2 var __create = Object.create;
3 var __defProp = Object.defineProperty;
4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5 var __getOwnPropNames = Object.getOwnPropertyNames;
6 var __getProtoOf = Object.getPrototypeOf;
7 var __hasOwnProp = Object.prototype.hasOwnProperty;
8 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9 var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
10 get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
11 }) : x2)(function(x2) {
12 if (typeof require !== "undefined")
13 return require.apply(this, arguments);
14 throw Error('Dynamic require of "' + x2 + '" is not supported');
16 var __commonJS = (cb, mod) => function __require2() {
17 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19 var __export = (target, all) => {
21 __defProp(target, name, { get: all[name], enumerable: true });
23 var __copyProps = (to, from, except, desc) => {
24 if (from && typeof from === "object" || typeof from === "function") {
25 for (let key of __getOwnPropNames(from))
26 if (!__hasOwnProp.call(to, key) && key !== except)
27 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
31 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32 // If the importer is in node compatibility mode or this is not an ESM
33 // file that has been converted to a CommonJS file using a Babel-
34 // compatible transform (i.e. "__esModule" has not been set), then set
35 // "default" to the CommonJS "module.exports" for node compatibility.
36 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
39 var __publicField = (obj, key, value) => {
40 __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
43 var __accessCheck = (obj, member, msg) => {
45 throw TypeError("Cannot " + msg);
47 var __privateAdd = (obj, member, value) => {
49 throw TypeError("Cannot add the same private member more than once");
50 member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
52 var __privateMethod = (obj, member, method) => {
53 __accessCheck(obj, member, "access private method");
57 // node_modules/diacritics/index.js
58 var require_diacritics = __commonJS({
59 "node_modules/diacritics/index.js"(exports2) {
60 exports2.remove = removeDiacritics2;
61 var replacementList = [
72 chars: "\u24B6\uFF21\xC0\xC1\xC2\u1EA6\u1EA4\u1EAA\u1EA8\xC3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\xC4\u01DE\u1EA2\xC5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F"
80 chars: "\xC6\u01FC\u01E2"
100 chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
104 chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
108 chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
116 chars: "\u01F1\u01C4"
120 chars: "\u01F2\u01C5"
124 chars: "\u025B\u24BA\uFF25\xC8\xC9\xCA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\xCB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E\u1D07"
128 chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
132 chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
136 chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
140 chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
144 chars: "\u24BF\uFF2A\u0134\u0248\u0237"
148 chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
152 chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
164 chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
168 chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
180 chars: "\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C"
200 chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
204 chars: "\u24C6\uFF31\uA756\uA758\u024A"
208 chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
212 chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
216 chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
228 chars: "\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244"
232 chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
240 chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
244 chars: "\u24CD\uFF38\u1E8A\u1E8C"
248 chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
252 chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
256 chars: "\u24D0\uFF41\u1E9A\xE0\xE1\xE2\u1EA7\u1EA5\u1EAB\u1EA9\xE3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\xE4\u01DF\u1EA3\xE5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0251"
264 chars: "\xE6\u01FD\u01E3"
276 chars: "\uA739\uA73B"
284 chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
288 chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
292 chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
300 chars: "\u01F3\u01C6"
304 chars: "\u24D4\uFF45\xE8\xE9\xEA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\xEB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u01DD"
308 chars: "\u24D5\uFF46\u1E1F\u0192"
332 chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
336 chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
344 chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
348 chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
352 chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
356 chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
364 chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
368 chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
376 chars: "\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\uA74B\uA74D\u0275\u0254\u1D11"
396 chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
400 chars: "\u24E0\uFF51\u024B\uA757\uA759"
404 chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
408 chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
416 chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
428 chars: "\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289"
432 chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
440 chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
444 chars: "\u24E7\uFF58\u1E8B\u1E8D"
448 chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
452 chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
455 var diacriticsMap = {};
456 for (i3 = 0; i3 < replacementList.length; i3 += 1) {
457 chars = replacementList[i3].chars;
458 for (j2 = 0; j2 < chars.length; j2 += 1) {
459 diacriticsMap[chars[j2]] = replacementList[i3].base;
465 function removeDiacritics2(str) {
466 return str.replace(/[^\u0000-\u007e]/g, function(c2) {
467 return diacriticsMap[c2] || c2;
470 exports2.replacementList = replacementList;
471 exports2.diacriticsMap = diacriticsMap;
475 // node_modules/alif-toolkit/lib/isArabic.js
476 var require_isArabic = __commonJS({
477 "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
479 Object.defineProperty(exports2, "__esModule", { value: true });
489 // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
491 function isArabic(char) {
492 if (char.length > 1) {
493 throw new Error("isArabic works on only one-character strings");
495 let code = char.charCodeAt(0);
496 for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
497 let block2 = arabicBlocks[i3];
498 if (code >= block2[0] && code <= block2[1]) {
504 exports2.isArabic = isArabic;
505 function isMath(char) {
506 if (char.length > 2) {
507 throw new Error("isMath works on only one-character strings");
509 let code = char.charCodeAt(0);
510 return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
512 exports2.isMath = isMath;
516 // node_modules/alif-toolkit/lib/unicode-arabic.js
517 var require_unicode_arabic = __commonJS({
518 "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
520 Object.defineProperty(exports2, "__esModule", { value: true });
521 var arabicReference = {
531 "isolated": "\uFE81",
539 "isolated": "\uFE83",
547 "isolated": "\uFE87",
552 "isolated": "\uFB50",
555 "wavy_hamza_above": [
558 "wavy_hamza_below": [
569 "indic_three_above": [
579 "isolated": "\uFE8D",
589 "three_dots_horizontally_below": [
592 "dot_below_three_dots_above": [
595 "three_dots_pointing_upwards_below": [
598 "three_dots_pointing_upwards_below_two_dots_above": [
601 "two_dots_below_dot_above": [
604 "inverted_small_v_below": [
616 "small_meem_above": [
619 "isolated": "\uFE8F",
628 "isolated": "\uFE93",
638 "three_dots_above_downwards": [
644 "isolated": "\uFE95",
653 "isolated": "\uFE99",
665 "isolated": "\uFE9D",
677 "two_dots_vertical_above": [
680 "three_dots_above": [
686 "three_dots_pointing_upwards_below": [
692 "small_tah_two_dots": [
698 "indic_four_below": [
701 "isolated": "\uFEA1",
710 "isolated": "\uFEA5",
725 "dot_below_small_tah": [
728 "three_dots_above_downwards": [
737 "two_dots_vertically_below_small_tah": [
740 "inverted_small_v_below": [
743 "three_dots_below": [
746 "isolated": "\uFEA9",
753 "isolated": "\uFEAB",
772 "dot_below_dot_above": [
787 "two_dots_vertically_above": [
793 "small_tah_two_dots": [
799 "small_noon_above": [
802 "isolated": "\uFEAD",
809 "inverted_v_above": [
812 "isolated": "\uFEAF",
819 "dot_below_dot_above": [
822 "three_dots_below": [
825 "three_dots_below_three_dots_above": [
831 "two_dots_vertically_above": [
834 "small_tah_two_dots": [
837 "indic_four_above": [
843 "isolated": "\uFEB1",
855 "isolated": "\uFEB5",
867 "three_dots_above": [
870 "three_dots_below": [
873 "isolated": "\uFEB9",
885 "isolated": "\uFEBD",
894 "three_dots_above": [
900 "isolated": "\uFEC1",
909 "isolated": "\uFEC5",
918 "three_dots_above": [
924 "three_dots_pointing_downwards_above": [
927 "two_dots_vertically_above": [
930 "three_dots_below": [
933 "isolated": "\uFEC9",
945 "isolated": "\uFECD",
963 "three_dots_below": [
969 "three_dots_pointing_upwards_below": [
972 "dot_below_three_dots_above": [
975 "isolated": "\uFED1",
990 "three_dots_above": [
996 "isolated": "\uFED5",
1014 "three_dots_below": [
1023 "isolated": "\uFED9",
1025 "initial": "\uFEDB",
1038 "three_dots_above": [
1041 "three_dots_below": [
1050 "isolated": "\uFEDD",
1052 "initial": "\uFEDF",
1065 "three_dots_above": [
1068 "isolated": "\uFEE1",
1070 "initial": "\uFEE3",
1083 "three_dots_above": [
1095 "isolated": "\uFEE5",
1097 "initial": "\uFEE7",
1104 "isolated": "\uFEE9",
1106 "initial": "\uFEEB",
1118 "isolated": "\uFE85",
1134 "indic_two_above": [
1137 "indic_three_above": [
1143 "isolated": "\uFEED",
1154 "initial": "\uFBE8",
1156 "isolated": "\uFEEF",
1168 "isolated": "\uFE89",
1170 "initial": "\uFE8B",
1173 "two_dots_below_hamza_above": [
1186 "three_dots_below": [
1189 "two_dots_below_dot_above": [
1192 "two_dots_below_small_noon_above": [
1195 "isolated": "\uFEF1",
1197 "initial": "\uFEF3",
1204 "isolated": "\uFB66",
1206 "initial": "\uFB68",
1213 "isolated": "\uFB5E",
1215 "initial": "\uFB60",
1222 "isolated": "\uFB52",
1224 "initial": "\uFB54",
1231 "small_meem_above": [
1234 "isolated": "\uFB56",
1236 "initial": "\uFB58",
1243 "isolated": "\uFB62",
1245 "initial": "\uFB64",
1252 "isolated": "\uFB5A",
1254 "initial": "\uFB5C",
1261 "isolated": "\uFB76",
1263 "initial": "\uFB78",
1270 "isolated": "\uFB72",
1272 "initial": "\uFB74",
1282 "isolated": "\uFB7A",
1284 "initial": "\uFB7C",
1291 "isolated": "\uFB7E",
1293 "initial": "\uFB80",
1300 "isolated": "\uFB88",
1307 "isolated": "\uFB84",
1314 "isolated": "\uFB82",
1322 "isolated": "\uFB86",
1329 "isolated": "\uFB8C",
1336 "isolated": "\uFB8A",
1343 "isolated": "\uFB6A",
1345 "initial": "\uFB6C",
1352 "isolated": "\uFB6E",
1354 "initial": "\uFB70",
1364 "three_dots_above": [
1367 "three_dots_pointing_upwards_below": [
1370 "isolated": "\uFB8E",
1372 "initial": "\uFB90",
1379 "isolated": "\uFBD3",
1381 "initial": "\uFBD5",
1394 "three_dots_above": [
1397 "inverted_stroke": [
1400 "isolated": "\uFB92",
1402 "initial": "\uFB94",
1409 "isolated": "\uFB9A",
1411 "initial": "\uFB9C",
1418 "isolated": "\uFB96",
1420 "initial": "\uFB98",
1427 "isolated": "\uFB9E",
1434 "isolated": "\uFBA0",
1436 "initial": "\uFBA2",
1439 "heh doachashmee": {
1443 "isolated": "\uFBAA",
1445 "initial": "\uFBAC",
1456 "isolated": "\uFBA6",
1458 "initial": "\uFBA8",
1461 "teh marbuta goal": {
1470 "isolated": "\uFBE0",
1477 "isolated": "\uFBD9",
1489 "isolated": "\uFBDD"
1491 "isolated": "\uFBD7",
1498 "isolated": "\uFBDB",
1505 "isolated": "\uFBE2",
1512 "isolated": "\uFBDE",
1519 "indic_two_above": [
1522 "indic_three_above": [
1525 "indic_four_above": [
1528 "isolated": "\uFBFC",
1530 "initial": "\uFBFE",
1537 "isolated": "\uFBE4",
1539 "initial": "\uFBE6",
1551 "isolated": "\uFBB0",
1554 "indic_two_above": [
1557 "indic_three_above": [
1560 "isolated": "\uFBAE",
1567 "isolated": "\u06D5",
1574 "isolated": "\uFBA4",
1609 exports2.default = arabicReference;
1613 // node_modules/alif-toolkit/lib/unicode-ligatures.js
1614 var require_unicode_ligatures = __commonJS({
1615 "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1617 Object.defineProperty(exports2, "__esModule", { value: true });
1618 var ligatureReference = {
1620 "isolated": "\uFBEA",
1624 "isolated": "\uFBEC",
1628 "isolated": "\uFBEE",
1632 "isolated": "\uFBF0",
1636 "isolated": "\uFBF2",
1640 "isolated": "\uFBF4",
1644 "isolated": "\uFBF6",
1650 "isolated": "\uFBF9",
1654 "isolated": "\uFC03",
1658 "isolated": "\uFC00",
1662 "isolated": "\uFC01",
1666 "isolated": "\uFC02",
1668 "initial": "\uFC9A",
1672 "isolated": "\uFC04",
1676 "isolated": "\uFC05",
1680 "isolated": "\uFC06",
1684 "isolated": "\uFC07",
1688 "isolated": "\uFC08",
1690 "initial": "\uFC9F",
1694 "isolated": "\uFC09",
1698 "isolated": "\uFC0A",
1702 "isolated": "\uFC0B",
1706 "isolated": "\uFC0C",
1710 "isolated": "\uFC0D",
1714 "isolated": "\uFC0E",
1716 "initial": "\uFCA4",
1720 "isolated": "\uFC0F",
1724 "isolated": "\uFC10",
1728 "isolated": "\uFC11"
1731 "isolated": "\uFC12",
1733 "initial": "\uFCA6",
1737 "isolated": "\uFC13",
1741 "isolated": "\uFC14"
1744 "isolated": "\uFC15",
1748 "isolated": "\uFC16",
1752 "isolated": "\uFC17",
1756 "isolated": "\uFC18",
1760 "isolated": "\uFC19",
1764 "isolated": "\uFC1A"
1767 "isolated": "\uFC1B",
1771 "isolated": "\uFC1C",
1772 "initial": "\uFCAD",
1776 "isolated": "\uFC1D",
1777 "initial": "\uFCAE",
1781 "isolated": "\uFC1E",
1782 "initial": "\uFCAF",
1786 "isolated": "\uFC1F",
1787 "initial": "\uFCB0",
1791 "isolated": "\uFC20",
1795 "isolated": "\uFC21",
1799 "isolated": "\uFC22",
1803 "isolated": "\uFC23",
1807 "isolated": "\uFC24",
1811 "isolated": "\uFC25",
1815 "isolated": "\uFC26",
1819 "isolated": "\uFC27",
1820 "initial": "\uFD33",
1824 "isolated": "\uFC28",
1825 "initial": "\uFCB9",
1829 "isolated": "\uFC29",
1833 "isolated": "\uFC2A",
1837 "isolated": "\uFC2B",
1841 "isolated": "\uFC2C",
1845 "isolated": "\uFC2D",
1849 "isolated": "\uFC2E",
1853 "isolated": "\uFC2F",
1857 "isolated": "\uFC30",
1861 "isolated": "\uFC31",
1865 "isolated": "\uFC32",
1869 "isolated": "\uFC33",
1873 "isolated": "\uFC34",
1877 "isolated": "\uFC35",
1881 "isolated": "\uFC36",
1885 "isolated": "\uFC37",
1889 "isolated": "\uFC38",
1893 "isolated": "\uFC39",
1897 "isolated": "\uFC3A",
1901 "isolated": "\uFC3B",
1903 "initial": "\uFCC7",
1907 "isolated": "\uFC3C",
1909 "initial": "\uFCC8",
1913 "isolated": "\uFC3D",
1917 "isolated": "\uFC3E",
1921 "isolated": "\uFC3F",
1925 "isolated": "\uFC40",
1929 "isolated": "\uFC41",
1933 "isolated": "\uFC42",
1935 "initial": "\uFCCC",
1939 "isolated": "\uFC43",
1943 "isolated": "\uFC44",
1947 "isolated": "\uFC45",
1951 "isolated": "\uFC46",
1955 "isolated": "\uFC47",
1959 "isolated": "\uFC48",
1964 "isolated": "\uFC49"
1967 "isolated": "\uFC4A"
1970 "isolated": "\uFC4B",
1974 "isolated": "\uFC4C",
1978 "isolated": "\uFC4D",
1982 "isolated": "\uFC4E",
1984 "initial": "\uFCD5",
1988 "isolated": "\uFC4F",
1992 "isolated": "\uFC50",
1996 "isolated": "\uFC51",
2000 "isolated": "\uFC52",
2004 "isolated": "\uFC53"
2007 "isolated": "\uFC54"
2010 "isolated": "\uFC55",
2014 "isolated": "\uFC56",
2018 "isolated": "\uFC57",
2022 "isolated": "\uFC58",
2024 "initial": "\uFCDD",
2028 "isolated": "\uFC59",
2032 "isolated": "\uFC5A",
2036 "isolated": "\uFC5B"
2039 "isolated": "\uFC5C"
2042 "isolated": "\uFC5D",
2046 "isolated": "\uFC5E"
2049 "isolated": "\uFC5F"
2052 "isolated": "\uFC60"
2055 "isolated": "\uFC61"
2058 "isolated": "\uFC62"
2061 "isolated": "\uFC63"
2127 "initial": "\uFC9B",
2131 "initial": "\uFCA0",
2135 "initial": "\uFCA5",
2145 "initial": "\uFCD6",
2152 "initial": "\uFCDE",
2164 "isolated": "\uFD0C",
2172 "\u0640\u064E\u0651": {
2175 "\u0640\u064F\u0651": {
2178 "\u0640\u0650\u0651": {
2182 "isolated": "\uFCF5",
2186 "isolated": "\uFCF6",
2190 "isolated": "\uFCF7",
2194 "isolated": "\uFCF8",
2198 "isolated": "\uFCF9",
2202 "isolated": "\uFCFA",
2206 "isolated": "\uFCFB"
2209 "isolated": "\uFCFC",
2213 "isolated": "\uFCFD",
2217 "isolated": "\uFCFE",
2221 "isolated": "\uFCFF",
2225 "isolated": "\uFD00",
2229 "isolated": "\uFD01",
2233 "isolated": "\uFD02",
2237 "isolated": "\uFD03",
2241 "isolated": "\uFD04",
2245 "isolated": "\uFD05",
2249 "isolated": "\uFD06",
2253 "isolated": "\uFD07",
2257 "isolated": "\uFD08",
2261 "isolated": "\uFD09",
2263 "initial": "\uFD2D",
2267 "isolated": "\uFD0A",
2269 "initial": "\uFD2E",
2273 "isolated": "\uFD0B",
2275 "initial": "\uFD2F",
2279 "isolated": "\uFD0D",
2283 "isolated": "\uFD0E",
2287 "isolated": "\uFD0F",
2291 "isolated": "\uFD10",
2297 "\u062A\u062C\u0645": {
2300 "\u062A\u062D\u062C": {
2304 "\u062A\u062D\u0645": {
2307 "\u062A\u062E\u0645": {
2310 "\u062A\u0645\u062C": {
2313 "\u062A\u0645\u062D": {
2316 "\u062A\u0645\u062E": {
2319 "\u062C\u0645\u062D": {
2323 "\u062D\u0645\u064A": {
2326 "\u062D\u0645\u0649": {
2329 "\u0633\u062D\u062C": {
2332 "\u0633\u062C\u062D": {
2335 "\u0633\u062C\u0649": {
2338 "\u0633\u0645\u062D": {
2342 "\u0633\u0645\u062C": {
2345 "\u0633\u0645\u0645": {
2349 "\u0635\u062D\u062D": {
2353 "\u0635\u0645\u0645": {
2357 "\u0634\u062D\u0645": {
2361 "\u0634\u062C\u064A": {
2364 "\u0634\u0645\u062E": {
2368 "\u0634\u0645\u0645": {
2372 "\u0636\u062D\u0649": {
2375 "\u0636\u062E\u0645": {
2379 "\u0636\u0645\u062D": {
2382 "\u0637\u0645\u062D": {
2385 "\u0637\u0645\u0645": {
2388 "\u0637\u0645\u064A": {
2391 "\u0639\u062C\u0645": {
2395 "\u0639\u0645\u0645": {
2399 "\u0639\u0645\u0649": {
2402 "\u063A\u0645\u0645": {
2405 "\u063A\u0645\u064A": {
2408 "\u063A\u0645\u0649": {
2411 "\u0641\u062E\u0645": {
2415 "\u0642\u0645\u062D": {
2419 "\u0642\u0645\u0645": {
2422 "\u0644\u062D\u0645": {
2426 "\u0644\u062D\u064A": {
2429 "\u0644\u062D\u0649": {
2432 "\u0644\u062C\u062C": {
2433 "initial": "\uFD83",
2436 "\u0644\u062E\u0645": {
2440 "\u0644\u0645\u062D": {
2444 "\u0645\u062D\u062C": {
2447 "\u0645\u062D\u0645": {
2450 "\u0645\u062D\u064A": {
2453 "\u0645\u062C\u062D": {
2456 "\u0645\u062C\u0645": {
2459 "\u0645\u062E\u062C": {
2462 "\u0645\u062E\u0645": {
2465 "\u0645\u062C\u062E": {
2468 "\u0647\u0645\u062C": {
2471 "\u0647\u0645\u0645": {
2474 "\u0646\u062D\u0645": {
2477 "\u0646\u062D\u0649": {
2480 "\u0646\u062C\u0645": {
2484 "\u0646\u062C\u0649": {
2487 "\u0646\u0645\u064A": {
2490 "\u0646\u0645\u0649": {
2493 "\u064A\u0645\u0645": {
2497 "\u0628\u062E\u064A": {
2500 "\u062A\u062C\u064A": {
2503 "\u062A\u062C\u0649": {
2506 "\u062A\u062E\u064A": {
2509 "\u062A\u062E\u0649": {
2512 "\u062A\u0645\u064A": {
2515 "\u062A\u0645\u0649": {
2518 "\u062C\u0645\u064A": {
2521 "\u062C\u062D\u0649": {
2524 "\u062C\u0645\u0649": {
2527 "\u0633\u062E\u0649": {
2530 "\u0635\u062D\u064A": {
2533 "\u0634\u062D\u064A": {
2536 "\u0636\u062D\u064A": {
2539 "\u0644\u062C\u064A": {
2542 "\u0644\u0645\u064A": {
2545 "\u064A\u062D\u064A": {
2548 "\u064A\u062C\u064A": {
2551 "\u064A\u0645\u064A": {
2554 "\u0645\u0645\u064A": {
2557 "\u0642\u0645\u064A": {
2560 "\u0646\u062D\u064A": {
2563 "\u0639\u0645\u064A": {
2566 "\u0643\u0645\u064A": {
2569 "\u0646\u062C\u062D": {
2570 "initial": "\uFDB8",
2573 "\u0645\u062E\u064A": {
2576 "\u0644\u062C\u0645": {
2577 "initial": "\uFDBA",
2580 "\u0643\u0645\u0645": {
2584 "\u062C\u062D\u064A": {
2587 "\u062D\u062C\u064A": {
2590 "\u0645\u062C\u064A": {
2593 "\u0641\u0645\u064A": {
2596 "\u0628\u062D\u064A": {
2599 "\u0633\u062E\u064A": {
2602 "\u0646\u062C\u064A": {
2606 "isolated": "\uFEF5",
2610 "isolated": "\uFEF7",
2614 "isolated": "\uFEF9",
2618 "isolated": "\uFEFB",
2622 "\u0635\u0644\u06D2": "\uFDF0",
2623 "\u0642\u0644\u06D2": "\uFDF1",
2624 "\u0627\u0644\u0644\u0647": "\uFDF2",
2625 "\u0627\u0643\u0628\u0631": "\uFDF3",
2626 "\u0645\u062D\u0645\u062F": "\uFDF4",
2627 "\u0635\u0644\u0639\u0645": "\uFDF5",
2628 "\u0631\u0633\u0648\u0644": "\uFDF6",
2629 "\u0639\u0644\u064A\u0647": "\uFDF7",
2630 "\u0648\u0633\u0644\u0645": "\uFDF8",
2631 "\u0635\u0644\u0649": "\uFDF9",
2632 "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2633 "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2634 "\u0631\u06CC\u0627\u0644": "\uFDFC"
2637 exports2.default = ligatureReference;
2641 // node_modules/alif-toolkit/lib/reference.js
2642 var require_reference = __commonJS({
2643 "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2645 Object.defineProperty(exports2, "__esModule", { value: true });
2646 var unicode_arabic_1 = require_unicode_arabic();
2647 var unicode_ligatures_1 = require_unicode_ligatures();
2648 var letterList = Object.keys(unicode_arabic_1.default);
2649 exports2.letterList = letterList;
2650 var ligatureList = Object.keys(unicode_ligatures_1.default);
2651 exports2.ligatureList = ligatureList;
2652 var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2653 exports2.ligatureWordList = ligatureWordList;
2654 var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2655 exports2.lams = lams;
2656 var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2657 exports2.alefs = alefs;
2658 var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2659 exports2.tashkeel = tashkeel;
2660 function addToTashkeel(start2, finish) {
2661 for (var i3 = start2; i3 <= finish; i3++) {
2662 exports2.tashkeel = tashkeel += String.fromCharCode(i3);
2665 addToTashkeel(1552, 1562);
2666 addToTashkeel(1611, 1631);
2667 addToTashkeel(1750, 1756);
2668 addToTashkeel(1760, 1764);
2669 addToTashkeel(1770, 1773);
2670 addToTashkeel(2259, 2273);
2671 addToTashkeel(2275, 2303);
2672 addToTashkeel(65136, 65151);
2673 var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2674 exports2.lineBreakers = lineBreakers;
2675 function addToLineBreakers(start2, finish) {
2676 for (var i3 = start2; i3 <= finish; i3++) {
2677 exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
2680 addToLineBreakers(1536, 1567);
2681 addToLineBreakers(1569, 1573);
2682 addToLineBreakers(1583, 1586);
2683 addToLineBreakers(1632, 1645);
2684 addToLineBreakers(1649, 1655);
2685 addToLineBreakers(1672, 1689);
2686 addToLineBreakers(1731, 1739);
2687 addToLineBreakers(1746, 1785);
2688 addToLineBreakers(1881, 1883);
2689 addToLineBreakers(2218, 2222);
2690 addToLineBreakers(64336, 65021);
2691 addToLineBreakers(65152, 65276);
2692 addToLineBreakers(69216, 69247);
2693 addToLineBreakers(126064, 126143);
2694 addToLineBreakers(126464, 126719);
2698 // node_modules/alif-toolkit/lib/GlyphSplitter.js
2699 var require_GlyphSplitter = __commonJS({
2700 "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2702 Object.defineProperty(exports2, "__esModule", { value: true });
2703 var isArabic_1 = require_isArabic();
2704 var reference_1 = require_reference();
2705 function GlyphSplitter(word) {
2707 let lastLetter = "";
2708 word.split("").forEach((letter) => {
2709 if (isArabic_1.isArabic(letter)) {
2710 if (reference_1.tashkeel.indexOf(letter) > -1) {
2711 letters[letters.length - 1] += letter;
2712 } else if (lastLetter.length && (reference_1.lams.indexOf(lastLetter) === 0 && reference_1.alefs.indexOf(letter) > -1 || reference_1.lams.indexOf(lastLetter) > 0 && reference_1.alefs.indexOf(letter) === 0)) {
2713 letters[letters.length - 1] += letter;
2715 letters.push(letter);
2718 letters.push(letter);
2720 if (reference_1.tashkeel.indexOf(letter) === -1) {
2721 lastLetter = letter;
2726 exports2.GlyphSplitter = GlyphSplitter;
2730 // node_modules/alif-toolkit/lib/BaselineSplitter.js
2731 var require_BaselineSplitter = __commonJS({
2732 "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2734 Object.defineProperty(exports2, "__esModule", { value: true });
2735 var isArabic_1 = require_isArabic();
2736 var reference_1 = require_reference();
2737 function BaselineSplitter(word) {
2739 let lastLetter = "";
2740 word.split("").forEach((letter) => {
2741 if (isArabic_1.isArabic(letter) && isArabic_1.isArabic(lastLetter)) {
2742 if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2743 letters[letters.length - 1] += letter;
2744 } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2745 letters.push(letter);
2747 letters[letters.length - 1] += letter;
2750 letters.push(letter);
2752 if (reference_1.tashkeel.indexOf(letter) === -1) {
2753 lastLetter = letter;
2758 exports2.BaselineSplitter = BaselineSplitter;
2762 // node_modules/alif-toolkit/lib/Normalization.js
2763 var require_Normalization = __commonJS({
2764 "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2766 Object.defineProperty(exports2, "__esModule", { value: true });
2767 var unicode_arabic_1 = require_unicode_arabic();
2768 var unicode_ligatures_1 = require_unicode_ligatures();
2769 var isArabic_1 = require_isArabic();
2770 var reference_1 = require_reference();
2771 function Normal(word, breakPresentationForm) {
2772 if (typeof breakPresentationForm === "undefined") {
2773 breakPresentationForm = true;
2775 let returnable = "";
2776 word.split("").forEach((letter) => {
2777 if (!isArabic_1.isArabic(letter)) {
2778 returnable += letter;
2781 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2782 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2783 let versions = Object.keys(letterForms);
2784 for (let v2 = 0; v2 < versions.length; v2++) {
2785 let localVersion = letterForms[versions[v2]];
2786 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2787 let embeddedForms = Object.keys(localVersion);
2788 for (let ef = 0; ef < embeddedForms.length; ef++) {
2789 let form = localVersion[embeddedForms[ef]];
2790 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2791 if (form === letter) {
2792 if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2793 if (typeof localVersion["normal"] === "object") {
2794 returnable += localVersion["normal"][0];
2796 returnable += localVersion["normal"];
2800 returnable += letter;
2802 } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2803 returnable += form[0];
2808 } else if (localVersion === letter) {
2809 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
2810 if (typeof letterForms["normal"] === "object") {
2811 returnable += letterForms["normal"][0];
2813 returnable += letterForms["normal"];
2817 returnable += letter;
2819 } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2820 returnable += localVersion[0];
2825 for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2826 let normalForm = reference_1.ligatureList[v2];
2827 if (normalForm !== "words") {
2828 let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2829 for (let f2 = 0; f2 < ligForms.length; f2++) {
2830 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2831 returnable += normalForm;
2837 for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2838 let normalForm = reference_1.ligatureWordList[v3];
2839 if (unicode_ligatures_1.default.words[normalForm] === letter) {
2840 returnable += normalForm;
2844 returnable += letter;
2848 exports2.Normal = Normal;
2852 // node_modules/alif-toolkit/lib/CharShaper.js
2853 var require_CharShaper = __commonJS({
2854 "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2856 Object.defineProperty(exports2, "__esModule", { value: true });
2857 var unicode_arabic_1 = require_unicode_arabic();
2858 var isArabic_1 = require_isArabic();
2859 var reference_1 = require_reference();
2860 function CharShaper(letter, form) {
2861 if (!isArabic_1.isArabic(letter)) {
2862 throw new Error("Not Arabic");
2864 if (letter === "\u0621") {
2867 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2868 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2869 let versions = Object.keys(letterForms);
2870 for (let v2 = 0; v2 < versions.length; v2++) {
2871 let localVersion = letterForms[versions[v2]];
2872 if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2873 if (versions.indexOf(form) > -1) {
2874 return letterForms[form];
2876 } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2877 let embeddedVersions = Object.keys(localVersion);
2878 for (let ev = 0; ev < embeddedVersions.length; ev++) {
2879 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2880 if (embeddedVersions.indexOf(form) > -1) {
2881 return localVersion[form];
2889 exports2.CharShaper = CharShaper;
2893 // node_modules/alif-toolkit/lib/WordShaper.js
2894 var require_WordShaper = __commonJS({
2895 "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2897 Object.defineProperty(exports2, "__esModule", { value: true });
2898 var isArabic_1 = require_isArabic();
2899 var reference_1 = require_reference();
2900 var CharShaper_1 = require_CharShaper();
2901 var unicode_ligatures_1 = require_unicode_ligatures();
2902 function WordShaper2(word) {
2903 let state = "initial";
2905 for (let w2 = 0; w2 < word.length; w2++) {
2906 let nextLetter = " ";
2907 for (let nxw = w2 + 1; nxw < word.length; nxw++) {
2908 if (!isArabic_1.isArabic(word[nxw])) {
2911 if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2912 nextLetter = word[nxw];
2916 if (!isArabic_1.isArabic(word[w2]) || isArabic_1.isMath(word[w2])) {
2919 } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
2921 } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
2922 output += CharShaper_1.CharShaper(word[w2], state === "initial" ? "isolated" : "final");
2924 } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2925 output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
2926 while (word[w2] !== nextLetter) {
2931 output += CharShaper_1.CharShaper(word[w2], state);
2937 exports2.WordShaper = WordShaper2;
2941 // node_modules/alif-toolkit/lib/ParentLetter.js
2942 var require_ParentLetter = __commonJS({
2943 "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2945 Object.defineProperty(exports2, "__esModule", { value: true });
2946 var unicode_arabic_1 = require_unicode_arabic();
2947 var isArabic_1 = require_isArabic();
2948 var reference_1 = require_reference();
2949 function ParentLetter(letter) {
2950 if (!isArabic_1.isArabic(letter)) {
2951 throw new Error("Not an Arabic letter");
2953 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2954 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2955 let versions = Object.keys(letterForms);
2956 for (let v2 = 0; v2 < versions.length; v2++) {
2957 let localVersion = letterForms[versions[v2]];
2958 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2959 let embeddedForms = Object.keys(localVersion);
2960 for (let ef = 0; ef < embeddedForms.length; ef++) {
2961 let form = localVersion[embeddedForms[ef]];
2962 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2963 return localVersion;
2966 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2973 exports2.ParentLetter = ParentLetter;
2974 function GrandparentLetter(letter) {
2975 if (!isArabic_1.isArabic(letter)) {
2976 throw new Error("Not an Arabic letter");
2978 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2979 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2980 let versions = Object.keys(letterForms);
2981 for (let v2 = 0; v2 < versions.length; v2++) {
2982 let localVersion = letterForms[versions[v2]];
2983 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2984 let embeddedForms = Object.keys(localVersion);
2985 for (let ef = 0; ef < embeddedForms.length; ef++) {
2986 let form = localVersion[embeddedForms[ef]];
2987 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2991 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2998 exports2.GrandparentLetter = GrandparentLetter;
3002 // node_modules/alif-toolkit/lib/index.js
3003 var require_lib = __commonJS({
3004 "node_modules/alif-toolkit/lib/index.js"(exports2) {
3006 Object.defineProperty(exports2, "__esModule", { value: true });
3007 var isArabic_1 = require_isArabic();
3008 exports2.isArabic = isArabic_1.isArabic;
3009 var GlyphSplitter_1 = require_GlyphSplitter();
3010 exports2.GlyphSplitter = GlyphSplitter_1.GlyphSplitter;
3011 var BaselineSplitter_1 = require_BaselineSplitter();
3012 exports2.BaselineSplitter = BaselineSplitter_1.BaselineSplitter;
3013 var Normalization_1 = require_Normalization();
3014 exports2.Normal = Normalization_1.Normal;
3015 var CharShaper_1 = require_CharShaper();
3016 exports2.CharShaper = CharShaper_1.CharShaper;
3017 var WordShaper_1 = require_WordShaper();
3018 exports2.WordShaper = WordShaper_1.WordShaper;
3019 var ParentLetter_1 = require_ParentLetter();
3020 exports2.ParentLetter = ParentLetter_1.ParentLetter;
3021 exports2.GrandparentLetter = ParentLetter_1.GrandparentLetter;
3025 // node_modules/vparse/index.js
3026 var require_vparse = __commonJS({
3027 "node_modules/vparse/index.js"(exports2, module2) {
3028 (function(window2) {
3030 function parseVersion3(v2) {
3031 var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3038 v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
3039 v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
3040 v2.text = v2.parsed.join(".");
3041 v2.compare = compare2;
3044 function compare2(v2) {
3045 if (typeof v2 === "string") {
3046 v2 = parseVersion3(v2);
3048 for (var i3 = 0; i3 < 4; i3++) {
3049 if (this.parsed[i3] !== v2.parsed[i3]) {
3050 return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
3055 if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3056 module2.exports = parseVersion3;
3058 window2.parseVersion = parseVersion3;
3064 // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3065 var require_quickselect = __commonJS({
3066 "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3067 (function(global2, factory) {
3068 typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
3069 })(exports2, function() {
3071 function quickselect2(arr, k2, left, right, compare2) {
3072 quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare);
3074 function quickselectStep(arr, k2, left, right, compare2) {
3075 while (right > left) {
3076 if (right - left > 600) {
3077 var n3 = right - left + 1;
3078 var m2 = k2 - left + 1;
3079 var z2 = Math.log(n3);
3080 var s2 = 0.5 * Math.exp(2 * z2 / 3);
3081 var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
3082 var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
3083 var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
3084 quickselectStep(arr, k2, newLeft, newRight, compare2);
3089 swap2(arr, left, k2);
3090 if (compare2(arr[right], t2) > 0)
3091 swap2(arr, left, right);
3096 while (compare2(arr[i3], t2) < 0)
3098 while (compare2(arr[j2], t2) > 0)
3101 if (compare2(arr[left], t2) === 0)
3102 swap2(arr, left, j2);
3105 swap2(arr, j2, right);
3113 function swap2(arr, i3, j2) {
3118 function defaultCompare(a2, b2) {
3119 return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
3121 return quickselect2;
3126 // node_modules/which-polygon/node_modules/rbush/index.js
3127 var require_rbush = __commonJS({
3128 "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3130 module2.exports = rbush;
3131 module2.exports.default = rbush;
3132 var quickselect2 = require_quickselect();
3133 function rbush(maxEntries, format2) {
3134 if (!(this instanceof rbush))
3135 return new rbush(maxEntries, format2);
3136 this._maxEntries = Math.max(4, maxEntries || 9);
3137 this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3139 this._initFormat(format2);
3145 return this._all(this.data, []);
3147 search: function(bbox2) {
3148 var node = this.data, result = [], toBBox = this.toBBox;
3149 if (!intersects(bbox2, node))
3151 var nodesToSearch = [], i3, len, child, childBBox;
3153 for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3154 child = node.children[i3];
3155 childBBox = node.leaf ? toBBox(child) : child;
3156 if (intersects(bbox2, childBBox)) {
3159 else if (contains(bbox2, childBBox))
3160 this._all(child, result);
3162 nodesToSearch.push(child);
3165 node = nodesToSearch.pop();
3169 collides: function(bbox2) {
3170 var node = this.data, toBBox = this.toBBox;
3171 if (!intersects(bbox2, node))
3173 var nodesToSearch = [], i3, len, child, childBBox;
3175 for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3176 child = node.children[i3];
3177 childBBox = node.leaf ? toBBox(child) : child;
3178 if (intersects(bbox2, childBBox)) {
3179 if (node.leaf || contains(bbox2, childBBox))
3181 nodesToSearch.push(child);
3184 node = nodesToSearch.pop();
3188 load: function(data) {
3189 if (!(data && data.length))
3191 if (data.length < this._minEntries) {
3192 for (var i3 = 0, len = data.length; i3 < len; i3++) {
3193 this.insert(data[i3]);
3197 var node = this._build(data.slice(), 0, data.length - 1, 0);
3198 if (!this.data.children.length) {
3200 } else if (this.data.height === node.height) {
3201 this._splitRoot(this.data, node);
3203 if (this.data.height < node.height) {
3204 var tmpNode = this.data;
3208 this._insert(node, this.data.height - node.height - 1, true);
3212 insert: function(item) {
3214 this._insert(item, this.data.height - 1);
3218 this.data = createNode([]);
3221 remove: function(item, equalsFn) {
3224 var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
3225 while (node || path.length) {
3228 parent = path[path.length - 1];
3233 index = findItem(item, node.children, equalsFn);
3235 node.children.splice(index, 1);
3237 this._condense(path);
3241 if (!goingUp && !node.leaf && contains(node, bbox2)) {
3246 node = node.children[0];
3247 } else if (parent) {
3249 node = parent.children[i3];
3256 toBBox: function(item) {
3259 compareMinX: compareNodeMinX,
3260 compareMinY: compareNodeMinY,
3261 toJSON: function() {
3264 fromJSON: function(data) {
3268 _all: function(node, result) {
3269 var nodesToSearch = [];
3272 result.push.apply(result, node.children);
3274 nodesToSearch.push.apply(nodesToSearch, node.children);
3275 node = nodesToSearch.pop();
3279 _build: function(items, left, right, height) {
3280 var N2 = right - left + 1, M2 = this._maxEntries, node;
3282 node = createNode(items.slice(left, right + 1));
3283 calcBBox(node, this.toBBox);
3287 height = Math.ceil(Math.log(N2) / Math.log(M2));
3288 M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
3290 node = createNode([]);
3292 node.height = height;
3293 var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j2, right2, right3;
3294 multiSelect(items, left, right, N1, this.compareMinX);
3295 for (i3 = left; i3 <= right; i3 += N1) {
3296 right2 = Math.min(i3 + N1 - 1, right);
3297 multiSelect(items, i3, right2, N22, this.compareMinY);
3298 for (j2 = i3; j2 <= right2; j2 += N22) {
3299 right3 = Math.min(j2 + N22 - 1, right2);
3300 node.children.push(this._build(items, j2, right3, height - 1));
3303 calcBBox(node, this.toBBox);
3306 _chooseSubtree: function(bbox2, node, level, path) {
3307 var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3310 if (node.leaf || path.length - 1 === level)
3312 minArea = minEnlargement = Infinity;
3313 for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3314 child = node.children[i3];
3315 area = bboxArea(child);
3316 enlargement = enlargedArea(bbox2, child) - area;
3317 if (enlargement < minEnlargement) {
3318 minEnlargement = enlargement;
3319 minArea = area < minArea ? area : minArea;
3321 } else if (enlargement === minEnlargement) {
3322 if (area < minArea) {
3328 node = targetNode || node.children[0];
3332 _insert: function(item, level, isNode) {
3333 var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3334 var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3335 node.children.push(item);
3336 extend2(node, bbox2);
3337 while (level >= 0) {
3338 if (insertPath[level].children.length > this._maxEntries) {
3339 this._split(insertPath, level);
3344 this._adjustParentBBoxes(bbox2, insertPath, level);
3346 // split overflowed node into two
3347 _split: function(insertPath, level) {
3348 var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
3349 this._chooseSplitAxis(node, m2, M2);
3350 var splitIndex = this._chooseSplitIndex(node, m2, M2);
3351 var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
3352 newNode.height = node.height;
3353 newNode.leaf = node.leaf;
3354 calcBBox(node, this.toBBox);
3355 calcBBox(newNode, this.toBBox);
3357 insertPath[level - 1].children.push(newNode);
3359 this._splitRoot(node, newNode);
3361 _splitRoot: function(node, newNode) {
3362 this.data = createNode([node, newNode]);
3363 this.data.height = node.height + 1;
3364 this.data.leaf = false;
3365 calcBBox(this.data, this.toBBox);
3367 _chooseSplitIndex: function(node, m2, M2) {
3368 var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3369 minOverlap = minArea = Infinity;
3370 for (i3 = m2; i3 <= M2 - m2; i3++) {
3371 bbox1 = distBBox(node, 0, i3, this.toBBox);
3372 bbox2 = distBBox(node, i3, M2, this.toBBox);
3373 overlap = intersectionArea(bbox1, bbox2);
3374 area = bboxArea(bbox1) + bboxArea(bbox2);
3375 if (overlap < minOverlap) {
3376 minOverlap = overlap;
3378 minArea = area < minArea ? area : minArea;
3379 } else if (overlap === minOverlap) {
3380 if (area < minArea) {
3388 // sorts node children by the best axis for split
3389 _chooseSplitAxis: function(node, m2, M2) {
3390 var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
3391 if (xMargin < yMargin)
3392 node.children.sort(compareMinX);
3394 // total margin of all possible split distributions where each node is at least m full
3395 _allDistMargin: function(node, m2, M2, compare2) {
3396 node.children.sort(compare2);
3397 var toBBox = this.toBBox, leftBBox = distBBox(node, 0, m2, toBBox), rightBBox = distBBox(node, M2 - m2, M2, toBBox), margin = bboxMargin(leftBBox) + bboxMargin(rightBBox), i3, child;
3398 for (i3 = m2; i3 < M2 - m2; i3++) {
3399 child = node.children[i3];
3400 extend2(leftBBox, node.leaf ? toBBox(child) : child);
3401 margin += bboxMargin(leftBBox);
3403 for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
3404 child = node.children[i3];
3405 extend2(rightBBox, node.leaf ? toBBox(child) : child);
3406 margin += bboxMargin(rightBBox);
3410 _adjustParentBBoxes: function(bbox2, path, level) {
3411 for (var i3 = level; i3 >= 0; i3--) {
3412 extend2(path[i3], bbox2);
3415 _condense: function(path) {
3416 for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
3417 if (path[i3].children.length === 0) {
3419 siblings = path[i3 - 1].children;
3420 siblings.splice(siblings.indexOf(path[i3]), 1);
3424 calcBBox(path[i3], this.toBBox);
3427 _initFormat: function(format2) {
3428 var compareArr = ["return a", " - b", ";"];
3429 this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3430 this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3431 this.toBBox = new Function(
3433 "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3437 function findItem(item, items, equalsFn) {
3439 return items.indexOf(item);
3440 for (var i3 = 0; i3 < items.length; i3++) {
3441 if (equalsFn(item, items[i3]))
3446 function calcBBox(node, toBBox) {
3447 distBBox(node, 0, node.children.length, toBBox, node);
3449 function distBBox(node, k2, p2, toBBox, destNode) {
3451 destNode = createNode(null);
3452 destNode.minX = Infinity;
3453 destNode.minY = Infinity;
3454 destNode.maxX = -Infinity;
3455 destNode.maxY = -Infinity;
3456 for (var i3 = k2, child; i3 < p2; i3++) {
3457 child = node.children[i3];
3458 extend2(destNode, node.leaf ? toBBox(child) : child);
3462 function extend2(a2, b2) {
3463 a2.minX = Math.min(a2.minX, b2.minX);
3464 a2.minY = Math.min(a2.minY, b2.minY);
3465 a2.maxX = Math.max(a2.maxX, b2.maxX);
3466 a2.maxY = Math.max(a2.maxY, b2.maxY);
3469 function compareNodeMinX(a2, b2) {
3470 return a2.minX - b2.minX;
3472 function compareNodeMinY(a2, b2) {
3473 return a2.minY - b2.minY;
3475 function bboxArea(a2) {
3476 return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
3478 function bboxMargin(a2) {
3479 return a2.maxX - a2.minX + (a2.maxY - a2.minY);
3481 function enlargedArea(a2, b2) {
3482 return (Math.max(b2.maxX, a2.maxX) - Math.min(b2.minX, a2.minX)) * (Math.max(b2.maxY, a2.maxY) - Math.min(b2.minY, a2.minY));
3484 function intersectionArea(a2, b2) {
3485 var minX = Math.max(a2.minX, b2.minX), minY = Math.max(a2.minY, b2.minY), maxX = Math.min(a2.maxX, b2.maxX), maxY = Math.min(a2.maxY, b2.maxY);
3486 return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3488 function contains(a2, b2) {
3489 return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
3491 function intersects(a2, b2) {
3492 return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
3494 function createNode(children2) {
3496 children: children2,
3505 function multiSelect(arr, left, right, n3, compare2) {
3506 var stack = [left, right], mid;
3507 while (stack.length) {
3508 right = stack.pop();
3510 if (right - left <= n3)
3512 mid = left + Math.ceil((right - left) / n3 / 2) * n3;
3513 quickselect2(arr, mid, left, right, compare2);
3514 stack.push(left, mid, mid, right);
3520 // node_modules/lineclip/index.js
3521 var require_lineclip = __commonJS({
3522 "node_modules/lineclip/index.js"(exports2, module2) {
3524 module2.exports = lineclip2;
3525 lineclip2.polyline = lineclip2;
3526 lineclip2.polygon = polygonclip2;
3527 function lineclip2(points, bbox2, result) {
3528 var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
3531 for (i3 = 1; i3 < len; i3++) {
3532 a2 = points[i3 - 1];
3534 codeB = lastCode = bitCode2(b2, bbox2);
3536 if (!(codeA | codeB)) {
3538 if (codeB !== lastCode) {
3544 } else if (i3 === len - 1) {
3548 } else if (codeA & codeB) {
3551 a2 = intersect2(a2, b2, codeA, bbox2);
3552 codeA = bitCode2(a2, bbox2);
3554 b2 = intersect2(a2, b2, codeB, bbox2);
3555 codeB = bitCode2(b2, bbox2);
3564 function polygonclip2(points, bbox2) {
3565 var result, edge, prev, prevInside, i3, p2, inside;
3566 for (edge = 1; edge <= 8; edge *= 2) {
3568 prev = points[points.length - 1];
3569 prevInside = !(bitCode2(prev, bbox2) & edge);
3570 for (i3 = 0; i3 < points.length; i3++) {
3572 inside = !(bitCode2(p2, bbox2) & edge);
3573 if (inside !== prevInside)
3574 result.push(intersect2(prev, p2, edge, bbox2));
3578 prevInside = inside;
3586 function intersect2(a2, b2, edge, bbox2) {
3587 return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
3589 edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
3591 edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
3593 edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
3601 function bitCode2(p2, bbox2) {
3603 if (p2[0] < bbox2[0])
3605 else if (p2[0] > bbox2[2])
3607 if (p2[1] < bbox2[1])
3609 else if (p2[1] > bbox2[3])
3616 // node_modules/which-polygon/index.js
3617 var require_which_polygon = __commonJS({
3618 "node_modules/which-polygon/index.js"(exports2, module2) {
3620 var rbush = require_rbush();
3621 var lineclip2 = require_lineclip();
3622 module2.exports = whichPolygon5;
3623 function whichPolygon5(data) {
3625 for (var i3 = 0; i3 < data.features.length; i3++) {
3626 var feature3 = data.features[i3];
3627 if (!feature3.geometry)
3629 var coords = feature3.geometry.coordinates;
3630 if (feature3.geometry.type === "Polygon") {
3631 bboxes.push(treeItem(coords, feature3.properties));
3632 } else if (feature3.geometry.type === "MultiPolygon") {
3633 for (var j2 = 0; j2 < coords.length; j2++) {
3634 bboxes.push(treeItem(coords[j2], feature3.properties));
3638 var tree = rbush().load(bboxes);
3639 function query(p2, multi) {
3640 var output = [], result = tree.search({
3646 for (var i4 = 0; i4 < result.length; i4++) {
3647 if (insidePolygon(result[i4].coords, p2)) {
3649 output.push(result[i4].props);
3651 return result[i4].props;
3654 return multi && output.length ? output : null;
3657 query.bbox = function queryBBox(bbox2) {
3659 var result = tree.search({
3665 for (var i4 = 0; i4 < result.length; i4++) {
3666 if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
3667 output.push(result[i4].props);
3674 function polygonIntersectsBBox(polygon2, bbox2) {
3676 (bbox2[0] + bbox2[2]) / 2,
3677 (bbox2[1] + bbox2[3]) / 2
3679 if (insidePolygon(polygon2, bboxCenter))
3681 for (var i3 = 0; i3 < polygon2.length; i3++) {
3682 if (lineclip2(polygon2[i3], bbox2).length > 0)
3687 function insidePolygon(rings, p2) {
3689 for (var i3 = 0, len = rings.length; i3 < len; i3++) {
3690 var ring = rings[i3];
3691 for (var j2 = 0, len2 = ring.length, k2 = len2 - 1; j2 < len2; k2 = j2++) {
3692 if (rayIntersect(p2, ring[j2], ring[k2]))
3698 function rayIntersect(p2, p1, p22) {
3699 return p1[1] > p2[1] !== p22[1] > p2[1] && p2[0] < (p22[0] - p1[0]) * (p2[1] - p1[1]) / (p22[1] - p1[1]) + p1[0];
3701 function treeItem(coords, props) {
3710 for (var i3 = 0; i3 < coords[0].length; i3++) {
3711 var p2 = coords[0][i3];
3712 item.minX = Math.min(item.minX, p2[0]);
3713 item.minY = Math.min(item.minY, p2[1]);
3714 item.maxX = Math.max(item.maxX, p2[0]);
3715 item.maxY = Math.max(item.maxY, p2[1]);
3722 // node_modules/wgs84/index.js
3723 var require_wgs84 = __commonJS({
3724 "node_modules/wgs84/index.js"(exports2, module2) {
3725 module2.exports.RADIUS = 6378137;
3726 module2.exports.FLATTENING = 1 / 298.257223563;
3727 module2.exports.POLAR_RADIUS = 63567523142e-4;
3731 // node_modules/@mapbox/geojson-area/index.js
3732 var require_geojson_area = __commonJS({
3733 "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3734 var wgs84 = require_wgs84();
3735 module2.exports.geometry = geometry;
3736 module2.exports.ring = ringArea;
3737 function geometry(_2) {
3741 return polygonArea(_2.coordinates);
3742 case "MultiPolygon":
3743 for (i3 = 0; i3 < _2.coordinates.length; i3++) {
3744 area += polygonArea(_2.coordinates[i3]);
3750 case "MultiLineString":
3752 case "GeometryCollection":
3753 for (i3 = 0; i3 < _2.geometries.length; i3++) {
3754 area += geometry(_2.geometries[i3]);
3759 function polygonArea(coords) {
3761 if (coords && coords.length > 0) {
3762 area += Math.abs(ringArea(coords[0]));
3763 for (var i3 = 1; i3 < coords.length; i3++) {
3764 area -= Math.abs(ringArea(coords[i3]));
3769 function ringArea(coords) {
3770 var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
3771 if (coordsLength > 2) {
3772 for (i3 = 0; i3 < coordsLength; i3++) {
3773 if (i3 === coordsLength - 2) {
3774 lowerIndex = coordsLength - 2;
3775 middleIndex = coordsLength - 1;
3777 } else if (i3 === coordsLength - 1) {
3778 lowerIndex = coordsLength - 1;
3783 middleIndex = i3 + 1;
3784 upperIndex = i3 + 2;
3786 p1 = coords[lowerIndex];
3787 p2 = coords[middleIndex];
3788 p3 = coords[upperIndex];
3789 area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3791 area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3796 return _2 * Math.PI / 180;
3801 // node_modules/circle-to-polygon/input-validation/validateCenter.js
3802 var require_validateCenter = __commonJS({
3803 "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3804 exports2.validateCenter = function validateCenter(center) {
3805 var validCenterLengths = [2, 3];
3806 if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3807 throw new Error("ERROR! Center has to be an array of length two or three");
3809 var [lng, lat] = center;
3810 if (typeof lng !== "number" || typeof lat !== "number") {
3812 "ERROR! Longitude and Latitude has to be numbers but where ".concat(typeof lng, " and ").concat(typeof lat)
3815 if (lng > 180 || lng < -180) {
3816 throw new Error("ERROR! Longitude has to be between -180 and 180 but was ".concat(lng));
3818 if (lat > 90 || lat < -90) {
3819 throw new Error("ERROR! Latitude has to be between -90 and 90 but was ".concat(lat));
3825 // node_modules/circle-to-polygon/input-validation/validateRadius.js
3826 var require_validateRadius = __commonJS({
3827 "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3828 exports2.validateRadius = function validateRadius(radius) {
3829 if (typeof radius !== "number") {
3830 throw new Error("ERROR! Radius has to be a positive number but was: ".concat(typeof radius));
3833 throw new Error("ERROR! Radius has to be a positive number but was: ".concat(radius));
3839 // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3840 var require_validateNumberOfEdges = __commonJS({
3841 "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3842 exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3843 if (typeof numberOfEdges !== "number") {
3844 const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3845 throw new Error("ERROR! Number of edges has to be a number but was: ".concat(ARGUMENT_TYPE));
3847 if (numberOfEdges < 3) {
3848 throw new Error("ERROR! Number of edges has to be at least 3 but was: ".concat(numberOfEdges));
3854 // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3855 var require_validateEarthRadius = __commonJS({
3856 "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3857 exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3858 if (typeof earthRadius2 !== "number") {
3859 const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3860 throw new Error("ERROR! Earth radius has to be a number but was: ".concat(ARGUMENT_TYPE));
3862 if (earthRadius2 <= 0) {
3863 throw new Error("ERROR! Earth radius has to be a positive number but was: ".concat(earthRadius2));
3869 // node_modules/circle-to-polygon/input-validation/validateBearing.js
3870 var require_validateBearing = __commonJS({
3871 "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3872 exports2.validateBearing = function validateBearing(bearing) {
3873 if (typeof bearing !== "number") {
3874 const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3875 throw new Error("ERROR! Bearing has to be a number but was: ".concat(ARGUMENT_TYPE));
3881 // node_modules/circle-to-polygon/input-validation/index.js
3882 var require_input_validation = __commonJS({
3883 "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3884 var validateCenter = require_validateCenter().validateCenter;
3885 var validateRadius = require_validateRadius().validateRadius;
3886 var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3887 var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3888 var validateBearing = require_validateBearing().validateBearing;
3889 function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3890 validateCenter(center);
3891 validateRadius(radius);
3892 validateNumberOfEdges(numberOfEdges);
3893 validateEarthRadius(earthRadius2);
3894 validateBearing(bearing);
3896 exports2.validateCenter = validateCenter;
3897 exports2.validateRadius = validateRadius;
3898 exports2.validateNumberOfEdges = validateNumberOfEdges;
3899 exports2.validateEarthRadius = validateEarthRadius;
3900 exports2.validateBearing = validateBearing;
3901 exports2.validateInput = validateInput;
3905 // node_modules/circle-to-polygon/index.js
3906 var require_circle_to_polygon = __commonJS({
3907 "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3909 var { validateInput } = require_input_validation();
3910 var defaultEarthRadius = 6378137;
3911 function toRadians(angleInDegrees) {
3912 return angleInDegrees * Math.PI / 180;
3914 function toDegrees(angleInRadians) {
3915 return angleInRadians * 180 / Math.PI;
3917 function offset(c1, distance, earthRadius2, bearing) {
3918 var lat1 = toRadians(c1[1]);
3919 var lon1 = toRadians(c1[0]);
3920 var dByR = distance / earthRadius2;
3921 var lat = Math.asin(
3922 Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3924 var lon = lon1 + Math.atan2(
3925 Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3926 Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3928 return [toDegrees(lon), toDegrees(lat)];
3930 module2.exports = function circleToPolygon2(center, radius, options2) {
3931 var n3 = getNumberOfEdges(options2);
3932 var earthRadius2 = getEarthRadius(options2);
3933 var bearing = getBearing(options2);
3934 var direction = getDirection(options2);
3935 validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
3936 var start2 = toRadians(bearing);
3937 var coordinates = [];
3938 for (var i3 = 0; i3 < n3; ++i3) {
3944 start2 + direction * 2 * Math.PI * -i3 / n3
3948 coordinates.push(coordinates[0]);
3951 coordinates: [coordinates]
3954 function getNumberOfEdges(options2) {
3955 if (isUndefinedOrNull(options2)) {
3957 } else if (isObjectNotArray(options2)) {
3958 var numberOfEdges = options2.numberOfEdges;
3959 return numberOfEdges === void 0 ? 32 : numberOfEdges;
3963 function getEarthRadius(options2) {
3964 if (isUndefinedOrNull(options2)) {
3965 return defaultEarthRadius;
3966 } else if (isObjectNotArray(options2)) {
3967 var earthRadius2 = options2.earthRadius;
3968 return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3970 return defaultEarthRadius;
3972 function getDirection(options2) {
3973 if (isObjectNotArray(options2) && options2.rightHandRule) {
3978 function getBearing(options2) {
3979 if (isUndefinedOrNull(options2)) {
3981 } else if (isObjectNotArray(options2)) {
3982 var bearing = options2.bearing;
3983 return bearing === void 0 ? 0 : bearing;
3987 function isObjectNotArray(argument) {
3988 return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3990 function isUndefinedOrNull(argument) {
3991 return argument === null || argument === void 0;
3996 // node_modules/geojson-precision/index.js
3997 var require_geojson_precision = __commonJS({
3998 "node_modules/geojson-precision/index.js"(exports2, module2) {
4000 function parse(t2, coordinatePrecision, extrasPrecision) {
4001 function point2(p2) {
4002 return p2.map(function(e3, index) {
4004 return 1 * e3.toFixed(coordinatePrecision);
4006 return 1 * e3.toFixed(extrasPrecision);
4010 function multi(l2) {
4011 return l2.map(point2);
4014 return p2.map(multi);
4016 function multiPoly(m2) {
4017 return m2.map(poly);
4019 function geometry(obj) {
4025 obj.coordinates = point2(obj.coordinates);
4029 obj.coordinates = multi(obj.coordinates);
4032 case "MultiLineString":
4033 obj.coordinates = poly(obj.coordinates);
4035 case "MultiPolygon":
4036 obj.coordinates = multiPoly(obj.coordinates);
4038 case "GeometryCollection":
4039 obj.geometries = obj.geometries.map(geometry);
4045 function feature3(obj) {
4046 obj.geometry = geometry(obj.geometry);
4049 function featureCollection(f2) {
4050 f2.features = f2.features.map(feature3);
4053 function geometryCollection(g3) {
4054 g3.geometries = g3.geometries.map(geometry);
4062 return feature3(t2);
4063 case "GeometryCollection":
4064 return geometryCollection(t2);
4065 case "FeatureCollection":
4066 return featureCollection(t2);
4071 case "MultiPolygon":
4072 case "MultiLineString":
4073 return geometry(t2);
4078 module2.exports = parse;
4079 module2.exports.parse = parse;
4084 // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
4085 var require_json_stringify_pretty_compact = __commonJS({
4086 "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
4087 function isObject3(obj) {
4088 return typeof obj === "object" && obj !== null;
4090 function forEach(obj, cb) {
4091 if (Array.isArray(obj)) {
4093 } else if (isObject3(obj)) {
4094 Object.keys(obj).forEach(function(key) {
4100 function getTreeDepth(obj) {
4102 if (Array.isArray(obj) || isObject3(obj)) {
4103 forEach(obj, function(val) {
4104 if (Array.isArray(val) || isObject3(val)) {
4105 var tmpDepth = getTreeDepth(val);
4106 if (tmpDepth > depth) {
4115 function stringify3(obj, options2) {
4116 options2 = options2 || {};
4117 var indent = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
4118 var addMargin = get4(options2, "margins", false);
4119 var addArrayMargin = get4(options2, "arrayMargins", false);
4120 var addObjectMargin = get4(options2, "objectMargins", false);
4121 var maxLength = indent === "" ? Infinity : get4(options2, "maxLength", 80);
4122 var maxNesting = get4(options2, "maxNesting", Infinity);
4123 return function _stringify(obj2, currentIndent, reserved) {
4124 if (obj2 && typeof obj2.toJSON === "function") {
4125 obj2 = obj2.toJSON();
4127 var string = JSON.stringify(obj2);
4128 if (string === void 0) {
4131 var length2 = maxLength - currentIndent.length - reserved;
4132 var treeDepth = getTreeDepth(obj2);
4133 if (treeDepth <= maxNesting && string.length <= length2) {
4134 var prettified = prettify(string, {
4139 if (prettified.length <= length2) {
4143 if (isObject3(obj2)) {
4144 var nextIndent = currentIndent + indent;
4147 var comma = function(array2, index2) {
4148 return index2 === array2.length - 1 ? 0 : 1;
4150 if (Array.isArray(obj2)) {
4151 for (var index = 0; index < obj2.length; index++) {
4153 _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
4158 Object.keys(obj2).forEach(function(key, index2, array2) {
4159 var keyPart = JSON.stringify(key) + ": ";
4160 var value = _stringify(
4163 keyPart.length + comma(array2, index2)
4165 if (value !== void 0) {
4166 items.push(keyPart + value);
4171 if (items.length > 0) {
4174 indent + items.join(",\n" + nextIndent),
4176 ].join("\n" + currentIndent);
4182 var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
4183 function prettify(string, options2) {
4184 options2 = options2 || {};
4193 if (options2.addMargin || options2.addObjectMargin) {
4197 if (options2.addMargin || options2.addArrayMargin) {
4201 return string.replace(stringOrChar, function(match, string2) {
4202 return string2 ? match : tokens[match];
4205 function get4(options2, name, defaultValue) {
4206 return name in options2 ? options2[name] : defaultValue;
4208 module2.exports = stringify3;
4212 // node_modules/aes-js/index.js
4213 var require_aes_js = __commonJS({
4214 "node_modules/aes-js/index.js"(exports2, module2) {
4217 function checkInt(value) {
4218 return parseInt(value) === value;
4220 function checkInts(arrayish) {
4221 if (!checkInt(arrayish.length)) {
4224 for (var i3 = 0; i3 < arrayish.length; i3++) {
4225 if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
4231 function coerceArray(arg, copy2) {
4232 if (arg.buffer && arg.name === "Uint8Array") {
4237 arg = Array.prototype.slice.call(arg);
4242 if (Array.isArray(arg)) {
4243 if (!checkInts(arg)) {
4244 throw new Error("Array contains invalid value: " + arg);
4246 return new Uint8Array(arg);
4248 if (checkInt(arg.length) && checkInts(arg)) {
4249 return new Uint8Array(arg);
4251 throw new Error("unsupported array-like object");
4253 function createArray(length2) {
4254 return new Uint8Array(length2);
4256 function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
4257 if (sourceStart != null || sourceEnd != null) {
4258 if (sourceArray.slice) {
4259 sourceArray = sourceArray.slice(sourceStart, sourceEnd);
4261 sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
4264 targetArray.set(sourceArray, targetStart);
4266 var convertUtf8 = /* @__PURE__ */ function() {
4267 function toBytes(text) {
4268 var result = [], i3 = 0;
4269 text = encodeURI(text);
4270 while (i3 < text.length) {
4271 var c2 = text.charCodeAt(i3++);
4273 result.push(parseInt(text.substr(i3, 2), 16));
4279 return coerceArray(result);
4281 function fromBytes(bytes) {
4282 var result = [], i3 = 0;
4283 while (i3 < bytes.length) {
4286 result.push(String.fromCharCode(c2));
4288 } else if (c2 > 191 && c2 < 224) {
4289 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
4292 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
4296 return result.join("");
4303 var convertHex = /* @__PURE__ */ function() {
4304 function toBytes(text) {
4306 for (var i3 = 0; i3 < text.length; i3 += 2) {
4307 result.push(parseInt(text.substr(i3, 2), 16));
4311 var Hex = "0123456789abcdef";
4312 function fromBytes(bytes) {
4314 for (var i3 = 0; i3 < bytes.length; i3++) {
4316 result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
4318 return result.join("");
4325 var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
4326 var rcon = [1, 2, 4, 8, 16, 32, 64, 128, 27, 54, 108, 216, 171, 77, 154, 47, 94, 188, 99, 198, 151, 53, 106, 212, 179, 125, 250, 239, 197, 145];
4327 var S2 = [99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118, 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192, 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21, 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117, 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132, 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207, 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168, 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210, 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115, 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219, 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121, 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8, 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138, 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158, 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223, 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22];
4328 var Si = [82, 9, 106, 213, 48, 54, 165, 56, 191, 64, 163, 158, 129, 243, 215, 251, 124, 227, 57, 130, 155, 47, 255, 135, 52, 142, 67, 68, 196, 222, 233, 203, 84, 123, 148, 50, 166, 194, 35, 61, 238, 76, 149, 11, 66, 250, 195, 78, 8, 46, 161, 102, 40, 217, 36, 178, 118, 91, 162, 73, 109, 139, 209, 37, 114, 248, 246, 100, 134, 104, 152, 22, 212, 164, 92, 204, 93, 101, 182, 146, 108, 112, 72, 80, 253, 237, 185, 218, 94, 21, 70, 87, 167, 141, 157, 132, 144, 216, 171, 0, 140, 188, 211, 10, 247, 228, 88, 5, 184, 179, 69, 6, 208, 44, 30, 143, 202, 63, 15, 2, 193, 175, 189, 3, 1, 19, 138, 107, 58, 145, 17, 65, 79, 103, 220, 234, 151, 242, 207, 206, 240, 180, 230, 115, 150, 172, 116, 34, 231, 173, 53, 133, 226, 249, 55, 232, 28, 117, 223, 110, 71, 241, 26, 113, 29, 41, 197, 137, 111, 183, 98, 14, 170, 24, 190, 27, 252, 86, 62, 75, 198, 210, 121, 32, 154, 219, 192, 254, 120, 205, 90, 244, 31, 221, 168, 51, 136, 7, 199, 49, 177, 18, 16, 89, 39, 128, 236, 95, 96, 81, 127, 169, 25, 181, 74, 13, 45, 229, 122, 159, 147, 201, 156, 239, 160, 224, 59, 77, 174, 42, 245, 176, 200, 235, 187, 60, 131, 83, 153, 97, 23, 43, 4, 126, 186, 119, 214, 38, 225, 105, 20, 99, 85, 33, 12, 125];
4329 var T1 = [3328402341, 4168907908, 4000806809, 4135287693, 4294111757, 3597364157, 3731845041, 2445657428, 1613770832, 33620227, 3462883241, 1445669757, 3892248089, 3050821474, 1303096294, 3967186586, 2412431941, 528646813, 2311702848, 4202528135, 4026202645, 2992200171, 2387036105, 4226871307, 1101901292, 3017069671, 1604494077, 1169141738, 597466303, 1403299063, 3832705686, 2613100635, 1974974402, 3791519004, 1033081774, 1277568618, 1815492186, 2118074177, 4126668546, 2211236943, 1748251740, 1369810420, 3521504564, 4193382664, 3799085459, 2883115123, 1647391059, 706024767, 134480908, 2512897874, 1176707941, 2646852446, 806885416, 932615841, 168101135, 798661301, 235341577, 605164086, 461406363, 3756188221, 3454790438, 1311188841, 2142417613, 3933566367, 302582043, 495158174, 1479289972, 874125870, 907746093, 3698224818, 3025820398, 1537253627, 2756858614, 1983593293, 3084310113, 2108928974, 1378429307, 3722699582, 1580150641, 327451799, 2790478837, 3117535592, 0, 3253595436, 1075847264, 3825007647, 2041688520, 3059440621, 3563743934, 2378943302, 1740553945, 1916352843, 2487896798, 2555137236, 2958579944, 2244988746, 3151024235, 3320835882, 1336584933, 3992714006, 2252555205, 2588757463, 1714631509, 293963156, 2319795663, 3925473552, 67240454, 4269768577, 2689618160, 2017213508, 631218106, 1269344483, 2723238387, 1571005438, 2151694528, 93294474, 1066570413, 563977660, 1882732616, 4059428100, 1673313503, 2008463041, 2950355573, 1109467491, 537923632, 3858759450, 4260623118, 3218264685, 2177748300, 403442708, 638784309, 3287084079, 3193921505, 899127202, 2286175436, 773265209, 2479146071, 1437050866, 4236148354, 2050833735, 3362022572, 3126681063, 840505643, 3866325909, 3227541664, 427917720, 2655997905, 2749160575, 1143087718, 1412049534, 999329963, 193497219, 2353415882, 3354324521, 1807268051, 672404540, 2816401017, 3160301282, 369822493, 2916866934, 3688947771, 1681011286, 1949973070, 336202270, 2454276571, 201721354, 1210328172, 3093060836, 2680341085, 3184776046, 1135389935, 3294782118, 965841320, 831886756, 3554993207, 4068047243, 3588745010, 2345191491, 1849112409, 3664604599, 26054028, 2983581028, 2622377682, 1235855840, 3630984372, 2891339514, 4092916743, 3488279077, 3395642799, 4101667470, 1202630377, 268961816, 1874508501, 4034427016, 1243948399, 1546530418, 941366308, 1470539505, 1941222599, 2546386513, 3421038627, 2715671932, 3899946140, 1042226977, 2521517021, 1639824860, 227249030, 260737669, 3765465232, 2084453954, 1907733956, 3429263018, 2420656344, 100860677, 4160157185, 470683154, 3261161891, 1781871967, 2924959737, 1773779408, 394692241, 2579611992, 974986535, 664706745, 3655459128, 3958962195, 731420851, 571543859, 3530123707, 2849626480, 126783113, 865375399, 765172662, 1008606754, 361203602, 3387549984, 2278477385, 2857719295, 1344809080, 2782912378, 59542671, 1503764984, 160008576, 437062935, 1707065306, 3622233649, 2218934982, 3496503480, 2185314755, 697932208, 1512910199, 504303377, 2075177163, 2824099068, 1841019862, 739644986];
4330 var T2 = [2781242211, 2230877308, 2582542199, 2381740923, 234877682, 3184946027, 2984144751, 1418839493, 1348481072, 50462977, 2848876391, 2102799147, 434634494, 1656084439, 3863849899, 2599188086, 1167051466, 2636087938, 1082771913, 2281340285, 368048890, 3954334041, 3381544775, 201060592, 3963727277, 1739838676, 4250903202, 3930435503, 3206782108, 4149453988, 2531553906, 1536934080, 3262494647, 484572669, 2923271059, 1783375398, 1517041206, 1098792767, 49674231, 1334037708, 1550332980, 4098991525, 886171109, 150598129, 2481090929, 1940642008, 1398944049, 1059722517, 201851908, 1385547719, 1699095331, 1587397571, 674240536, 2704774806, 252314885, 3039795866, 151914247, 908333586, 2602270848, 1038082786, 651029483, 1766729511, 3447698098, 2682942837, 454166793, 2652734339, 1951935532, 775166490, 758520603, 3000790638, 4004797018, 4217086112, 4137964114, 1299594043, 1639438038, 3464344499, 2068982057, 1054729187, 1901997871, 2534638724, 4121318227, 1757008337, 0, 750906861, 1614815264, 535035132, 3363418545, 3988151131, 3201591914, 1183697867, 3647454910, 1265776953, 3734260298, 3566750796, 3903871064, 1250283471, 1807470800, 717615087, 3847203498, 384695291, 3313910595, 3617213773, 1432761139, 2484176261, 3481945413, 283769337, 100925954, 2180939647, 4037038160, 1148730428, 3123027871, 3813386408, 4087501137, 4267549603, 3229630528, 2315620239, 2906624658, 3156319645, 1215313976, 82966005, 3747855548, 3245848246, 1974459098, 1665278241, 807407632, 451280895, 251524083, 1841287890, 1283575245, 337120268, 891687699, 801369324, 3787349855, 2721421207, 3431482436, 959321879, 1469301956, 4065699751, 2197585534, 1199193405, 2898814052, 3887750493, 724703513, 2514908019, 2696962144, 2551808385, 3516813135, 2141445340, 1715741218, 2119445034, 2872807568, 2198571144, 3398190662, 700968686, 3547052216, 1009259540, 2041044702, 3803995742, 487983883, 1991105499, 1004265696, 1449407026, 1316239930, 504629770, 3683797321, 168560134, 1816667172, 3837287516, 1570751170, 1857934291, 4014189740, 2797888098, 2822345105, 2754712981, 936633572, 2347923833, 852879335, 1133234376, 1500395319, 3084545389, 2348912013, 1689376213, 3533459022, 3762923945, 3034082412, 4205598294, 133428468, 634383082, 2949277029, 2398386810, 3913789102, 403703816, 3580869306, 2297460856, 1867130149, 1918643758, 607656988, 4049053350, 3346248884, 1368901318, 600565992, 2090982877, 2632479860, 557719327, 3717614411, 3697393085, 2249034635, 2232388234, 2430627952, 1115438654, 3295786421, 2865522278, 3633334344, 84280067, 33027830, 303828494, 2747425121, 1600795957, 4188952407, 3496589753, 2434238086, 1486471617, 658119965, 3106381470, 953803233, 334231800, 3005978776, 857870609, 3151128937, 1890179545, 2298973838, 2805175444, 3056442267, 574365214, 2450884487, 550103529, 1233637070, 4289353045, 2018519080, 2057691103, 2399374476, 4166623649, 2148108681, 387583245, 3664101311, 836232934, 3330556482, 3100665960, 3280093505, 2955516313, 2002398509, 287182607, 3413881008, 4238890068, 3597515707, 975967766];
4331 var T3 = [1671808611, 2089089148, 2006576759, 2072901243, 4061003762, 1807603307, 1873927791, 3310653893, 810573872, 16974337, 1739181671, 729634347, 4263110654, 3613570519, 2883997099, 1989864566, 3393556426, 2191335298, 3376449993, 2106063485, 4195741690, 1508618841, 1204391495, 4027317232, 2917941677, 3563566036, 2734514082, 2951366063, 2629772188, 2767672228, 1922491506, 3227229120, 3082974647, 4246528509, 2477669779, 644500518, 911895606, 1061256767, 4144166391, 3427763148, 878471220, 2784252325, 3845444069, 4043897329, 1905517169, 3631459288, 827548209, 356461077, 67897348, 3344078279, 593839651, 3277757891, 405286936, 2527147926, 84871685, 2595565466, 118033927, 305538066, 2157648768, 3795705826, 3945188843, 661212711, 2999812018, 1973414517, 152769033, 2208177539, 745822252, 439235610, 455947803, 1857215598, 1525593178, 2700827552, 1391895634, 994932283, 3596728278, 3016654259, 695947817, 3812548067, 795958831, 2224493444, 1408607827, 3513301457, 0, 3979133421, 543178784, 4229948412, 2982705585, 1542305371, 1790891114, 3410398667, 3201918910, 961245753, 1256100938, 1289001036, 1491644504, 3477767631, 3496721360, 4012557807, 2867154858, 4212583931, 1137018435, 1305975373, 861234739, 2241073541, 1171229253, 4178635257, 33948674, 2139225727, 1357946960, 1011120188, 2679776671, 2833468328, 1374921297, 2751356323, 1086357568, 2408187279, 2460827538, 2646352285, 944271416, 4110742005, 3168756668, 3066132406, 3665145818, 560153121, 271589392, 4279952895, 4077846003, 3530407890, 3444343245, 202643468, 322250259, 3962553324, 1608629855, 2543990167, 1154254916, 389623319, 3294073796, 2817676711, 2122513534, 1028094525, 1689045092, 1575467613, 422261273, 1939203699, 1621147744, 2174228865, 1339137615, 3699352540, 577127458, 712922154, 2427141008, 2290289544, 1187679302, 3995715566, 3100863416, 339486740, 3732514782, 1591917662, 186455563, 3681988059, 3762019296, 844522546, 978220090, 169743370, 1239126601, 101321734, 611076132, 1558493276, 3260915650, 3547250131, 2901361580, 1655096418, 2443721105, 2510565781, 3828863972, 2039214713, 3878868455, 3359869896, 928607799, 1840765549, 2374762893, 3580146133, 1322425422, 2850048425, 1823791212, 1459268694, 4094161908, 3928346602, 1706019429, 2056189050, 2934523822, 135794696, 3134549946, 2022240376, 628050469, 779246638, 472135708, 2800834470, 3032970164, 3327236038, 3894660072, 3715932637, 1956440180, 522272287, 1272813131, 3185336765, 2340818315, 2323976074, 1888542832, 1044544574, 3049550261, 1722469478, 1222152264, 50660867, 4127324150, 236067854, 1638122081, 895445557, 1475980887, 3117443513, 2257655686, 3243809217, 489110045, 2662934430, 3778599393, 4162055160, 2561878936, 288563729, 1773916777, 3648039385, 2391345038, 2493985684, 2612407707, 505560094, 2274497927, 3911240169, 3460925390, 1442818645, 678973480, 3749357023, 2358182796, 2717407649, 2306869641, 219617805, 3218761151, 3862026214, 1120306242, 1756942440, 1103331905, 2578459033, 762796589, 252780047, 2966125488, 1425844308, 3151392187, 372911126];
4332 var T4 = [1667474886, 2088535288, 2004326894, 2071694838, 4075949567, 1802223062, 1869591006, 3318043793, 808472672, 16843522, 1734846926, 724270422, 4278065639, 3621216949, 2880169549, 1987484396, 3402253711, 2189597983, 3385409673, 2105378810, 4210693615, 1499065266, 1195886990, 4042263547, 2913856577, 3570689971, 2728590687, 2947541573, 2627518243, 2762274643, 1920112356, 3233831835, 3082273397, 4261223649, 2475929149, 640051788, 909531756, 1061110142, 4160160501, 3435941763, 875846760, 2779116625, 3857003729, 4059105529, 1903268834, 3638064043, 825316194, 353713962, 67374088, 3351728789, 589522246, 3284360861, 404236336, 2526454071, 84217610, 2593830191, 117901582, 303183396, 2155911963, 3806477791, 3958056653, 656894286, 2998062463, 1970642922, 151591698, 2206440989, 741110872, 437923380, 454765878, 1852748508, 1515908788, 2694904667, 1381168804, 993742198, 3604373943, 3014905469, 690584402, 3823320797, 791638366, 2223281939, 1398011302, 3520161977, 0, 3991743681, 538992704, 4244381667, 2981218425, 1532751286, 1785380564, 3419096717, 3200178535, 960056178, 1246420628, 1280103576, 1482221744, 3486468741, 3503319995, 4025428677, 2863326543, 4227536621, 1128514950, 1296947098, 859002214, 2240123921, 1162203018, 4193849577, 33687044, 2139062782, 1347481760, 1010582648, 2678045221, 2829640523, 1364325282, 2745433693, 1077985408, 2408548869, 2459086143, 2644360225, 943212656, 4126475505, 3166494563, 3065430391, 3671750063, 555836226, 269496352, 4294908645, 4092792573, 3537006015, 3452783745, 202118168, 320025894, 3974901699, 1600119230, 2543297077, 1145359496, 387397934, 3301201811, 2812801621, 2122220284, 1027426170, 1684319432, 1566435258, 421079858, 1936954854, 1616945344, 2172753945, 1330631070, 3705438115, 572679748, 707427924, 2425400123, 2290647819, 1179044492, 4008585671, 3099120491, 336870440, 3739122087, 1583276732, 185277718, 3688593069, 3772791771, 842159716, 976899700, 168435220, 1229577106, 101059084, 606366792, 1549591736, 3267517855, 3553849021, 2897014595, 1650632388, 2442242105, 2509612081, 3840161747, 2038008818, 3890688725, 3368567691, 926374254, 1835907034, 2374863873, 3587531953, 1313788572, 2846482505, 1819063512, 1448540844, 4109633523, 3941213647, 1701162954, 2054852340, 2930698567, 134748176, 3132806511, 2021165296, 623210314, 774795868, 471606328, 2795958615, 3031746419, 3334885783, 3907527627, 3722280097, 1953799400, 522133822, 1263263126, 3183336545, 2341176845, 2324333839, 1886425312, 1044267644, 3048588401, 1718004428, 1212733584, 50529542, 4143317495, 235803164, 1633788866, 892690282, 1465383342, 3115962473, 2256965911, 3250673817, 488449850, 2661202215, 3789633753, 4177007595, 2560144171, 286339874, 1768537042, 3654906025, 2391705863, 2492770099, 2610673197, 505291324, 2273808917, 3924369609, 3469625735, 1431699370, 673740880, 3755965093, 2358021891, 2711746649, 2307489801, 218961690, 3217021541, 3873845719, 1111672452, 1751693520, 1094828930, 2576986153, 757954394, 252645662, 2964376443, 1414855848, 3149649517, 370555436];
4333 var T5 = [1374988112, 2118214995, 437757123, 975658646, 1001089995, 530400753, 2902087851, 1273168787, 540080725, 2910219766, 2295101073, 4110568485, 1340463100, 3307916247, 641025152, 3043140495, 3736164937, 632953703, 1172967064, 1576976609, 3274667266, 2169303058, 2370213795, 1809054150, 59727847, 361929877, 3211623147, 2505202138, 3569255213, 1484005843, 1239443753, 2395588676, 1975683434, 4102977912, 2572697195, 666464733, 3202437046, 4035489047, 3374361702, 2110667444, 1675577880, 3843699074, 2538681184, 1649639237, 2976151520, 3144396420, 4269907996, 4178062228, 1883793496, 2403728665, 2497604743, 1383856311, 2876494627, 1917518562, 3810496343, 1716890410, 3001755655, 800440835, 2261089178, 3543599269, 807962610, 599762354, 33778362, 3977675356, 2328828971, 2809771154, 4077384432, 1315562145, 1708848333, 101039829, 3509871135, 3299278474, 875451293, 2733856160, 92987698, 2767645557, 193195065, 1080094634, 1584504582, 3178106961, 1042385657, 2531067453, 3711829422, 1306967366, 2438237621, 1908694277, 67556463, 1615861247, 429456164, 3602770327, 2302690252, 1742315127, 2968011453, 126454664, 3877198648, 2043211483, 2709260871, 2084704233, 4169408201, 0, 159417987, 841739592, 504459436, 1817866830, 4245618683, 260388950, 1034867998, 908933415, 168810852, 1750902305, 2606453969, 607530554, 202008497, 2472011535, 3035535058, 463180190, 2160117071, 1641816226, 1517767529, 470948374, 3801332234, 3231722213, 1008918595, 303765277, 235474187, 4069246893, 766945465, 337553864, 1475418501, 2943682380, 4003061179, 2743034109, 4144047775, 1551037884, 1147550661, 1543208500, 2336434550, 3408119516, 3069049960, 3102011747, 3610369226, 1113818384, 328671808, 2227573024, 2236228733, 3535486456, 2935566865, 3341394285, 496906059, 3702665459, 226906860, 2009195472, 733156972, 2842737049, 294930682, 1206477858, 2835123396, 2700099354, 1451044056, 573804783, 2269728455, 3644379585, 2362090238, 2564033334, 2801107407, 2776292904, 3669462566, 1068351396, 742039012, 1350078989, 1784663195, 1417561698, 4136440770, 2430122216, 775550814, 2193862645, 2673705150, 1775276924, 1876241833, 3475313331, 3366754619, 270040487, 3902563182, 3678124923, 3441850377, 1851332852, 3969562369, 2203032232, 3868552805, 2868897406, 566021896, 4011190502, 3135740889, 1248802510, 3936291284, 699432150, 832877231, 708780849, 3332740144, 899835584, 1951317047, 4236429990, 3767586992, 866637845, 4043610186, 1106041591, 2144161806, 395441711, 1984812685, 1139781709, 3433712980, 3835036895, 2664543715, 1282050075, 3240894392, 1181045119, 2640243204, 25965917, 4203181171, 4211818798, 3009879386, 2463879762, 3910161971, 1842759443, 2597806476, 933301370, 1509430414, 3943906441, 3467192302, 3076639029, 3776767469, 2051518780, 2631065433, 1441952575, 404016761, 1942435775, 1408749034, 1610459739, 3745345300, 2017778566, 3400528769, 3110650942, 941896748, 3265478751, 371049330, 3168937228, 675039627, 4279080257, 967311729, 135050206, 3635733660, 1683407248, 2076935265, 3576870512, 1215061108, 3501741890];
4334 var T6 = [1347548327, 1400783205, 3273267108, 2520393566, 3409685355, 4045380933, 2880240216, 2471224067, 1428173050, 4138563181, 2441661558, 636813900, 4233094615, 3620022987, 2149987652, 2411029155, 1239331162, 1730525723, 2554718734, 3781033664, 46346101, 310463728, 2743944855, 3328955385, 3875770207, 2501218972, 3955191162, 3667219033, 768917123, 3545789473, 692707433, 1150208456, 1786102409, 2029293177, 1805211710, 3710368113, 3065962831, 401639597, 1724457132, 3028143674, 409198410, 2196052529, 1620529459, 1164071807, 3769721975, 2226875310, 486441376, 2499348523, 1483753576, 428819965, 2274680428, 3075636216, 598438867, 3799141122, 1474502543, 711349675, 129166120, 53458370, 2592523643, 2782082824, 4063242375, 2988687269, 3120694122, 1559041666, 730517276, 2460449204, 4042459122, 2706270690, 3446004468, 3573941694, 533804130, 2328143614, 2637442643, 2695033685, 839224033, 1973745387, 957055980, 2856345839, 106852767, 1371368976, 4181598602, 1033297158, 2933734917, 1179510461, 3046200461, 91341917, 1862534868, 4284502037, 605657339, 2547432937, 3431546947, 2003294622, 3182487618, 2282195339, 954669403, 3682191598, 1201765386, 3917234703, 3388507166, 0, 2198438022, 1211247597, 2887651696, 1315723890, 4227665663, 1443857720, 507358933, 657861945, 1678381017, 560487590, 3516619604, 975451694, 2970356327, 261314535, 3535072918, 2652609425, 1333838021, 2724322336, 1767536459, 370938394, 182621114, 3854606378, 1128014560, 487725847, 185469197, 2918353863, 3106780840, 3356761769, 2237133081, 1286567175, 3152976349, 4255350624, 2683765030, 3160175349, 3309594171, 878443390, 1988838185, 3704300486, 1756818940, 1673061617, 3403100636, 272786309, 1075025698, 545572369, 2105887268, 4174560061, 296679730, 1841768865, 1260232239, 4091327024, 3960309330, 3497509347, 1814803222, 2578018489, 4195456072, 575138148, 3299409036, 446754879, 3629546796, 4011996048, 3347532110, 3252238545, 4270639778, 915985419, 3483825537, 681933534, 651868046, 2755636671, 3828103837, 223377554, 2607439820, 1649704518, 3270937875, 3901806776, 1580087799, 4118987695, 3198115200, 2087309459, 2842678573, 3016697106, 1003007129, 2802849917, 1860738147, 2077965243, 164439672, 4100872472, 32283319, 2827177882, 1709610350, 2125135846, 136428751, 3874428392, 3652904859, 3460984630, 3572145929, 3593056380, 2939266226, 824852259, 818324884, 3224740454, 930369212, 2801566410, 2967507152, 355706840, 1257309336, 4148292826, 243256656, 790073846, 2373340630, 1296297904, 1422699085, 3756299780, 3818836405, 457992840, 3099667487, 2135319889, 77422314, 1560382517, 1945798516, 788204353, 1521706781, 1385356242, 870912086, 325965383, 2358957921, 2050466060, 2388260884, 2313884476, 4006521127, 901210569, 3990953189, 1014646705, 1503449823, 1062597235, 2031621326, 3212035895, 3931371469, 1533017514, 350174575, 2256028891, 2177544179, 1052338372, 741876788, 1606591296, 1914052035, 213705253, 2334669897, 1107234197, 1899603969, 3725069491, 2631447780, 2422494913, 1635502980, 1893020342, 1950903388, 1120974935];
4335 var T7 = [2807058932, 1699970625, 2764249623, 1586903591, 1808481195, 1173430173, 1487645946, 59984867, 4199882800, 1844882806, 1989249228, 1277555970, 3623636965, 3419915562, 1149249077, 2744104290, 1514790577, 459744698, 244860394, 3235995134, 1963115311, 4027744588, 2544078150, 4190530515, 1608975247, 2627016082, 2062270317, 1507497298, 2200818878, 567498868, 1764313568, 3359936201, 2305455554, 2037970062, 1047239e3, 1910319033, 1337376481, 2904027272, 2892417312, 984907214, 1243112415, 830661914, 861968209, 2135253587, 2011214180, 2927934315, 2686254721, 731183368, 1750626376, 4246310725, 1820824798, 4172763771, 3542330227, 48394827, 2404901663, 2871682645, 671593195, 3254988725, 2073724613, 145085239, 2280796200, 2779915199, 1790575107, 2187128086, 472615631, 3029510009, 4075877127, 3802222185, 4107101658, 3201631749, 1646252340, 4270507174, 1402811438, 1436590835, 3778151818, 3950355702, 3963161475, 4020912224, 2667994737, 273792366, 2331590177, 104699613, 95345982, 3175501286, 2377486676, 1560637892, 3564045318, 369057872, 4213447064, 3919042237, 1137477952, 2658625497, 1119727848, 2340947849, 1530455833, 4007360968, 172466556, 266959938, 516552836, 0, 2256734592, 3980931627, 1890328081, 1917742170, 4294704398, 945164165, 3575528878, 958871085, 3647212047, 2787207260, 1423022939, 775562294, 1739656202, 3876557655, 2530391278, 2443058075, 3310321856, 547512796, 1265195639, 437656594, 3121275539, 719700128, 3762502690, 387781147, 218828297, 3350065803, 2830708150, 2848461854, 428169201, 122466165, 3720081049, 1627235199, 648017665, 4122762354, 1002783846, 2117360635, 695634755, 3336358691, 4234721005, 4049844452, 3704280881, 2232435299, 574624663, 287343814, 612205898, 1039717051, 840019705, 2708326185, 793451934, 821288114, 1391201670, 3822090177, 376187827, 3113855344, 1224348052, 1679968233, 2361698556, 1058709744, 752375421, 2431590963, 1321699145, 3519142200, 2734591178, 188127444, 2177869557, 3727205754, 2384911031, 3215212461, 2648976442, 2450346104, 3432737375, 1180849278, 331544205, 3102249176, 4150144569, 2952102595, 2159976285, 2474404304, 766078933, 313773861, 2570832044, 2108100632, 1668212892, 3145456443, 2013908262, 418672217, 3070356634, 2594734927, 1852171925, 3867060991, 3473416636, 3907448597, 2614737639, 919489135, 164948639, 2094410160, 2997825956, 590424639, 2486224549, 1723872674, 3157750862, 3399941250, 3501252752, 3625268135, 2555048196, 3673637356, 1343127501, 4130281361, 3599595085, 2957853679, 1297403050, 81781910, 3051593425, 2283490410, 532201772, 1367295589, 3926170974, 895287692, 1953757831, 1093597963, 492483431, 3528626907, 1446242576, 1192455638, 1636604631, 209336225, 344873464, 1015671571, 669961897, 3375740769, 3857572124, 2973530695, 3747192018, 1933530610, 3464042516, 935293895, 3454686199, 2858115069, 1863638845, 3683022916, 4085369519, 3292445032, 875313188, 1080017571, 3279033885, 621591778, 1233856572, 2504130317, 24197544, 3017672716, 3835484340, 3247465558, 2220981195, 3060847922, 1551124588, 1463996600];
4336 var T8 = [4104605777, 1097159550, 396673818, 660510266, 2875968315, 2638606623, 4200115116, 3808662347, 821712160, 1986918061, 3430322568, 38544885, 3856137295, 718002117, 893681702, 1654886325, 2975484382, 3122358053, 3926825029, 4274053469, 796197571, 1290801793, 1184342925, 3556361835, 2405426947, 2459735317, 1836772287, 1381620373, 3196267988, 1948373848, 3764988233, 3385345166, 3263785589, 2390325492, 1480485785, 3111247143, 3780097726, 2293045232, 548169417, 3459953789, 3746175075, 439452389, 1362321559, 1400849762, 1685577905, 1806599355, 2174754046, 137073913, 1214797936, 1174215055, 3731654548, 2079897426, 1943217067, 1258480242, 529487843, 1437280870, 3945269170, 3049390895, 3313212038, 923313619, 679998e3, 3215307299, 57326082, 377642221, 3474729866, 2041877159, 133361907, 1776460110, 3673476453, 96392454, 878845905, 2801699524, 777231668, 4082475170, 2330014213, 4142626212, 2213296395, 1626319424, 1906247262, 1846563261, 562755902, 3708173718, 1040559837, 3871163981, 1418573201, 3294430577, 114585348, 1343618912, 2566595609, 3186202582, 1078185097, 3651041127, 3896688048, 2307622919, 425408743, 3371096953, 2081048481, 1108339068, 2216610296, 0, 2156299017, 736970802, 292596766, 1517440620, 251657213, 2235061775, 2933202493, 758720310, 265905162, 1554391400, 1532285339, 908999204, 174567692, 1474760595, 4002861748, 2610011675, 3234156416, 3693126241, 2001430874, 303699484, 2478443234, 2687165888, 585122620, 454499602, 151849742, 2345119218, 3064510765, 514443284, 4044981591, 1963412655, 2581445614, 2137062819, 19308535, 1928707164, 1715193156, 4219352155, 1126790795, 600235211, 3992742070, 3841024952, 836553431, 1669664834, 2535604243, 3323011204, 1243905413, 3141400786, 4180808110, 698445255, 2653899549, 2989552604, 2253581325, 3252932727, 3004591147, 1891211689, 2487810577, 3915653703, 4237083816, 4030667424, 2100090966, 865136418, 1229899655, 953270745, 3399679628, 3557504664, 4118925222, 2061379749, 3079546586, 2915017791, 983426092, 2022837584, 1607244650, 2118541908, 2366882550, 3635996816, 972512814, 3283088770, 1568718495, 3499326569, 3576539503, 621982671, 2895723464, 410887952, 2623762152, 1002142683, 645401037, 1494807662, 2595684844, 1335535747, 2507040230, 4293295786, 3167684641, 367585007, 3885750714, 1865862730, 2668221674, 2960971305, 2763173681, 1059270954, 2777952454, 2724642869, 1320957812, 2194319100, 2429595872, 2815956275, 77089521, 3973773121, 3444575871, 2448830231, 1305906550, 4021308739, 2857194700, 2516901860, 3518358430, 1787304780, 740276417, 1699839814, 1592394909, 2352307457, 2272556026, 188821243, 1729977011, 3687994002, 274084841, 3594982253, 3613494426, 2701949495, 4162096729, 322734571, 2837966542, 1640576439, 484830689, 1202797690, 3537852828, 4067639125, 349075736, 3342319475, 4157467219, 4255800159, 1030690015, 1155237496, 2951971274, 1757691577, 607398968, 2738905026, 499347990, 3794078908, 1011452712, 227885567, 2818666809, 213114376, 3034881240, 1455525988, 3414450555, 850817237, 1817998408, 3092726480];
4337 var U1 = [0, 235474187, 470948374, 303765277, 941896748, 908933415, 607530554, 708780849, 1883793496, 2118214995, 1817866830, 1649639237, 1215061108, 1181045119, 1417561698, 1517767529, 3767586992, 4003061179, 4236429990, 4069246893, 3635733660, 3602770327, 3299278474, 3400528769, 2430122216, 2664543715, 2362090238, 2193862645, 2835123396, 2801107407, 3035535058, 3135740889, 3678124923, 3576870512, 3341394285, 3374361702, 3810496343, 3977675356, 4279080257, 4043610186, 2876494627, 2776292904, 3076639029, 3110650942, 2472011535, 2640243204, 2403728665, 2169303058, 1001089995, 899835584, 666464733, 699432150, 59727847, 226906860, 530400753, 294930682, 1273168787, 1172967064, 1475418501, 1509430414, 1942435775, 2110667444, 1876241833, 1641816226, 2910219766, 2743034109, 2976151520, 3211623147, 2505202138, 2606453969, 2302690252, 2269728455, 3711829422, 3543599269, 3240894392, 3475313331, 3843699074, 3943906441, 4178062228, 4144047775, 1306967366, 1139781709, 1374988112, 1610459739, 1975683434, 2076935265, 1775276924, 1742315127, 1034867998, 866637845, 566021896, 800440835, 92987698, 193195065, 429456164, 395441711, 1984812685, 2017778566, 1784663195, 1683407248, 1315562145, 1080094634, 1383856311, 1551037884, 101039829, 135050206, 437757123, 337553864, 1042385657, 807962610, 573804783, 742039012, 2531067453, 2564033334, 2328828971, 2227573024, 2935566865, 2700099354, 3001755655, 3168937228, 3868552805, 3902563182, 4203181171, 4102977912, 3736164937, 3501741890, 3265478751, 3433712980, 1106041591, 1340463100, 1576976609, 1408749034, 2043211483, 2009195472, 1708848333, 1809054150, 832877231, 1068351396, 766945465, 599762354, 159417987, 126454664, 361929877, 463180190, 2709260871, 2943682380, 3178106961, 3009879386, 2572697195, 2538681184, 2236228733, 2336434550, 3509871135, 3745345300, 3441850377, 3274667266, 3910161971, 3877198648, 4110568485, 4211818798, 2597806476, 2497604743, 2261089178, 2295101073, 2733856160, 2902087851, 3202437046, 2968011453, 3936291284, 3835036895, 4136440770, 4169408201, 3535486456, 3702665459, 3467192302, 3231722213, 2051518780, 1951317047, 1716890410, 1750902305, 1113818384, 1282050075, 1584504582, 1350078989, 168810852, 67556463, 371049330, 404016761, 841739592, 1008918595, 775550814, 540080725, 3969562369, 3801332234, 4035489047, 4269907996, 3569255213, 3669462566, 3366754619, 3332740144, 2631065433, 2463879762, 2160117071, 2395588676, 2767645557, 2868897406, 3102011747, 3069049960, 202008497, 33778362, 270040487, 504459436, 875451293, 975658646, 675039627, 641025152, 2084704233, 1917518562, 1615861247, 1851332852, 1147550661, 1248802510, 1484005843, 1451044056, 933301370, 967311729, 733156972, 632953703, 260388950, 25965917, 328671808, 496906059, 1206477858, 1239443753, 1543208500, 1441952575, 2144161806, 1908694277, 1675577880, 1842759443, 3610369226, 3644379585, 3408119516, 3307916247, 4011190502, 3776767469, 4077384432, 4245618683, 2809771154, 2842737049, 3144396420, 3043140495, 2673705150, 2438237621, 2203032232, 2370213795];
4338 var U2 = [0, 185469197, 370938394, 487725847, 741876788, 657861945, 975451694, 824852259, 1483753576, 1400783205, 1315723890, 1164071807, 1950903388, 2135319889, 1649704518, 1767536459, 2967507152, 3152976349, 2801566410, 2918353863, 2631447780, 2547432937, 2328143614, 2177544179, 3901806776, 3818836405, 4270639778, 4118987695, 3299409036, 3483825537, 3535072918, 3652904859, 2077965243, 1893020342, 1841768865, 1724457132, 1474502543, 1559041666, 1107234197, 1257309336, 598438867, 681933534, 901210569, 1052338372, 261314535, 77422314, 428819965, 310463728, 3409685355, 3224740454, 3710368113, 3593056380, 3875770207, 3960309330, 4045380933, 4195456072, 2471224067, 2554718734, 2237133081, 2388260884, 3212035895, 3028143674, 2842678573, 2724322336, 4138563181, 4255350624, 3769721975, 3955191162, 3667219033, 3516619604, 3431546947, 3347532110, 2933734917, 2782082824, 3099667487, 3016697106, 2196052529, 2313884476, 2499348523, 2683765030, 1179510461, 1296297904, 1347548327, 1533017514, 1786102409, 1635502980, 2087309459, 2003294622, 507358933, 355706840, 136428751, 53458370, 839224033, 957055980, 605657339, 790073846, 2373340630, 2256028891, 2607439820, 2422494913, 2706270690, 2856345839, 3075636216, 3160175349, 3573941694, 3725069491, 3273267108, 3356761769, 4181598602, 4063242375, 4011996048, 3828103837, 1033297158, 915985419, 730517276, 545572369, 296679730, 446754879, 129166120, 213705253, 1709610350, 1860738147, 1945798516, 2029293177, 1239331162, 1120974935, 1606591296, 1422699085, 4148292826, 4233094615, 3781033664, 3931371469, 3682191598, 3497509347, 3446004468, 3328955385, 2939266226, 2755636671, 3106780840, 2988687269, 2198438022, 2282195339, 2501218972, 2652609425, 1201765386, 1286567175, 1371368976, 1521706781, 1805211710, 1620529459, 2105887268, 1988838185, 533804130, 350174575, 164439672, 46346101, 870912086, 954669403, 636813900, 788204353, 2358957921, 2274680428, 2592523643, 2441661558, 2695033685, 2880240216, 3065962831, 3182487618, 3572145929, 3756299780, 3270937875, 3388507166, 4174560061, 4091327024, 4006521127, 3854606378, 1014646705, 930369212, 711349675, 560487590, 272786309, 457992840, 106852767, 223377554, 1678381017, 1862534868, 1914052035, 2031621326, 1211247597, 1128014560, 1580087799, 1428173050, 32283319, 182621114, 401639597, 486441376, 768917123, 651868046, 1003007129, 818324884, 1503449823, 1385356242, 1333838021, 1150208456, 1973745387, 2125135846, 1673061617, 1756818940, 2970356327, 3120694122, 2802849917, 2887651696, 2637442643, 2520393566, 2334669897, 2149987652, 3917234703, 3799141122, 4284502037, 4100872472, 3309594171, 3460984630, 3545789473, 3629546796, 2050466060, 1899603969, 1814803222, 1730525723, 1443857720, 1560382517, 1075025698, 1260232239, 575138148, 692707433, 878443390, 1062597235, 243256656, 91341917, 409198410, 325965383, 3403100636, 3252238545, 3704300486, 3620022987, 3874428392, 3990953189, 4042459122, 4227665663, 2460449204, 2578018489, 2226875310, 2411029155, 3198115200, 3046200461, 2827177882, 2743944855];
4339 var U3 = [0, 218828297, 437656594, 387781147, 875313188, 958871085, 775562294, 590424639, 1750626376, 1699970625, 1917742170, 2135253587, 1551124588, 1367295589, 1180849278, 1265195639, 3501252752, 3720081049, 3399941250, 3350065803, 3835484340, 3919042237, 4270507174, 4085369519, 3102249176, 3051593425, 2734591178, 2952102595, 2361698556, 2177869557, 2530391278, 2614737639, 3145456443, 3060847922, 2708326185, 2892417312, 2404901663, 2187128086, 2504130317, 2555048196, 3542330227, 3727205754, 3375740769, 3292445032, 3876557655, 3926170974, 4246310725, 4027744588, 1808481195, 1723872674, 1910319033, 2094410160, 1608975247, 1391201670, 1173430173, 1224348052, 59984867, 244860394, 428169201, 344873464, 935293895, 984907214, 766078933, 547512796, 1844882806, 1627235199, 2011214180, 2062270317, 1507497298, 1423022939, 1137477952, 1321699145, 95345982, 145085239, 532201772, 313773861, 830661914, 1015671571, 731183368, 648017665, 3175501286, 2957853679, 2807058932, 2858115069, 2305455554, 2220981195, 2474404304, 2658625497, 3575528878, 3625268135, 3473416636, 3254988725, 3778151818, 3963161475, 4213447064, 4130281361, 3599595085, 3683022916, 3432737375, 3247465558, 3802222185, 4020912224, 4172763771, 4122762354, 3201631749, 3017672716, 2764249623, 2848461854, 2331590177, 2280796200, 2431590963, 2648976442, 104699613, 188127444, 472615631, 287343814, 840019705, 1058709744, 671593195, 621591778, 1852171925, 1668212892, 1953757831, 2037970062, 1514790577, 1463996600, 1080017571, 1297403050, 3673637356, 3623636965, 3235995134, 3454686199, 4007360968, 3822090177, 4107101658, 4190530515, 2997825956, 3215212461, 2830708150, 2779915199, 2256734592, 2340947849, 2627016082, 2443058075, 172466556, 122466165, 273792366, 492483431, 1047239e3, 861968209, 612205898, 695634755, 1646252340, 1863638845, 2013908262, 1963115311, 1446242576, 1530455833, 1277555970, 1093597963, 1636604631, 1820824798, 2073724613, 1989249228, 1436590835, 1487645946, 1337376481, 1119727848, 164948639, 81781910, 331544205, 516552836, 1039717051, 821288114, 669961897, 719700128, 2973530695, 3157750862, 2871682645, 2787207260, 2232435299, 2283490410, 2667994737, 2450346104, 3647212047, 3564045318, 3279033885, 3464042516, 3980931627, 3762502690, 4150144569, 4199882800, 3070356634, 3121275539, 2904027272, 2686254721, 2200818878, 2384911031, 2570832044, 2486224549, 3747192018, 3528626907, 3310321856, 3359936201, 3950355702, 3867060991, 4049844452, 4234721005, 1739656202, 1790575107, 2108100632, 1890328081, 1402811438, 1586903591, 1233856572, 1149249077, 266959938, 48394827, 369057872, 418672217, 1002783846, 919489135, 567498868, 752375421, 209336225, 24197544, 376187827, 459744698, 945164165, 895287692, 574624663, 793451934, 1679968233, 1764313568, 2117360635, 1933530610, 1343127501, 1560637892, 1243112415, 1192455638, 3704280881, 3519142200, 3336358691, 3419915562, 3907448597, 3857572124, 4075877127, 4294704398, 3029510009, 3113855344, 2927934315, 2744104290, 2159976285, 2377486676, 2594734927, 2544078150];
4340 var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925];
4341 function convertToInt32(bytes) {
4343 for (var i3 = 0; i3 < bytes.length; i3 += 4) {
4345 bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
4350 var AES = function(key) {
4351 if (!(this instanceof AES)) {
4352 throw Error("AES must be instanitated with `new`");
4354 Object.defineProperty(this, "key", {
4355 value: coerceArray(key, true)
4359 AES.prototype._prepare = function() {
4360 var rounds = numberOfRounds[this.key.length];
4361 if (rounds == null) {
4362 throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
4366 for (var i3 = 0; i3 <= rounds; i3++) {
4367 this._Ke.push([0, 0, 0, 0]);
4368 this._Kd.push([0, 0, 0, 0]);
4370 var roundKeyCount = (rounds + 1) * 4;
4371 var KC = this.key.length / 4;
4372 var tk = convertToInt32(this.key);
4374 for (var i3 = 0; i3 < KC; i3++) {
4376 this._Ke[index][i3 % 4] = tk[i3];
4377 this._Kd[rounds - index][i3 % 4] = tk[i3];
4379 var rconpointer = 0;
4381 while (t2 < roundKeyCount) {
4383 tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
4386 for (var i3 = 1; i3 < KC; i3++) {
4387 tk[i3] ^= tk[i3 - 1];
4390 for (var i3 = 1; i3 < KC / 2; i3++) {
4391 tk[i3] ^= tk[i3 - 1];
4393 tt2 = tk[KC / 2 - 1];
4394 tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
4395 for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
4396 tk[i3] ^= tk[i3 - 1];
4400 while (i3 < KC && t2 < roundKeyCount) {
4403 this._Ke[r2][c2] = tk[i3];
4404 this._Kd[rounds - r2][c2] = tk[i3++];
4408 for (var r2 = 1; r2 < rounds; r2++) {
4409 for (var c2 = 0; c2 < 4; c2++) {
4410 tt2 = this._Kd[r2][c2];
4411 this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
4415 AES.prototype.encrypt = function(plaintext) {
4416 if (plaintext.length != 16) {
4417 throw new Error("invalid plaintext size (must be 16 bytes)");
4419 var rounds = this._Ke.length - 1;
4420 var a2 = [0, 0, 0, 0];
4421 var t2 = convertToInt32(plaintext);
4422 for (var i3 = 0; i3 < 4; i3++) {
4423 t2[i3] ^= this._Ke[0][i3];
4425 for (var r2 = 1; r2 < rounds; r2++) {
4426 for (var i3 = 0; i3 < 4; i3++) {
4427 a2[i3] = T1[t2[i3] >> 24 & 255] ^ T2[t2[(i3 + 1) % 4] >> 16 & 255] ^ T3[t2[(i3 + 2) % 4] >> 8 & 255] ^ T4[t2[(i3 + 3) % 4] & 255] ^ this._Ke[r2][i3];
4431 var result = createArray(16), tt2;
4432 for (var i3 = 0; i3 < 4; i3++) {
4433 tt2 = this._Ke[rounds][i3];
4434 result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4435 result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4436 result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4437 result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
4441 AES.prototype.decrypt = function(ciphertext) {
4442 if (ciphertext.length != 16) {
4443 throw new Error("invalid ciphertext size (must be 16 bytes)");
4445 var rounds = this._Kd.length - 1;
4446 var a2 = [0, 0, 0, 0];
4447 var t2 = convertToInt32(ciphertext);
4448 for (var i3 = 0; i3 < 4; i3++) {
4449 t2[i3] ^= this._Kd[0][i3];
4451 for (var r2 = 1; r2 < rounds; r2++) {
4452 for (var i3 = 0; i3 < 4; i3++) {
4453 a2[i3] = T5[t2[i3] >> 24 & 255] ^ T6[t2[(i3 + 3) % 4] >> 16 & 255] ^ T7[t2[(i3 + 2) % 4] >> 8 & 255] ^ T8[t2[(i3 + 1) % 4] & 255] ^ this._Kd[r2][i3];
4457 var result = createArray(16), tt2;
4458 for (var i3 = 0; i3 < 4; i3++) {
4459 tt2 = this._Kd[rounds][i3];
4460 result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4461 result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4462 result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4463 result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
4467 var ModeOfOperationECB = function(key) {
4468 if (!(this instanceof ModeOfOperationECB)) {
4469 throw Error("AES must be instanitated with `new`");
4471 this.description = "Electronic Code Block";
4473 this._aes = new AES(key);
4475 ModeOfOperationECB.prototype.encrypt = function(plaintext) {
4476 plaintext = coerceArray(plaintext);
4477 if (plaintext.length % 16 !== 0) {
4478 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4480 var ciphertext = createArray(plaintext.length);
4481 var block2 = createArray(16);
4482 for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4483 copyArray(plaintext, block2, 0, i3, i3 + 16);
4484 block2 = this._aes.encrypt(block2);
4485 copyArray(block2, ciphertext, i3);
4489 ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
4490 ciphertext = coerceArray(ciphertext);
4491 if (ciphertext.length % 16 !== 0) {
4492 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4494 var plaintext = createArray(ciphertext.length);
4495 var block2 = createArray(16);
4496 for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4497 copyArray(ciphertext, block2, 0, i3, i3 + 16);
4498 block2 = this._aes.decrypt(block2);
4499 copyArray(block2, plaintext, i3);
4503 var ModeOfOperationCBC = function(key, iv) {
4504 if (!(this instanceof ModeOfOperationCBC)) {
4505 throw Error("AES must be instanitated with `new`");
4507 this.description = "Cipher Block Chaining";
4510 iv = createArray(16);
4511 } else if (iv.length != 16) {
4512 throw new Error("invalid initialation vector size (must be 16 bytes)");
4514 this._lastCipherblock = coerceArray(iv, true);
4515 this._aes = new AES(key);
4517 ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
4518 plaintext = coerceArray(plaintext);
4519 if (plaintext.length % 16 !== 0) {
4520 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4522 var ciphertext = createArray(plaintext.length);
4523 var block2 = createArray(16);
4524 for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4525 copyArray(plaintext, block2, 0, i3, i3 + 16);
4526 for (var j2 = 0; j2 < 16; j2++) {
4527 block2[j2] ^= this._lastCipherblock[j2];
4529 this._lastCipherblock = this._aes.encrypt(block2);
4530 copyArray(this._lastCipherblock, ciphertext, i3);
4534 ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
4535 ciphertext = coerceArray(ciphertext);
4536 if (ciphertext.length % 16 !== 0) {
4537 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4539 var plaintext = createArray(ciphertext.length);
4540 var block2 = createArray(16);
4541 for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4542 copyArray(ciphertext, block2, 0, i3, i3 + 16);
4543 block2 = this._aes.decrypt(block2);
4544 for (var j2 = 0; j2 < 16; j2++) {
4545 plaintext[i3 + j2] = block2[j2] ^ this._lastCipherblock[j2];
4547 copyArray(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
4551 var ModeOfOperationCFB = function(key, iv, segmentSize) {
4552 if (!(this instanceof ModeOfOperationCFB)) {
4553 throw Error("AES must be instanitated with `new`");
4555 this.description = "Cipher Feedback";
4558 iv = createArray(16);
4559 } else if (iv.length != 16) {
4560 throw new Error("invalid initialation vector size (must be 16 size)");
4565 this.segmentSize = segmentSize;
4566 this._shiftRegister = coerceArray(iv, true);
4567 this._aes = new AES(key);
4569 ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
4570 if (plaintext.length % this.segmentSize != 0) {
4571 throw new Error("invalid plaintext size (must be segmentSize bytes)");
4573 var encrypted = coerceArray(plaintext, true);
4575 for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
4576 xorSegment = this._aes.encrypt(this._shiftRegister);
4577 for (var j2 = 0; j2 < this.segmentSize; j2++) {
4578 encrypted[i3 + j2] ^= xorSegment[j2];
4580 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4581 copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4585 ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
4586 if (ciphertext.length % this.segmentSize != 0) {
4587 throw new Error("invalid ciphertext size (must be segmentSize bytes)");
4589 var plaintext = coerceArray(ciphertext, true);
4591 for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
4592 xorSegment = this._aes.encrypt(this._shiftRegister);
4593 for (var j2 = 0; j2 < this.segmentSize; j2++) {
4594 plaintext[i3 + j2] ^= xorSegment[j2];
4596 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4597 copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4601 var ModeOfOperationOFB = function(key, iv) {
4602 if (!(this instanceof ModeOfOperationOFB)) {
4603 throw Error("AES must be instanitated with `new`");
4605 this.description = "Output Feedback";
4608 iv = createArray(16);
4609 } else if (iv.length != 16) {
4610 throw new Error("invalid initialation vector size (must be 16 bytes)");
4612 this._lastPrecipher = coerceArray(iv, true);
4613 this._lastPrecipherIndex = 16;
4614 this._aes = new AES(key);
4616 ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
4617 var encrypted = coerceArray(plaintext, true);
4618 for (var i3 = 0; i3 < encrypted.length; i3++) {
4619 if (this._lastPrecipherIndex === 16) {
4620 this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
4621 this._lastPrecipherIndex = 0;
4623 encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
4627 ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
4628 var Counter = function(initialValue) {
4629 if (!(this instanceof Counter)) {
4630 throw Error("Counter must be instanitated with `new`");
4632 if (initialValue !== 0 && !initialValue) {
4635 if (typeof initialValue === "number") {
4636 this._counter = createArray(16);
4637 this.setValue(initialValue);
4639 this.setBytes(initialValue);
4642 Counter.prototype.setValue = function(value) {
4643 if (typeof value !== "number" || parseInt(value) != value) {
4644 throw new Error("invalid counter value (must be an integer)");
4646 if (value > Number.MAX_SAFE_INTEGER) {
4647 throw new Error("integer value out of safe range");
4649 for (var index = 15; index >= 0; --index) {
4650 this._counter[index] = value % 256;
4651 value = parseInt(value / 256);
4654 Counter.prototype.setBytes = function(bytes) {
4655 bytes = coerceArray(bytes, true);
4656 if (bytes.length != 16) {
4657 throw new Error("invalid counter bytes size (must be 16 bytes)");
4659 this._counter = bytes;
4661 Counter.prototype.increment = function() {
4662 for (var i3 = 15; i3 >= 0; i3--) {
4663 if (this._counter[i3] === 255) {
4664 this._counter[i3] = 0;
4666 this._counter[i3]++;
4671 var ModeOfOperationCTR = function(key, counter) {
4672 if (!(this instanceof ModeOfOperationCTR)) {
4673 throw Error("AES must be instanitated with `new`");
4675 this.description = "Counter";
4677 if (!(counter instanceof Counter)) {
4678 counter = new Counter(counter);
4680 this._counter = counter;
4681 this._remainingCounter = null;
4682 this._remainingCounterIndex = 16;
4683 this._aes = new AES(key);
4685 ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
4686 var encrypted = coerceArray(plaintext, true);
4687 for (var i3 = 0; i3 < encrypted.length; i3++) {
4688 if (this._remainingCounterIndex === 16) {
4689 this._remainingCounter = this._aes.encrypt(this._counter._counter);
4690 this._remainingCounterIndex = 0;
4691 this._counter.increment();
4693 encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
4697 ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
4698 function pkcs7pad(data) {
4699 data = coerceArray(data, true);
4700 var padder = 16 - data.length % 16;
4701 var result = createArray(data.length + padder);
4702 copyArray(data, result);
4703 for (var i3 = data.length; i3 < result.length; i3++) {
4704 result[i3] = padder;
4708 function pkcs7strip(data) {
4709 data = coerceArray(data, true);
4710 if (data.length < 16) {
4711 throw new Error("PKCS#7 invalid length");
4713 var padder = data[data.length - 1];
4715 throw new Error("PKCS#7 padding byte out of range");
4717 var length2 = data.length - padder;
4718 for (var i3 = 0; i3 < padder; i3++) {
4719 if (data[length2 + i3] !== padder) {
4720 throw new Error("PKCS#7 invalid padding byte");
4723 var result = createArray(length2);
4724 copyArray(data, result, 0, 0, length2);
4731 ecb: ModeOfOperationECB,
4732 cbc: ModeOfOperationCBC,
4733 cfb: ModeOfOperationCFB,
4734 ofb: ModeOfOperationOFB,
4735 ctr: ModeOfOperationCTR
4753 if (typeof exports2 !== "undefined") {
4754 module2.exports = aesjs2;
4755 } else if (typeof define === "function" && define.amd) {
4756 define([], function() {
4761 aesjs2._aesjs = root3.aesjs;
4763 root3.aesjs = aesjs2;
4769 // node_modules/lodash/lodash.js
4770 var require_lodash = __commonJS({
4771 "node_modules/lodash/lodash.js"(exports2, module2) {
4774 var VERSION = "4.17.21";
4775 var LARGE_ARRAY_SIZE2 = 200;
4776 var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT3 = "Expected a function", INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
4777 var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
4778 var MAX_MEMOIZE_SIZE = 500;
4779 var PLACEHOLDER = "__lodash_placeholder__";
4780 var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
4781 var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
4782 var WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512;
4783 var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
4784 var HOT_COUNT = 800, HOT_SPAN = 16;
4785 var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
4786 var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
4787 var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
4789 ["ary", WRAP_ARY_FLAG],
4790 ["bind", WRAP_BIND_FLAG],
4791 ["bindKey", WRAP_BIND_KEY_FLAG],
4792 ["curry", WRAP_CURRY_FLAG],
4793 ["curryRight", WRAP_CURRY_RIGHT_FLAG],
4794 ["flip", WRAP_FLIP_FLAG],
4795 ["partial", WRAP_PARTIAL_FLAG],
4796 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
4797 ["rearg", WRAP_REARG_FLAG]
4799 var argsTag4 = "[object Arguments]", arrayTag3 = "[object Array]", asyncTag2 = "[object AsyncFunction]", boolTag3 = "[object Boolean]", dateTag3 = "[object Date]", domExcTag = "[object DOMException]", errorTag3 = "[object Error]", funcTag3 = "[object Function]", genTag2 = "[object GeneratorFunction]", mapTag4 = "[object Map]", numberTag4 = "[object Number]", nullTag2 = "[object Null]", objectTag4 = "[object Object]", promiseTag2 = "[object Promise]", proxyTag2 = "[object Proxy]", regexpTag3 = "[object RegExp]", setTag4 = "[object Set]", stringTag3 = "[object String]", symbolTag3 = "[object Symbol]", undefinedTag2 = "[object Undefined]", weakMapTag3 = "[object WeakMap]", weakSetTag = "[object WeakSet]";
4800 var arrayBufferTag3 = "[object ArrayBuffer]", dataViewTag4 = "[object DataView]", float32Tag2 = "[object Float32Array]", float64Tag2 = "[object Float64Array]", int8Tag2 = "[object Int8Array]", int16Tag2 = "[object Int16Array]", int32Tag2 = "[object Int32Array]", uint8Tag2 = "[object Uint8Array]", uint8ClampedTag2 = "[object Uint8ClampedArray]", uint16Tag2 = "[object Uint16Array]", uint32Tag2 = "[object Uint32Array]";
4801 var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
4802 var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
4803 var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
4804 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
4805 var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
4806 var reTrimStart2 = /^\s+/;
4807 var reWhitespace2 = /\s/;
4808 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
4809 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
4810 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
4811 var reEscapeChar = /\\(\\)?/g;
4812 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
4813 var reFlags = /\w*$/;
4814 var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
4815 var reIsBinary2 = /^0b[01]+$/i;
4816 var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
4817 var reIsOctal2 = /^0o[0-7]+$/i;
4818 var reIsUint2 = /^(?:0|[1-9]\d*)$/;
4819 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
4820 var reNoMatch = /($^)/;
4821 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
4822 var rsAstralRange = "\\ud800-\\udfff", rsComboMarksRange = "\\u0300-\\u036f", reComboHalfMarksRange = "\\ufe20-\\ufe2f", rsComboSymbolsRange = "\\u20d0-\\u20ff", rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange, rsDingbatRange = "\\u2700-\\u27bf", rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff", rsMathOpRange = "\\xac\\xb1\\xd7\\xf7", rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", rsPunctuationRange = "\\u2000-\\u206f", rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde", rsVarRange = "\\ufe0e\\ufe0f", rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
4823 var rsApos = "['\u2019]", rsAstral = "[" + rsAstralRange + "]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[" + rsDingbatRange + "]", rsLower = "[" + rsLowerRange + "]", rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")", rsNonAstral = "[^" + rsAstralRange + "]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[" + rsUpperRange + "]", rsZWJ = "\\u200d";
4824 var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?", rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?", reOptMod = rsModifier + "?", rsOptVar = "[" + rsVarRange + "]?", rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*", rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", rsSeq = rsOptVar + reOptMod + rsOptJoin, rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
4825 var reApos = RegExp(rsApos, "g");
4826 var reComboMark = RegExp(rsCombo, "g");
4827 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
4828 var reUnicodeWord = RegExp([
4829 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
4830 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
4831 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
4832 rsUpper + "+" + rsOptContrUpper,
4838 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
4839 var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
4840 var contextProps = [
4862 "Uint8ClampedArray",
4872 var templateCounter = -1;
4873 var typedArrayTags2 = {};
4874 typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
4875 typedArrayTags2[argsTag4] = typedArrayTags2[arrayTag3] = typedArrayTags2[arrayBufferTag3] = typedArrayTags2[boolTag3] = typedArrayTags2[dataViewTag4] = typedArrayTags2[dateTag3] = typedArrayTags2[errorTag3] = typedArrayTags2[funcTag3] = typedArrayTags2[mapTag4] = typedArrayTags2[numberTag4] = typedArrayTags2[objectTag4] = typedArrayTags2[regexpTag3] = typedArrayTags2[setTag4] = typedArrayTags2[stringTag3] = typedArrayTags2[weakMapTag3] = false;
4876 var cloneableTags = {};
4877 cloneableTags[argsTag4] = cloneableTags[arrayTag3] = cloneableTags[arrayBufferTag3] = cloneableTags[dataViewTag4] = cloneableTags[boolTag3] = cloneableTags[dateTag3] = cloneableTags[float32Tag2] = cloneableTags[float64Tag2] = cloneableTags[int8Tag2] = cloneableTags[int16Tag2] = cloneableTags[int32Tag2] = cloneableTags[mapTag4] = cloneableTags[numberTag4] = cloneableTags[objectTag4] = cloneableTags[regexpTag3] = cloneableTags[setTag4] = cloneableTags[stringTag3] = cloneableTags[symbolTag3] = cloneableTags[uint8Tag2] = cloneableTags[uint8ClampedTag2] = cloneableTags[uint16Tag2] = cloneableTags[uint32Tag2] = true;
4878 cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
4879 var deburredLetters = {
4880 // Latin-1 Supplement block.
4943 // Latin Extended-A block.
5073 var htmlEscapes2 = {
5080 var htmlUnescapes2 = {
5087 var stringEscapes = {
5095 var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
5096 var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
5097 var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
5098 var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
5099 var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
5100 var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
5101 var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
5102 var freeProcess2 = moduleExports3 && freeGlobal2.process;
5103 var nodeUtil2 = function() {
5105 var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
5109 return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
5113 var nodeIsArrayBuffer = nodeUtil2 && nodeUtil2.isArrayBuffer, nodeIsDate = nodeUtil2 && nodeUtil2.isDate, nodeIsMap = nodeUtil2 && nodeUtil2.isMap, nodeIsRegExp = nodeUtil2 && nodeUtil2.isRegExp, nodeIsSet = nodeUtil2 && nodeUtil2.isSet, nodeIsTypedArray2 = nodeUtil2 && nodeUtil2.isTypedArray;
5114 function apply(func, thisArg, args) {
5115 switch (args.length) {
5117 return func.call(thisArg);
5119 return func.call(thisArg, args[0]);
5121 return func.call(thisArg, args[0], args[1]);
5123 return func.call(thisArg, args[0], args[1], args[2]);
5125 return func.apply(thisArg, args);
5127 function arrayAggregator(array2, setter, iteratee, accumulator) {
5128 var index = -1, length2 = array2 == null ? 0 : array2.length;
5129 while (++index < length2) {
5130 var value = array2[index];
5131 setter(accumulator, value, iteratee(value), array2);
5135 function arrayEach(array2, iteratee) {
5136 var index = -1, length2 = array2 == null ? 0 : array2.length;
5137 while (++index < length2) {
5138 if (iteratee(array2[index], index, array2) === false) {
5144 function arrayEachRight(array2, iteratee) {
5145 var length2 = array2 == null ? 0 : array2.length;
5147 if (iteratee(array2[length2], length2, array2) === false) {
5153 function arrayEvery(array2, predicate) {
5154 var index = -1, length2 = array2 == null ? 0 : array2.length;
5155 while (++index < length2) {
5156 if (!predicate(array2[index], index, array2)) {
5162 function arrayFilter2(array2, predicate) {
5163 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
5164 while (++index < length2) {
5165 var value = array2[index];
5166 if (predicate(value, index, array2)) {
5167 result[resIndex++] = value;
5172 function arrayIncludes(array2, value) {
5173 var length2 = array2 == null ? 0 : array2.length;
5174 return !!length2 && baseIndexOf(array2, value, 0) > -1;
5176 function arrayIncludesWith(array2, value, comparator) {
5177 var index = -1, length2 = array2 == null ? 0 : array2.length;
5178 while (++index < length2) {
5179 if (comparator(value, array2[index])) {
5185 function arrayMap2(array2, iteratee) {
5186 var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
5187 while (++index < length2) {
5188 result[index] = iteratee(array2[index], index, array2);
5192 function arrayPush2(array2, values) {
5193 var index = -1, length2 = values.length, offset = array2.length;
5194 while (++index < length2) {
5195 array2[offset + index] = values[index];
5199 function arrayReduce(array2, iteratee, accumulator, initAccum) {
5200 var index = -1, length2 = array2 == null ? 0 : array2.length;
5201 if (initAccum && length2) {
5202 accumulator = array2[++index];
5204 while (++index < length2) {
5205 accumulator = iteratee(accumulator, array2[index], index, array2);
5209 function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
5210 var length2 = array2 == null ? 0 : array2.length;
5211 if (initAccum && length2) {
5212 accumulator = array2[--length2];
5215 accumulator = iteratee(accumulator, array2[length2], length2, array2);
5219 function arraySome2(array2, predicate) {
5220 var index = -1, length2 = array2 == null ? 0 : array2.length;
5221 while (++index < length2) {
5222 if (predicate(array2[index], index, array2)) {
5228 var asciiSize = baseProperty("length");
5229 function asciiToArray(string) {
5230 return string.split("");
5232 function asciiWords(string) {
5233 return string.match(reAsciiWord) || [];
5235 function baseFindKey(collection, predicate, eachFunc) {
5237 eachFunc(collection, function(value, key, collection2) {
5238 if (predicate(value, key, collection2)) {
5245 function baseFindIndex(array2, predicate, fromIndex, fromRight) {
5246 var length2 = array2.length, index = fromIndex + (fromRight ? 1 : -1);
5247 while (fromRight ? index-- : ++index < length2) {
5248 if (predicate(array2[index], index, array2)) {
5254 function baseIndexOf(array2, value, fromIndex) {
5255 return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
5257 function baseIndexOfWith(array2, value, fromIndex, comparator) {
5258 var index = fromIndex - 1, length2 = array2.length;
5259 while (++index < length2) {
5260 if (comparator(array2[index], value)) {
5266 function baseIsNaN(value) {
5267 return value !== value;
5269 function baseMean(array2, iteratee) {
5270 var length2 = array2 == null ? 0 : array2.length;
5271 return length2 ? baseSum(array2, iteratee) / length2 : NAN2;
5273 function baseProperty(key) {
5274 return function(object) {
5275 return object == null ? undefined2 : object[key];
5278 function basePropertyOf2(object) {
5279 return function(key) {
5280 return object == null ? undefined2 : object[key];
5283 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
5284 eachFunc(collection, function(value, index, collection2) {
5285 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
5289 function baseSortBy(array2, comparer) {
5290 var length2 = array2.length;
5291 array2.sort(comparer);
5293 array2[length2] = array2[length2].value;
5297 function baseSum(array2, iteratee) {
5298 var result, index = -1, length2 = array2.length;
5299 while (++index < length2) {
5300 var current = iteratee(array2[index]);
5301 if (current !== undefined2) {
5302 result = result === undefined2 ? current : result + current;
5307 function baseTimes2(n3, iteratee) {
5308 var index = -1, result = Array(n3);
5309 while (++index < n3) {
5310 result[index] = iteratee(index);
5314 function baseToPairs(object, props) {
5315 return arrayMap2(props, function(key) {
5316 return [key, object[key]];
5319 function baseTrim2(string) {
5320 return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
5322 function baseUnary2(func) {
5323 return function(value) {
5327 function baseValues(object, props) {
5328 return arrayMap2(props, function(key) {
5332 function cacheHas2(cache, key) {
5333 return cache.has(key);
5335 function charsStartIndex(strSymbols, chrSymbols) {
5336 var index = -1, length2 = strSymbols.length;
5337 while (++index < length2 && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5341 function charsEndIndex(strSymbols, chrSymbols) {
5342 var index = strSymbols.length;
5343 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5347 function countHolders(array2, placeholder) {
5348 var length2 = array2.length, result = 0;
5350 if (array2[length2] === placeholder) {
5356 var deburrLetter = basePropertyOf2(deburredLetters);
5357 var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
5358 function escapeStringChar(chr) {
5359 return "\\" + stringEscapes[chr];
5361 function getValue2(object, key) {
5362 return object == null ? undefined2 : object[key];
5364 function hasUnicode(string) {
5365 return reHasUnicode.test(string);
5367 function hasUnicodeWord(string) {
5368 return reHasUnicodeWord.test(string);
5370 function iteratorToArray(iterator) {
5371 var data, result = [];
5372 while (!(data = iterator.next()).done) {
5373 result.push(data.value);
5377 function mapToArray2(map2) {
5378 var index = -1, result = Array(map2.size);
5379 map2.forEach(function(value, key) {
5380 result[++index] = [key, value];
5384 function overArg2(func, transform2) {
5385 return function(arg) {
5386 return func(transform2(arg));
5389 function replaceHolders(array2, placeholder) {
5390 var index = -1, length2 = array2.length, resIndex = 0, result = [];
5391 while (++index < length2) {
5392 var value = array2[index];
5393 if (value === placeholder || value === PLACEHOLDER) {
5394 array2[index] = PLACEHOLDER;
5395 result[resIndex++] = index;
5400 function setToArray2(set4) {
5401 var index = -1, result = Array(set4.size);
5402 set4.forEach(function(value) {
5403 result[++index] = value;
5407 function setToPairs(set4) {
5408 var index = -1, result = Array(set4.size);
5409 set4.forEach(function(value) {
5410 result[++index] = [value, value];
5414 function strictIndexOf(array2, value, fromIndex) {
5415 var index = fromIndex - 1, length2 = array2.length;
5416 while (++index < length2) {
5417 if (array2[index] === value) {
5423 function strictLastIndexOf(array2, value, fromIndex) {
5424 var index = fromIndex + 1;
5426 if (array2[index] === value) {
5432 function stringSize(string) {
5433 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
5435 function stringToArray(string) {
5436 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
5438 function trimmedEndIndex2(string) {
5439 var index = string.length;
5440 while (index-- && reWhitespace2.test(string.charAt(index))) {
5444 var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
5445 function unicodeSize(string) {
5446 var result = reUnicode.lastIndex = 0;
5447 while (reUnicode.test(string)) {
5452 function unicodeToArray(string) {
5453 return string.match(reUnicode) || [];
5455 function unicodeWords(string) {
5456 return string.match(reUnicodeWord) || [];
5458 var runInContext = function runInContext2(context) {
5459 context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
5460 var Array2 = context.Array, Date2 = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
5461 var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
5462 var coreJsData2 = context["__core-js_shared__"];
5463 var funcToString3 = funcProto3.toString;
5464 var hasOwnProperty10 = objectProto13.hasOwnProperty;
5466 var maskSrcKey2 = function() {
5467 var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
5468 return uid ? "Symbol(src)_1." + uid : "";
5470 var nativeObjectToString3 = objectProto13.toString;
5471 var objectCtorString = funcToString3.call(Object2);
5472 var oldDash = root3._;
5473 var reIsNative2 = RegExp2(
5474 "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5476 var Buffer3 = moduleExports3 ? context.Buffer : undefined2, Symbol3 = context.Symbol, Uint8Array3 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg2(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable3 = objectProto13.propertyIsEnumerable, splice2 = arrayProto2.splice, spreadableSymbol = Symbol3 ? Symbol3.isConcatSpreadable : undefined2, symIterator = Symbol3 ? Symbol3.iterator : undefined2, symToStringTag3 = Symbol3 ? Symbol3.toStringTag : undefined2;
5477 var defineProperty = function() {
5479 var func = getNative2(Object2, "defineProperty");
5485 var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
5486 var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols2 = Object2.getOwnPropertySymbols, nativeIsBuffer2 = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto2.join, nativeKeys2 = overArg2(Object2.keys, Object2), nativeMax2 = Math2.max, nativeMin2 = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto2.reverse;
5487 var DataView3 = getNative2(context, "DataView"), Map3 = getNative2(context, "Map"), Promise3 = getNative2(context, "Promise"), Set3 = getNative2(context, "Set"), WeakMap2 = getNative2(context, "WeakMap"), nativeCreate2 = getNative2(Object2, "create");
5488 var metaMap = WeakMap2 && new WeakMap2();
5490 var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
5491 var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
5492 function lodash(value) {
5493 if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
5494 if (value instanceof LodashWrapper) {
5497 if (hasOwnProperty10.call(value, "__wrapped__")) {
5498 return wrapperClone(value);
5501 return new LodashWrapper(value);
5503 var baseCreate = /* @__PURE__ */ function() {
5506 return function(proto) {
5507 if (!isObject3(proto)) {
5511 return objectCreate(proto);
5513 object.prototype = proto;
5514 var result2 = new object();
5515 object.prototype = undefined2;
5519 function baseLodash() {
5521 function LodashWrapper(value, chainAll) {
5522 this.__wrapped__ = value;
5523 this.__actions__ = [];
5524 this.__chain__ = !!chainAll;
5526 this.__values__ = undefined2;
5528 lodash.templateSettings = {
5530 * Used to detect `data` property values to be HTML-escaped.
5532 * @memberOf _.templateSettings
5537 * Used to detect code to be evaluated.
5539 * @memberOf _.templateSettings
5542 "evaluate": reEvaluate,
5544 * Used to detect `data` property values to inject.
5546 * @memberOf _.templateSettings
5549 "interpolate": reInterpolate,
5551 * Used to reference the data object in the template text.
5553 * @memberOf _.templateSettings
5558 * Used to import variables into the compiled template.
5560 * @memberOf _.templateSettings
5565 * A reference to the `lodash` function.
5567 * @memberOf _.templateSettings.imports
5573 lodash.prototype = baseLodash.prototype;
5574 lodash.prototype.constructor = lodash;
5575 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
5576 LodashWrapper.prototype.constructor = LodashWrapper;
5577 function LazyWrapper(value) {
5578 this.__wrapped__ = value;
5579 this.__actions__ = [];
5581 this.__filtered__ = false;
5582 this.__iteratees__ = [];
5583 this.__takeCount__ = MAX_ARRAY_LENGTH;
5584 this.__views__ = [];
5586 function lazyClone() {
5587 var result2 = new LazyWrapper(this.__wrapped__);
5588 result2.__actions__ = copyArray(this.__actions__);
5589 result2.__dir__ = this.__dir__;
5590 result2.__filtered__ = this.__filtered__;
5591 result2.__iteratees__ = copyArray(this.__iteratees__);
5592 result2.__takeCount__ = this.__takeCount__;
5593 result2.__views__ = copyArray(this.__views__);
5596 function lazyReverse() {
5597 if (this.__filtered__) {
5598 var result2 = new LazyWrapper(this);
5599 result2.__dir__ = -1;
5600 result2.__filtered__ = true;
5602 result2 = this.clone();
5603 result2.__dir__ *= -1;
5607 function lazyValue() {
5608 var array2 = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray2(array2), isRight = dir < 0, arrLength = isArr ? array2.length : 0, view = getView(0, arrLength, this.__views__), start2 = view.start, end = view.end, length2 = end - start2, index = isRight ? end : start2 - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin2(length2, this.__takeCount__);
5609 if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
5610 return baseWrapperValue(array2, this.__actions__);
5614 while (length2-- && resIndex < takeCount) {
5616 var iterIndex = -1, value = array2[index];
5617 while (++iterIndex < iterLength) {
5618 var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
5619 if (type2 == LAZY_MAP_FLAG) {
5621 } else if (!computed) {
5622 if (type2 == LAZY_FILTER_FLAG) {
5629 result2[resIndex++] = value;
5633 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
5634 LazyWrapper.prototype.constructor = LazyWrapper;
5635 function Hash2(entries) {
5636 var index = -1, length2 = entries == null ? 0 : entries.length;
5638 while (++index < length2) {
5639 var entry = entries[index];
5640 this.set(entry[0], entry[1]);
5643 function hashClear2() {
5644 this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
5647 function hashDelete2(key) {
5648 var result2 = this.has(key) && delete this.__data__[key];
5649 this.size -= result2 ? 1 : 0;
5652 function hashGet2(key) {
5653 var data = this.__data__;
5654 if (nativeCreate2) {
5655 var result2 = data[key];
5656 return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
5658 return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
5660 function hashHas2(key) {
5661 var data = this.__data__;
5662 return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
5664 function hashSet2(key, value) {
5665 var data = this.__data__;
5666 this.size += this.has(key) ? 0 : 1;
5667 data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
5670 Hash2.prototype.clear = hashClear2;
5671 Hash2.prototype["delete"] = hashDelete2;
5672 Hash2.prototype.get = hashGet2;
5673 Hash2.prototype.has = hashHas2;
5674 Hash2.prototype.set = hashSet2;
5675 function ListCache2(entries) {
5676 var index = -1, length2 = entries == null ? 0 : entries.length;
5678 while (++index < length2) {
5679 var entry = entries[index];
5680 this.set(entry[0], entry[1]);
5683 function listCacheClear2() {
5687 function listCacheDelete2(key) {
5688 var data = this.__data__, index = assocIndexOf2(data, key);
5692 var lastIndex = data.length - 1;
5693 if (index == lastIndex) {
5696 splice2.call(data, index, 1);
5701 function listCacheGet2(key) {
5702 var data = this.__data__, index = assocIndexOf2(data, key);
5703 return index < 0 ? undefined2 : data[index][1];
5705 function listCacheHas2(key) {
5706 return assocIndexOf2(this.__data__, key) > -1;
5708 function listCacheSet2(key, value) {
5709 var data = this.__data__, index = assocIndexOf2(data, key);
5712 data.push([key, value]);
5714 data[index][1] = value;
5718 ListCache2.prototype.clear = listCacheClear2;
5719 ListCache2.prototype["delete"] = listCacheDelete2;
5720 ListCache2.prototype.get = listCacheGet2;
5721 ListCache2.prototype.has = listCacheHas2;
5722 ListCache2.prototype.set = listCacheSet2;
5723 function MapCache2(entries) {
5724 var index = -1, length2 = entries == null ? 0 : entries.length;
5726 while (++index < length2) {
5727 var entry = entries[index];
5728 this.set(entry[0], entry[1]);
5731 function mapCacheClear2() {
5734 "hash": new Hash2(),
5735 "map": new (Map3 || ListCache2)(),
5736 "string": new Hash2()
5739 function mapCacheDelete2(key) {
5740 var result2 = getMapData2(this, key)["delete"](key);
5741 this.size -= result2 ? 1 : 0;
5744 function mapCacheGet2(key) {
5745 return getMapData2(this, key).get(key);
5747 function mapCacheHas2(key) {
5748 return getMapData2(this, key).has(key);
5750 function mapCacheSet2(key, value) {
5751 var data = getMapData2(this, key), size2 = data.size;
5752 data.set(key, value);
5753 this.size += data.size == size2 ? 0 : 1;
5756 MapCache2.prototype.clear = mapCacheClear2;
5757 MapCache2.prototype["delete"] = mapCacheDelete2;
5758 MapCache2.prototype.get = mapCacheGet2;
5759 MapCache2.prototype.has = mapCacheHas2;
5760 MapCache2.prototype.set = mapCacheSet2;
5761 function SetCache2(values2) {
5762 var index = -1, length2 = values2 == null ? 0 : values2.length;
5763 this.__data__ = new MapCache2();
5764 while (++index < length2) {
5765 this.add(values2[index]);
5768 function setCacheAdd2(value) {
5769 this.__data__.set(value, HASH_UNDEFINED4);
5772 function setCacheHas2(value) {
5773 return this.__data__.has(value);
5775 SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
5776 SetCache2.prototype.has = setCacheHas2;
5777 function Stack2(entries) {
5778 var data = this.__data__ = new ListCache2(entries);
5779 this.size = data.size;
5781 function stackClear2() {
5782 this.__data__ = new ListCache2();
5785 function stackDelete2(key) {
5786 var data = this.__data__, result2 = data["delete"](key);
5787 this.size = data.size;
5790 function stackGet2(key) {
5791 return this.__data__.get(key);
5793 function stackHas2(key) {
5794 return this.__data__.has(key);
5796 function stackSet2(key, value) {
5797 var data = this.__data__;
5798 if (data instanceof ListCache2) {
5799 var pairs2 = data.__data__;
5800 if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
5801 pairs2.push([key, value]);
5802 this.size = ++data.size;
5805 data = this.__data__ = new MapCache2(pairs2);
5807 data.set(key, value);
5808 this.size = data.size;
5811 Stack2.prototype.clear = stackClear2;
5812 Stack2.prototype["delete"] = stackDelete2;
5813 Stack2.prototype.get = stackGet2;
5814 Stack2.prototype.has = stackHas2;
5815 Stack2.prototype.set = stackSet2;
5816 function arrayLikeKeys2(value, inherited) {
5817 var isArr = isArray2(value), isArg = !isArr && isArguments2(value), isBuff = !isArr && !isArg && isBuffer2(value), isType = !isArr && !isArg && !isBuff && isTypedArray2(value), skipIndexes = isArr || isArg || isBuff || isType, result2 = skipIndexes ? baseTimes2(value.length, String2) : [], length2 = result2.length;
5818 for (var key in value) {
5819 if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
5820 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
5821 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
5822 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
5823 isIndex2(key, length2)))) {
5829 function arraySample(array2) {
5830 var length2 = array2.length;
5831 return length2 ? array2[baseRandom(0, length2 - 1)] : undefined2;
5833 function arraySampleSize(array2, n3) {
5834 return shuffleSelf(copyArray(array2), baseClamp(n3, 0, array2.length));
5836 function arrayShuffle(array2) {
5837 return shuffleSelf(copyArray(array2));
5839 function assignMergeValue(object, key, value) {
5840 if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
5841 baseAssignValue(object, key, value);
5844 function assignValue(object, key, value) {
5845 var objValue = object[key];
5846 if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
5847 baseAssignValue(object, key, value);
5850 function assocIndexOf2(array2, key) {
5851 var length2 = array2.length;
5853 if (eq2(array2[length2][0], key)) {
5859 function baseAggregator(collection, setter, iteratee2, accumulator) {
5860 baseEach(collection, function(value, key, collection2) {
5861 setter(accumulator, value, iteratee2(value), collection2);
5865 function baseAssign(object, source) {
5866 return object && copyObject(source, keys2(source), object);
5868 function baseAssignIn(object, source) {
5869 return object && copyObject(source, keysIn(source), object);
5871 function baseAssignValue(object, key, value) {
5872 if (key == "__proto__" && defineProperty) {
5873 defineProperty(object, key, {
5874 "configurable": true,
5880 object[key] = value;
5883 function baseAt(object, paths) {
5884 var index = -1, length2 = paths.length, result2 = Array2(length2), skip = object == null;
5885 while (++index < length2) {
5886 result2[index] = skip ? undefined2 : get4(object, paths[index]);
5890 function baseClamp(number3, lower2, upper) {
5891 if (number3 === number3) {
5892 if (upper !== undefined2) {
5893 number3 = number3 <= upper ? number3 : upper;
5895 if (lower2 !== undefined2) {
5896 number3 = number3 >= lower2 ? number3 : lower2;
5901 function baseClone(value, bitmask, customizer, key, object, stack) {
5902 var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
5904 result2 = object ? customizer(value, key, object, stack) : customizer(value);
5906 if (result2 !== undefined2) {
5909 if (!isObject3(value)) {
5912 var isArr = isArray2(value);
5914 result2 = initCloneArray(value);
5916 return copyArray(value, result2);
5919 var tag2 = getTag2(value), isFunc = tag2 == funcTag3 || tag2 == genTag2;
5920 if (isBuffer2(value)) {
5921 return cloneBuffer(value, isDeep);
5923 if (tag2 == objectTag4 || tag2 == argsTag4 || isFunc && !object) {
5924 result2 = isFlat || isFunc ? {} : initCloneObject(value);
5926 return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
5929 if (!cloneableTags[tag2]) {
5930 return object ? value : {};
5932 result2 = initCloneByTag(value, tag2, isDeep);
5935 stack || (stack = new Stack2());
5936 var stacked = stack.get(value);
5940 stack.set(value, result2);
5942 value.forEach(function(subValue) {
5943 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
5945 } else if (isMap(value)) {
5946 value.forEach(function(subValue, key2) {
5947 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5950 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
5951 var props = isArr ? undefined2 : keysFunc(value);
5952 arrayEach(props || value, function(subValue, key2) {
5955 subValue = value[key2];
5957 assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5961 function baseConforms(source) {
5962 var props = keys2(source);
5963 return function(object) {
5964 return baseConformsTo(object, source, props);
5967 function baseConformsTo(object, source, props) {
5968 var length2 = props.length;
5969 if (object == null) {
5972 object = Object2(object);
5974 var key = props[length2], predicate = source[key], value = object[key];
5975 if (value === undefined2 && !(key in object) || !predicate(value)) {
5981 function baseDelay(func, wait, args) {
5982 if (typeof func != "function") {
5983 throw new TypeError2(FUNC_ERROR_TEXT3);
5985 return setTimeout2(function() {
5986 func.apply(undefined2, args);
5989 function baseDifference(array2, values2, iteratee2, comparator) {
5990 var index = -1, includes2 = arrayIncludes, isCommon = true, length2 = array2.length, result2 = [], valuesLength = values2.length;
5995 values2 = arrayMap2(values2, baseUnary2(iteratee2));
5998 includes2 = arrayIncludesWith;
6000 } else if (values2.length >= LARGE_ARRAY_SIZE2) {
6001 includes2 = cacheHas2;
6003 values2 = new SetCache2(values2);
6006 while (++index < length2) {
6007 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
6008 value = comparator || value !== 0 ? value : 0;
6009 if (isCommon && computed === computed) {
6010 var valuesIndex = valuesLength;
6011 while (valuesIndex--) {
6012 if (values2[valuesIndex] === computed) {
6016 result2.push(value);
6017 } else if (!includes2(values2, computed, comparator)) {
6018 result2.push(value);
6023 var baseEach = createBaseEach(baseForOwn);
6024 var baseEachRight = createBaseEach(baseForOwnRight, true);
6025 function baseEvery(collection, predicate) {
6027 baseEach(collection, function(value, index, collection2) {
6028 result2 = !!predicate(value, index, collection2);
6033 function baseExtremum(array2, iteratee2, comparator) {
6034 var index = -1, length2 = array2.length;
6035 while (++index < length2) {
6036 var value = array2[index], current = iteratee2(value);
6037 if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
6038 var computed = current, result2 = value;
6043 function baseFill(array2, value, start2, end) {
6044 var length2 = array2.length;
6045 start2 = toInteger(start2);
6047 start2 = -start2 > length2 ? 0 : length2 + start2;
6049 end = end === undefined2 || end > length2 ? length2 : toInteger(end);
6053 end = start2 > end ? 0 : toLength(end);
6054 while (start2 < end) {
6055 array2[start2++] = value;
6059 function baseFilter(collection, predicate) {
6061 baseEach(collection, function(value, index, collection2) {
6062 if (predicate(value, index, collection2)) {
6063 result2.push(value);
6068 function baseFlatten(array2, depth, predicate, isStrict, result2) {
6069 var index = -1, length2 = array2.length;
6070 predicate || (predicate = isFlattenable);
6071 result2 || (result2 = []);
6072 while (++index < length2) {
6073 var value = array2[index];
6074 if (depth > 0 && predicate(value)) {
6076 baseFlatten(value, depth - 1, predicate, isStrict, result2);
6078 arrayPush2(result2, value);
6080 } else if (!isStrict) {
6081 result2[result2.length] = value;
6086 var baseFor = createBaseFor();
6087 var baseForRight = createBaseFor(true);
6088 function baseForOwn(object, iteratee2) {
6089 return object && baseFor(object, iteratee2, keys2);
6091 function baseForOwnRight(object, iteratee2) {
6092 return object && baseForRight(object, iteratee2, keys2);
6094 function baseFunctions(object, props) {
6095 return arrayFilter2(props, function(key) {
6096 return isFunction2(object[key]);
6099 function baseGet(object, path) {
6100 path = castPath(path, object);
6101 var index = 0, length2 = path.length;
6102 while (object != null && index < length2) {
6103 object = object[toKey(path[index++])];
6105 return index && index == length2 ? object : undefined2;
6107 function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
6108 var result2 = keysFunc(object);
6109 return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
6111 function baseGetTag2(value) {
6112 if (value == null) {
6113 return value === undefined2 ? undefinedTag2 : nullTag2;
6115 return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
6117 function baseGt(value, other) {
6118 return value > other;
6120 function baseHas(object, key) {
6121 return object != null && hasOwnProperty10.call(object, key);
6123 function baseHasIn(object, key) {
6124 return object != null && key in Object2(object);
6126 function baseInRange(number3, start2, end) {
6127 return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
6129 function baseIntersection(arrays, iteratee2, comparator) {
6130 var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
6131 while (othIndex--) {
6132 var array2 = arrays[othIndex];
6133 if (othIndex && iteratee2) {
6134 array2 = arrayMap2(array2, baseUnary2(iteratee2));
6136 maxLength = nativeMin2(array2.length, maxLength);
6137 caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
6140 var index = -1, seen = caches[0];
6142 while (++index < length2 && result2.length < maxLength) {
6143 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6144 value = comparator || value !== 0 ? value : 0;
6145 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
6146 othIndex = othLength;
6147 while (--othIndex) {
6148 var cache = caches[othIndex];
6149 if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
6154 seen.push(computed);
6156 result2.push(value);
6161 function baseInverter(object, setter, iteratee2, accumulator) {
6162 baseForOwn(object, function(value, key, object2) {
6163 setter(accumulator, iteratee2(value), key, object2);
6167 function baseInvoke(object, path, args) {
6168 path = castPath(path, object);
6169 object = parent(object, path);
6170 var func = object == null ? object : object[toKey(last(path))];
6171 return func == null ? undefined2 : apply(func, object, args);
6173 function baseIsArguments2(value) {
6174 return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
6176 function baseIsArrayBuffer(value) {
6177 return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
6179 function baseIsDate(value) {
6180 return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
6182 function baseIsEqual2(value, other, bitmask, customizer, stack) {
6183 if (value === other) {
6186 if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
6187 return value !== value && other !== other;
6189 return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
6191 function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
6192 var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
6193 objTag = objTag == argsTag4 ? objectTag4 : objTag;
6194 othTag = othTag == argsTag4 ? objectTag4 : othTag;
6195 var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
6196 if (isSameTag && isBuffer2(object)) {
6197 if (!isBuffer2(other)) {
6203 if (isSameTag && !objIsObj) {
6204 stack || (stack = new Stack2());
6205 return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
6207 if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
6208 var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
6209 if (objIsWrapped || othIsWrapped) {
6210 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
6211 stack || (stack = new Stack2());
6212 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
6218 stack || (stack = new Stack2());
6219 return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
6221 function baseIsMap(value) {
6222 return isObjectLike2(value) && getTag2(value) == mapTag4;
6224 function baseIsMatch(object, source, matchData, customizer) {
6225 var index = matchData.length, length2 = index, noCustomizer = !customizer;
6226 if (object == null) {
6229 object = Object2(object);
6231 var data = matchData[index];
6232 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
6236 while (++index < length2) {
6237 data = matchData[index];
6238 var key = data[0], objValue = object[key], srcValue = data[1];
6239 if (noCustomizer && data[2]) {
6240 if (objValue === undefined2 && !(key in object)) {
6244 var stack = new Stack2();
6246 var result2 = customizer(objValue, srcValue, key, object, source, stack);
6248 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
6255 function baseIsNative2(value) {
6256 if (!isObject3(value) || isMasked2(value)) {
6259 var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
6260 return pattern.test(toSource2(value));
6262 function baseIsRegExp(value) {
6263 return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
6265 function baseIsSet(value) {
6266 return isObjectLike2(value) && getTag2(value) == setTag4;
6268 function baseIsTypedArray2(value) {
6269 return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
6271 function baseIteratee(value) {
6272 if (typeof value == "function") {
6275 if (value == null) {
6278 if (typeof value == "object") {
6279 return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
6281 return property(value);
6283 function baseKeys2(object) {
6284 if (!isPrototype2(object)) {
6285 return nativeKeys2(object);
6288 for (var key in Object2(object)) {
6289 if (hasOwnProperty10.call(object, key) && key != "constructor") {
6295 function baseKeysIn(object) {
6296 if (!isObject3(object)) {
6297 return nativeKeysIn(object);
6299 var isProto = isPrototype2(object), result2 = [];
6300 for (var key in object) {
6301 if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
6307 function baseLt(value, other) {
6308 return value < other;
6310 function baseMap(collection, iteratee2) {
6311 var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
6312 baseEach(collection, function(value, key, collection2) {
6313 result2[++index] = iteratee2(value, key, collection2);
6317 function baseMatches(source) {
6318 var matchData = getMatchData(source);
6319 if (matchData.length == 1 && matchData[0][2]) {
6320 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
6322 return function(object) {
6323 return object === source || baseIsMatch(object, source, matchData);
6326 function baseMatchesProperty(path, srcValue) {
6327 if (isKey(path) && isStrictComparable(srcValue)) {
6328 return matchesStrictComparable(toKey(path), srcValue);
6330 return function(object) {
6331 var objValue = get4(object, path);
6332 return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
6335 function baseMerge(object, source, srcIndex, customizer, stack) {
6336 if (object === source) {
6339 baseFor(source, function(srcValue, key) {
6340 stack || (stack = new Stack2());
6341 if (isObject3(srcValue)) {
6342 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
6344 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
6345 if (newValue === undefined2) {
6346 newValue = srcValue;
6348 assignMergeValue(object, key, newValue);
6352 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
6353 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
6355 assignMergeValue(object, key, stacked);
6358 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
6359 var isCommon = newValue === undefined2;
6361 var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
6362 newValue = srcValue;
6363 if (isArr || isBuff || isTyped) {
6364 if (isArray2(objValue)) {
6365 newValue = objValue;
6366 } else if (isArrayLikeObject(objValue)) {
6367 newValue = copyArray(objValue);
6368 } else if (isBuff) {
6370 newValue = cloneBuffer(srcValue, true);
6371 } else if (isTyped) {
6373 newValue = cloneTypedArray(srcValue, true);
6377 } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
6378 newValue = objValue;
6379 if (isArguments2(objValue)) {
6380 newValue = toPlainObject(objValue);
6381 } else if (!isObject3(objValue) || isFunction2(objValue)) {
6382 newValue = initCloneObject(srcValue);
6389 stack.set(srcValue, newValue);
6390 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
6391 stack["delete"](srcValue);
6393 assignMergeValue(object, key, newValue);
6395 function baseNth(array2, n3) {
6396 var length2 = array2.length;
6400 n3 += n3 < 0 ? length2 : 0;
6401 return isIndex2(n3, length2) ? array2[n3] : undefined2;
6403 function baseOrderBy(collection, iteratees, orders) {
6404 if (iteratees.length) {
6405 iteratees = arrayMap2(iteratees, function(iteratee2) {
6406 if (isArray2(iteratee2)) {
6407 return function(value) {
6408 return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
6414 iteratees = [identity4];
6417 iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
6418 var result2 = baseMap(collection, function(value, key, collection2) {
6419 var criteria = arrayMap2(iteratees, function(iteratee2) {
6420 return iteratee2(value);
6422 return { "criteria": criteria, "index": ++index, "value": value };
6424 return baseSortBy(result2, function(object, other) {
6425 return compareMultiple(object, other, orders);
6428 function basePick(object, paths) {
6429 return basePickBy(object, paths, function(value, path) {
6430 return hasIn(object, path);
6433 function basePickBy(object, paths, predicate) {
6434 var index = -1, length2 = paths.length, result2 = {};
6435 while (++index < length2) {
6436 var path = paths[index], value = baseGet(object, path);
6437 if (predicate(value, path)) {
6438 baseSet(result2, castPath(path, object), value);
6443 function basePropertyDeep(path) {
6444 return function(object) {
6445 return baseGet(object, path);
6448 function basePullAll(array2, values2, iteratee2, comparator) {
6449 var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length2 = values2.length, seen = array2;
6450 if (array2 === values2) {
6451 values2 = copyArray(values2);
6454 seen = arrayMap2(array2, baseUnary2(iteratee2));
6456 while (++index < length2) {
6457 var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
6458 while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
6459 if (seen !== array2) {
6460 splice2.call(seen, fromIndex, 1);
6462 splice2.call(array2, fromIndex, 1);
6467 function basePullAt(array2, indexes) {
6468 var length2 = array2 ? indexes.length : 0, lastIndex = length2 - 1;
6470 var index = indexes[length2];
6471 if (length2 == lastIndex || index !== previous) {
6472 var previous = index;
6473 if (isIndex2(index)) {
6474 splice2.call(array2, index, 1);
6476 baseUnset(array2, index);
6482 function baseRandom(lower2, upper) {
6483 return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
6485 function baseRange(start2, end, step, fromRight) {
6486 var index = -1, length2 = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length2);
6488 result2[fromRight ? length2 : ++index] = start2;
6493 function baseRepeat(string, n3) {
6495 if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
6502 n3 = nativeFloor(n3 / 2);
6509 function baseRest(func, start2) {
6510 return setToString(overRest(func, start2, identity4), func + "");
6512 function baseSample(collection) {
6513 return arraySample(values(collection));
6515 function baseSampleSize(collection, n3) {
6516 var array2 = values(collection);
6517 return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
6519 function baseSet(object, path, value, customizer) {
6520 if (!isObject3(object)) {
6523 path = castPath(path, object);
6524 var index = -1, length2 = path.length, lastIndex = length2 - 1, nested = object;
6525 while (nested != null && ++index < length2) {
6526 var key = toKey(path[index]), newValue = value;
6527 if (key === "__proto__" || key === "constructor" || key === "prototype") {
6530 if (index != lastIndex) {
6531 var objValue = nested[key];
6532 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
6533 if (newValue === undefined2) {
6534 newValue = isObject3(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
6537 assignValue(nested, key, newValue);
6538 nested = nested[key];
6542 var baseSetData = !metaMap ? identity4 : function(func, data) {
6543 metaMap.set(func, data);
6546 var baseSetToString = !defineProperty ? identity4 : function(func, string) {
6547 return defineProperty(func, "toString", {
6548 "configurable": true,
6549 "enumerable": false,
6550 "value": constant(string),
6554 function baseShuffle(collection) {
6555 return shuffleSelf(values(collection));
6557 function baseSlice(array2, start2, end) {
6558 var index = -1, length2 = array2.length;
6560 start2 = -start2 > length2 ? 0 : length2 + start2;
6562 end = end > length2 ? length2 : end;
6566 length2 = start2 > end ? 0 : end - start2 >>> 0;
6568 var result2 = Array2(length2);
6569 while (++index < length2) {
6570 result2[index] = array2[index + start2];
6574 function baseSome(collection, predicate) {
6576 baseEach(collection, function(value, index, collection2) {
6577 result2 = predicate(value, index, collection2);
6582 function baseSortedIndex(array2, value, retHighest) {
6583 var low = 0, high = array2 == null ? low : array2.length;
6584 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
6585 while (low < high) {
6586 var mid = low + high >>> 1, computed = array2[mid];
6587 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
6595 return baseSortedIndexBy(array2, value, identity4, retHighest);
6597 function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
6598 var low = 0, high = array2 == null ? 0 : array2.length;
6602 value = iteratee2(value);
6603 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
6604 while (low < high) {
6605 var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
6607 var setLow = retHighest || othIsReflexive;
6608 } else if (valIsUndefined) {
6609 setLow = othIsReflexive && (retHighest || othIsDefined);
6610 } else if (valIsNull) {
6611 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
6612 } else if (valIsSymbol) {
6613 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
6614 } else if (othIsNull || othIsSymbol) {
6617 setLow = retHighest ? computed <= value : computed < value;
6625 return nativeMin2(high, MAX_ARRAY_INDEX);
6627 function baseSortedUniq(array2, iteratee2) {
6628 var index = -1, length2 = array2.length, resIndex = 0, result2 = [];
6629 while (++index < length2) {
6630 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6631 if (!index || !eq2(computed, seen)) {
6632 var seen = computed;
6633 result2[resIndex++] = value === 0 ? 0 : value;
6638 function baseToNumber(value) {
6639 if (typeof value == "number") {
6642 if (isSymbol2(value)) {
6647 function baseToString2(value) {
6648 if (typeof value == "string") {
6651 if (isArray2(value)) {
6652 return arrayMap2(value, baseToString2) + "";
6654 if (isSymbol2(value)) {
6655 return symbolToString2 ? symbolToString2.call(value) : "";
6657 var result2 = value + "";
6658 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
6660 function baseUniq(array2, iteratee2, comparator) {
6661 var index = -1, includes2 = arrayIncludes, length2 = array2.length, isCommon = true, result2 = [], seen = result2;
6664 includes2 = arrayIncludesWith;
6665 } else if (length2 >= LARGE_ARRAY_SIZE2) {
6666 var set5 = iteratee2 ? null : createSet(array2);
6668 return setToArray2(set5);
6671 includes2 = cacheHas2;
6672 seen = new SetCache2();
6674 seen = iteratee2 ? [] : result2;
6677 while (++index < length2) {
6678 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6679 value = comparator || value !== 0 ? value : 0;
6680 if (isCommon && computed === computed) {
6681 var seenIndex = seen.length;
6682 while (seenIndex--) {
6683 if (seen[seenIndex] === computed) {
6688 seen.push(computed);
6690 result2.push(value);
6691 } else if (!includes2(seen, computed, comparator)) {
6692 if (seen !== result2) {
6693 seen.push(computed);
6695 result2.push(value);
6700 function baseUnset(object, path) {
6701 path = castPath(path, object);
6702 object = parent(object, path);
6703 return object == null || delete object[toKey(last(path))];
6705 function baseUpdate(object, path, updater, customizer) {
6706 return baseSet(object, path, updater(baseGet(object, path)), customizer);
6708 function baseWhile(array2, predicate, isDrop, fromRight) {
6709 var length2 = array2.length, index = fromRight ? length2 : -1;
6710 while ((fromRight ? index-- : ++index < length2) && predicate(array2[index], index, array2)) {
6712 return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length2) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length2 : index);
6714 function baseWrapperValue(value, actions) {
6715 var result2 = value;
6716 if (result2 instanceof LazyWrapper) {
6717 result2 = result2.value();
6719 return arrayReduce(actions, function(result3, action) {
6720 return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
6723 function baseXor(arrays, iteratee2, comparator) {
6724 var length2 = arrays.length;
6726 return length2 ? baseUniq(arrays[0]) : [];
6728 var index = -1, result2 = Array2(length2);
6729 while (++index < length2) {
6730 var array2 = arrays[index], othIndex = -1;
6731 while (++othIndex < length2) {
6732 if (othIndex != index) {
6733 result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
6737 return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
6739 function baseZipObject(props, values2, assignFunc) {
6740 var index = -1, length2 = props.length, valsLength = values2.length, result2 = {};
6741 while (++index < length2) {
6742 var value = index < valsLength ? values2[index] : undefined2;
6743 assignFunc(result2, props[index], value);
6747 function castArrayLikeObject(value) {
6748 return isArrayLikeObject(value) ? value : [];
6750 function castFunction(value) {
6751 return typeof value == "function" ? value : identity4;
6753 function castPath(value, object) {
6754 if (isArray2(value)) {
6757 return isKey(value, object) ? [value] : stringToPath(toString2(value));
6759 var castRest = baseRest;
6760 function castSlice(array2, start2, end) {
6761 var length2 = array2.length;
6762 end = end === undefined2 ? length2 : end;
6763 return !start2 && end >= length2 ? array2 : baseSlice(array2, start2, end);
6765 var clearTimeout2 = ctxClearTimeout || function(id2) {
6766 return root3.clearTimeout(id2);
6768 function cloneBuffer(buffer, isDeep) {
6770 return buffer.slice();
6772 var length2 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
6773 buffer.copy(result2);
6776 function cloneArrayBuffer(arrayBuffer) {
6777 var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
6778 new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
6781 function cloneDataView(dataView, isDeep) {
6782 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
6783 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
6785 function cloneRegExp(regexp) {
6786 var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
6787 result2.lastIndex = regexp.lastIndex;
6790 function cloneSymbol(symbol) {
6791 return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
6793 function cloneTypedArray(typedArray, isDeep) {
6794 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
6795 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
6797 function compareAscending(value, other) {
6798 if (value !== other) {
6799 var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
6800 var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
6801 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
6804 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
6810 function compareMultiple(object, other, orders) {
6811 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length;
6812 while (++index < length2) {
6813 var result2 = compareAscending(objCriteria[index], othCriteria[index]);
6815 if (index >= ordersLength) {
6818 var order = orders[index];
6819 return result2 * (order == "desc" ? -1 : 1);
6822 return object.index - other.index;
6824 function composeArgs(args, partials, holders, isCurried) {
6825 var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(leftLength + rangeLength), isUncurried = !isCurried;
6826 while (++leftIndex < leftLength) {
6827 result2[leftIndex] = partials[leftIndex];
6829 while (++argsIndex < holdersLength) {
6830 if (isUncurried || argsIndex < argsLength) {
6831 result2[holders[argsIndex]] = args[argsIndex];
6834 while (rangeLength--) {
6835 result2[leftIndex++] = args[argsIndex++];
6839 function composeArgsRight(args, partials, holders, isCurried) {
6840 var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax2(argsLength - holdersLength, 0), result2 = Array2(rangeLength + rightLength), isUncurried = !isCurried;
6841 while (++argsIndex < rangeLength) {
6842 result2[argsIndex] = args[argsIndex];
6844 var offset = argsIndex;
6845 while (++rightIndex < rightLength) {
6846 result2[offset + rightIndex] = partials[rightIndex];
6848 while (++holdersIndex < holdersLength) {
6849 if (isUncurried || argsIndex < argsLength) {
6850 result2[offset + holders[holdersIndex]] = args[argsIndex++];
6855 function copyArray(source, array2) {
6856 var index = -1, length2 = source.length;
6857 array2 || (array2 = Array2(length2));
6858 while (++index < length2) {
6859 array2[index] = source[index];
6863 function copyObject(source, props, object, customizer) {
6864 var isNew = !object;
6865 object || (object = {});
6866 var index = -1, length2 = props.length;
6867 while (++index < length2) {
6868 var key = props[index];
6869 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
6870 if (newValue === undefined2) {
6871 newValue = source[key];
6874 baseAssignValue(object, key, newValue);
6876 assignValue(object, key, newValue);
6881 function copySymbols(source, object) {
6882 return copyObject(source, getSymbols2(source), object);
6884 function copySymbolsIn(source, object) {
6885 return copyObject(source, getSymbolsIn(source), object);
6887 function createAggregator(setter, initializer) {
6888 return function(collection, iteratee2) {
6889 var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
6890 return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
6893 function createAssigner(assigner) {
6894 return baseRest(function(object, sources) {
6895 var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined2, guard = length2 > 2 ? sources[2] : undefined2;
6896 customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined2;
6897 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
6898 customizer = length2 < 3 ? undefined2 : customizer;
6901 object = Object2(object);
6902 while (++index < length2) {
6903 var source = sources[index];
6905 assigner(object, source, index, customizer);
6911 function createBaseEach(eachFunc, fromRight) {
6912 return function(collection, iteratee2) {
6913 if (collection == null) {
6916 if (!isArrayLike2(collection)) {
6917 return eachFunc(collection, iteratee2);
6919 var length2 = collection.length, index = fromRight ? length2 : -1, iterable = Object2(collection);
6920 while (fromRight ? index-- : ++index < length2) {
6921 if (iteratee2(iterable[index], index, iterable) === false) {
6928 function createBaseFor(fromRight) {
6929 return function(object, iteratee2, keysFunc) {
6930 var index = -1, iterable = Object2(object), props = keysFunc(object), length2 = props.length;
6932 var key = props[fromRight ? length2 : ++index];
6933 if (iteratee2(iterable[key], key, iterable) === false) {
6940 function createBind(func, bitmask, thisArg) {
6941 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
6942 function wrapper() {
6943 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
6944 return fn.apply(isBind ? thisArg : this, arguments);
6948 function createCaseFirst(methodName) {
6949 return function(string) {
6950 string = toString2(string);
6951 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
6952 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
6953 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
6954 return chr[methodName]() + trailing;
6957 function createCompounder(callback) {
6958 return function(string) {
6959 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
6962 function createCtor(Ctor) {
6964 var args = arguments;
6965 switch (args.length) {
6969 return new Ctor(args[0]);
6971 return new Ctor(args[0], args[1]);
6973 return new Ctor(args[0], args[1], args[2]);
6975 return new Ctor(args[0], args[1], args[2], args[3]);
6977 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6979 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6981 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6983 var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
6984 return isObject3(result2) ? result2 : thisBinding;
6987 function createCurry(func, bitmask, arity) {
6988 var Ctor = createCtor(func);
6989 function wrapper() {
6990 var length2 = arguments.length, args = Array2(length2), index = length2, placeholder = getHolder(wrapper);
6992 args[index] = arguments[index];
6994 var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
6995 length2 -= holders.length;
6996 if (length2 < arity) {
6997 return createRecurry(
7001 wrapper.placeholder,
7010 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
7011 return apply(fn, this, args);
7015 function createFind(findIndexFunc) {
7016 return function(collection, predicate, fromIndex) {
7017 var iterable = Object2(collection);
7018 if (!isArrayLike2(collection)) {
7019 var iteratee2 = getIteratee(predicate, 3);
7020 collection = keys2(collection);
7021 predicate = function(key) {
7022 return iteratee2(iterable[key], key, iterable);
7025 var index = findIndexFunc(collection, predicate, fromIndex);
7026 return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
7029 function createFlow(fromRight) {
7030 return flatRest(function(funcs) {
7031 var length2 = funcs.length, index = length2, prereq = LodashWrapper.prototype.thru;
7036 var func = funcs[index];
7037 if (typeof func != "function") {
7038 throw new TypeError2(FUNC_ERROR_TEXT3);
7040 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
7041 var wrapper = new LodashWrapper([], true);
7044 index = wrapper ? index : length2;
7045 while (++index < length2) {
7046 func = funcs[index];
7047 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
7048 if (data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && data[9] == 1) {
7049 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
7051 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
7055 var args = arguments, value = args[0];
7056 if (wrapper && args.length == 1 && isArray2(value)) {
7057 return wrapper.plant(value).value();
7059 var index2 = 0, result2 = length2 ? funcs[index2].apply(this, args) : value;
7060 while (++index2 < length2) {
7061 result2 = funcs[index2].call(this, result2);
7067 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
7068 var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined2 : createCtor(func);
7069 function wrapper() {
7070 var length2 = arguments.length, args = Array2(length2), index = length2;
7072 args[index] = arguments[index];
7075 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
7078 args = composeArgs(args, partials, holders, isCurried);
7080 if (partialsRight) {
7081 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
7083 length2 -= holdersCount;
7084 if (isCurried && length2 < arity) {
7085 var newHolders = replaceHolders(args, placeholder);
7086 return createRecurry(
7090 wrapper.placeholder,
7099 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
7100 length2 = args.length;
7102 args = reorder(args, argPos);
7103 } else if (isFlip && length2 > 1) {
7106 if (isAry && ary2 < length2) {
7109 if (this && this !== root3 && this instanceof wrapper) {
7110 fn = Ctor || createCtor(fn);
7112 return fn.apply(thisBinding, args);
7116 function createInverter(setter, toIteratee) {
7117 return function(object, iteratee2) {
7118 return baseInverter(object, setter, toIteratee(iteratee2), {});
7121 function createMathOperation(operator, defaultValue) {
7122 return function(value, other) {
7124 if (value === undefined2 && other === undefined2) {
7125 return defaultValue;
7127 if (value !== undefined2) {
7130 if (other !== undefined2) {
7131 if (result2 === undefined2) {
7134 if (typeof value == "string" || typeof other == "string") {
7135 value = baseToString2(value);
7136 other = baseToString2(other);
7138 value = baseToNumber(value);
7139 other = baseToNumber(other);
7141 result2 = operator(value, other);
7146 function createOver(arrayFunc) {
7147 return flatRest(function(iteratees) {
7148 iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
7149 return baseRest(function(args) {
7151 return arrayFunc(iteratees, function(iteratee2) {
7152 return apply(iteratee2, thisArg, args);
7157 function createPadding(length2, chars) {
7158 chars = chars === undefined2 ? " " : baseToString2(chars);
7159 var charsLength = chars.length;
7160 if (charsLength < 2) {
7161 return charsLength ? baseRepeat(chars, length2) : chars;
7163 var result2 = baseRepeat(chars, nativeCeil(length2 / stringSize(chars)));
7164 return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length2).join("") : result2.slice(0, length2);
7166 function createPartial(func, bitmask, thisArg, partials) {
7167 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
7168 function wrapper() {
7169 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
7170 while (++leftIndex < leftLength) {
7171 args[leftIndex] = partials[leftIndex];
7173 while (argsLength--) {
7174 args[leftIndex++] = arguments[++argsIndex];
7176 return apply(fn, isBind ? thisArg : this, args);
7180 function createRange(fromRight) {
7181 return function(start2, end, step) {
7182 if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
7183 end = step = undefined2;
7185 start2 = toFinite(start2);
7186 if (end === undefined2) {
7190 end = toFinite(end);
7192 step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
7193 return baseRange(start2, end, step, fromRight);
7196 function createRelationalOperation(operator) {
7197 return function(value, other) {
7198 if (!(typeof value == "string" && typeof other == "string")) {
7199 value = toNumber3(value);
7200 other = toNumber3(other);
7202 return operator(value, other);
7205 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
7206 var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
7207 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
7208 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
7209 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
7210 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
7224 var result2 = wrapFunc.apply(undefined2, newData);
7225 if (isLaziable(func)) {
7226 setData(result2, newData);
7228 result2.placeholder = placeholder;
7229 return setWrapToString(result2, func, bitmask);
7231 function createRound(methodName) {
7232 var func = Math2[methodName];
7233 return function(number3, precision3) {
7234 number3 = toNumber3(number3);
7235 precision3 = precision3 == null ? 0 : nativeMin2(toInteger(precision3), 292);
7236 if (precision3 && nativeIsFinite(number3)) {
7237 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision3));
7238 pair3 = (toString2(value) + "e").split("e");
7239 return +(pair3[0] + "e" + (+pair3[1] - precision3));
7241 return func(number3);
7244 var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
7245 return new Set3(values2);
7247 function createToPairs(keysFunc) {
7248 return function(object) {
7249 var tag2 = getTag2(object);
7250 if (tag2 == mapTag4) {
7251 return mapToArray2(object);
7253 if (tag2 == setTag4) {
7254 return setToPairs(object);
7256 return baseToPairs(object, keysFunc(object));
7259 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
7260 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
7261 if (!isBindKey && typeof func != "function") {
7262 throw new TypeError2(FUNC_ERROR_TEXT3);
7264 var length2 = partials ? partials.length : 0;
7266 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
7267 partials = holders = undefined2;
7269 ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
7270 arity = arity === undefined2 ? arity : toInteger(arity);
7271 length2 -= holders ? holders.length : 0;
7272 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
7273 var partialsRight = partials, holdersRight = holders;
7274 partials = holders = undefined2;
7276 var data = isBindKey ? undefined2 : getData(func);
7290 mergeData(newData, data);
7293 bitmask = newData[1];
7294 thisArg = newData[2];
7295 partials = newData[3];
7296 holders = newData[4];
7297 arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length2, 0);
7298 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
7299 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
7301 if (!bitmask || bitmask == WRAP_BIND_FLAG) {
7302 var result2 = createBind(func, bitmask, thisArg);
7303 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
7304 result2 = createCurry(func, bitmask, arity);
7305 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
7306 result2 = createPartial(func, bitmask, thisArg, partials);
7308 result2 = createHybrid.apply(undefined2, newData);
7310 var setter = data ? baseSetData : setData;
7311 return setWrapToString(setter(result2, newData), func, bitmask);
7313 function customDefaultsAssignIn(objValue, srcValue, key, object) {
7314 if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
7319 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
7320 if (isObject3(objValue) && isObject3(srcValue)) {
7321 stack.set(srcValue, objValue);
7322 baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
7323 stack["delete"](srcValue);
7327 function customOmitClone(value) {
7328 return isPlainObject(value) ? undefined2 : value;
7330 function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
7331 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
7332 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
7335 var arrStacked = stack.get(array2);
7336 var othStacked = stack.get(other);
7337 if (arrStacked && othStacked) {
7338 return arrStacked == other && othStacked == array2;
7340 var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
7341 stack.set(array2, other);
7342 stack.set(other, array2);
7343 while (++index < arrLength) {
7344 var arrValue = array2[index], othValue = other[index];
7346 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
7348 if (compared !== undefined2) {
7356 if (!arraySome2(other, function(othValue2, othIndex) {
7357 if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
7358 return seen.push(othIndex);
7364 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
7369 stack["delete"](array2);
7370 stack["delete"](other);
7373 function equalByTag2(object, other, tag2, bitmask, customizer, equalFunc, stack) {
7376 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
7379 object = object.buffer;
7380 other = other.buffer;
7381 case arrayBufferTag3:
7382 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
7389 return eq2(+object, +other);
7391 return object.name == other.name && object.message == other.message;
7394 return object == other + "";
7396 var convert = mapToArray2;
7398 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
7399 convert || (convert = setToArray2);
7400 if (object.size != other.size && !isPartial) {
7403 var stacked = stack.get(object);
7405 return stacked == other;
7407 bitmask |= COMPARE_UNORDERED_FLAG3;
7408 stack.set(object, other);
7409 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
7410 stack["delete"](object);
7413 if (symbolValueOf2) {
7414 return symbolValueOf2.call(object) == symbolValueOf2.call(other);
7419 function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
7420 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
7421 if (objLength != othLength && !isPartial) {
7424 var index = objLength;
7426 var key = objProps[index];
7427 if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
7431 var objStacked = stack.get(object);
7432 var othStacked = stack.get(other);
7433 if (objStacked && othStacked) {
7434 return objStacked == other && othStacked == object;
7437 stack.set(object, other);
7438 stack.set(other, object);
7439 var skipCtor = isPartial;
7440 while (++index < objLength) {
7441 key = objProps[index];
7442 var objValue = object[key], othValue = other[key];
7444 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
7446 if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
7450 skipCtor || (skipCtor = key == "constructor");
7452 if (result2 && !skipCtor) {
7453 var objCtor = object.constructor, othCtor = other.constructor;
7454 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
7458 stack["delete"](object);
7459 stack["delete"](other);
7462 function flatRest(func) {
7463 return setToString(overRest(func, undefined2, flatten2), func + "");
7465 function getAllKeys2(object) {
7466 return baseGetAllKeys2(object, keys2, getSymbols2);
7468 function getAllKeysIn(object) {
7469 return baseGetAllKeys2(object, keysIn, getSymbolsIn);
7471 var getData = !metaMap ? noop3 : function(func) {
7472 return metaMap.get(func);
7474 function getFuncName(func) {
7475 var result2 = func.name + "", array2 = realNames[result2], length2 = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
7477 var data = array2[length2], otherFunc = data.func;
7478 if (otherFunc == null || otherFunc == func) {
7484 function getHolder(func) {
7485 var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
7486 return object.placeholder;
7488 function getIteratee() {
7489 var result2 = lodash.iteratee || iteratee;
7490 result2 = result2 === iteratee ? baseIteratee : result2;
7491 return arguments.length ? result2(arguments[0], arguments[1]) : result2;
7493 function getMapData2(map3, key) {
7494 var data = map3.__data__;
7495 return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
7497 function getMatchData(object) {
7498 var result2 = keys2(object), length2 = result2.length;
7500 var key = result2[length2], value = object[key];
7501 result2[length2] = [key, value, isStrictComparable(value)];
7505 function getNative2(object, key) {
7506 var value = getValue2(object, key);
7507 return baseIsNative2(value) ? value : undefined2;
7509 function getRawTag2(value) {
7510 var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag2 = value[symToStringTag3];
7512 value[symToStringTag3] = undefined2;
7513 var unmasked = true;
7516 var result2 = nativeObjectToString3.call(value);
7519 value[symToStringTag3] = tag2;
7521 delete value[symToStringTag3];
7526 var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
7527 if (object == null) {
7530 object = Object2(object);
7531 return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
7532 return propertyIsEnumerable3.call(object, symbol);
7535 var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
7538 arrayPush2(result2, getSymbols2(object));
7539 object = getPrototype(object);
7543 var getTag2 = baseGetTag2;
7544 if (DataView3 && getTag2(new DataView3(new ArrayBuffer(1))) != dataViewTag4 || Map3 && getTag2(new Map3()) != mapTag4 || Promise3 && getTag2(Promise3.resolve()) != promiseTag2 || Set3 && getTag2(new Set3()) != setTag4 || WeakMap2 && getTag2(new WeakMap2()) != weakMapTag3) {
7545 getTag2 = function(value) {
7546 var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
7548 switch (ctorString) {
7549 case dataViewCtorString2:
7550 return dataViewTag4;
7551 case mapCtorString2:
7553 case promiseCtorString2:
7555 case setCtorString2:
7557 case weakMapCtorString2:
7564 function getView(start2, end, transforms) {
7565 var index = -1, length2 = transforms.length;
7566 while (++index < length2) {
7567 var data = transforms[index], size2 = data.size;
7568 switch (data.type) {
7576 end = nativeMin2(end, start2 + size2);
7579 start2 = nativeMax2(start2, end - size2);
7583 return { "start": start2, "end": end };
7585 function getWrapDetails(source) {
7586 var match = source.match(reWrapDetails);
7587 return match ? match[1].split(reSplitDetails) : [];
7589 function hasPath(object, path, hasFunc) {
7590 path = castPath(path, object);
7591 var index = -1, length2 = path.length, result2 = false;
7592 while (++index < length2) {
7593 var key = toKey(path[index]);
7594 if (!(result2 = object != null && hasFunc(object, key))) {
7597 object = object[key];
7599 if (result2 || ++index != length2) {
7602 length2 = object == null ? 0 : object.length;
7603 return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray2(object) || isArguments2(object));
7605 function initCloneArray(array2) {
7606 var length2 = array2.length, result2 = new array2.constructor(length2);
7607 if (length2 && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
7608 result2.index = array2.index;
7609 result2.input = array2.input;
7613 function initCloneObject(object) {
7614 return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
7616 function initCloneByTag(object, tag2, isDeep) {
7617 var Ctor = object.constructor;
7619 case arrayBufferTag3:
7620 return cloneArrayBuffer(object);
7623 return new Ctor(+object);
7625 return cloneDataView(object, isDeep);
7632 case uint8ClampedTag2:
7635 return cloneTypedArray(object, isDeep);
7640 return new Ctor(object);
7642 return cloneRegExp(object);
7646 return cloneSymbol(object);
7649 function insertWrapDetails(source, details) {
7650 var length2 = details.length;
7654 var lastIndex = length2 - 1;
7655 details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
7656 details = details.join(length2 > 2 ? ", " : " ");
7657 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
7659 function isFlattenable(value) {
7660 return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
7662 function isIndex2(value, length2) {
7663 var type2 = typeof value;
7664 length2 = length2 == null ? MAX_SAFE_INTEGER4 : length2;
7665 return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
7667 function isIterateeCall(value, index, object) {
7668 if (!isObject3(object)) {
7671 var type2 = typeof index;
7672 if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
7673 return eq2(object[index], value);
7677 function isKey(value, object) {
7678 if (isArray2(value)) {
7681 var type2 = typeof value;
7682 if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
7685 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
7687 function isKeyable2(value) {
7688 var type2 = typeof value;
7689 return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
7691 function isLaziable(func) {
7692 var funcName = getFuncName(func), other = lodash[funcName];
7693 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
7696 if (func === other) {
7699 var data = getData(other);
7700 return !!data && func === data[0];
7702 function isMasked2(func) {
7703 return !!maskSrcKey2 && maskSrcKey2 in func;
7705 var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
7706 function isPrototype2(value) {
7707 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
7708 return value === proto;
7710 function isStrictComparable(value) {
7711 return value === value && !isObject3(value);
7713 function matchesStrictComparable(key, srcValue) {
7714 return function(object) {
7715 if (object == null) {
7718 return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
7721 function memoizeCapped(func) {
7722 var result2 = memoize(func, function(key) {
7723 if (cache.size === MAX_MEMOIZE_SIZE) {
7728 var cache = result2.cache;
7731 function mergeData(data, source) {
7732 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
7733 var isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
7734 if (!(isCommon || isCombo)) {
7737 if (srcBitmask & WRAP_BIND_FLAG) {
7738 data[2] = source[2];
7739 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
7741 var value = source[3];
7743 var partials = data[3];
7744 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
7745 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
7750 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
7751 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
7757 if (srcBitmask & WRAP_ARY_FLAG) {
7758 data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
7760 if (data[9] == null) {
7761 data[9] = source[9];
7763 data[0] = source[0];
7764 data[1] = newBitmask;
7767 function nativeKeysIn(object) {
7769 if (object != null) {
7770 for (var key in Object2(object)) {
7776 function objectToString2(value) {
7777 return nativeObjectToString3.call(value);
7779 function overRest(func, start2, transform3) {
7780 start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
7782 var args = arguments, index = -1, length2 = nativeMax2(args.length - start2, 0), array2 = Array2(length2);
7783 while (++index < length2) {
7784 array2[index] = args[start2 + index];
7787 var otherArgs = Array2(start2 + 1);
7788 while (++index < start2) {
7789 otherArgs[index] = args[index];
7791 otherArgs[start2] = transform3(array2);
7792 return apply(func, this, otherArgs);
7795 function parent(object, path) {
7796 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
7798 function reorder(array2, indexes) {
7799 var arrLength = array2.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
7801 var index = indexes[length2];
7802 array2[length2] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
7806 function safeGet(object, key) {
7807 if (key === "constructor" && typeof object[key] === "function") {
7810 if (key == "__proto__") {
7815 var setData = shortOut(baseSetData);
7816 var setTimeout2 = ctxSetTimeout || function(func, wait) {
7817 return root3.setTimeout(func, wait);
7819 var setToString = shortOut(baseSetToString);
7820 function setWrapToString(wrapper, reference, bitmask) {
7821 var source = reference + "";
7822 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
7824 function shortOut(func) {
7825 var count = 0, lastCalled = 0;
7827 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
7829 if (remaining > 0) {
7830 if (++count >= HOT_COUNT) {
7831 return arguments[0];
7836 return func.apply(undefined2, arguments);
7839 function shuffleSelf(array2, size2) {
7840 var index = -1, length2 = array2.length, lastIndex = length2 - 1;
7841 size2 = size2 === undefined2 ? length2 : size2;
7842 while (++index < size2) {
7843 var rand = baseRandom(index, lastIndex), value = array2[rand];
7844 array2[rand] = array2[index];
7845 array2[index] = value;
7847 array2.length = size2;
7850 var stringToPath = memoizeCapped(function(string) {
7852 if (string.charCodeAt(0) === 46) {
7855 string.replace(rePropName, function(match, number3, quote, subString) {
7856 result2.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
7860 function toKey(value) {
7861 if (typeof value == "string" || isSymbol2(value)) {
7864 var result2 = value + "";
7865 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
7867 function toSource2(func) {
7870 return funcToString3.call(func);
7880 function updateWrapDetails(details, bitmask) {
7881 arrayEach(wrapFlags, function(pair3) {
7882 var value = "_." + pair3[0];
7883 if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
7884 details.push(value);
7887 return details.sort();
7889 function wrapperClone(wrapper) {
7890 if (wrapper instanceof LazyWrapper) {
7891 return wrapper.clone();
7893 var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
7894 result2.__actions__ = copyArray(wrapper.__actions__);
7895 result2.__index__ = wrapper.__index__;
7896 result2.__values__ = wrapper.__values__;
7899 function chunk(array2, size2, guard) {
7900 if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
7903 size2 = nativeMax2(toInteger(size2), 0);
7905 var length2 = array2 == null ? 0 : array2.length;
7906 if (!length2 || size2 < 1) {
7909 var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size2));
7910 while (index < length2) {
7911 result2[resIndex++] = baseSlice(array2, index, index += size2);
7915 function compact(array2) {
7916 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
7917 while (++index < length2) {
7918 var value = array2[index];
7920 result2[resIndex++] = value;
7926 var length2 = arguments.length;
7930 var args = Array2(length2 - 1), array2 = arguments[0], index = length2;
7932 args[index - 1] = arguments[index];
7934 return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
7936 var difference2 = baseRest(function(array2, values2) {
7937 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
7939 var differenceBy = baseRest(function(array2, values2) {
7940 var iteratee2 = last(values2);
7941 if (isArrayLikeObject(iteratee2)) {
7942 iteratee2 = undefined2;
7944 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
7946 var differenceWith = baseRest(function(array2, values2) {
7947 var comparator = last(values2);
7948 if (isArrayLikeObject(comparator)) {
7949 comparator = undefined2;
7951 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
7953 function drop(array2, n3, guard) {
7954 var length2 = array2 == null ? 0 : array2.length;
7958 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7959 return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
7961 function dropRight(array2, n3, guard) {
7962 var length2 = array2 == null ? 0 : array2.length;
7966 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7968 return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
7970 function dropRightWhile(array2, predicate) {
7971 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
7973 function dropWhile(array2, predicate) {
7974 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
7976 function fill(array2, value, start2, end) {
7977 var length2 = array2 == null ? 0 : array2.length;
7981 if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
7985 return baseFill(array2, value, start2, end);
7987 function findIndex(array2, predicate, fromIndex) {
7988 var length2 = array2 == null ? 0 : array2.length;
7992 var index = fromIndex == null ? 0 : toInteger(fromIndex);
7994 index = nativeMax2(length2 + index, 0);
7996 return baseFindIndex(array2, getIteratee(predicate, 3), index);
7998 function findLastIndex(array2, predicate, fromIndex) {
7999 var length2 = array2 == null ? 0 : array2.length;
8003 var index = length2 - 1;
8004 if (fromIndex !== undefined2) {
8005 index = toInteger(fromIndex);
8006 index = fromIndex < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
8008 return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
8010 function flatten2(array2) {
8011 var length2 = array2 == null ? 0 : array2.length;
8012 return length2 ? baseFlatten(array2, 1) : [];
8014 function flattenDeep(array2) {
8015 var length2 = array2 == null ? 0 : array2.length;
8016 return length2 ? baseFlatten(array2, INFINITY2) : [];
8018 function flattenDepth(array2, depth) {
8019 var length2 = array2 == null ? 0 : array2.length;
8023 depth = depth === undefined2 ? 1 : toInteger(depth);
8024 return baseFlatten(array2, depth);
8026 function fromPairs(pairs2) {
8027 var index = -1, length2 = pairs2 == null ? 0 : pairs2.length, result2 = {};
8028 while (++index < length2) {
8029 var pair3 = pairs2[index];
8030 result2[pair3[0]] = pair3[1];
8034 function head(array2) {
8035 return array2 && array2.length ? array2[0] : undefined2;
8037 function indexOf(array2, value, fromIndex) {
8038 var length2 = array2 == null ? 0 : array2.length;
8042 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8044 index = nativeMax2(length2 + index, 0);
8046 return baseIndexOf(array2, value, index);
8048 function initial(array2) {
8049 var length2 = array2 == null ? 0 : array2.length;
8050 return length2 ? baseSlice(array2, 0, -1) : [];
8052 var intersection2 = baseRest(function(arrays) {
8053 var mapped = arrayMap2(arrays, castArrayLikeObject);
8054 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
8056 var intersectionBy = baseRest(function(arrays) {
8057 var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8058 if (iteratee2 === last(mapped)) {
8059 iteratee2 = undefined2;
8063 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
8065 var intersectionWith = baseRest(function(arrays) {
8066 var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8067 comparator = typeof comparator == "function" ? comparator : undefined2;
8071 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
8073 function join(array2, separator) {
8074 return array2 == null ? "" : nativeJoin.call(array2, separator);
8076 function last(array2) {
8077 var length2 = array2 == null ? 0 : array2.length;
8078 return length2 ? array2[length2 - 1] : undefined2;
8080 function lastIndexOf(array2, value, fromIndex) {
8081 var length2 = array2 == null ? 0 : array2.length;
8085 var index = length2;
8086 if (fromIndex !== undefined2) {
8087 index = toInteger(fromIndex);
8088 index = index < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
8090 return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
8092 function nth(array2, n3) {
8093 return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
8095 var pull = baseRest(pullAll);
8096 function pullAll(array2, values2) {
8097 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
8099 function pullAllBy(array2, values2, iteratee2) {
8100 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
8102 function pullAllWith(array2, values2, comparator) {
8103 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
8105 var pullAt = flatRest(function(array2, indexes) {
8106 var length2 = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
8107 basePullAt(array2, arrayMap2(indexes, function(index) {
8108 return isIndex2(index, length2) ? +index : index;
8109 }).sort(compareAscending));
8112 function remove2(array2, predicate) {
8114 if (!(array2 && array2.length)) {
8117 var index = -1, indexes = [], length2 = array2.length;
8118 predicate = getIteratee(predicate, 3);
8119 while (++index < length2) {
8120 var value = array2[index];
8121 if (predicate(value, index, array2)) {
8122 result2.push(value);
8123 indexes.push(index);
8126 basePullAt(array2, indexes);
8129 function reverse(array2) {
8130 return array2 == null ? array2 : nativeReverse.call(array2);
8132 function slice(array2, start2, end) {
8133 var length2 = array2 == null ? 0 : array2.length;
8137 if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
8141 start2 = start2 == null ? 0 : toInteger(start2);
8142 end = end === undefined2 ? length2 : toInteger(end);
8144 return baseSlice(array2, start2, end);
8146 function sortedIndex(array2, value) {
8147 return baseSortedIndex(array2, value);
8149 function sortedIndexBy(array2, value, iteratee2) {
8150 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
8152 function sortedIndexOf(array2, value) {
8153 var length2 = array2 == null ? 0 : array2.length;
8155 var index = baseSortedIndex(array2, value);
8156 if (index < length2 && eq2(array2[index], value)) {
8162 function sortedLastIndex(array2, value) {
8163 return baseSortedIndex(array2, value, true);
8165 function sortedLastIndexBy(array2, value, iteratee2) {
8166 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
8168 function sortedLastIndexOf(array2, value) {
8169 var length2 = array2 == null ? 0 : array2.length;
8171 var index = baseSortedIndex(array2, value, true) - 1;
8172 if (eq2(array2[index], value)) {
8178 function sortedUniq(array2) {
8179 return array2 && array2.length ? baseSortedUniq(array2) : [];
8181 function sortedUniqBy(array2, iteratee2) {
8182 return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
8184 function tail(array2) {
8185 var length2 = array2 == null ? 0 : array2.length;
8186 return length2 ? baseSlice(array2, 1, length2) : [];
8188 function take(array2, n3, guard) {
8189 if (!(array2 && array2.length)) {
8192 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8193 return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
8195 function takeRight(array2, n3, guard) {
8196 var length2 = array2 == null ? 0 : array2.length;
8200 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8202 return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
8204 function takeRightWhile(array2, predicate) {
8205 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
8207 function takeWhile(array2, predicate) {
8208 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
8210 var union2 = baseRest(function(arrays) {
8211 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
8213 var unionBy = baseRest(function(arrays) {
8214 var iteratee2 = last(arrays);
8215 if (isArrayLikeObject(iteratee2)) {
8216 iteratee2 = undefined2;
8218 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
8220 var unionWith = baseRest(function(arrays) {
8221 var comparator = last(arrays);
8222 comparator = typeof comparator == "function" ? comparator : undefined2;
8223 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
8225 function uniq(array2) {
8226 return array2 && array2.length ? baseUniq(array2) : [];
8228 function uniqBy(array2, iteratee2) {
8229 return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
8231 function uniqWith(array2, comparator) {
8232 comparator = typeof comparator == "function" ? comparator : undefined2;
8233 return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
8235 function unzip(array2) {
8236 if (!(array2 && array2.length)) {
8240 array2 = arrayFilter2(array2, function(group) {
8241 if (isArrayLikeObject(group)) {
8242 length2 = nativeMax2(group.length, length2);
8246 return baseTimes2(length2, function(index) {
8247 return arrayMap2(array2, baseProperty(index));
8250 function unzipWith(array2, iteratee2) {
8251 if (!(array2 && array2.length)) {
8254 var result2 = unzip(array2);
8255 if (iteratee2 == null) {
8258 return arrayMap2(result2, function(group) {
8259 return apply(iteratee2, undefined2, group);
8262 var without = baseRest(function(array2, values2) {
8263 return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
8265 var xor = baseRest(function(arrays) {
8266 return baseXor(arrayFilter2(arrays, isArrayLikeObject));
8268 var xorBy = baseRest(function(arrays) {
8269 var iteratee2 = last(arrays);
8270 if (isArrayLikeObject(iteratee2)) {
8271 iteratee2 = undefined2;
8273 return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
8275 var xorWith = baseRest(function(arrays) {
8276 var comparator = last(arrays);
8277 comparator = typeof comparator == "function" ? comparator : undefined2;
8278 return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
8280 var zip = baseRest(unzip);
8281 function zipObject(props, values2) {
8282 return baseZipObject(props || [], values2 || [], assignValue);
8284 function zipObjectDeep(props, values2) {
8285 return baseZipObject(props || [], values2 || [], baseSet);
8287 var zipWith = baseRest(function(arrays) {
8288 var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined2;
8289 iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
8290 return unzipWith(arrays, iteratee2);
8292 function chain(value) {
8293 var result2 = lodash(value);
8294 result2.__chain__ = true;
8297 function tap(value, interceptor) {
8301 function thru(value, interceptor) {
8302 return interceptor(value);
8304 var wrapperAt = flatRest(function(paths) {
8305 var length2 = paths.length, start2 = length2 ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
8306 return baseAt(object, paths);
8308 if (length2 > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
8309 return this.thru(interceptor);
8311 value = value.slice(start2, +start2 + (length2 ? 1 : 0));
8312 value.__actions__.push({
8314 "args": [interceptor],
8315 "thisArg": undefined2
8317 return new LodashWrapper(value, this.__chain__).thru(function(array2) {
8318 if (length2 && !array2.length) {
8319 array2.push(undefined2);
8324 function wrapperChain() {
8327 function wrapperCommit() {
8328 return new LodashWrapper(this.value(), this.__chain__);
8330 function wrapperNext() {
8331 if (this.__values__ === undefined2) {
8332 this.__values__ = toArray(this.value());
8334 var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
8335 return { "done": done, "value": value };
8337 function wrapperToIterator() {
8340 function wrapperPlant(value) {
8341 var result2, parent2 = this;
8342 while (parent2 instanceof baseLodash) {
8343 var clone3 = wrapperClone(parent2);
8344 clone3.__index__ = 0;
8345 clone3.__values__ = undefined2;
8347 previous.__wrapped__ = clone3;
8351 var previous = clone3;
8352 parent2 = parent2.__wrapped__;
8354 previous.__wrapped__ = value;
8357 function wrapperReverse() {
8358 var value = this.__wrapped__;
8359 if (value instanceof LazyWrapper) {
8360 var wrapped = value;
8361 if (this.__actions__.length) {
8362 wrapped = new LazyWrapper(this);
8364 wrapped = wrapped.reverse();
8365 wrapped.__actions__.push({
8368 "thisArg": undefined2
8370 return new LodashWrapper(wrapped, this.__chain__);
8372 return this.thru(reverse);
8374 function wrapperValue() {
8375 return baseWrapperValue(this.__wrapped__, this.__actions__);
8377 var countBy = createAggregator(function(result2, value, key) {
8378 if (hasOwnProperty10.call(result2, key)) {
8381 baseAssignValue(result2, key, 1);
8384 function every(collection, predicate, guard) {
8385 var func = isArray2(collection) ? arrayEvery : baseEvery;
8386 if (guard && isIterateeCall(collection, predicate, guard)) {
8387 predicate = undefined2;
8389 return func(collection, getIteratee(predicate, 3));
8391 function filter2(collection, predicate) {
8392 var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8393 return func(collection, getIteratee(predicate, 3));
8395 var find2 = createFind(findIndex);
8396 var findLast = createFind(findLastIndex);
8397 function flatMap(collection, iteratee2) {
8398 return baseFlatten(map2(collection, iteratee2), 1);
8400 function flatMapDeep(collection, iteratee2) {
8401 return baseFlatten(map2(collection, iteratee2), INFINITY2);
8403 function flatMapDepth(collection, iteratee2, depth) {
8404 depth = depth === undefined2 ? 1 : toInteger(depth);
8405 return baseFlatten(map2(collection, iteratee2), depth);
8407 function forEach(collection, iteratee2) {
8408 var func = isArray2(collection) ? arrayEach : baseEach;
8409 return func(collection, getIteratee(iteratee2, 3));
8411 function forEachRight(collection, iteratee2) {
8412 var func = isArray2(collection) ? arrayEachRight : baseEachRight;
8413 return func(collection, getIteratee(iteratee2, 3));
8415 var groupBy = createAggregator(function(result2, value, key) {
8416 if (hasOwnProperty10.call(result2, key)) {
8417 result2[key].push(value);
8419 baseAssignValue(result2, key, [value]);
8422 function includes(collection, value, fromIndex, guard) {
8423 collection = isArrayLike2(collection) ? collection : values(collection);
8424 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
8425 var length2 = collection.length;
8426 if (fromIndex < 0) {
8427 fromIndex = nativeMax2(length2 + fromIndex, 0);
8429 return isString(collection) ? fromIndex <= length2 && collection.indexOf(value, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value, fromIndex) > -1;
8431 var invokeMap = baseRest(function(collection, path, args) {
8432 var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8433 baseEach(collection, function(value) {
8434 result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
8438 var keyBy = createAggregator(function(result2, value, key) {
8439 baseAssignValue(result2, key, value);
8441 function map2(collection, iteratee2) {
8442 var func = isArray2(collection) ? arrayMap2 : baseMap;
8443 return func(collection, getIteratee(iteratee2, 3));
8445 function orderBy(collection, iteratees, orders, guard) {
8446 if (collection == null) {
8449 if (!isArray2(iteratees)) {
8450 iteratees = iteratees == null ? [] : [iteratees];
8452 orders = guard ? undefined2 : orders;
8453 if (!isArray2(orders)) {
8454 orders = orders == null ? [] : [orders];
8456 return baseOrderBy(collection, iteratees, orders);
8458 var partition = createAggregator(function(result2, value, key) {
8459 result2[key ? 0 : 1].push(value);
8463 function reduce(collection, iteratee2, accumulator) {
8464 var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
8465 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
8467 function reduceRight(collection, iteratee2, accumulator) {
8468 var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
8469 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
8471 function reject(collection, predicate) {
8472 var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8473 return func(collection, negate(getIteratee(predicate, 3)));
8475 function sample(collection) {
8476 var func = isArray2(collection) ? arraySample : baseSample;
8477 return func(collection);
8479 function sampleSize(collection, n3, guard) {
8480 if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
8485 var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
8486 return func(collection, n3);
8488 function shuffle(collection) {
8489 var func = isArray2(collection) ? arrayShuffle : baseShuffle;
8490 return func(collection);
8492 function size(collection) {
8493 if (collection == null) {
8496 if (isArrayLike2(collection)) {
8497 return isString(collection) ? stringSize(collection) : collection.length;
8499 var tag2 = getTag2(collection);
8500 if (tag2 == mapTag4 || tag2 == setTag4) {
8501 return collection.size;
8503 return baseKeys2(collection).length;
8505 function some(collection, predicate, guard) {
8506 var func = isArray2(collection) ? arraySome2 : baseSome;
8507 if (guard && isIterateeCall(collection, predicate, guard)) {
8508 predicate = undefined2;
8510 return func(collection, getIteratee(predicate, 3));
8512 var sortBy = baseRest(function(collection, iteratees) {
8513 if (collection == null) {
8516 var length2 = iteratees.length;
8517 if (length2 > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
8519 } else if (length2 > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
8520 iteratees = [iteratees[0]];
8522 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
8524 var now3 = ctxNow || function() {
8525 return root3.Date.now();
8527 function after(n3, func) {
8528 if (typeof func != "function") {
8529 throw new TypeError2(FUNC_ERROR_TEXT3);
8534 return func.apply(this, arguments);
8538 function ary(func, n3, guard) {
8539 n3 = guard ? undefined2 : n3;
8540 n3 = func && n3 == null ? func.length : n3;
8541 return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
8543 function before(n3, func) {
8545 if (typeof func != "function") {
8546 throw new TypeError2(FUNC_ERROR_TEXT3);
8551 result2 = func.apply(this, arguments);
8559 var bind = baseRest(function(func, thisArg, partials) {
8560 var bitmask = WRAP_BIND_FLAG;
8561 if (partials.length) {
8562 var holders = replaceHolders(partials, getHolder(bind));
8563 bitmask |= WRAP_PARTIAL_FLAG;
8565 return createWrap(func, bitmask, thisArg, partials, holders);
8567 var bindKey2 = baseRest(function(object, key, partials) {
8568 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
8569 if (partials.length) {
8570 var holders = replaceHolders(partials, getHolder(bindKey2));
8571 bitmask |= WRAP_PARTIAL_FLAG;
8573 return createWrap(key, bitmask, object, partials, holders);
8575 function curry(func, arity, guard) {
8576 arity = guard ? undefined2 : arity;
8577 var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8578 result2.placeholder = curry.placeholder;
8581 function curryRight(func, arity, guard) {
8582 arity = guard ? undefined2 : arity;
8583 var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8584 result2.placeholder = curryRight.placeholder;
8587 function debounce2(func, wait, options2) {
8588 var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
8589 if (typeof func != "function") {
8590 throw new TypeError2(FUNC_ERROR_TEXT3);
8592 wait = toNumber3(wait) || 0;
8593 if (isObject3(options2)) {
8594 leading = !!options2.leading;
8595 maxing = "maxWait" in options2;
8596 maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
8597 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8599 function invokeFunc(time) {
8600 var args = lastArgs, thisArg = lastThis;
8601 lastArgs = lastThis = undefined2;
8602 lastInvokeTime = time;
8603 result2 = func.apply(thisArg, args);
8606 function leadingEdge(time) {
8607 lastInvokeTime = time;
8608 timerId = setTimeout2(timerExpired, wait);
8609 return leading ? invokeFunc(time) : result2;
8611 function remainingWait(time) {
8612 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
8613 return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
8615 function shouldInvoke(time) {
8616 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
8617 return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
8619 function timerExpired() {
8621 if (shouldInvoke(time)) {
8622 return trailingEdge(time);
8624 timerId = setTimeout2(timerExpired, remainingWait(time));
8626 function trailingEdge(time) {
8627 timerId = undefined2;
8628 if (trailing && lastArgs) {
8629 return invokeFunc(time);
8631 lastArgs = lastThis = undefined2;
8635 if (timerId !== undefined2) {
8636 clearTimeout2(timerId);
8639 lastArgs = lastCallTime = lastThis = timerId = undefined2;
8642 return timerId === undefined2 ? result2 : trailingEdge(now3());
8644 function debounced() {
8645 var time = now3(), isInvoking = shouldInvoke(time);
8646 lastArgs = arguments;
8648 lastCallTime = time;
8650 if (timerId === undefined2) {
8651 return leadingEdge(lastCallTime);
8654 clearTimeout2(timerId);
8655 timerId = setTimeout2(timerExpired, wait);
8656 return invokeFunc(lastCallTime);
8659 if (timerId === undefined2) {
8660 timerId = setTimeout2(timerExpired, wait);
8664 debounced.cancel = cancel;
8665 debounced.flush = flush;
8668 var defer = baseRest(function(func, args) {
8669 return baseDelay(func, 1, args);
8671 var delay = baseRest(function(func, wait, args) {
8672 return baseDelay(func, toNumber3(wait) || 0, args);
8674 function flip(func) {
8675 return createWrap(func, WRAP_FLIP_FLAG);
8677 function memoize(func, resolver) {
8678 if (typeof func != "function" || resolver != null && typeof resolver != "function") {
8679 throw new TypeError2(FUNC_ERROR_TEXT3);
8681 var memoized = function() {
8682 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
8683 if (cache.has(key)) {
8684 return cache.get(key);
8686 var result2 = func.apply(this, args);
8687 memoized.cache = cache.set(key, result2) || cache;
8690 memoized.cache = new (memoize.Cache || MapCache2)();
8693 memoize.Cache = MapCache2;
8694 function negate(predicate) {
8695 if (typeof predicate != "function") {
8696 throw new TypeError2(FUNC_ERROR_TEXT3);
8699 var args = arguments;
8700 switch (args.length) {
8702 return !predicate.call(this);
8704 return !predicate.call(this, args[0]);
8706 return !predicate.call(this, args[0], args[1]);
8708 return !predicate.call(this, args[0], args[1], args[2]);
8710 return !predicate.apply(this, args);
8713 function once(func) {
8714 return before(2, func);
8716 var overArgs = castRest(function(func, transforms) {
8717 transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
8718 var funcsLength = transforms.length;
8719 return baseRest(function(args) {
8720 var index = -1, length2 = nativeMin2(args.length, funcsLength);
8721 while (++index < length2) {
8722 args[index] = transforms[index].call(this, args[index]);
8724 return apply(func, this, args);
8727 var partial = baseRest(function(func, partials) {
8728 var holders = replaceHolders(partials, getHolder(partial));
8729 return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
8731 var partialRight = baseRest(function(func, partials) {
8732 var holders = replaceHolders(partials, getHolder(partialRight));
8733 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
8735 var rearg = flatRest(function(func, indexes) {
8736 return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
8738 function rest(func, start2) {
8739 if (typeof func != "function") {
8740 throw new TypeError2(FUNC_ERROR_TEXT3);
8742 start2 = start2 === undefined2 ? start2 : toInteger(start2);
8743 return baseRest(func, start2);
8745 function spread(func, start2) {
8746 if (typeof func != "function") {
8747 throw new TypeError2(FUNC_ERROR_TEXT3);
8749 start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
8750 return baseRest(function(args) {
8751 var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
8753 arrayPush2(otherArgs, array2);
8755 return apply(func, this, otherArgs);
8758 function throttle2(func, wait, options2) {
8759 var leading = true, trailing = true;
8760 if (typeof func != "function") {
8761 throw new TypeError2(FUNC_ERROR_TEXT3);
8763 if (isObject3(options2)) {
8764 leading = "leading" in options2 ? !!options2.leading : leading;
8765 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8767 return debounce2(func, wait, {
8770 "trailing": trailing
8773 function unary(func) {
8774 return ary(func, 1);
8776 function wrap2(value, wrapper) {
8777 return partial(castFunction(wrapper), value);
8779 function castArray() {
8780 if (!arguments.length) {
8783 var value = arguments[0];
8784 return isArray2(value) ? value : [value];
8786 function clone2(value) {
8787 return baseClone(value, CLONE_SYMBOLS_FLAG);
8789 function cloneWith(value, customizer) {
8790 customizer = typeof customizer == "function" ? customizer : undefined2;
8791 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
8793 function cloneDeep(value) {
8794 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
8796 function cloneDeepWith(value, customizer) {
8797 customizer = typeof customizer == "function" ? customizer : undefined2;
8798 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
8800 function conformsTo(object, source) {
8801 return source == null || baseConformsTo(object, source, keys2(source));
8803 function eq2(value, other) {
8804 return value === other || value !== value && other !== other;
8806 var gt2 = createRelationalOperation(baseGt);
8807 var gte = createRelationalOperation(function(value, other) {
8808 return value >= other;
8810 var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
8812 }()) ? baseIsArguments2 : function(value) {
8813 return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
8815 var isArray2 = Array2.isArray;
8816 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
8817 function isArrayLike2(value) {
8818 return value != null && isLength2(value.length) && !isFunction2(value);
8820 function isArrayLikeObject(value) {
8821 return isObjectLike2(value) && isArrayLike2(value);
8823 function isBoolean(value) {
8824 return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
8826 var isBuffer2 = nativeIsBuffer2 || stubFalse2;
8827 var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
8828 function isElement2(value) {
8829 return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
8831 function isEmpty(value) {
8832 if (value == null) {
8835 if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
8836 return !value.length;
8838 var tag2 = getTag2(value);
8839 if (tag2 == mapTag4 || tag2 == setTag4) {
8842 if (isPrototype2(value)) {
8843 return !baseKeys2(value).length;
8845 for (var key in value) {
8846 if (hasOwnProperty10.call(value, key)) {
8852 function isEqual4(value, other) {
8853 return baseIsEqual2(value, other);
8855 function isEqualWith(value, other, customizer) {
8856 customizer = typeof customizer == "function" ? customizer : undefined2;
8857 var result2 = customizer ? customizer(value, other) : undefined2;
8858 return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
8860 function isError(value) {
8861 if (!isObjectLike2(value)) {
8864 var tag2 = baseGetTag2(value);
8865 return tag2 == errorTag3 || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
8867 function isFinite2(value) {
8868 return typeof value == "number" && nativeIsFinite(value);
8870 function isFunction2(value) {
8871 if (!isObject3(value)) {
8874 var tag2 = baseGetTag2(value);
8875 return tag2 == funcTag3 || tag2 == genTag2 || tag2 == asyncTag2 || tag2 == proxyTag2;
8877 function isInteger(value) {
8878 return typeof value == "number" && value == toInteger(value);
8880 function isLength2(value) {
8881 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER4;
8883 function isObject3(value) {
8884 var type2 = typeof value;
8885 return value != null && (type2 == "object" || type2 == "function");
8887 function isObjectLike2(value) {
8888 return value != null && typeof value == "object";
8890 var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
8891 function isMatch(object, source) {
8892 return object === source || baseIsMatch(object, source, getMatchData(source));
8894 function isMatchWith(object, source, customizer) {
8895 customizer = typeof customizer == "function" ? customizer : undefined2;
8896 return baseIsMatch(object, source, getMatchData(source), customizer);
8898 function isNaN2(value) {
8899 return isNumber3(value) && value != +value;
8901 function isNative(value) {
8902 if (isMaskable(value)) {
8903 throw new Error2(CORE_ERROR_TEXT);
8905 return baseIsNative2(value);
8907 function isNull(value) {
8908 return value === null;
8910 function isNil(value) {
8911 return value == null;
8913 function isNumber3(value) {
8914 return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
8916 function isPlainObject(value) {
8917 if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
8920 var proto = getPrototype(value);
8921 if (proto === null) {
8924 var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
8925 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
8927 var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
8928 function isSafeInteger(value) {
8929 return isInteger(value) && value >= -MAX_SAFE_INTEGER4 && value <= MAX_SAFE_INTEGER4;
8931 var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
8932 function isString(value) {
8933 return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
8935 function isSymbol2(value) {
8936 return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
8938 var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
8939 function isUndefined(value) {
8940 return value === undefined2;
8942 function isWeakMap(value) {
8943 return isObjectLike2(value) && getTag2(value) == weakMapTag3;
8945 function isWeakSet(value) {
8946 return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
8948 var lt2 = createRelationalOperation(baseLt);
8949 var lte = createRelationalOperation(function(value, other) {
8950 return value <= other;
8952 function toArray(value) {
8956 if (isArrayLike2(value)) {
8957 return isString(value) ? stringToArray(value) : copyArray(value);
8959 if (symIterator && value[symIterator]) {
8960 return iteratorToArray(value[symIterator]());
8962 var tag2 = getTag2(value), func = tag2 == mapTag4 ? mapToArray2 : tag2 == setTag4 ? setToArray2 : values;
8965 function toFinite(value) {
8967 return value === 0 ? value : 0;
8969 value = toNumber3(value);
8970 if (value === INFINITY2 || value === -INFINITY2) {
8971 var sign2 = value < 0 ? -1 : 1;
8972 return sign2 * MAX_INTEGER;
8974 return value === value ? value : 0;
8976 function toInteger(value) {
8977 var result2 = toFinite(value), remainder = result2 % 1;
8978 return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
8980 function toLength(value) {
8981 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
8983 function toNumber3(value) {
8984 if (typeof value == "number") {
8987 if (isSymbol2(value)) {
8990 if (isObject3(value)) {
8991 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
8992 value = isObject3(other) ? other + "" : other;
8994 if (typeof value != "string") {
8995 return value === 0 ? value : +value;
8997 value = baseTrim2(value);
8998 var isBinary = reIsBinary2.test(value);
8999 return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
9001 function toPlainObject(value) {
9002 return copyObject(value, keysIn(value));
9004 function toSafeInteger(value) {
9005 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value === 0 ? value : 0;
9007 function toString2(value) {
9008 return value == null ? "" : baseToString2(value);
9010 var assign = createAssigner(function(object, source) {
9011 if (isPrototype2(source) || isArrayLike2(source)) {
9012 copyObject(source, keys2(source), object);
9015 for (var key in source) {
9016 if (hasOwnProperty10.call(source, key)) {
9017 assignValue(object, key, source[key]);
9021 var assignIn = createAssigner(function(object, source) {
9022 copyObject(source, keysIn(source), object);
9024 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
9025 copyObject(source, keysIn(source), object, customizer);
9027 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
9028 copyObject(source, keys2(source), object, customizer);
9030 var at2 = flatRest(baseAt);
9031 function create2(prototype, properties) {
9032 var result2 = baseCreate(prototype);
9033 return properties == null ? result2 : baseAssign(result2, properties);
9035 var defaults = baseRest(function(object, sources) {
9036 object = Object2(object);
9038 var length2 = sources.length;
9039 var guard = length2 > 2 ? sources[2] : undefined2;
9040 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
9043 while (++index < length2) {
9044 var source = sources[index];
9045 var props = keysIn(source);
9046 var propsIndex = -1;
9047 var propsLength = props.length;
9048 while (++propsIndex < propsLength) {
9049 var key = props[propsIndex];
9050 var value = object[key];
9051 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9052 object[key] = source[key];
9058 var defaultsDeep = baseRest(function(args) {
9059 args.push(undefined2, customDefaultsMerge);
9060 return apply(mergeWith, undefined2, args);
9062 function findKey(object, predicate) {
9063 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
9065 function findLastKey(object, predicate) {
9066 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
9068 function forIn(object, iteratee2) {
9069 return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
9071 function forInRight(object, iteratee2) {
9072 return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
9074 function forOwn(object, iteratee2) {
9075 return object && baseForOwn(object, getIteratee(iteratee2, 3));
9077 function forOwnRight(object, iteratee2) {
9078 return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
9080 function functions(object) {
9081 return object == null ? [] : baseFunctions(object, keys2(object));
9083 function functionsIn(object) {
9084 return object == null ? [] : baseFunctions(object, keysIn(object));
9086 function get4(object, path, defaultValue) {
9087 var result2 = object == null ? undefined2 : baseGet(object, path);
9088 return result2 === undefined2 ? defaultValue : result2;
9090 function has(object, path) {
9091 return object != null && hasPath(object, path, baseHas);
9093 function hasIn(object, path) {
9094 return object != null && hasPath(object, path, baseHasIn);
9096 var invert = createInverter(function(result2, value, key) {
9097 if (value != null && typeof value.toString != "function") {
9098 value = nativeObjectToString3.call(value);
9100 result2[value] = key;
9101 }, constant(identity4));
9102 var invertBy = createInverter(function(result2, value, key) {
9103 if (value != null && typeof value.toString != "function") {
9104 value = nativeObjectToString3.call(value);
9106 if (hasOwnProperty10.call(result2, value)) {
9107 result2[value].push(key);
9109 result2[value] = [key];
9112 var invoke = baseRest(baseInvoke);
9113 function keys2(object) {
9114 return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
9116 function keysIn(object) {
9117 return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
9119 function mapKeys(object, iteratee2) {
9121 iteratee2 = getIteratee(iteratee2, 3);
9122 baseForOwn(object, function(value, key, object2) {
9123 baseAssignValue(result2, iteratee2(value, key, object2), value);
9127 function mapValues(object, iteratee2) {
9129 iteratee2 = getIteratee(iteratee2, 3);
9130 baseForOwn(object, function(value, key, object2) {
9131 baseAssignValue(result2, key, iteratee2(value, key, object2));
9135 var merge2 = createAssigner(function(object, source, srcIndex) {
9136 baseMerge(object, source, srcIndex);
9138 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
9139 baseMerge(object, source, srcIndex, customizer);
9141 var omit = flatRest(function(object, paths) {
9143 if (object == null) {
9147 paths = arrayMap2(paths, function(path) {
9148 path = castPath(path, object);
9149 isDeep || (isDeep = path.length > 1);
9152 copyObject(object, getAllKeysIn(object), result2);
9154 result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
9156 var length2 = paths.length;
9158 baseUnset(result2, paths[length2]);
9162 function omitBy(object, predicate) {
9163 return pickBy(object, negate(getIteratee(predicate)));
9165 var pick = flatRest(function(object, paths) {
9166 return object == null ? {} : basePick(object, paths);
9168 function pickBy(object, predicate) {
9169 if (object == null) {
9172 var props = arrayMap2(getAllKeysIn(object), function(prop) {
9175 predicate = getIteratee(predicate);
9176 return basePickBy(object, props, function(value, path) {
9177 return predicate(value, path[0]);
9180 function result(object, path, defaultValue) {
9181 path = castPath(path, object);
9182 var index = -1, length2 = path.length;
9185 object = undefined2;
9187 while (++index < length2) {
9188 var value = object == null ? undefined2 : object[toKey(path[index])];
9189 if (value === undefined2) {
9191 value = defaultValue;
9193 object = isFunction2(value) ? value.call(object) : value;
9197 function set4(object, path, value) {
9198 return object == null ? object : baseSet(object, path, value);
9200 function setWith(object, path, value, customizer) {
9201 customizer = typeof customizer == "function" ? customizer : undefined2;
9202 return object == null ? object : baseSet(object, path, value, customizer);
9204 var toPairs = createToPairs(keys2);
9205 var toPairsIn = createToPairs(keysIn);
9206 function transform2(object, iteratee2, accumulator) {
9207 var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
9208 iteratee2 = getIteratee(iteratee2, 4);
9209 if (accumulator == null) {
9210 var Ctor = object && object.constructor;
9212 accumulator = isArr ? new Ctor() : [];
9213 } else if (isObject3(object)) {
9214 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
9219 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
9220 return iteratee2(accumulator, value, index, object2);
9224 function unset(object, path) {
9225 return object == null ? true : baseUnset(object, path);
9227 function update(object, path, updater) {
9228 return object == null ? object : baseUpdate(object, path, castFunction(updater));
9230 function updateWith(object, path, updater, customizer) {
9231 customizer = typeof customizer == "function" ? customizer : undefined2;
9232 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
9234 function values(object) {
9235 return object == null ? [] : baseValues(object, keys2(object));
9237 function valuesIn(object) {
9238 return object == null ? [] : baseValues(object, keysIn(object));
9240 function clamp3(number3, lower2, upper) {
9241 if (upper === undefined2) {
9243 lower2 = undefined2;
9245 if (upper !== undefined2) {
9246 upper = toNumber3(upper);
9247 upper = upper === upper ? upper : 0;
9249 if (lower2 !== undefined2) {
9250 lower2 = toNumber3(lower2);
9251 lower2 = lower2 === lower2 ? lower2 : 0;
9253 return baseClamp(toNumber3(number3), lower2, upper);
9255 function inRange(number3, start2, end) {
9256 start2 = toFinite(start2);
9257 if (end === undefined2) {
9261 end = toFinite(end);
9263 number3 = toNumber3(number3);
9264 return baseInRange(number3, start2, end);
9266 function random(lower2, upper, floating) {
9267 if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
9268 upper = floating = undefined2;
9270 if (floating === undefined2) {
9271 if (typeof upper == "boolean") {
9274 } else if (typeof lower2 == "boolean") {
9276 lower2 = undefined2;
9279 if (lower2 === undefined2 && upper === undefined2) {
9283 lower2 = toFinite(lower2);
9284 if (upper === undefined2) {
9288 upper = toFinite(upper);
9291 if (lower2 > upper) {
9296 if (floating || lower2 % 1 || upper % 1) {
9297 var rand = nativeRandom();
9298 return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
9300 return baseRandom(lower2, upper);
9302 var camelCase = createCompounder(function(result2, word, index) {
9303 word = word.toLowerCase();
9304 return result2 + (index ? capitalize(word) : word);
9306 function capitalize(string) {
9307 return upperFirst(toString2(string).toLowerCase());
9309 function deburr(string) {
9310 string = toString2(string);
9311 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
9313 function endsWith(string, target, position) {
9314 string = toString2(string);
9315 target = baseToString2(target);
9316 var length2 = string.length;
9317 position = position === undefined2 ? length2 : baseClamp(toInteger(position), 0, length2);
9319 position -= target.length;
9320 return position >= 0 && string.slice(position, end) == target;
9322 function escape6(string) {
9323 string = toString2(string);
9324 return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
9326 function escapeRegExp(string) {
9327 string = toString2(string);
9328 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
9330 var kebabCase = createCompounder(function(result2, word, index) {
9331 return result2 + (index ? "-" : "") + word.toLowerCase();
9333 var lowerCase = createCompounder(function(result2, word, index) {
9334 return result2 + (index ? " " : "") + word.toLowerCase();
9336 var lowerFirst = createCaseFirst("toLowerCase");
9337 function pad2(string, length2, chars) {
9338 string = toString2(string);
9339 length2 = toInteger(length2);
9340 var strLength = length2 ? stringSize(string) : 0;
9341 if (!length2 || strLength >= length2) {
9344 var mid = (length2 - strLength) / 2;
9345 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
9347 function padEnd(string, length2, chars) {
9348 string = toString2(string);
9349 length2 = toInteger(length2);
9350 var strLength = length2 ? stringSize(string) : 0;
9351 return length2 && strLength < length2 ? string + createPadding(length2 - strLength, chars) : string;
9353 function padStart(string, length2, chars) {
9354 string = toString2(string);
9355 length2 = toInteger(length2);
9356 var strLength = length2 ? stringSize(string) : 0;
9357 return length2 && strLength < length2 ? createPadding(length2 - strLength, chars) + string : string;
9359 function parseInt2(string, radix, guard) {
9360 if (guard || radix == null) {
9365 return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
9367 function repeat(string, n3, guard) {
9368 if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
9373 return baseRepeat(toString2(string), n3);
9375 function replace() {
9376 var args = arguments, string = toString2(args[0]);
9377 return args.length < 3 ? string : string.replace(args[1], args[2]);
9379 var snakeCase = createCompounder(function(result2, word, index) {
9380 return result2 + (index ? "_" : "") + word.toLowerCase();
9382 function split(string, separator, limit) {
9383 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
9384 separator = limit = undefined2;
9386 limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
9390 string = toString2(string);
9391 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
9392 separator = baseToString2(separator);
9393 if (!separator && hasUnicode(string)) {
9394 return castSlice(stringToArray(string), 0, limit);
9397 return string.split(separator, limit);
9399 var startCase = createCompounder(function(result2, word, index) {
9400 return result2 + (index ? " " : "") + upperFirst(word);
9402 function startsWith(string, target, position) {
9403 string = toString2(string);
9404 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
9405 target = baseToString2(target);
9406 return string.slice(position, position + target.length) == target;
9408 function template(string, options2, guard) {
9409 var settings = lodash.templateSettings;
9410 if (guard && isIterateeCall(string, options2, guard)) {
9411 options2 = undefined2;
9413 string = toString2(string);
9414 options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
9415 var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
9416 var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
9417 var reDelimiters = RegExp2(
9418 (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
9421 var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
9422 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
9423 interpolateValue || (interpolateValue = esTemplateValue);
9424 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
9427 source += "' +\n__e(" + escapeValue + ") +\n'";
9429 if (evaluateValue) {
9430 isEvaluating = true;
9431 source += "';\n" + evaluateValue + ";\n__p += '";
9433 if (interpolateValue) {
9434 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
9436 index = offset + match.length;
9440 var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
9442 source = "with (obj) {\n" + source + "\n}\n";
9443 } else if (reForbiddenIdentifierChars.test(variable)) {
9444 throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
9446 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
9447 source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
9448 var result2 = attempt(function() {
9449 return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
9451 result2.source = source;
9452 if (isError(result2)) {
9457 function toLower(value) {
9458 return toString2(value).toLowerCase();
9460 function toUpper(value) {
9461 return toString2(value).toUpperCase();
9463 function trim(string, chars, guard) {
9464 string = toString2(string);
9465 if (string && (guard || chars === undefined2)) {
9466 return baseTrim2(string);
9468 if (!string || !(chars = baseToString2(chars))) {
9471 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
9472 return castSlice(strSymbols, start2, end).join("");
9474 function trimEnd(string, chars, guard) {
9475 string = toString2(string);
9476 if (string && (guard || chars === undefined2)) {
9477 return string.slice(0, trimmedEndIndex2(string) + 1);
9479 if (!string || !(chars = baseToString2(chars))) {
9482 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
9483 return castSlice(strSymbols, 0, end).join("");
9485 function trimStart(string, chars, guard) {
9486 string = toString2(string);
9487 if (string && (guard || chars === undefined2)) {
9488 return string.replace(reTrimStart2, "");
9490 if (!string || !(chars = baseToString2(chars))) {
9493 var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
9494 return castSlice(strSymbols, start2).join("");
9496 function truncate(string, options2) {
9497 var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
9498 if (isObject3(options2)) {
9499 var separator = "separator" in options2 ? options2.separator : separator;
9500 length2 = "length" in options2 ? toInteger(options2.length) : length2;
9501 omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
9503 string = toString2(string);
9504 var strLength = string.length;
9505 if (hasUnicode(string)) {
9506 var strSymbols = stringToArray(string);
9507 strLength = strSymbols.length;
9509 if (length2 >= strLength) {
9512 var end = length2 - stringSize(omission);
9516 var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
9517 if (separator === undefined2) {
9518 return result2 + omission;
9521 end += result2.length - end;
9523 if (isRegExp(separator)) {
9524 if (string.slice(end).search(separator)) {
9525 var match, substring = result2;
9526 if (!separator.global) {
9527 separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
9529 separator.lastIndex = 0;
9530 while (match = separator.exec(substring)) {
9531 var newEnd = match.index;
9533 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
9535 } else if (string.indexOf(baseToString2(separator), end) != end) {
9536 var index = result2.lastIndexOf(separator);
9538 result2 = result2.slice(0, index);
9541 return result2 + omission;
9543 function unescape3(string) {
9544 string = toString2(string);
9545 return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
9547 var upperCase = createCompounder(function(result2, word, index) {
9548 return result2 + (index ? " " : "") + word.toUpperCase();
9550 var upperFirst = createCaseFirst("toUpperCase");
9551 function words(string, pattern, guard) {
9552 string = toString2(string);
9553 pattern = guard ? undefined2 : pattern;
9554 if (pattern === undefined2) {
9555 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
9557 return string.match(pattern) || [];
9559 var attempt = baseRest(function(func, args) {
9561 return apply(func, undefined2, args);
9563 return isError(e3) ? e3 : new Error2(e3);
9566 var bindAll = flatRest(function(object, methodNames) {
9567 arrayEach(methodNames, function(key) {
9569 baseAssignValue(object, key, bind(object[key], object));
9573 function cond(pairs2) {
9574 var length2 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
9575 pairs2 = !length2 ? [] : arrayMap2(pairs2, function(pair3) {
9576 if (typeof pair3[1] != "function") {
9577 throw new TypeError2(FUNC_ERROR_TEXT3);
9579 return [toIteratee(pair3[0]), pair3[1]];
9581 return baseRest(function(args) {
9583 while (++index < length2) {
9584 var pair3 = pairs2[index];
9585 if (apply(pair3[0], this, args)) {
9586 return apply(pair3[1], this, args);
9591 function conforms(source) {
9592 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
9594 function constant(value) {
9599 function defaultTo(value, defaultValue) {
9600 return value == null || value !== value ? defaultValue : value;
9602 var flow = createFlow();
9603 var flowRight = createFlow(true);
9604 function identity4(value) {
9607 function iteratee(func) {
9608 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
9610 function matches(source) {
9611 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
9613 function matchesProperty(path, srcValue) {
9614 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
9616 var method = baseRest(function(path, args) {
9617 return function(object) {
9618 return baseInvoke(object, path, args);
9621 var methodOf = baseRest(function(object, args) {
9622 return function(path) {
9623 return baseInvoke(object, path, args);
9626 function mixin(object, source, options2) {
9627 var props = keys2(source), methodNames = baseFunctions(source, props);
9628 if (options2 == null && !(isObject3(source) && (methodNames.length || !props.length))) {
9632 methodNames = baseFunctions(source, keys2(source));
9634 var chain2 = !(isObject3(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
9635 arrayEach(methodNames, function(methodName) {
9636 var func = source[methodName];
9637 object[methodName] = func;
9639 object.prototype[methodName] = function() {
9640 var chainAll = this.__chain__;
9641 if (chain2 || chainAll) {
9642 var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
9643 actions.push({ "func": func, "args": arguments, "thisArg": object });
9644 result2.__chain__ = chainAll;
9647 return func.apply(object, arrayPush2([this.value()], arguments));
9653 function noConflict() {
9654 if (root3._ === this) {
9661 function nthArg(n3) {
9663 return baseRest(function(args) {
9664 return baseNth(args, n3);
9667 var over = createOver(arrayMap2);
9668 var overEvery = createOver(arrayEvery);
9669 var overSome = createOver(arraySome2);
9670 function property(path) {
9671 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
9673 function propertyOf(object) {
9674 return function(path) {
9675 return object == null ? undefined2 : baseGet(object, path);
9678 var range3 = createRange();
9679 var rangeRight = createRange(true);
9680 function stubArray2() {
9683 function stubFalse2() {
9686 function stubObject() {
9689 function stubString() {
9692 function stubTrue() {
9695 function times(n3, iteratee2) {
9697 if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
9700 var index = MAX_ARRAY_LENGTH, length2 = nativeMin2(n3, MAX_ARRAY_LENGTH);
9701 iteratee2 = getIteratee(iteratee2);
9702 n3 -= MAX_ARRAY_LENGTH;
9703 var result2 = baseTimes2(length2, iteratee2);
9704 while (++index < n3) {
9709 function toPath(value) {
9710 if (isArray2(value)) {
9711 return arrayMap2(value, toKey);
9713 return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
9715 function uniqueId(prefix) {
9716 var id2 = ++idCounter;
9717 return toString2(prefix) + id2;
9719 var add = createMathOperation(function(augend, addend) {
9720 return augend + addend;
9722 var ceil = createRound("ceil");
9723 var divide = createMathOperation(function(dividend, divisor) {
9724 return dividend / divisor;
9726 var floor = createRound("floor");
9727 function max3(array2) {
9728 return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
9730 function maxBy(array2, iteratee2) {
9731 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
9733 function mean(array2) {
9734 return baseMean(array2, identity4);
9736 function meanBy(array2, iteratee2) {
9737 return baseMean(array2, getIteratee(iteratee2, 2));
9739 function min3(array2) {
9740 return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
9742 function minBy(array2, iteratee2) {
9743 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
9745 var multiply = createMathOperation(function(multiplier, multiplicand) {
9746 return multiplier * multiplicand;
9748 var round = createRound("round");
9749 var subtract = createMathOperation(function(minuend, subtrahend) {
9750 return minuend - subtrahend;
9752 function sum(array2) {
9753 return array2 && array2.length ? baseSum(array2, identity4) : 0;
9755 function sumBy(array2, iteratee2) {
9756 return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
9758 lodash.after = after;
9760 lodash.assign = assign;
9761 lodash.assignIn = assignIn;
9762 lodash.assignInWith = assignInWith;
9763 lodash.assignWith = assignWith;
9765 lodash.before = before;
9767 lodash.bindAll = bindAll;
9768 lodash.bindKey = bindKey2;
9769 lodash.castArray = castArray;
9770 lodash.chain = chain;
9771 lodash.chunk = chunk;
9772 lodash.compact = compact;
9773 lodash.concat = concat;
9775 lodash.conforms = conforms;
9776 lodash.constant = constant;
9777 lodash.countBy = countBy;
9778 lodash.create = create2;
9779 lodash.curry = curry;
9780 lodash.curryRight = curryRight;
9781 lodash.debounce = debounce2;
9782 lodash.defaults = defaults;
9783 lodash.defaultsDeep = defaultsDeep;
9784 lodash.defer = defer;
9785 lodash.delay = delay;
9786 lodash.difference = difference2;
9787 lodash.differenceBy = differenceBy;
9788 lodash.differenceWith = differenceWith;
9790 lodash.dropRight = dropRight;
9791 lodash.dropRightWhile = dropRightWhile;
9792 lodash.dropWhile = dropWhile;
9794 lodash.filter = filter2;
9795 lodash.flatMap = flatMap;
9796 lodash.flatMapDeep = flatMapDeep;
9797 lodash.flatMapDepth = flatMapDepth;
9798 lodash.flatten = flatten2;
9799 lodash.flattenDeep = flattenDeep;
9800 lodash.flattenDepth = flattenDepth;
9803 lodash.flowRight = flowRight;
9804 lodash.fromPairs = fromPairs;
9805 lodash.functions = functions;
9806 lodash.functionsIn = functionsIn;
9807 lodash.groupBy = groupBy;
9808 lodash.initial = initial;
9809 lodash.intersection = intersection2;
9810 lodash.intersectionBy = intersectionBy;
9811 lodash.intersectionWith = intersectionWith;
9812 lodash.invert = invert;
9813 lodash.invertBy = invertBy;
9814 lodash.invokeMap = invokeMap;
9815 lodash.iteratee = iteratee;
9816 lodash.keyBy = keyBy;
9817 lodash.keys = keys2;
9818 lodash.keysIn = keysIn;
9820 lodash.mapKeys = mapKeys;
9821 lodash.mapValues = mapValues;
9822 lodash.matches = matches;
9823 lodash.matchesProperty = matchesProperty;
9824 lodash.memoize = memoize;
9825 lodash.merge = merge2;
9826 lodash.mergeWith = mergeWith;
9827 lodash.method = method;
9828 lodash.methodOf = methodOf;
9829 lodash.mixin = mixin;
9830 lodash.negate = negate;
9831 lodash.nthArg = nthArg;
9833 lodash.omitBy = omitBy;
9835 lodash.orderBy = orderBy;
9837 lodash.overArgs = overArgs;
9838 lodash.overEvery = overEvery;
9839 lodash.overSome = overSome;
9840 lodash.partial = partial;
9841 lodash.partialRight = partialRight;
9842 lodash.partition = partition;
9844 lodash.pickBy = pickBy;
9845 lodash.property = property;
9846 lodash.propertyOf = propertyOf;
9848 lodash.pullAll = pullAll;
9849 lodash.pullAllBy = pullAllBy;
9850 lodash.pullAllWith = pullAllWith;
9851 lodash.pullAt = pullAt;
9852 lodash.range = range3;
9853 lodash.rangeRight = rangeRight;
9854 lodash.rearg = rearg;
9855 lodash.reject = reject;
9856 lodash.remove = remove2;
9858 lodash.reverse = reverse;
9859 lodash.sampleSize = sampleSize;
9861 lodash.setWith = setWith;
9862 lodash.shuffle = shuffle;
9863 lodash.slice = slice;
9864 lodash.sortBy = sortBy;
9865 lodash.sortedUniq = sortedUniq;
9866 lodash.sortedUniqBy = sortedUniqBy;
9867 lodash.split = split;
9868 lodash.spread = spread;
9871 lodash.takeRight = takeRight;
9872 lodash.takeRightWhile = takeRightWhile;
9873 lodash.takeWhile = takeWhile;
9875 lodash.throttle = throttle2;
9877 lodash.toArray = toArray;
9878 lodash.toPairs = toPairs;
9879 lodash.toPairsIn = toPairsIn;
9880 lodash.toPath = toPath;
9881 lodash.toPlainObject = toPlainObject;
9882 lodash.transform = transform2;
9883 lodash.unary = unary;
9884 lodash.union = union2;
9885 lodash.unionBy = unionBy;
9886 lodash.unionWith = unionWith;
9888 lodash.uniqBy = uniqBy;
9889 lodash.uniqWith = uniqWith;
9890 lodash.unset = unset;
9891 lodash.unzip = unzip;
9892 lodash.unzipWith = unzipWith;
9893 lodash.update = update;
9894 lodash.updateWith = updateWith;
9895 lodash.values = values;
9896 lodash.valuesIn = valuesIn;
9897 lodash.without = without;
9898 lodash.words = words;
9899 lodash.wrap = wrap2;
9901 lodash.xorBy = xorBy;
9902 lodash.xorWith = xorWith;
9904 lodash.zipObject = zipObject;
9905 lodash.zipObjectDeep = zipObjectDeep;
9906 lodash.zipWith = zipWith;
9907 lodash.entries = toPairs;
9908 lodash.entriesIn = toPairsIn;
9909 lodash.extend = assignIn;
9910 lodash.extendWith = assignInWith;
9911 mixin(lodash, lodash);
9913 lodash.attempt = attempt;
9914 lodash.camelCase = camelCase;
9915 lodash.capitalize = capitalize;
9917 lodash.clamp = clamp3;
9918 lodash.clone = clone2;
9919 lodash.cloneDeep = cloneDeep;
9920 lodash.cloneDeepWith = cloneDeepWith;
9921 lodash.cloneWith = cloneWith;
9922 lodash.conformsTo = conformsTo;
9923 lodash.deburr = deburr;
9924 lodash.defaultTo = defaultTo;
9925 lodash.divide = divide;
9926 lodash.endsWith = endsWith;
9928 lodash.escape = escape6;
9929 lodash.escapeRegExp = escapeRegExp;
9930 lodash.every = every;
9931 lodash.find = find2;
9932 lodash.findIndex = findIndex;
9933 lodash.findKey = findKey;
9934 lodash.findLast = findLast;
9935 lodash.findLastIndex = findLastIndex;
9936 lodash.findLastKey = findLastKey;
9937 lodash.floor = floor;
9938 lodash.forEach = forEach;
9939 lodash.forEachRight = forEachRight;
9940 lodash.forIn = forIn;
9941 lodash.forInRight = forInRight;
9942 lodash.forOwn = forOwn;
9943 lodash.forOwnRight = forOwnRight;
9948 lodash.hasIn = hasIn;
9950 lodash.identity = identity4;
9951 lodash.includes = includes;
9952 lodash.indexOf = indexOf;
9953 lodash.inRange = inRange;
9954 lodash.invoke = invoke;
9955 lodash.isArguments = isArguments2;
9956 lodash.isArray = isArray2;
9957 lodash.isArrayBuffer = isArrayBuffer;
9958 lodash.isArrayLike = isArrayLike2;
9959 lodash.isArrayLikeObject = isArrayLikeObject;
9960 lodash.isBoolean = isBoolean;
9961 lodash.isBuffer = isBuffer2;
9962 lodash.isDate = isDate;
9963 lodash.isElement = isElement2;
9964 lodash.isEmpty = isEmpty;
9965 lodash.isEqual = isEqual4;
9966 lodash.isEqualWith = isEqualWith;
9967 lodash.isError = isError;
9968 lodash.isFinite = isFinite2;
9969 lodash.isFunction = isFunction2;
9970 lodash.isInteger = isInteger;
9971 lodash.isLength = isLength2;
9972 lodash.isMap = isMap;
9973 lodash.isMatch = isMatch;
9974 lodash.isMatchWith = isMatchWith;
9975 lodash.isNaN = isNaN2;
9976 lodash.isNative = isNative;
9977 lodash.isNil = isNil;
9978 lodash.isNull = isNull;
9979 lodash.isNumber = isNumber3;
9980 lodash.isObject = isObject3;
9981 lodash.isObjectLike = isObjectLike2;
9982 lodash.isPlainObject = isPlainObject;
9983 lodash.isRegExp = isRegExp;
9984 lodash.isSafeInteger = isSafeInteger;
9985 lodash.isSet = isSet;
9986 lodash.isString = isString;
9987 lodash.isSymbol = isSymbol2;
9988 lodash.isTypedArray = isTypedArray2;
9989 lodash.isUndefined = isUndefined;
9990 lodash.isWeakMap = isWeakMap;
9991 lodash.isWeakSet = isWeakSet;
9993 lodash.kebabCase = kebabCase;
9995 lodash.lastIndexOf = lastIndexOf;
9996 lodash.lowerCase = lowerCase;
9997 lodash.lowerFirst = lowerFirst;
10001 lodash.maxBy = maxBy;
10002 lodash.mean = mean;
10003 lodash.meanBy = meanBy;
10005 lodash.minBy = minBy;
10006 lodash.stubArray = stubArray2;
10007 lodash.stubFalse = stubFalse2;
10008 lodash.stubObject = stubObject;
10009 lodash.stubString = stubString;
10010 lodash.stubTrue = stubTrue;
10011 lodash.multiply = multiply;
10013 lodash.noConflict = noConflict;
10014 lodash.noop = noop3;
10017 lodash.padEnd = padEnd;
10018 lodash.padStart = padStart;
10019 lodash.parseInt = parseInt2;
10020 lodash.random = random;
10021 lodash.reduce = reduce;
10022 lodash.reduceRight = reduceRight;
10023 lodash.repeat = repeat;
10024 lodash.replace = replace;
10025 lodash.result = result;
10026 lodash.round = round;
10027 lodash.runInContext = runInContext2;
10028 lodash.sample = sample;
10029 lodash.size = size;
10030 lodash.snakeCase = snakeCase;
10031 lodash.some = some;
10032 lodash.sortedIndex = sortedIndex;
10033 lodash.sortedIndexBy = sortedIndexBy;
10034 lodash.sortedIndexOf = sortedIndexOf;
10035 lodash.sortedLastIndex = sortedLastIndex;
10036 lodash.sortedLastIndexBy = sortedLastIndexBy;
10037 lodash.sortedLastIndexOf = sortedLastIndexOf;
10038 lodash.startCase = startCase;
10039 lodash.startsWith = startsWith;
10040 lodash.subtract = subtract;
10042 lodash.sumBy = sumBy;
10043 lodash.template = template;
10044 lodash.times = times;
10045 lodash.toFinite = toFinite;
10046 lodash.toInteger = toInteger;
10047 lodash.toLength = toLength;
10048 lodash.toLower = toLower;
10049 lodash.toNumber = toNumber3;
10050 lodash.toSafeInteger = toSafeInteger;
10051 lodash.toString = toString2;
10052 lodash.toUpper = toUpper;
10053 lodash.trim = trim;
10054 lodash.trimEnd = trimEnd;
10055 lodash.trimStart = trimStart;
10056 lodash.truncate = truncate;
10057 lodash.unescape = unescape3;
10058 lodash.uniqueId = uniqueId;
10059 lodash.upperCase = upperCase;
10060 lodash.upperFirst = upperFirst;
10061 lodash.each = forEach;
10062 lodash.eachRight = forEachRight;
10063 lodash.first = head;
10064 mixin(lodash, function() {
10066 baseForOwn(lodash, function(func, methodName) {
10067 if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
10068 source[methodName] = func;
10072 }(), { "chain": false });
10073 lodash.VERSION = VERSION;
10074 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
10075 lodash[methodName].placeholder = lodash;
10077 arrayEach(["drop", "take"], function(methodName, index) {
10078 LazyWrapper.prototype[methodName] = function(n3) {
10079 n3 = n3 === undefined2 ? 1 : nativeMax2(toInteger(n3), 0);
10080 var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
10081 if (result2.__filtered__) {
10082 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
10084 result2.__views__.push({
10085 "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
10086 "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
10091 LazyWrapper.prototype[methodName + "Right"] = function(n3) {
10092 return this.reverse()[methodName](n3).reverse();
10095 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
10096 var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
10097 LazyWrapper.prototype[methodName] = function(iteratee2) {
10098 var result2 = this.clone();
10099 result2.__iteratees__.push({
10100 "iteratee": getIteratee(iteratee2, 3),
10103 result2.__filtered__ = result2.__filtered__ || isFilter;
10107 arrayEach(["head", "last"], function(methodName, index) {
10108 var takeName = "take" + (index ? "Right" : "");
10109 LazyWrapper.prototype[methodName] = function() {
10110 return this[takeName](1).value()[0];
10113 arrayEach(["initial", "tail"], function(methodName, index) {
10114 var dropName = "drop" + (index ? "" : "Right");
10115 LazyWrapper.prototype[methodName] = function() {
10116 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
10119 LazyWrapper.prototype.compact = function() {
10120 return this.filter(identity4);
10122 LazyWrapper.prototype.find = function(predicate) {
10123 return this.filter(predicate).head();
10125 LazyWrapper.prototype.findLast = function(predicate) {
10126 return this.reverse().find(predicate);
10128 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
10129 if (typeof path == "function") {
10130 return new LazyWrapper(this);
10132 return this.map(function(value) {
10133 return baseInvoke(value, path, args);
10136 LazyWrapper.prototype.reject = function(predicate) {
10137 return this.filter(negate(getIteratee(predicate)));
10139 LazyWrapper.prototype.slice = function(start2, end) {
10140 start2 = toInteger(start2);
10141 var result2 = this;
10142 if (result2.__filtered__ && (start2 > 0 || end < 0)) {
10143 return new LazyWrapper(result2);
10146 result2 = result2.takeRight(-start2);
10147 } else if (start2) {
10148 result2 = result2.drop(start2);
10150 if (end !== undefined2) {
10151 end = toInteger(end);
10152 result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
10156 LazyWrapper.prototype.takeRightWhile = function(predicate) {
10157 return this.reverse().takeWhile(predicate).reverse();
10159 LazyWrapper.prototype.toArray = function() {
10160 return this.take(MAX_ARRAY_LENGTH);
10162 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10163 var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + (methodName == "last" ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
10167 lodash.prototype[methodName] = function() {
10168 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
10169 var interceptor = function(value2) {
10170 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
10171 return isTaker && chainAll ? result3[0] : result3;
10173 if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
10174 isLazy = useLazy = false;
10176 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
10177 if (!retUnwrapped && useLazy) {
10178 value = onlyLazy ? value : new LazyWrapper(this);
10179 var result2 = func.apply(value, args);
10180 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
10181 return new LodashWrapper(result2, chainAll);
10183 if (isUnwrapped && onlyLazy) {
10184 return func.apply(this, args);
10186 result2 = this.thru(interceptor);
10187 return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
10190 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
10191 var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
10192 lodash.prototype[methodName] = function() {
10193 var args = arguments;
10194 if (retUnwrapped && !this.__chain__) {
10195 var value = this.value();
10196 return func.apply(isArray2(value) ? value : [], args);
10198 return this[chainName](function(value2) {
10199 return func.apply(isArray2(value2) ? value2 : [], args);
10203 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10204 var lodashFunc = lodash[methodName];
10206 var key = lodashFunc.name + "";
10207 if (!hasOwnProperty10.call(realNames, key)) {
10208 realNames[key] = [];
10210 realNames[key].push({ "name": methodName, "func": lodashFunc });
10213 realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
10217 LazyWrapper.prototype.clone = lazyClone;
10218 LazyWrapper.prototype.reverse = lazyReverse;
10219 LazyWrapper.prototype.value = lazyValue;
10220 lodash.prototype.at = wrapperAt;
10221 lodash.prototype.chain = wrapperChain;
10222 lodash.prototype.commit = wrapperCommit;
10223 lodash.prototype.next = wrapperNext;
10224 lodash.prototype.plant = wrapperPlant;
10225 lodash.prototype.reverse = wrapperReverse;
10226 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
10227 lodash.prototype.first = lodash.prototype.head;
10229 lodash.prototype[symIterator] = wrapperToIterator;
10233 var _2 = runInContext();
10234 if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
10236 define(function() {
10239 } else if (freeModule3) {
10240 (freeModule3.exports = _2)._ = _2;
10241 freeExports3._ = _2;
10249 // node_modules/fast-deep-equal/index.js
10250 var require_fast_deep_equal = __commonJS({
10251 "node_modules/fast-deep-equal/index.js"(exports2, module2) {
10253 module2.exports = function equal(a2, b2) {
10256 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
10257 if (a2.constructor !== b2.constructor)
10259 var length2, i3, keys2;
10260 if (Array.isArray(a2)) {
10261 length2 = a2.length;
10262 if (length2 != b2.length)
10264 for (i3 = length2; i3-- !== 0; )
10265 if (!equal(a2[i3], b2[i3]))
10269 if (a2.constructor === RegExp)
10270 return a2.source === b2.source && a2.flags === b2.flags;
10271 if (a2.valueOf !== Object.prototype.valueOf)
10272 return a2.valueOf() === b2.valueOf();
10273 if (a2.toString !== Object.prototype.toString)
10274 return a2.toString() === b2.toString();
10275 keys2 = Object.keys(a2);
10276 length2 = keys2.length;
10277 if (length2 !== Object.keys(b2).length)
10279 for (i3 = length2; i3-- !== 0; )
10280 if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3]))
10282 for (i3 = length2; i3-- !== 0; ) {
10283 var key = keys2[i3];
10284 if (!equal(a2[key], b2[key]))
10289 return a2 !== a2 && b2 !== b2;
10294 // node_modules/rbush/rbush.min.js
10295 var require_rbush_min = __commonJS({
10296 "node_modules/rbush/rbush.min.js"(exports2, module2) {
10297 !function(t2, i3) {
10298 "object" == typeof exports2 && "undefined" != typeof module2 ? module2.exports = i3() : "function" == typeof define && define.amd ? define(i3) : (t2 = t2 || self).RBush = i3();
10299 }(exports2, function() {
10301 function t2(t3, r3, e4, a3, h3) {
10302 !function t4(n4, r4, e6, a4, h4) {
10303 for (; a4 > e6; ) {
10304 if (a4 - e6 > 600) {
10305 var o3 = a4 - e6 + 1, s3 = r4 - e6 + 1, l3 = Math.log(o3), f3 = 0.5 * Math.exp(2 * l3 / 3), u3 = 0.5 * Math.sqrt(l3 * f3 * (o3 - f3) / o3) * (s3 - o3 / 2 < 0 ? -1 : 1), m3 = Math.max(e6, Math.floor(r4 - s3 * f3 / o3 + u3)), c3 = Math.min(a4, Math.floor(r4 + (o3 - s3) * f3 / o3 + u3));
10306 t4(n4, r4, m3, c3, h4);
10308 var p3 = n4[r4], d4 = e6, x2 = a4;
10309 for (i3(n4, e6, r4), h4(n4[a4], p3) > 0 && i3(n4, e6, a4); d4 < x2; ) {
10310 for (i3(n4, d4, x2), d4++, x2--; h4(n4[d4], p3) < 0; )
10312 for (; h4(n4[x2], p3) > 0; )
10315 0 === h4(n4[e6], p3) ? i3(n4, e6, x2) : i3(n4, ++x2, a4), x2 <= r4 && (e6 = x2 + 1), r4 <= x2 && (a4 = x2 - 1);
10317 }(t3, r3, e4 || 0, a3 || t3.length - 1, h3 || n3);
10319 function i3(t3, i4, n4) {
10321 t3[i4] = t3[n4], t3[n4] = r3;
10323 function n3(t3, i4) {
10324 return t3 < i4 ? -1 : t3 > i4 ? 1 : 0;
10326 var r2 = function(t3) {
10327 void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
10329 function e3(t3, i4, n4) {
10331 return i4.indexOf(t3);
10332 for (var r3 = 0; r3 < i4.length; r3++)
10333 if (n4(t3, i4[r3]))
10337 function a2(t3, i4) {
10338 h2(t3, 0, t3.children.length, i4, t3);
10340 function h2(t3, i4, n4, r3, e4) {
10341 e4 || (e4 = p2(null)), e4.minX = 1 / 0, e4.minY = 1 / 0, e4.maxX = -1 / 0, e4.maxY = -1 / 0;
10342 for (var a3 = i4; a3 < n4; a3++) {
10343 var h3 = t3.children[a3];
10344 o2(e4, t3.leaf ? r3(h3) : h3);
10348 function o2(t3, i4) {
10349 return t3.minX = Math.min(t3.minX, i4.minX), t3.minY = Math.min(t3.minY, i4.minY), t3.maxX = Math.max(t3.maxX, i4.maxX), t3.maxY = Math.max(t3.maxY, i4.maxY), t3;
10351 function s2(t3, i4) {
10352 return t3.minX - i4.minX;
10354 function l2(t3, i4) {
10355 return t3.minY - i4.minY;
10358 return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
10361 return t3.maxX - t3.minX + (t3.maxY - t3.minY);
10363 function m2(t3, i4) {
10364 return t3.minX <= i4.minX && t3.minY <= i4.minY && i4.maxX <= t3.maxX && i4.maxY <= t3.maxY;
10366 function c2(t3, i4) {
10367 return i4.minX <= t3.maxX && i4.minY <= t3.maxY && i4.maxX >= t3.minX && i4.maxY >= t3.minY;
10370 return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
10372 function d2(i4, n4, r3, e4, a3) {
10373 for (var h3 = [n4, r3]; h3.length; )
10374 if (!((r3 = h3.pop()) - (n4 = h3.pop()) <= e4)) {
10375 var o3 = n4 + Math.ceil((r3 - n4) / e4 / 2) * e4;
10376 t2(i4, o3, n4, r3, a3), h3.push(n4, o3, o3, r3);
10379 return r2.prototype.all = function() {
10380 return this._all(this.data, []);
10381 }, r2.prototype.search = function(t3) {
10382 var i4 = this.data, n4 = [];
10385 for (var r3 = this.toBBox, e4 = []; i4; ) {
10386 for (var a3 = 0; a3 < i4.children.length; a3++) {
10387 var h3 = i4.children[a3], o3 = i4.leaf ? r3(h3) : h3;
10388 c2(t3, o3) && (i4.leaf ? n4.push(h3) : m2(t3, o3) ? this._all(h3, n4) : e4.push(h3));
10393 }, r2.prototype.collides = function(t3) {
10394 var i4 = this.data;
10397 for (var n4 = []; i4; ) {
10398 for (var r3 = 0; r3 < i4.children.length; r3++) {
10399 var e4 = i4.children[r3], a3 = i4.leaf ? this.toBBox(e4) : e4;
10401 if (i4.leaf || m2(t3, a3))
10409 }, r2.prototype.load = function(t3) {
10410 if (!t3 || !t3.length)
10412 if (t3.length < this._minEntries) {
10413 for (var i4 = 0; i4 < t3.length; i4++)
10414 this.insert(t3[i4]);
10417 var n4 = this._build(t3.slice(), 0, t3.length - 1, 0);
10418 if (this.data.children.length)
10419 if (this.data.height === n4.height)
10420 this._splitRoot(this.data, n4);
10422 if (this.data.height < n4.height) {
10423 var r3 = this.data;
10424 this.data = n4, n4 = r3;
10426 this._insert(n4, this.data.height - n4.height - 1, true);
10431 }, r2.prototype.insert = function(t3) {
10432 return t3 && this._insert(t3, this.data.height - 1), this;
10433 }, r2.prototype.clear = function() {
10434 return this.data = p2([]), this;
10435 }, r2.prototype.remove = function(t3, i4) {
10438 for (var n4, r3, a3, h3 = this.data, o3 = this.toBBox(t3), s3 = [], l3 = []; h3 || s3.length; ) {
10439 if (h3 || (h3 = s3.pop(), r3 = s3[s3.length - 1], n4 = l3.pop(), a3 = true), h3.leaf) {
10440 var f3 = e3(t3, h3.children, i4);
10442 return h3.children.splice(f3, 1), s3.push(h3), this._condense(s3), this;
10444 a3 || h3.leaf || !m2(h3, o3) ? r3 ? (n4++, h3 = r3.children[n4], a3 = false) : h3 = null : (s3.push(h3), l3.push(n4), n4 = 0, r3 = h3, h3 = h3.children[0]);
10447 }, r2.prototype.toBBox = function(t3) {
10449 }, r2.prototype.compareMinX = function(t3, i4) {
10450 return t3.minX - i4.minX;
10451 }, r2.prototype.compareMinY = function(t3, i4) {
10452 return t3.minY - i4.minY;
10453 }, r2.prototype.toJSON = function() {
10455 }, r2.prototype.fromJSON = function(t3) {
10456 return this.data = t3, this;
10457 }, r2.prototype._all = function(t3, i4) {
10458 for (var n4 = []; t3; )
10459 t3.leaf ? i4.push.apply(i4, t3.children) : n4.push.apply(n4, t3.children), t3 = n4.pop();
10461 }, r2.prototype._build = function(t3, i4, n4, r3) {
10462 var e4, h3 = n4 - i4 + 1, o3 = this._maxEntries;
10464 return a2(e4 = p2(t3.slice(i4, n4 + 1)), this.toBBox), e4;
10465 r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o3)), o3 = Math.ceil(h3 / Math.pow(o3, r3 - 1))), (e4 = p2([])).leaf = false, e4.height = r3;
10466 var s3 = Math.ceil(h3 / o3), l3 = s3 * Math.ceil(Math.sqrt(o3));
10467 d2(t3, i4, n4, l3, this.compareMinX);
10468 for (var f3 = i4; f3 <= n4; f3 += l3) {
10469 var u3 = Math.min(f3 + l3 - 1, n4);
10470 d2(t3, f3, u3, s3, this.compareMinY);
10471 for (var m3 = f3; m3 <= u3; m3 += s3) {
10472 var c3 = Math.min(m3 + s3 - 1, u3);
10473 e4.children.push(this._build(t3, m3, c3, r3 - 1));
10476 return a2(e4, this.toBBox), e4;
10477 }, r2.prototype._chooseSubtree = function(t3, i4, n4, r3) {
10478 for (; r3.push(i4), !i4.leaf && r3.length - 1 !== n4; ) {
10479 for (var e4 = 1 / 0, a3 = 1 / 0, h3 = void 0, o3 = 0; o3 < i4.children.length; o3++) {
10480 var s3 = i4.children[o3], l3 = f2(s3), u3 = (m3 = t3, c3 = s3, (Math.max(c3.maxX, m3.maxX) - Math.min(c3.minX, m3.minX)) * (Math.max(c3.maxY, m3.maxY) - Math.min(c3.minY, m3.minY)) - l3);
10481 u3 < a3 ? (a3 = u3, e4 = l3 < e4 ? l3 : e4, h3 = s3) : u3 === a3 && l3 < e4 && (e4 = l3, h3 = s3);
10483 i4 = h3 || i4.children[0];
10487 }, r2.prototype._insert = function(t3, i4, n4) {
10488 var r3 = n4 ? t3 : this.toBBox(t3), e4 = [], a3 = this._chooseSubtree(r3, this.data, i4, e4);
10489 for (a3.children.push(t3), o2(a3, r3); i4 >= 0 && e4[i4].children.length > this._maxEntries; )
10490 this._split(e4, i4), i4--;
10491 this._adjustParentBBoxes(r3, e4, i4);
10492 }, r2.prototype._split = function(t3, i4) {
10493 var n4 = t3[i4], r3 = n4.children.length, e4 = this._minEntries;
10494 this._chooseSplitAxis(n4, e4, r3);
10495 var h3 = this._chooseSplitIndex(n4, e4, r3), o3 = p2(n4.children.splice(h3, n4.children.length - h3));
10496 o3.height = n4.height, o3.leaf = n4.leaf, a2(n4, this.toBBox), a2(o3, this.toBBox), i4 ? t3[i4 - 1].children.push(o3) : this._splitRoot(n4, o3);
10497 }, r2.prototype._splitRoot = function(t3, i4) {
10498 this.data = p2([t3, i4]), this.data.height = t3.height + 1, this.data.leaf = false, a2(this.data, this.toBBox);
10499 }, r2.prototype._chooseSplitIndex = function(t3, i4, n4) {
10500 for (var r3, e4, a3, o3, s3, l3, u3, m3 = 1 / 0, c3 = 1 / 0, p3 = i4; p3 <= n4 - i4; p3++) {
10501 var d4 = h2(t3, 0, p3, this.toBBox), x2 = h2(t3, p3, n4, this.toBBox), v2 = (e4 = d4, a3 = x2, o3 = void 0, s3 = void 0, l3 = void 0, u3 = void 0, o3 = Math.max(e4.minX, a3.minX), s3 = Math.max(e4.minY, a3.minY), l3 = Math.min(e4.maxX, a3.maxX), u3 = Math.min(e4.maxY, a3.maxY), Math.max(0, l3 - o3) * Math.max(0, u3 - s3)), M2 = f2(d4) + f2(x2);
10502 v2 < m3 ? (m3 = v2, r3 = p3, c3 = M2 < c3 ? M2 : c3) : v2 === m3 && M2 < c3 && (c3 = M2, r3 = p3);
10504 return r3 || n4 - i4;
10505 }, r2.prototype._chooseSplitAxis = function(t3, i4, n4) {
10506 var r3 = t3.leaf ? this.compareMinX : s2, e4 = t3.leaf ? this.compareMinY : l2;
10507 this._allDistMargin(t3, i4, n4, r3) < this._allDistMargin(t3, i4, n4, e4) && t3.children.sort(r3);
10508 }, r2.prototype._allDistMargin = function(t3, i4, n4, r3) {
10509 t3.children.sort(r3);
10510 for (var e4 = this.toBBox, a3 = h2(t3, 0, i4, e4), s3 = h2(t3, n4 - i4, n4, e4), l3 = u2(a3) + u2(s3), f3 = i4; f3 < n4 - i4; f3++) {
10511 var m3 = t3.children[f3];
10512 o2(a3, t3.leaf ? e4(m3) : m3), l3 += u2(a3);
10514 for (var c3 = n4 - i4 - 1; c3 >= i4; c3--) {
10515 var p3 = t3.children[c3];
10516 o2(s3, t3.leaf ? e4(p3) : p3), l3 += u2(s3);
10519 }, r2.prototype._adjustParentBBoxes = function(t3, i4, n4) {
10520 for (var r3 = n4; r3 >= 0; r3--)
10522 }, r2.prototype._condense = function(t3) {
10523 for (var i4 = t3.length - 1, n4 = void 0; i4 >= 0; i4--)
10524 0 === t3[i4].children.length ? i4 > 0 ? (n4 = t3[i4 - 1].children).splice(n4.indexOf(t3[i4]), 1) : this.clear() : a2(t3[i4], this.toBBox);
10530 // node_modules/ieee754/index.js
10531 var require_ieee754 = __commonJS({
10532 "node_modules/ieee754/index.js"(exports2) {
10533 exports2.read = function(buffer, offset, isLE, mLen, nBytes) {
10535 var eLen = nBytes * 8 - mLen - 1;
10536 var eMax = (1 << eLen) - 1;
10537 var eBias = eMax >> 1;
10539 var i3 = isLE ? nBytes - 1 : 0;
10540 var d2 = isLE ? -1 : 1;
10541 var s2 = buffer[offset + i3];
10543 e3 = s2 & (1 << -nBits) - 1;
10546 for (; nBits > 0; e3 = e3 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
10548 m2 = e3 & (1 << -nBits) - 1;
10551 for (; nBits > 0; m2 = m2 * 256 + buffer[offset + i3], i3 += d2, nBits -= 8) {
10555 } else if (e3 === eMax) {
10556 return m2 ? NaN : (s2 ? -1 : 1) * Infinity;
10558 m2 = m2 + Math.pow(2, mLen);
10561 return (s2 ? -1 : 1) * m2 * Math.pow(2, e3 - mLen);
10563 exports2.write = function(buffer, value, offset, isLE, mLen, nBytes) {
10565 var eLen = nBytes * 8 - mLen - 1;
10566 var eMax = (1 << eLen) - 1;
10567 var eBias = eMax >> 1;
10568 var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
10569 var i3 = isLE ? 0 : nBytes - 1;
10570 var d2 = isLE ? 1 : -1;
10571 var s2 = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
10572 value = Math.abs(value);
10573 if (isNaN(value) || value === Infinity) {
10574 m2 = isNaN(value) ? 1 : 0;
10577 e3 = Math.floor(Math.log(value) / Math.LN2);
10578 if (value * (c2 = Math.pow(2, -e3)) < 1) {
10582 if (e3 + eBias >= 1) {
10585 value += rt * Math.pow(2, 1 - eBias);
10587 if (value * c2 >= 2) {
10591 if (e3 + eBias >= eMax) {
10594 } else if (e3 + eBias >= 1) {
10595 m2 = (value * c2 - 1) * Math.pow(2, mLen);
10598 m2 = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
10602 for (; mLen >= 8; buffer[offset + i3] = m2 & 255, i3 += d2, m2 /= 256, mLen -= 8) {
10604 e3 = e3 << mLen | m2;
10606 for (; eLen > 0; buffer[offset + i3] = e3 & 255, i3 += d2, e3 /= 256, eLen -= 8) {
10608 buffer[offset + i3 - d2] |= s2 * 128;
10613 // node_modules/pbf/index.js
10614 var require_pbf = __commonJS({
10615 "node_modules/pbf/index.js"(exports2, module2) {
10617 module2.exports = Pbf;
10618 var ieee754 = require_ieee754();
10619 function Pbf(buf) {
10620 this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
10623 this.length = this.buf.length;
10629 var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
10630 var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
10631 var TEXT_DECODER_MIN_LENGTH = 12;
10632 var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf8");
10634 destroy: function() {
10637 // === READING =================================================================
10638 readFields: function(readField, result, end) {
10639 end = end || this.length;
10640 while (this.pos < end) {
10641 var val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
10642 this.type = val & 7;
10643 readField(tag2, result, this);
10644 if (this.pos === startPos)
10649 readMessage: function(readField, result) {
10650 return this.readFields(readField, result, this.readVarint() + this.pos);
10652 readFixed32: function() {
10653 var val = readUInt32(this.buf, this.pos);
10657 readSFixed32: function() {
10658 var val = readInt32(this.buf, this.pos);
10662 // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
10663 readFixed64: function() {
10664 var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
10668 readSFixed64: function() {
10669 var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
10673 readFloat: function() {
10674 var val = ieee754.read(this.buf, this.pos, true, 23, 4);
10678 readDouble: function() {
10679 var val = ieee754.read(this.buf, this.pos, true, 52, 8);
10683 readVarint: function(isSigned) {
10684 var buf = this.buf, val, b2;
10685 b2 = buf[this.pos++];
10689 b2 = buf[this.pos++];
10690 val |= (b2 & 127) << 7;
10693 b2 = buf[this.pos++];
10694 val |= (b2 & 127) << 14;
10697 b2 = buf[this.pos++];
10698 val |= (b2 & 127) << 21;
10701 b2 = buf[this.pos];
10702 val |= (b2 & 15) << 28;
10703 return readVarintRemainder(val, isSigned, this);
10705 readVarint64: function() {
10706 return this.readVarint(true);
10708 readSVarint: function() {
10709 var num = this.readVarint();
10710 return num % 2 === 1 ? (num + 1) / -2 : num / 2;
10712 readBoolean: function() {
10713 return Boolean(this.readVarint());
10715 readString: function() {
10716 var end = this.readVarint() + this.pos;
10717 var pos = this.pos;
10719 if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
10720 return readUtf8TextDecoder(this.buf, pos, end);
10722 return readUtf8(this.buf, pos, end);
10724 readBytes: function() {
10725 var end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
10729 // verbose for performance reasons; doesn't affect gzipped size
10730 readPackedVarint: function(arr, isSigned) {
10731 if (this.type !== Pbf.Bytes)
10732 return arr.push(this.readVarint(isSigned));
10733 var end = readPackedEnd(this);
10735 while (this.pos < end)
10736 arr.push(this.readVarint(isSigned));
10739 readPackedSVarint: function(arr) {
10740 if (this.type !== Pbf.Bytes)
10741 return arr.push(this.readSVarint());
10742 var end = readPackedEnd(this);
10744 while (this.pos < end)
10745 arr.push(this.readSVarint());
10748 readPackedBoolean: function(arr) {
10749 if (this.type !== Pbf.Bytes)
10750 return arr.push(this.readBoolean());
10751 var end = readPackedEnd(this);
10753 while (this.pos < end)
10754 arr.push(this.readBoolean());
10757 readPackedFloat: function(arr) {
10758 if (this.type !== Pbf.Bytes)
10759 return arr.push(this.readFloat());
10760 var end = readPackedEnd(this);
10762 while (this.pos < end)
10763 arr.push(this.readFloat());
10766 readPackedDouble: function(arr) {
10767 if (this.type !== Pbf.Bytes)
10768 return arr.push(this.readDouble());
10769 var end = readPackedEnd(this);
10771 while (this.pos < end)
10772 arr.push(this.readDouble());
10775 readPackedFixed32: function(arr) {
10776 if (this.type !== Pbf.Bytes)
10777 return arr.push(this.readFixed32());
10778 var end = readPackedEnd(this);
10780 while (this.pos < end)
10781 arr.push(this.readFixed32());
10784 readPackedSFixed32: function(arr) {
10785 if (this.type !== Pbf.Bytes)
10786 return arr.push(this.readSFixed32());
10787 var end = readPackedEnd(this);
10789 while (this.pos < end)
10790 arr.push(this.readSFixed32());
10793 readPackedFixed64: function(arr) {
10794 if (this.type !== Pbf.Bytes)
10795 return arr.push(this.readFixed64());
10796 var end = readPackedEnd(this);
10798 while (this.pos < end)
10799 arr.push(this.readFixed64());
10802 readPackedSFixed64: function(arr) {
10803 if (this.type !== Pbf.Bytes)
10804 return arr.push(this.readSFixed64());
10805 var end = readPackedEnd(this);
10807 while (this.pos < end)
10808 arr.push(this.readSFixed64());
10811 skip: function(val) {
10812 var type2 = val & 7;
10813 if (type2 === Pbf.Varint)
10814 while (this.buf[this.pos++] > 127) {
10816 else if (type2 === Pbf.Bytes)
10817 this.pos = this.readVarint() + this.pos;
10818 else if (type2 === Pbf.Fixed32)
10820 else if (type2 === Pbf.Fixed64)
10823 throw new Error("Unimplemented type: " + type2);
10825 // === WRITING =================================================================
10826 writeTag: function(tag2, type2) {
10827 this.writeVarint(tag2 << 3 | type2);
10829 realloc: function(min3) {
10830 var length2 = this.length || 16;
10831 while (length2 < this.pos + min3)
10833 if (length2 !== this.length) {
10834 var buf = new Uint8Array(length2);
10837 this.length = length2;
10840 finish: function() {
10841 this.length = this.pos;
10843 return this.buf.subarray(0, this.length);
10845 writeFixed32: function(val) {
10847 writeInt32(this.buf, val, this.pos);
10850 writeSFixed32: function(val) {
10852 writeInt32(this.buf, val, this.pos);
10855 writeFixed64: function(val) {
10857 writeInt32(this.buf, val & -1, this.pos);
10858 writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
10861 writeSFixed64: function(val) {
10863 writeInt32(this.buf, val & -1, this.pos);
10864 writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
10867 writeVarint: function(val) {
10869 if (val > 268435455 || val < 0) {
10870 writeBigVarint(val, this);
10874 this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
10877 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
10880 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
10883 this.buf[this.pos++] = val >>> 7 & 127;
10885 writeSVarint: function(val) {
10886 this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
10888 writeBoolean: function(val) {
10889 this.writeVarint(Boolean(val));
10891 writeString: function(str) {
10893 this.realloc(str.length * 4);
10895 var startPos = this.pos;
10896 this.pos = writeUtf8(this.buf, str, this.pos);
10897 var len = this.pos - startPos;
10899 makeRoomForExtraLength(startPos, len, this);
10900 this.pos = startPos - 1;
10901 this.writeVarint(len);
10904 writeFloat: function(val) {
10906 ieee754.write(this.buf, val, this.pos, true, 23, 4);
10909 writeDouble: function(val) {
10911 ieee754.write(this.buf, val, this.pos, true, 52, 8);
10914 writeBytes: function(buffer) {
10915 var len = buffer.length;
10916 this.writeVarint(len);
10918 for (var i3 = 0; i3 < len; i3++)
10919 this.buf[this.pos++] = buffer[i3];
10921 writeRawMessage: function(fn, obj) {
10923 var startPos = this.pos;
10925 var len = this.pos - startPos;
10927 makeRoomForExtraLength(startPos, len, this);
10928 this.pos = startPos - 1;
10929 this.writeVarint(len);
10932 writeMessage: function(tag2, fn, obj) {
10933 this.writeTag(tag2, Pbf.Bytes);
10934 this.writeRawMessage(fn, obj);
10936 writePackedVarint: function(tag2, arr) {
10938 this.writeMessage(tag2, writePackedVarint, arr);
10940 writePackedSVarint: function(tag2, arr) {
10942 this.writeMessage(tag2, writePackedSVarint, arr);
10944 writePackedBoolean: function(tag2, arr) {
10946 this.writeMessage(tag2, writePackedBoolean, arr);
10948 writePackedFloat: function(tag2, arr) {
10950 this.writeMessage(tag2, writePackedFloat, arr);
10952 writePackedDouble: function(tag2, arr) {
10954 this.writeMessage(tag2, writePackedDouble, arr);
10956 writePackedFixed32: function(tag2, arr) {
10958 this.writeMessage(tag2, writePackedFixed32, arr);
10960 writePackedSFixed32: function(tag2, arr) {
10962 this.writeMessage(tag2, writePackedSFixed32, arr);
10964 writePackedFixed64: function(tag2, arr) {
10966 this.writeMessage(tag2, writePackedFixed64, arr);
10968 writePackedSFixed64: function(tag2, arr) {
10970 this.writeMessage(tag2, writePackedSFixed64, arr);
10972 writeBytesField: function(tag2, buffer) {
10973 this.writeTag(tag2, Pbf.Bytes);
10974 this.writeBytes(buffer);
10976 writeFixed32Field: function(tag2, val) {
10977 this.writeTag(tag2, Pbf.Fixed32);
10978 this.writeFixed32(val);
10980 writeSFixed32Field: function(tag2, val) {
10981 this.writeTag(tag2, Pbf.Fixed32);
10982 this.writeSFixed32(val);
10984 writeFixed64Field: function(tag2, val) {
10985 this.writeTag(tag2, Pbf.Fixed64);
10986 this.writeFixed64(val);
10988 writeSFixed64Field: function(tag2, val) {
10989 this.writeTag(tag2, Pbf.Fixed64);
10990 this.writeSFixed64(val);
10992 writeVarintField: function(tag2, val) {
10993 this.writeTag(tag2, Pbf.Varint);
10994 this.writeVarint(val);
10996 writeSVarintField: function(tag2, val) {
10997 this.writeTag(tag2, Pbf.Varint);
10998 this.writeSVarint(val);
11000 writeStringField: function(tag2, str) {
11001 this.writeTag(tag2, Pbf.Bytes);
11002 this.writeString(str);
11004 writeFloatField: function(tag2, val) {
11005 this.writeTag(tag2, Pbf.Fixed32);
11006 this.writeFloat(val);
11008 writeDoubleField: function(tag2, val) {
11009 this.writeTag(tag2, Pbf.Fixed64);
11010 this.writeDouble(val);
11012 writeBooleanField: function(tag2, val) {
11013 this.writeVarintField(tag2, Boolean(val));
11016 function readVarintRemainder(l2, s2, p2) {
11017 var buf = p2.buf, h2, b2;
11018 b2 = buf[p2.pos++];
11019 h2 = (b2 & 112) >> 4;
11021 return toNum(l2, h2, s2);
11022 b2 = buf[p2.pos++];
11023 h2 |= (b2 & 127) << 3;
11025 return toNum(l2, h2, s2);
11026 b2 = buf[p2.pos++];
11027 h2 |= (b2 & 127) << 10;
11029 return toNum(l2, h2, s2);
11030 b2 = buf[p2.pos++];
11031 h2 |= (b2 & 127) << 17;
11033 return toNum(l2, h2, s2);
11034 b2 = buf[p2.pos++];
11035 h2 |= (b2 & 127) << 24;
11037 return toNum(l2, h2, s2);
11038 b2 = buf[p2.pos++];
11039 h2 |= (b2 & 1) << 31;
11041 return toNum(l2, h2, s2);
11042 throw new Error("Expected varint not more than 10 bytes");
11044 function readPackedEnd(pbf) {
11045 return pbf.type === Pbf.Bytes ? pbf.readVarint() + pbf.pos : pbf.pos + 1;
11047 function toNum(low, high, isSigned) {
11049 return high * 4294967296 + (low >>> 0);
11051 return (high >>> 0) * 4294967296 + (low >>> 0);
11053 function writeBigVarint(val, pbf) {
11056 low = val % 4294967296 | 0;
11057 high = val / 4294967296 | 0;
11059 low = ~(-val % 4294967296);
11060 high = ~(-val / 4294967296);
11061 if (low ^ 4294967295) {
11065 high = high + 1 | 0;
11068 if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
11069 throw new Error("Given varint doesn't fit into 10 bytes");
11072 writeBigVarintLow(low, high, pbf);
11073 writeBigVarintHigh(high, pbf);
11075 function writeBigVarintLow(low, high, pbf) {
11076 pbf.buf[pbf.pos++] = low & 127 | 128;
11078 pbf.buf[pbf.pos++] = low & 127 | 128;
11080 pbf.buf[pbf.pos++] = low & 127 | 128;
11082 pbf.buf[pbf.pos++] = low & 127 | 128;
11084 pbf.buf[pbf.pos] = low & 127;
11086 function writeBigVarintHigh(high, pbf) {
11087 var lsb = (high & 7) << 4;
11088 pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
11091 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
11094 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
11097 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
11100 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
11103 pbf.buf[pbf.pos++] = high & 127;
11105 function makeRoomForExtraLength(startPos, len, pbf) {
11106 var extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
11107 pbf.realloc(extraLen);
11108 for (var i3 = pbf.pos - 1; i3 >= startPos; i3--)
11109 pbf.buf[i3 + extraLen] = pbf.buf[i3];
11111 function writePackedVarint(arr, pbf) {
11112 for (var i3 = 0; i3 < arr.length; i3++)
11113 pbf.writeVarint(arr[i3]);
11115 function writePackedSVarint(arr, pbf) {
11116 for (var i3 = 0; i3 < arr.length; i3++)
11117 pbf.writeSVarint(arr[i3]);
11119 function writePackedFloat(arr, pbf) {
11120 for (var i3 = 0; i3 < arr.length; i3++)
11121 pbf.writeFloat(arr[i3]);
11123 function writePackedDouble(arr, pbf) {
11124 for (var i3 = 0; i3 < arr.length; i3++)
11125 pbf.writeDouble(arr[i3]);
11127 function writePackedBoolean(arr, pbf) {
11128 for (var i3 = 0; i3 < arr.length; i3++)
11129 pbf.writeBoolean(arr[i3]);
11131 function writePackedFixed32(arr, pbf) {
11132 for (var i3 = 0; i3 < arr.length; i3++)
11133 pbf.writeFixed32(arr[i3]);
11135 function writePackedSFixed32(arr, pbf) {
11136 for (var i3 = 0; i3 < arr.length; i3++)
11137 pbf.writeSFixed32(arr[i3]);
11139 function writePackedFixed64(arr, pbf) {
11140 for (var i3 = 0; i3 < arr.length; i3++)
11141 pbf.writeFixed64(arr[i3]);
11143 function writePackedSFixed64(arr, pbf) {
11144 for (var i3 = 0; i3 < arr.length; i3++)
11145 pbf.writeSFixed64(arr[i3]);
11147 function readUInt32(buf, pos) {
11148 return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + buf[pos + 3] * 16777216;
11150 function writeInt32(buf, val, pos) {
11152 buf[pos + 1] = val >>> 8;
11153 buf[pos + 2] = val >>> 16;
11154 buf[pos + 3] = val >>> 24;
11156 function readInt32(buf, pos) {
11157 return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16) + (buf[pos + 3] << 24);
11159 function readUtf8(buf, pos, end) {
11165 var bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
11166 if (i3 + bytesPerSequence > end)
11169 if (bytesPerSequence === 1) {
11173 } else if (bytesPerSequence === 2) {
11175 if ((b1 & 192) === 128) {
11176 c2 = (b0 & 31) << 6 | b1 & 63;
11181 } else if (bytesPerSequence === 3) {
11184 if ((b1 & 192) === 128 && (b2 & 192) === 128) {
11185 c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
11186 if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
11190 } else if (bytesPerSequence === 4) {
11194 if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
11195 c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
11196 if (c2 <= 65535 || c2 >= 1114112) {
11203 bytesPerSequence = 1;
11204 } else if (c2 > 65535) {
11206 str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
11207 c2 = 56320 | c2 & 1023;
11209 str += String.fromCharCode(c2);
11210 i3 += bytesPerSequence;
11214 function readUtf8TextDecoder(buf, pos, end) {
11215 return utf8TextDecoder.decode(buf.subarray(pos, end));
11217 function writeUtf8(buf, str, pos) {
11218 for (var i3 = 0, c2, lead; i3 < str.length; i3++) {
11219 c2 = str.charCodeAt(i3);
11220 if (c2 > 55295 && c2 < 57344) {
11229 c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
11233 if (c2 > 56319 || i3 + 1 === str.length) {
11252 buf[pos++] = c2 >> 6 | 192;
11255 buf[pos++] = c2 >> 12 | 224;
11257 buf[pos++] = c2 >> 18 | 240;
11258 buf[pos++] = c2 >> 12 & 63 | 128;
11260 buf[pos++] = c2 >> 6 & 63 | 128;
11262 buf[pos++] = c2 & 63 | 128;
11270 // node_modules/@mapbox/point-geometry/index.js
11271 var require_point_geometry = __commonJS({
11272 "node_modules/@mapbox/point-geometry/index.js"(exports2, module2) {
11274 module2.exports = Point;
11275 function Point(x2, y2) {
11279 Point.prototype = {
11281 * Clone this point, returning a new point that can be modified
11282 * without affecting the old one.
11283 * @return {Point} the clone
11285 clone: function() {
11286 return new Point(this.x, this.y);
11289 * Add this point's x & y coordinates to another point,
11290 * yielding a new point.
11291 * @param {Point} p the other point
11292 * @return {Point} output point
11294 add: function(p2) {
11295 return this.clone()._add(p2);
11298 * Subtract this point's x & y coordinates to from point,
11299 * yielding a new point.
11300 * @param {Point} p the other point
11301 * @return {Point} output point
11303 sub: function(p2) {
11304 return this.clone()._sub(p2);
11307 * Multiply this point's x & y coordinates by point,
11308 * yielding a new point.
11309 * @param {Point} p the other point
11310 * @return {Point} output point
11312 multByPoint: function(p2) {
11313 return this.clone()._multByPoint(p2);
11316 * Divide this point's x & y coordinates by point,
11317 * yielding a new point.
11318 * @param {Point} p the other point
11319 * @return {Point} output point
11321 divByPoint: function(p2) {
11322 return this.clone()._divByPoint(p2);
11325 * Multiply this point's x & y coordinates by a factor,
11326 * yielding a new point.
11327 * @param {Point} k factor
11328 * @return {Point} output point
11330 mult: function(k2) {
11331 return this.clone()._mult(k2);
11334 * Divide this point's x & y coordinates by a factor,
11335 * yielding a new point.
11336 * @param {Point} k factor
11337 * @return {Point} output point
11339 div: function(k2) {
11340 return this.clone()._div(k2);
11343 * Rotate this point around the 0, 0 origin by an angle a,
11345 * @param {Number} a angle to rotate around, in radians
11346 * @return {Point} output point
11348 rotate: function(a2) {
11349 return this.clone()._rotate(a2);
11352 * Rotate this point around p point by an angle a,
11354 * @param {Number} a angle to rotate around, in radians
11355 * @param {Point} p Point to rotate around
11356 * @return {Point} output point
11358 rotateAround: function(a2, p2) {
11359 return this.clone()._rotateAround(a2, p2);
11362 * Multiply this point by a 4x1 transformation matrix
11363 * @param {Array<Number>} m transformation matrix
11364 * @return {Point} output point
11366 matMult: function(m2) {
11367 return this.clone()._matMult(m2);
11370 * Calculate this point but as a unit vector from 0, 0, meaning
11371 * that the distance from the resulting point to the 0, 0
11372 * coordinate will be equal to 1 and the angle from the resulting
11373 * point to the 0, 0 coordinate will be the same as before.
11374 * @return {Point} unit vector point
11377 return this.clone()._unit();
11380 * Compute a perpendicular point, where the new y coordinate
11381 * is the old x coordinate and the new x coordinate is the old y
11382 * coordinate multiplied by -1
11383 * @return {Point} perpendicular point
11386 return this.clone()._perp();
11389 * Return a version of this point with the x & y coordinates
11390 * rounded to integers.
11391 * @return {Point} rounded point
11393 round: function() {
11394 return this.clone()._round();
11397 * Return the magitude of this point: this is the Euclidean
11398 * distance from the 0, 0 coordinate to this point's x and y
11400 * @return {Number} magnitude
11403 return Math.sqrt(this.x * this.x + this.y * this.y);
11406 * Judge whether this point is equal to another point, returning
11408 * @param {Point} other the other point
11409 * @return {boolean} whether the points are equal
11411 equals: function(other) {
11412 return this.x === other.x && this.y === other.y;
11415 * Calculate the distance from this point to another point
11416 * @param {Point} p the other point
11417 * @return {Number} distance
11419 dist: function(p2) {
11420 return Math.sqrt(this.distSqr(p2));
11423 * Calculate the distance from this point to another point,
11424 * without the square root step. Useful if you're comparing
11425 * relative distances.
11426 * @param {Point} p the other point
11427 * @return {Number} distance
11429 distSqr: function(p2) {
11430 var dx = p2.x - this.x, dy = p2.y - this.y;
11431 return dx * dx + dy * dy;
11434 * Get the angle from the 0, 0 coordinate to this point, in radians
11436 * @return {Number} angle
11438 angle: function() {
11439 return Math.atan2(this.y, this.x);
11442 * Get the angle from this point to another point, in radians
11443 * @param {Point} b the other point
11444 * @return {Number} angle
11446 angleTo: function(b2) {
11447 return Math.atan2(this.y - b2.y, this.x - b2.x);
11450 * Get the angle between this point and another point, in radians
11451 * @param {Point} b the other point
11452 * @return {Number} angle
11454 angleWith: function(b2) {
11455 return this.angleWithSep(b2.x, b2.y);
11458 * Find the angle of the two vectors, solving the formula for
11459 * the cross product a x b = |a||b|sin(θ) for θ.
11460 * @param {Number} x the x-coordinate
11461 * @param {Number} y the y-coordinate
11462 * @return {Number} the angle in radians
11464 angleWithSep: function(x2, y2) {
11466 this.x * y2 - this.y * x2,
11467 this.x * x2 + this.y * y2
11470 _matMult: function(m2) {
11471 var x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
11476 _add: function(p2) {
11481 _sub: function(p2) {
11486 _mult: function(k2) {
11491 _div: function(k2) {
11496 _multByPoint: function(p2) {
11501 _divByPoint: function(p2) {
11506 _unit: function() {
11507 this._div(this.mag());
11510 _perp: function() {
11516 _rotate: function(angle2) {
11517 var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
11522 _rotateAround: function(angle2, p2) {
11523 var cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = p2.x + cos2 * (this.x - p2.x) - sin2 * (this.y - p2.y), y2 = p2.y + sin2 * (this.x - p2.x) + cos2 * (this.y - p2.y);
11528 _round: function() {
11529 this.x = Math.round(this.x);
11530 this.y = Math.round(this.y);
11534 Point.convert = function(a2) {
11535 if (a2 instanceof Point) {
11538 if (Array.isArray(a2)) {
11539 return new Point(a2[0], a2[1]);
11546 // node_modules/@mapbox/vector-tile/lib/vectortilefeature.js
11547 var require_vectortilefeature = __commonJS({
11548 "node_modules/@mapbox/vector-tile/lib/vectortilefeature.js"(exports2, module2) {
11550 var Point = require_point_geometry();
11551 module2.exports = VectorTileFeature;
11552 function VectorTileFeature(pbf, end, extent, keys2, values) {
11553 this.properties = {};
11554 this.extent = extent;
11557 this._geometry = -1;
11558 this._keys = keys2;
11559 this._values = values;
11560 pbf.readFields(readFeature, this, end);
11562 function readFeature(tag2, feature3, pbf) {
11564 feature3.id = pbf.readVarint();
11565 else if (tag2 == 2)
11566 readTag(pbf, feature3);
11567 else if (tag2 == 3)
11568 feature3.type = pbf.readVarint();
11569 else if (tag2 == 4)
11570 feature3._geometry = pbf.pos;
11572 function readTag(pbf, feature3) {
11573 var end = pbf.readVarint() + pbf.pos;
11574 while (pbf.pos < end) {
11575 var key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
11576 feature3.properties[key] = value;
11579 VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
11580 VectorTileFeature.prototype.loadGeometry = function() {
11581 var pbf = this._pbf;
11582 pbf.pos = this._geometry;
11583 var end = pbf.readVarint() + pbf.pos, cmd = 1, length2 = 0, x2 = 0, y2 = 0, lines = [], line;
11584 while (pbf.pos < end) {
11585 if (length2 <= 0) {
11586 var cmdLen = pbf.readVarint();
11588 length2 = cmdLen >> 3;
11591 if (cmd === 1 || cmd === 2) {
11592 x2 += pbf.readSVarint();
11593 y2 += pbf.readSVarint();
11599 line.push(new Point(x2, y2));
11600 } else if (cmd === 7) {
11602 line.push(line[0].clone());
11605 throw new Error("unknown command " + cmd);
11612 VectorTileFeature.prototype.bbox = function() {
11613 var pbf = this._pbf;
11614 pbf.pos = this._geometry;
11615 var end = pbf.readVarint() + pbf.pos, cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
11616 while (pbf.pos < end) {
11617 if (length2 <= 0) {
11618 var cmdLen = pbf.readVarint();
11620 length2 = cmdLen >> 3;
11623 if (cmd === 1 || cmd === 2) {
11624 x2 += pbf.readSVarint();
11625 y2 += pbf.readSVarint();
11634 } else if (cmd !== 7) {
11635 throw new Error("unknown command " + cmd);
11638 return [x12, y12, x22, y22];
11640 VectorTileFeature.prototype.toGeoJSON = function(x2, y2, z2) {
11641 var size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, coords = this.loadGeometry(), type2 = VectorTileFeature.types[this.type], i3, j2;
11642 function project(line) {
11643 for (var j3 = 0; j3 < line.length; j3++) {
11644 var p2 = line[j3], y22 = 180 - (p2.y + y05) * 360 / size;
11646 (p2.x + x05) * 360 / size - 180,
11647 360 / Math.PI * Math.atan(Math.exp(y22 * Math.PI / 180)) - 90
11651 switch (this.type) {
11654 for (i3 = 0; i3 < coords.length; i3++) {
11655 points[i3] = coords[i3][0];
11661 for (i3 = 0; i3 < coords.length; i3++) {
11662 project(coords[i3]);
11666 coords = classifyRings(coords);
11667 for (i3 = 0; i3 < coords.length; i3++) {
11668 for (j2 = 0; j2 < coords[i3].length; j2++) {
11669 project(coords[i3][j2]);
11674 if (coords.length === 1) {
11675 coords = coords[0];
11677 type2 = "Multi" + type2;
11683 coordinates: coords
11685 properties: this.properties
11687 if ("id" in this) {
11688 result.id = this.id;
11692 function classifyRings(rings) {
11693 var len = rings.length;
11696 var polygons = [], polygon2, ccw;
11697 for (var i3 = 0; i3 < len; i3++) {
11698 var area = signedArea(rings[i3]);
11701 if (ccw === void 0)
11703 if (ccw === area < 0) {
11705 polygons.push(polygon2);
11706 polygon2 = [rings[i3]];
11708 polygon2.push(rings[i3]);
11712 polygons.push(polygon2);
11715 function signedArea(ring) {
11717 for (var i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
11720 sum += (p2.x - p1.x) * (p1.y + p2.y);
11727 // node_modules/@mapbox/vector-tile/lib/vectortilelayer.js
11728 var require_vectortilelayer = __commonJS({
11729 "node_modules/@mapbox/vector-tile/lib/vectortilelayer.js"(exports2, module2) {
11731 var VectorTileFeature = require_vectortilefeature();
11732 module2.exports = VectorTileLayer;
11733 function VectorTileLayer(pbf, end) {
11736 this.extent = 4096;
11741 this._features = [];
11742 pbf.readFields(readLayer, this, end);
11743 this.length = this._features.length;
11745 function readLayer(tag2, layer, pbf) {
11747 layer.version = pbf.readVarint();
11748 else if (tag2 === 1)
11749 layer.name = pbf.readString();
11750 else if (tag2 === 5)
11751 layer.extent = pbf.readVarint();
11752 else if (tag2 === 2)
11753 layer._features.push(pbf.pos);
11754 else if (tag2 === 3)
11755 layer._keys.push(pbf.readString());
11756 else if (tag2 === 4)
11757 layer._values.push(readValueMessage(pbf));
11759 function readValueMessage(pbf) {
11760 var value = null, end = pbf.readVarint() + pbf.pos;
11761 while (pbf.pos < end) {
11762 var tag2 = pbf.readVarint() >> 3;
11763 value = tag2 === 1 ? pbf.readString() : tag2 === 2 ? pbf.readFloat() : tag2 === 3 ? pbf.readDouble() : tag2 === 4 ? pbf.readVarint64() : tag2 === 5 ? pbf.readVarint() : tag2 === 6 ? pbf.readSVarint() : tag2 === 7 ? pbf.readBoolean() : null;
11767 VectorTileLayer.prototype.feature = function(i3) {
11768 if (i3 < 0 || i3 >= this._features.length)
11769 throw new Error("feature index out of bounds");
11770 this._pbf.pos = this._features[i3];
11771 var end = this._pbf.readVarint() + this._pbf.pos;
11772 return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
11777 // node_modules/@mapbox/vector-tile/lib/vectortile.js
11778 var require_vectortile = __commonJS({
11779 "node_modules/@mapbox/vector-tile/lib/vectortile.js"(exports2, module2) {
11781 var VectorTileLayer = require_vectortilelayer();
11782 module2.exports = VectorTile3;
11783 function VectorTile3(pbf, end) {
11784 this.layers = pbf.readFields(readTile, {}, end);
11786 function readTile(tag2, layers, pbf) {
11788 var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
11790 layers[layer.name] = layer;
11796 // node_modules/@mapbox/vector-tile/index.js
11797 var require_vector_tile = __commonJS({
11798 "node_modules/@mapbox/vector-tile/index.js"(exports2, module2) {
11799 module2.exports.VectorTile = require_vectortile();
11800 module2.exports.VectorTileFeature = require_vectortilefeature();
11801 module2.exports.VectorTileLayer = require_vectortilelayer();
11805 // node_modules/fast-json-stable-stringify/index.js
11806 var require_fast_json_stable_stringify = __commonJS({
11807 "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
11809 module2.exports = function(data, opts) {
11812 if (typeof opts === "function")
11813 opts = { cmp: opts };
11814 var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
11815 var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
11816 return function(node) {
11817 return function(a2, b2) {
11818 var aobj = { key: a2, value: node[a2] };
11819 var bobj = { key: b2, value: node[b2] };
11820 return f2(aobj, bobj);
11825 return function stringify3(node) {
11826 if (node && node.toJSON && typeof node.toJSON === "function") {
11827 node = node.toJSON();
11829 if (node === void 0)
11831 if (typeof node == "number")
11832 return isFinite(node) ? "" + node : "null";
11833 if (typeof node !== "object")
11834 return JSON.stringify(node);
11836 if (Array.isArray(node)) {
11838 for (i3 = 0; i3 < node.length; i3++) {
11841 out += stringify3(node[i3]) || "null";
11847 if (seen.indexOf(node) !== -1) {
11849 return JSON.stringify("__cycle__");
11850 throw new TypeError("Converting circular structure to JSON");
11852 var seenIndex = seen.push(node) - 1;
11853 var keys2 = Object.keys(node).sort(cmp && cmp(node));
11855 for (i3 = 0; i3 < keys2.length; i3++) {
11856 var key = keys2[i3];
11857 var value = stringify3(node[key]);
11862 out += JSON.stringify(key) + ":" + value;
11864 seen.splice(seenIndex, 1);
11865 return "{" + out + "}";
11871 // node_modules/@mapbox/sexagesimal/index.js
11872 var require_sexagesimal = __commonJS({
11873 "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
11874 module2.exports = element;
11875 module2.exports.pair = pair3;
11876 module2.exports.format = format2;
11877 module2.exports.formatPair = formatPair;
11878 module2.exports.coordToDMS = coordToDMS;
11879 function element(input, dims) {
11880 var result = search(input, dims);
11881 return result === null ? null : result.val;
11883 function formatPair(input) {
11884 return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
11886 function format2(input, dim) {
11887 var dms = coordToDMS(input, dim);
11888 return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
11890 function coordToDMS(input, dim) {
11891 var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
11892 var dir = dirs[input >= 0 ? 0 : 1];
11893 var abs3 = Math.abs(input);
11894 var whole = Math.floor(abs3);
11895 var fraction = abs3 - whole;
11896 var fractionMinutes = fraction * 60;
11897 var minutes = Math.floor(fractionMinutes);
11898 var seconds = Math.floor((fractionMinutes - minutes) * 60);
11906 function search(input, dims) {
11909 if (typeof input !== "string")
11911 input = input.toUpperCase();
11912 var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
11913 var m2 = input.match(regex);
11916 var matched = m2[0];
11918 if (m2[1] && m2[5]) {
11920 matched = matched.slice(0, -1);
11922 dim = m2[1] || m2[5];
11924 if (dim && dims.indexOf(dim) === -1)
11926 var deg = m2[2] ? parseFloat(m2[2]) : 0;
11927 var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
11928 var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
11929 var sign2 = deg < 0 ? -1 : 1;
11930 if (dim === "S" || dim === "W")
11933 val: (Math.abs(deg) + min3 + sec) * sign2,
11936 remain: input.slice(matched.length)
11939 function pair3(input, dims) {
11940 input = input.trim();
11941 var one2 = search(input, dims);
11944 input = one2.remain.trim();
11945 var two = search(input, dims);
11946 if (!two || two.remain)
11949 return swapdim(one2.val, two.val, one2.dim);
11951 return [one2.val, two.val];
11954 function swapdim(a2, b2, dim) {
11955 if (dim === "N" || dim === "S")
11957 if (dim === "W" || dim === "E")
11963 // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
11964 var require_polygon_clipping_umd = __commonJS({
11965 "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
11966 (function(global2, factory) {
11967 typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, global2.polygonClipping = factory());
11968 })(exports2, function() {
11970 function __generator(thisArg, body) {
11985 }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
11988 function verb(n3) {
11989 return function(v2) {
11990 return step([n3, v2]);
11993 function step(op) {
11995 throw new TypeError("Generator is already executing.");
11998 if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done)
12001 op = [op[0] & 2, t2.value];
12023 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
12027 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
12031 if (op[0] === 6 && _2.label < t2[1]) {
12036 if (t2 && _2.label < t2[2]) {
12046 op = body.call(thisArg, _2);
12056 value: op[0] ? op[1] : void 0,
12063 /* @__PURE__ */ function() {
12064 function Node2(key, data) {
12074 function DEFAULT_COMPARE(a2, b2) {
12075 return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
12077 function splay(i3, t2, comparator) {
12078 var N2 = new Node(null, null);
12082 var cmp2 = comparator(i3, t2.key);
12084 if (t2.left === null)
12086 if (comparator(i3, t2.left.key) < 0) {
12088 t2.left = y2.right;
12091 if (t2.left === null)
12097 } else if (cmp2 > 0) {
12098 if (t2.right === null)
12100 if (comparator(i3, t2.right.key) > 0) {
12102 t2.right = y2.left;
12105 if (t2.right === null)
12114 l2.right = t2.left;
12115 r2.left = t2.right;
12116 t2.left = N2.right;
12117 t2.right = N2.left;
12120 function insert(i3, data, t2, comparator) {
12121 var node = new Node(i3, data);
12123 node.left = node.right = null;
12126 t2 = splay(i3, t2, comparator);
12127 var cmp2 = comparator(i3, t2.key);
12129 node.left = t2.left;
12132 } else if (cmp2 >= 0) {
12133 node.right = t2.right;
12139 function split(key, v2, comparator) {
12143 v2 = splay(key, v2, comparator);
12144 var cmp2 = comparator(v2.key, key);
12148 } else if (cmp2 < 0) {
12163 function merge2(left, right, comparator) {
12164 if (right === null)
12168 right = splay(left.key, right, comparator);
12172 function printRow(root3, prefix, isTail, out, printNode) {
12174 out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
12175 var indent = prefix + (isTail ? " " : "\u2502 ");
12177 printRow(root3.left, indent, false, out, printNode);
12179 printRow(root3.right, indent, true, out, printNode);
12185 function Tree2(comparator) {
12186 if (comparator === void 0) {
12187 comparator = DEFAULT_COMPARE;
12191 this._comparator = comparator;
12193 Tree2.prototype.insert = function(key, data) {
12195 return this._root = insert(key, data, this._root, this._comparator);
12197 Tree2.prototype.add = function(key, data) {
12198 var node = new Node(key, data);
12199 if (this._root === null) {
12200 node.left = node.right = null;
12204 var comparator = this._comparator;
12205 var t2 = splay(key, this._root, comparator);
12206 var cmp2 = comparator(key, t2.key);
12211 node.left = t2.left;
12214 } else if (cmp2 > 0) {
12215 node.right = t2.right;
12224 Tree2.prototype.remove = function(key) {
12225 this._root = this._remove(key, this._root, this._comparator);
12227 Tree2.prototype._remove = function(i3, t2, comparator) {
12231 t2 = splay(i3, t2, comparator);
12232 var cmp2 = comparator(i3, t2.key);
12234 if (t2.left === null) {
12237 x2 = splay(i3, t2.left, comparator);
12238 x2.right = t2.right;
12245 Tree2.prototype.pop = function() {
12246 var node = this._root;
12250 this._root = splay(node.key, this._root, this._comparator);
12251 this._root = this._remove(node.key, this._root, this._comparator);
12259 Tree2.prototype.findStatic = function(key) {
12260 var current = this._root;
12261 var compare2 = this._comparator;
12263 var cmp2 = compare2(key, current.key);
12267 current = current.left;
12269 current = current.right;
12273 Tree2.prototype.find = function(key) {
12275 this._root = splay(key, this._root, this._comparator);
12276 if (this._comparator(key, this._root.key) !== 0)
12281 Tree2.prototype.contains = function(key) {
12282 var current = this._root;
12283 var compare2 = this._comparator;
12285 var cmp2 = compare2(key, current.key);
12289 current = current.left;
12291 current = current.right;
12295 Tree2.prototype.forEach = function(visitor, ctx) {
12296 var current = this._root;
12300 if (current !== null) {
12302 current = current.left;
12304 if (Q2.length !== 0) {
12305 current = Q2.pop();
12306 visitor.call(ctx, current);
12307 current = current.right;
12314 Tree2.prototype.range = function(low, high, fn, ctx) {
12316 var compare2 = this._comparator;
12317 var node = this._root;
12319 while (Q2.length !== 0 || node) {
12325 cmp2 = compare2(node.key, high);
12328 } else if (compare2(node.key, low) >= 0) {
12329 if (fn.call(ctx, node))
12337 Tree2.prototype.keys = function() {
12339 this.forEach(function(_a2) {
12341 return keys2.push(key);
12345 Tree2.prototype.values = function() {
12347 this.forEach(function(_a2) {
12348 var data = _a2.data;
12349 return values.push(data);
12353 Tree2.prototype.min = function() {
12355 return this.minNode(this._root).key;
12358 Tree2.prototype.max = function() {
12360 return this.maxNode(this._root).key;
12363 Tree2.prototype.minNode = function(t2) {
12364 if (t2 === void 0) {
12372 Tree2.prototype.maxNode = function(t2) {
12373 if (t2 === void 0) {
12381 Tree2.prototype.at = function(index2) {
12382 var current = this._root;
12389 current = current.left;
12391 if (Q2.length > 0) {
12392 current = Q2.pop();
12396 current = current.right;
12403 Tree2.prototype.next = function(d2) {
12404 var root3 = this._root;
12405 var successor = null;
12407 successor = d2.right;
12408 while (successor.left)
12409 successor = successor.left;
12412 var comparator = this._comparator;
12414 var cmp2 = comparator(d2.key, root3.key);
12417 else if (cmp2 < 0) {
12419 root3 = root3.left;
12421 root3 = root3.right;
12425 Tree2.prototype.prev = function(d2) {
12426 var root3 = this._root;
12427 var predecessor = null;
12428 if (d2.left !== null) {
12429 predecessor = d2.left;
12430 while (predecessor.right)
12431 predecessor = predecessor.right;
12432 return predecessor;
12434 var comparator = this._comparator;
12436 var cmp2 = comparator(d2.key, root3.key);
12440 root3 = root3.left;
12442 predecessor = root3;
12443 root3 = root3.right;
12446 return predecessor;
12448 Tree2.prototype.clear = function() {
12453 Tree2.prototype.toList = function() {
12454 return toList(this._root);
12456 Tree2.prototype.load = function(keys2, values, presort) {
12457 if (values === void 0) {
12460 if (presort === void 0) {
12463 var size = keys2.length;
12464 var comparator = this._comparator;
12466 sort(keys2, values, 0, size - 1, comparator);
12467 if (this._root === null) {
12468 this._root = loadRecursive(keys2, values, 0, size);
12471 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
12472 size = this._size + size;
12473 this._root = sortedListToBST({
12479 Tree2.prototype.isEmpty = function() {
12480 return this._root === null;
12482 Object.defineProperty(Tree2.prototype, "size", {
12489 Object.defineProperty(Tree2.prototype, "root", {
12496 Tree2.prototype.toString = function(printNode) {
12497 if (printNode === void 0) {
12498 printNode = function(n3) {
12499 return String(n3.key);
12503 printRow(this._root, "", true, function(v2) {
12504 return out.push(v2);
12506 return out.join("");
12508 Tree2.prototype.update = function(key, newKey, newData) {
12509 var comparator = this._comparator;
12510 var _a2 = split(key, this._root, comparator), left = _a2.left, right = _a2.right;
12511 if (comparator(key, newKey) < 0) {
12512 right = insert(newKey, newData, right, comparator);
12514 left = insert(newKey, newData, left, comparator);
12516 this._root = merge2(left, right, comparator);
12518 Tree2.prototype.split = function(key) {
12519 return split(key, this._root, this._comparator);
12521 Tree2.prototype[Symbol.iterator] = function() {
12522 var current, Q2, done;
12523 return __generator(this, function(_a2) {
12524 switch (_a2.label) {
12526 current = this._root;
12533 if (!(current !== null))
12536 current = current.left;
12539 if (!(Q2.length !== 0))
12541 current = Q2.pop();
12542 return [4, current];
12545 current = current.right;
12563 function loadRecursive(keys2, values, start2, end) {
12564 var size = end - start2;
12566 var middle = start2 + Math.floor(size / 2);
12567 var key = keys2[middle];
12568 var data = values[middle];
12569 var node = new Node(key, data);
12570 node.left = loadRecursive(keys2, values, start2, middle);
12571 node.right = loadRecursive(keys2, values, middle + 1, end);
12576 function createList(keys2, values) {
12577 var head = new Node(null, null);
12579 for (var i3 = 0; i3 < keys2.length; i3++) {
12580 p2 = p2.next = new Node(keys2[i3], values[i3]);
12585 function toList(root3) {
12586 var current = root3;
12589 var head = new Node(null, null);
12594 current = current.left;
12596 if (Q2.length > 0) {
12597 current = p2 = p2.next = Q2.pop();
12598 current = current.right;
12606 function sortedListToBST(list2, start2, end) {
12607 var size = end - start2;
12609 var middle = start2 + Math.floor(size / 2);
12610 var left = sortedListToBST(list2, start2, middle);
12611 var root3 = list2.head;
12613 list2.head = list2.head.next;
12614 root3.right = sortedListToBST(list2, middle + 1, end);
12619 function mergeLists(l1, l2, compare2) {
12620 var head = new Node(null, null);
12624 while (p1 !== null && p22 !== null) {
12625 if (compare2(p1.key, p22.key) < 0) {
12636 } else if (p22 !== null) {
12641 function sort(keys2, values, left, right, compare2) {
12644 var pivot = keys2[left + right >> 1];
12646 var j2 = right + 1;
12650 while (compare2(keys2[i3], pivot) < 0);
12653 while (compare2(keys2[j2], pivot) > 0);
12656 var tmp = keys2[i3];
12657 keys2[i3] = keys2[j2];
12660 values[i3] = values[j2];
12663 sort(keys2, values, left, j2, compare2);
12664 sort(keys2, values, j2 + 1, right, compare2);
12666 const isInBbox2 = (bbox2, point2) => {
12667 return bbox2.ll.x <= point2.x && point2.x <= bbox2.ur.x && bbox2.ll.y <= point2.y && point2.y <= bbox2.ur.y;
12669 const getBboxOverlap2 = (b1, b2) => {
12670 if (b2.ur.x < b1.ll.x || b1.ur.x < b2.ll.x || b2.ur.y < b1.ll.y || b1.ur.y < b2.ll.y)
12672 const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
12673 const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
12674 const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
12675 const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
12687 let epsilon$1 = Number.EPSILON;
12688 if (epsilon$1 === void 0)
12689 epsilon$1 = Math.pow(2, -52);
12690 const EPSILON_SQ = epsilon$1 * epsilon$1;
12691 const cmp = (a2, b2) => {
12692 if (-epsilon$1 < a2 && a2 < epsilon$1) {
12693 if (-epsilon$1 < b2 && b2 < epsilon$1) {
12697 const ab = a2 - b2;
12698 if (ab * ab < EPSILON_SQ * a2 * b2) {
12701 return a2 < b2 ? -1 : 1;
12708 this.xRounder = new CoordRounder();
12709 this.yRounder = new CoordRounder();
12713 x: this.xRounder.round(x2),
12714 y: this.yRounder.round(y2)
12718 class CoordRounder {
12720 this.tree = new Tree();
12723 // Note: this can rounds input values backwards or forwards.
12724 // You might ask, why not restrict this to just rounding
12725 // forwards? Wouldn't that allow left endpoints to always
12726 // remain left endpoints during splitting (never change to
12727 // right). No - it wouldn't, because we snap intersections
12728 // to endpoints (to establish independence from the segment
12729 // angle for t-intersections).
12731 const node = this.tree.add(coord2);
12732 const prevNode = this.tree.prev(node);
12733 if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
12734 this.tree.remove(coord2);
12735 return prevNode.key;
12737 const nextNode = this.tree.next(node);
12738 if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
12739 this.tree.remove(coord2);
12740 return nextNode.key;
12745 const rounder = new PtRounder();
12746 const epsilon3 = 11102230246251565e-32;
12747 const splitter = 134217729;
12748 const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
12749 function sum(elen, e3, flen, f2, h2) {
12750 let Q2, Qnew, hh, bvirt;
12755 if (fnow > enow === fnow > -enow) {
12757 enow = e3[++eindex];
12760 fnow = f2[++findex];
12763 if (eindex < elen && findex < flen) {
12764 if (fnow > enow === fnow > -enow) {
12766 hh = Q2 - (Qnew - enow);
12767 enow = e3[++eindex];
12770 hh = Q2 - (Qnew - fnow);
12771 fnow = f2[++findex];
12777 while (eindex < elen && findex < flen) {
12778 if (fnow > enow === fnow > -enow) {
12781 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
12782 enow = e3[++eindex];
12786 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
12787 fnow = f2[++findex];
12795 while (eindex < elen) {
12798 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
12799 enow = e3[++eindex];
12805 while (findex < flen) {
12808 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
12809 fnow = f2[++findex];
12815 if (Q2 !== 0 || hindex === 0) {
12820 function estimate(elen, e3) {
12822 for (let i3 = 1; i3 < elen; i3++)
12827 return new Float64Array(n3);
12829 const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
12830 const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
12831 const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
12834 const C2 = vec(12);
12835 const D2 = vec(16);
12837 function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
12838 let acxtail, acytail, bcxtail, bcytail;
12839 let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;
12840 const acx = ax - cx;
12841 const bcx = bx - cx;
12842 const acy = ay - cy;
12843 const bcy = by - cy;
12845 c2 = splitter * acx;
12846 ahi = c2 - (c2 - acx);
12848 c2 = splitter * bcy;
12849 bhi = c2 - (c2 - bcy);
12851 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
12853 c2 = splitter * acy;
12854 ahi = c2 - (c2 - acy);
12856 c2 = splitter * bcx;
12857 bhi = c2 - (c2 - bcx);
12859 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
12862 B2[0] = s0 - (_i + bvirt) + (bvirt - t0);
12865 _0 = s1 - (_j - bvirt) + (_i - bvirt);
12868 B2[1] = _0 - (_i + bvirt) + (bvirt - t1);
12871 B2[2] = _j - (u3 - bvirt) + (_i - bvirt);
12873 let det = estimate(4, B2);
12874 let errbound = ccwerrboundB * detsum;
12875 if (det >= errbound || -det >= errbound) {
12879 acxtail = ax - (acx + bvirt) + (bvirt - cx);
12881 bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
12883 acytail = ay - (acy + bvirt) + (bvirt - cy);
12885 bcytail = by - (bcy + bvirt) + (bvirt - cy);
12886 if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
12889 errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
12890 det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
12891 if (det >= errbound || -det >= errbound)
12893 s1 = acxtail * bcy;
12894 c2 = splitter * acxtail;
12895 ahi = c2 - (c2 - acxtail);
12896 alo = acxtail - ahi;
12897 c2 = splitter * bcy;
12898 bhi = c2 - (c2 - bcy);
12900 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
12901 t1 = acytail * bcx;
12902 c2 = splitter * acytail;
12903 ahi = c2 - (c2 - acytail);
12904 alo = acytail - ahi;
12905 c2 = splitter * bcx;
12906 bhi = c2 - (c2 - bcx);
12908 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
12911 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
12914 _0 = s1 - (_j - bvirt) + (_i - bvirt);
12917 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
12920 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
12922 const C1len = sum(4, B2, 4, u2, C1);
12923 s1 = acx * bcytail;
12924 c2 = splitter * acx;
12925 ahi = c2 - (c2 - acx);
12927 c2 = splitter * bcytail;
12928 bhi = c2 - (c2 - bcytail);
12929 blo = bcytail - bhi;
12930 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
12931 t1 = acy * bcxtail;
12932 c2 = splitter * acy;
12933 ahi = c2 - (c2 - acy);
12935 c2 = splitter * bcxtail;
12936 bhi = c2 - (c2 - bcxtail);
12937 blo = bcxtail - bhi;
12938 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
12941 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
12944 _0 = s1 - (_j - bvirt) + (_i - bvirt);
12947 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
12950 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
12952 const C2len = sum(C1len, C1, 4, u2, C2);
12953 s1 = acxtail * bcytail;
12954 c2 = splitter * acxtail;
12955 ahi = c2 - (c2 - acxtail);
12956 alo = acxtail - ahi;
12957 c2 = splitter * bcytail;
12958 bhi = c2 - (c2 - bcytail);
12959 blo = bcytail - bhi;
12960 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
12961 t1 = acytail * bcxtail;
12962 c2 = splitter * acytail;
12963 ahi = c2 - (c2 - acytail);
12964 alo = acytail - ahi;
12965 c2 = splitter * bcxtail;
12966 bhi = c2 - (c2 - bcxtail);
12967 blo = bcxtail - bhi;
12968 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
12971 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
12974 _0 = s1 - (_j - bvirt) + (_i - bvirt);
12977 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
12980 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
12982 const Dlen = sum(C2len, C2, 4, u2, D2);
12983 return D2[Dlen - 1];
12985 function orient2d(ax, ay, bx, by, cx, cy) {
12986 const detleft = (ay - cy) * (bx - cx);
12987 const detright = (ax - cx) * (by - cy);
12988 const det = detleft - detright;
12989 const detsum = Math.abs(detleft + detright);
12990 if (Math.abs(det) >= ccwerrboundA * detsum)
12992 return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
12994 const crossProduct2 = (a2, b2) => a2.x * b2.y - a2.y * b2.x;
12995 const dotProduct2 = (a2, b2) => a2.x * b2.x + a2.y * b2.y;
12996 const compareVectorAngles = (basePt, endPt1, endPt2) => {
12997 const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
13004 const length2 = (v2) => Math.sqrt(dotProduct2(v2, v2));
13005 const sineOfAngle2 = (pShared, pBase, pAngle) => {
13007 x: pBase.x - pShared.x,
13008 y: pBase.y - pShared.y
13011 x: pAngle.x - pShared.x,
13012 y: pAngle.y - pShared.y
13014 return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
13016 const cosineOfAngle2 = (pShared, pBase, pAngle) => {
13018 x: pBase.x - pShared.x,
13019 y: pBase.y - pShared.y
13022 x: pAngle.x - pShared.x,
13023 y: pAngle.y - pShared.y
13025 return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
13027 const horizontalIntersection2 = (pt2, v2, y2) => {
13031 x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
13035 const verticalIntersection2 = (pt2, v2, x2) => {
13040 y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
13043 const intersection$1 = (pt1, v1, pt2, v2) => {
13045 return verticalIntersection2(pt2, v2, pt1.x);
13047 return verticalIntersection2(pt1, v1, pt2.x);
13049 return horizontalIntersection2(pt2, v2, pt1.y);
13051 return horizontalIntersection2(pt1, v1, pt2.y);
13052 const kross = crossProduct2(v1, v2);
13059 const d1 = crossProduct2(ve2, v1) / kross;
13060 const d2 = crossProduct2(ve2, v2) / kross;
13061 const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
13062 const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
13063 const x3 = (x12 + x2) / 2;
13064 const y3 = (y12 + y2) / 2;
13070 class SweepEvent2 {
13071 // for ordering sweep events in the sweep event queue
13072 static compare(a2, b2) {
13073 const ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
13076 if (a2.point !== b2.point)
13078 if (a2.isLeft !== b2.isLeft)
13079 return a2.isLeft ? 1 : -1;
13080 return Segment2.compare(a2.segment, b2.segment);
13082 // for ordering points in sweep line order
13083 static comparePoints(aPt, bPt) {
13094 // Warning: 'point' input will be modified and re-used (for performance)
13095 constructor(point2, isLeft) {
13096 if (point2.events === void 0)
13097 point2.events = [this];
13099 point2.events.push(this);
13100 this.point = point2;
13101 this.isLeft = isLeft;
13104 if (other.point === this.point) {
13105 throw new Error("Tried to link already linked events");
13107 const otherEvents = other.point.events;
13108 for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
13109 const evt = otherEvents[i3];
13110 this.point.events.push(evt);
13111 evt.point = this.point;
13113 this.checkForConsuming();
13115 /* Do a pass over our linked events and check to see if any pair
13116 * of segments match, and should be consumed. */
13117 checkForConsuming() {
13118 const numEvents = this.point.events.length;
13119 for (let i3 = 0; i3 < numEvents; i3++) {
13120 const evt1 = this.point.events[i3];
13121 if (evt1.segment.consumedBy !== void 0)
13123 for (let j2 = i3 + 1; j2 < numEvents; j2++) {
13124 const evt2 = this.point.events[j2];
13125 if (evt2.consumedBy !== void 0)
13127 if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
13129 evt1.segment.consume(evt2.segment);
13133 getAvailableLinkedEvents() {
13135 for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
13136 const evt = this.point.events[i3];
13137 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
13144 * Returns a comparator function for sorting linked events that will
13145 * favor the event that will give us the smallest left-side angle.
13146 * All ring construction starts as low as possible heading to the right,
13147 * so by always turning left as sharp as possible we'll get polygons
13148 * without uncessary loops & holes.
13150 * The comparator function has a compute cache such that it avoids
13151 * re-computing already-computed values.
13153 getLeftmostComparator(baseEvent) {
13154 const cache = /* @__PURE__ */ new Map();
13155 const fillCache = (linkedEvent) => {
13156 const nextEvent = linkedEvent.otherSE;
13157 cache.set(linkedEvent, {
13158 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
13159 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
13162 return (a2, b2) => {
13163 if (!cache.has(a2))
13165 if (!cache.has(b2))
13175 if (asine >= 0 && bsine >= 0) {
13176 if (acosine < bcosine)
13178 if (acosine > bcosine)
13182 if (asine < 0 && bsine < 0) {
13183 if (acosine < bcosine)
13185 if (acosine > bcosine)
13197 let segmentId2 = 0;
13199 /* This compare() function is for ordering segments in the sweep
13200 * line tree, and does so according to the following criteria:
13202 * Consider the vertical line that lies an infinestimal step to the
13203 * right of the right-more of the two left endpoints of the input
13204 * segments. Imagine slowly moving a point up from negative infinity
13205 * in the increasing y direction. Which of the two segments will that
13206 * point intersect first? That segment comes 'before' the other one.
13208 * If neither segment would be intersected by such a line, (if one
13209 * or more of the segments are vertical) then the line to be considered
13210 * is directly on the right-more of the two left inputs.
13212 static compare(a2, b2) {
13213 const alx = a2.leftSE.point.x;
13214 const blx = b2.leftSE.point.x;
13215 const arx = a2.rightSE.point.x;
13216 const brx = b2.rightSE.point.x;
13221 const aly = a2.leftSE.point.y;
13222 const bly = b2.leftSE.point.y;
13223 const ary = a2.rightSE.point.y;
13224 const bry = b2.rightSE.point.y;
13226 if (bly < aly && bly < ary)
13228 if (bly > aly && bly > ary)
13230 const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
13235 const bCmpARight = b2.comparePoint(a2.rightSE.point);
13236 if (bCmpARight !== 0)
13241 if (aly < bly && aly < bry)
13243 if (aly > bly && aly > bry)
13245 const bCmpALeft = b2.comparePoint(a2.leftSE.point);
13246 if (bCmpALeft !== 0)
13248 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
13249 if (aCmpBRight < 0)
13251 if (aCmpBRight > 0)
13260 const bCmpARight = b2.comparePoint(a2.rightSE.point);
13261 if (bCmpARight !== 0)
13265 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
13266 if (aCmpBRight < 0)
13268 if (aCmpBRight > 0)
13272 const ay = ary - aly;
13273 const ax = arx - alx;
13274 const by = bry - bly;
13275 const bx = brx - blx;
13276 if (ay > ax && by < bx)
13278 if (ay < ax && by > bx)
13295 /* Warning: a reference to ringWindings input will be stored,
13296 * and possibly will be later modified */
13297 constructor(leftSE, rightSE, rings, windings) {
13298 this.id = ++segmentId2;
13299 this.leftSE = leftSE;
13300 leftSE.segment = this;
13301 leftSE.otherSE = rightSE;
13302 this.rightSE = rightSE;
13303 rightSE.segment = this;
13304 rightSE.otherSE = leftSE;
13305 this.rings = rings;
13306 this.windings = windings;
13308 static fromRing(pt1, pt2, ring) {
13309 let leftPt, rightPt, winding;
13310 const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
13315 } else if (cmpPts > 0) {
13320 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
13321 const leftSE = new SweepEvent2(leftPt, true);
13322 const rightSE = new SweepEvent2(rightPt, false);
13323 return new Segment2(leftSE, rightSE, [ring], [winding]);
13325 /* When a segment is split, the rightSE is replaced with a new sweep event */
13326 replaceRightSE(newRightSE) {
13327 this.rightSE = newRightSE;
13328 this.rightSE.segment = this;
13329 this.rightSE.otherSE = this.leftSE;
13330 this.leftSE.otherSE = this.rightSE;
13333 const y12 = this.leftSE.point.y;
13334 const y2 = this.rightSE.point.y;
13337 x: this.leftSE.point.x,
13338 y: y12 < y2 ? y12 : y2
13341 x: this.rightSE.point.x,
13342 y: y12 > y2 ? y12 : y2
13346 /* A vector from the left point to the right */
13349 x: this.rightSE.point.x - this.leftSE.point.x,
13350 y: this.rightSE.point.y - this.leftSE.point.y
13353 isAnEndpoint(pt2) {
13354 return pt2.x === this.leftSE.point.x && pt2.y === this.leftSE.point.y || pt2.x === this.rightSE.point.x && pt2.y === this.rightSE.point.y;
13356 /* Compare this segment with a point.
13358 * A point P is considered to be colinear to a segment if there
13359 * exists a distance D such that if we travel along the segment
13360 * from one * endpoint towards the other a distance D, we find
13361 * ourselves at point P.
13363 * Return value indicates:
13365 * 1: point lies above the segment (to the left of vertical)
13366 * 0: point is colinear to segment
13367 * -1: point lies below the segment (to the right of vertical)
13369 comparePoint(point2) {
13370 if (this.isAnEndpoint(point2))
13372 const lPt = this.leftSE.point;
13373 const rPt = this.rightSE.point;
13374 const v2 = this.vector();
13375 if (lPt.x === rPt.x) {
13376 if (point2.x === lPt.x)
13378 return point2.x < lPt.x ? 1 : -1;
13380 const yDist = (point2.y - lPt.y) / v2.y;
13381 const xFromYDist = lPt.x + yDist * v2.x;
13382 if (point2.x === xFromYDist)
13384 const xDist = (point2.x - lPt.x) / v2.x;
13385 const yFromXDist = lPt.y + xDist * v2.y;
13386 if (point2.y === yFromXDist)
13388 return point2.y < yFromXDist ? -1 : 1;
13391 * Given another segment, returns the first non-trivial intersection
13392 * between the two segments (in terms of sweep line ordering), if it exists.
13394 * A 'non-trivial' intersection is one that will cause one or both of the
13395 * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
13397 * * endpoint of segA with endpoint of segB --> trivial
13398 * * endpoint of segA with point along segB --> non-trivial
13399 * * endpoint of segB with point along segA --> non-trivial
13400 * * point along segA with point along segB --> non-trivial
13402 * If no non-trivial intersection exists, return null
13403 * Else, return null.
13405 getIntersection(other) {
13406 const tBbox = this.bbox();
13407 const oBbox = other.bbox();
13408 const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
13409 if (bboxOverlap === null)
13411 const tlp = this.leftSE.point;
13412 const trp = this.rightSE.point;
13413 const olp = other.leftSE.point;
13414 const orp = other.rightSE.point;
13415 const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
13416 const touchesThisLSE = isInBbox2(oBbox, tlp) && other.comparePoint(tlp) === 0;
13417 const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
13418 const touchesThisRSE = isInBbox2(oBbox, trp) && other.comparePoint(trp) === 0;
13419 if (touchesThisLSE && touchesOtherLSE) {
13420 if (touchesThisRSE && !touchesOtherRSE)
13422 if (!touchesThisRSE && touchesOtherRSE)
13426 if (touchesThisLSE) {
13427 if (touchesOtherRSE) {
13428 if (tlp.x === orp.x && tlp.y === orp.y)
13433 if (touchesOtherLSE) {
13434 if (touchesThisRSE) {
13435 if (trp.x === olp.x && trp.y === olp.y)
13440 if (touchesThisRSE && touchesOtherRSE)
13442 if (touchesThisRSE)
13444 if (touchesOtherRSE)
13446 const pt2 = intersection$1(tlp, this.vector(), olp, other.vector());
13449 if (!isInBbox2(bboxOverlap, pt2))
13451 return rounder.round(pt2.x, pt2.y);
13454 * Split the given segment into multiple segments on the given points.
13455 * * Each existing segment will retain its leftSE and a new rightSE will be
13456 * generated for it.
13457 * * A new segment will be generated which will adopt the original segment's
13458 * rightSE, and a new leftSE will be generated for it.
13459 * * If there are more than two points given to split on, new segments
13460 * in the middle will be generated with new leftSE and rightSE's.
13461 * * An array of the newly generated SweepEvents will be returned.
13463 * Warning: input array of points is modified
13466 const newEvents = [];
13467 const alreadyLinked = point2.events !== void 0;
13468 const newLeftSE = new SweepEvent2(point2, true);
13469 const newRightSE = new SweepEvent2(point2, false);
13470 const oldRightSE = this.rightSE;
13471 this.replaceRightSE(newRightSE);
13472 newEvents.push(newRightSE);
13473 newEvents.push(newLeftSE);
13474 const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
13475 if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
13476 newSeg.swapEvents();
13478 if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
13481 if (alreadyLinked) {
13482 newLeftSE.checkForConsuming();
13483 newRightSE.checkForConsuming();
13487 /* Swap which event is left and right */
13489 const tmpEvt = this.rightSE;
13490 this.rightSE = this.leftSE;
13491 this.leftSE = tmpEvt;
13492 this.leftSE.isLeft = true;
13493 this.rightSE.isLeft = false;
13494 for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
13495 this.windings[i3] *= -1;
13498 /* Consume another segment. We take their rings under our wing
13499 * and mark them as consumed. Use for perfectly overlapping segments */
13501 let consumer = this;
13502 let consumee = other;
13503 while (consumer.consumedBy)
13504 consumer = consumer.consumedBy;
13505 while (consumee.consumedBy)
13506 consumee = consumee.consumedBy;
13507 const cmp2 = Segment2.compare(consumer, consumee);
13511 const tmp = consumer;
13512 consumer = consumee;
13515 if (consumer.prev === consumee) {
13516 const tmp = consumer;
13517 consumer = consumee;
13520 for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
13521 const ring = consumee.rings[i3];
13522 const winding = consumee.windings[i3];
13523 const index2 = consumer.rings.indexOf(ring);
13524 if (index2 === -1) {
13525 consumer.rings.push(ring);
13526 consumer.windings.push(winding);
13528 consumer.windings[index2] += winding;
13530 consumee.rings = null;
13531 consumee.windings = null;
13532 consumee.consumedBy = consumer;
13533 consumee.leftSE.consumedBy = consumer.leftSE;
13534 consumee.rightSE.consumedBy = consumer.rightSE;
13536 /* The first segment previous segment chain that is in the result */
13538 if (this._prevInResult !== void 0)
13539 return this._prevInResult;
13541 this._prevInResult = null;
13542 else if (this.prev.isInResult())
13543 this._prevInResult = this.prev;
13545 this._prevInResult = this.prev.prevInResult();
13546 return this._prevInResult;
13549 if (this._beforeState !== void 0)
13550 return this._beforeState;
13552 this._beforeState = {
13558 const seg = this.prev.consumedBy || this.prev;
13559 this._beforeState = seg.afterState();
13561 return this._beforeState;
13564 if (this._afterState !== void 0)
13565 return this._afterState;
13566 const beforeState = this.beforeState();
13567 this._afterState = {
13568 rings: beforeState.rings.slice(0),
13569 windings: beforeState.windings.slice(0),
13572 const ringsAfter = this._afterState.rings;
13573 const windingsAfter = this._afterState.windings;
13574 const mpsAfter = this._afterState.multiPolys;
13575 for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
13576 const ring = this.rings[i3];
13577 const winding = this.windings[i3];
13578 const index2 = ringsAfter.indexOf(ring);
13579 if (index2 === -1) {
13580 ringsAfter.push(ring);
13581 windingsAfter.push(winding);
13583 windingsAfter[index2] += winding;
13585 const polysAfter = [];
13586 const polysExclude = [];
13587 for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
13588 if (windingsAfter[i3] === 0)
13590 const ring = ringsAfter[i3];
13591 const poly = ring.poly;
13592 if (polysExclude.indexOf(poly) !== -1)
13594 if (ring.isExterior)
13595 polysAfter.push(poly);
13597 if (polysExclude.indexOf(poly) === -1)
13598 polysExclude.push(poly);
13599 const index2 = polysAfter.indexOf(ring.poly);
13601 polysAfter.splice(index2, 1);
13604 for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
13605 const mp = polysAfter[i3].multiPoly;
13606 if (mpsAfter.indexOf(mp) === -1)
13609 return this._afterState;
13611 /* Is this segment part of the final result? */
13613 if (this.consumedBy)
13615 if (this._isInResult !== void 0)
13616 return this._isInResult;
13617 const mpsBefore = this.beforeState().multiPolys;
13618 const mpsAfter = this.afterState().multiPolys;
13619 switch (operation2.type) {
13621 const noBefores = mpsBefore.length === 0;
13622 const noAfters = mpsAfter.length === 0;
13623 this._isInResult = noBefores !== noAfters;
13626 case "intersection": {
13629 if (mpsBefore.length < mpsAfter.length) {
13630 least = mpsBefore.length;
13631 most = mpsAfter.length;
13633 least = mpsAfter.length;
13634 most = mpsBefore.length;
13636 this._isInResult = most === operation2.numMultiPolys && least < most;
13640 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
13641 this._isInResult = diff % 2 === 1;
13644 case "difference": {
13645 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
13646 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
13650 throw new Error("Unrecognized operation type found ".concat(operation2.type));
13652 return this._isInResult;
13656 constructor(geomRing, poly, isExterior) {
13657 if (!Array.isArray(geomRing) || geomRing.length === 0) {
13658 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
13661 this.isExterior = isExterior;
13662 this.segments = [];
13663 if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
13664 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
13666 const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
13677 let prevPoint = firstPoint;
13678 for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
13679 if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
13680 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
13682 let point2 = rounder.round(geomRing[i3][0], geomRing[i3][1]);
13683 if (point2.x === prevPoint.x && point2.y === prevPoint.y)
13685 this.segments.push(Segment2.fromRing(prevPoint, point2, this));
13686 if (point2.x < this.bbox.ll.x)
13687 this.bbox.ll.x = point2.x;
13688 if (point2.y < this.bbox.ll.y)
13689 this.bbox.ll.y = point2.y;
13690 if (point2.x > this.bbox.ur.x)
13691 this.bbox.ur.x = point2.x;
13692 if (point2.y > this.bbox.ur.y)
13693 this.bbox.ur.y = point2.y;
13694 prevPoint = point2;
13696 if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
13697 this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
13701 const sweepEvents = [];
13702 for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
13703 const segment = this.segments[i3];
13704 sweepEvents.push(segment.leftSE);
13705 sweepEvents.push(segment.rightSE);
13707 return sweepEvents;
13711 constructor(geomPoly, multiPoly) {
13712 if (!Array.isArray(geomPoly)) {
13713 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
13715 this.exteriorRing = new RingIn2(geomPoly[0], this, true);
13718 x: this.exteriorRing.bbox.ll.x,
13719 y: this.exteriorRing.bbox.ll.y
13722 x: this.exteriorRing.bbox.ur.x,
13723 y: this.exteriorRing.bbox.ur.y
13726 this.interiorRings = [];
13727 for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
13728 const ring = new RingIn2(geomPoly[i3], this, false);
13729 if (ring.bbox.ll.x < this.bbox.ll.x)
13730 this.bbox.ll.x = ring.bbox.ll.x;
13731 if (ring.bbox.ll.y < this.bbox.ll.y)
13732 this.bbox.ll.y = ring.bbox.ll.y;
13733 if (ring.bbox.ur.x > this.bbox.ur.x)
13734 this.bbox.ur.x = ring.bbox.ur.x;
13735 if (ring.bbox.ur.y > this.bbox.ur.y)
13736 this.bbox.ur.y = ring.bbox.ur.y;
13737 this.interiorRings.push(ring);
13739 this.multiPoly = multiPoly;
13742 const sweepEvents = this.exteriorRing.getSweepEvents();
13743 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
13744 const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
13745 for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
13746 sweepEvents.push(ringSweepEvents[j2]);
13749 return sweepEvents;
13752 class MultiPolyIn2 {
13753 constructor(geom, isSubject) {
13754 if (!Array.isArray(geom)) {
13755 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
13758 if (typeof geom[0][0][0] === "number")
13765 x: Number.POSITIVE_INFINITY,
13766 y: Number.POSITIVE_INFINITY
13769 x: Number.NEGATIVE_INFINITY,
13770 y: Number.NEGATIVE_INFINITY
13773 for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
13774 const poly = new PolyIn2(geom[i3], this);
13775 if (poly.bbox.ll.x < this.bbox.ll.x)
13776 this.bbox.ll.x = poly.bbox.ll.x;
13777 if (poly.bbox.ll.y < this.bbox.ll.y)
13778 this.bbox.ll.y = poly.bbox.ll.y;
13779 if (poly.bbox.ur.x > this.bbox.ur.x)
13780 this.bbox.ur.x = poly.bbox.ur.x;
13781 if (poly.bbox.ur.y > this.bbox.ur.y)
13782 this.bbox.ur.y = poly.bbox.ur.y;
13783 this.polys.push(poly);
13785 this.isSubject = isSubject;
13788 const sweepEvents = [];
13789 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
13790 const polySweepEvents = this.polys[i3].getSweepEvents();
13791 for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
13792 sweepEvents.push(polySweepEvents[j2]);
13795 return sweepEvents;
13799 /* Given the segments from the sweep line pass, compute & return a series
13800 * of closed rings from all the segments marked to be part of the result */
13801 static factory(allSegments) {
13802 const ringsOut = [];
13803 for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
13804 const segment = allSegments[i3];
13805 if (!segment.isInResult() || segment.ringOut)
13807 let prevEvent = null;
13808 let event = segment.leftSE;
13809 let nextEvent = segment.rightSE;
13810 const events = [event];
13811 const startingPoint = event.point;
13812 const intersectionLEs = [];
13816 events.push(event);
13817 if (event.point === startingPoint)
13820 const availableLEs = event.getAvailableLinkedEvents();
13821 if (availableLEs.length === 0) {
13822 const firstPt = events[0].point;
13823 const lastPt = events[events.length - 1].point;
13824 throw new Error("Unable to complete output ring starting at [".concat(firstPt.x, ",") + " ".concat(firstPt.y, "]. Last matching segment found ends at") + " [".concat(lastPt.x, ", ").concat(lastPt.y, "]."));
13826 if (availableLEs.length === 1) {
13827 nextEvent = availableLEs[0].otherSE;
13830 let indexLE = null;
13831 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
13832 if (intersectionLEs[j2].point === event.point) {
13837 if (indexLE !== null) {
13838 const intersectionLE = intersectionLEs.splice(indexLE)[0];
13839 const ringEvents = events.splice(intersectionLE.index);
13840 ringEvents.unshift(ringEvents[0].otherSE);
13841 ringsOut.push(new RingOut2(ringEvents.reverse()));
13844 intersectionLEs.push({
13845 index: events.length,
13848 const comparator = event.getLeftmostComparator(prevEvent);
13849 nextEvent = availableLEs.sort(comparator)[0].otherSE;
13853 ringsOut.push(new RingOut2(events));
13857 constructor(events) {
13858 this.events = events;
13859 for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
13860 events[i3].segment.ringOut = this;
13865 let prevPt = this.events[0].point;
13866 const points = [prevPt];
13867 for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
13868 const pt3 = this.events[i3].point;
13869 const nextPt2 = this.events[i3 + 1].point;
13870 if (compareVectorAngles(pt3, prevPt, nextPt2) === 0)
13875 if (points.length === 1)
13877 const pt2 = points[0];
13878 const nextPt = points[1];
13879 if (compareVectorAngles(pt2, prevPt, nextPt) === 0)
13881 points.push(points[0]);
13882 const step = this.isExteriorRing() ? 1 : -1;
13883 const iStart = this.isExteriorRing() ? 0 : points.length - 1;
13884 const iEnd = this.isExteriorRing() ? points.length : -1;
13885 const orderedPoints = [];
13886 for (let i3 = iStart; i3 != iEnd; i3 += step)
13887 orderedPoints.push([points[i3].x, points[i3].y]);
13888 return orderedPoints;
13891 if (this._isExteriorRing === void 0) {
13892 const enclosing = this.enclosingRing();
13893 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
13895 return this._isExteriorRing;
13898 if (this._enclosingRing === void 0) {
13899 this._enclosingRing = this._calcEnclosingRing();
13901 return this._enclosingRing;
13903 /* Returns the ring that encloses this one, if any */
13904 _calcEnclosingRing() {
13905 let leftMostEvt = this.events[0];
13906 for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
13907 const evt = this.events[i3];
13908 if (SweepEvent2.compare(leftMostEvt, evt) > 0)
13911 let prevSeg = leftMostEvt.segment.prevInResult();
13912 let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
13917 return prevSeg.ringOut;
13918 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
13919 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
13920 return prevSeg.ringOut;
13922 return prevSeg.ringOut.enclosingRing();
13924 prevSeg = prevPrevSeg.prevInResult();
13925 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
13930 constructor(exteriorRing) {
13931 this.exteriorRing = exteriorRing;
13932 exteriorRing.poly = this;
13933 this.interiorRings = [];
13935 addInterior(ring) {
13936 this.interiorRings.push(ring);
13940 const geom = [this.exteriorRing.getGeom()];
13941 if (geom[0] === null)
13943 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
13944 const ringGeom = this.interiorRings[i3].getGeom();
13945 if (ringGeom === null)
13947 geom.push(ringGeom);
13952 class MultiPolyOut2 {
13953 constructor(rings) {
13954 this.rings = rings;
13955 this.polys = this._composePolys(rings);
13959 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
13960 const polyGeom = this.polys[i3].getGeom();
13961 if (polyGeom === null)
13963 geom.push(polyGeom);
13967 _composePolys(rings) {
13969 for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
13970 const ring = rings[i3];
13973 if (ring.isExteriorRing())
13974 polys.push(new PolyOut2(ring));
13976 const enclosingRing = ring.enclosingRing();
13977 if (!enclosingRing.poly)
13978 polys.push(new PolyOut2(enclosingRing));
13979 enclosingRing.poly.addInterior(ring);
13986 constructor(queue) {
13987 let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
13988 this.queue = queue;
13989 this.tree = new Tree(comparator);
13990 this.segments = [];
13993 const segment = event.segment;
13994 const newEvents = [];
13995 if (event.consumedBy) {
13997 this.queue.remove(event.otherSE);
13999 this.tree.remove(segment);
14002 const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
14004 throw new Error("Unable to find segment #".concat(segment.id, " ") + "[".concat(segment.leftSE.point.x, ", ").concat(segment.leftSE.point.y, "] -> ") + "[".concat(segment.rightSE.point.x, ", ").concat(segment.rightSE.point.y, "] ") + "in SweepLine tree.");
14005 let prevNode = node;
14006 let nextNode = node;
14007 let prevSeg = void 0;
14008 let nextSeg = void 0;
14009 while (prevSeg === void 0) {
14010 prevNode = this.tree.prev(prevNode);
14011 if (prevNode === null)
14013 else if (prevNode.key.consumedBy === void 0)
14014 prevSeg = prevNode.key;
14016 while (nextSeg === void 0) {
14017 nextNode = this.tree.next(nextNode);
14018 if (nextNode === null)
14020 else if (nextNode.key.consumedBy === void 0)
14021 nextSeg = nextNode.key;
14023 if (event.isLeft) {
14024 let prevMySplitter = null;
14026 const prevInter = prevSeg.getIntersection(segment);
14027 if (prevInter !== null) {
14028 if (!segment.isAnEndpoint(prevInter))
14029 prevMySplitter = prevInter;
14030 if (!prevSeg.isAnEndpoint(prevInter)) {
14031 const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
14032 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
14033 newEvents.push(newEventsFromSplit[i3]);
14038 let nextMySplitter = null;
14040 const nextInter = nextSeg.getIntersection(segment);
14041 if (nextInter !== null) {
14042 if (!segment.isAnEndpoint(nextInter))
14043 nextMySplitter = nextInter;
14044 if (!nextSeg.isAnEndpoint(nextInter)) {
14045 const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
14046 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
14047 newEvents.push(newEventsFromSplit[i3]);
14052 if (prevMySplitter !== null || nextMySplitter !== null) {
14053 let mySplitter = null;
14054 if (prevMySplitter === null)
14055 mySplitter = nextMySplitter;
14056 else if (nextMySplitter === null)
14057 mySplitter = prevMySplitter;
14059 const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
14060 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
14062 this.queue.remove(segment.rightSE);
14063 newEvents.push(segment.rightSE);
14064 const newEventsFromSplit = segment.split(mySplitter);
14065 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
14066 newEvents.push(newEventsFromSplit[i3]);
14069 if (newEvents.length > 0) {
14070 this.tree.remove(segment);
14071 newEvents.push(event);
14073 this.segments.push(segment);
14074 segment.prev = prevSeg;
14077 if (prevSeg && nextSeg) {
14078 const inter = prevSeg.getIntersection(nextSeg);
14079 if (inter !== null) {
14080 if (!prevSeg.isAnEndpoint(inter)) {
14081 const newEventsFromSplit = this._splitSafely(prevSeg, inter);
14082 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
14083 newEvents.push(newEventsFromSplit[i3]);
14086 if (!nextSeg.isAnEndpoint(inter)) {
14087 const newEventsFromSplit = this._splitSafely(nextSeg, inter);
14088 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
14089 newEvents.push(newEventsFromSplit[i3]);
14094 this.tree.remove(segment);
14098 /* Safely split a segment that is currently in the datastructures
14099 * IE - a segment other than the one that is currently being processed. */
14100 _splitSafely(seg, pt2) {
14101 this.tree.remove(seg);
14102 const rightSE = seg.rightSE;
14103 this.queue.remove(rightSE);
14104 const newEvents = seg.split(pt2);
14105 newEvents.push(rightSE);
14106 if (seg.consumedBy === void 0)
14107 this.tree.add(seg);
14111 const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
14112 const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
14114 run(type2, geom, moreGeoms) {
14115 operation2.type = type2;
14117 const multipolys = [new MultiPolyIn2(geom, true)];
14118 for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
14119 multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
14121 operation2.numMultiPolys = multipolys.length;
14122 if (operation2.type === "difference") {
14123 const subject = multipolys[0];
14125 while (i3 < multipolys.length) {
14126 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null)
14129 multipolys.splice(i3, 1);
14132 if (operation2.type === "intersection") {
14133 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
14134 const mpA = multipolys[i3];
14135 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
14136 if (getBboxOverlap2(mpA.bbox, multipolys[j2].bbox) === null)
14141 const queue = new Tree(SweepEvent2.compare);
14142 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
14143 const sweepEvents = multipolys[i3].getSweepEvents();
14144 for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
14145 queue.insert(sweepEvents[j2]);
14146 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
14147 throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
14151 const sweepLine = new SweepLine2(queue);
14152 let prevQueueSize = queue.size;
14153 let node = queue.pop();
14155 const evt = node.key;
14156 if (queue.size === prevQueueSize) {
14157 const seg = evt.segment;
14158 throw new Error("Unable to pop() ".concat(evt.isLeft ? "left" : "right", " SweepEvent ") + "[".concat(evt.point.x, ", ").concat(evt.point.y, "] from segment #").concat(seg.id, " ") + "[".concat(seg.leftSE.point.x, ", ").concat(seg.leftSE.point.y, "] -> ") + "[".concat(seg.rightSE.point.x, ", ").concat(seg.rightSE.point.y, "] from queue."));
14160 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
14161 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
14163 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
14164 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
14166 const newEvents = sweepLine.process(evt);
14167 for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
14168 const evt2 = newEvents[i3];
14169 if (evt2.consumedBy === void 0)
14170 queue.insert(evt2);
14172 prevQueueSize = queue.size;
14173 node = queue.pop();
14176 const ringsOut = RingOut2.factory(sweepLine.segments);
14177 const result = new MultiPolyOut2(ringsOut);
14178 return result.getGeom();
14181 const operation2 = new Operation2();
14182 const union2 = function(geom) {
14183 for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14184 moreGeoms[_key - 1] = arguments[_key];
14186 return operation2.run("union", geom, moreGeoms);
14188 const intersection2 = function(geom) {
14189 for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
14190 moreGeoms[_key2 - 1] = arguments[_key2];
14192 return operation2.run("intersection", geom, moreGeoms);
14194 const xor = function(geom) {
14195 for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
14196 moreGeoms[_key3 - 1] = arguments[_key3];
14198 return operation2.run("xor", geom, moreGeoms);
14200 const difference2 = function(subjectGeom) {
14201 for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
14202 clippingGeoms[_key4 - 1] = arguments[_key4];
14204 return operation2.run("difference", subjectGeom, clippingGeoms);
14208 intersection: intersection2,
14210 difference: difference2
14217 // node_modules/whatwg-fetch/fetch.js
14218 var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
14219 typeof global !== "undefined" && global || {};
14221 searchParams: "URLSearchParams" in g,
14222 iterable: "Symbol" in g && "iterator" in Symbol,
14223 blob: "FileReader" in g && "Blob" in g && function() {
14231 formData: "FormData" in g,
14232 arrayBuffer: "ArrayBuffer" in g
14234 function isDataView(obj) {
14235 return obj && DataView.prototype.isPrototypeOf(obj);
14237 if (support.arrayBuffer) {
14239 "[object Int8Array]",
14240 "[object Uint8Array]",
14241 "[object Uint8ClampedArray]",
14242 "[object Int16Array]",
14243 "[object Uint16Array]",
14244 "[object Int32Array]",
14245 "[object Uint32Array]",
14246 "[object Float32Array]",
14247 "[object Float64Array]"
14249 isArrayBufferView = ArrayBuffer.isView || function(obj) {
14250 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
14254 var isArrayBufferView;
14255 function normalizeName(name) {
14256 if (typeof name !== "string") {
14257 name = String(name);
14259 if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
14260 throw new TypeError('Invalid character in header field name: "' + name + '"');
14262 return name.toLowerCase();
14264 function normalizeValue(value) {
14265 if (typeof value !== "string") {
14266 value = String(value);
14270 function iteratorFor(items) {
14273 var value = items.shift();
14274 return { done: value === void 0, value };
14277 if (support.iterable) {
14278 iterator[Symbol.iterator] = function() {
14284 function Headers(headers) {
14286 if (headers instanceof Headers) {
14287 headers.forEach(function(value, name) {
14288 this.append(name, value);
14290 } else if (Array.isArray(headers)) {
14291 headers.forEach(function(header) {
14292 if (header.length != 2) {
14293 throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
14295 this.append(header[0], header[1]);
14297 } else if (headers) {
14298 Object.getOwnPropertyNames(headers).forEach(function(name) {
14299 this.append(name, headers[name]);
14303 Headers.prototype.append = function(name, value) {
14304 name = normalizeName(name);
14305 value = normalizeValue(value);
14306 var oldValue = this.map[name];
14307 this.map[name] = oldValue ? oldValue + ", " + value : value;
14309 Headers.prototype["delete"] = function(name) {
14310 delete this.map[normalizeName(name)];
14312 Headers.prototype.get = function(name) {
14313 name = normalizeName(name);
14314 return this.has(name) ? this.map[name] : null;
14316 Headers.prototype.has = function(name) {
14317 return this.map.hasOwnProperty(normalizeName(name));
14319 Headers.prototype.set = function(name, value) {
14320 this.map[normalizeName(name)] = normalizeValue(value);
14322 Headers.prototype.forEach = function(callback, thisArg) {
14323 for (var name in this.map) {
14324 if (this.map.hasOwnProperty(name)) {
14325 callback.call(thisArg, this.map[name], name, this);
14329 Headers.prototype.keys = function() {
14331 this.forEach(function(value, name) {
14334 return iteratorFor(items);
14336 Headers.prototype.values = function() {
14338 this.forEach(function(value) {
14341 return iteratorFor(items);
14343 Headers.prototype.entries = function() {
14345 this.forEach(function(value, name) {
14346 items.push([name, value]);
14348 return iteratorFor(items);
14350 if (support.iterable) {
14351 Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
14353 function consumed(body) {
14356 if (body.bodyUsed) {
14357 return Promise.reject(new TypeError("Already read"));
14359 body.bodyUsed = true;
14361 function fileReaderReady(reader) {
14362 return new Promise(function(resolve, reject) {
14363 reader.onload = function() {
14364 resolve(reader.result);
14366 reader.onerror = function() {
14367 reject(reader.error);
14371 function readBlobAsArrayBuffer(blob) {
14372 var reader = new FileReader();
14373 var promise = fileReaderReady(reader);
14374 reader.readAsArrayBuffer(blob);
14377 function readBlobAsText(blob) {
14378 var reader = new FileReader();
14379 var promise = fileReaderReady(reader);
14380 var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
14381 var encoding = match ? match[1] : "utf-8";
14382 reader.readAsText(blob, encoding);
14385 function readArrayBufferAsText(buf) {
14386 var view = new Uint8Array(buf);
14387 var chars = new Array(view.length);
14388 for (var i3 = 0; i3 < view.length; i3++) {
14389 chars[i3] = String.fromCharCode(view[i3]);
14391 return chars.join("");
14393 function bufferClone(buf) {
14395 return buf.slice(0);
14397 var view = new Uint8Array(buf.byteLength);
14398 view.set(new Uint8Array(buf));
14399 return view.buffer;
14403 this.bodyUsed = false;
14404 this._initBody = function(body) {
14405 this.bodyUsed = this.bodyUsed;
14406 this._bodyInit = body;
14408 this._noBody = true;
14409 this._bodyText = "";
14410 } else if (typeof body === "string") {
14411 this._bodyText = body;
14412 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
14413 this._bodyBlob = body;
14414 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
14415 this._bodyFormData = body;
14416 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14417 this._bodyText = body.toString();
14418 } else if (support.arrayBuffer && support.blob && isDataView(body)) {
14419 this._bodyArrayBuffer = bufferClone(body.buffer);
14420 this._bodyInit = new Blob([this._bodyArrayBuffer]);
14421 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
14422 this._bodyArrayBuffer = bufferClone(body);
14424 this._bodyText = body = Object.prototype.toString.call(body);
14426 if (!this.headers.get("content-type")) {
14427 if (typeof body === "string") {
14428 this.headers.set("content-type", "text/plain;charset=UTF-8");
14429 } else if (this._bodyBlob && this._bodyBlob.type) {
14430 this.headers.set("content-type", this._bodyBlob.type);
14431 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
14432 this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
14436 if (support.blob) {
14437 this.blob = function() {
14438 var rejected = consumed(this);
14442 if (this._bodyBlob) {
14443 return Promise.resolve(this._bodyBlob);
14444 } else if (this._bodyArrayBuffer) {
14445 return Promise.resolve(new Blob([this._bodyArrayBuffer]));
14446 } else if (this._bodyFormData) {
14447 throw new Error("could not read FormData body as blob");
14449 return Promise.resolve(new Blob([this._bodyText]));
14453 this.arrayBuffer = function() {
14454 if (this._bodyArrayBuffer) {
14455 var isConsumed = consumed(this);
14458 } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
14459 return Promise.resolve(
14460 this._bodyArrayBuffer.buffer.slice(
14461 this._bodyArrayBuffer.byteOffset,
14462 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
14466 return Promise.resolve(this._bodyArrayBuffer);
14468 } else if (support.blob) {
14469 return this.blob().then(readBlobAsArrayBuffer);
14471 throw new Error("could not read as ArrayBuffer");
14474 this.text = function() {
14475 var rejected = consumed(this);
14479 if (this._bodyBlob) {
14480 return readBlobAsText(this._bodyBlob);
14481 } else if (this._bodyArrayBuffer) {
14482 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
14483 } else if (this._bodyFormData) {
14484 throw new Error("could not read FormData body as text");
14486 return Promise.resolve(this._bodyText);
14489 if (support.formData) {
14490 this.formData = function() {
14491 return this.text().then(decode);
14494 this.json = function() {
14495 return this.text().then(JSON.parse);
14499 var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
14500 function normalizeMethod(method) {
14501 var upcased = method.toUpperCase();
14502 return methods.indexOf(upcased) > -1 ? upcased : method;
14504 function Request(input, options2) {
14505 if (!(this instanceof Request)) {
14506 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14508 options2 = options2 || {};
14509 var body = options2.body;
14510 if (input instanceof Request) {
14511 if (input.bodyUsed) {
14512 throw new TypeError("Already read");
14514 this.url = input.url;
14515 this.credentials = input.credentials;
14516 if (!options2.headers) {
14517 this.headers = new Headers(input.headers);
14519 this.method = input.method;
14520 this.mode = input.mode;
14521 this.signal = input.signal;
14522 if (!body && input._bodyInit != null) {
14523 body = input._bodyInit;
14524 input.bodyUsed = true;
14527 this.url = String(input);
14529 this.credentials = options2.credentials || this.credentials || "same-origin";
14530 if (options2.headers || !this.headers) {
14531 this.headers = new Headers(options2.headers);
14533 this.method = normalizeMethod(options2.method || this.method || "GET");
14534 this.mode = options2.mode || this.mode || null;
14535 this.signal = options2.signal || this.signal || function() {
14536 if ("AbortController" in g) {
14537 var ctrl = new AbortController();
14538 return ctrl.signal;
14541 this.referrer = null;
14542 if ((this.method === "GET" || this.method === "HEAD") && body) {
14543 throw new TypeError("Body not allowed for GET or HEAD requests");
14545 this._initBody(body);
14546 if (this.method === "GET" || this.method === "HEAD") {
14547 if (options2.cache === "no-store" || options2.cache === "no-cache") {
14548 var reParamSearch = /([?&])_=[^&]*/;
14549 if (reParamSearch.test(this.url)) {
14550 this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
14552 var reQueryString = /\?/;
14553 this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
14558 Request.prototype.clone = function() {
14559 return new Request(this, { body: this._bodyInit });
14561 function decode(body) {
14562 var form = new FormData();
14563 body.trim().split("&").forEach(function(bytes) {
14565 var split = bytes.split("=");
14566 var name = split.shift().replace(/\+/g, " ");
14567 var value = split.join("=").replace(/\+/g, " ");
14568 form.append(decodeURIComponent(name), decodeURIComponent(value));
14573 function parseHeaders(rawHeaders) {
14574 var headers = new Headers();
14575 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
14576 preProcessedHeaders.split("\r").map(function(header) {
14577 return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
14578 }).forEach(function(line) {
14579 var parts = line.split(":");
14580 var key = parts.shift().trim();
14582 var value = parts.join(":").trim();
14584 headers.append(key, value);
14586 console.warn("Response " + error.message);
14592 Body.call(Request.prototype);
14593 function Response(bodyInit, options2) {
14594 if (!(this instanceof Response)) {
14595 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
14600 this.type = "default";
14601 this.status = options2.status === void 0 ? 200 : options2.status;
14602 if (this.status < 200 || this.status > 599) {
14603 throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
14605 this.ok = this.status >= 200 && this.status < 300;
14606 this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
14607 this.headers = new Headers(options2.headers);
14608 this.url = options2.url || "";
14609 this._initBody(bodyInit);
14611 Body.call(Response.prototype);
14612 Response.prototype.clone = function() {
14613 return new Response(this._bodyInit, {
14614 status: this.status,
14615 statusText: this.statusText,
14616 headers: new Headers(this.headers),
14620 Response.error = function() {
14621 var response = new Response(null, { status: 200, statusText: "" });
14622 response.ok = false;
14623 response.status = 0;
14624 response.type = "error";
14627 var redirectStatuses = [301, 302, 303, 307, 308];
14628 Response.redirect = function(url, status) {
14629 if (redirectStatuses.indexOf(status) === -1) {
14630 throw new RangeError("Invalid status code");
14632 return new Response(null, { status, headers: { location: url } });
14634 var DOMException2 = g.DOMException;
14636 new DOMException2();
14638 DOMException2 = function(message, name) {
14639 this.message = message;
14641 var error = Error(message);
14642 this.stack = error.stack;
14644 DOMException2.prototype = Object.create(Error.prototype);
14645 DOMException2.prototype.constructor = DOMException2;
14647 function fetch2(input, init2) {
14648 return new Promise(function(resolve, reject) {
14649 var request3 = new Request(input, init2);
14650 if (request3.signal && request3.signal.aborted) {
14651 return reject(new DOMException2("Aborted", "AbortError"));
14653 var xhr = new XMLHttpRequest();
14654 function abortXhr() {
14657 xhr.onload = function() {
14659 statusText: xhr.statusText,
14660 headers: parseHeaders(xhr.getAllResponseHeaders() || "")
14662 if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
14663 options2.status = 200;
14665 options2.status = xhr.status;
14667 options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
14668 var body = "response" in xhr ? xhr.response : xhr.responseText;
14669 setTimeout(function() {
14670 resolve(new Response(body, options2));
14673 xhr.onerror = function() {
14674 setTimeout(function() {
14675 reject(new TypeError("Network request failed"));
14678 xhr.ontimeout = function() {
14679 setTimeout(function() {
14680 reject(new TypeError("Network request timed out"));
14683 xhr.onabort = function() {
14684 setTimeout(function() {
14685 reject(new DOMException2("Aborted", "AbortError"));
14688 function fixUrl(url) {
14690 return url === "" && g.location.href ? g.location.href : url;
14695 xhr.open(request3.method, fixUrl(request3.url), true);
14696 if (request3.credentials === "include") {
14697 xhr.withCredentials = true;
14698 } else if (request3.credentials === "omit") {
14699 xhr.withCredentials = false;
14701 if ("responseType" in xhr) {
14702 if (support.blob) {
14703 xhr.responseType = "blob";
14704 } else if (support.arrayBuffer) {
14705 xhr.responseType = "arraybuffer";
14708 if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
14710 Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
14711 names.push(normalizeName(name));
14712 xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
14714 request3.headers.forEach(function(value, name) {
14715 if (names.indexOf(name) === -1) {
14716 xhr.setRequestHeader(name, value);
14720 request3.headers.forEach(function(value, name) {
14721 xhr.setRequestHeader(name, value);
14724 if (request3.signal) {
14725 request3.signal.addEventListener("abort", abortXhr);
14726 xhr.onreadystatechange = function() {
14727 if (xhr.readyState === 4) {
14728 request3.signal.removeEventListener("abort", abortXhr);
14732 xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
14735 fetch2.polyfill = true;
14738 g.Headers = Headers;
14739 g.Request = Request;
14740 g.Response = Response;
14743 // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
14744 (function(factory) {
14745 typeof define === "function" && define.amd ? define(factory) : factory();
14748 function _classCallCheck(instance, Constructor) {
14749 if (!(instance instanceof Constructor)) {
14750 throw new TypeError("Cannot call a class as a function");
14753 function _defineProperties(target, props) {
14754 for (var i3 = 0; i3 < props.length; i3++) {
14755 var descriptor = props[i3];
14756 descriptor.enumerable = descriptor.enumerable || false;
14757 descriptor.configurable = true;
14758 if ("value" in descriptor)
14759 descriptor.writable = true;
14760 Object.defineProperty(target, descriptor.key, descriptor);
14763 function _createClass(Constructor, protoProps, staticProps) {
14765 _defineProperties(Constructor.prototype, protoProps);
14767 _defineProperties(Constructor, staticProps);
14768 Object.defineProperty(Constructor, "prototype", {
14771 return Constructor;
14773 function _inherits(subClass, superClass) {
14774 if (typeof superClass !== "function" && superClass !== null) {
14775 throw new TypeError("Super expression must either be null or a function");
14777 subClass.prototype = Object.create(superClass && superClass.prototype, {
14784 Object.defineProperty(subClass, "prototype", {
14788 _setPrototypeOf(subClass, superClass);
14790 function _getPrototypeOf(o2) {
14791 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
14792 return o3.__proto__ || Object.getPrototypeOf(o3);
14794 return _getPrototypeOf(o2);
14796 function _setPrototypeOf(o2, p2) {
14797 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
14801 return _setPrototypeOf(o2, p2);
14803 function _isNativeReflectConstruct() {
14804 if (typeof Reflect === "undefined" || !Reflect.construct)
14806 if (Reflect.construct.sham)
14808 if (typeof Proxy === "function")
14811 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
14818 function _assertThisInitialized(self2) {
14819 if (self2 === void 0) {
14820 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
14824 function _possibleConstructorReturn(self2, call) {
14825 if (call && (typeof call === "object" || typeof call === "function")) {
14827 } else if (call !== void 0) {
14828 throw new TypeError("Derived constructors may only return object or undefined");
14830 return _assertThisInitialized(self2);
14832 function _createSuper(Derived) {
14833 var hasNativeReflectConstruct = _isNativeReflectConstruct();
14834 return function _createSuperInternal() {
14835 var Super = _getPrototypeOf(Derived), result;
14836 if (hasNativeReflectConstruct) {
14837 var NewTarget = _getPrototypeOf(this).constructor;
14838 result = Reflect.construct(Super, arguments, NewTarget);
14840 result = Super.apply(this, arguments);
14842 return _possibleConstructorReturn(this, result);
14845 function _superPropBase(object, property) {
14846 while (!Object.prototype.hasOwnProperty.call(object, property)) {
14847 object = _getPrototypeOf(object);
14848 if (object === null)
14854 if (typeof Reflect !== "undefined" && Reflect.get) {
14855 _get = Reflect.get.bind();
14857 _get = function _get2(target, property, receiver) {
14858 var base = _superPropBase(target, property);
14861 var desc = Object.getOwnPropertyDescriptor(base, property);
14863 return desc.get.call(arguments.length < 3 ? target : receiver);
14868 return _get.apply(this, arguments);
14870 var Emitter = /* @__PURE__ */ function() {
14871 function Emitter2() {
14872 _classCallCheck(this, Emitter2);
14873 Object.defineProperty(this, "listeners", {
14879 _createClass(Emitter2, [{
14880 key: "addEventListener",
14881 value: function addEventListener(type2, callback, options2) {
14882 if (!(type2 in this.listeners)) {
14883 this.listeners[type2] = [];
14885 this.listeners[type2].push({
14891 key: "removeEventListener",
14892 value: function removeEventListener(type2, callback) {
14893 if (!(type2 in this.listeners)) {
14896 var stack = this.listeners[type2];
14897 for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
14898 if (stack[i3].callback === callback) {
14899 stack.splice(i3, 1);
14905 key: "dispatchEvent",
14906 value: function dispatchEvent2(event) {
14907 if (!(event.type in this.listeners)) {
14910 var stack = this.listeners[event.type];
14911 var stackToCall = stack.slice();
14912 for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
14913 var listener = stackToCall[i3];
14915 listener.callback.call(this, event);
14917 Promise.resolve().then(function() {
14921 if (listener.options && listener.options.once) {
14922 this.removeEventListener(event.type, listener.callback);
14925 return !event.defaultPrevented;
14930 var AbortSignal = /* @__PURE__ */ function(_Emitter) {
14931 _inherits(AbortSignal2, _Emitter);
14932 var _super = _createSuper(AbortSignal2);
14933 function AbortSignal2() {
14935 _classCallCheck(this, AbortSignal2);
14936 _this = _super.call(this);
14937 if (!_this.listeners) {
14938 Emitter.call(_assertThisInitialized(_this));
14940 Object.defineProperty(_assertThisInitialized(_this), "aborted", {
14945 Object.defineProperty(_assertThisInitialized(_this), "onabort", {
14950 Object.defineProperty(_assertThisInitialized(_this), "reason", {
14957 _createClass(AbortSignal2, [{
14959 value: function toString2() {
14960 return "[object AbortSignal]";
14963 key: "dispatchEvent",
14964 value: function dispatchEvent2(event) {
14965 if (event.type === "abort") {
14966 this.aborted = true;
14967 if (typeof this.onabort === "function") {
14968 this.onabort.call(this, event);
14971 _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
14974 return AbortSignal2;
14976 var AbortController2 = /* @__PURE__ */ function() {
14977 function AbortController3() {
14978 _classCallCheck(this, AbortController3);
14979 Object.defineProperty(this, "signal", {
14980 value: new AbortSignal(),
14985 _createClass(AbortController3, [{
14987 value: function abort(reason) {
14990 event = new Event("abort");
14992 if (typeof document !== "undefined") {
14993 if (!document.createEvent) {
14994 event = document.createEventObject();
14995 event.type = "abort";
14997 event = document.createEvent("Event");
14998 event.initEvent("abort", false, false);
15008 var signalReason = reason;
15009 if (signalReason === void 0) {
15010 if (typeof document === "undefined") {
15011 signalReason = new Error("This operation was aborted");
15012 signalReason.name = "AbortError";
15015 signalReason = new DOMException("signal is aborted without reason");
15017 signalReason = new Error("This operation was aborted");
15018 signalReason.name = "AbortError";
15022 this.signal.reason = signalReason;
15023 this.signal.dispatchEvent(event);
15027 value: function toString2() {
15028 return "[object AbortController]";
15031 return AbortController3;
15033 if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
15034 AbortController2.prototype[Symbol.toStringTag] = "AbortController";
15035 AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
15037 function polyfillNeeded(self2) {
15038 if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15039 console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
15042 return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
15044 function abortableFetchDecorator(patchTargets) {
15045 if ("function" === typeof patchTargets) {
15047 fetch: patchTargets
15050 var _patchTargets = patchTargets, fetch3 = _patchTargets.fetch, _patchTargets$Request = _patchTargets.Request, NativeRequest = _patchTargets$Request === void 0 ? fetch3.Request : _patchTargets$Request, NativeAbortController = _patchTargets.AbortController, _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL, __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;
15051 if (!polyfillNeeded({
15053 Request: NativeRequest,
15054 AbortController: NativeAbortController,
15055 __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
15062 var Request2 = NativeRequest;
15063 if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
15064 Request2 = function Request3(input, init2) {
15066 if (init2 && init2.signal) {
15067 signal = init2.signal;
15068 delete init2.signal;
15070 var request3 = new NativeRequest(input, init2);
15072 Object.defineProperty(request3, "signal", {
15075 configurable: true,
15081 Request2.prototype = NativeRequest.prototype;
15083 var realFetch = fetch3;
15084 var abortableFetch = function abortableFetch2(input, init2) {
15085 var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
15089 abortError = new DOMException("Aborted", "AbortError");
15091 abortError = new Error("Aborted");
15092 abortError.name = "AbortError";
15094 if (signal.aborted) {
15095 return Promise.reject(abortError);
15097 var cancellation = new Promise(function(_2, reject) {
15098 signal.addEventListener("abort", function() {
15099 return reject(abortError);
15104 if (init2 && init2.signal) {
15105 delete init2.signal;
15107 return Promise.race([cancellation, realFetch(input, init2)]);
15109 return realFetch(input, init2);
15112 fetch: abortableFetch,
15117 if (!polyfillNeeded(self2)) {
15120 if (!self2.fetch) {
15121 console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
15124 var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
15125 self2.fetch = fetch3;
15126 self2.Request = Request2;
15127 Object.defineProperty(self2, "AbortController", {
15130 configurable: true,
15131 value: AbortController2
15133 Object.defineProperty(self2, "AbortSignal", {
15136 configurable: true,
15139 })(typeof self !== "undefined" ? self : global);
15142 // modules/index.js
15143 var modules_exports = {};
15144 __export(modules_exports, {
15145 LocationManager: () => LocationManager,
15146 QAItem: () => QAItem,
15147 actionAddEntity: () => actionAddEntity,
15148 actionAddMember: () => actionAddMember,
15149 actionAddMidpoint: () => actionAddMidpoint,
15150 actionAddVertex: () => actionAddVertex,
15151 actionChangeMember: () => actionChangeMember,
15152 actionChangePreset: () => actionChangePreset,
15153 actionChangeTags: () => actionChangeTags,
15154 actionCircularize: () => actionCircularize,
15155 actionConnect: () => actionConnect,
15156 actionCopyEntities: () => actionCopyEntities,
15157 actionDeleteMember: () => actionDeleteMember,
15158 actionDeleteMultiple: () => actionDeleteMultiple,
15159 actionDeleteNode: () => actionDeleteNode,
15160 actionDeleteRelation: () => actionDeleteRelation,
15161 actionDeleteWay: () => actionDeleteWay,
15162 actionDiscardTags: () => actionDiscardTags,
15163 actionDisconnect: () => actionDisconnect,
15164 actionExtract: () => actionExtract,
15165 actionJoin: () => actionJoin,
15166 actionMerge: () => actionMerge,
15167 actionMergeNodes: () => actionMergeNodes,
15168 actionMergePolygon: () => actionMergePolygon,
15169 actionMergeRemoteChanges: () => actionMergeRemoteChanges,
15170 actionMove: () => actionMove,
15171 actionMoveMember: () => actionMoveMember,
15172 actionMoveNode: () => actionMoveNode,
15173 actionNoop: () => actionNoop,
15174 actionOrthogonalize: () => actionOrthogonalize,
15175 actionReflect: () => actionReflect,
15176 actionRestrictTurn: () => actionRestrictTurn,
15177 actionReverse: () => actionReverse,
15178 actionRevert: () => actionRevert,
15179 actionRotate: () => actionRotate,
15180 actionScale: () => actionScale,
15181 actionSplit: () => actionSplit,
15182 actionStraightenNodes: () => actionStraightenNodes,
15183 actionStraightenWay: () => actionStraightenWay,
15184 actionUnrestrictTurn: () => actionUnrestrictTurn,
15185 actionUpgradeTags: () => actionUpgradeTags,
15186 behaviorAddWay: () => behaviorAddWay,
15187 behaviorBreathe: () => behaviorBreathe,
15188 behaviorDrag: () => behaviorDrag,
15189 behaviorDraw: () => behaviorDraw,
15190 behaviorDrawWay: () => behaviorDrawWay,
15191 behaviorEdit: () => behaviorEdit,
15192 behaviorHash: () => behaviorHash,
15193 behaviorHover: () => behaviorHover,
15194 behaviorLasso: () => behaviorLasso,
15195 behaviorOperation: () => behaviorOperation,
15196 behaviorPaste: () => behaviorPaste,
15197 behaviorSelect: () => behaviorSelect,
15198 coreContext: () => coreContext,
15199 coreDifference: () => coreDifference,
15200 coreFileFetcher: () => coreFileFetcher,
15201 coreGraph: () => coreGraph,
15202 coreHistory: () => coreHistory,
15203 coreLocalizer: () => coreLocalizer,
15204 coreTree: () => coreTree,
15205 coreUploader: () => coreUploader,
15206 coreValidator: () => coreValidator,
15208 debug: () => debug,
15209 dmsCoordinatePair: () => dmsCoordinatePair,
15210 dmsMatcher: () => dmsMatcher,
15211 fileFetcher: () => _mainFileFetcher,
15212 geoAngle: () => geoAngle,
15213 geoChooseEdge: () => geoChooseEdge,
15214 geoEdgeEqual: () => geoEdgeEqual,
15215 geoExtent: () => geoExtent,
15216 geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
15217 geoHasLineIntersections: () => geoHasLineIntersections,
15218 geoHasSelfIntersections: () => geoHasSelfIntersections,
15219 geoLatToMeters: () => geoLatToMeters,
15220 geoLineIntersection: () => geoLineIntersection,
15221 geoLonToMeters: () => geoLonToMeters,
15222 geoMetersToLat: () => geoMetersToLat,
15223 geoMetersToLon: () => geoMetersToLon,
15224 geoMetersToOffset: () => geoMetersToOffset,
15225 geoOffsetToMeters: () => geoOffsetToMeters,
15226 geoOrthoCalcScore: () => geoOrthoCalcScore,
15227 geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
15228 geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
15229 geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
15230 geoPathHasIntersections: () => geoPathHasIntersections,
15231 geoPathIntersections: () => geoPathIntersections,
15232 geoPathLength: () => geoPathLength,
15233 geoPointInPolygon: () => geoPointInPolygon,
15234 geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
15235 geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
15236 geoRawMercator: () => geoRawMercator,
15237 geoRotate: () => geoRotate,
15238 geoScaleToZoom: () => geoScaleToZoom,
15239 geoSphericalClosestNode: () => geoSphericalClosestNode,
15240 geoSphericalDistance: () => geoSphericalDistance,
15241 geoVecAdd: () => geoVecAdd,
15242 geoVecAngle: () => geoVecAngle,
15243 geoVecCross: () => geoVecCross,
15244 geoVecDot: () => geoVecDot,
15245 geoVecEqual: () => geoVecEqual,
15246 geoVecFloor: () => geoVecFloor,
15247 geoVecInterp: () => geoVecInterp,
15248 geoVecLength: () => geoVecLength,
15249 geoVecLengthSquare: () => geoVecLengthSquare,
15250 geoVecNormalize: () => geoVecNormalize,
15251 geoVecNormalizedDot: () => geoVecNormalizedDot,
15252 geoVecProject: () => geoVecProject,
15253 geoVecScale: () => geoVecScale,
15254 geoVecSubtract: () => geoVecSubtract,
15255 geoViewportEdge: () => geoViewportEdge,
15256 geoZoomToScale: () => geoZoomToScale,
15257 likelyRawNumberFormat: () => likelyRawNumberFormat,
15258 localizer: () => _mainLocalizer,
15259 locationManager: () => _sharedLocationManager,
15260 modeAddArea: () => modeAddArea,
15261 modeAddLine: () => modeAddLine,
15262 modeAddNote: () => modeAddNote,
15263 modeAddPoint: () => modeAddPoint,
15264 modeBrowse: () => modeBrowse,
15265 modeDragNode: () => modeDragNode,
15266 modeDragNote: () => modeDragNote,
15267 modeDrawArea: () => modeDrawArea,
15268 modeDrawLine: () => modeDrawLine,
15269 modeMove: () => modeMove,
15270 modeRotate: () => modeRotate,
15271 modeSave: () => modeSave,
15272 modeSelect: () => modeSelect,
15273 modeSelectData: () => modeSelectData,
15274 modeSelectError: () => modeSelectError,
15275 modeSelectNote: () => modeSelectNote,
15276 operationCircularize: () => operationCircularize,
15277 operationContinue: () => operationContinue,
15278 operationCopy: () => operationCopy,
15279 operationDelete: () => operationDelete,
15280 operationDisconnect: () => operationDisconnect,
15281 operationDowngrade: () => operationDowngrade,
15282 operationExtract: () => operationExtract,
15283 operationMerge: () => operationMerge,
15284 operationMove: () => operationMove,
15285 operationOrthogonalize: () => operationOrthogonalize,
15286 operationPaste: () => operationPaste,
15287 operationReflectLong: () => operationReflectLong,
15288 operationReflectShort: () => operationReflectShort,
15289 operationReverse: () => operationReverse,
15290 operationRotate: () => operationRotate,
15291 operationSplit: () => operationSplit,
15292 operationStraighten: () => operationStraighten,
15293 osmAreaKeys: () => osmAreaKeys,
15294 osmChangeset: () => osmChangeset,
15295 osmEntity: () => osmEntity,
15296 osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
15297 osmInferRestriction: () => osmInferRestriction,
15298 osmIntersection: () => osmIntersection,
15299 osmIsInterestingTag: () => osmIsInterestingTag,
15300 osmJoinWays: () => osmJoinWays,
15301 osmLanes: () => osmLanes,
15302 osmLifecyclePrefixes: () => osmLifecyclePrefixes,
15303 osmNode: () => osmNode,
15304 osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
15305 osmNote: () => osmNote,
15306 osmOneWayTags: () => osmOneWayTags,
15307 osmPavedTags: () => osmPavedTags,
15308 osmPointTags: () => osmPointTags,
15309 osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
15310 osmRelation: () => osmRelation,
15311 osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
15312 osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
15313 osmSetAreaKeys: () => osmSetAreaKeys,
15314 osmSetPointTags: () => osmSetPointTags,
15315 osmSetVertexTags: () => osmSetVertexTags,
15316 osmTagSuggestingArea: () => osmTagSuggestingArea,
15317 osmTurn: () => osmTurn,
15318 osmVertexTags: () => osmVertexTags,
15319 osmWay: () => osmWay,
15320 prefs: () => corePreferences,
15321 presetCategory: () => presetCategory,
15322 presetCollection: () => presetCollection,
15323 presetField: () => presetField,
15324 presetIndex: () => presetIndex,
15325 presetManager: () => _mainPresetIndex,
15326 presetPreset: () => presetPreset,
15327 rendererBackground: () => rendererBackground,
15328 rendererBackgroundSource: () => rendererBackgroundSource,
15329 rendererFeatures: () => rendererFeatures,
15330 rendererMap: () => rendererMap,
15331 rendererPhotos: () => rendererPhotos,
15332 rendererTileLayer: () => rendererTileLayer,
15333 serviceImproveOSM: () => improveOSM_default,
15334 serviceKartaview: () => kartaview_default,
15335 serviceKeepRight: () => keepRight_default,
15336 serviceMapRules: () => maprules_default,
15337 serviceMapilio: () => mapilio_default,
15338 serviceMapillary: () => mapillary_default,
15339 serviceNominatim: () => nominatim_default,
15340 serviceNsi: () => nsi_default,
15341 serviceOsm: () => osm_default,
15342 serviceOsmWikibase: () => osm_wikibase_default,
15343 serviceOsmose: () => osmose_default,
15344 serviceStreetside: () => streetside_default,
15345 serviceTaginfo: () => taginfo_default,
15346 serviceVectorTile: () => vector_tile_default,
15347 serviceVegbilder: () => vegbilder_default,
15348 serviceWikidata: () => wikidata_default,
15349 serviceWikipedia: () => wikipedia_default,
15350 services: () => services,
15351 svgAreas: () => svgAreas,
15352 svgData: () => svgData,
15353 svgDebug: () => svgDebug,
15354 svgDefs: () => svgDefs,
15355 svgGeolocate: () => svgGeolocate,
15356 svgIcon: () => svgIcon,
15357 svgKartaviewImages: () => svgKartaviewImages,
15358 svgKeepRight: () => svgKeepRight,
15359 svgLabels: () => svgLabels,
15360 svgLayers: () => svgLayers,
15361 svgLines: () => svgLines,
15362 svgMapilioImages: () => svgMapilioImages,
15363 svgMapillaryImages: () => svgMapillaryImages,
15364 svgMapillarySigns: () => svgMapillarySigns,
15365 svgMarkerSegments: () => svgMarkerSegments,
15366 svgMidpoints: () => svgMidpoints,
15367 svgNotes: () => svgNotes,
15368 svgOsm: () => svgOsm,
15369 svgPassiveVertex: () => svgPassiveVertex,
15370 svgPath: () => svgPath,
15371 svgPointTransform: () => svgPointTransform,
15372 svgPoints: () => svgPoints,
15373 svgRelationMemberTags: () => svgRelationMemberTags,
15374 svgSegmentWay: () => svgSegmentWay,
15375 svgStreetside: () => svgStreetside,
15376 svgTagClasses: () => svgTagClasses,
15377 svgTagPattern: () => svgTagPattern,
15378 svgTouch: () => svgTouch,
15379 svgTurns: () => svgTurns,
15380 svgVegbilder: () => svgVegbilder,
15381 svgVertices: () => svgVertices,
15383 uiAccount: () => uiAccount,
15384 uiAttribution: () => uiAttribution,
15385 uiChangesetEditor: () => uiChangesetEditor,
15386 uiCmd: () => uiCmd,
15387 uiCombobox: () => uiCombobox,
15388 uiCommit: () => uiCommit,
15389 uiCommitWarnings: () => uiCommitWarnings,
15390 uiConfirm: () => uiConfirm,
15391 uiConflicts: () => uiConflicts,
15392 uiContributors: () => uiContributors,
15393 uiCurtain: () => uiCurtain,
15394 uiDataEditor: () => uiDataEditor,
15395 uiDataHeader: () => uiDataHeader,
15396 uiDisclosure: () => uiDisclosure,
15397 uiEditMenu: () => uiEditMenu,
15398 uiEntityEditor: () => uiEntityEditor,
15399 uiFeatureInfo: () => uiFeatureInfo,
15400 uiFeatureList: () => uiFeatureList,
15401 uiField: () => uiField,
15402 uiFieldAccess: () => uiFieldAccess,
15403 uiFieldAddress: () => uiFieldAddress,
15404 uiFieldCheck: () => uiFieldCheck,
15405 uiFieldColour: () => uiFieldText,
15406 uiFieldCombo: () => uiFieldCombo,
15407 uiFieldDefaultCheck: () => uiFieldCheck,
15408 uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
15409 uiFieldEmail: () => uiFieldText,
15410 uiFieldHelp: () => uiFieldHelp,
15411 uiFieldIdentifier: () => uiFieldText,
15412 uiFieldLanes: () => uiFieldLanes,
15413 uiFieldLocalized: () => uiFieldLocalized,
15414 uiFieldManyCombo: () => uiFieldCombo,
15415 uiFieldMultiCombo: () => uiFieldCombo,
15416 uiFieldNetworkCombo: () => uiFieldCombo,
15417 uiFieldNumber: () => uiFieldText,
15418 uiFieldOnewayCheck: () => uiFieldCheck,
15419 uiFieldRadio: () => uiFieldRadio,
15420 uiFieldRestrictions: () => uiFieldRestrictions,
15421 uiFieldRoadheight: () => uiFieldRoadheight,
15422 uiFieldRoadspeed: () => uiFieldRoadspeed,
15423 uiFieldSemiCombo: () => uiFieldCombo,
15424 uiFieldStructureRadio: () => uiFieldRadio,
15425 uiFieldTel: () => uiFieldText,
15426 uiFieldText: () => uiFieldText,
15427 uiFieldTextarea: () => uiFieldTextarea,
15428 uiFieldTypeCombo: () => uiFieldCombo,
15429 uiFieldUrl: () => uiFieldText,
15430 uiFieldWikidata: () => uiFieldWikidata,
15431 uiFieldWikipedia: () => uiFieldWikipedia,
15432 uiFields: () => uiFields,
15433 uiFlash: () => uiFlash,
15434 uiFormFields: () => uiFormFields,
15435 uiFullScreen: () => uiFullScreen,
15436 uiGeolocate: () => uiGeolocate,
15437 uiImproveOsmComments: () => uiImproveOsmComments,
15438 uiImproveOsmDetails: () => uiImproveOsmDetails,
15439 uiImproveOsmEditor: () => uiImproveOsmEditor,
15440 uiImproveOsmHeader: () => uiImproveOsmHeader,
15441 uiInfo: () => uiInfo,
15442 uiInfoPanels: () => uiInfoPanels,
15443 uiInit: () => uiInit,
15444 uiInspector: () => uiInspector,
15445 uiIntro: () => uiIntro,
15446 uiIssuesInfo: () => uiIssuesInfo,
15447 uiKeepRightDetails: () => uiKeepRightDetails,
15448 uiKeepRightEditor: () => uiKeepRightEditor,
15449 uiKeepRightHeader: () => uiKeepRightHeader,
15450 uiLasso: () => uiLasso,
15451 uiLengthIndicator: () => uiLengthIndicator,
15452 uiLoading: () => uiLoading,
15453 uiMapInMap: () => uiMapInMap,
15454 uiModal: () => uiModal,
15455 uiNoteComments: () => uiNoteComments,
15456 uiNoteEditor: () => uiNoteEditor,
15457 uiNoteHeader: () => uiNoteHeader,
15458 uiNoteReport: () => uiNoteReport,
15459 uiNotice: () => uiNotice,
15460 uiPaneBackground: () => uiPaneBackground,
15461 uiPaneHelp: () => uiPaneHelp,
15462 uiPaneIssues: () => uiPaneIssues,
15463 uiPaneMapData: () => uiPaneMapData,
15464 uiPanePreferences: () => uiPanePreferences,
15465 uiPanelBackground: () => uiPanelBackground,
15466 uiPanelHistory: () => uiPanelHistory,
15467 uiPanelLocation: () => uiPanelLocation,
15468 uiPanelMeasurement: () => uiPanelMeasurement,
15469 uiPopover: () => uiPopover,
15470 uiPresetIcon: () => uiPresetIcon,
15471 uiPresetList: () => uiPresetList,
15472 uiRestore: () => uiRestore,
15473 uiScale: () => uiScale,
15474 uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
15475 uiSectionBackgroundList: () => uiSectionBackgroundList,
15476 uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
15477 uiSectionChanges: () => uiSectionChanges,
15478 uiSectionDataLayers: () => uiSectionDataLayers,
15479 uiSectionEntityIssues: () => uiSectionEntityIssues,
15480 uiSectionFeatureType: () => uiSectionFeatureType,
15481 uiSectionMapFeatures: () => uiSectionMapFeatures,
15482 uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
15483 uiSectionOverlayList: () => uiSectionOverlayList,
15484 uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
15485 uiSectionPresetFields: () => uiSectionPresetFields,
15486 uiSectionPrivacy: () => uiSectionPrivacy,
15487 uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
15488 uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
15489 uiSectionRawTagEditor: () => uiSectionRawTagEditor,
15490 uiSectionSelectionList: () => uiSectionSelectionList,
15491 uiSectionValidationIssues: () => uiSectionValidationIssues,
15492 uiSectionValidationOptions: () => uiSectionValidationOptions,
15493 uiSectionValidationRules: () => uiSectionValidationRules,
15494 uiSectionValidationStatus: () => uiSectionValidationStatus,
15495 uiSettingsCustomBackground: () => uiSettingsCustomBackground,
15496 uiSettingsCustomData: () => uiSettingsCustomData,
15497 uiSidebar: () => uiSidebar,
15498 uiSourceSwitch: () => uiSourceSwitch,
15499 uiSpinner: () => uiSpinner,
15500 uiSplash: () => uiSplash,
15501 uiStatus: () => uiStatus,
15502 uiSuccess: () => uiSuccess,
15503 uiTagReference: () => uiTagReference,
15504 uiToggle: () => uiToggle,
15505 uiTooltip: () => uiTooltip,
15506 uiVersion: () => uiVersion,
15507 uiViewOnKeepRight: () => uiViewOnKeepRight,
15508 uiViewOnOSM: () => uiViewOnOSM,
15509 uiZoom: () => uiZoom,
15510 utilAesDecrypt: () => utilAesDecrypt,
15511 utilAesEncrypt: () => utilAesEncrypt,
15512 utilArrayChunk: () => utilArrayChunk,
15513 utilArrayDifference: () => utilArrayDifference,
15514 utilArrayFlatten: () => utilArrayFlatten,
15515 utilArrayGroupBy: () => utilArrayGroupBy,
15516 utilArrayIdentical: () => utilArrayIdentical,
15517 utilArrayIntersection: () => utilArrayIntersection,
15518 utilArrayUnion: () => utilArrayUnion,
15519 utilArrayUniq: () => utilArrayUniq,
15520 utilArrayUniqBy: () => utilArrayUniqBy,
15521 utilAsyncMap: () => utilAsyncMap,
15522 utilCleanOsmString: () => utilCleanOsmString,
15523 utilCleanTags: () => utilCleanTags,
15524 utilCombinedTags: () => utilCombinedTags,
15525 utilCompareIDs: () => utilCompareIDs,
15526 utilDeepMemberSelector: () => utilDeepMemberSelector,
15527 utilDetect: () => utilDetect,
15528 utilDisplayLabel: () => utilDisplayLabel,
15529 utilDisplayName: () => utilDisplayName,
15530 utilDisplayNameForPath: () => utilDisplayNameForPath,
15531 utilDisplayType: () => utilDisplayType,
15532 utilEditDistance: () => utilEditDistance,
15533 utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
15534 utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
15535 utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
15536 utilEntityRoot: () => utilEntityRoot,
15537 utilEntitySelector: () => utilEntitySelector,
15538 utilFastMouse: () => utilFastMouse,
15539 utilFunctor: () => utilFunctor,
15540 utilGetAllNodes: () => utilGetAllNodes,
15541 utilGetSetValue: () => utilGetSetValue,
15542 utilHashcode: () => utilHashcode,
15543 utilHighlightEntities: () => utilHighlightEntities,
15544 utilKeybinding: () => utilKeybinding,
15545 utilNoAuto: () => utilNoAuto,
15546 utilObjectOmit: () => utilObjectOmit,
15547 utilOldestID: () => utilOldestID,
15548 utilPrefixCSSProperty: () => utilPrefixCSSProperty,
15549 utilPrefixDOMProperty: () => utilPrefixDOMProperty,
15550 utilQsString: () => utilQsString,
15551 utilRebind: () => utilRebind,
15552 utilSafeClassName: () => utilSafeClassName,
15553 utilSessionMutex: () => utilSessionMutex,
15554 utilSetTransform: () => utilSetTransform,
15555 utilStringQs: () => utilStringQs,
15556 utilTagDiff: () => utilTagDiff,
15557 utilTagText: () => utilTagText,
15558 utilTiler: () => utilTiler,
15559 utilTotalExtent: () => utilTotalExtent,
15560 utilTriggerEvent: () => utilTriggerEvent,
15561 utilUnicodeCharsCount: () => utilUnicodeCharsCount,
15562 utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
15563 utilUniqueDomId: () => utilUniqueDomId,
15564 utilWrap: () => utilWrap,
15565 validationAlmostJunction: () => validationAlmostJunction,
15566 validationCloseNodes: () => validationCloseNodes,
15567 validationCrossingWays: () => validationCrossingWays,
15568 validationDisconnectedWay: () => validationDisconnectedWay,
15569 validationFormatting: () => validationFormatting,
15570 validationHelpRequest: () => validationHelpRequest,
15571 validationImpossibleOneway: () => validationImpossibleOneway,
15572 validationIncompatibleSource: () => validationIncompatibleSource,
15573 validationMaprules: () => validationMaprules,
15574 validationMismatchedGeometry: () => validationMismatchedGeometry,
15575 validationMissingRole: () => validationMissingRole,
15576 validationMissingTag: () => validationMissingTag,
15577 validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
15578 validationOutdatedTags: () => validationOutdatedTags,
15579 validationPrivateData: () => validationPrivateData,
15580 validationSuspiciousName: () => validationSuspiciousName,
15581 validationUnsquareWay: () => validationUnsquareWay
15584 // modules/actions/add_entity.js
15585 function actionAddEntity(way) {
15586 return function(graph) {
15587 return graph.replace(way);
15591 // modules/actions/reverse.js
15592 function actionReverse(entityID, options2) {
15593 var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
15594 var numeric = /^([+\-]?)(?=[\d.])/;
15595 var directionKey = /direction$/;
15596 var turn_lanes = /^turn:lanes:?/;
15597 var keyReplacements = [
15598 [/:right$/, ":left"],
15599 [/:left$/, ":right"],
15600 [/:forward$/, ":backward"],
15601 [/:backward$/, ":forward"],
15602 [/:right:/, ":left:"],
15603 [/:left:/, ":right:"],
15604 [/:forward:/, ":backward:"],
15605 [/:backward:/, ":forward:"]
15607 var valueReplacements = {
15612 forward: "backward",
15613 backward: "forward",
15614 forwards: "backward",
15615 backwards: "forward"
15617 const valueReplacementsExceptions = {
15619 { highway: "cyclist_waiting_aid" }
15622 var roleReplacements = {
15623 forward: "backward",
15624 backward: "forward",
15625 forwards: "backward",
15626 backwards: "forward"
15628 var onewayReplacements = {
15633 var compassReplacements = {
15651 function reverseKey(key) {
15652 for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
15653 var replacement = keyReplacements[i3];
15654 if (replacement[0].test(key)) {
15655 return key.replace(replacement[0], replacement[1]);
15660 function reverseValue(key, value, includeAbsolute, allTags) {
15661 if (ignoreKey.test(key))
15663 if (turn_lanes.test(key)) {
15665 } else if (key === "incline" && numeric.test(value)) {
15666 return value.replace(numeric, function(_2, sign2) {
15667 return sign2 === "-" ? "" : "-";
15669 } else if (options2 && options2.reverseOneway && key === "oneway") {
15670 return onewayReplacements[value] || value;
15671 } else if (includeAbsolute && directionKey.test(key)) {
15672 return value.split(";").map((value2) => {
15673 if (compassReplacements[value2])
15674 return compassReplacements[value2];
15675 var degrees3 = Number(value2);
15676 if (isFinite(degrees3)) {
15677 if (degrees3 < 180) {
15682 return degrees3.toString();
15684 return valueReplacements[value2] || value2;
15688 if (valueReplacementsExceptions[key] && valueReplacementsExceptions[key].some(
15689 (exceptionTags) => Object.keys(exceptionTags).every((k2) => {
15690 const v2 = exceptionTags[k2];
15691 return allTags[k2] && (v2 === "*" || allTags[k2] === v2);
15696 return valueReplacements[value] || value;
15698 function reverseNodeTags(graph, nodeIDs) {
15699 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
15700 var node = graph.hasEntity(nodeIDs[i3]);
15701 if (!node || !Object.keys(node.tags).length)
15704 for (var key in node.tags) {
15705 tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID, node.tags);
15707 graph = graph.replace(node.update({ tags }));
15711 function reverseWay(graph, way) {
15712 var nodes = way.nodes.slice().reverse();
15715 for (var key in way.tags) {
15716 tags[reverseKey(key)] = reverseValue(key, way.tags[key], false, way.tags);
15718 graph.parentRelations(way).forEach(function(relation) {
15719 relation.members.forEach(function(member, index) {
15720 if (member.id === way.id && (role = roleReplacements[member.role])) {
15721 relation = relation.updateMember({ role }, index);
15722 graph = graph.replace(relation);
15726 return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
15728 var action = function(graph) {
15729 var entity = graph.entity(entityID);
15730 if (entity.type === "way") {
15731 return reverseWay(graph, entity);
15733 return reverseNodeTags(graph, [entityID]);
15735 action.disabled = function(graph) {
15736 var entity = graph.hasEntity(entityID);
15737 if (!entity || entity.type === "way")
15739 for (var key in entity.tags) {
15740 var value = entity.tags[key];
15741 if (reverseKey(key) !== key || reverseValue(key, value, true, entity.tags) !== value) {
15745 return "nondirectional_node";
15747 action.entityID = function() {
15753 // node_modules/d3-array/src/ascending.js
15754 function ascending(a2, b2) {
15755 return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
15758 // node_modules/d3-array/src/descending.js
15759 function descending(a2, b2) {
15760 return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
15763 // node_modules/d3-array/src/bisector.js
15764 function bisector(f2) {
15765 let compare1, compare2, delta;
15766 if (f2.length !== 2) {
15767 compare1 = ascending;
15768 compare2 = (d2, x2) => ascending(f2(d2), x2);
15769 delta = (d2, x2) => f2(d2) - x2;
15771 compare1 = f2 === ascending || f2 === descending ? f2 : zero;
15775 function left(a2, x2, lo = 0, hi = a2.length) {
15777 if (compare1(x2, x2) !== 0)
15780 const mid = lo + hi >>> 1;
15781 if (compare2(a2[mid], x2) < 0)
15789 function right(a2, x2, lo = 0, hi = a2.length) {
15791 if (compare1(x2, x2) !== 0)
15794 const mid = lo + hi >>> 1;
15795 if (compare2(a2[mid], x2) <= 0)
15803 function center(a2, x2, lo = 0, hi = a2.length) {
15804 const i3 = left(a2, x2, lo, hi - 1);
15805 return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
15807 return { left, center, right };
15813 // node_modules/d3-array/src/number.js
15814 function number(x2) {
15815 return x2 === null ? NaN : +x2;
15817 function* numbers(values, valueof) {
15818 if (valueof === void 0) {
15819 for (let value of values) {
15820 if (value != null && (value = +value) >= value) {
15826 for (let value of values) {
15827 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
15834 // node_modules/d3-array/src/bisect.js
15835 var ascendingBisect = bisector(ascending);
15836 var bisectRight = ascendingBisect.right;
15837 var bisectLeft = ascendingBisect.left;
15838 var bisectCenter = bisector(number).center;
15839 var bisect_default = bisectRight;
15841 // node_modules/d3-array/src/fsum.js
15842 var Adder = class {
15844 this._partials = new Float64Array(32);
15848 const p2 = this._partials;
15850 for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
15851 const y2 = p2[j2], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
15861 const p2 = this._partials;
15862 let n3 = this._n, x2, y2, lo, hi = 0;
15869 lo = y2 - (hi - x2);
15873 if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
15884 // node_modules/d3-array/src/sort.js
15885 function compareDefined(compare2 = ascending) {
15886 if (compare2 === ascending)
15887 return ascendingDefined;
15888 if (typeof compare2 !== "function")
15889 throw new TypeError("compare is not a function");
15890 return (a2, b2) => {
15891 const x2 = compare2(a2, b2);
15892 if (x2 || x2 === 0)
15894 return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0);
15897 function ascendingDefined(a2, b2) {
15898 return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
15901 // node_modules/d3-array/src/ticks.js
15902 var e10 = Math.sqrt(50);
15903 var e5 = Math.sqrt(10);
15904 var e2 = Math.sqrt(2);
15905 function ticks(start2, stop, count) {
15906 var reverse, i3 = -1, n3, ticks2, step;
15907 stop = +stop, start2 = +start2, count = +count;
15908 if (start2 === stop && count > 0)
15910 if (reverse = stop < start2)
15911 n3 = start2, start2 = stop, stop = n3;
15912 if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step))
15915 let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
15916 if (r0 * step < start2)
15918 if (r1 * step > stop)
15920 ticks2 = new Array(n3 = r1 - r0 + 1);
15922 ticks2[i3] = (r0 + i3) * step;
15925 let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
15926 if (r0 / step < start2)
15928 if (r1 / step > stop)
15930 ticks2 = new Array(n3 = r1 - r0 + 1);
15932 ticks2[i3] = (r0 + i3) / step;
15938 function tickIncrement(start2, stop, count) {
15939 var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
15940 return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1);
15942 function tickStep(start2, stop, count) {
15943 var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
15946 else if (error >= e5)
15948 else if (error >= e2)
15950 return stop < start2 ? -step1 : step1;
15953 // node_modules/d3-array/src/max.js
15954 function max(values, valueof) {
15956 if (valueof === void 0) {
15957 for (const value of values) {
15958 if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
15964 for (let value of values) {
15965 if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
15973 // node_modules/d3-array/src/min.js
15974 function min(values, valueof) {
15976 if (valueof === void 0) {
15977 for (const value of values) {
15978 if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
15984 for (let value of values) {
15985 if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
15993 // node_modules/d3-array/src/quickselect.js
15994 function quickselect(array2, k2, left = 0, right = array2.length - 1, compare2) {
15995 compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
15996 while (right > left) {
15997 if (right - left > 600) {
15998 const n3 = right - left + 1;
15999 const m2 = k2 - left + 1;
16000 const z2 = Math.log(n3);
16001 const s2 = 0.5 * Math.exp(2 * z2 / 3);
16002 const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
16003 const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
16004 const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
16005 quickselect(array2, k2, newLeft, newRight, compare2);
16007 const t2 = array2[k2];
16010 swap(array2, left, k2);
16011 if (compare2(array2[right], t2) > 0)
16012 swap(array2, left, right);
16014 swap(array2, i3, j2), ++i3, --j2;
16015 while (compare2(array2[i3], t2) < 0)
16017 while (compare2(array2[j2], t2) > 0)
16020 if (compare2(array2[left], t2) === 0)
16021 swap(array2, left, j2);
16023 ++j2, swap(array2, j2, right);
16031 function swap(array2, i3, j2) {
16032 const t2 = array2[i3];
16033 array2[i3] = array2[j2];
16037 // node_modules/d3-array/src/quantile.js
16038 function quantile(values, p2, valueof) {
16039 values = Float64Array.from(numbers(values, valueof));
16040 if (!(n3 = values.length))
16042 if ((p2 = +p2) <= 0 || n3 < 2)
16043 return min(values);
16045 return max(values);
16046 var n3, i3 = (n3 - 1) * p2, i0 = Math.floor(i3), value0 = max(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min(values.subarray(i0 + 1));
16047 return value0 + (value1 - value0) * (i3 - i0);
16050 // node_modules/d3-array/src/median.js
16051 function median(values, valueof) {
16052 return quantile(values, 0.5, valueof);
16055 // node_modules/d3-array/src/merge.js
16056 function* flatten(arrays) {
16057 for (const array2 of arrays) {
16061 function merge(arrays) {
16062 return Array.from(flatten(arrays));
16065 // node_modules/d3-array/src/pairs.js
16066 function pairs(values, pairof = pair) {
16070 for (const value of values) {
16072 pairs2.push(pairof(previous, value));
16078 function pair(a2, b2) {
16082 // node_modules/d3-array/src/range.js
16083 function range(start2, stop, step) {
16084 start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
16085 var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
16086 while (++i3 < n3) {
16087 range3[i3] = start2 + i3 * step;
16092 // node_modules/d3-geo/src/math.js
16093 var epsilon = 1e-6;
16094 var epsilon2 = 1e-12;
16096 var halfPi = pi / 2;
16097 var quarterPi = pi / 4;
16099 var degrees = 180 / pi;
16100 var radians = pi / 180;
16101 var abs = Math.abs;
16102 var atan = Math.atan;
16103 var atan2 = Math.atan2;
16104 var cos = Math.cos;
16105 var exp = Math.exp;
16106 var log = Math.log;
16107 var sin = Math.sin;
16108 var sign = Math.sign || function(x2) {
16109 return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
16111 var sqrt = Math.sqrt;
16112 var tan = Math.tan;
16113 function acos(x2) {
16114 return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
16116 function asin(x2) {
16117 return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
16120 // node_modules/d3-geo/src/noop.js
16124 // node_modules/d3-geo/src/stream.js
16125 function streamGeometry(geometry, stream) {
16126 if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
16127 streamGeometryType[geometry.type](geometry, stream);
16130 var streamObjectType = {
16131 Feature: function(object, stream) {
16132 streamGeometry(object.geometry, stream);
16134 FeatureCollection: function(object, stream) {
16135 var features = object.features, i3 = -1, n3 = features.length;
16137 streamGeometry(features[i3].geometry, stream);
16140 var streamGeometryType = {
16141 Sphere: function(object, stream) {
16144 Point: function(object, stream) {
16145 object = object.coordinates;
16146 stream.point(object[0], object[1], object[2]);
16148 MultiPoint: function(object, stream) {
16149 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16151 object = coordinates[i3], stream.point(object[0], object[1], object[2]);
16153 LineString: function(object, stream) {
16154 streamLine(object.coordinates, stream, 0);
16156 MultiLineString: function(object, stream) {
16157 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16159 streamLine(coordinates[i3], stream, 0);
16161 Polygon: function(object, stream) {
16162 streamPolygon(object.coordinates, stream);
16164 MultiPolygon: function(object, stream) {
16165 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
16167 streamPolygon(coordinates[i3], stream);
16169 GeometryCollection: function(object, stream) {
16170 var geometries = object.geometries, i3 = -1, n3 = geometries.length;
16172 streamGeometry(geometries[i3], stream);
16175 function streamLine(coordinates, stream, closed) {
16176 var i3 = -1, n3 = coordinates.length - closed, coordinate;
16177 stream.lineStart();
16179 coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
16182 function streamPolygon(coordinates, stream) {
16183 var i3 = -1, n3 = coordinates.length;
16184 stream.polygonStart();
16186 streamLine(coordinates[i3], stream, 1);
16187 stream.polygonEnd();
16189 function stream_default(object, stream) {
16190 if (object && streamObjectType.hasOwnProperty(object.type)) {
16191 streamObjectType[object.type](object, stream);
16193 streamGeometry(object, stream);
16197 // node_modules/d3-geo/src/area.js
16198 var areaRingSum = new Adder();
16199 var areaSum = new Adder();
16209 polygonStart: function() {
16210 areaRingSum = new Adder();
16211 areaStream.lineStart = areaRingStart;
16212 areaStream.lineEnd = areaRingEnd;
16214 polygonEnd: function() {
16215 var areaRing = +areaRingSum;
16216 areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
16217 this.lineStart = this.lineEnd = this.point = noop;
16219 sphere: function() {
16223 function areaRingStart() {
16224 areaStream.point = areaPointFirst;
16226 function areaRingEnd() {
16227 areaPoint(lambda00, phi00);
16229 function areaPointFirst(lambda, phi) {
16230 areaStream.point = areaPoint;
16231 lambda00 = lambda, phi00 = phi;
16232 lambda *= radians, phi *= radians;
16233 lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
16235 function areaPoint(lambda, phi) {
16236 lambda *= radians, phi *= radians;
16237 phi = phi / 2 + quarterPi;
16238 var dLambda = lambda - lambda0, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos(phi), sinPhi = sin(phi), k2 = sinPhi0 * sinPhi, u2 = cosPhi0 * cosPhi + k2 * cos(adLambda), v2 = k2 * sdLambda * sin(adLambda);
16239 areaRingSum.add(atan2(v2, u2));
16240 lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
16242 function area_default(object) {
16243 areaSum = new Adder();
16244 stream_default(object, areaStream);
16245 return areaSum * 2;
16248 // node_modules/d3-geo/src/cartesian.js
16249 function spherical(cartesian2) {
16250 return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
16252 function cartesian(spherical2) {
16253 var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
16254 return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
16256 function cartesianDot(a2, b2) {
16257 return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
16259 function cartesianCross(a2, b2) {
16260 return [a2[1] * b2[2] - a2[2] * b2[1], a2[2] * b2[0] - a2[0] * b2[2], a2[0] * b2[1] - a2[1] * b2[0]];
16262 function cartesianAddInPlace(a2, b2) {
16263 a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
16265 function cartesianScale(vector, k2) {
16266 return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
16268 function cartesianNormalizeInPlace(d2) {
16269 var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
16270 d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
16273 // node_modules/d3-geo/src/bounds.js
16285 var boundsStream = {
16286 point: boundsPoint,
16287 lineStart: boundsLineStart,
16288 lineEnd: boundsLineEnd,
16289 polygonStart: function() {
16290 boundsStream.point = boundsRingPoint;
16291 boundsStream.lineStart = boundsRingStart;
16292 boundsStream.lineEnd = boundsRingEnd;
16293 deltaSum = new Adder();
16294 areaStream.polygonStart();
16296 polygonEnd: function() {
16297 areaStream.polygonEnd();
16298 boundsStream.point = boundsPoint;
16299 boundsStream.lineStart = boundsLineStart;
16300 boundsStream.lineEnd = boundsLineEnd;
16301 if (areaRingSum < 0)
16302 lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16303 else if (deltaSum > epsilon)
16305 else if (deltaSum < -epsilon)
16307 range2[0] = lambda02, range2[1] = lambda1;
16309 sphere: function() {
16310 lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
16313 function boundsPoint(lambda, phi) {
16314 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16320 function linePoint(lambda, phi) {
16321 var p2 = cartesian([lambda * radians, phi * radians]);
16323 var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
16324 cartesianNormalizeInPlace(inflection);
16325 inflection = spherical(inflection);
16326 var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
16327 if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16328 phii = inflection[1] * degrees;
16331 } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
16332 phii = -inflection[1] * degrees;
16341 if (antimeridian) {
16342 if (lambda < lambda2) {
16343 if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16346 if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16350 if (lambda1 >= lambda02) {
16351 if (lambda < lambda02)
16353 if (lambda > lambda1)
16356 if (lambda > lambda2) {
16357 if (angle(lambda02, lambda) > angle(lambda02, lambda1))
16360 if (angle(lambda, lambda1) > angle(lambda02, lambda1))
16366 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
16372 p0 = p2, lambda2 = lambda;
16374 function boundsLineStart() {
16375 boundsStream.point = linePoint;
16377 function boundsLineEnd() {
16378 range2[0] = lambda02, range2[1] = lambda1;
16379 boundsStream.point = boundsPoint;
16382 function boundsRingPoint(lambda, phi) {
16384 var delta = lambda - lambda2;
16385 deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
16387 lambda002 = lambda, phi002 = phi;
16389 areaStream.point(lambda, phi);
16390 linePoint(lambda, phi);
16392 function boundsRingStart() {
16393 areaStream.lineStart();
16395 function boundsRingEnd() {
16396 boundsRingPoint(lambda002, phi002);
16397 areaStream.lineEnd();
16398 if (abs(deltaSum) > epsilon)
16399 lambda02 = -(lambda1 = 180);
16400 range2[0] = lambda02, range2[1] = lambda1;
16403 function angle(lambda04, lambda12) {
16404 return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
16406 function rangeCompare(a2, b2) {
16407 return a2[0] - b2[0];
16409 function rangeContains(range3, x2) {
16410 return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
16412 function bounds_default(feature3) {
16413 var i3, n3, a2, b2, merged, deltaMax, delta;
16414 phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
16416 stream_default(feature3, boundsStream);
16417 if (n3 = ranges.length) {
16418 ranges.sort(rangeCompare);
16419 for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
16421 if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
16422 if (angle(a2[0], b2[1]) > angle(a2[0], a2[1]))
16424 if (angle(b2[0], a2[1]) > angle(a2[0], a2[1]))
16427 merged.push(a2 = b2);
16430 for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
16432 if ((delta = angle(a2[1], b2[0])) > deltaMax)
16433 deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
16436 ranges = range2 = null;
16437 return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
16440 // node_modules/d3-geo/src/compose.js
16441 function compose_default(a2, b2) {
16442 function compose(x2, y2) {
16443 return x2 = a2(x2, y2), b2(x2[0], x2[1]);
16445 if (a2.invert && b2.invert)
16446 compose.invert = function(x2, y2) {
16447 return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
16452 // node_modules/d3-geo/src/rotation.js
16453 function rotationIdentity(lambda, phi) {
16454 return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
16456 rotationIdentity.invert = rotationIdentity;
16457 function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
16458 return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
16460 function forwardRotationLambda(deltaLambda) {
16461 return function(lambda, phi) {
16462 return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
16465 function rotationLambda(deltaLambda) {
16466 var rotation = forwardRotationLambda(deltaLambda);
16467 rotation.invert = forwardRotationLambda(-deltaLambda);
16470 function rotationPhiGamma(deltaPhi, deltaGamma) {
16471 var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
16472 function rotation(lambda, phi) {
16473 var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
16475 atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
16476 asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
16479 rotation.invert = function(lambda, phi) {
16480 var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
16482 atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
16483 asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
16488 function rotation_default(rotate) {
16489 rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
16490 function forward(coordinates) {
16491 coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
16492 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16494 forward.invert = function(coordinates) {
16495 coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
16496 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
16501 // node_modules/d3-geo/src/circle.js
16502 function circleStream(stream, radius, delta, direction, t0, t1) {
16505 var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
16507 t0 = radius + direction * tau;
16508 t1 = radius - step / 2;
16510 t0 = circleRadius(cosRadius, t0);
16511 t1 = circleRadius(cosRadius, t1);
16512 if (direction > 0 ? t0 < t1 : t0 > t1)
16513 t0 += direction * tau;
16515 for (var point2, t2 = t0; direction > 0 ? t2 > t1 : t2 < t1; t2 -= step) {
16516 point2 = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
16517 stream.point(point2[0], point2[1]);
16520 function circleRadius(cosRadius, point2) {
16521 point2 = cartesian(point2), point2[0] -= cosRadius;
16522 cartesianNormalizeInPlace(point2);
16523 var radius = acos(-point2[1]);
16524 return ((-point2[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
16527 // node_modules/d3-geo/src/clip/buffer.js
16528 function buffer_default() {
16529 var lines = [], line;
16531 point: function(x2, y2, m2) {
16532 line.push([x2, y2, m2]);
16534 lineStart: function() {
16535 lines.push(line = []);
16538 rejoin: function() {
16539 if (lines.length > 1)
16540 lines.push(lines.pop().concat(lines.shift()));
16542 result: function() {
16543 var result = lines;
16551 // node_modules/d3-geo/src/pointEqual.js
16552 function pointEqual_default(a2, b2) {
16553 return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
16556 // node_modules/d3-geo/src/clip/rejoin.js
16557 function Intersection(point2, points, other, entry) {
16563 this.n = this.p = null;
16565 function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
16566 var subject = [], clip = [], i3, n3;
16567 segments.forEach(function(segment) {
16568 if ((n4 = segment.length - 1) <= 0)
16570 var n4, p02 = segment[0], p1 = segment[n4], x2;
16571 if (pointEqual_default(p02, p1)) {
16572 if (!p02[2] && !p1[2]) {
16573 stream.lineStart();
16574 for (i3 = 0; i3 < n4; ++i3)
16575 stream.point((p02 = segment[i3])[0], p02[1]);
16579 p1[0] += 2 * epsilon;
16581 subject.push(x2 = new Intersection(p02, segment, null, true));
16582 clip.push(x2.o = new Intersection(p02, null, x2, false));
16583 subject.push(x2 = new Intersection(p1, segment, null, false));
16584 clip.push(x2.o = new Intersection(p1, null, x2, true));
16586 if (!subject.length)
16588 clip.sort(compareIntersection2);
16591 for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
16592 clip[i3].e = startInside = !startInside;
16594 var start2 = subject[0], points, point2;
16596 var current = start2, isSubject = true;
16598 if ((current = current.n) === start2)
16600 points = current.z;
16601 stream.lineStart();
16603 current.v = current.o.v = true;
16606 for (i3 = 0, n3 = points.length; i3 < n3; ++i3)
16607 stream.point((point2 = points[i3])[0], point2[1]);
16609 interpolate(current.x, current.n.x, 1, stream);
16611 current = current.n;
16614 points = current.p.z;
16615 for (i3 = points.length - 1; i3 >= 0; --i3)
16616 stream.point((point2 = points[i3])[0], point2[1]);
16618 interpolate(current.x, current.p.x, -1, stream);
16620 current = current.p;
16622 current = current.o;
16623 points = current.z;
16624 isSubject = !isSubject;
16625 } while (!current.v);
16629 function link(array2) {
16630 if (!(n3 = array2.length))
16632 var n3, i3 = 0, a2 = array2[0], b2;
16633 while (++i3 < n3) {
16634 a2.n = b2 = array2[i3];
16638 a2.n = b2 = array2[0];
16642 // node_modules/d3-geo/src/polygonContains.js
16643 function longitude(point2) {
16644 return abs(point2[0]) <= pi ? point2[0] : sign(point2[0]) * ((abs(point2[0]) + pi) % tau - pi);
16646 function polygonContains_default(polygon2, point2) {
16647 var lambda = longitude(point2), phi = point2[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
16648 var sum = new Adder();
16650 phi = halfPi + epsilon;
16651 else if (sinPhi === -1)
16652 phi = -halfPi - epsilon;
16653 for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
16654 if (!(m2 = (ring = polygon2[i3]).length))
16656 var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
16657 for (var j2 = 0; j2 < m2; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
16658 var point1 = ring[j2], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin(phi12), cosPhi1 = cos(phi12), delta = lambda12 - lambda04, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi, k2 = sinPhi03 * sinPhi1;
16659 sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
16660 angle2 += antimeridian ? delta + sign2 * tau : delta;
16661 if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
16662 var arc = cartesianCross(cartesian(point0), cartesian(point1));
16663 cartesianNormalizeInPlace(arc);
16664 var intersection2 = cartesianCross(normal, arc);
16665 cartesianNormalizeInPlace(intersection2);
16666 var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection2[2]);
16667 if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
16668 winding += antimeridian ^ delta >= 0 ? 1 : -1;
16673 return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
16676 // node_modules/d3-geo/src/clip/index.js
16677 function clip_default(pointVisible, clipLine, interpolate, start2) {
16678 return function(sink) {
16679 var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
16684 polygonStart: function() {
16685 clip.point = pointRing;
16686 clip.lineStart = ringStart;
16687 clip.lineEnd = ringEnd;
16691 polygonEnd: function() {
16692 clip.point = point2;
16693 clip.lineStart = lineStart;
16694 clip.lineEnd = lineEnd;
16695 segments = merge(segments);
16696 var startInside = polygonContains_default(polygon2, start2);
16697 if (segments.length) {
16698 if (!polygonStarted)
16699 sink.polygonStart(), polygonStarted = true;
16700 rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
16701 } else if (startInside) {
16702 if (!polygonStarted)
16703 sink.polygonStart(), polygonStarted = true;
16705 interpolate(null, null, 1, sink);
16708 if (polygonStarted)
16709 sink.polygonEnd(), polygonStarted = false;
16710 segments = polygon2 = null;
16712 sphere: function() {
16713 sink.polygonStart();
16715 interpolate(null, null, 1, sink);
16720 function point2(lambda, phi) {
16721 if (pointVisible(lambda, phi))
16722 sink.point(lambda, phi);
16724 function pointLine(lambda, phi) {
16725 line.point(lambda, phi);
16727 function lineStart() {
16728 clip.point = pointLine;
16731 function lineEnd() {
16732 clip.point = point2;
16735 function pointRing(lambda, phi) {
16736 ring.push([lambda, phi]);
16737 ringSink.point(lambda, phi);
16739 function ringStart() {
16740 ringSink.lineStart();
16743 function ringEnd() {
16744 pointRing(ring[0][0], ring[0][1]);
16745 ringSink.lineEnd();
16746 var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point3;
16748 polygon2.push(ring);
16753 segment = ringSegments[0];
16754 if ((m2 = segment.length - 1) > 0) {
16755 if (!polygonStarted)
16756 sink.polygonStart(), polygonStarted = true;
16758 for (i3 = 0; i3 < m2; ++i3)
16759 sink.point((point3 = segment[i3])[0], point3[1]);
16764 if (n3 > 1 && clean2 & 2)
16765 ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
16766 segments.push(ringSegments.filter(validSegment));
16771 function validSegment(segment) {
16772 return segment.length > 1;
16774 function compareIntersection(a2, b2) {
16775 return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi - epsilon : halfPi - a2[1]) - ((b2 = b2.x)[0] < 0 ? b2[1] - halfPi - epsilon : halfPi - b2[1]);
16778 // node_modules/d3-geo/src/clip/antimeridian.js
16779 var antimeridian_default = clip_default(
16783 clipAntimeridianLine,
16784 clipAntimeridianInterpolate,
16787 function clipAntimeridianLine(stream) {
16788 var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
16790 lineStart: function() {
16791 stream.lineStart();
16794 point: function(lambda12, phi12) {
16795 var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
16796 if (abs(delta - pi) < epsilon) {
16797 stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
16798 stream.point(sign0, phi02);
16800 stream.lineStart();
16801 stream.point(sign1, phi02);
16802 stream.point(lambda12, phi02);
16804 } else if (sign0 !== sign1 && delta >= pi) {
16805 if (abs(lambda04 - sign0) < epsilon)
16806 lambda04 -= sign0 * epsilon;
16807 if (abs(lambda12 - sign1) < epsilon)
16808 lambda12 -= sign1 * epsilon;
16809 phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
16810 stream.point(sign0, phi02);
16812 stream.lineStart();
16813 stream.point(sign1, phi02);
16816 stream.point(lambda04 = lambda12, phi02 = phi12);
16819 lineEnd: function() {
16821 lambda04 = phi02 = NaN;
16823 clean: function() {
16828 function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
16829 var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
16830 return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi02) * (cosPhi1 = cos(phi12)) * sin(lambda12) - sin(phi12) * (cosPhi03 = cos(phi02)) * sin(lambda04)) / (cosPhi03 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2;
16832 function clipAntimeridianInterpolate(from, to, direction, stream) {
16834 if (from == null) {
16835 phi = direction * halfPi;
16836 stream.point(-pi, phi);
16837 stream.point(0, phi);
16838 stream.point(pi, phi);
16839 stream.point(pi, 0);
16840 stream.point(pi, -phi);
16841 stream.point(0, -phi);
16842 stream.point(-pi, -phi);
16843 stream.point(-pi, 0);
16844 stream.point(-pi, phi);
16845 } else if (abs(from[0] - to[0]) > epsilon) {
16846 var lambda = from[0] < to[0] ? pi : -pi;
16847 phi = direction * lambda / 2;
16848 stream.point(-lambda, phi);
16849 stream.point(0, phi);
16850 stream.point(lambda, phi);
16852 stream.point(to[0], to[1]);
16856 // node_modules/d3-geo/src/clip/circle.js
16857 function circle_default(radius) {
16858 var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
16859 function interpolate(from, to, direction, stream) {
16860 circleStream(stream, radius, delta, direction, from, to);
16862 function visible(lambda, phi) {
16863 return cos(lambda) * cos(phi) > cr;
16865 function clipLine(stream) {
16866 var point0, c0, v0, v00, clean2;
16868 lineStart: function() {
16872 point: function(lambda, phi) {
16873 var point1 = [lambda, phi], point2, v2 = visible(lambda, phi), c2 = smallRadius ? v2 ? 0 : code(lambda, phi) : v2 ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0;
16874 if (!point0 && (v00 = v0 = v2))
16875 stream.lineStart();
16877 point2 = intersect2(point0, point1);
16878 if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
16884 stream.lineStart();
16885 point2 = intersect2(point1, point0);
16886 stream.point(point2[0], point2[1]);
16888 point2 = intersect2(point0, point1);
16889 stream.point(point2[0], point2[1], 2);
16893 } else if (notHemisphere && point0 && smallRadius ^ v2) {
16895 if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
16898 stream.lineStart();
16899 stream.point(t2[0][0], t2[0][1]);
16900 stream.point(t2[1][0], t2[1][1]);
16903 stream.point(t2[1][0], t2[1][1]);
16905 stream.lineStart();
16906 stream.point(t2[0][0], t2[0][1], 3);
16910 if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
16911 stream.point(point1[0], point1[1]);
16913 point0 = point1, v0 = v2, c0 = c2;
16915 lineEnd: function() {
16920 // Rejoin first and last segments if there were intersections and the first
16921 // and last points were visible.
16922 clean: function() {
16923 return clean2 | (v00 && v0) << 1;
16927 function intersect2(a2, b2, two) {
16928 var pa = cartesian(a2), pb = cartesian(b2);
16929 var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
16932 var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
16933 cartesianAddInPlace(A2, B2);
16934 var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
16937 var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
16938 cartesianAddInPlace(q2, A2);
16939 q2 = spherical(q2);
16942 var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
16943 if (lambda12 < lambda04)
16944 z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
16945 var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
16946 if (!polar && phi12 < phi02)
16947 z2 = phi02, phi02 = phi12, phi12 = z2;
16948 if (meridian ? polar ? phi02 + phi12 > 0 ^ q2[1] < (abs(q2[0] - lambda04) < epsilon ? phi02 : phi12) : phi02 <= q2[1] && q2[1] <= phi12 : delta2 > pi ^ (lambda04 <= q2[0] && q2[0] <= lambda12)) {
16949 var q1 = cartesianScale(u2, (-w2 + t3) / uu);
16950 cartesianAddInPlace(q1, A2);
16951 return [q2, spherical(q1)];
16954 function code(lambda, phi) {
16955 var r2 = smallRadius ? radius : pi - radius, code2 = 0;
16958 else if (lambda > r2)
16966 return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
16969 // node_modules/d3-geo/src/clip/line.js
16970 function line_default(a2, b2, x05, y05, x12, y12) {
16971 var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r2;
16981 } else if (dx > 0) {
16996 } else if (dx > 0) {
17011 } else if (dy > 0) {
17026 } else if (dy > 0) {
17033 a2[0] = ax + t0 * dx, a2[1] = ay + t0 * dy;
17035 b2[0] = ax + t1 * dx, b2[1] = ay + t1 * dy;
17039 // node_modules/d3-geo/src/clip/rectangle.js
17041 var clipMin = -clipMax;
17042 function clipRectangle(x05, y05, x12, y12) {
17043 function visible(x2, y2) {
17044 return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
17046 function interpolate(from, to, direction, stream) {
17047 var a2 = 0, a1 = 0;
17048 if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
17050 stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
17051 while ((a2 = (a2 + direction + 4) % 4) !== a1);
17053 stream.point(to[0], to[1]);
17056 function corner(p2, direction) {
17057 return abs(p2[0] - x05) < epsilon ? direction > 0 ? 0 : 3 : abs(p2[0] - x12) < epsilon ? direction > 0 ? 2 : 1 : abs(p2[1] - y05) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2;
17059 function compareIntersection2(a2, b2) {
17060 return comparePoint(a2.x, b2.x);
17062 function comparePoint(a2, b2) {
17063 var ca = corner(a2, 1), cb = corner(b2, 1);
17064 return ca !== cb ? ca - cb : ca === 0 ? b2[1] - a2[1] : ca === 1 ? a2[0] - b2[0] : ca === 2 ? a2[1] - b2[1] : b2[0] - a2[0];
17066 return function(stream) {
17067 var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
17075 function point2(x2, y2) {
17076 if (visible(x2, y2))
17077 activeStream.point(x2, y2);
17079 function polygonInside() {
17081 for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
17082 for (var ring2 = polygon2[i3], j2 = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b0 = point3[0], b1 = point3[1]; j2 < m2; ++j2) {
17083 a0 = b0, a1 = b1, point3 = ring2[j2], b0 = point3[0], b1 = point3[1];
17085 if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0))
17088 if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0))
17095 function polygonStart() {
17096 activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
17098 function polygonEnd() {
17099 var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
17100 if (cleanInside || visible2) {
17101 stream.polygonStart();
17103 stream.lineStart();
17104 interpolate(null, null, 1, stream);
17108 rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
17110 stream.polygonEnd();
17112 activeStream = stream, segments = polygon2 = ring = null;
17114 function lineStart() {
17115 clipStream.point = linePoint2;
17117 polygon2.push(ring = []);
17122 function lineEnd() {
17124 linePoint2(x__, y__);
17126 bufferStream.rejoin();
17127 segments.push(bufferStream.result());
17129 clipStream.point = point2;
17131 activeStream.lineEnd();
17133 function linePoint2(x2, y2) {
17134 var v2 = visible(x2, y2);
17136 ring.push([x2, y2]);
17138 x__ = x2, y__ = y2, v__ = v2;
17141 activeStream.lineStart();
17142 activeStream.point(x2, y2);
17146 activeStream.point(x2, y2);
17148 var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b2 = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))];
17149 if (line_default(a2, b2, x05, y05, x12, y12)) {
17151 activeStream.lineStart();
17152 activeStream.point(a2[0], a2[1]);
17154 activeStream.point(b2[0], b2[1]);
17156 activeStream.lineEnd();
17159 activeStream.lineStart();
17160 activeStream.point(x2, y2);
17165 x_ = x2, y_ = y2, v_ = v2;
17171 // node_modules/d3-geo/src/length.js
17176 var lengthStream = {
17179 lineStart: lengthLineStart,
17181 polygonStart: noop,
17184 function lengthLineStart() {
17185 lengthStream.point = lengthPointFirst;
17186 lengthStream.lineEnd = lengthLineEnd;
17188 function lengthLineEnd() {
17189 lengthStream.point = lengthStream.lineEnd = noop;
17191 function lengthPointFirst(lambda, phi) {
17192 lambda *= radians, phi *= radians;
17193 lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
17194 lengthStream.point = lengthPoint;
17196 function lengthPoint(lambda, phi) {
17197 lambda *= radians, phi *= radians;
17198 var sinPhi = sin(phi), cosPhi = cos(phi), delta = abs(lambda - lambda03), cosDelta = cos(delta), sinDelta = sin(delta), x2 = cosPhi * sinDelta, y2 = cosPhi02 * sinPhi - sinPhi02 * cosPhi * cosDelta, z2 = sinPhi02 * sinPhi + cosPhi02 * cosPhi * cosDelta;
17199 lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
17200 lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
17202 function length_default(object) {
17203 lengthSum = new Adder();
17204 stream_default(object, lengthStream);
17208 // node_modules/d3-geo/src/identity.js
17209 var identity_default = (x2) => x2;
17211 // node_modules/d3-geo/src/path/area.js
17212 var areaSum2 = new Adder();
17213 var areaRingSum2 = new Adder();
17218 var areaStream2 = {
17222 polygonStart: function() {
17223 areaStream2.lineStart = areaRingStart2;
17224 areaStream2.lineEnd = areaRingEnd2;
17226 polygonEnd: function() {
17227 areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
17228 areaSum2.add(abs(areaRingSum2));
17229 areaRingSum2 = new Adder();
17231 result: function() {
17232 var area = areaSum2 / 2;
17233 areaSum2 = new Adder();
17237 function areaRingStart2() {
17238 areaStream2.point = areaPointFirst2;
17240 function areaPointFirst2(x2, y2) {
17241 areaStream2.point = areaPoint2;
17242 x00 = x0 = x2, y00 = y0 = y2;
17244 function areaPoint2(x2, y2) {
17245 areaRingSum2.add(y0 * x2 - x0 * y2);
17248 function areaRingEnd2() {
17249 areaPoint2(x00, y00);
17251 var area_default2 = areaStream2;
17253 // node_modules/d3-geo/src/path/bounds.js
17254 var x02 = Infinity;
17258 var boundsStream2 = {
17259 point: boundsPoint2,
17262 polygonStart: noop,
17264 result: function() {
17265 var bounds = [[x02, y02], [x1, y1]];
17266 x1 = y1 = -(y02 = x02 = Infinity);
17270 function boundsPoint2(x2, y2) {
17280 var bounds_default2 = boundsStream2;
17282 // node_modules/d3-geo/src/path/centroid.js
17296 var centroidStream = {
17297 point: centroidPoint,
17298 lineStart: centroidLineStart,
17299 lineEnd: centroidLineEnd,
17300 polygonStart: function() {
17301 centroidStream.lineStart = centroidRingStart;
17302 centroidStream.lineEnd = centroidRingEnd;
17304 polygonEnd: function() {
17305 centroidStream.point = centroidPoint;
17306 centroidStream.lineStart = centroidLineStart;
17307 centroidStream.lineEnd = centroidLineEnd;
17309 result: function() {
17310 var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
17311 X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
17315 function centroidPoint(x2, y2) {
17320 function centroidLineStart() {
17321 centroidStream.point = centroidPointFirstLine;
17323 function centroidPointFirstLine(x2, y2) {
17324 centroidStream.point = centroidPointLine;
17325 centroidPoint(x03 = x2, y03 = y2);
17327 function centroidPointLine(x2, y2) {
17328 var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
17329 X1 += z2 * (x03 + x2) / 2;
17330 Y1 += z2 * (y03 + y2) / 2;
17332 centroidPoint(x03 = x2, y03 = y2);
17334 function centroidLineEnd() {
17335 centroidStream.point = centroidPoint;
17337 function centroidRingStart() {
17338 centroidStream.point = centroidPointFirstRing;
17340 function centroidRingEnd() {
17341 centroidPointRing(x002, y002);
17343 function centroidPointFirstRing(x2, y2) {
17344 centroidStream.point = centroidPointRing;
17345 centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
17347 function centroidPointRing(x2, y2) {
17348 var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
17349 X1 += z2 * (x03 + x2) / 2;
17350 Y1 += z2 * (y03 + y2) / 2;
17352 z2 = y03 * x2 - x03 * y2;
17353 X2 += z2 * (x03 + x2);
17354 Y2 += z2 * (y03 + y2);
17356 centroidPoint(x03 = x2, y03 = y2);
17358 var centroid_default = centroidStream;
17360 // node_modules/d3-geo/src/path/context.js
17361 function PathContext(context) {
17362 this._context = context;
17364 PathContext.prototype = {
17366 pointRadius: function(_2) {
17367 return this._radius = _2, this;
17369 polygonStart: function() {
17372 polygonEnd: function() {
17375 lineStart: function() {
17378 lineEnd: function() {
17379 if (this._line === 0)
17380 this._context.closePath();
17383 point: function(x2, y2) {
17384 switch (this._point) {
17386 this._context.moveTo(x2, y2);
17391 this._context.lineTo(x2, y2);
17395 this._context.moveTo(x2 + this._radius, y2);
17396 this._context.arc(x2, y2, this._radius, 0, tau);
17404 // node_modules/d3-geo/src/path/measure.js
17405 var lengthSum2 = new Adder();
17411 var lengthStream2 = {
17413 lineStart: function() {
17414 lengthStream2.point = lengthPointFirst2;
17416 lineEnd: function() {
17418 lengthPoint2(x003, y003);
17419 lengthStream2.point = noop;
17421 polygonStart: function() {
17424 polygonEnd: function() {
17427 result: function() {
17428 var length2 = +lengthSum2;
17429 lengthSum2 = new Adder();
17433 function lengthPointFirst2(x2, y2) {
17434 lengthStream2.point = lengthPoint2;
17435 x003 = x04 = x2, y003 = y04 = y2;
17437 function lengthPoint2(x2, y2) {
17438 x04 -= x2, y04 -= y2;
17439 lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
17440 x04 = x2, y04 = y2;
17442 var measure_default = lengthStream2;
17444 // node_modules/d3-geo/src/path/string.js
17445 function PathString() {
17448 PathString.prototype = {
17450 _circle: circle(4.5),
17451 pointRadius: function(_2) {
17452 if ((_2 = +_2) !== this._radius)
17453 this._radius = _2, this._circle = null;
17456 polygonStart: function() {
17459 polygonEnd: function() {
17462 lineStart: function() {
17465 lineEnd: function() {
17466 if (this._line === 0)
17467 this._string.push("Z");
17470 point: function(x2, y2) {
17471 switch (this._point) {
17473 this._string.push("M", x2, ",", y2);
17478 this._string.push("L", x2, ",", y2);
17482 if (this._circle == null)
17483 this._circle = circle(this._radius);
17484 this._string.push("M", x2, ",", y2, this._circle);
17489 result: function() {
17490 if (this._string.length) {
17491 var result = this._string.join("");
17499 function circle(radius) {
17500 return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
17503 // node_modules/d3-geo/src/path/index.js
17504 function path_default(projection2, context) {
17505 var pointRadius = 4.5, projectionStream, contextStream;
17506 function path(object) {
17508 if (typeof pointRadius === "function")
17509 contextStream.pointRadius(+pointRadius.apply(this, arguments));
17510 stream_default(object, projectionStream(contextStream));
17512 return contextStream.result();
17514 path.area = function(object) {
17515 stream_default(object, projectionStream(area_default2));
17516 return area_default2.result();
17518 path.measure = function(object) {
17519 stream_default(object, projectionStream(measure_default));
17520 return measure_default.result();
17522 path.bounds = function(object) {
17523 stream_default(object, projectionStream(bounds_default2));
17524 return bounds_default2.result();
17526 path.centroid = function(object) {
17527 stream_default(object, projectionStream(centroid_default));
17528 return centroid_default.result();
17530 path.projection = function(_2) {
17531 return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream, path) : projection2;
17533 path.context = function(_2) {
17534 if (!arguments.length)
17536 contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2);
17537 if (typeof pointRadius !== "function")
17538 contextStream.pointRadius(pointRadius);
17541 path.pointRadius = function(_2) {
17542 if (!arguments.length)
17543 return pointRadius;
17544 pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
17547 return path.projection(projection2).context(context);
17550 // node_modules/d3-geo/src/transform.js
17551 function transform_default(methods2) {
17553 stream: transformer(methods2)
17556 function transformer(methods2) {
17557 return function(stream) {
17558 var s2 = new TransformStream();
17559 for (var key in methods2)
17560 s2[key] = methods2[key];
17561 s2.stream = stream;
17565 function TransformStream() {
17567 TransformStream.prototype = {
17568 constructor: TransformStream,
17569 point: function(x2, y2) {
17570 this.stream.point(x2, y2);
17572 sphere: function() {
17573 this.stream.sphere();
17575 lineStart: function() {
17576 this.stream.lineStart();
17578 lineEnd: function() {
17579 this.stream.lineEnd();
17581 polygonStart: function() {
17582 this.stream.polygonStart();
17584 polygonEnd: function() {
17585 this.stream.polygonEnd();
17589 // node_modules/d3-geo/src/projection/fit.js
17590 function fit(projection2, fitBounds, object) {
17591 var clip = projection2.clipExtent && projection2.clipExtent();
17592 projection2.scale(150).translate([0, 0]);
17594 projection2.clipExtent(null);
17595 stream_default(object, projection2.stream(bounds_default2));
17596 fitBounds(bounds_default2.result());
17598 projection2.clipExtent(clip);
17599 return projection2;
17601 function fitExtent(projection2, extent, object) {
17602 return fit(projection2, function(b2) {
17603 var w2 = extent[1][0] - extent[0][0], h2 = extent[1][1] - extent[0][1], k2 = Math.min(w2 / (b2[1][0] - b2[0][0]), h2 / (b2[1][1] - b2[0][1])), x2 = +extent[0][0] + (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = +extent[0][1] + (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
17604 projection2.scale(150 * k2).translate([x2, y2]);
17607 function fitSize(projection2, size, object) {
17608 return fitExtent(projection2, [[0, 0], size], object);
17610 function fitWidth(projection2, width, object) {
17611 return fit(projection2, function(b2) {
17612 var w2 = +width, k2 = w2 / (b2[1][0] - b2[0][0]), x2 = (w2 - k2 * (b2[1][0] + b2[0][0])) / 2, y2 = -k2 * b2[0][1];
17613 projection2.scale(150 * k2).translate([x2, y2]);
17616 function fitHeight(projection2, height, object) {
17617 return fit(projection2, function(b2) {
17618 var h2 = +height, k2 = h2 / (b2[1][1] - b2[0][1]), x2 = -k2 * b2[0][0], y2 = (h2 - k2 * (b2[1][1] + b2[0][1])) / 2;
17619 projection2.scale(150 * k2).translate([x2, y2]);
17623 // node_modules/d3-geo/src/projection/resample.js
17625 var cosMinDistance = cos(30 * radians);
17626 function resample_default(project, delta2) {
17627 return +delta2 ? resample(project, delta2) : resampleNone(project);
17629 function resampleNone(project) {
17630 return transformer({
17631 point: function(x2, y2) {
17632 x2 = project(x2, y2);
17633 this.stream.point(x2[0], x2[1]);
17637 function resample(project, delta2) {
17638 function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
17639 var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
17640 if (d2 > 4 * delta2 && depth--) {
17641 var a2 = a0 + a1, b2 = b0 + b1, c2 = c0 + c1, m2 = sqrt(a2 * a2 + b2 * b2 + c2 * c2), phi2 = asin(c2 /= m2), lambda22 = abs(abs(c2) - 1) < epsilon || abs(lambda04 - lambda12) < epsilon ? (lambda04 + lambda12) / 2 : atan2(b2, a2), p2 = project(lambda22, phi2), x2 = p2[0], y2 = p2[1], dx2 = x2 - x05, dy2 = y2 - y05, dz = dy * dx2 - dx * dy2;
17642 if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
17643 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
17644 stream.point(x2, y2);
17645 resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
17649 return function(stream) {
17650 var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
17651 var resampleStream = {
17655 polygonStart: function() {
17656 stream.polygonStart();
17657 resampleStream.lineStart = ringStart;
17659 polygonEnd: function() {
17660 stream.polygonEnd();
17661 resampleStream.lineStart = lineStart;
17664 function point2(x2, y2) {
17665 x2 = project(x2, y2);
17666 stream.point(x2[0], x2[1]);
17668 function lineStart() {
17670 resampleStream.point = linePoint2;
17671 stream.lineStart();
17673 function linePoint2(lambda, phi) {
17674 var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
17675 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x05 = p2[0], y05 = p2[1], lambda04 = lambda, a0 = c2[0], b0 = c2[1], c0 = c2[2], maxDepth, stream);
17676 stream.point(x05, y05);
17678 function lineEnd() {
17679 resampleStream.point = point2;
17682 function ringStart() {
17684 resampleStream.point = ringPoint;
17685 resampleStream.lineEnd = ringEnd;
17687 function ringPoint(lambda, phi) {
17688 linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
17689 resampleStream.point = linePoint2;
17691 function ringEnd() {
17692 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
17693 resampleStream.lineEnd = lineEnd;
17696 return resampleStream;
17700 // node_modules/d3-geo/src/projection/index.js
17701 var transformRadians = transformer({
17702 point: function(x2, y2) {
17703 this.stream.point(x2 * radians, y2 * radians);
17706 function transformRotate(rotate) {
17707 return transformer({
17708 point: function(x2, y2) {
17709 var r2 = rotate(x2, y2);
17710 return this.stream.point(r2[0], r2[1]);
17714 function scaleTranslate(k2, dx, dy, sx, sy) {
17715 function transform2(x2, y2) {
17718 return [dx + k2 * x2, dy - k2 * y2];
17720 transform2.invert = function(x2, y2) {
17721 return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
17725 function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
17727 return scaleTranslate(k2, dx, dy, sx, sy);
17728 var cosAlpha = cos(alpha), sinAlpha = sin(alpha), a2 = cosAlpha * k2, b2 = sinAlpha * k2, ai = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2;
17729 function transform2(x2, y2) {
17732 return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
17734 transform2.invert = function(x2, y2) {
17735 return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
17739 function projection(project) {
17740 return projectionMutator(function() {
17744 function projectionMutator(projectAt) {
17745 var project, k2 = 150, x2 = 480, y2 = 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;
17746 function projection2(point2) {
17747 return projectRotateTransform(point2[0] * radians, point2[1] * radians);
17749 function invert(point2) {
17750 point2 = projectRotateTransform.invert(point2[0], point2[1]);
17751 return point2 && [point2[0] * degrees, point2[1] * degrees];
17753 projection2.stream = function(stream) {
17754 return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
17756 projection2.preclip = function(_2) {
17757 return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
17759 projection2.postclip = function(_2) {
17760 return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
17762 projection2.clipAngle = function(_2) {
17763 return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
17765 projection2.clipExtent = function(_2) {
17766 return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
17768 projection2.scale = function(_2) {
17769 return arguments.length ? (k2 = +_2, recenter()) : k2;
17771 projection2.translate = function(_2) {
17772 return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
17774 projection2.center = function(_2) {
17775 return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
17777 projection2.rotate = function(_2) {
17778 return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees];
17780 projection2.angle = function(_2) {
17781 return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
17783 projection2.reflectX = function(_2) {
17784 return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
17786 projection2.reflectY = function(_2) {
17787 return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
17789 projection2.precision = function(_2) {
17790 return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
17792 projection2.fitExtent = function(extent, object) {
17793 return fitExtent(projection2, extent, object);
17795 projection2.fitSize = function(size, object) {
17796 return fitSize(projection2, size, object);
17798 projection2.fitWidth = function(width, object) {
17799 return fitWidth(projection2, width, object);
17801 projection2.fitHeight = function(height, object) {
17802 return fitHeight(projection2, height, object);
17804 function recenter() {
17805 var center = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), transform2 = scaleTranslateRotate(k2, x2 - center[0], y2 - center[1], sx, sy, alpha);
17806 rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
17807 projectTransform = compose_default(project, transform2);
17808 projectRotateTransform = compose_default(rotate, projectTransform);
17809 projectResample = resample_default(projectTransform, delta2);
17813 cache = cacheStream = null;
17814 return projection2;
17816 return function() {
17817 project = projectAt.apply(this, arguments);
17818 projection2.invert = project.invert && invert;
17823 // node_modules/d3-geo/src/projection/mercator.js
17824 function mercatorRaw(lambda, phi) {
17825 return [lambda, log(tan((halfPi + phi) / 2))];
17827 mercatorRaw.invert = function(x2, y2) {
17828 return [x2, 2 * atan(exp(y2)) - halfPi];
17830 function mercator_default() {
17831 return mercatorProjection(mercatorRaw).scale(961 / tau);
17833 function mercatorProjection(project) {
17834 var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
17835 m2.scale = function(_2) {
17836 return arguments.length ? (scale(_2), reclip()) : scale();
17838 m2.translate = function(_2) {
17839 return arguments.length ? (translate(_2), reclip()) : translate();
17841 m2.center = function(_2) {
17842 return arguments.length ? (center(_2), reclip()) : center();
17844 m2.clipExtent = function(_2) {
17845 return arguments.length ? (_2 == null ? x05 = y05 = x12 = y12 = null : (x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x05 == null ? null : [[x05, y05], [x12, y12]];
17847 function reclip() {
17848 var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
17849 return clipExtent(x05 == null ? [[t2[0] - k2, t2[1] - k2], [t2[0] + k2, t2[1] + k2]] : project === mercatorRaw ? [[Math.max(t2[0] - k2, x05), y05], [Math.min(t2[0] + k2, x12), y12]] : [[x05, Math.max(t2[1] - k2, y05)], [x12, Math.min(t2[1] + k2, y12)]]);
17854 // node_modules/d3-geo/src/projection/identity.js
17855 function identity_default2() {
17856 var k2 = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x05 = null, y05, x12, y12, kx = 1, ky = 1, transform2 = transformer({
17857 point: function(x2, y2) {
17858 var p2 = projection2([x2, y2]);
17859 this.stream.point(p2[0], p2[1]);
17861 }), postclip = identity_default, cache, cacheStream;
17865 cache = cacheStream = null;
17866 return projection2;
17868 function projection2(p2) {
17869 var x2 = p2[0] * kx, y2 = p2[1] * ky;
17871 var t2 = y2 * ca - x2 * sa;
17872 x2 = x2 * ca + y2 * sa;
17875 return [x2 + tx, y2 + ty];
17877 projection2.invert = function(p2) {
17878 var x2 = p2[0] - tx, y2 = p2[1] - ty;
17880 var t2 = y2 * ca + x2 * sa;
17881 x2 = x2 * ca - y2 * sa;
17884 return [x2 / kx, y2 / ky];
17886 projection2.stream = function(stream) {
17887 return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
17889 projection2.postclip = function(_2) {
17890 return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
17892 projection2.clipExtent = function(_2) {
17893 return arguments.length ? (postclip = _2 == null ? (x05 = y05 = x12 = y12 = null, identity_default) : clipRectangle(x05 = +_2[0][0], y05 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset()) : x05 == null ? null : [[x05, y05], [x12, y12]];
17895 projection2.scale = function(_2) {
17896 return arguments.length ? (k2 = +_2, reset()) : k2;
17898 projection2.translate = function(_2) {
17899 return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
17901 projection2.angle = function(_2) {
17902 return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
17904 projection2.reflectX = function(_2) {
17905 return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
17907 projection2.reflectY = function(_2) {
17908 return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
17910 projection2.fitExtent = function(extent, object) {
17911 return fitExtent(projection2, extent, object);
17913 projection2.fitSize = function(size, object) {
17914 return fitSize(projection2, size, object);
17916 projection2.fitWidth = function(width, object) {
17917 return fitWidth(projection2, width, object);
17919 projection2.fitHeight = function(height, object) {
17920 return fitHeight(projection2, height, object);
17922 return projection2;
17925 // modules/geo/geo.js
17926 var TAU = 2 * Math.PI;
17927 var EQUATORIAL_RADIUS = 6378137;
17928 var POLAR_RADIUS = 63567523e-1;
17929 function geoLatToMeters(dLat) {
17930 return dLat * (TAU * POLAR_RADIUS / 360);
17932 function geoLonToMeters(dLon, atLat) {
17933 return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
17935 function geoMetersToLat(m2) {
17936 return m2 / (TAU * POLAR_RADIUS / 360);
17938 function geoMetersToLon(m2, atLat) {
17939 return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
17941 function geoMetersToOffset(meters, tileSize) {
17942 tileSize = tileSize || 256;
17944 meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
17945 -meters[1] * tileSize / (TAU * POLAR_RADIUS)
17948 function geoOffsetToMeters(offset, tileSize) {
17949 tileSize = tileSize || 256;
17951 offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
17952 -offset[1] * TAU * POLAR_RADIUS / tileSize
17955 function geoSphericalDistance(a2, b2) {
17956 var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
17957 var y2 = geoLatToMeters(a2[1] - b2[1]);
17958 return Math.sqrt(x2 * x2 + y2 * y2);
17960 function geoScaleToZoom(k2, tileSize) {
17961 tileSize = tileSize || 256;
17962 var log2ts = Math.log(tileSize) * Math.LOG2E;
17963 return Math.log(k2 * TAU) / Math.LN2 - log2ts;
17965 function geoZoomToScale(z2, tileSize) {
17966 tileSize = tileSize || 256;
17967 return tileSize * Math.pow(2, z2) / TAU;
17969 function geoSphericalClosestNode(nodes, point2) {
17970 var minDistance = Infinity, distance;
17972 for (var i3 in nodes) {
17973 distance = geoSphericalDistance(nodes[i3].loc, point2);
17974 if (distance < minDistance) {
17975 minDistance = distance;
17979 if (indexOfMin !== void 0) {
17980 return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
17986 // modules/geo/extent.js
17987 function geoExtent(min3, max3) {
17988 if (!(this instanceof geoExtent)) {
17989 return new geoExtent(min3, max3);
17990 } else if (min3 instanceof geoExtent) {
17992 } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
17996 this[0] = min3 || [Infinity, Infinity];
17997 this[1] = max3 || min3 || [-Infinity, -Infinity];
18000 geoExtent.prototype = new Array(2);
18001 Object.assign(geoExtent.prototype, {
18002 equals: function(obj) {
18003 return this[0][0] === obj[0][0] && this[0][1] === obj[0][1] && this[1][0] === obj[1][0] && this[1][1] === obj[1][1];
18005 extend: function(obj) {
18006 if (!(obj instanceof geoExtent))
18007 obj = new geoExtent(obj);
18009 [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
18010 [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
18013 _extend: function(extent) {
18014 this[0][0] = Math.min(extent[0][0], this[0][0]);
18015 this[0][1] = Math.min(extent[0][1], this[0][1]);
18016 this[1][0] = Math.max(extent[1][0], this[1][0]);
18017 this[1][1] = Math.max(extent[1][1], this[1][1]);
18020 return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
18022 center: function() {
18023 return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
18025 rectangle: function() {
18026 return [this[0][0], this[0][1], this[1][0], this[1][1]];
18029 return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
18031 polygon: function() {
18033 [this[0][0], this[0][1]],
18034 [this[0][0], this[1][1]],
18035 [this[1][0], this[1][1]],
18036 [this[1][0], this[0][1]],
18037 [this[0][0], this[0][1]]
18040 contains: function(obj) {
18041 if (!(obj instanceof geoExtent))
18042 obj = new geoExtent(obj);
18043 return obj[0][0] >= this[0][0] && obj[0][1] >= this[0][1] && obj[1][0] <= this[1][0] && obj[1][1] <= this[1][1];
18045 intersects: function(obj) {
18046 if (!(obj instanceof geoExtent))
18047 obj = new geoExtent(obj);
18048 return obj[0][0] <= this[1][0] && obj[0][1] <= this[1][1] && obj[1][0] >= this[0][0] && obj[1][1] >= this[0][1];
18050 intersection: function(obj) {
18051 if (!this.intersects(obj))
18052 return new geoExtent();
18053 return new geoExtent(
18054 [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
18055 [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
18058 percentContainedIn: function(obj) {
18059 if (!(obj instanceof geoExtent))
18060 obj = new geoExtent(obj);
18061 var a1 = this.intersection(obj).area();
18062 var a2 = this.area();
18063 if (a1 === Infinity || a2 === Infinity) {
18065 } else if (a1 === 0 || a2 === 0) {
18066 if (obj.contains(this)) {
18074 padByMeters: function(meters) {
18075 var dLat = geoMetersToLat(meters);
18076 var dLon = geoMetersToLon(meters, this.center()[1]);
18078 [this[0][0] - dLon, this[0][1] - dLat],
18079 [this[1][0] + dLon, this[1][1] + dLat]
18082 toParam: function() {
18083 return this.rectangle().join(",");
18085 split: function() {
18086 const center = this.center();
18088 geoExtent(this[0], center),
18089 geoExtent([center[0], this[0][1]], [this[1][0], center[1]]),
18090 geoExtent(center, this[1]),
18091 geoExtent([this[0][0], center[1]], [center[0], this[1][1]])
18096 // node_modules/d3-polygon/src/area.js
18097 function area_default3(polygon2) {
18098 var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
18099 while (++i3 < n3) {
18102 area += a2[1] * b2[0] - a2[0] * b2[1];
18107 // node_modules/d3-polygon/src/centroid.js
18108 function centroid_default2(polygon2) {
18109 var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
18110 while (++i3 < n3) {
18113 k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
18114 x2 += (a2[0] + b2[0]) * c2;
18115 y2 += (a2[1] + b2[1]) * c2;
18117 return k2 *= 3, [x2 / k2, y2 / k2];
18120 // node_modules/d3-polygon/src/cross.js
18121 function cross_default(a2, b2, c2) {
18122 return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
18125 // node_modules/d3-polygon/src/hull.js
18126 function lexicographicOrder(a2, b2) {
18127 return a2[0] - b2[0] || a2[1] - b2[1];
18129 function computeUpperHullIndexes(points) {
18130 const n3 = points.length, indexes = [0, 1];
18132 for (i3 = 2; i3 < n3; ++i3) {
18133 while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0)
18135 indexes[size++] = i3;
18137 return indexes.slice(0, size);
18139 function hull_default(points) {
18140 if ((n3 = points.length) < 3)
18142 var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
18143 for (i3 = 0; i3 < n3; ++i3)
18144 sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
18145 sortedPoints.sort(lexicographicOrder);
18146 for (i3 = 0; i3 < n3; ++i3)
18147 flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
18148 var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
18149 var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
18150 for (i3 = upperIndexes.length - 1; i3 >= 0; --i3)
18151 hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
18152 for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3)
18153 hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
18157 // modules/geo/vector.js
18158 function geoVecEqual(a2, b2, epsilon3) {
18160 return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
18162 return a2[0] === b2[0] && a2[1] === b2[1];
18165 function geoVecAdd(a2, b2) {
18166 return [a2[0] + b2[0], a2[1] + b2[1]];
18168 function geoVecSubtract(a2, b2) {
18169 return [a2[0] - b2[0], a2[1] - b2[1]];
18171 function geoVecScale(a2, mag) {
18172 return [a2[0] * mag, a2[1] * mag];
18174 function geoVecFloor(a2) {
18175 return [Math.floor(a2[0]), Math.floor(a2[1])];
18177 function geoVecInterp(a2, b2, t2) {
18179 a2[0] + (b2[0] - a2[0]) * t2,
18180 a2[1] + (b2[1] - a2[1]) * t2
18183 function geoVecLength(a2, b2) {
18184 return Math.sqrt(geoVecLengthSquare(a2, b2));
18186 function geoVecLengthSquare(a2, b2) {
18188 var x2 = a2[0] - b2[0];
18189 var y2 = a2[1] - b2[1];
18190 return x2 * x2 + y2 * y2;
18192 function geoVecNormalize(a2) {
18193 var length2 = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
18194 if (length2 !== 0) {
18195 return geoVecScale(a2, 1 / length2);
18199 function geoVecAngle(a2, b2) {
18200 return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
18202 function geoVecDot(a2, b2, origin) {
18203 origin = origin || [0, 0];
18204 var p2 = geoVecSubtract(a2, origin);
18205 var q2 = geoVecSubtract(b2, origin);
18206 return p2[0] * q2[0] + p2[1] * q2[1];
18208 function geoVecNormalizedDot(a2, b2, origin) {
18209 origin = origin || [0, 0];
18210 var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
18211 var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
18212 return geoVecDot(p2, q2);
18214 function geoVecCross(a2, b2, origin) {
18215 origin = origin || [0, 0];
18216 var p2 = geoVecSubtract(a2, origin);
18217 var q2 = geoVecSubtract(b2, origin);
18218 return p2[0] * q2[1] - p2[1] * q2[0];
18220 function geoVecProject(a2, points) {
18221 var min3 = Infinity;
18224 for (var i3 = 0; i3 < points.length - 1; i3++) {
18225 var o2 = points[i3];
18226 var s2 = geoVecSubtract(points[i3 + 1], o2);
18227 var v2 = geoVecSubtract(a2, o2);
18228 var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
18232 } else if (proj > 1) {
18233 p2 = points[i3 + 1];
18235 p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
18237 var dist = geoVecLength(p2, a2);
18244 if (idx !== void 0) {
18245 return { index: idx, distance: min3, target };
18251 // modules/geo/geom.js
18252 function geoAngle(a2, b2, projection2) {
18253 return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
18255 function geoEdgeEqual(a2, b2) {
18256 return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
18258 function geoRotate(points, angle2, around) {
18259 return points.map(function(point2) {
18260 var radial = geoVecSubtract(point2, around);
18262 radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
18263 radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
18267 function geoChooseEdge(nodes, point2, projection2, activeID) {
18268 var dist = geoVecLength;
18269 var points = nodes.map(function(n3) {
18270 return projection2(n3.loc);
18272 var ids = nodes.map(function(n3) {
18275 var min3 = Infinity;
18278 for (var i3 = 0; i3 < points.length - 1; i3++) {
18279 if (ids[i3] === activeID || ids[i3 + 1] === activeID)
18281 var o2 = points[i3];
18282 var s2 = geoVecSubtract(points[i3 + 1], o2);
18283 var v2 = geoVecSubtract(point2, o2);
18284 var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
18288 } else if (proj > 1) {
18289 p2 = points[i3 + 1];
18291 p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
18293 var d2 = dist(p2, point2);
18297 loc = projection2.invert(p2);
18300 if (idx !== void 0) {
18301 return { index: idx, distance: min3, loc };
18306 function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
18308 var inactives = [];
18309 var j2, k2, n1, n22, segment;
18310 for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
18311 n1 = activeNodes[j2];
18312 n22 = activeNodes[j2 + 1];
18313 segment = [n1.loc, n22.loc];
18314 if (n1.id === activeID || n22.id === activeID) {
18315 actives.push(segment);
18318 for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
18319 n1 = inactiveNodes[j2];
18320 n22 = inactiveNodes[j2 + 1];
18321 segment = [n1.loc, n22.loc];
18322 inactives.push(segment);
18324 for (j2 = 0; j2 < actives.length; j2++) {
18325 for (k2 = 0; k2 < inactives.length; k2++) {
18326 var p2 = actives[j2];
18327 var q2 = inactives[k2];
18328 var hit = geoLineIntersection(p2, q2);
18336 function geoHasSelfIntersections(nodes, activeID) {
18338 var inactives = [];
18340 for (j2 = 0; j2 < nodes.length - 1; j2++) {
18341 var n1 = nodes[j2];
18342 var n22 = nodes[j2 + 1];
18343 var segment = [n1.loc, n22.loc];
18344 if (n1.id === activeID || n22.id === activeID) {
18345 actives.push(segment);
18347 inactives.push(segment);
18350 for (j2 = 0; j2 < actives.length; j2++) {
18351 for (k2 = 0; k2 < inactives.length; k2++) {
18352 var p2 = actives[j2];
18353 var q2 = inactives[k2];
18354 if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
18357 var hit = geoLineIntersection(p2, q2);
18359 var epsilon3 = 1e-8;
18360 if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
18370 function geoLineIntersection(a2, b2) {
18371 var p2 = [a2[0][0], a2[0][1]];
18372 var p22 = [a2[1][0], a2[1][1]];
18373 var q2 = [b2[0][0], b2[0][1]];
18374 var q22 = [b2[1][0], b2[1][1]];
18375 var r2 = geoVecSubtract(p22, p2);
18376 var s2 = geoVecSubtract(q22, q2);
18377 var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
18378 var denominator = geoVecCross(r2, s2);
18379 if (uNumerator && denominator) {
18380 var u2 = uNumerator / denominator;
18381 var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
18382 if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
18383 return geoVecInterp(p2, p22, t2);
18388 function geoPathIntersections(path1, path2) {
18389 var intersections = [];
18390 for (var i3 = 0; i3 < path1.length - 1; i3++) {
18391 for (var j2 = 0; j2 < path2.length - 1; j2++) {
18392 var a2 = [path1[i3], path1[i3 + 1]];
18393 var b2 = [path2[j2], path2[j2 + 1]];
18394 var hit = geoLineIntersection(a2, b2);
18396 intersections.push(hit);
18400 return intersections;
18402 function geoPathHasIntersections(path1, path2) {
18403 for (var i3 = 0; i3 < path1.length - 1; i3++) {
18404 for (var j2 = 0; j2 < path2.length - 1; j2++) {
18405 var a2 = [path1[i3], path1[i3 + 1]];
18406 var b2 = [path2[j2], path2[j2 + 1]];
18407 var hit = geoLineIntersection(a2, b2);
18415 function geoPointInPolygon(point2, polygon2) {
18416 var x2 = point2[0];
18417 var y2 = point2[1];
18418 var inside = false;
18419 for (var i3 = 0, j2 = polygon2.length - 1; i3 < polygon2.length; j2 = i3++) {
18420 var xi = polygon2[i3][0];
18421 var yi = polygon2[i3][1];
18422 var xj = polygon2[j2][0];
18423 var yj = polygon2[j2][1];
18424 var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
18430 function geoPolygonContainsPolygon(outer, inner) {
18431 return inner.every(function(point2) {
18432 return geoPointInPolygon(point2, outer);
18435 function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
18436 function testPoints(outer2, inner2) {
18437 return inner2.some(function(point2) {
18438 return geoPointInPolygon(point2, outer2);
18441 return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
18443 function geoGetSmallestSurroundingRectangle(points) {
18444 var hull = hull_default(points);
18445 var centroid = centroid_default2(hull);
18446 var minArea = Infinity;
18447 var ssrExtent = [];
18450 for (var i3 = 0; i3 <= hull.length - 1; i3++) {
18451 var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
18452 var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
18453 var poly = geoRotate(hull, -angle2, centroid);
18454 var extent = poly.reduce(function(extent2, point2) {
18455 return extent2.extend(geoExtent(point2));
18457 var area = extent.area();
18458 if (area < minArea) {
18460 ssrExtent = extent;
18466 poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
18470 function geoPathLength(path) {
18472 for (var i3 = 0; i3 < path.length - 1; i3++) {
18473 length2 += geoVecLength(path[i3], path[i3 + 1]);
18477 function geoViewportEdge(point2, dimensions) {
18478 var pad2 = [80, 20, 50, 20];
18481 if (point2[0] > dimensions[0] - pad2[1]) {
18484 if (point2[0] < pad2[3]) {
18487 if (point2[1] > dimensions[1] - pad2[2]) {
18490 if (point2[1] < pad2[0]) {
18500 // node_modules/d3-dispatch/src/dispatch.js
18501 var noop2 = { value: () => {
18503 function dispatch() {
18504 for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
18505 if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2))
18506 throw new Error("illegal type: " + t2);
18509 return new Dispatch(_2);
18511 function Dispatch(_2) {
18514 function parseTypenames(typenames, types) {
18515 return typenames.trim().split(/^|\s+/).map(function(t2) {
18516 var name = "", i3 = t2.indexOf(".");
18518 name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
18519 if (t2 && !types.hasOwnProperty(t2))
18520 throw new Error("unknown type: " + t2);
18521 return { type: t2, name };
18524 Dispatch.prototype = dispatch.prototype = {
18525 constructor: Dispatch,
18526 on: function(typename, callback) {
18527 var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
18528 if (arguments.length < 2) {
18530 if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name)))
18534 if (callback != null && typeof callback !== "function")
18535 throw new Error("invalid callback: " + callback);
18536 while (++i3 < n3) {
18537 if (t2 = (typename = T2[i3]).type)
18538 _2[t2] = set(_2[t2], typename.name, callback);
18539 else if (callback == null)
18541 _2[t2] = set(_2[t2], typename.name, null);
18546 var copy2 = {}, _2 = this._;
18548 copy2[t2] = _2[t2].slice();
18549 return new Dispatch(copy2);
18551 call: function(type2, that) {
18552 if ((n3 = arguments.length - 2) > 0)
18553 for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3)
18554 args[i3] = arguments[i3 + 2];
18555 if (!this._.hasOwnProperty(type2))
18556 throw new Error("unknown type: " + type2);
18557 for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
18558 t2[i3].value.apply(that, args);
18560 apply: function(type2, that, args) {
18561 if (!this._.hasOwnProperty(type2))
18562 throw new Error("unknown type: " + type2);
18563 for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3)
18564 t2[i3].value.apply(that, args);
18567 function get(type2, name) {
18568 for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
18569 if ((c2 = type2[i3]).name === name) {
18574 function set(type2, name, callback) {
18575 for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
18576 if (type2[i3].name === name) {
18577 type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
18581 if (callback != null)
18582 type2.push({ name, value: callback });
18585 var dispatch_default = dispatch;
18587 // node_modules/d3-selection/src/namespaces.js
18588 var xhtml = "http://www.w3.org/1999/xhtml";
18589 var namespaces_default = {
18590 svg: "http://www.w3.org/2000/svg",
18592 xlink: "http://www.w3.org/1999/xlink",
18593 xml: "http://www.w3.org/XML/1998/namespace",
18594 xmlns: "http://www.w3.org/2000/xmlns/"
18597 // node_modules/d3-selection/src/namespace.js
18598 function namespace_default(name) {
18599 var prefix = name += "", i3 = prefix.indexOf(":");
18600 if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns")
18601 name = name.slice(i3 + 1);
18602 return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
18605 // node_modules/d3-selection/src/creator.js
18606 function creatorInherit(name) {
18607 return function() {
18608 var document2 = this.ownerDocument, uri = this.namespaceURI;
18609 return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
18612 function creatorFixed(fullname) {
18613 return function() {
18614 return this.ownerDocument.createElementNS(fullname.space, fullname.local);
18617 function creator_default(name) {
18618 var fullname = namespace_default(name);
18619 return (fullname.local ? creatorFixed : creatorInherit)(fullname);
18622 // node_modules/d3-selection/src/selector.js
18625 function selector_default(selector) {
18626 return selector == null ? none : function() {
18627 return this.querySelector(selector);
18631 // node_modules/d3-selection/src/selection/select.js
18632 function select_default(select) {
18633 if (typeof select !== "function")
18634 select = selector_default(select);
18635 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18636 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
18637 if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
18638 if ("__data__" in node)
18639 subnode.__data__ = node.__data__;
18640 subgroup[i3] = subnode;
18644 return new Selection(subgroups, this._parents);
18647 // node_modules/d3-selection/src/array.js
18648 function array(x2) {
18649 return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
18652 // node_modules/d3-selection/src/selectorAll.js
18656 function selectorAll_default(selector) {
18657 return selector == null ? empty : function() {
18658 return this.querySelectorAll(selector);
18662 // node_modules/d3-selection/src/selection/selectAll.js
18663 function arrayAll(select) {
18664 return function() {
18665 return array(select.apply(this, arguments));
18668 function selectAll_default(select) {
18669 if (typeof select === "function")
18670 select = arrayAll(select);
18672 select = selectorAll_default(select);
18673 for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
18674 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
18675 if (node = group[i3]) {
18676 subgroups.push(select.call(node, node.__data__, i3, group));
18677 parents.push(node);
18681 return new Selection(subgroups, parents);
18684 // node_modules/d3-selection/src/matcher.js
18685 function matcher_default(selector) {
18686 return function() {
18687 return this.matches(selector);
18690 function childMatcher(selector) {
18691 return function(node) {
18692 return node.matches(selector);
18696 // node_modules/d3-selection/src/selection/selectChild.js
18697 var find = Array.prototype.find;
18698 function childFind(match) {
18699 return function() {
18700 return find.call(this.children, match);
18703 function childFirst() {
18704 return this.firstElementChild;
18706 function selectChild_default(match) {
18707 return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
18710 // node_modules/d3-selection/src/selection/selectChildren.js
18711 var filter = Array.prototype.filter;
18712 function children() {
18713 return Array.from(this.children);
18715 function childrenFilter(match) {
18716 return function() {
18717 return filter.call(this.children, match);
18720 function selectChildren_default(match) {
18721 return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
18724 // node_modules/d3-selection/src/selection/filter.js
18725 function filter_default(match) {
18726 if (typeof match !== "function")
18727 match = matcher_default(match);
18728 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18729 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
18730 if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
18731 subgroup.push(node);
18735 return new Selection(subgroups, this._parents);
18738 // node_modules/d3-selection/src/selection/sparse.js
18739 function sparse_default(update) {
18740 return new Array(update.length);
18743 // node_modules/d3-selection/src/selection/enter.js
18744 function enter_default() {
18745 return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
18747 function EnterNode(parent, datum2) {
18748 this.ownerDocument = parent.ownerDocument;
18749 this.namespaceURI = parent.namespaceURI;
18751 this._parent = parent;
18752 this.__data__ = datum2;
18754 EnterNode.prototype = {
18755 constructor: EnterNode,
18756 appendChild: function(child) {
18757 return this._parent.insertBefore(child, this._next);
18759 insertBefore: function(child, next) {
18760 return this._parent.insertBefore(child, next);
18762 querySelector: function(selector) {
18763 return this._parent.querySelector(selector);
18765 querySelectorAll: function(selector) {
18766 return this._parent.querySelectorAll(selector);
18770 // node_modules/d3-selection/src/constant.js
18771 function constant_default(x2) {
18772 return function() {
18777 // node_modules/d3-selection/src/selection/data.js
18778 function bindIndex(parent, group, enter, update, exit, data) {
18779 var i3 = 0, node, groupLength = group.length, dataLength = data.length;
18780 for (; i3 < dataLength; ++i3) {
18781 if (node = group[i3]) {
18782 node.__data__ = data[i3];
18785 enter[i3] = new EnterNode(parent, data[i3]);
18788 for (; i3 < groupLength; ++i3) {
18789 if (node = group[i3]) {
18794 function bindKey(parent, group, enter, update, exit, data, key) {
18795 var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
18796 for (i3 = 0; i3 < groupLength; ++i3) {
18797 if (node = group[i3]) {
18798 keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
18799 if (nodeByKeyValue.has(keyValue)) {
18802 nodeByKeyValue.set(keyValue, node);
18806 for (i3 = 0; i3 < dataLength; ++i3) {
18807 keyValue = key.call(parent, data[i3], i3, data) + "";
18808 if (node = nodeByKeyValue.get(keyValue)) {
18810 node.__data__ = data[i3];
18811 nodeByKeyValue.delete(keyValue);
18813 enter[i3] = new EnterNode(parent, data[i3]);
18816 for (i3 = 0; i3 < groupLength; ++i3) {
18817 if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
18822 function datum(node) {
18823 return node.__data__;
18825 function data_default(value, key) {
18826 if (!arguments.length)
18827 return Array.from(this, datum);
18828 var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
18829 if (typeof value !== "function")
18830 value = constant_default(value);
18831 for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18832 var parent = parents[j2], group = groups[j2], groupLength = group.length, data = arraylike(value.call(parent, parent && parent.__data__, j2, parents)), dataLength = data.length, enterGroup = enter[j2] = new Array(dataLength), updateGroup = update[j2] = new Array(dataLength), exitGroup = exit[j2] = new Array(groupLength);
18833 bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
18834 for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
18835 if (previous = enterGroup[i0]) {
18838 while (!(next = updateGroup[i1]) && ++i1 < dataLength)
18840 previous._next = next || null;
18844 update = new Selection(update, parents);
18845 update._enter = enter;
18846 update._exit = exit;
18849 function arraylike(data) {
18850 return typeof data === "object" && "length" in data ? data : Array.from(data);
18853 // node_modules/d3-selection/src/selection/exit.js
18854 function exit_default() {
18855 return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
18858 // node_modules/d3-selection/src/selection/join.js
18859 function join_default(onenter, onupdate, onexit) {
18860 var enter = this.enter(), update = this, exit = this.exit();
18861 if (typeof onenter === "function") {
18862 enter = onenter(enter);
18864 enter = enter.selection();
18866 enter = enter.append(onenter + "");
18868 if (onupdate != null) {
18869 update = onupdate(update);
18871 update = update.selection();
18873 if (onexit == null)
18877 return enter && update ? enter.merge(update).order() : update;
18880 // node_modules/d3-selection/src/selection/merge.js
18881 function merge_default(context) {
18882 var selection2 = context.selection ? context.selection() : context;
18883 for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
18884 for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
18885 if (node = group0[i3] || group1[i3]) {
18890 for (; j2 < m0; ++j2) {
18891 merges[j2] = groups0[j2];
18893 return new Selection(merges, this._parents);
18896 // node_modules/d3-selection/src/selection/order.js
18897 function order_default() {
18898 for (var groups = this._groups, j2 = -1, m2 = groups.length; ++j2 < m2; ) {
18899 for (var group = groups[j2], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
18900 if (node = group[i3]) {
18901 if (next && node.compareDocumentPosition(next) ^ 4)
18902 next.parentNode.insertBefore(node, next);
18910 // node_modules/d3-selection/src/selection/sort.js
18911 function sort_default(compare2) {
18913 compare2 = ascending2;
18914 function compareNode(a2, b2) {
18915 return a2 && b2 ? compare2(a2.__data__, b2.__data__) : !a2 - !b2;
18917 for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18918 for (var group = groups[j2], n3 = group.length, sortgroup = sortgroups[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
18919 if (node = group[i3]) {
18920 sortgroup[i3] = node;
18923 sortgroup.sort(compareNode);
18925 return new Selection(sortgroups, this._parents).order();
18927 function ascending2(a2, b2) {
18928 return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
18931 // node_modules/d3-selection/src/selection/call.js
18932 function call_default() {
18933 var callback = arguments[0];
18934 arguments[0] = this;
18935 callback.apply(null, arguments);
18939 // node_modules/d3-selection/src/selection/nodes.js
18940 function nodes_default() {
18941 return Array.from(this);
18944 // node_modules/d3-selection/src/selection/node.js
18945 function node_default() {
18946 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
18947 for (var group = groups[j2], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
18948 var node = group[i3];
18956 // node_modules/d3-selection/src/selection/size.js
18957 function size_default() {
18959 for (const node of this)
18964 // node_modules/d3-selection/src/selection/empty.js
18965 function empty_default() {
18966 return !this.node();
18969 // node_modules/d3-selection/src/selection/each.js
18970 function each_default(callback) {
18971 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
18972 for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
18973 if (node = group[i3])
18974 callback.call(node, node.__data__, i3, group);
18980 // node_modules/d3-selection/src/selection/attr.js
18981 function attrRemove(name) {
18982 return function() {
18983 this.removeAttribute(name);
18986 function attrRemoveNS(fullname) {
18987 return function() {
18988 this.removeAttributeNS(fullname.space, fullname.local);
18991 function attrConstant(name, value) {
18992 return function() {
18993 this.setAttribute(name, value);
18996 function attrConstantNS(fullname, value) {
18997 return function() {
18998 this.setAttributeNS(fullname.space, fullname.local, value);
19001 function attrFunction(name, value) {
19002 return function() {
19003 var v2 = value.apply(this, arguments);
19005 this.removeAttribute(name);
19007 this.setAttribute(name, v2);
19010 function attrFunctionNS(fullname, value) {
19011 return function() {
19012 var v2 = value.apply(this, arguments);
19014 this.removeAttributeNS(fullname.space, fullname.local);
19016 this.setAttributeNS(fullname.space, fullname.local, v2);
19019 function attr_default(name, value) {
19020 var fullname = namespace_default(name);
19021 if (arguments.length < 2) {
19022 var node = this.node();
19023 return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
19025 return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
19028 // node_modules/d3-selection/src/window.js
19029 function window_default(node) {
19030 return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
19033 // node_modules/d3-selection/src/selection/style.js
19034 function styleRemove(name) {
19035 return function() {
19036 this.style.removeProperty(name);
19039 function styleConstant(name, value, priority) {
19040 return function() {
19041 this.style.setProperty(name, value, priority);
19044 function styleFunction(name, value, priority) {
19045 return function() {
19046 var v2 = value.apply(this, arguments);
19048 this.style.removeProperty(name);
19050 this.style.setProperty(name, v2, priority);
19053 function style_default(name, value, priority) {
19054 return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
19056 function styleValue(node, name) {
19057 return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
19060 // node_modules/d3-selection/src/selection/property.js
19061 function propertyRemove(name) {
19062 return function() {
19066 function propertyConstant(name, value) {
19067 return function() {
19068 this[name] = value;
19071 function propertyFunction(name, value) {
19072 return function() {
19073 var v2 = value.apply(this, arguments);
19080 function property_default(name, value) {
19081 return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
19084 // node_modules/d3-selection/src/selection/classed.js
19085 function classArray(string) {
19086 return string.trim().split(/^|\s+/);
19088 function classList(node) {
19089 return node.classList || new ClassList(node);
19091 function ClassList(node) {
19093 this._names = classArray(node.getAttribute("class") || "");
19095 ClassList.prototype = {
19096 add: function(name) {
19097 var i3 = this._names.indexOf(name);
19099 this._names.push(name);
19100 this._node.setAttribute("class", this._names.join(" "));
19103 remove: function(name) {
19104 var i3 = this._names.indexOf(name);
19106 this._names.splice(i3, 1);
19107 this._node.setAttribute("class", this._names.join(" "));
19110 contains: function(name) {
19111 return this._names.indexOf(name) >= 0;
19114 function classedAdd(node, names) {
19115 var list2 = classList(node), i3 = -1, n3 = names.length;
19117 list2.add(names[i3]);
19119 function classedRemove(node, names) {
19120 var list2 = classList(node), i3 = -1, n3 = names.length;
19122 list2.remove(names[i3]);
19124 function classedTrue(names) {
19125 return function() {
19126 classedAdd(this, names);
19129 function classedFalse(names) {
19130 return function() {
19131 classedRemove(this, names);
19134 function classedFunction(names, value) {
19135 return function() {
19136 (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
19139 function classed_default(name, value) {
19140 var names = classArray(name + "");
19141 if (arguments.length < 2) {
19142 var list2 = classList(this.node()), i3 = -1, n3 = names.length;
19144 if (!list2.contains(names[i3]))
19148 return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
19151 // node_modules/d3-selection/src/selection/text.js
19152 function textRemove() {
19153 this.textContent = "";
19155 function textConstant(value) {
19156 return function() {
19157 this.textContent = value;
19160 function textFunction(value) {
19161 return function() {
19162 var v2 = value.apply(this, arguments);
19163 this.textContent = v2 == null ? "" : v2;
19166 function text_default(value) {
19167 return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
19170 // node_modules/d3-selection/src/selection/html.js
19171 function htmlRemove() {
19172 this.innerHTML = "";
19174 function htmlConstant(value) {
19175 return function() {
19176 this.innerHTML = value;
19179 function htmlFunction(value) {
19180 return function() {
19181 var v2 = value.apply(this, arguments);
19182 this.innerHTML = v2 == null ? "" : v2;
19185 function html_default(value) {
19186 return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
19189 // node_modules/d3-selection/src/selection/raise.js
19191 if (this.nextSibling)
19192 this.parentNode.appendChild(this);
19194 function raise_default() {
19195 return this.each(raise);
19198 // node_modules/d3-selection/src/selection/lower.js
19200 if (this.previousSibling)
19201 this.parentNode.insertBefore(this, this.parentNode.firstChild);
19203 function lower_default() {
19204 return this.each(lower);
19207 // node_modules/d3-selection/src/selection/append.js
19208 function append_default(name) {
19209 var create2 = typeof name === "function" ? name : creator_default(name);
19210 return this.select(function() {
19211 return this.appendChild(create2.apply(this, arguments));
19215 // node_modules/d3-selection/src/selection/insert.js
19216 function constantNull() {
19219 function insert_default(name, before) {
19220 var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
19221 return this.select(function() {
19222 return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
19226 // node_modules/d3-selection/src/selection/remove.js
19227 function remove() {
19228 var parent = this.parentNode;
19230 parent.removeChild(this);
19232 function remove_default() {
19233 return this.each(remove);
19236 // node_modules/d3-selection/src/selection/clone.js
19237 function selection_cloneShallow() {
19238 var clone2 = this.cloneNode(false), parent = this.parentNode;
19239 return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
19241 function selection_cloneDeep() {
19242 var clone2 = this.cloneNode(true), parent = this.parentNode;
19243 return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
19245 function clone_default(deep) {
19246 return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
19249 // node_modules/d3-selection/src/selection/datum.js
19250 function datum_default(value) {
19251 return arguments.length ? this.property("__data__", value) : this.node().__data__;
19254 // node_modules/d3-selection/src/selection/on.js
19255 function contextListener(listener) {
19256 return function(event) {
19257 listener.call(this, event, this.__data__);
19260 function parseTypenames2(typenames) {
19261 return typenames.trim().split(/^|\s+/).map(function(t2) {
19262 var name = "", i3 = t2.indexOf(".");
19264 name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
19265 return { type: t2, name };
19268 function onRemove(typename) {
19269 return function() {
19270 var on = this.__on;
19273 for (var j2 = 0, i3 = -1, m2 = on.length, o2; j2 < m2; ++j2) {
19274 if (o2 = on[j2], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
19275 this.removeEventListener(o2.type, o2.listener, o2.options);
19286 function onAdd(typename, value, options2) {
19287 return function() {
19288 var on = this.__on, o2, listener = contextListener(value);
19290 for (var j2 = 0, m2 = on.length; j2 < m2; ++j2) {
19291 if ((o2 = on[j2]).type === typename.type && o2.name === typename.name) {
19292 this.removeEventListener(o2.type, o2.listener, o2.options);
19293 this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
19298 this.addEventListener(typename.type, listener, options2);
19299 o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
19306 function on_default(typename, value, options2) {
19307 var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
19308 if (arguments.length < 2) {
19309 var on = this.node().__on;
19311 for (var j2 = 0, m2 = on.length, o2; j2 < m2; ++j2) {
19312 for (i3 = 0, o2 = on[j2]; i3 < n3; ++i3) {
19313 if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
19320 on = value ? onAdd : onRemove;
19321 for (i3 = 0; i3 < n3; ++i3)
19322 this.each(on(typenames[i3], value, options2));
19326 // node_modules/d3-selection/src/selection/dispatch.js
19327 function dispatchEvent(node, type2, params) {
19328 var window2 = window_default(node), event = window2.CustomEvent;
19329 if (typeof event === "function") {
19330 event = new event(type2, params);
19332 event = window2.document.createEvent("Event");
19334 event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
19336 event.initEvent(type2, false, false);
19338 node.dispatchEvent(event);
19340 function dispatchConstant(type2, params) {
19341 return function() {
19342 return dispatchEvent(this, type2, params);
19345 function dispatchFunction(type2, params) {
19346 return function() {
19347 return dispatchEvent(this, type2, params.apply(this, arguments));
19350 function dispatch_default2(type2, params) {
19351 return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
19354 // node_modules/d3-selection/src/selection/iterator.js
19355 function* iterator_default() {
19356 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
19357 for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
19358 if (node = group[i3])
19364 // node_modules/d3-selection/src/selection/index.js
19366 function Selection(groups, parents) {
19367 this._groups = groups;
19368 this._parents = parents;
19370 function selection() {
19371 return new Selection([[document.documentElement]], root);
19373 function selection_selection() {
19376 Selection.prototype = selection.prototype = {
19377 constructor: Selection,
19378 select: select_default,
19379 selectAll: selectAll_default,
19380 selectChild: selectChild_default,
19381 selectChildren: selectChildren_default,
19382 filter: filter_default,
19383 data: data_default,
19384 enter: enter_default,
19385 exit: exit_default,
19386 join: join_default,
19387 merge: merge_default,
19388 selection: selection_selection,
19389 order: order_default,
19390 sort: sort_default,
19391 call: call_default,
19392 nodes: nodes_default,
19393 node: node_default,
19394 size: size_default,
19395 empty: empty_default,
19396 each: each_default,
19397 attr: attr_default,
19398 style: style_default,
19399 property: property_default,
19400 classed: classed_default,
19401 text: text_default,
19402 html: html_default,
19403 raise: raise_default,
19404 lower: lower_default,
19405 append: append_default,
19406 insert: insert_default,
19407 remove: remove_default,
19408 clone: clone_default,
19409 datum: datum_default,
19411 dispatch: dispatch_default2,
19412 [Symbol.iterator]: iterator_default
19414 var selection_default = selection;
19416 // node_modules/d3-selection/src/select.js
19417 function select_default2(selector) {
19418 return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
19421 // node_modules/d3-selection/src/sourceEvent.js
19422 function sourceEvent_default(event) {
19424 while (sourceEvent = event.sourceEvent)
19425 event = sourceEvent;
19429 // node_modules/d3-selection/src/pointer.js
19430 function pointer_default(event, node) {
19431 event = sourceEvent_default(event);
19432 if (node === void 0)
19433 node = event.currentTarget;
19435 var svg2 = node.ownerSVGElement || node;
19436 if (svg2.createSVGPoint) {
19437 var point2 = svg2.createSVGPoint();
19438 point2.x = event.clientX, point2.y = event.clientY;
19439 point2 = point2.matrixTransform(node.getScreenCTM().inverse());
19440 return [point2.x, point2.y];
19442 if (node.getBoundingClientRect) {
19443 var rect = node.getBoundingClientRect();
19444 return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
19447 return [event.pageX, event.pageY];
19450 // node_modules/d3-selection/src/selectAll.js
19451 function selectAll_default2(selector) {
19452 return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
19455 // node_modules/d3-drag/src/noevent.js
19456 var nonpassive = { passive: false };
19457 var nonpassivecapture = { capture: true, passive: false };
19458 function nopropagation(event) {
19459 event.stopImmediatePropagation();
19461 function noevent_default(event) {
19462 event.preventDefault();
19463 event.stopImmediatePropagation();
19466 // node_modules/d3-drag/src/nodrag.js
19467 function nodrag_default(view) {
19468 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
19469 if ("onselectstart" in root3) {
19470 selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
19472 root3.__noselect = root3.style.MozUserSelect;
19473 root3.style.MozUserSelect = "none";
19476 function yesdrag(view, noclick) {
19477 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
19479 selection2.on("click.drag", noevent_default, nonpassivecapture);
19480 setTimeout(function() {
19481 selection2.on("click.drag", null);
19484 if ("onselectstart" in root3) {
19485 selection2.on("selectstart.drag", null);
19487 root3.style.MozUserSelect = root3.__noselect;
19488 delete root3.__noselect;
19492 // node_modules/d3-drag/src/constant.js
19493 var constant_default2 = (x2) => () => x2;
19495 // node_modules/d3-drag/src/event.js
19496 function DragEvent(type2, {
19506 dispatch: dispatch14
19508 Object.defineProperties(this, {
19509 type: { value: type2, enumerable: true, configurable: true },
19510 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19511 subject: { value: subject, enumerable: true, configurable: true },
19512 target: { value: target, enumerable: true, configurable: true },
19513 identifier: { value: identifier, enumerable: true, configurable: true },
19514 active: { value: active, enumerable: true, configurable: true },
19515 x: { value: x2, enumerable: true, configurable: true },
19516 y: { value: y2, enumerable: true, configurable: true },
19517 dx: { value: dx, enumerable: true, configurable: true },
19518 dy: { value: dy, enumerable: true, configurable: true },
19519 _: { value: dispatch14 }
19522 DragEvent.prototype.on = function() {
19523 var value = this._.on.apply(this._, arguments);
19524 return value === this._ ? this : value;
19527 // node_modules/d3-drag/src/drag.js
19528 function defaultFilter(event) {
19529 return !event.ctrlKey && !event.button;
19531 function defaultContainer() {
19532 return this.parentNode;
19534 function defaultSubject(event, d2) {
19535 return d2 == null ? { x: event.x, y: event.y } : d2;
19537 function defaultTouchable() {
19538 return navigator.maxTouchPoints || "ontouchstart" in this;
19540 function drag_default() {
19541 var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
19542 function drag(selection2) {
19543 selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
19545 function mousedowned(event, d2) {
19546 if (touchending || !filter2.call(this, event, d2))
19548 var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
19551 select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
19552 nodrag_default(event.view);
19553 nopropagation(event);
19554 mousemoving = false;
19555 mousedownx = event.clientX;
19556 mousedowny = event.clientY;
19557 gesture("start", event);
19559 function mousemoved(event) {
19560 noevent_default(event);
19561 if (!mousemoving) {
19562 var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
19563 mousemoving = dx * dx + dy * dy > clickDistance2;
19565 gestures.mouse("drag", event);
19567 function mouseupped(event) {
19568 select_default2(event.view).on("mousemove.drag mouseup.drag", null);
19569 yesdrag(event.view, mousemoving);
19570 noevent_default(event);
19571 gestures.mouse("end", event);
19573 function touchstarted(event, d2) {
19574 if (!filter2.call(this, event, d2))
19576 var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
19577 for (i3 = 0; i3 < n3; ++i3) {
19578 if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
19579 nopropagation(event);
19580 gesture("start", event, touches[i3]);
19584 function touchmoved(event) {
19585 var touches = event.changedTouches, n3 = touches.length, i3, gesture;
19586 for (i3 = 0; i3 < n3; ++i3) {
19587 if (gesture = gestures[touches[i3].identifier]) {
19588 noevent_default(event);
19589 gesture("drag", event, touches[i3]);
19593 function touchended(event) {
19594 var touches = event.changedTouches, n3 = touches.length, i3, gesture;
19596 clearTimeout(touchending);
19597 touchending = setTimeout(function() {
19598 touchending = null;
19600 for (i3 = 0; i3 < n3; ++i3) {
19601 if (gesture = gestures[touches[i3].identifier]) {
19602 nopropagation(event);
19603 gesture("end", event, touches[i3]);
19607 function beforestart(that, container2, event, d2, identifier, touch) {
19608 var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
19609 if ((s2 = subject.call(that, new DragEvent("beforestart", {
19610 sourceEvent: event,
19618 dispatch: dispatch14
19621 dx = s2.x - p2[0] || 0;
19622 dy = s2.y - p2[1] || 0;
19623 return function gesture(type2, event2, touch2) {
19627 gestures[identifier] = gesture, n3 = active++;
19630 delete gestures[identifier], --active;
19632 p2 = pointer_default(touch2 || event2, container2), n3 = active;
19638 new DragEvent(type2, {
19639 sourceEvent: event2,
19646 dx: p2[0] - p02[0],
19647 dy: p2[1] - p02[1],
19648 dispatch: dispatch14
19654 drag.filter = function(_2) {
19655 return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
19657 drag.container = function(_2) {
19658 return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
19660 drag.subject = function(_2) {
19661 return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
19663 drag.touchable = function(_2) {
19664 return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
19666 drag.on = function() {
19667 var value = listeners.on.apply(listeners, arguments);
19668 return value === listeners ? drag : value;
19670 drag.clickDistance = function(_2) {
19671 return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
19676 // node_modules/d3-color/src/define.js
19677 function define_default(constructor, factory, prototype) {
19678 constructor.prototype = factory.prototype = prototype;
19679 prototype.constructor = constructor;
19681 function extend(parent, definition) {
19682 var prototype = Object.create(parent.prototype);
19683 for (var key in definition)
19684 prototype[key] = definition[key];
19688 // node_modules/d3-color/src/color.js
19692 var brighter = 1 / darker;
19693 var reI = "\\s*([+-]?\\d+)\\s*";
19694 var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
19695 var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
19696 var reHex = /^#([0-9a-f]{3,8})$/;
19697 var reRgbInteger = new RegExp("^rgb\\(".concat(reI, ",").concat(reI, ",").concat(reI, "\\)$"));
19698 var reRgbPercent = new RegExp("^rgb\\(".concat(reP, ",").concat(reP, ",").concat(reP, "\\)$"));
19699 var reRgbaInteger = new RegExp("^rgba\\(".concat(reI, ",").concat(reI, ",").concat(reI, ",").concat(reN, "\\)$"));
19700 var reRgbaPercent = new RegExp("^rgba\\(".concat(reP, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
19701 var reHslPercent = new RegExp("^hsl\\(".concat(reN, ",").concat(reP, ",").concat(reP, "\\)$"));
19702 var reHslaPercent = new RegExp("^hsla\\(".concat(reN, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
19704 aliceblue: 15792383,
19705 antiquewhite: 16444375,
19707 aquamarine: 8388564,
19712 blanchedalmond: 16772045,
19714 blueviolet: 9055202,
19716 burlywood: 14596231,
19717 cadetblue: 6266528,
19718 chartreuse: 8388352,
19719 chocolate: 13789470,
19721 cornflowerblue: 6591981,
19722 cornsilk: 16775388,
19727 darkgoldenrod: 12092939,
19728 darkgray: 11119017,
19730 darkgrey: 11119017,
19731 darkkhaki: 12433259,
19732 darkmagenta: 9109643,
19733 darkolivegreen: 5597999,
19734 darkorange: 16747520,
19735 darkorchid: 10040012,
19737 darksalmon: 15308410,
19738 darkseagreen: 9419919,
19739 darkslateblue: 4734347,
19740 darkslategray: 3100495,
19741 darkslategrey: 3100495,
19742 darkturquoise: 52945,
19743 darkviolet: 9699539,
19744 deeppink: 16716947,
19745 deepskyblue: 49151,
19748 dodgerblue: 2003199,
19749 firebrick: 11674146,
19750 floralwhite: 16775920,
19751 forestgreen: 2263842,
19753 gainsboro: 14474460,
19754 ghostwhite: 16316671,
19756 goldenrod: 14329120,
19759 greenyellow: 11403055,
19761 honeydew: 15794160,
19763 indianred: 13458524,
19767 lavender: 15132410,
19768 lavenderblush: 16773365,
19769 lawngreen: 8190976,
19770 lemonchiffon: 16775885,
19771 lightblue: 11393254,
19772 lightcoral: 15761536,
19773 lightcyan: 14745599,
19774 lightgoldenrodyellow: 16448210,
19775 lightgray: 13882323,
19776 lightgreen: 9498256,
19777 lightgrey: 13882323,
19778 lightpink: 16758465,
19779 lightsalmon: 16752762,
19780 lightseagreen: 2142890,
19781 lightskyblue: 8900346,
19782 lightslategray: 7833753,
19783 lightslategrey: 7833753,
19784 lightsteelblue: 11584734,
19785 lightyellow: 16777184,
19787 limegreen: 3329330,
19791 mediumaquamarine: 6737322,
19793 mediumorchid: 12211667,
19794 mediumpurple: 9662683,
19795 mediumseagreen: 3978097,
19796 mediumslateblue: 8087790,
19797 mediumspringgreen: 64154,
19798 mediumturquoise: 4772300,
19799 mediumvioletred: 13047173,
19800 midnightblue: 1644912,
19801 mintcream: 16121850,
19802 mistyrose: 16770273,
19803 moccasin: 16770229,
19804 navajowhite: 16768685,
19808 olivedrab: 7048739,
19810 orangered: 16729344,
19812 palegoldenrod: 15657130,
19813 palegreen: 10025880,
19814 paleturquoise: 11529966,
19815 palevioletred: 14381203,
19816 papayawhip: 16773077,
19817 peachpuff: 16767673,
19821 powderblue: 11591910,
19823 rebeccapurple: 6697881,
19825 rosybrown: 12357519,
19826 royalblue: 4286945,
19827 saddlebrown: 9127187,
19829 sandybrown: 16032864,
19831 seashell: 16774638,
19835 slateblue: 6970061,
19836 slategray: 7372944,
19837 slategrey: 7372944,
19839 springgreen: 65407,
19840 steelblue: 4620980,
19845 turquoise: 4251856,
19849 whitesmoke: 16119285,
19851 yellowgreen: 10145074
19853 define_default(Color, color, {
19855 return Object.assign(new this.constructor(), this, channels);
19858 return this.rgb().displayable();
19860 hex: color_formatHex,
19861 // Deprecated! Use color.formatHex.
19862 formatHex: color_formatHex,
19863 formatHex8: color_formatHex8,
19864 formatHsl: color_formatHsl,
19865 formatRgb: color_formatRgb,
19866 toString: color_formatRgb
19868 function color_formatHex() {
19869 return this.rgb().formatHex();
19871 function color_formatHex8() {
19872 return this.rgb().formatHex8();
19874 function color_formatHsl() {
19875 return hslConvert(this).formatHsl();
19877 function color_formatRgb() {
19878 return this.rgb().formatRgb();
19880 function color(format2) {
19882 format2 = (format2 + "").trim().toLowerCase();
19883 return (m2 = reHex.exec(format2)) ? (l2 = m2[1].length, m2 = parseInt(m2[1], 16), l2 === 6 ? rgbn(m2) : l2 === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l2 === 8 ? rgba(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l2 === 4 ? rgba(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
19885 function rgbn(n3) {
19886 return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
19888 function rgba(r2, g3, b2, a2) {
19890 r2 = g3 = b2 = NaN;
19891 return new Rgb(r2, g3, b2, a2);
19893 function rgbConvert(o2) {
19894 if (!(o2 instanceof Color))
19899 return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
19901 function rgb(r2, g3, b2, opacity) {
19902 return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
19904 function Rgb(r2, g3, b2, opacity) {
19908 this.opacity = +opacity;
19910 define_default(Rgb, rgb, extend(Color, {
19912 k2 = k2 == null ? brighter : Math.pow(brighter, k2);
19913 return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
19916 k2 = k2 == null ? darker : Math.pow(darker, k2);
19917 return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
19923 return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
19926 return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
19928 hex: rgb_formatHex,
19929 // Deprecated! Use color.formatHex.
19930 formatHex: rgb_formatHex,
19931 formatHex8: rgb_formatHex8,
19932 formatRgb: rgb_formatRgb,
19933 toString: rgb_formatRgb
19935 function rgb_formatHex() {
19936 return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b));
19938 function rgb_formatHex8() {
19939 return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b)).concat(hex((isNaN(this.opacity) ? 1 : this.opacity) * 255));
19941 function rgb_formatRgb() {
19942 const a2 = clampa(this.opacity);
19943 return "".concat(a2 === 1 ? "rgb(" : "rgba(").concat(clampi(this.r), ", ").concat(clampi(this.g), ", ").concat(clampi(this.b)).concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
19945 function clampa(opacity) {
19946 return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
19948 function clampi(value) {
19949 return Math.max(0, Math.min(255, Math.round(value) || 0));
19951 function hex(value) {
19952 value = clampi(value);
19953 return (value < 16 ? "0" : "") + value.toString(16);
19955 function hsla(h2, s2, l2, a2) {
19957 h2 = s2 = l2 = NaN;
19958 else if (l2 <= 0 || l2 >= 1)
19962 return new Hsl(h2, s2, l2, a2);
19964 function hslConvert(o2) {
19965 if (o2 instanceof Hsl)
19966 return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
19967 if (!(o2 instanceof Color))
19971 if (o2 instanceof Hsl)
19974 var r2 = o2.r / 255, g3 = o2.g / 255, b2 = o2.b / 255, min3 = Math.min(r2, g3, b2), max3 = Math.max(r2, g3, b2), h2 = NaN, s2 = max3 - min3, l2 = (max3 + min3) / 2;
19977 h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
19978 else if (g3 === max3)
19979 h2 = (b2 - r2) / s2 + 2;
19981 h2 = (r2 - g3) / s2 + 4;
19982 s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
19985 s2 = l2 > 0 && l2 < 1 ? 0 : h2;
19987 return new Hsl(h2, s2, l2, o2.opacity);
19989 function hsl(h2, s2, l2, opacity) {
19990 return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
19992 function Hsl(h2, s2, l2, opacity) {
19996 this.opacity = +opacity;
19998 define_default(Hsl, hsl, extend(Color, {
20000 k2 = k2 == null ? brighter : Math.pow(brighter, k2);
20001 return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20004 k2 = k2 == null ? darker : Math.pow(darker, k2);
20005 return new Hsl(this.h, this.s, this.l * k2, this.opacity);
20008 var h2 = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h2) || isNaN(this.s) ? 0 : this.s, l2 = this.l, m2 = l2 + (l2 < 0.5 ? l2 : 1 - l2) * s2, m1 = 2 * l2 - m2;
20010 hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
20011 hsl2rgb(h2, m1, m2),
20012 hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
20017 return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
20020 return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
20023 const a2 = clampa(this.opacity);
20024 return "".concat(a2 === 1 ? "hsl(" : "hsla(").concat(clamph(this.h), ", ").concat(clampt(this.s) * 100, "%, ").concat(clampt(this.l) * 100, "%").concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
20027 function clamph(value) {
20028 value = (value || 0) % 360;
20029 return value < 0 ? value + 360 : value;
20031 function clampt(value) {
20032 return Math.max(0, Math.min(1, value || 0));
20034 function hsl2rgb(h2, m1, m2) {
20035 return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
20038 // node_modules/d3-interpolate/src/basis.js
20039 function basis(t1, v0, v1, v2, v3) {
20040 var t2 = t1 * t1, t3 = t2 * t1;
20041 return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
20043 function basis_default(values) {
20044 var n3 = values.length - 1;
20045 return function(t2) {
20046 var i3 = t2 <= 0 ? t2 = 0 : t2 >= 1 ? (t2 = 1, n3 - 1) : Math.floor(t2 * n3), v1 = values[i3], v2 = values[i3 + 1], v0 = i3 > 0 ? values[i3 - 1] : 2 * v1 - v2, v3 = i3 < n3 - 1 ? values[i3 + 2] : 2 * v2 - v1;
20047 return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20051 // node_modules/d3-interpolate/src/basisClosed.js
20052 function basisClosed_default(values) {
20053 var n3 = values.length;
20054 return function(t2) {
20055 var i3 = Math.floor(((t2 %= 1) < 0 ? ++t2 : t2) * n3), v0 = values[(i3 + n3 - 1) % n3], v1 = values[i3 % n3], v2 = values[(i3 + 1) % n3], v3 = values[(i3 + 2) % n3];
20056 return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
20060 // node_modules/d3-interpolate/src/constant.js
20061 var constant_default3 = (x2) => () => x2;
20063 // node_modules/d3-interpolate/src/color.js
20064 function linear(a2, d2) {
20065 return function(t2) {
20066 return a2 + t2 * d2;
20069 function exponential(a2, b2, y2) {
20070 return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
20071 return Math.pow(a2 + t2 * b2, y2);
20074 function gamma(y2) {
20075 return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
20076 return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
20079 function nogamma(a2, b2) {
20081 return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
20084 // node_modules/d3-interpolate/src/rgb.js
20085 var rgb_default = function rgbGamma(y2) {
20086 var color2 = gamma(y2);
20087 function rgb2(start2, end) {
20088 var r2 = color2((start2 = rgb(start2)).r, (end = rgb(end)).r), g3 = color2(start2.g, end.g), b2 = color2(start2.b, end.b), opacity = nogamma(start2.opacity, end.opacity);
20089 return function(t2) {
20093 start2.opacity = opacity(t2);
20094 return start2 + "";
20097 rgb2.gamma = rgbGamma;
20100 function rgbSpline(spline) {
20101 return function(colors) {
20102 var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
20103 for (i3 = 0; i3 < n3; ++i3) {
20104 color2 = rgb(colors[i3]);
20105 r2[i3] = color2.r || 0;
20106 g3[i3] = color2.g || 0;
20107 b2[i3] = color2.b || 0;
20112 color2.opacity = 1;
20113 return function(t2) {
20117 return color2 + "";
20121 var rgbBasis = rgbSpline(basis_default);
20122 var rgbBasisClosed = rgbSpline(basisClosed_default);
20124 // node_modules/d3-interpolate/src/numberArray.js
20125 function numberArray_default(a2, b2) {
20128 var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
20129 return function(t2) {
20130 for (i3 = 0; i3 < n3; ++i3)
20131 c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
20135 function isNumberArray(x2) {
20136 return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
20139 // node_modules/d3-interpolate/src/array.js
20140 function genericArray(a2, b2) {
20141 var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
20142 for (i3 = 0; i3 < na; ++i3)
20143 x2[i3] = value_default(a2[i3], b2[i3]);
20144 for (; i3 < nb; ++i3)
20146 return function(t2) {
20147 for (i3 = 0; i3 < na; ++i3)
20148 c2[i3] = x2[i3](t2);
20153 // node_modules/d3-interpolate/src/date.js
20154 function date_default(a2, b2) {
20155 var d2 = /* @__PURE__ */ new Date();
20156 return a2 = +a2, b2 = +b2, function(t2) {
20157 return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
20161 // node_modules/d3-interpolate/src/number.js
20162 function number_default(a2, b2) {
20163 return a2 = +a2, b2 = +b2, function(t2) {
20164 return a2 * (1 - t2) + b2 * t2;
20168 // node_modules/d3-interpolate/src/object.js
20169 function object_default(a2, b2) {
20170 var i3 = {}, c2 = {}, k2;
20171 if (a2 === null || typeof a2 !== "object")
20173 if (b2 === null || typeof b2 !== "object")
20177 i3[k2] = value_default(a2[k2], b2[k2]);
20182 return function(t2) {
20184 c2[k2] = i3[k2](t2);
20189 // node_modules/d3-interpolate/src/string.js
20190 var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
20191 var reB = new RegExp(reA.source, "g");
20192 function zero2(b2) {
20193 return function() {
20198 return function(t2) {
20199 return b2(t2) + "";
20202 function string_default(a2, b2) {
20203 var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
20204 a2 = a2 + "", b2 = b2 + "";
20205 while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
20206 if ((bs = bm.index) > bi) {
20207 bs = b2.slice(bi, bs);
20213 if ((am = am[0]) === (bm = bm[0])) {
20220 q2.push({ i: i3, x: number_default(am, bm) });
20222 bi = reB.lastIndex;
20224 if (bi < b2.length) {
20231 return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
20232 for (var i4 = 0, o2; i4 < b2; ++i4)
20233 s2[(o2 = q2[i4]).i] = o2.x(t2);
20234 return s2.join("");
20238 // node_modules/d3-interpolate/src/value.js
20239 function value_default(a2, b2) {
20240 var t2 = typeof b2, c2;
20241 return b2 == null || t2 === "boolean" ? constant_default3(b2) : (t2 === "number" ? number_default : t2 === "string" ? (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default : b2 instanceof color ? rgb_default : b2 instanceof Date ? date_default : isNumberArray(b2) ? numberArray_default : Array.isArray(b2) ? genericArray : typeof b2.valueOf !== "function" && typeof b2.toString !== "function" || isNaN(b2) ? object_default : number_default)(a2, b2);
20244 // node_modules/d3-interpolate/src/round.js
20245 function round_default(a2, b2) {
20246 return a2 = +a2, b2 = +b2, function(t2) {
20247 return Math.round(a2 * (1 - t2) + b2 * t2);
20251 // node_modules/d3-interpolate/src/transform/decompose.js
20252 var degrees2 = 180 / Math.PI;
20261 function decompose_default(a2, b2, c2, d2, e3, f2) {
20262 var scaleX, scaleY, skewX;
20263 if (scaleX = Math.sqrt(a2 * a2 + b2 * b2))
20264 a2 /= scaleX, b2 /= scaleX;
20265 if (skewX = a2 * c2 + b2 * d2)
20266 c2 -= a2 * skewX, d2 -= b2 * skewX;
20267 if (scaleY = Math.sqrt(c2 * c2 + d2 * d2))
20268 c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
20269 if (a2 * d2 < b2 * c2)
20270 a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
20274 rotate: Math.atan2(b2, a2) * degrees2,
20275 skewX: Math.atan(skewX) * degrees2,
20281 // node_modules/d3-interpolate/src/transform/parse.js
20283 function parseCss(value) {
20284 const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
20285 return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
20287 function parseSvg(value) {
20291 svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
20292 svgNode.setAttribute("transform", value);
20293 if (!(value = svgNode.transform.baseVal.consolidate()))
20295 value = value.matrix;
20296 return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
20299 // node_modules/d3-interpolate/src/transform/index.js
20300 function interpolateTransform(parse, pxComma, pxParen, degParen) {
20302 return s2.length ? s2.pop() + " " : "";
20304 function translate(xa, ya, xb, yb, s2, q2) {
20305 if (xa !== xb || ya !== yb) {
20306 var i3 = s2.push("translate(", null, pxComma, null, pxParen);
20307 q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
20308 } else if (xb || yb) {
20309 s2.push("translate(" + xb + pxComma + yb + pxParen);
20312 function rotate(a2, b2, s2, q2) {
20316 else if (b2 - a2 > 180)
20318 q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
20320 s2.push(pop(s2) + "rotate(" + b2 + degParen);
20323 function skewX(a2, b2, s2, q2) {
20325 q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
20327 s2.push(pop(s2) + "skewX(" + b2 + degParen);
20330 function scale(xa, ya, xb, yb, s2, q2) {
20331 if (xa !== xb || ya !== yb) {
20332 var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
20333 q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
20334 } else if (xb !== 1 || yb !== 1) {
20335 s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
20338 return function(a2, b2) {
20339 var s2 = [], q2 = [];
20340 a2 = parse(a2), b2 = parse(b2);
20341 translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
20342 rotate(a2.rotate, b2.rotate, s2, q2);
20343 skewX(a2.skewX, b2.skewX, s2, q2);
20344 scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
20346 return function(t2) {
20347 var i3 = -1, n3 = q2.length, o2;
20349 s2[(o2 = q2[i3]).i] = o2.x(t2);
20350 return s2.join("");
20354 var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
20355 var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
20357 // node_modules/d3-interpolate/src/zoom.js
20358 var epsilon22 = 1e-12;
20359 function cosh(x2) {
20360 return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
20362 function sinh(x2) {
20363 return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
20365 function tanh(x2) {
20366 return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
20368 var zoom_default = function zoomRho(rho, rho2, rho4) {
20369 function zoom(p02, p1) {
20370 var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i3, S2;
20371 if (d2 < epsilon22) {
20372 S2 = Math.log(w1 / w0) / rho;
20373 i3 = function(t2) {
20377 w0 * Math.exp(rho * t2 * S2)
20381 var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
20382 S2 = (r1 - r0) / rho;
20383 i3 = function(t2) {
20384 var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
20388 w0 * coshr0 / cosh(rho * s2 + r0)
20392 i3.duration = S2 * 1e3 * rho / Math.SQRT2;
20395 zoom.rho = function(_2) {
20396 var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
20397 return zoomRho(_1, _22, _4);
20400 }(Math.SQRT2, 2, 4);
20402 // node_modules/d3-interpolate/src/quantize.js
20403 function quantize_default(interpolator, n3) {
20404 var samples = new Array(n3);
20405 for (var i3 = 0; i3 < n3; ++i3)
20406 samples[i3] = interpolator(i3 / (n3 - 1));
20410 // node_modules/d3-timer/src/timer.js
20414 var pokeDelay = 1e3;
20420 var clock = typeof performance === "object" && performance.now ? performance : Date;
20421 var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
20422 setTimeout(f2, 17);
20425 return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
20427 function clearNow() {
20431 this._call = this._time = this._next = null;
20433 Timer.prototype = timer.prototype = {
20434 constructor: Timer,
20435 restart: function(callback, delay, time) {
20436 if (typeof callback !== "function")
20437 throw new TypeError("callback is not a function");
20438 time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
20439 if (!this._next && taskTail !== this) {
20441 taskTail._next = this;
20446 this._call = callback;
20453 this._time = Infinity;
20458 function timer(callback, delay, time) {
20459 var t2 = new Timer();
20460 t2.restart(callback, delay, time);
20463 function timerFlush() {
20466 var t2 = taskHead, e3;
20468 if ((e3 = clockNow - t2._time) >= 0)
20469 t2._call.call(void 0, e3);
20475 clockNow = (clockLast = clock.now()) + clockSkew;
20476 frame = timeout = 0;
20486 var now3 = clock.now(), delay = now3 - clockLast;
20487 if (delay > pokeDelay)
20488 clockSkew -= delay, clockLast = now3;
20491 var t0, t1 = taskHead, t2, time = Infinity;
20494 if (time > t1._time)
20496 t0 = t1, t1 = t1._next;
20498 t2 = t1._next, t1._next = null;
20499 t1 = t0 ? t0._next = t2 : taskHead = t2;
20505 function sleep(time) {
20509 timeout = clearTimeout(timeout);
20510 var delay = time - clockNow;
20512 if (time < Infinity)
20513 timeout = setTimeout(wake, time - clock.now() - clockSkew);
20515 interval = clearInterval(interval);
20518 clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
20519 frame = 1, setFrame(wake);
20523 // node_modules/d3-timer/src/timeout.js
20524 function timeout_default(callback, delay, time) {
20525 var t2 = new Timer();
20526 delay = delay == null ? 0 : +delay;
20527 t2.restart((elapsed) => {
20529 callback(elapsed + delay);
20534 // node_modules/d3-transition/src/transition/schedule.js
20535 var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
20536 var emptyTween = [];
20544 function schedule_default(node, name, id2, index, group, timing) {
20545 var schedules = node.__transition;
20547 node.__transition = {};
20548 else if (id2 in schedules)
20550 create(node, id2, {
20553 // For context during callback.
20555 // For context during callback.
20559 delay: timing.delay,
20560 duration: timing.duration,
20566 function init(node, id2) {
20567 var schedule = get2(node, id2);
20568 if (schedule.state > CREATED)
20569 throw new Error("too late; already scheduled");
20572 function set2(node, id2) {
20573 var schedule = get2(node, id2);
20574 if (schedule.state > STARTED)
20575 throw new Error("too late; already running");
20578 function get2(node, id2) {
20579 var schedule = node.__transition;
20580 if (!schedule || !(schedule = schedule[id2]))
20581 throw new Error("transition not found");
20584 function create(node, id2, self2) {
20585 var schedules = node.__transition, tween;
20586 schedules[id2] = self2;
20587 self2.timer = timer(schedule, 0, self2.time);
20588 function schedule(elapsed) {
20589 self2.state = SCHEDULED;
20590 self2.timer.restart(start2, self2.delay, self2.time);
20591 if (self2.delay <= elapsed)
20592 start2(elapsed - self2.delay);
20594 function start2(elapsed) {
20595 var i3, j2, n3, o2;
20596 if (self2.state !== SCHEDULED)
20598 for (i3 in schedules) {
20599 o2 = schedules[i3];
20600 if (o2.name !== self2.name)
20602 if (o2.state === STARTED)
20603 return timeout_default(start2);
20604 if (o2.state === RUNNING) {
20607 o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
20608 delete schedules[i3];
20609 } else if (+i3 < id2) {
20612 o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
20613 delete schedules[i3];
20616 timeout_default(function() {
20617 if (self2.state === STARTED) {
20618 self2.state = RUNNING;
20619 self2.timer.restart(tick, self2.delay, self2.time);
20623 self2.state = STARTING;
20624 self2.on.call("start", node, node.__data__, self2.index, self2.group);
20625 if (self2.state !== STARTING)
20627 self2.state = STARTED;
20628 tween = new Array(n3 = self2.tween.length);
20629 for (i3 = 0, j2 = -1; i3 < n3; ++i3) {
20630 if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
20634 tween.length = j2 + 1;
20636 function tick(elapsed) {
20637 var t2 = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i3 = -1, n3 = tween.length;
20638 while (++i3 < n3) {
20639 tween[i3].call(node, t2);
20641 if (self2.state === ENDING) {
20642 self2.on.call("end", node, node.__data__, self2.index, self2.group);
20647 self2.state = ENDED;
20648 self2.timer.stop();
20649 delete schedules[id2];
20650 for (var i3 in schedules)
20652 delete node.__transition;
20656 // node_modules/d3-transition/src/interrupt.js
20657 function interrupt_default(node, name) {
20658 var schedules = node.__transition, schedule, active, empty2 = true, i3;
20661 name = name == null ? null : name + "";
20662 for (i3 in schedules) {
20663 if ((schedule = schedules[i3]).name !== name) {
20667 active = schedule.state > STARTING && schedule.state < ENDING;
20668 schedule.state = ENDED;
20669 schedule.timer.stop();
20670 schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
20671 delete schedules[i3];
20674 delete node.__transition;
20677 // node_modules/d3-transition/src/selection/interrupt.js
20678 function interrupt_default2(name) {
20679 return this.each(function() {
20680 interrupt_default(this, name);
20684 // node_modules/d3-transition/src/transition/tween.js
20685 function tweenRemove(id2, name) {
20686 var tween0, tween1;
20687 return function() {
20688 var schedule = set2(this, id2), tween = schedule.tween;
20689 if (tween !== tween0) {
20690 tween1 = tween0 = tween;
20691 for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
20692 if (tween1[i3].name === name) {
20693 tween1 = tween1.slice();
20694 tween1.splice(i3, 1);
20699 schedule.tween = tween1;
20702 function tweenFunction(id2, name, value) {
20703 var tween0, tween1;
20704 if (typeof value !== "function")
20706 return function() {
20707 var schedule = set2(this, id2), tween = schedule.tween;
20708 if (tween !== tween0) {
20709 tween1 = (tween0 = tween).slice();
20710 for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
20711 if (tween1[i3].name === name) {
20719 schedule.tween = tween1;
20722 function tween_default(name, value) {
20723 var id2 = this._id;
20725 if (arguments.length < 2) {
20726 var tween = get2(this.node(), id2).tween;
20727 for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
20728 if ((t2 = tween[i3]).name === name) {
20734 return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
20736 function tweenValue(transition2, name, value) {
20737 var id2 = transition2._id;
20738 transition2.each(function() {
20739 var schedule = set2(this, id2);
20740 (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
20742 return function(node) {
20743 return get2(node, id2).value[name];
20747 // node_modules/d3-transition/src/transition/interpolate.js
20748 function interpolate_default(a2, b2) {
20750 return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
20753 // node_modules/d3-transition/src/transition/attr.js
20754 function attrRemove2(name) {
20755 return function() {
20756 this.removeAttribute(name);
20759 function attrRemoveNS2(fullname) {
20760 return function() {
20761 this.removeAttributeNS(fullname.space, fullname.local);
20764 function attrConstant2(name, interpolate, value1) {
20765 var string00, string1 = value1 + "", interpolate0;
20766 return function() {
20767 var string0 = this.getAttribute(name);
20768 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
20771 function attrConstantNS2(fullname, interpolate, value1) {
20772 var string00, string1 = value1 + "", interpolate0;
20773 return function() {
20774 var string0 = this.getAttributeNS(fullname.space, fullname.local);
20775 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
20778 function attrFunction2(name, interpolate, value) {
20779 var string00, string10, interpolate0;
20780 return function() {
20781 var string0, value1 = value(this), string1;
20782 if (value1 == null)
20783 return void this.removeAttribute(name);
20784 string0 = this.getAttribute(name);
20785 string1 = value1 + "";
20786 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
20789 function attrFunctionNS2(fullname, interpolate, value) {
20790 var string00, string10, interpolate0;
20791 return function() {
20792 var string0, value1 = value(this), string1;
20793 if (value1 == null)
20794 return void this.removeAttributeNS(fullname.space, fullname.local);
20795 string0 = this.getAttributeNS(fullname.space, fullname.local);
20796 string1 = value1 + "";
20797 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
20800 function attr_default2(name, value) {
20801 var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
20802 return this.attrTween(name, typeof value === "function" ? (fullname.local ? attrFunctionNS2 : attrFunction2)(fullname, i3, tweenValue(this, "attr." + name, value)) : value == null ? (fullname.local ? attrRemoveNS2 : attrRemove2)(fullname) : (fullname.local ? attrConstantNS2 : attrConstant2)(fullname, i3, value));
20805 // node_modules/d3-transition/src/transition/attrTween.js
20806 function attrInterpolate(name, i3) {
20807 return function(t2) {
20808 this.setAttribute(name, i3.call(this, t2));
20811 function attrInterpolateNS(fullname, i3) {
20812 return function(t2) {
20813 this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
20816 function attrTweenNS(fullname, value) {
20819 var i3 = value.apply(this, arguments);
20821 t0 = (i0 = i3) && attrInterpolateNS(fullname, i3);
20824 tween._value = value;
20827 function attrTween(name, value) {
20830 var i3 = value.apply(this, arguments);
20832 t0 = (i0 = i3) && attrInterpolate(name, i3);
20835 tween._value = value;
20838 function attrTween_default(name, value) {
20839 var key = "attr." + name;
20840 if (arguments.length < 2)
20841 return (key = this.tween(key)) && key._value;
20843 return this.tween(key, null);
20844 if (typeof value !== "function")
20846 var fullname = namespace_default(name);
20847 return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
20850 // node_modules/d3-transition/src/transition/delay.js
20851 function delayFunction(id2, value) {
20852 return function() {
20853 init(this, id2).delay = +value.apply(this, arguments);
20856 function delayConstant(id2, value) {
20857 return value = +value, function() {
20858 init(this, id2).delay = value;
20861 function delay_default(value) {
20862 var id2 = this._id;
20863 return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
20866 // node_modules/d3-transition/src/transition/duration.js
20867 function durationFunction(id2, value) {
20868 return function() {
20869 set2(this, id2).duration = +value.apply(this, arguments);
20872 function durationConstant(id2, value) {
20873 return value = +value, function() {
20874 set2(this, id2).duration = value;
20877 function duration_default(value) {
20878 var id2 = this._id;
20879 return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
20882 // node_modules/d3-transition/src/transition/ease.js
20883 function easeConstant(id2, value) {
20884 if (typeof value !== "function")
20886 return function() {
20887 set2(this, id2).ease = value;
20890 function ease_default(value) {
20891 var id2 = this._id;
20892 return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
20895 // node_modules/d3-transition/src/transition/easeVarying.js
20896 function easeVarying(id2, value) {
20897 return function() {
20898 var v2 = value.apply(this, arguments);
20899 if (typeof v2 !== "function")
20901 set2(this, id2).ease = v2;
20904 function easeVarying_default(value) {
20905 if (typeof value !== "function")
20907 return this.each(easeVarying(this._id, value));
20910 // node_modules/d3-transition/src/transition/filter.js
20911 function filter_default2(match) {
20912 if (typeof match !== "function")
20913 match = matcher_default(match);
20914 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
20915 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
20916 if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
20917 subgroup.push(node);
20921 return new Transition(subgroups, this._parents, this._name, this._id);
20924 // node_modules/d3-transition/src/transition/merge.js
20925 function merge_default2(transition2) {
20926 if (transition2._id !== this._id)
20928 for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j2 = 0; j2 < m2; ++j2) {
20929 for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
20930 if (node = group0[i3] || group1[i3]) {
20935 for (; j2 < m0; ++j2) {
20936 merges[j2] = groups0[j2];
20938 return new Transition(merges, this._parents, this._name, this._id);
20941 // node_modules/d3-transition/src/transition/on.js
20942 function start(name) {
20943 return (name + "").trim().split(/^|\s+/).every(function(t2) {
20944 var i3 = t2.indexOf(".");
20946 t2 = t2.slice(0, i3);
20947 return !t2 || t2 === "start";
20950 function onFunction(id2, name, listener) {
20951 var on0, on1, sit = start(name) ? init : set2;
20952 return function() {
20953 var schedule = sit(this, id2), on = schedule.on;
20955 (on1 = (on0 = on).copy()).on(name, listener);
20959 function on_default2(name, listener) {
20960 var id2 = this._id;
20961 return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
20964 // node_modules/d3-transition/src/transition/remove.js
20965 function removeFunction(id2) {
20966 return function() {
20967 var parent = this.parentNode;
20968 for (var i3 in this.__transition)
20972 parent.removeChild(this);
20975 function remove_default2() {
20976 return this.on("end.remove", removeFunction(this._id));
20979 // node_modules/d3-transition/src/transition/select.js
20980 function select_default3(select) {
20981 var name = this._name, id2 = this._id;
20982 if (typeof select !== "function")
20983 select = selector_default(select);
20984 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
20985 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
20986 if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
20987 if ("__data__" in node)
20988 subnode.__data__ = node.__data__;
20989 subgroup[i3] = subnode;
20990 schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
20994 return new Transition(subgroups, this._parents, name, id2);
20997 // node_modules/d3-transition/src/transition/selectAll.js
20998 function selectAll_default3(select) {
20999 var name = this._name, id2 = this._id;
21000 if (typeof select !== "function")
21001 select = selectorAll_default(select);
21002 for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
21003 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21004 if (node = group[i3]) {
21005 for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
21006 if (child = children2[k2]) {
21007 schedule_default(child, name, id2, k2, children2, inherit2);
21010 subgroups.push(children2);
21011 parents.push(node);
21015 return new Transition(subgroups, parents, name, id2);
21018 // node_modules/d3-transition/src/transition/selection.js
21019 var Selection2 = selection_default.prototype.constructor;
21020 function selection_default2() {
21021 return new Selection2(this._groups, this._parents);
21024 // node_modules/d3-transition/src/transition/style.js
21025 function styleNull(name, interpolate) {
21026 var string00, string10, interpolate0;
21027 return function() {
21028 var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
21029 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
21032 function styleRemove2(name) {
21033 return function() {
21034 this.style.removeProperty(name);
21037 function styleConstant2(name, interpolate, value1) {
21038 var string00, string1 = value1 + "", interpolate0;
21039 return function() {
21040 var string0 = styleValue(this, name);
21041 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
21044 function styleFunction2(name, interpolate, value) {
21045 var string00, string10, interpolate0;
21046 return function() {
21047 var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
21048 if (value1 == null)
21049 string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
21050 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
21053 function styleMaybeRemove(id2, name) {
21054 var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
21055 return function() {
21056 var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
21057 if (on !== on0 || listener0 !== listener)
21058 (on1 = (on0 = on).copy()).on(event, listener0 = listener);
21062 function style_default2(name, value, priority) {
21063 var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
21064 return value == null ? this.styleTween(name, styleNull(name, i3)).on("end.style." + name, styleRemove2(name)) : typeof value === "function" ? this.styleTween(name, styleFunction2(name, i3, tweenValue(this, "style." + name, value))).each(styleMaybeRemove(this._id, name)) : this.styleTween(name, styleConstant2(name, i3, value), priority).on("end.style." + name, null);
21067 // node_modules/d3-transition/src/transition/styleTween.js
21068 function styleInterpolate(name, i3, priority) {
21069 return function(t2) {
21070 this.style.setProperty(name, i3.call(this, t2), priority);
21073 function styleTween(name, value, priority) {
21076 var i3 = value.apply(this, arguments);
21078 t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
21081 tween._value = value;
21084 function styleTween_default(name, value, priority) {
21085 var key = "style." + (name += "");
21086 if (arguments.length < 2)
21087 return (key = this.tween(key)) && key._value;
21089 return this.tween(key, null);
21090 if (typeof value !== "function")
21092 return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
21095 // node_modules/d3-transition/src/transition/text.js
21096 function textConstant2(value) {
21097 return function() {
21098 this.textContent = value;
21101 function textFunction2(value) {
21102 return function() {
21103 var value1 = value(this);
21104 this.textContent = value1 == null ? "" : value1;
21107 function text_default2(value) {
21108 return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
21111 // node_modules/d3-transition/src/transition/textTween.js
21112 function textInterpolate(i3) {
21113 return function(t2) {
21114 this.textContent = i3.call(this, t2);
21117 function textTween(value) {
21120 var i3 = value.apply(this, arguments);
21122 t0 = (i0 = i3) && textInterpolate(i3);
21125 tween._value = value;
21128 function textTween_default(value) {
21130 if (arguments.length < 1)
21131 return (key = this.tween(key)) && key._value;
21133 return this.tween(key, null);
21134 if (typeof value !== "function")
21136 return this.tween(key, textTween(value));
21139 // node_modules/d3-transition/src/transition/transition.js
21140 function transition_default() {
21141 var name = this._name, id0 = this._id, id1 = newId();
21142 for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
21143 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21144 if (node = group[i3]) {
21145 var inherit2 = get2(node, id0);
21146 schedule_default(node, name, id1, i3, group, {
21147 time: inherit2.time + inherit2.delay + inherit2.duration,
21149 duration: inherit2.duration,
21150 ease: inherit2.ease
21155 return new Transition(groups, this._parents, name, id1);
21158 // node_modules/d3-transition/src/transition/end.js
21159 function end_default() {
21160 var on0, on1, that = this, id2 = that._id, size = that.size();
21161 return new Promise(function(resolve, reject) {
21162 var cancel = { value: reject }, end = { value: function() {
21166 that.each(function() {
21167 var schedule = set2(this, id2), on = schedule.on;
21169 on1 = (on0 = on).copy();
21170 on1._.cancel.push(cancel);
21171 on1._.interrupt.push(cancel);
21172 on1._.end.push(end);
21181 // node_modules/d3-transition/src/transition/index.js
21183 function Transition(groups, parents, name, id2) {
21184 this._groups = groups;
21185 this._parents = parents;
21189 function transition(name) {
21190 return selection_default().transition(name);
21195 var selection_prototype = selection_default.prototype;
21196 Transition.prototype = transition.prototype = {
21197 constructor: Transition,
21198 select: select_default3,
21199 selectAll: selectAll_default3,
21200 selectChild: selection_prototype.selectChild,
21201 selectChildren: selection_prototype.selectChildren,
21202 filter: filter_default2,
21203 merge: merge_default2,
21204 selection: selection_default2,
21205 transition: transition_default,
21206 call: selection_prototype.call,
21207 nodes: selection_prototype.nodes,
21208 node: selection_prototype.node,
21209 size: selection_prototype.size,
21210 empty: selection_prototype.empty,
21211 each: selection_prototype.each,
21213 attr: attr_default2,
21214 attrTween: attrTween_default,
21215 style: style_default2,
21216 styleTween: styleTween_default,
21217 text: text_default2,
21218 textTween: textTween_default,
21219 remove: remove_default2,
21220 tween: tween_default,
21221 delay: delay_default,
21222 duration: duration_default,
21223 ease: ease_default,
21224 easeVarying: easeVarying_default,
21226 [Symbol.iterator]: selection_prototype[Symbol.iterator]
21229 // node_modules/d3-ease/src/linear.js
21230 var linear2 = (t2) => +t2;
21232 // node_modules/d3-ease/src/cubic.js
21233 function cubicInOut(t2) {
21234 return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
21237 // node_modules/d3-transition/src/selection/transition.js
21238 var defaultTiming = {
21245 function inherit(node, id2) {
21247 while (!(timing = node.__transition) || !(timing = timing[id2])) {
21248 if (!(node = node.parentNode)) {
21249 throw new Error("transition ".concat(id2, " not found"));
21254 function transition_default2(name) {
21256 if (name instanceof Transition) {
21257 id2 = name._id, name = name._name;
21259 id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
21261 for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
21262 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
21263 if (node = group[i3]) {
21264 schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
21268 return new Transition(groups, this._parents, name, id2);
21271 // node_modules/d3-transition/src/selection/index.js
21272 selection_default.prototype.interrupt = interrupt_default2;
21273 selection_default.prototype.transition = transition_default2;
21275 // node_modules/d3-zoom/src/constant.js
21276 var constant_default4 = (x2) => () => x2;
21278 // node_modules/d3-zoom/src/event.js
21279 function ZoomEvent(type2, {
21282 transform: transform2,
21283 dispatch: dispatch14
21285 Object.defineProperties(this, {
21286 type: { value: type2, enumerable: true, configurable: true },
21287 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
21288 target: { value: target, enumerable: true, configurable: true },
21289 transform: { value: transform2, enumerable: true, configurable: true },
21290 _: { value: dispatch14 }
21294 // node_modules/d3-zoom/src/transform.js
21295 function Transform(k2, x2, y2) {
21300 Transform.prototype = {
21301 constructor: Transform,
21302 scale: function(k2) {
21303 return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
21305 translate: function(x2, y2) {
21306 return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
21308 apply: function(point2) {
21309 return [point2[0] * this.k + this.x, point2[1] * this.k + this.y];
21311 applyX: function(x2) {
21312 return x2 * this.k + this.x;
21314 applyY: function(y2) {
21315 return y2 * this.k + this.y;
21317 invert: function(location) {
21318 return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
21320 invertX: function(x2) {
21321 return (x2 - this.x) / this.k;
21323 invertY: function(y2) {
21324 return (y2 - this.y) / this.k;
21326 rescaleX: function(x2) {
21327 return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
21329 rescaleY: function(y2) {
21330 return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
21332 toString: function() {
21333 return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
21336 var identity2 = new Transform(1, 0, 0);
21337 transform.prototype = Transform.prototype;
21338 function transform(node) {
21339 while (!node.__zoom)
21340 if (!(node = node.parentNode))
21342 return node.__zoom;
21345 // node_modules/d3-zoom/src/noevent.js
21346 function nopropagation2(event) {
21347 event.stopImmediatePropagation();
21349 function noevent_default2(event) {
21350 event.preventDefault();
21351 event.stopImmediatePropagation();
21354 // node_modules/d3-zoom/src/zoom.js
21355 function defaultFilter2(event) {
21356 return (!event.ctrlKey || event.type === "wheel") && !event.button;
21358 function defaultExtent() {
21360 if (e3 instanceof SVGElement) {
21361 e3 = e3.ownerSVGElement || e3;
21362 if (e3.hasAttribute("viewBox")) {
21363 e3 = e3.viewBox.baseVal;
21364 return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
21366 return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
21368 return [[0, 0], [e3.clientWidth, e3.clientHeight]];
21370 function defaultTransform() {
21371 return this.__zoom || identity2;
21373 function defaultWheelDelta(event) {
21374 return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
21376 function defaultTouchable2() {
21377 return navigator.maxTouchPoints || "ontouchstart" in this;
21379 function defaultConstrain(transform2, extent, translateExtent) {
21380 var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
21381 return transform2.translate(
21382 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
21383 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
21386 function zoom_default2() {
21387 var filter2 = defaultFilter2, extent = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate = zoom_default, listeners = dispatch_default("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10;
21388 function zoom(selection2) {
21389 selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
21391 zoom.transform = function(collection, transform2, point2, event) {
21392 var selection2 = collection.selection ? collection.selection() : collection;
21393 selection2.property("__zoom", defaultTransform);
21394 if (collection !== selection2) {
21395 schedule(collection, transform2, point2, event);
21397 selection2.interrupt().each(function() {
21398 gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
21402 zoom.scaleBy = function(selection2, k2, p2, event) {
21403 zoom.scaleTo(selection2, function() {
21404 var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
21408 zoom.scaleTo = function(selection2, k2, p2, event) {
21409 zoom.transform(selection2, function() {
21410 var e3 = extent.apply(this, arguments), t0 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
21411 return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
21414 zoom.translateBy = function(selection2, x2, y2, event) {
21415 zoom.transform(selection2, function() {
21416 return constrain(this.__zoom.translate(
21417 typeof x2 === "function" ? x2.apply(this, arguments) : x2,
21418 typeof y2 === "function" ? y2.apply(this, arguments) : y2
21419 ), extent.apply(this, arguments), translateExtent);
21422 zoom.translateTo = function(selection2, x2, y2, p2, event) {
21423 zoom.transform(selection2, function() {
21424 var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
21425 return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
21426 typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
21427 typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
21428 ), e3, translateExtent);
21431 function scale(transform2, k2) {
21432 k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
21433 return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
21435 function translate(transform2, p02, p1) {
21436 var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
21437 return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
21439 function centroid(extent2) {
21440 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
21442 function schedule(transition2, transform2, point2, event) {
21443 transition2.on("start.zoom", function() {
21444 gesture(this, arguments).event(event).start();
21445 }).on("interrupt.zoom end.zoom", function() {
21446 gesture(this, arguments).event(event).end();
21447 }).tween("zoom", function() {
21448 var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point2 == null ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = that.__zoom, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
21449 return function(t2) {
21453 var l2 = i3(t2), k2 = w2 / l2[2];
21454 t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
21460 function gesture(that, args, clean2) {
21461 return !clean2 && that.__zooming || new Gesture(that, args);
21463 function Gesture(that, args) {
21467 this.sourceEvent = null;
21468 this.extent = extent.apply(that, args);
21471 Gesture.prototype = {
21472 event: function(event) {
21474 this.sourceEvent = event;
21477 start: function() {
21478 if (++this.active === 1) {
21479 this.that.__zooming = this;
21480 this.emit("start");
21484 zoom: function(key, transform2) {
21485 if (this.mouse && key !== "mouse")
21486 this.mouse[1] = transform2.invert(this.mouse[0]);
21487 if (this.touch0 && key !== "touch")
21488 this.touch0[1] = transform2.invert(this.touch0[0]);
21489 if (this.touch1 && key !== "touch")
21490 this.touch1[1] = transform2.invert(this.touch1[0]);
21491 this.that.__zoom = transform2;
21496 if (--this.active === 0) {
21497 delete this.that.__zooming;
21502 emit: function(type2) {
21503 var d2 = select_default2(this.that).datum();
21507 new ZoomEvent(type2, {
21508 sourceEvent: this.sourceEvent,
21511 transform: this.that.__zoom,
21512 dispatch: listeners
21518 function wheeled(event, ...args) {
21519 if (!filter2.apply(this, arguments))
21521 var g3 = gesture(this, args).event(event), t2 = this.__zoom, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = pointer_default(event);
21523 if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
21524 g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
21526 clearTimeout(g3.wheel);
21527 } else if (t2.k === k2)
21530 g3.mouse = [p2, t2.invert(p2)];
21531 interrupt_default(this);
21534 noevent_default2(event);
21535 g3.wheel = setTimeout(wheelidled, wheelDelay);
21536 g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
21537 function wheelidled() {
21542 function mousedowned(event, ...args) {
21543 if (touchending || !filter2.apply(this, arguments))
21545 var currentTarget = event.currentTarget, g3 = gesture(this, args, true).event(event), v2 = select_default2(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p2 = pointer_default(event, currentTarget), x05 = event.clientX, y05 = event.clientY;
21546 nodrag_default(event.view);
21547 nopropagation2(event);
21548 g3.mouse = [p2, this.__zoom.invert(p2)];
21549 interrupt_default(this);
21551 function mousemoved(event2) {
21552 noevent_default2(event2);
21554 var dx = event2.clientX - x05, dy = event2.clientY - y05;
21555 g3.moved = dx * dx + dy * dy > clickDistance2;
21557 g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
21559 function mouseupped(event2) {
21560 v2.on("mousemove.zoom mouseup.zoom", null);
21561 yesdrag(event2.view, g3.moved);
21562 noevent_default2(event2);
21563 g3.event(event2).end();
21566 function dblclicked(event, ...args) {
21567 if (!filter2.apply(this, arguments))
21569 var t0 = this.__zoom, p02 = pointer_default(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t0.invert(p02), k1 = t0.k * (event.shiftKey ? 0.5 : 2), t1 = constrain(translate(scale(t0, k1), p02, p1), extent.apply(this, args), translateExtent);
21570 noevent_default2(event);
21572 select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
21574 select_default2(this).call(zoom.transform, t1, p02, event);
21576 function touchstarted(event, ...args) {
21577 if (!filter2.apply(this, arguments))
21579 var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
21580 nopropagation2(event);
21581 for (i3 = 0; i3 < n3; ++i3) {
21582 t2 = touches[i3], p2 = pointer_default(t2, this);
21583 p2 = [p2, this.__zoom.invert(p2), t2.identifier];
21585 g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
21586 else if (!g3.touch1 && g3.touch0[2] !== p2[2])
21587 g3.touch1 = p2, g3.taps = 0;
21590 touchstarting = clearTimeout(touchstarting);
21593 touchfirst = p2[0], touchstarting = setTimeout(function() {
21594 touchstarting = null;
21596 interrupt_default(this);
21600 function touchmoved(event, ...args) {
21601 if (!this.__zooming)
21603 var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
21604 noevent_default2(event);
21605 for (i3 = 0; i3 < n3; ++i3) {
21606 t2 = touches[i3], p2 = pointer_default(t2, this);
21607 if (g3.touch0 && g3.touch0[2] === t2.identifier)
21609 else if (g3.touch1 && g3.touch1[2] === t2.identifier)
21612 t2 = g3.that.__zoom;
21614 var p02 = g3.touch0[0], l0 = g3.touch0[1], p1 = g3.touch1[0], l1 = g3.touch1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
21615 t2 = scale(t2, Math.sqrt(dp / dl));
21616 p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
21617 l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
21618 } else if (g3.touch0)
21619 p2 = g3.touch0[0], l2 = g3.touch0[1];
21622 g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
21624 function touchended(event, ...args) {
21625 if (!this.__zooming)
21627 var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
21628 nopropagation2(event);
21630 clearTimeout(touchending);
21631 touchending = setTimeout(function() {
21632 touchending = null;
21634 for (i3 = 0; i3 < n3; ++i3) {
21636 if (g3.touch0 && g3.touch0[2] === t2.identifier)
21638 else if (g3.touch1 && g3.touch1[2] === t2.identifier)
21641 if (g3.touch1 && !g3.touch0)
21642 g3.touch0 = g3.touch1, delete g3.touch1;
21644 g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
21647 if (g3.taps === 2) {
21648 t2 = pointer_default(t2, this);
21649 if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
21650 var p2 = select_default2(this).on("dblclick.zoom");
21652 p2.apply(this, arguments);
21657 zoom.wheelDelta = function(_2) {
21658 return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
21660 zoom.filter = function(_2) {
21661 return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
21663 zoom.touchable = function(_2) {
21664 return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
21666 zoom.extent = function(_2) {
21667 return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
21669 zoom.scaleExtent = function(_2) {
21670 return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
21672 zoom.translateExtent = function(_2) {
21673 return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
21675 zoom.constrain = function(_2) {
21676 return arguments.length ? (constrain = _2, zoom) : constrain;
21678 zoom.duration = function(_2) {
21679 return arguments.length ? (duration = +_2, zoom) : duration;
21681 zoom.interpolate = function(_2) {
21682 return arguments.length ? (interpolate = _2, zoom) : interpolate;
21684 zoom.on = function() {
21685 var value = listeners.on.apply(listeners, arguments);
21686 return value === listeners ? zoom : value;
21688 zoom.clickDistance = function(_2) {
21689 return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
21691 zoom.tapDistance = function(_2) {
21692 return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
21697 // modules/geo/raw_mercator.js
21698 function geoRawMercator() {
21699 var project = mercatorRaw;
21700 var k2 = 512 / Math.PI;
21703 var clipExtent = [[0, 0], [0, 0]];
21704 function projection2(point2) {
21705 point2 = project(point2[0] * Math.PI / 180, point2[1] * Math.PI / 180);
21706 return [point2[0] * k2 + x2, y2 - point2[1] * k2];
21708 projection2.invert = function(point2) {
21709 point2 = project.invert((point2[0] - x2) / k2, (y2 - point2[1]) / k2);
21710 return point2 && [point2[0] * 180 / Math.PI, point2[1] * 180 / Math.PI];
21712 projection2.scale = function(_2) {
21713 if (!arguments.length)
21716 return projection2;
21718 projection2.translate = function(_2) {
21719 if (!arguments.length)
21723 return projection2;
21725 projection2.clipExtent = function(_2) {
21726 if (!arguments.length)
21729 return projection2;
21731 projection2.transform = function(obj) {
21732 if (!arguments.length)
21733 return identity2.translate(x2, y2).scale(k2);
21737 return projection2;
21739 projection2.stream = transform_default({
21740 point: function(x3, y3) {
21741 var vec = projection2([x3, y3]);
21742 this.stream.point(vec[0], vec[1]);
21745 return projection2;
21748 // modules/geo/ortho.js
21749 function geoOrthoNormalizedDotProduct(a2, b2, origin) {
21750 if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
21753 return geoVecNormalizedDot(a2, b2, origin);
21755 function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
21756 var val = Math.abs(dotp);
21757 if (val < epsilon3) {
21759 } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
21761 } else if (val < lowerThreshold || val > upperThreshold) {
21767 function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
21769 var first = isClosed ? 0 : 1;
21770 var last = isClosed ? points.length : points.length - 1;
21771 var coords = points.map(function(p2) {
21774 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
21775 var upperThreshold = Math.cos(threshold * Math.PI / 180);
21776 for (var i3 = first; i3 < last; i3++) {
21777 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
21778 var origin = coords[i3];
21779 var b2 = coords[(i3 + 1) % coords.length];
21780 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
21783 score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
21787 function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
21788 var max3 = -Infinity;
21789 var first = isClosed ? 0 : 1;
21790 var last = isClosed ? coords.length : coords.length - 1;
21791 for (var i3 = first; i3 < last; i3++) {
21792 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
21793 var origin = coords[i3];
21794 var b2 = coords[(i3 + 1) % coords.length];
21795 var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
21796 var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
21798 angle2 = 90 - angle2;
21799 if (angle2 >= lessThan)
21804 if (max3 === -Infinity)
21808 function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
21810 var first = isClosed ? 0 : 1;
21811 var last = isClosed ? coords.length : coords.length - 1;
21812 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
21813 var upperThreshold = Math.cos(threshold * Math.PI / 180);
21814 for (var i3 = first; i3 < last; i3++) {
21815 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
21816 var origin = coords[i3];
21817 var b2 = coords[(i3 + 1) % coords.length];
21818 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
21821 if (Math.abs(dotp) > 0)
21828 // modules/osm/tags.js
21829 function osmIsInterestingTag(key) {
21830 return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
21831 key.indexOf("tiger:") !== 0;
21833 var osmLifecyclePrefixes = {
21834 // nonexistent, might be built
21837 // under maintentance or between groundbreaking and opening
21838 construction: true,
21839 // existent but not functional
21841 // dilapidated to nonexistent
21844 // nonexistent, still may appear in imagery
21851 // existent occasionally, e.g. stormwater drainage basin
21854 function osmRemoveLifecyclePrefix(key) {
21855 const keySegments = key.split(":");
21856 if (keySegments.length === 1)
21858 if (keySegments[0] in osmLifecyclePrefixes) {
21859 return key.slice(keySegments[0].length + 1);
21863 var osmAreaKeys = {};
21864 function osmSetAreaKeys(value) {
21865 osmAreaKeys = value;
21867 var osmAreaKeysExceptions = {
21873 public_transport: {
21888 bicycle_parking: true
21891 function osmTagSuggestingArea(tags) {
21892 if (tags.area === "yes")
21893 return { area: "yes" };
21894 if (tags.area === "no")
21896 var returnTags = {};
21897 for (var realKey in tags) {
21898 const key = osmRemoveLifecyclePrefix(realKey);
21899 if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
21900 returnTags[realKey] = tags[realKey];
21903 if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
21904 returnTags[realKey] = tags[realKey];
21910 var osmLineTags = {};
21911 function osmSetLineTags(value) {
21912 osmLineTags = value;
21914 var osmPointTags = {};
21915 function osmSetPointTags(value) {
21916 osmPointTags = value;
21918 var osmVertexTags = {};
21919 function osmSetVertexTags(value) {
21920 osmVertexTags = value;
21922 function osmNodeGeometriesForTags(nodeTags) {
21923 var geometries = {};
21924 for (var key in nodeTags) {
21925 if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
21926 geometries.point = true;
21928 if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
21929 geometries.vertex = true;
21931 if (geometries.point && geometries.vertex)
21936 var osmOneWayTags = {
21938 "chair_lift": true,
21941 "magic_carpet": true,
21942 "mixed_lift": true,
21956 "goods_conveyor": true,
21957 "piste:halfpipe": true
21965 "two-way_route": true,
21966 "recommended_traffic_lane": true,
21967 "separation_lane": true,
21968 "separation_roundabout": true
21975 "pressurised": true,
21979 "tidal_channel": true
21982 var osmPavedTags = {
21988 "concrete:lanes": true,
21989 "concrete:plates": true
21995 var osmSemipavedTags = {
21997 "cobblestone": true,
21998 "cobblestone:flattened": true,
21999 "unhewn_cobblestone": true,
22001 "paving_stones": true,
22006 var osmRightSideIsInsideTags = {
22009 "coastline": "coastline"
22012 "retaining_wall": true,
22014 "guard_rail": true,
22018 "embankment": true,
22025 var osmRoutableHighwayTagValues = {
22032 motorway_link: true,
22034 primary_link: true,
22035 secondary_link: true,
22036 tertiary_link: true,
22037 unclassified: true,
22041 living_street: true,
22042 bus_guideway: true,
22052 var osmPathHighwayTagValues = {
22061 var osmRailwayTrackTagValues = {
22069 narrow_gauge: true,
22073 var osmFlowingWaterwayTagValues = {
22080 tidal_channel: true
22082 var allowUpperCaseTagValues = /network|taxon|genus|species|brand|grape_variety|royal_cypher|listed_status|booth|rating|stars|:output|_hours|_times|_ref|manufacturer|country|target|brewery|cai_scale|traffic_sign/;
22083 function isColourValid(value) {
22084 if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
22087 if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
22092 var osmMutuallyExclusiveTagPairs = [
22093 ["noname", "name"],
22095 ["nohousenumber", "addr:housenumber"],
22096 ["noaddress", "addr:housenumber"],
22097 ["noaddress", "addr:housename"],
22098 ["noaddress", "addr:unit"],
22099 ["addr:nostreet", "addr:street"]
22102 // modules/util/array.js
22103 function utilArrayIdentical(a2, b2) {
22106 var i3 = a2.length;
22107 if (i3 !== b2.length)
22110 if (a2[i3] !== b2[i3])
22115 function utilArrayDifference(a2, b2) {
22116 var other = new Set(b2);
22117 return Array.from(new Set(a2)).filter(function(v2) {
22118 return !other.has(v2);
22121 function utilArrayIntersection(a2, b2) {
22122 var other = new Set(b2);
22123 return Array.from(new Set(a2)).filter(function(v2) {
22124 return other.has(v2);
22127 function utilArrayUnion(a2, b2) {
22128 var result = new Set(a2);
22129 b2.forEach(function(v2) {
22132 return Array.from(result);
22134 function utilArrayUniq(a2) {
22135 return Array.from(new Set(a2));
22137 function utilArrayChunk(a2, chunkSize) {
22138 if (!chunkSize || chunkSize < 0)
22139 return [a2.slice()];
22140 var result = new Array(Math.ceil(a2.length / chunkSize));
22141 return Array.from(result, function(item, i3) {
22142 return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
22145 function utilArrayFlatten(a2) {
22146 return a2.reduce(function(acc, val) {
22147 return acc.concat(val);
22150 function utilArrayGroupBy(a2, key) {
22151 return a2.reduce(function(acc, item) {
22152 var group = typeof key === "function" ? key(item) : item[key];
22153 (acc[group] = acc[group] || []).push(item);
22157 function utilArrayUniqBy(a2, key) {
22158 var seen = /* @__PURE__ */ new Set();
22159 return a2.reduce(function(acc, item) {
22160 var val = typeof key === "function" ? key(item) : item[key];
22161 if (val && !seen.has(val)) {
22169 // modules/util/util.js
22170 var import_diacritics = __toESM(require_diacritics());
22172 // modules/util/svg_paths_rtl_fix.js
22173 var import_alif_toolkit = __toESM(require_lib());
22174 var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
22175 function fixRTLTextForSvg(inputText) {
22176 var ret = "", rtlBuffer = [];
22177 var arabicRegex = /[\u0600-\u06FF]/g;
22178 var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
22179 var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
22180 var thaanaVowel = /[\u07A6-\u07B0]/;
22181 var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
22182 if (arabicRegex.test(inputText)) {
22183 inputText = (0, import_alif_toolkit.WordShaper)(inputText);
22185 for (var n3 = 0; n3 < inputText.length; n3++) {
22186 var c2 = inputText[n3];
22187 if (arabicMath.test(c2)) {
22188 ret += rtlBuffer.reverse().join("");
22191 if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
22192 ret += rtlBuffer.reverse().join("");
22195 if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
22196 rtlBuffer[rtlBuffer.length - 1] += c2;
22197 } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
22198 rtlBuffer.push(c2);
22199 } else if (c2 === " " && rtlBuffer.length) {
22200 rtlBuffer = [rtlBuffer.reverse().join("") + " "];
22202 ret += rtlBuffer.reverse().join("") + c2;
22207 ret += rtlBuffer.reverse().join("");
22211 // modules/core/preferences.js
22214 _storage = localStorage;
22217 _storage = _storage || /* @__PURE__ */ (() => {
22220 getItem: (k2) => s2[k2],
22221 setItem: (k2, v2) => s2[k2] = v2,
22222 removeItem: (k2) => delete s2[k2]
22225 var _listeners = {};
22226 function corePreferences(k2, v2) {
22229 return _storage.getItem(k2);
22230 else if (v2 === null)
22231 _storage.removeItem(k2);
22233 _storage.setItem(k2, v2);
22234 if (_listeners[k2]) {
22235 _listeners[k2].forEach((handler) => handler(v2));
22239 if (typeof console !== "undefined") {
22240 console.error("localStorage quota exceeded");
22245 corePreferences.onChange = function(k2, handler) {
22246 _listeners[k2] = _listeners[k2] || [];
22247 _listeners[k2].push(handler);
22250 // modules/core/file_fetcher.js
22251 var import_vparse = __toESM(require_vparse());
22254 var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
22255 var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
22256 var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
22257 var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
22258 var defaultOsmApiConnections = {
22260 url: "https://www.openstreetmap.org",
22261 apiUrl: "https://api.openstreetmap.org",
22262 client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc",
22263 client_secret: "BTlNrNxIPitHdL4sP2clHw5KLoee9aKkA7dQbc0Bj7Q"
22266 url: "https://api06.dev.openstreetmap.org",
22267 client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw",
22268 client_secret: "OnfWFC-JkZNHyYdr_viNn_h_RTZXRslKcUxllOXqf5g"
22271 var osmApiConnections = [];
22273 osmApiConnections.push({
22275 apiUrl: ENV__ID_API_CONNECTION_API_URL,
22277 client_secret: null
22279 } else if (false) {
22280 osmApiConnections.push(defaultOsmApiConnections[null]);
22282 osmApiConnections.push(defaultOsmApiConnections.live);
22283 osmApiConnections.push(defaultOsmApiConnections.dev);
22285 var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
22286 var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
22287 var showDonationMessage = true;
22290 var package_default = {
22293 description: "A friendly editor for OpenStreetMap",
22294 main: "dist/iD.min.js",
22295 repository: "github:openstreetmap/iD",
22296 homepage: "https://github.com/openstreetmap/iD",
22297 bugs: "https://github.com/openstreetmap/iD/issues",
22304 all: "run-s clean build dist",
22305 build: "run-s build:css build:data build:js",
22306 "build:css": "node scripts/build_css.js",
22307 "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
22308 "build:stats": "node config/esbuild.config.mjs --stats && esbuild-visualizer --metadata dist/esbuild.json --exclude *.png --filename docs/statistics.html && shx rm dist/esbuild.json",
22309 "build:js": "node config/esbuild.config.mjs",
22310 "build:js:watch": "node config/esbuild.config.mjs --watch",
22311 clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
22312 dist: "run-p dist:**",
22313 "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
22314 "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
22315 "dist:min": "node config/esbuild.config.min.mjs",
22316 "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
22317 "dist:svg:community": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "community-%s" --symbol-sprite dist/img/community-sprite.svg node_modules/osm-community-index/dist/img/*.svg',
22318 "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
22319 "dist:svg:maki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "maki-%s" --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg',
22320 "dist:svg:mapillary:signs": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_signs/*.svg",
22321 "dist:svg:mapillary:objects": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/mapillary-object-sprite.svg node_modules/@rapideditor/mapillary_sprite_source/package_objects/*.svg",
22322 "dist:svg:roentgen": 'svg-sprite --shape-id-generator "roentgen-%s" --shape-dim-width 16 --shape-dim-height 16 --symbol --symbol-dest . --symbol-sprite dist/img/roentgen-sprite.svg svg/roentgen/*.svg',
22323 "dist:svg:temaki": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "temaki-%s" --symbol-sprite dist/img/temaki-sprite.svg node_modules/@rapideditor/temaki/icons/*.svg',
22324 imagery: "node scripts/update_imagery.js",
22325 lint: "eslint config scripts test/spec modules -c config/eslint.config.mjs",
22326 "lint:fix": "eslint scripts test/spec modules -c config/eslint.config.mjs --fix",
22327 start: "run-s start:watch",
22328 "start:single-build": "run-p build:js start:server",
22329 "start:watch": "run-p build:js:watch start:server",
22330 "start:server": "node scripts/server.js",
22331 test: "npm-run-all -s lint build test:spec",
22332 "test:spec": "karma start config/karma.conf.js",
22333 translations: "node scripts/update_locales.js"
22336 "@mapbox/geojson-area": "^0.2.2",
22337 "@mapbox/sexagesimal": "1.2.0",
22338 "@mapbox/vector-tile": "^1.3.1",
22339 "@rapideditor/country-coder": "~5.2.2",
22340 "@rapideditor/location-conflation": "~1.3.0",
22341 "@tmcw/togeojson": "^5.8.1",
22342 "@turf/bbox": "^6.0.0",
22343 "@turf/bbox-clip": "^6.0.0",
22344 "abortcontroller-polyfill": "^1.7.5",
22345 "aes-js": "^3.1.2",
22346 "alif-toolkit": "^1.2.9",
22347 "core-js-bundle": "^3.37.0",
22348 diacritics: "1.3.0",
22350 "fast-deep-equal": "~3.1.1",
22351 "fast-json-stable-stringify": "2.1.0",
22352 "lodash-es": "~4.17.15",
22354 "node-diff3": "~3.1.0",
22355 "osm-auth": "~2.4.0",
22356 pannellum: "2.5.6",
22358 "polygon-clipping": "~0.15.7",
22360 "whatwg-fetch": "^3.6.20",
22361 "which-polygon": "2.2.1"
22364 "@fortawesome/fontawesome-svg-core": "~6.5.2",
22365 "@fortawesome/free-brands-svg-icons": "~6.5.2",
22366 "@fortawesome/free-regular-svg-icons": "~6.5.2",
22367 "@fortawesome/free-solid-svg-icons": "~6.5.2",
22368 "@mapbox/maki": "^8.0.1",
22369 "@openstreetmap/id-tagging-schema": "^6.7.3",
22370 "@rapideditor/mapillary_sprite_source": "^1.8.0",
22371 "@rapideditor/temaki": "^5.8.0",
22372 "@transifex/api": "^7.1.0",
22373 autoprefixer: "^10.4.19",
22374 browserslist: "^4.23.0",
22375 "browserslist-to-esbuild": "^2.1.1",
22378 "cldr-core": "^45.0.0",
22379 "cldr-localenames-full": "^45.0.0",
22380 "concat-files": "^0.1.1",
22383 "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
22384 esbuild: "^0.20.2",
22385 "esbuild-visualizer": "^0.6.0",
22387 "fetch-mock": "^9.11.0",
22391 "js-yaml": "^4.0.0",
22392 "json-stringify-pretty-compact": "^3.0.0",
22394 "karma-chrome-launcher": "^3.2.0",
22395 "karma-coverage": "2.1.1",
22396 "karma-mocha": "^2.0.1",
22397 "karma-remap-istanbul": "^0.6.0",
22398 "mapillary-js": "4.1.2",
22399 minimist: "^1.2.8",
22401 "name-suggestion-index": "~6.0",
22402 "npm-run-all": "^4.0.0",
22403 "osm-community-index": "~5.6.2",
22404 postcss: "^8.4.38",
22405 "postcss-selector-prepend": "^0.5.0",
22409 "sinon-chai": "^3.7.0",
22411 "static-server": "^2.2.1",
22412 "svg-sprite": "2.0.4",
22419 "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
22423 // modules/core/file_fetcher.js
22424 var _mainFileFetcher = coreFileFetcher();
22425 function coreFileFetcher() {
22426 const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
22427 const v2 = (0, import_vparse.default)(ociVersion);
22428 const ociVersionMinor = "".concat(v2.major, ".").concat(v2.minor);
22429 const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
22431 let _inflight4 = {};
22433 "address_formats": "data/address_formats.min.json",
22434 "imagery": "data/imagery.min.json",
22435 "intro_graph": "data/intro_graph.min.json",
22436 "keepRight": "data/keepRight.min.json",
22437 "languages": "data/languages.min.json",
22438 "locales": "locales/index.min.json",
22439 "phone_formats": "data/phone_formats.min.json",
22440 "qa_data": "data/qa_data.min.json",
22441 "shortcuts": "data/shortcuts.min.json",
22442 "territory_languages": "data/territory_languages.min.json",
22443 "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
22444 "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
22445 "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
22446 "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
22447 "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
22448 "discarded": presetsCdnUrl + "dist/discarded.min.json",
22449 "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
22450 "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
22451 "preset_fields": presetsCdnUrl + "dist/fields.min.json",
22452 "preset_presets": presetsCdnUrl + "dist/presets.min.json",
22453 "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
22455 let _cachedData = {};
22456 _this.cache = () => _cachedData;
22457 _this.get = (which) => {
22458 if (_cachedData[which]) {
22459 return Promise.resolve(_cachedData[which]);
22461 const file = _fileMap[which];
22462 const url = file && _this.asset(file);
22464 return Promise.reject('Unknown data file for "'.concat(which, '"'));
22466 if (url.includes("{presets_version}")) {
22467 return _this.get("presets_package").then((result) => {
22468 const presetsVersion2 = result.version;
22469 return getUrl(url.replace("{presets_version}", presetsVersion2), which);
22472 return getUrl(url);
22475 function getUrl(url, which) {
22476 let prom = _inflight4[url];
22478 _inflight4[url] = prom = fetch(url).then((response) => {
22479 if (!response.ok || !response.json) {
22480 throw new Error(response.status + " " + response.statusText);
22482 if (response.status === 204 || response.status === 205)
22484 return response.json();
22485 }).then((result) => {
22486 delete _inflight4[url];
22488 throw new Error('No data loaded for "'.concat(which, '"'));
22490 _cachedData[which] = result;
22492 }).catch((err) => {
22493 delete _inflight4[url];
22499 _this.fileMap = function(val) {
22500 if (!arguments.length)
22505 let _assetPath = "";
22506 _this.assetPath = function(val) {
22507 if (!arguments.length)
22512 let _assetMap = {};
22513 _this.assetMap = function(val) {
22514 if (!arguments.length)
22519 _this.asset = (val) => {
22520 if (/^http(s)?:\/\//i.test(val))
22522 const filename = _assetPath + val;
22523 return _assetMap[filename] || filename;
22528 // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
22529 var import_which_polygon = __toESM(require_which_polygon(), 1);
22530 var borders_default = { type: "FeatureCollection", features: [
22531 { type: "Feature", properties: { wikidata: "Q21", nameEn: "England", aliases: ["GB-ENG"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.03913, 51.13217], [-7.74976, 48.64773], [1.17405, 50.74239], [2.18458, 51.52087], [2.56575, 51.85301], [0.792, 57.56437], [-2.30613, 55.62698], [-2.17058, 55.45916], [-2.6095, 55.28488], [-2.63532, 55.19452], [-3.02906, 55.04606], [-3.09361, 54.94924], [-3.38407, 54.94278], [-4.1819, 54.57861], [-3.5082, 53.54318], [-3.08228, 53.25526], [-3.03675, 53.25092], [-2.92329, 53.19383], [-2.92022, 53.17685], [-2.98598, 53.15589], [-2.90649, 53.10964], [-2.87469, 53.12337], [-2.89131, 53.09374], [-2.83133, 52.99184], [-2.7251, 52.98389], [-2.72221, 52.92969], [-2.80549, 52.89428], [-2.85897, 52.94487], [-2.92401, 52.93836], [-2.97243, 52.9651], [-3.13576, 52.895], [-3.15744, 52.84947], [-3.16105, 52.79599], [-3.08734, 52.77504], [-3.01001, 52.76636], [-2.95581, 52.71794], [-3.01724, 52.72083], [-3.04398, 52.65435], [-3.13648, 52.58208], [-3.12926, 52.5286], [-3.09746, 52.53077], [-3.08662, 52.54811], [-3.00929, 52.57774], [-2.99701, 52.551], [-3.03603, 52.49969], [-3.13359, 52.49174], [-3.22971, 52.45344], [-3.22754, 52.42526], [-3.04687, 52.34504], [-2.95364, 52.3501], [-2.99701, 52.323], [-3.00785, 52.2753], [-3.09289, 52.20546], [-3.12638, 52.08114], [-2.97111, 51.90456], [-2.8818, 51.93196], [-2.78742, 51.88833], [-2.74277, 51.84367], [-2.66234, 51.83555], [-2.66336, 51.59504], [-3.20563, 51.31615], [-6.03913, 51.13217]]]] } },
22532 { type: "Feature", properties: { wikidata: "Q22", nameEn: "Scotland", aliases: ["GB-SCT"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.792, 57.56437], [-0.3751, 61.32236], [-14.78497, 57.60709], [-6.82333, 55.83103], [-4.69044, 54.3629], [-3.38407, 54.94278], [-3.09361, 54.94924], [-3.02906, 55.04606], [-2.63532, 55.19452], [-2.6095, 55.28488], [-2.17058, 55.45916], [-2.30613, 55.62698], [0.792, 57.56437]]]] } },
22533 { type: "Feature", properties: { wikidata: "Q25", nameEn: "Wales", aliases: ["GB-WLS"], country: "GB", groups: ["Q23666", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.5082, 53.54318], [-5.37267, 53.63269], [-6.03913, 51.13217], [-3.20563, 51.31615], [-2.66336, 51.59504], [-2.66234, 51.83555], [-2.74277, 51.84367], [-2.78742, 51.88833], [-2.8818, 51.93196], [-2.97111, 51.90456], [-3.12638, 52.08114], [-3.09289, 52.20546], [-3.00785, 52.2753], [-2.99701, 52.323], [-2.95364, 52.3501], [-3.04687, 52.34504], [-3.22754, 52.42526], [-3.22971, 52.45344], [-3.13359, 52.49174], [-3.03603, 52.49969], [-2.99701, 52.551], [-3.00929, 52.57774], [-3.08662, 52.54811], [-3.09746, 52.53077], [-3.12926, 52.5286], [-3.13648, 52.58208], [-3.04398, 52.65435], [-3.01724, 52.72083], [-2.95581, 52.71794], [-3.01001, 52.76636], [-3.08734, 52.77504], [-3.16105, 52.79599], [-3.15744, 52.84947], [-3.13576, 52.895], [-2.97243, 52.9651], [-2.92401, 52.93836], [-2.85897, 52.94487], [-2.80549, 52.89428], [-2.72221, 52.92969], [-2.7251, 52.98389], [-2.83133, 52.99184], [-2.89131, 53.09374], [-2.87469, 53.12337], [-2.90649, 53.10964], [-2.98598, 53.15589], [-2.92022, 53.17685], [-2.92329, 53.19383], [-3.03675, 53.25092], [-3.08228, 53.25526], [-3.5082, 53.54318]]]] } },
22534 { type: "Feature", properties: { wikidata: "Q26", nameEn: "Northern Ireland", aliases: ["GB-NIR"], country: "GB", groups: ["Q22890", "Q3336843", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-6.34755, 55.49206], [-7.2471, 55.06933], [-7.34464, 55.04688], [-7.4033, 55.00391], [-7.40004, 54.94498], [-7.44404, 54.9403], [-7.4473, 54.87003], [-7.47626, 54.83084], [-7.54508, 54.79401], [-7.54671, 54.74606], [-7.64449, 54.75265], [-7.75041, 54.7103], [-7.83352, 54.73854], [-7.93293, 54.66603], [-7.70315, 54.62077], [-7.8596, 54.53671], [-7.99812, 54.54427], [-8.04538, 54.48941], [-8.179, 54.46763], [-8.04555, 54.36292], [-7.87101, 54.29299], [-7.8596, 54.21779], [-7.81397, 54.20159], [-7.69501, 54.20731], [-7.55812, 54.12239], [-7.4799, 54.12239], [-7.44567, 54.1539], [-7.32834, 54.11475], [-7.30553, 54.11869], [-7.34005, 54.14698], [-7.29157, 54.17191], [-7.28017, 54.16714], [-7.29687, 54.1354], [-7.29493, 54.12013], [-7.26316, 54.13863], [-7.25012, 54.20063], [-7.14908, 54.22732], [-7.19145, 54.31296], [-7.02034, 54.4212], [-6.87775, 54.34682], [-6.85179, 54.29176], [-6.81583, 54.22791], [-6.74575, 54.18788], [-6.70175, 54.20218], [-6.6382, 54.17071], [-6.66264, 54.0666], [-6.62842, 54.03503], [-6.47849, 54.06947], [-6.36605, 54.07234], [-6.36279, 54.11248], [-6.32694, 54.09337], [-6.29003, 54.11278], [-6.26218, 54.09785], [-5.83481, 53.87749], [-4.69044, 54.3629], [-6.34755, 55.49206]]]] } },
22535 { type: "Feature", properties: { wikidata: "Q35", nameEn: "Denmark", country: "DK", groups: ["EU", "154", "150", "UN"], callingCodes: ["45"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.16597, 56.60205], [10.40861, 58.38489], [7.28637, 57.35913], [8.02459, 55.09613], [8.45719, 55.06747], [8.55769, 54.91837], [8.63979, 54.91069], [8.76387, 54.8948], [8.81178, 54.90518], [8.92795, 54.90452], [9.04629, 54.87249], [9.14275, 54.87421], [9.20571, 54.85841], [9.24631, 54.84726], [9.23445, 54.83432], [9.2474, 54.8112], [9.32771, 54.80602], [9.33849, 54.80233], [9.36496, 54.81749], [9.38532, 54.83968], [9.41213, 54.84254], [9.43155, 54.82586], [9.4659, 54.83131], [9.58937, 54.88785], [9.62734, 54.88057], [9.61187, 54.85548], [9.73563, 54.8247], [9.89314, 54.84171], [10.16755, 54.73883], [10.31111, 54.65968], [11.00303, 54.63689], [11.90309, 54.38543], [12.85844, 54.82438], [13.93395, 54.84044], [15.36991, 54.73263], [15.79951, 55.54655], [14.89259, 55.5623], [14.28399, 55.1553], [12.84405, 55.13257], [12.60345, 55.42675], [12.88472, 55.63369], [12.6372, 55.91371], [12.65312, 56.04345], [12.07466, 56.29488], [12.16597, 56.60205]]]] } },
22536 { type: "Feature", properties: { wikidata: "Q55", nameEn: "Netherlands", country: "NL", groups: ["EU", "155", "150", "UN"], callingCodes: ["31"] }, geometry: { type: "MultiPolygon", coordinates: [[[[5.45168, 54.20039], [2.56575, 51.85301], [3.36263, 51.37112], [3.38696, 51.33436], [3.35847, 51.31572], [3.38289, 51.27331], [3.41704, 51.25933], [3.43488, 51.24135], [3.52698, 51.2458], [3.51502, 51.28697], [3.58939, 51.30064], [3.78999, 51.25766], [3.78783, 51.2151], [3.90125, 51.20371], [3.97889, 51.22537], [4.01957, 51.24504], [4.05165, 51.24171], [4.16721, 51.29348], [4.24024, 51.35371], [4.21923, 51.37443], [4.33265, 51.37687], [4.34086, 51.35738], [4.39292, 51.35547], [4.43777, 51.36989], [4.38064, 51.41965], [4.39747, 51.43316], [4.38122, 51.44905], [4.47736, 51.4778], [4.5388, 51.48184], [4.54675, 51.47265], [4.52846, 51.45002], [4.53521, 51.4243], [4.57489, 51.4324], [4.65442, 51.42352], [4.72935, 51.48424], [4.74578, 51.48937], [4.77321, 51.50529], [4.78803, 51.50284], [4.84139, 51.4799], [4.82409, 51.44736], [4.82946, 51.4213], [4.78314, 51.43319], [4.76577, 51.43046], [4.77229, 51.41337], [4.78941, 51.41102], [4.84988, 51.41502], [4.90016, 51.41404], [4.92152, 51.39487], [5.00393, 51.44406], [5.0106, 51.47167], [5.03281, 51.48679], [5.04774, 51.47022], [5.07891, 51.4715], [5.10456, 51.43163], [5.07102, 51.39469], [5.13105, 51.34791], [5.13377, 51.31592], [5.16222, 51.31035], [5.2002, 51.32243], [5.24244, 51.30495], [5.22542, 51.26888], [5.23814, 51.26064], [5.26461, 51.26693], [5.29716, 51.26104], [5.33886, 51.26314], [5.347, 51.27502], [5.41672, 51.26248], [5.4407, 51.28169], [5.46519, 51.2849], [5.48476, 51.30053], [5.515, 51.29462], [5.5569, 51.26544], [5.5603, 51.22249], [5.65145, 51.19788], [5.65528, 51.18736], [5.70344, 51.1829], [5.74617, 51.18928], [5.77735, 51.17845], [5.77697, 51.1522], [5.82564, 51.16753], [5.85508, 51.14445], [5.80798, 51.11661], [5.8109, 51.10861], [5.83226, 51.10585], [5.82921, 51.09328], [5.79903, 51.09371], [5.79835, 51.05834], [5.77258, 51.06196], [5.75961, 51.03113], [5.77688, 51.02483], [5.76242, 50.99703], [5.71864, 50.96092], [5.72875, 50.95428], [5.74752, 50.96202], [5.75927, 50.95601], [5.74644, 50.94723], [5.72545, 50.92312], [5.72644, 50.91167], [5.71626, 50.90796], [5.69858, 50.91046], [5.67886, 50.88142], [5.64504, 50.87107], [5.64009, 50.84742], [5.65259, 50.82309], [5.70118, 50.80764], [5.68995, 50.79641], [5.70107, 50.7827], [5.68091, 50.75804], [5.69469, 50.75529], [5.72216, 50.76398], [5.73904, 50.75674], [5.74356, 50.7691], [5.76533, 50.78159], [5.77513, 50.78308], [5.80673, 50.7558], [5.84548, 50.76542], [5.84888, 50.75448], [5.88734, 50.77092], [5.89129, 50.75125], [5.89132, 50.75124], [5.95942, 50.7622], [5.97545, 50.75441], [6.01976, 50.75398], [6.02624, 50.77453], [5.97497, 50.79992], [5.98404, 50.80988], [6.00462, 50.80065], [6.02328, 50.81694], [6.01921, 50.84435], [6.05623, 50.8572], [6.05702, 50.85179], [6.07431, 50.84674], [6.07693, 50.86025], [6.08805, 50.87223], [6.07486, 50.89307], [6.09297, 50.92066], [6.01615, 50.93367], [6.02697, 50.98303], [5.95282, 50.98728], [5.90296, 50.97356], [5.90493, 51.00198], [5.87849, 51.01969], [5.86735, 51.05182], [5.9134, 51.06736], [5.9541, 51.03496], [5.98292, 51.07469], [6.16706, 51.15677], [6.17384, 51.19589], [6.07889, 51.17038], [6.07889, 51.24432], [6.16977, 51.33169], [6.22674, 51.36135], [6.22641, 51.39948], [6.20654, 51.40049], [6.21724, 51.48568], [6.18017, 51.54096], [6.09055, 51.60564], [6.11759, 51.65609], [6.02767, 51.6742], [6.04091, 51.71821], [5.95003, 51.7493], [5.98665, 51.76944], [5.94568, 51.82786], [5.99848, 51.83195], [6.06705, 51.86136], [6.10337, 51.84829], [6.16902, 51.84094], [6.11551, 51.89769], [6.15349, 51.90439], [6.21443, 51.86801], [6.29872, 51.86801], [6.30593, 51.84998], [6.40704, 51.82771], [6.38815, 51.87257], [6.47179, 51.85395], [6.50231, 51.86313], [6.58556, 51.89386], [6.68386, 51.91861], [6.72319, 51.89518], [6.82357, 51.96711], [6.83035, 51.9905], [6.68128, 52.05052], [6.76117, 52.11895], [6.83984, 52.11728], [6.97189, 52.20329], [6.9897, 52.2271], [7.03729, 52.22695], [7.06365, 52.23789], [7.02703, 52.27941], [7.07044, 52.37805], [7.03417, 52.40237], [6.99041, 52.47235], [6.94293, 52.43597], [6.69507, 52.488], [6.71641, 52.62905], [6.77307, 52.65375], [7.04557, 52.63318], [7.07253, 52.81083], [7.21694, 53.00742], [7.17898, 53.13817], [7.22681, 53.18165], [7.21679, 53.20058], [7.19052, 53.31866], [7.00198, 53.32672], [6.91025, 53.44221], [5.45168, 54.20039]], [[4.93295, 51.44945], [4.95244, 51.45207], [4.9524, 51.45014], [4.93909, 51.44632], [4.93295, 51.44945]], [[4.91493, 51.4353], [4.91935, 51.43634], [4.92227, 51.44252], [4.91811, 51.44621], [4.92287, 51.44741], [4.92811, 51.4437], [4.92566, 51.44273], [4.92815, 51.43856], [4.92879, 51.44161], [4.93544, 51.44634], [4.94025, 51.44193], [4.93416, 51.44185], [4.93471, 51.43861], [4.94265, 51.44003], [4.93986, 51.43064], [4.92952, 51.42984], [4.92652, 51.43329], [4.91493, 51.4353]]]] } },
22537 { type: "Feature", properties: { wikidata: "Q782", nameEn: "Hawaii", aliases: ["US-HI"], country: "US", groups: ["Q35657", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.8563, 29.18961], [-179.49839, 27.86265], [-151.6784, 9.55515], [-154.05867, 45.51124], [-177.5224, 27.7635], [-177.8563, 29.18961]]]] } },
22538 { type: "Feature", properties: { wikidata: "Q797", nameEn: "Alaska", aliases: ["US-AK"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.34848, 52.47228], [180, 51.0171], [179.84401, 55.10087], [169.34848, 52.47228]]], [[[-168.95635, 65.98512], [-169.03888, 65.48473], [-172.76104, 63.77445], [-179.55295, 57.62081], [-179.55295, 50.81807], [-133.92876, 54.62289], [-130.61931, 54.70835], [-130.64499, 54.76912], [-130.44184, 54.85377], [-130.27203, 54.97174], [-130.18765, 55.07744], [-130.08035, 55.21556], [-129.97513, 55.28029], [-130.15373, 55.74895], [-130.00857, 55.91344], [-130.00093, 56.00325], [-130.10173, 56.12178], [-130.33965, 56.10849], [-130.77769, 56.36185], [-131.8271, 56.62247], [-133.38523, 58.42773], [-133.84645, 58.73543], [-134.27175, 58.8634], [-134.48059, 59.13231], [-134.55699, 59.1297], [-134.7047, 59.2458], [-135.00267, 59.28745], [-135.03069, 59.56208], [-135.48007, 59.79937], [-136.31566, 59.59083], [-136.22381, 59.55526], [-136.33727, 59.44466], [-136.47323, 59.46617], [-136.52365, 59.16752], [-136.82619, 59.16198], [-137.4925, 58.89415], [-137.60623, 59.24465], [-138.62145, 59.76431], [-138.71149, 59.90728], [-139.05365, 59.99655], [-139.20603, 60.08896], [-139.05831, 60.35205], [-139.68991, 60.33693], [-139.98024, 60.18027], [-140.45648, 60.30919], [-140.5227, 60.22077], [-141.00116, 60.30648], [-140.97446, 84.39275], [-168.25765, 71.99091], [-168.95635, 65.98512]]]] } },
22539 { type: "Feature", properties: { wikidata: "Q3492", nameEn: "Sumatra", aliases: ["ID-SM"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.82788, 2.86812], [110.90339, 7.52694], [105.01437, 3.24936], [104.56723, 1.44271], [104.34728, 1.33529], [104.12282, 1.27714], [104.03085, 1.26954], [103.74084, 1.12902], [103.66049, 1.18825], [103.56591, 1.19719], [103.03657, 1.30383], [96.11174, 6.69841], [74.28481, -3.17525], [102.92489, -8.17146], [106.32259, -5.50116], [106.38511, -5.16715], [109.17017, -4.07401], [109.3962, -2.07276], [108.50935, -2.01066], [107.94791, 1.06924], [109.82788, 2.86812]]]] } },
22540 { type: "Feature", properties: { wikidata: "Q3757", nameEn: "Java", aliases: ["ID-JW"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[109.17017, -4.07401], [106.38511, -5.16715], [106.32259, -5.50116], [102.92489, -8.17146], [116.22542, -10.49172], [114.39575, -8.2889], [114.42235, -8.09762], [114.92859, -7.49253], [116.33992, -7.56171], [116.58433, -5.30385], [109.17017, -4.07401]]]] } },
22541 { type: "Feature", properties: { wikidata: "Q3795", nameEn: "Kalimantan", aliases: ["ID-KA"], country: "ID", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[120.02464, 2.83703], [118.06469, 4.16638], [117.67641, 4.16535], [117.47313, 4.18857], [117.25801, 4.35108], [115.90217, 4.37708], [115.58276, 3.93499], [115.53713, 3.14776], [115.11343, 2.82879], [115.1721, 2.49671], [114.80706, 2.21665], [114.80706, 1.92351], [114.57892, 1.5], [114.03788, 1.44787], [113.64677, 1.23933], [113.01448, 1.42832], [113.021, 1.57819], [112.48648, 1.56516], [112.2127, 1.44135], [112.15679, 1.17004], [111.94553, 1.12016], [111.82846, 0.99349], [111.55434, 0.97864], [111.22979, 1.08326], [110.62374, 0.873], [110.49182, 0.88088], [110.35354, 0.98869], [109.66397, 1.60425], [109.66397, 1.79972], [109.57923, 1.80624], [109.53794, 1.91771], [109.62558, 1.99182], [109.82788, 2.86812], [107.94791, 1.06924], [108.50935, -2.01066], [109.3962, -2.07276], [109.17017, -4.07401], [116.58433, -5.30385], [120.02464, 2.83703]]]] } },
22542 { type: "Feature", properties: { wikidata: "Q3803", nameEn: "Lesser Sunda Islands", aliases: ["ID-NU"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[116.96967, -8.01483], [114.92859, -7.49253], [114.42235, -8.09762], [114.39575, -8.2889], [116.22542, -10.49172], [122.14954, -11.52517], [125.68138, -9.85176], [125.09025, -9.46406], [124.97892, -9.19281], [125.04044, -9.17093], [125.09434, -9.19669], [125.18907, -9.16434], [125.18632, -9.03142], [125.11764, -8.96359], [124.97742, -9.08128], [124.94011, -8.85617], [124.46701, -9.13002], [124.45971, -9.30263], [124.38554, -9.3582], [124.35258, -9.43002], [124.3535, -9.48493], [124.28115, -9.50453], [124.28115, -9.42189], [124.21247, -9.36904], [124.14517, -9.42324], [124.10539, -9.41206], [124.04286, -9.34243], [124.04628, -9.22671], [124.33472, -9.11416], [124.92337, -8.75859], [125.87688, -7.49892], [116.96967, -8.01483]]]] } },
22543 { type: "Feature", properties: { wikidata: "Q3812", nameEn: "Sulawesi", aliases: ["ID-SL"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.34321, 3.90322], [126.69413, 6.02692], [119.56457, 0.90759], [116.58433, -5.30385], [116.33992, -7.56171], [116.96967, -8.01483], [125.87688, -7.49892], [123.78965, -0.86805], [128.34321, 3.90322]]]] } },
22544 { type: "Feature", properties: { wikidata: "Q3827", nameEn: "Maluku Islands", aliases: ["ID-ML"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.63187, 2.21409], [128.34321, 3.90322], [123.78965, -0.86805], [125.87688, -7.49892], [125.58506, -7.95311], [125.87691, -8.31789], [127.42116, -8.22471], [127.55165, -9.05052], [135.49042, -9.2276], [135.35517, -5.01442], [132.8312, -4.70282], [130.8468, -2.61103], [128.40647, -2.30349], [129.71519, -0.24692], [129.63187, 2.21409]]]] } },
22545 { type: "Feature", properties: { wikidata: "Q3845", nameEn: "Western New Guinea", aliases: ["ID-PP"], country: "ID", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["62"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.49042, -9.2276], [141.01842, -9.35091], [141.01763, -6.90181], [140.90448, -6.85033], [140.85295, -6.72996], [140.99813, -6.3233], [141.02352, 0.08993], [129.63187, 2.21409], [129.71519, -0.24692], [128.40647, -2.30349], [130.8468, -2.61103], [132.8312, -4.70282], [135.35517, -5.01442], [135.49042, -9.2276]]]] } },
22546 { type: "Feature", properties: { wikidata: "Q5765", nameEn: "Balearic Islands", aliases: ["ES-IB"], country: "ES", groups: ["EU", "039", "150", "UN"], callingCodes: ["34 971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [5.10072, 39.89531], [3.75438, 42.33445], [-2.27707, 35.35051]]]] } },
22547 { type: "Feature", properties: { wikidata: "Q5823", nameEn: "Ceuta", aliases: ["ES-CE"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.38491, 35.92591], [-5.37338, 35.88417], [-5.35844, 35.87375], [-5.34379, 35.8711], [-5.21179, 35.90091], [-5.38491, 35.92591]]]] } },
22548 { type: "Feature", properties: { wikidata: "Q5831", nameEn: "Melilla", aliases: ["ES-ML"], country: "ES", groups: ["EA", "EU", "015", "002", "UN"], level: "subterritory", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.91909, 35.33927], [-2.96038, 35.31609], [-2.96648, 35.30475], [-2.96978, 35.29459], [-2.97035, 35.28852], [-2.96507, 35.28801], [-2.96826, 35.28296], [-2.96516, 35.27967], [-2.95431, 35.2728], [-2.95065, 35.26576], [-2.93893, 35.26737], [-2.92272, 35.27509], [-2.91909, 35.33927]]]] } },
22549 { type: "Feature", properties: { wikidata: "Q7835", nameEn: "Crimea", country: "RU", groups: ["151", "150", "UN"], level: "subterritory", callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.5, 44], [36.4883, 45.0488], [36.475, 45.2411], [36.5049, 45.3136], [36.6545, 45.3417], [36.6645, 45.4514], [35.0498, 45.7683], [34.9601, 45.7563], [34.7991, 45.8101], [34.8015, 45.9005], [34.7548, 45.907], [34.6668, 45.9714], [34.6086, 45.9935], [34.5589, 45.9935], [34.5201, 45.951], [34.4873, 45.9427], [34.4415, 45.9599], [34.4122, 46.0025], [34.3391, 46.0611], [34.2511, 46.0532], [34.181, 46.068], [34.1293, 46.1049], [34.0731, 46.1177], [34.0527, 46.1084], [33.9155, 46.1594], [33.8523, 46.1986], [33.7972, 46.2048], [33.7405, 46.1855], [33.646, 46.2303], [33.6152, 46.2261], [33.6385, 46.1415], [33.6147, 46.1356], [33.5732, 46.1032], [33.5909, 46.0601], [33.5597, 46.0307], [31.5, 45.5], [33.5, 44]]]] } },
22550 { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
22551 { type: "Feature", properties: { wikidata: "Q14056", nameEn: "Jan Mayen", aliases: ["NO-22"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-9.18243, 72.23144], [-10.71459, 70.09565], [-5.93364, 70.76368], [-9.18243, 72.23144]]]] } },
22552 { type: "Feature", properties: { wikidata: "Q19188", nameEn: "Mainland China", country: "CN", groups: ["030", "142", "UN"], callingCodes: ["86"] }, geometry: { type: "MultiPolygon", coordinates: [[[[125.6131, 53.07229], [125.17522, 53.20225], [124.46078, 53.21881], [123.86158, 53.49391], [123.26989, 53.54843], [122.85966, 53.47395], [122.35063, 53.49565], [121.39213, 53.31888], [120.85633, 53.28499], [120.0451, 52.7359], [120.04049, 52.58773], [120.46454, 52.63811], [120.71673, 52.54099], [120.61346, 52.32447], [120.77337, 52.20805], [120.65907, 51.93544], [120.10963, 51.671], [119.13553, 50.37412], [119.38598, 50.35162], [119.27996, 50.13348], [119.11003, 50.00276], [118.61623, 49.93809], [117.82343, 49.52696], [117.48208, 49.62324], [117.27597, 49.62544], [116.71193, 49.83813], [116.03781, 48.87014], [116.06565, 48.81716], [115.78876, 48.51781], [115.811, 48.25699], [115.52082, 48.15367], [115.57128, 47.91988], [115.94296, 47.67741], [116.21879, 47.88505], [116.4465, 47.83662], [116.67405, 47.89039], [116.9723, 47.87285], [117.37875, 47.63627], [117.50181, 47.77216], [117.80196, 48.01661], [118.03676, 48.00982], [118.11009, 48.04], [118.22677, 48.03853], [118.29654, 48.00246], [118.55766, 47.99277], [118.7564, 47.76947], [119.12343, 47.66458], [119.13995, 47.53997], [119.35892, 47.48104], [119.31964, 47.42617], [119.54918, 47.29505], [119.56019, 47.24874], [119.62403, 47.24575], [119.71209, 47.19192], [119.85518, 46.92196], [119.91242, 46.90091], [119.89261, 46.66423], [119.80455, 46.67631], [119.77373, 46.62947], [119.68127, 46.59015], [119.65265, 46.62342], [119.42827, 46.63783], [119.32827, 46.61433], [119.24978, 46.64761], [119.10448, 46.65516], [119.00541, 46.74273], [118.92616, 46.72765], [118.89974, 46.77139], [118.8337, 46.77742], [118.78747, 46.68689], [118.30534, 46.73519], [117.69554, 46.50991], [117.60748, 46.59771], [117.41782, 46.57862], [117.36609, 46.36335], [116.83166, 46.38637], [116.75551, 46.33083], [116.58612, 46.30211], [116.26678, 45.96479], [116.24012, 45.8778], [116.27366, 45.78637], [116.16989, 45.68603], [115.60329, 45.44717], [114.94546, 45.37377], [114.74612, 45.43585], [114.54801, 45.38337], [114.5166, 45.27189], [113.70918, 44.72891], [112.74662, 44.86297], [112.4164, 45.06858], [111.98695, 45.09074], [111.76275, 44.98032], [111.40498, 44.3461], [111.96289, 43.81596], [111.93776, 43.68709], [111.79758, 43.6637], [111.59087, 43.51207], [111.0149, 43.3289], [110.4327, 42.78293], [110.08401, 42.6411], [109.89402, 42.63111], [109.452, 42.44842], [109.00679, 42.45302], [108.84489, 42.40246], [107.57258, 42.40898], [107.49681, 42.46221], [107.29755, 42.41395], [107.24774, 42.36107], [106.76517, 42.28741], [105.0123, 41.63188], [104.51667, 41.66113], [104.52258, 41.8706], [103.92804, 41.78246], [102.72403, 42.14675], [102.07645, 42.22519], [101.80515, 42.50074], [100.84979, 42.67087], [100.33297, 42.68231], [99.50671, 42.56535], [97.1777, 42.7964], [96.37926, 42.72055], [96.35658, 42.90363], [95.89543, 43.2528], [95.52594, 43.99353], [95.32891, 44.02407], [95.39772, 44.2805], [95.01191, 44.25274], [94.71959, 44.35284], [94.10003, 44.71016], [93.51161, 44.95964], [91.64048, 45.07408], [90.89169, 45.19667], [90.65114, 45.49314], [90.70907, 45.73437], [91.03026, 46.04194], [90.99672, 46.14207], [90.89639, 46.30711], [91.07696, 46.57315], [91.0147, 46.58171], [91.03649, 46.72916], [90.84035, 46.99525], [90.76108, 46.99399], [90.48542, 47.30438], [90.48854, 47.41826], [90.33598, 47.68303], [90.10871, 47.7375], [90.06512, 47.88177], [89.76624, 47.82745], [89.55453, 48.0423], [89.0711, 47.98528], [88.93186, 48.10263], [88.8011, 48.11302], [88.58316, 48.21893], [88.58939, 48.34531], [87.96361, 48.58478], [88.0788, 48.71436], [87.73822, 48.89582], [87.88171, 48.95853], [87.81333, 49.17354], [87.48983, 49.13794], [87.478, 49.07403], [87.28386, 49.11626], [86.87238, 49.12432], [86.73568, 48.99918], [86.75343, 48.70331], [86.38069, 48.46064], [85.73581, 48.3939], [85.5169, 48.05493], [85.61067, 47.49753], [85.69696, 47.2898], [85.54294, 47.06171], [85.22443, 47.04816], [84.93995, 46.87399], [84.73077, 47.01394], [83.92184, 46.98912], [83.04622, 47.19053], [82.21792, 45.56619], [82.58474, 45.40027], [82.51374, 45.1755], [81.73278, 45.3504], [80.11169, 45.03352], [79.8987, 44.89957], [80.38384, 44.63073], [80.40229, 44.23319], [80.40031, 44.10986], [80.75156, 43.44948], [80.69718, 43.32589], [80.77771, 43.30065], [80.78817, 43.14235], [80.62913, 43.141], [80.3735, 43.01557], [80.58999, 42.9011], [80.38169, 42.83142], [80.26886, 42.8366], [80.16892, 42.61137], [80.26841, 42.23797], [80.17807, 42.21166], [80.17842, 42.03211], [79.92977, 42.04113], [78.3732, 41.39603], [78.15757, 41.38565], [78.12873, 41.23091], [77.81287, 41.14307], [77.76206, 41.01574], [77.52723, 41.00227], [77.3693, 41.0375], [77.28004, 41.0033], [76.99302, 41.0696], [76.75681, 40.95354], [76.5261, 40.46114], [76.33659, 40.3482], [75.96168, 40.38064], [75.91361, 40.2948], [75.69663, 40.28642], [75.5854, 40.66874], [75.22834, 40.45382], [75.08243, 40.43945], [74.82013, 40.52197], [74.78168, 40.44886], [74.85996, 40.32857], [74.69875, 40.34668], [74.35063, 40.09742], [74.25533, 40.13191], [73.97049, 40.04378], [73.83006, 39.76136], [73.9051, 39.75073], [73.92354, 39.69565], [73.94683, 39.60733], [73.87018, 39.47879], [73.59831, 39.46425], [73.59241, 39.40843], [73.5004, 39.38402], [73.55396, 39.3543], [73.54572, 39.27567], [73.60638, 39.24534], [73.75823, 39.023], [73.81728, 39.04007], [73.82964, 38.91517], [73.7445, 38.93867], [73.7033, 38.84782], [73.80656, 38.66449], [73.79806, 38.61106], [73.97933, 38.52945], [74.17022, 38.65504], [74.51217, 38.47034], [74.69619, 38.42947], [74.69894, 38.22155], [74.80331, 38.19889], [74.82665, 38.07359], [74.9063, 38.03033], [74.92416, 37.83428], [75.00935, 37.77486], [74.8912, 37.67576], [74.94338, 37.55501], [75.06011, 37.52779], [75.15899, 37.41443], [75.09719, 37.37297], [75.12328, 37.31839], [74.88887, 37.23275], [74.80605, 37.21565], [74.49981, 37.24518], [74.56453, 37.03023], [75.13839, 37.02622], [75.40481, 36.95382], [75.45562, 36.71971], [75.72737, 36.7529], [75.92391, 36.56986], [76.0324, 36.41198], [76.00906, 36.17511], [75.93028, 36.13136], [76.15325, 35.9264], [76.14913, 35.82848], [76.33453, 35.84296], [76.50961, 35.8908], [76.77323, 35.66062], [76.84539, 35.67356], [76.96624, 35.5932], [77.44277, 35.46132], [77.70232, 35.46244], [77.80532, 35.52058], [78.11664, 35.48022], [78.03466, 35.3785], [78.00033, 35.23954], [78.22692, 34.88771], [78.18435, 34.7998], [78.27781, 34.61484], [78.54964, 34.57283], [78.56475, 34.50835], [78.74465, 34.45174], [79.05364, 34.32482], [78.99802, 34.3027], [78.91769, 34.15452], [78.66225, 34.08858], [78.65657, 34.03195], [78.73367, 34.01121], [78.77349, 33.73871], [78.67599, 33.66445], [78.73636, 33.56521], [79.15252, 33.17156], [79.14016, 33.02545], [79.46562, 32.69668], [79.26768, 32.53277], [79.13174, 32.47766], [79.0979, 32.38051], [78.99322, 32.37948], [78.96713, 32.33655], [78.7831, 32.46873], [78.73916, 32.69438], [78.38897, 32.53938], [78.4645, 32.45367], [78.49609, 32.2762], [78.68754, 32.10256], [78.74404, 32.00384], [78.78036, 31.99478], [78.69933, 31.78723], [78.84516, 31.60631], [78.71032, 31.50197], [78.77898, 31.31209], [78.89344, 31.30481], [79.01931, 31.42817], [79.14016, 31.43403], [79.30694, 31.17357], [79.59884, 30.93943], [79.93255, 30.88288], [80.20721, 30.58541], [80.54504, 30.44936], [80.83343, 30.32023], [81.03953, 30.20059], [81.12842, 30.01395], [81.24362, 30.0126], [81.29032, 30.08806], [81.2623, 30.14596], [81.33355, 30.15303], [81.39928, 30.21862], [81.41018, 30.42153], [81.5459, 30.37688], [81.62033, 30.44703], [81.99082, 30.33423], [82.10135, 30.35439], [82.10757, 30.23745], [82.19475, 30.16884], [82.16984, 30.0692], [82.38622, 30.02608], [82.5341, 29.9735], [82.73024, 29.81695], [83.07116, 29.61957], [83.28131, 29.56813], [83.44787, 29.30513], [83.63156, 29.16249], [83.82303, 29.30513], [83.97559, 29.33091], [84.18107, 29.23451], [84.24801, 29.02783], [84.2231, 28.89571], [84.47528, 28.74023], [84.62317, 28.73887], [84.85511, 28.58041], [85.06059, 28.68562], [85.19135, 28.62825], [85.18668, 28.54076], [85.10729, 28.34092], [85.38127, 28.28336], [85.4233, 28.32996], [85.59765, 28.30529], [85.60854, 28.25045], [85.69105, 28.38475], [85.71907, 28.38064], [85.74864, 28.23126], [85.84672, 28.18187], [85.90743, 28.05144], [85.97813, 27.99023], [85.94946, 27.9401], [86.06309, 27.90021], [86.12069, 27.93047], [86.08333, 28.02121], [86.088, 28.09264], [86.18607, 28.17364], [86.22966, 27.9786], [86.42736, 27.91122], [86.51609, 27.96623], [86.56265, 28.09569], [86.74181, 28.10638], [86.75582, 28.04182], [87.03757, 27.94835], [87.11696, 27.84104], [87.56996, 27.84517], [87.72718, 27.80938], [87.82681, 27.95248], [88.13378, 27.88015], [88.1278, 27.95417], [88.25332, 27.9478], [88.54858, 28.06057], [88.63235, 28.12356], [88.83559, 28.01936], [88.88091, 27.85192], [88.77517, 27.45415], [88.82981, 27.38814], [88.91901, 27.32483], [88.93678, 27.33777], [88.96947, 27.30319], [89.00216, 27.32532], [88.95355, 27.4106], [88.97213, 27.51671], [89.0582, 27.60985], [89.12825, 27.62502], [89.59525, 28.16433], [89.79762, 28.23979], [90.13387, 28.19178], [90.58842, 28.02838], [90.69894, 28.07784], [91.20019, 27.98715], [91.25779, 28.07509], [91.46327, 28.0064], [91.48973, 27.93903], [91.5629, 27.84823], [91.6469, 27.76358], [91.84722, 27.76325], [91.87057, 27.7195], [92.27432, 27.89077], [92.32101, 27.79363], [92.42538, 27.80092], [92.7275, 27.98662], [92.73025, 28.05814], [92.65472, 28.07632], [92.67486, 28.15018], [92.93075, 28.25671], [93.14635, 28.37035], [93.18069, 28.50319], [93.44621, 28.67189], [93.72797, 28.68821], [94.35897, 29.01965], [94.2752, 29.11687], [94.69318, 29.31739], [94.81353, 29.17804], [95.0978, 29.14446], [95.11291, 29.09527], [95.2214, 29.10727], [95.26122, 29.07727], [95.3038, 29.13847], [95.41091, 29.13007], [95.50842, 29.13487], [95.72086, 29.20797], [95.75149, 29.32063], [95.84899, 29.31464], [96.05361, 29.38167], [96.31316, 29.18643], [96.18682, 29.11087], [96.20467, 29.02325], [96.3626, 29.10607], [96.61391, 28.72742], [96.40929, 28.51526], [96.48895, 28.42955], [96.6455, 28.61657], [96.85561, 28.4875], [96.88445, 28.39452], [96.98882, 28.32564], [97.1289, 28.3619], [97.34547, 28.21385], [97.41729, 28.29783], [97.47085, 28.2688], [97.50518, 28.49716], [97.56835, 28.55628], [97.70705, 28.5056], [97.79632, 28.33168], [97.90069, 28.3776], [98.15337, 28.12114], [98.13964, 27.9478], [98.32641, 27.51385], [98.42529, 27.55404], [98.43353, 27.67086], [98.69582, 27.56499], [98.7333, 26.85615], [98.77547, 26.61994], [98.72741, 26.36183], [98.67797, 26.24487], [98.7329, 26.17218], [98.66884, 26.09165], [98.63128, 26.15492], [98.57085, 26.11547], [98.60763, 26.01512], [98.70818, 25.86241], [98.63128, 25.79937], [98.54064, 25.85129], [98.40606, 25.61129], [98.31268, 25.55307], [98.25774, 25.6051], [98.16848, 25.62739], [98.18084, 25.56298], [98.12591, 25.50722], [98.14925, 25.41547], [97.92541, 25.20815], [97.83614, 25.2715], [97.77023, 25.11492], [97.72216, 25.08508], [97.72903, 24.91332], [97.79949, 24.85655], [97.76481, 24.8289], [97.73127, 24.83015], [97.70181, 24.84557], [97.64354, 24.79171], [97.56648, 24.76475], [97.56383, 24.75535], [97.5542, 24.74943], [97.54675, 24.74202], [97.56525, 24.72838], [97.56286, 24.54535], [97.52757, 24.43748], [97.60029, 24.4401], [97.66998, 24.45288], [97.7098, 24.35658], [97.65624, 24.33781], [97.66723, 24.30027], [97.71941, 24.29652], [97.76799, 24.26365], [97.72998, 24.2302], [97.72799, 24.18883], [97.75305, 24.16902], [97.72903, 24.12606], [97.62363, 24.00506], [97.5247, 23.94032], [97.64667, 23.84574], [97.72302, 23.89288], [97.79456, 23.94836], [97.79416, 23.95663], [97.84328, 23.97603], [97.86545, 23.97723], [97.88811, 23.97446], [97.8955, 23.97758], [97.89676, 23.97931], [97.89683, 23.98389], [97.88814, 23.98605], [97.88414, 23.99405], [97.88616, 24.00463], [97.90998, 24.02094], [97.93951, 24.01953], [97.98691, 24.03897], [97.99583, 24.04932], [98.04709, 24.07616], [98.05302, 24.07408], [98.05671, 24.07961], [98.0607, 24.07812], [98.06703, 24.08028], [98.07806, 24.07988], [98.20666, 24.11406], [98.54476, 24.13119], [98.59256, 24.08371], [98.85319, 24.13042], [98.87998, 24.15624], [98.89632, 24.10612], [98.67797, 23.9644], [98.68209, 23.80492], [98.79607, 23.77947], [98.82933, 23.72921], [98.81775, 23.694], [98.88396, 23.59555], [98.80294, 23.5345], [98.82877, 23.47908], [98.87683, 23.48995], [98.92104, 23.36946], [98.87573, 23.33038], [98.93958, 23.31414], [98.92515, 23.29535], [98.88597, 23.18656], [99.05975, 23.16382], [99.04601, 23.12215], [99.25741, 23.09025], [99.34127, 23.13099], [99.52214, 23.08218], [99.54218, 22.90014], [99.43537, 22.94086], [99.45654, 22.85726], [99.31243, 22.73893], [99.38247, 22.57544], [99.37972, 22.50188], [99.28771, 22.4105], [99.17318, 22.18025], [99.19176, 22.16983], [99.1552, 22.15874], [99.33166, 22.09656], [99.47585, 22.13345], [99.85351, 22.04183], [99.96612, 22.05965], [99.99084, 21.97053], [99.94003, 21.82782], [99.98654, 21.71064], [100.04956, 21.66843], [100.12679, 21.70539], [100.17486, 21.65306], [100.10757, 21.59945], [100.12542, 21.50365], [100.1625, 21.48704], [100.18447, 21.51898], [100.25863, 21.47043], [100.35201, 21.53176], [100.42892, 21.54325], [100.4811, 21.46148], [100.57861, 21.45637], [100.72143, 21.51898], [100.87265, 21.67396], [101.11744, 21.77659], [101.15156, 21.56129], [101.2124, 21.56422], [101.19349, 21.41959], [101.26912, 21.36482], [101.2229, 21.23271], [101.29326, 21.17254], [101.54563, 21.25668], [101.6068, 21.23329], [101.59491, 21.18621], [101.60886, 21.17947], [101.66977, 21.20004], [101.70548, 21.14911], [101.7622, 21.14813], [101.79266, 21.19025], [101.76745, 21.21571], [101.83887, 21.20983], [101.84412, 21.25291], [101.74014, 21.30967], [101.74224, 21.48276], [101.7727, 21.51794], [101.7475, 21.5873], [101.80001, 21.57461], [101.83257, 21.61562], [101.74555, 21.72852], [101.7791, 21.83019], [101.62566, 21.96574], [101.57525, 22.13026], [101.60675, 22.13513], [101.53638, 22.24794], [101.56789, 22.28876], [101.61306, 22.27515], [101.68973, 22.46843], [101.7685, 22.50337], [101.86828, 22.38397], [101.90714, 22.38688], [101.91344, 22.44417], [101.98487, 22.42766], [102.03633, 22.46164], [102.1245, 22.43372], [102.14099, 22.40092], [102.16621, 22.43336], [102.26428, 22.41321], [102.25339, 22.4607], [102.41061, 22.64184], [102.38415, 22.67919], [102.42618, 22.69212], [102.46665, 22.77108], [102.51802, 22.77969], [102.57095, 22.7036], [102.60675, 22.73376], [102.8636, 22.60735], [102.9321, 22.48659], [103.0722, 22.44775], [103.07843, 22.50097], [103.17961, 22.55705], [103.15782, 22.59873], [103.18895, 22.64471], [103.28079, 22.68063], [103.32282, 22.8127], [103.43179, 22.75816], [103.43646, 22.70648], [103.52675, 22.59155], [103.57812, 22.65764], [103.56255, 22.69499], [103.64506, 22.79979], [103.87904, 22.56683], [103.93286, 22.52703], [103.94513, 22.52553], [103.95191, 22.5134], [103.96352, 22.50584], [103.96783, 22.51173], [103.97384, 22.50634], [103.99247, 22.51958], [104.01088, 22.51823], [104.03734, 22.72945], [104.11384, 22.80363], [104.27084, 22.8457], [104.25683, 22.76534], [104.35593, 22.69353], [104.47225, 22.75813], [104.58122, 22.85571], [104.60457, 22.81841], [104.65283, 22.83419], [104.72755, 22.81984], [104.77114, 22.90017], [104.84942, 22.93631], [104.86765, 22.95178], [104.8334, 23.01484], [104.79478, 23.12934], [104.87382, 23.12854], [104.87992, 23.17141], [104.91435, 23.18666], [104.9486, 23.17235], [104.96532, 23.20463], [104.98712, 23.19176], [105.07002, 23.26248], [105.11672, 23.25247], [105.17276, 23.28679], [105.22569, 23.27249], [105.32376, 23.39684], [105.40782, 23.28107], [105.42805, 23.30824], [105.49966, 23.20669], [105.56037, 23.16806], [105.57594, 23.075], [105.72382, 23.06641], [105.8726, 22.92756], [105.90119, 22.94168], [105.99568, 22.94178], [106.00179, 22.99049], [106.19705, 22.98475], [106.27022, 22.87722], [106.34961, 22.86718], [106.49749, 22.91164], [106.51306, 22.94891], [106.55976, 22.92311], [106.60179, 22.92884], [106.6516, 22.86862], [106.6734, 22.89587], [106.71387, 22.88296], [106.71128, 22.85982], [106.78422, 22.81532], [106.81271, 22.8226], [106.83685, 22.8098], [106.82404, 22.7881], [106.76293, 22.73491], [106.72321, 22.63606], [106.71698, 22.58432], [106.65316, 22.5757], [106.61269, 22.60301], [106.58395, 22.474], [106.55665, 22.46498], [106.57221, 22.37], [106.55976, 22.34841], [106.6516, 22.33977], [106.69986, 22.22309], [106.67495, 22.1885], [106.6983, 22.15102], [106.70142, 22.02409], [106.68274, 21.99811], [106.69276, 21.96013], [106.72551, 21.97923], [106.74345, 22.00965], [106.81038, 21.97934], [106.9178, 21.97357], [106.92714, 21.93459], [106.97228, 21.92592], [106.99252, 21.95191], [107.05634, 21.92303], [107.06101, 21.88982], [107.00964, 21.85948], [107.02615, 21.81981], [107.10771, 21.79879], [107.20734, 21.71493], [107.24625, 21.7077], [107.29296, 21.74674], [107.35834, 21.6672], [107.35989, 21.60063], [107.38636, 21.59774], [107.41593, 21.64839], [107.47197, 21.6672], [107.49532, 21.62958], [107.49065, 21.59774], [107.54047, 21.5934], [107.56537, 21.61945], [107.66967, 21.60787], [107.80355, 21.66141], [107.86114, 21.65128], [107.90006, 21.5905], [107.92652, 21.58906], [107.95232, 21.5388], [107.96774, 21.53601], [107.97074, 21.54072], [107.97383, 21.53961], [107.97932, 21.54503], [108.02926, 21.54997], [108.0569, 21.53604], [108.10003, 21.47338], [108.00365, 17.98159], [111.60491, 13.57105], [118.41371, 24.06775], [118.11703, 24.39734], [118.28244, 24.51231], [118.35291, 24.51645], [118.42453, 24.54644], [118.6333, 24.46259], [119.42295, 25.0886], [119.98511, 25.37624], [119.78816, 26.2348], [120.0693, 26.3959], [120.5128, 26.536], [121.03532, 26.8787], [123.5458, 31.01942], [122.29378, 31.76513], [122.80525, 33.30571], [123.85601, 37.49093], [123.90497, 38.79949], [124.17532, 39.8232], [124.23201, 39.9248], [124.35029, 39.95639], [124.37089, 40.03004], [124.3322, 40.05573], [124.38556, 40.11047], [124.40719, 40.13655], [124.86913, 40.45387], [125.71172, 40.85223], [125.76869, 40.87908], [126.00335, 40.92835], [126.242, 41.15454], [126.53189, 41.35206], [126.60631, 41.65565], [126.90729, 41.79955], [127.17841, 41.59714], [127.29712, 41.49473], [127.92943, 41.44291], [128.02633, 41.42103], [128.03311, 41.39232], [128.12967, 41.37931], [128.18546, 41.41279], [128.20061, 41.40895], [128.30716, 41.60322], [128.15119, 41.74568], [128.04487, 42.01769], [128.94007, 42.03537], [128.96068, 42.06657], [129.15178, 42.17224], [129.22285, 42.26491], [129.22423, 42.3553], [129.28541, 42.41574], [129.42882, 42.44702], [129.54701, 42.37254], [129.60482, 42.44461], [129.72541, 42.43739], [129.75294, 42.59409], [129.77183, 42.69435], [129.7835, 42.76521], [129.80719, 42.79218], [129.83277, 42.86746], [129.85261, 42.96494], [129.8865, 43.00395], [129.95082, 43.01051], [129.96409, 42.97306], [130.12957, 42.98361], [130.09764, 42.91425], [130.26095, 42.9027], [130.23068, 42.80125], [130.2385, 42.71127], [130.41826, 42.6011], [130.44361, 42.54849], [130.50123, 42.61636], [130.55143, 42.52158], [130.62107, 42.58413], [130.56576, 42.68925], [130.40213, 42.70788], [130.44361, 42.76205], [130.66524, 42.84753], [131.02438, 42.86518], [131.02668, 42.91246], [131.135, 42.94114], [131.10274, 43.04734], [131.20414, 43.13654], [131.19031, 43.21385], [131.30324, 43.39498], [131.29402, 43.46695], [131.19492, 43.53047], [131.21105, 43.82383], [131.26176, 43.94011], [131.23583, 43.96085], [131.25484, 44.03131], [131.30365, 44.04262], [131.1108, 44.70266], [130.95639, 44.85154], [131.48415, 44.99513], [131.68466, 45.12374], [131.66852, 45.2196], [131.76532, 45.22609], [131.86903, 45.33636], [131.99417, 45.2567], [132.83978, 45.05916], [132.96373, 45.0212], [133.12293, 45.1332], [133.09279, 45.25693], [133.19419, 45.51913], [133.41083, 45.57723], [133.48457, 45.86203], [133.60442, 45.90053], [133.67569, 45.9759], [133.72695, 46.05576], [133.68047, 46.14697], [133.88097, 46.25066], [133.91496, 46.4274], [133.84104, 46.46681], [134.03538, 46.75668], [134.20016, 47.33458], [134.50898, 47.4812], [134.7671, 47.72051], [134.55508, 47.98651], [134.67098, 48.1564], [134.75328, 48.36763], [134.49516, 48.42884], [132.66989, 47.96491], [132.57309, 47.71741], [131.90448, 47.68011], [131.2635, 47.73325], [131.09871, 47.6852], [130.95985, 47.6957], [130.90915, 47.90623], [130.65103, 48.10052], [130.84462, 48.30942], [130.52147, 48.61745], [130.66946, 48.88251], [130.43232, 48.90844], [130.2355, 48.86741], [129.85416, 49.11067], [129.67598, 49.29596], [129.50685, 49.42398], [129.40398, 49.44194], [129.35317, 49.3481], [129.23232, 49.40353], [129.11153, 49.36813], [128.72896, 49.58676], [127.83476, 49.5748], [127.53516, 49.84306], [127.49299, 50.01251], [127.60515, 50.23503], [127.37384, 50.28393], [127.36009, 50.43787], [127.28765, 50.46585], [127.36335, 50.58306], [127.28165, 50.72075], [127.14586, 50.91152], [126.93135, 51.0841], [126.90369, 51.3238], [126.68349, 51.70607], [126.44606, 51.98254], [126.558, 52.13738], [125.6131, 53.07229]], [[113.56865, 22.20973], [113.57123, 22.20416], [113.60504, 22.20464], [113.63011, 22.10782], [113.57191, 22.07696], [113.54839, 22.10909], [113.54942, 22.14519], [113.54093, 22.15497], [113.52659, 22.18271], [113.53552, 22.20607], [113.53301, 22.21235], [113.53591, 22.21369], [113.54093, 22.21314], [113.54333, 22.21688], [113.5508, 22.21672], [113.56865, 22.20973]], [[114.50148, 22.15017], [113.92195, 22.13873], [113.83338, 22.1826], [113.81621, 22.2163], [113.86771, 22.42972], [114.03113, 22.5065], [114.05438, 22.5026], [114.05729, 22.51104], [114.06272, 22.51617], [114.07267, 22.51855], [114.07817, 22.52997], [114.08606, 22.53276], [114.09048, 22.53716], [114.09692, 22.53435], [114.1034, 22.5352], [114.11181, 22.52878], [114.11656, 22.53415], [114.12665, 22.54003], [114.13823, 22.54319], [114.1482, 22.54091], [114.15123, 22.55163], [114.1597, 22.56041], [114.17247, 22.55944], [114.18338, 22.55444], [114.20655, 22.55706], [114.22185, 22.55343], [114.22888, 22.5436], [114.25154, 22.55977], [114.44998, 22.55977], [114.50148, 22.15017]]]] } },
22553 { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
22554 { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
22555 { type: "Feature", properties: { wikidata: "Q23681", nameEn: "Northern Cyprus", groups: ["Q644636", "145", "142"], driveSide: "left", callingCodes: ["90 392"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.67678, 35.03866], [33.67742, 35.05963], [33.68474, 35.06602], [33.69095, 35.06237], [33.70861, 35.07644], [33.7161, 35.07279], [33.70209, 35.04882], [33.71482, 35.03722], [33.73824, 35.05321], [33.76106, 35.04253], [33.78581, 35.05104], [33.82067, 35.07826], [33.84168, 35.06823], [33.8541, 35.07201], [33.87479, 35.08881], [33.87097, 35.09389], [33.87622, 35.10457], [33.87224, 35.12293], [33.88561, 35.12449], [33.88943, 35.12007], [33.88737, 35.11408], [33.89853, 35.11377], [33.91789, 35.08688], [33.91299, 35.07579], [33.90247, 35.07686], [33.89485, 35.06873], [33.88367, 35.07877], [33.85261, 35.0574], [33.8355, 35.05777], [33.82051, 35.0667], [33.8012, 35.04786], [33.81524, 35.04192], [33.83055, 35.02865], [33.82875, 35.01685], [33.84045, 35.00616], [33.85216, 35.00579], [33.85891, 35.001], [33.85621, 34.98956], [33.83505, 34.98108], [33.84811, 34.97075], [33.86432, 34.97592], [33.90075, 34.96623], [33.98684, 34.76642], [35.48515, 34.70851], [35.51152, 36.10954], [32.82353, 35.70297], [32.46489, 35.48584], [32.60361, 35.16647], [32.64864, 35.19967], [32.70947, 35.18328], [32.70779, 35.14127], [32.85733, 35.07742], [32.86406, 35.1043], [32.94471, 35.09422], [33.01192, 35.15639], [33.08249, 35.17319], [33.11105, 35.15639], [33.15138, 35.19504], [33.27068, 35.16815], [33.3072, 35.16816], [33.31955, 35.18096], [33.35056, 35.18328], [33.34964, 35.17803], [33.35596, 35.17942], [33.35612, 35.17402], [33.36569, 35.17479], [33.3717, 35.1788], [33.37248, 35.18698], [33.38575, 35.2018], [33.4076, 35.20062], [33.41675, 35.16325], [33.46813, 35.10564], [33.48136, 35.0636], [33.47825, 35.04103], [33.45178, 35.02078], [33.45256, 35.00288], [33.47666, 35.00701], [33.48915, 35.06594], [33.53975, 35.08151], [33.57478, 35.06049], [33.567, 35.04803], [33.59658, 35.03635], [33.61215, 35.0527], [33.63765, 35.03869], [33.67678, 35.03866]]]] } },
22556 { type: "Feature", properties: { wikidata: "Q25231", nameEn: "Svalbard", aliases: ["NO-21"], country: "NO", groups: ["SJ", "154", "150", "UN"], level: "subterritory", callingCodes: ["47 79"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.49892, 77.24208], [32.07813, 72.01005], [36.85549, 84.09565], [-7.49892, 77.24208]]]] } },
22557 { type: "Feature", properties: { wikidata: "Q25263", nameEn: "Azores", aliases: ["PT-20"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-23.12984, 40.26428], [-36.43765, 41.39418], [-22.54767, 33.34416], [-23.12984, 40.26428]]]] } },
22558 { type: "Feature", properties: { wikidata: "Q25359", nameEn: "Navassa Island", aliases: ["UM-76"], country: "US", groups: ["UM", "Q1352230", "029", "003", "419", "019", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.7289, 18.71009], [-75.71816, 18.46438], [-74.76465, 18.06252], [-74.7289, 18.71009]]]] } },
22559 { type: "Feature", properties: { wikidata: "Q25396", nameEn: "Bonaire", aliases: ["BQ-BO", "NL-BQ1"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.89186, 12.4116], [-68.90012, 12.62309], [-68.33524, 11.78151], [-68.01417, 11.77722], [-67.89186, 12.4116]]]] } },
22560 { type: "Feature", properties: { wikidata: "Q25528", nameEn: "Saba", aliases: ["BQ-SA", "NL-BQ2"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 4"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.81314, 17.95045], [-63.22932, 17.32592], [-63.07669, 17.79659]]]] } },
22561 { type: "Feature", properties: { wikidata: "Q26180", nameEn: "Sint Eustatius", aliases: ["BQ-SE", "NL-BQ3"], country: "NL", groups: ["Q1451600", "BQ", "029", "003", "419", "019", "UN"], level: "subterritory", callingCodes: ["599 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.07669, 17.79659], [-63.34999, 16.94218], [-62.76692, 17.64353], [-63.07669, 17.79659]]]] } },
22562 { type: "Feature", properties: { wikidata: "Q26253", nameEn: "Madeira", aliases: ["PT-30"], country: "PT", groups: ["Q3320166", "Q2914565", "Q105472", "EU", "039", "150", "UN"], callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-19.30302, 33.65304], [-16.04789, 29.65076], [-11.68307, 33.12333], [-19.30302, 33.65304]]]] } },
22563 { type: "Feature", properties: { wikidata: "Q26927", nameEn: "Lakshadweep", aliases: ["IN-LD"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[67.64074, 11.57295], [76.59015, 5.591], [72.67494, 13.58102], [67.64074, 11.57295]]]] } },
22564 { type: "Feature", properties: { wikidata: "Q27329", nameEn: "Asian Russia", country: "RU", groups: ["142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.99933, 64.74703], [-172.76104, 63.77445], [-169.03888, 65.48473], [-168.95635, 65.98512], [-168.25765, 71.99091], [-179.9843, 71.90735], [-179.99933, 64.74703]]], [[[59.99809, 51.98263], [60.19925, 51.99173], [60.48915, 52.15175], [60.72581, 52.15538], [60.78201, 52.22067], [61.05417, 52.35096], [60.98021, 52.50068], [60.84709, 52.52228], [60.84118, 52.63912], [60.71693, 52.66245], [60.71989, 52.75923], [61.05842, 52.92217], [61.23462, 53.03227], [62.0422, 52.96105], [62.12799, 52.99133], [62.14574, 53.09626], [61.19024, 53.30536], [61.14291, 53.41481], [61.29082, 53.50992], [61.37957, 53.45887], [61.57185, 53.50112], [61.55706, 53.57144], [60.90626, 53.62937], [61.22574, 53.80268], [61.14283, 53.90063], [60.99796, 53.93699], [61.26863, 53.92797], [61.3706, 54.08464], [61.47603, 54.08048], [61.56941, 53.95703], [61.65318, 54.02445], [62.03913, 53.94768], [62.00966, 54.04134], [62.38535, 54.03961], [62.45931, 53.90737], [62.56876, 53.94047], [62.58651, 54.05871], [63.80604, 54.27079], [63.91224, 54.20013], [64.02715, 54.22679], [63.97686, 54.29763], [64.97216, 54.4212], [65.11033, 54.33028], [65.24663, 54.35721], [65.20174, 54.55216], [68.21308, 54.98645], [68.26661, 55.09226], [68.19206, 55.18823], [68.90865, 55.38148], [69.34224, 55.36344], [69.74917, 55.35545], [70.19179, 55.1476], [70.76493, 55.3027], [70.96009, 55.10558], [71.08288, 54.71253], [71.24185, 54.64965], [71.08706, 54.33376], [71.10379, 54.13326], [71.96141, 54.17736], [72.17477, 54.36303], [72.43415, 53.92685], [72.71026, 54.1161], [73.37963, 53.96132], [73.74778, 54.07194], [73.68921, 53.86522], [73.25412, 53.61532], [73.39218, 53.44623], [75.07405, 53.80831], [75.43398, 53.98652], [75.3668, 54.07439], [76.91052, 54.4677], [76.82266, 54.1798], [76.44076, 54.16017], [76.54243, 53.99329], [77.90383, 53.29807], [79.11255, 52.01171], [80.08138, 50.77658], [80.4127, 50.95581], [80.44819, 51.20855], [80.80318, 51.28262], [81.16999, 51.15662], [81.06091, 50.94833], [81.41248, 50.97524], [81.46581, 50.77658], [81.94999, 50.79307], [82.55443, 50.75412], [83.14607, 51.00796], [83.8442, 50.87375], [84.29385, 50.27257], [84.99198, 50.06793], [85.24047, 49.60239], [86.18709, 49.50259], [86.63674, 49.80136], [86.79056, 49.74787], [86.61307, 49.60239], [86.82606, 49.51796], [87.03071, 49.25142], [87.31465, 49.23603], [87.28386, 49.11626], [87.478, 49.07403], [87.48983, 49.13794], [87.81333, 49.17354], [87.98977, 49.18147], [88.15543, 49.30314], [88.17223, 49.46934], [88.42449, 49.48821], [88.82499, 49.44808], [89.70687, 49.72535], [89.59711, 49.90851], [91.86048, 50.73734], [92.07173, 50.69585], [92.44714, 50.78762], [93.01109, 50.79001], [92.99595, 50.63183], [94.30823, 50.57498], [94.39258, 50.22193], [94.49477, 50.17832], [94.6121, 50.04239], [94.97166, 50.04725], [95.02465, 49.96941], [95.74757, 49.97915], [95.80056, 50.04239], [96.97388, 49.88413], [97.24639, 49.74737], [97.56811, 49.84265], [97.56432, 49.92801], [97.76871, 49.99861], [97.85197, 49.91339], [98.29481, 50.33561], [98.31373, 50.4996], [98.06393, 50.61262], [97.9693, 50.78044], [98.01472, 50.86652], [97.83305, 51.00248], [98.05257, 51.46696], [98.22053, 51.46579], [98.33222, 51.71832], [98.74142, 51.8637], [98.87768, 52.14563], [99.27888, 51.96876], [99.75578, 51.90108], [99.89203, 51.74903], [100.61116, 51.73028], [101.39085, 51.45753], [101.5044, 51.50467], [102.14032, 51.35566], [102.32194, 50.67982], [102.71178, 50.38873], [103.70343, 50.13952], [105.32528, 50.4648], [106.05562, 50.40582], [106.07865, 50.33474], [106.47156, 50.31909], [106.49628, 50.32436], [106.51122, 50.34408], [106.58373, 50.34044], [106.80326, 50.30177], [107.00007, 50.1977], [107.1174, 50.04239], [107.36407, 49.97612], [107.96116, 49.93191], [107.95387, 49.66659], [108.27937, 49.53167], [108.53969, 49.32325], [109.18017, 49.34709], [109.51325, 49.22859], [110.24373, 49.16676], [110.39891, 49.25083], [110.64493, 49.1816], [113.02647, 49.60772], [113.20216, 49.83356], [114.325, 50.28098], [114.9703, 50.19254], [115.26068, 49.97367], [115.73602, 49.87688], [116.22402, 50.04477], [116.62502, 49.92919], [116.71193, 49.83813], [117.27597, 49.62544], [117.48208, 49.62324], [117.82343, 49.52696], [118.61623, 49.93809], [119.11003, 50.00276], [119.27996, 50.13348], [119.38598, 50.35162], [119.13553, 50.37412], [120.10963, 51.671], [120.65907, 51.93544], [120.77337, 52.20805], [120.61346, 52.32447], [120.71673, 52.54099], [120.46454, 52.63811], [120.04049, 52.58773], [120.0451, 52.7359], [120.85633, 53.28499], [121.39213, 53.31888], [122.35063, 53.49565], [122.85966, 53.47395], [123.26989, 53.54843], [123.86158, 53.49391], [124.46078, 53.21881], [125.17522, 53.20225], [125.6131, 53.07229], [126.558, 52.13738], [126.44606, 51.98254], [126.68349, 51.70607], [126.90369, 51.3238], [126.93135, 51.0841], [127.14586, 50.91152], [127.28165, 50.72075], [127.36335, 50.58306], [127.28765, 50.46585], [127.36009, 50.43787], [127.37384, 50.28393], [127.60515, 50.23503], [127.49299, 50.01251], [127.53516, 49.84306], [127.83476, 49.5748], [128.72896, 49.58676], [129.11153, 49.36813], [129.23232, 49.40353], [129.35317, 49.3481], [129.40398, 49.44194], [129.50685, 49.42398], [129.67598, 49.29596], [129.85416, 49.11067], [130.2355, 48.86741], [130.43232, 48.90844], [130.66946, 48.88251], [130.52147, 48.61745], [130.84462, 48.30942], [130.65103, 48.10052], [130.90915, 47.90623], [130.95985, 47.6957], [131.09871, 47.6852], [131.2635, 47.73325], [131.90448, 47.68011], [132.57309, 47.71741], [132.66989, 47.96491], [134.49516, 48.42884], [134.75328, 48.36763], [134.67098, 48.1564], [134.55508, 47.98651], [134.7671, 47.72051], [134.50898, 47.4812], [134.20016, 47.33458], [134.03538, 46.75668], [133.84104, 46.46681], [133.91496, 46.4274], [133.88097, 46.25066], [133.68047, 46.14697], [133.72695, 46.05576], [133.67569, 45.9759], [133.60442, 45.90053], [133.48457, 45.86203], [133.41083, 45.57723], [133.19419, 45.51913], [133.09279, 45.25693], [133.12293, 45.1332], [132.96373, 45.0212], [132.83978, 45.05916], [131.99417, 45.2567], [131.86903, 45.33636], [131.76532, 45.22609], [131.66852, 45.2196], [131.68466, 45.12374], [131.48415, 44.99513], [130.95639, 44.85154], [131.1108, 44.70266], [131.30365, 44.04262], [131.25484, 44.03131], [131.23583, 43.96085], [131.26176, 43.94011], [131.21105, 43.82383], [131.19492, 43.53047], [131.29402, 43.46695], [131.30324, 43.39498], [131.19031, 43.21385], [131.20414, 43.13654], [131.10274, 43.04734], [131.135, 42.94114], [131.02668, 42.91246], [131.02438, 42.86518], [130.66524, 42.84753], [130.44361, 42.76205], [130.40213, 42.70788], [130.56576, 42.68925], [130.62107, 42.58413], [130.55143, 42.52158], [130.56835, 42.43281], [130.60805, 42.4317], [130.64181, 42.41422], [130.66367, 42.38024], [130.65022, 42.32281], [131.95041, 41.5445], [140.9182, 45.92937], [145.82343, 44.571], [145.23667, 43.76813], [153.94307, 38.42848], [180, 62.52334], [180, 71.53642], [155.31937, 81.93282], [76.13964, 83.37843], [64.18965, 69.94255], [66.1708, 67.61252], [61.98014, 65.72191], [60.74386, 64.95767], [59.63945, 64.78384], [59.80579, 64.13948], [59.24834, 63.01859], [59.61398, 62.44915], [59.36223, 61.3882], [59.50685, 60.91162], [58.3853, 59.487], [59.15636, 59.14682], [59.40376, 58.45822], [58.71104, 58.07475], [58.81412, 57.71602], [58.13789, 57.68097], [58.07604, 57.08308], [57.28024, 56.87898], [57.51527, 56.08729], [59.28419, 56.15739], [59.49035, 55.60486], [58.81825, 55.03378], [57.25137, 55.26262], [57.14829, 54.84204], [57.95234, 54.39672], [59.95217, 54.85853], [59.70487, 54.14846], [58.94336, 53.953], [58.79644, 52.43392], [59.22409, 52.28437], [59.25033, 52.46803], [60.17516, 52.39457], [60.17253, 52.25814], [59.91279, 52.06924], [59.99809, 51.98263]]]] } },
22565 { type: "Feature", properties: { wikidata: "Q34366", nameEn: "Tasmania", aliases: ["AU-TAS"], country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.64533, -39.13605], [159.69067, -56.28945], [159.74028, -39.1978], [123.64533, -39.13605]]]] } },
22566 { type: "Feature", properties: { wikidata: "Q34497", nameEn: "Saint Helena", aliases: ["SH-HL"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.3824, -13.9131], [-6.17428, -19.07236], [-3.29308, -15.22647], [-8.3824, -13.9131]]]] } },
22567 { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
22568 { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
22569 { type: "Feature", properties: { wikidata: "Q36678", nameEn: "West Bank", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.47672, 31.49578], [35.55941, 31.76535], [35.52758, 31.9131], [35.54375, 31.96587], [35.52012, 32.04076], [35.57111, 32.21877], [35.55807, 32.38674], [35.42078, 32.41562], [35.41048, 32.43706], [35.41598, 32.45593], [35.42034, 32.46009], [35.40224, 32.50136], [35.35212, 32.52047], [35.30685, 32.51024], [35.29306, 32.50947], [35.25049, 32.52453], [35.2244, 32.55289], [35.15937, 32.50466], [35.10882, 32.4757], [35.10024, 32.47856], [35.09236, 32.47614], [35.08564, 32.46948], [35.07059, 32.4585], [35.05423, 32.41754], [35.05311, 32.4024], [35.0421, 32.38242], [35.05142, 32.3667], [35.04243, 32.35008], [35.01772, 32.33863], [35.01119, 32.28684], [35.02939, 32.2671], [35.01841, 32.23981], [34.98885, 32.20758], [34.95703, 32.19522], [34.96009, 32.17503], [34.99039, 32.14626], [34.98507, 32.12606], [34.99437, 32.10962], [34.9863, 32.09551], [35.00261, 32.027], [34.98682, 31.96935], [35.00124, 31.93264], [35.03489, 31.92448], [35.03978, 31.89276], [35.03489, 31.85919], [34.99712, 31.85569], [34.9724, 31.83352], [35.01978, 31.82944], [35.05617, 31.85685], [35.07677, 31.85627], [35.14174, 31.81325], [35.18603, 31.80901], [35.18169, 31.82542], [35.19461, 31.82687], [35.21469, 31.81835], [35.216, 31.83894], [35.21128, 31.863], [35.20381, 31.86716], [35.20673, 31.88151], [35.20791, 31.8821], [35.20945, 31.8815], [35.21016, 31.88237], [35.21276, 31.88153], [35.2136, 31.88241], [35.22014, 31.88264], [35.22294, 31.87889], [35.22567, 31.86745], [35.22817, 31.8638], [35.2249, 31.85433], [35.2304, 31.84222], [35.24816, 31.8458], [35.25753, 31.8387], [35.251, 31.83085], [35.26404, 31.82567], [35.25573, 31.81362], [35.26058, 31.79064], [35.25225, 31.7678], [35.26319, 31.74846], [35.25182, 31.73945], [35.24981, 31.72543], [35.2438, 31.7201], [35.24315, 31.71244], [35.23972, 31.70896], [35.22392, 31.71899], [35.21937, 31.71578], [35.20538, 31.72388], [35.18023, 31.72067], [35.16478, 31.73242], [35.15474, 31.73352], [35.15119, 31.73634], [35.13931, 31.73012], [35.12933, 31.7325], [35.11895, 31.71454], [35.10782, 31.71594], [35.08226, 31.69107], [35.00879, 31.65426], [34.95249, 31.59813], [34.9415, 31.55601], [34.94356, 31.50743], [34.93258, 31.47816], [34.89756, 31.43891], [34.87833, 31.39321], [34.88932, 31.37093], [34.92571, 31.34337], [35.02459, 31.35979], [35.13033, 31.3551], [35.22921, 31.37445], [35.39675, 31.49572], [35.47672, 31.49578]]]] } },
22570 { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
22571 { type: "Feature", properties: { wikidata: "Q38095", nameEn: "Gal\xE1pagos Islands", aliases: ["EC-W"], country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-93.12365, 2.64343], [-92.46744, -2.52874], [-87.07749, -0.8849], [-93.12365, 2.64343]]]] } },
22572 { type: "Feature", properties: { wikidata: "Q39760", nameEn: "Gaza Strip", country: "PS", groups: ["145", "142"], callingCodes: ["970"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.21853, 31.32363], [34.23572, 31.2966], [34.24012, 31.29591], [34.26742, 31.21998], [34.29417, 31.24194], [34.36523, 31.28963], [34.37381, 31.30598], [34.36505, 31.36404], [34.40077, 31.40926], [34.48892, 31.48365], [34.56797, 31.54197], [34.48681, 31.59711], [34.29262, 31.70393], [34.052, 31.46619]]]] } },
22573 { type: "Feature", properties: { wikidata: "Q40888", nameEn: "Andaman and Nicobar Islands", aliases: ["IN-AN"], country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[94.42132, 5.96581], [94.6371, 13.81803], [86.7822, 13.41052], [94.42132, 5.96581]]]] } },
22574 { type: "Feature", properties: { wikidata: "Q41684", nameEn: "Stewart Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.59185, -47.61313], [169.70504, -47.56021], [167.52103, -46.41337], [166.59185, -47.61313]]]] } },
22575 { type: "Feature", properties: { wikidata: "Q43296", nameEn: "Wake Island", aliases: ["WK", "WAK", "WKUM", "872", "UM-79"], country: "US", groups: ["UM", "Q1352230", "057", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[167.34779, 18.97692], [166.67967, 20.14834], [165.82549, 18.97692], [167.34779, 18.97692]]]] } },
22576 { type: "Feature", properties: { wikidata: "Q46275", nameEn: "New Zealand Subantarctic Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[164.30551, -47.88072], [161.96603, -56.07661], [179.49541, -50.04657], [179.49541, -47.2902], [169.91032, -47.66283], [164.30551, -47.88072]]]] } },
22577 { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
22578 { type: "Feature", properties: { wikidata: "Q46772", nameEn: "Kerguelen Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[61.9216, -49.39746], [70.67507, -51.14192], [74.25129, -45.45074], [61.9216, -49.39746]]]] } },
22579 { type: "Feature", properties: { wikidata: "Q46879", nameEn: "Baker Island", aliases: ["UM-81"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-175.33482, -1.40631], [-175.31323, 0.5442], [-177.91421, 0.39582], [-175.33482, -1.40631]]]] } },
22580 { type: "Feature", properties: { wikidata: "Q47863", nameEn: "Midway Atoll", aliases: ["MI", "MID", "MIUM", "488", "UM-71"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.29741, 29.09786], [-177.77531, 29.29793], [-177.5224, 27.7635], [-176.29741, 29.09786]]]] } },
22581 { type: "Feature", properties: { wikidata: "Q62218", nameEn: "Jarvis Island", aliases: ["UM-86"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-160.42921, -1.4364], [-159.12443, 0.19975], [-160.38779, 0.30331], [-160.42921, -1.4364]]]] } },
22582 { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
22583 { type: "Feature", properties: { wikidata: "Q114935", nameEn: "Kermadec Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-174.40891, -29.09438], [-180, -24.21376], [-179.96512, -35.00791], [-174.40891, -29.09438]]]] } },
22584 { type: "Feature", properties: { wikidata: "Q115459", nameEn: "Chatham Islands", aliases: ["NZ-CIT"], country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-179.93224, -45.18423], [-172.47015, -45.17912], [-176.30998, -41.38382], [-179.93224, -45.18423]]]] } },
22585 { type: "Feature", properties: { wikidata: "Q118863", nameEn: "North Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[179.49541, -47.2902], [179.49541, -36.79303], [174.17679, -32.62487], [170.27492, -36.38133], [174.58663, -40.80446], [174.46634, -41.55028], [179.49541, -47.2902]]]] } },
22586 { type: "Feature", properties: { wikidata: "Q120755", nameEn: "South Island", country: "NZ", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.70504, -47.56021], [179.49541, -47.2902], [174.46634, -41.55028], [174.58663, -40.80446], [170.27492, -36.38133], [166.56976, -39.94841], [164.8365, -46.0205], [167.52103, -46.41337], [169.70504, -47.56021]]]] } },
22587 { type: "Feature", properties: { wikidata: "Q123076", nameEn: "Palmyra Atoll", aliases: ["UM-95"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.06795, 5.2462], [-161.0731, 7.1291], [-163.24478, 5.24198], [-161.06795, 5.2462]]]] } },
22588 { type: "Feature", properties: { wikidata: "Q130574", nameEn: "Chafarinas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.40316, 35.16893], [-2.43262, 35.20652], [-2.45965, 35.16527], [-2.40316, 35.16893]]]] } },
22589 { type: "Feature", properties: { wikidata: "Q130895", nameEn: "Kingman Reef", aliases: ["UM-89"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-161.0731, 7.1291], [-163.16627, 7.15036], [-163.24478, 5.24198], [-161.0731, 7.1291]]]] } },
22590 { type: "Feature", properties: { wikidata: "Q131008", nameEn: "Johnston Atoll", aliases: ["JT", "JTN", "JTUM", "396", "UM-67"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.65691, 16.57199], [-168.87689, 16.01159], [-169.2329, 17.4933], [-170.65691, 16.57199]]]] } },
22591 { type: "Feature", properties: { wikidata: "Q131305", nameEn: "Howland Island", aliases: ["UM-84"], country: "US", groups: ["UM", "Q1352230", "061", "009", "UN"], level: "subterritory", roadSpeedUnit: "mph", roadHeightUnit: "ft" }, geometry: { type: "MultiPolygon", coordinates: [[[[-177.91421, 0.39582], [-175.31323, 0.5442], [-176.74464, 2.28109], [-177.91421, 0.39582]]]] } },
22592 { type: "Feature", properties: { wikidata: "Q133888", nameEn: "Ashmore and Cartier Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[123.7463, -11.1783], [120.6877, -13.59408], [125.29076, -12.33139], [123.7463, -11.1783]]]] } },
22593 { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
22594 { type: "Feature", properties: { wikidata: "Q172216", nameEn: "Coral Sea Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [156.73836, -14.50464], [145.2855, -9.62524], [147.69992, -17.5933], [152.93188, -20.92631], [154.02855, -24.43238], [159.77159, -28.41151]]]] } },
22595 { type: "Feature", properties: { wikidata: "Q179313", nameEn: "Alderney", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.09454, 49.46288], [-2.02963, 49.91866], [-2.49556, 49.79012], [-2.36485, 49.48223]]]] } },
22596 { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
22597 { type: "Feature", properties: { wikidata: "Q190571", nameEn: "Scattered Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[53.53458, -16.36909], [54.96649, -16.28353], [54.61476, -15.02273], [53.53458, -16.36909]]], [[[38.55969, -20.75596], [40.68027, -23.38889], [43.52893, -15.62903], [38.55969, -20.75596]]], [[[47.03092, -11.05648], [47.11593, -12.08552], [47.96702, -11.46447], [47.03092, -11.05648]]]] } },
22598 { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
22599 { type: "Feature", properties: { wikidata: "Q191146", nameEn: "Pe\xF1\xF3n de V\xE9lez de la Gomera", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.30191, 35.17419], [-4.30112, 35.17058], [-4.29436, 35.17149], [-4.30191, 35.17419]]]] } },
22600 { type: "Feature", properties: { wikidata: "Q201698", nameEn: "Crozet Islands", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[55.03425, -43.65017], [46.31615, -46.28749], [54.5587, -47.93013], [55.03425, -43.65017]]]] } },
22601 { type: "Feature", properties: { wikidata: "Q578170", nameEn: "Contiguous United States", aliases: ["CONUS"], country: "US", groups: ["Q35657", "021", "003", "019", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-97.13927, 25.96583], [-96.92418, 25.97377], [-80.57035, 24.0565], [-78.91214, 27.76553], [-61.98255, 37.34815], [-67.16117, 44.20069], [-66.93432, 44.82597], [-66.96824, 44.83078], [-66.98249, 44.87071], [-66.96824, 44.90965], [-67.0216, 44.95333], [-67.11316, 45.11176], [-67.15965, 45.16179], [-67.19603, 45.16771], [-67.20349, 45.1722], [-67.22751, 45.16344], [-67.27039, 45.1934], [-67.29748, 45.18173], [-67.29754, 45.14865], [-67.34927, 45.122], [-67.48201, 45.27351], [-67.42394, 45.37969], [-67.50578, 45.48971], [-67.42144, 45.50584], [-67.43815, 45.59162], [-67.6049, 45.60725], [-67.80705, 45.69528], [-67.80653, 45.80022], [-67.75654, 45.82324], [-67.80961, 45.87531], [-67.75196, 45.91814], [-67.78111, 45.9392], [-67.78578, 47.06473], [-67.87993, 47.10377], [-67.94843, 47.1925], [-68.23244, 47.35712], [-68.37458, 47.35851], [-68.38332, 47.28723], [-68.57914, 47.28431], [-68.60575, 47.24659], [-68.70125, 47.24399], [-68.89222, 47.1807], [-69.05039, 47.2456], [-69.05073, 47.30076], [-69.05148, 47.42012], [-69.22119, 47.46461], [-69.99966, 46.69543], [-70.05812, 46.41768], [-70.18547, 46.35357], [-70.29078, 46.18832], [-70.23855, 46.1453], [-70.31025, 45.96424], [-70.24694, 45.95138], [-70.25976, 45.89675], [-70.41523, 45.79497], [-70.38934, 45.73215], [-70.54019, 45.67291], [-70.68516, 45.56964], [-70.72651, 45.49771], [-70.62518, 45.42286], [-70.65383, 45.37592], [-70.78372, 45.43269], [-70.82638, 45.39828], [-70.80236, 45.37444], [-70.84816, 45.22698], [-70.89864, 45.2398], [-70.91169, 45.29849], [-70.95193, 45.33895], [-71.0107, 45.34819], [-71.01866, 45.31573], [-71.08364, 45.30623], [-71.14568, 45.24128], [-71.19723, 45.25438], [-71.22338, 45.25184], [-71.29371, 45.29996], [-71.37133, 45.24624], [-71.44252, 45.2361], [-71.40364, 45.21382], [-71.42778, 45.12624], [-71.48735, 45.07784], [-71.50067, 45.01357], [-73.35025, 45.00942], [-74.32699, 44.99029], [-74.66689, 45.00646], [-74.8447, 45.00606], [-74.99101, 44.98051], [-75.01363, 44.95608], [-75.2193, 44.87821], [-75.41441, 44.76614], [-75.76813, 44.51537], [-75.8217, 44.43176], [-75.95947, 44.34463], [-76.00018, 44.34896], [-76.16285, 44.28262], [-76.1664, 44.23051], [-76.244, 44.19643], [-76.31222, 44.19894], [-76.35324, 44.13493], [-76.43859, 44.09393], [-76.79706, 43.63099], [-79.25796, 43.54052], [-79.06921, 43.26183], [-79.05512, 43.25375], [-79.05544, 43.21224], [-79.05002, 43.20133], [-79.05384, 43.17418], [-79.04652, 43.16396], [-79.0427, 43.13934], [-79.06881, 43.12029], [-79.05671, 43.10937], [-79.07486, 43.07845], [-79.01055, 43.06659], [-78.99941, 43.05612], [-79.02424, 43.01983], [-79.02074, 42.98444], [-78.98126, 42.97], [-78.96312, 42.95509], [-78.93224, 42.95229], [-78.90905, 42.93022], [-78.90712, 42.89733], [-78.93684, 42.82887], [-82.67862, 41.67615], [-83.11184, 41.95671], [-83.14962, 42.04089], [-83.12724, 42.2376], [-83.09837, 42.28877], [-83.07837, 42.30978], [-83.02253, 42.33045], [-82.82964, 42.37355], [-82.64242, 42.55594], [-82.58873, 42.54984], [-82.57583, 42.5718], [-82.51858, 42.611], [-82.51063, 42.66025], [-82.46613, 42.76615], [-82.4826, 42.8068], [-82.45331, 42.93139], [-82.4253, 42.95423], [-82.4146, 42.97626], [-82.42469, 42.992], [-82.48419, 45.30225], [-83.59589, 45.82131], [-83.43746, 45.99749], [-83.57017, 46.105], [-83.83329, 46.12169], [-83.90453, 46.05922], [-83.95399, 46.05634], [-84.1096, 46.23987], [-84.09756, 46.25512], [-84.11615, 46.2681], [-84.11254, 46.32329], [-84.13451, 46.39218], [-84.11196, 46.50248], [-84.12885, 46.53068], [-84.17723, 46.52753], [-84.1945, 46.54061], [-84.2264, 46.53337], [-84.26351, 46.49508], [-84.29893, 46.49127], [-84.34174, 46.50683], [-84.42101, 46.49853], [-84.4481, 46.48972], [-84.47607, 46.45225], [-84.55635, 46.45974], [-84.85871, 46.88881], [-88.37033, 48.30586], [-89.48837, 48.01412], [-89.57972, 48.00023], [-89.77248, 48.02607], [-89.89974, 47.98109], [-90.07418, 48.11043], [-90.56312, 48.09488], [-90.56444, 48.12184], [-90.75045, 48.09143], [-90.87588, 48.2484], [-91.08016, 48.18096], [-91.25025, 48.08522], [-91.43248, 48.04912], [-91.45829, 48.07454], [-91.58025, 48.04339], [-91.55649, 48.10611], [-91.70451, 48.11805], [-91.71231, 48.19875], [-91.86125, 48.21278], [-91.98929, 48.25409], [-92.05339, 48.35958], [-92.14732, 48.36578], [-92.202, 48.35252], [-92.26662, 48.35651], [-92.30939, 48.31251], [-92.27167, 48.25046], [-92.37185, 48.22259], [-92.48147, 48.36609], [-92.45588, 48.40624], [-92.50712, 48.44921], [-92.65606, 48.43471], [-92.71323, 48.46081], [-92.69927, 48.49573], [-92.62747, 48.50278], [-92.6342, 48.54133], [-92.7287, 48.54005], [-92.94973, 48.60866], [-93.25391, 48.64266], [-93.33946, 48.62787], [-93.3712, 48.60599], [-93.39758, 48.60364], [-93.40693, 48.60948], [-93.44472, 48.59147], [-93.47022, 48.54357], [-93.66382, 48.51845], [-93.79267, 48.51631], [-93.80939, 48.52439], [-93.80676, 48.58232], [-93.83288, 48.62745], [-93.85769, 48.63284], [-94.23215, 48.65202], [-94.25104, 48.65729], [-94.25172, 48.68404], [-94.27153, 48.70232], [-94.4174, 48.71049], [-94.44258, 48.69223], [-94.53826, 48.70216], [-94.54885, 48.71543], [-94.58903, 48.71803], [-94.69335, 48.77883], [-94.69669, 48.80918], [-94.70486, 48.82365], [-94.70087, 48.8339], [-94.687, 48.84077], [-94.75017, 49.09931], [-94.77355, 49.11998], [-94.82487, 49.29483], [-94.8159, 49.32299], [-94.85381, 49.32492], [-94.95681, 49.37035], [-94.99532, 49.36579], [-95.01419, 49.35647], [-95.05825, 49.35311], [-95.12903, 49.37056], [-95.15357, 49.384], [-95.15355, 48.9996], [-123.32163, 49.00419], [-123.0093, 48.83186], [-123.0093, 48.76586], [-123.26565, 48.6959], [-123.15614, 48.35395], [-123.50039, 48.21223], [-125.03842, 48.53282], [-133.98258, 38.06389], [-118.48109, 32.5991], [-117.1243, 32.53427], [-115.88053, 32.63624], [-114.71871, 32.71894], [-114.76736, 32.64094], [-114.80584, 32.62028], [-114.81141, 32.55543], [-114.79524, 32.55731], [-114.82011, 32.49609], [-111.07523, 31.33232], [-108.20979, 31.33316], [-108.20899, 31.78534], [-106.529, 31.784], [-106.52266, 31.77509], [-106.51251, 31.76922], [-106.50962, 31.76155], [-106.50111, 31.75714], [-106.48815, 31.74769], [-106.47298, 31.75054], [-106.46726, 31.75998], [-106.45244, 31.76523], [-106.43419, 31.75478], [-106.41773, 31.75196], [-106.38003, 31.73151], [-106.3718, 31.71165], [-106.34864, 31.69663], [-106.33419, 31.66303], [-106.30305, 31.62154], [-106.28084, 31.56173], [-106.24612, 31.54193], [-106.23711, 31.51262], [-106.20346, 31.46305], [-106.09025, 31.40569], [-106.00363, 31.39181], [-104.77674, 30.4236], [-104.5171, 29.64671], [-104.3969, 29.57105], [-104.39363, 29.55396], [-104.37752, 29.54255], [-103.15787, 28.93865], [-102.60596, 29.8192], [-101.47277, 29.7744], [-101.05686, 29.44738], [-101.01128, 29.36947], [-100.96725, 29.3477], [-100.94579, 29.34523], [-100.94056, 29.33371], [-100.87982, 29.296], [-100.79696, 29.24688], [-100.67294, 29.09744], [-100.63689, 28.90812], [-100.59809, 28.88197], [-100.52313, 28.75598], [-100.5075, 28.74066], [-100.51222, 28.70679], [-100.50029, 28.66117], [-99.55409, 27.61314], [-99.51478, 27.55836], [-99.52955, 27.49747], [-99.50208, 27.50021], [-99.48045, 27.49016], [-99.482, 27.47128], [-99.49744, 27.43746], [-99.53573, 27.30926], [-99.08477, 26.39849], [-99.03053, 26.41249], [-99.00546, 26.3925], [-98.35126, 26.15129], [-98.30491, 26.10475], [-98.27075, 26.09457], [-98.24603, 26.07191], [-97.97017, 26.05232], [-97.95155, 26.0625], [-97.66511, 26.01708], [-97.52025, 25.88518], [-97.49828, 25.89877], [-97.45669, 25.86874], [-97.42511, 25.83969], [-97.37332, 25.83854], [-97.35946, 25.92189], [-97.13927, 25.96583]]]] } },
22602 { type: "Feature", properties: { wikidata: "Q620634", nameEn: "Bir Tawil", groups: ["015", "002"], level: "territory" }, geometry: { type: "MultiPolygon", coordinates: [[[[33.17563, 22.00405], [33.57251, 21.72406], [33.99686, 21.76784], [34.0765, 22.00501], [33.17563, 22.00405]]]] } },
22603 { type: "Feature", properties: { wikidata: "Q639185", nameEn: "Peros Banhos", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.12587, -4.02588], [70.1848, -6.37445], [72.09518, -5.61768], [72.12587, -4.02588]]]] } },
22604 { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
22605 { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
22606 { type: "Feature", properties: { wikidata: "Q875134", nameEn: "European Russia", country: "RU", groups: ["151", "150", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [19.64312, 54.45423], [19.8038, 54.44203], [20.63871, 54.3706], [21.41123, 54.32395], [22.79705, 54.36264], [22.7253, 54.41732], [22.70208, 54.45312], [22.67788, 54.532], [22.71293, 54.56454], [22.68021, 54.58486], [22.7522, 54.63525], [22.74225, 54.64339], [22.75467, 54.6483], [22.73397, 54.66604], [22.73631, 54.72952], [22.87317, 54.79492], [22.85083, 54.88711], [22.76422, 54.92521], [22.68723, 54.9811], [22.65451, 54.97037], [22.60075, 55.01863], [22.58907, 55.07085], [22.47688, 55.04408], [22.31562, 55.0655], [22.14267, 55.05345], [22.11697, 55.02131], [22.06087, 55.02935], [22.02582, 55.05078], [22.03984, 55.07888], [21.99543, 55.08691], [21.96505, 55.07353], [21.85521, 55.09493], [21.64954, 55.1791], [21.55605, 55.20311], [21.51095, 55.18507], [21.46766, 55.21115], [21.38446, 55.29348], [21.35465, 55.28427], [21.26425, 55.24456], [20.95181, 55.27994], [20.60454, 55.40986], [18.57853, 55.25302]]], [[[26.32936, 60.00121], [26.90044, 59.63819], [27.85643, 59.58538], [28.04187, 59.47017], [28.19061, 59.39962], [28.21137, 59.38058], [28.20537, 59.36491], [28.19284, 59.35791], [28.14215, 59.28934], [28.00689, 59.28351], [27.90911, 59.24353], [27.87978, 59.18097], [27.80482, 59.1116], [27.74429, 58.98351], [27.36366, 58.78381], [27.55489, 58.39525], [27.48541, 58.22615], [27.62393, 58.09462], [27.67282, 57.92627], [27.81841, 57.89244], [27.78526, 57.83963], [27.56689, 57.83356], [27.50171, 57.78842], [27.52615, 57.72843], [27.3746, 57.66834], [27.40393, 57.62125], [27.31919, 57.57672], [27.34698, 57.52242], [27.56832, 57.53728], [27.52453, 57.42826], [27.86101, 57.29402], [27.66511, 56.83921], [27.86101, 56.88204], [28.04768, 56.59004], [28.13526, 56.57989], [28.10069, 56.524], [28.19057, 56.44637], [28.16599, 56.37806], [28.23716, 56.27588], [28.15217, 56.16964], [28.30571, 56.06035], [28.36888, 56.05805], [28.37987, 56.11399], [28.43068, 56.09407], [28.5529, 56.11705], [28.68337, 56.10173], [28.63668, 56.07262], [28.73418, 55.97131], [29.08299, 56.03427], [29.21717, 55.98971], [29.44692, 55.95978], [29.3604, 55.75862], [29.51283, 55.70294], [29.61446, 55.77716], [29.80672, 55.79569], [29.97975, 55.87281], [30.12136, 55.8358], [30.27776, 55.86819], [30.30987, 55.83592], [30.48257, 55.81066], [30.51346, 55.78982], [30.51037, 55.76568], [30.63344, 55.73079], [30.67464, 55.64176], [30.72957, 55.66268], [30.7845, 55.58514], [30.86003, 55.63169], [30.93419, 55.6185], [30.95204, 55.50667], [30.90123, 55.46621], [30.93144, 55.3914], [30.8257, 55.3313], [30.81946, 55.27931], [30.87944, 55.28223], [30.97369, 55.17134], [31.02071, 55.06167], [31.00972, 55.02783], [30.94243, 55.03964], [30.9081, 55.02232], [30.95754, 54.98609], [30.93144, 54.9585], [30.81759, 54.94064], [30.8264, 54.90062], [30.75165, 54.80699], [30.95479, 54.74346], [30.97127, 54.71967], [31.0262, 54.70698], [30.98226, 54.68872], [30.99187, 54.67046], [31.19339, 54.66947], [31.21399, 54.63113], [31.08543, 54.50361], [31.22945, 54.46585], [31.3177, 54.34067], [31.30791, 54.25315], [31.57002, 54.14535], [31.89599, 54.0837], [31.88744, 54.03653], [31.85019, 53.91801], [31.77028, 53.80015], [31.89137, 53.78099], [32.12621, 53.81586], [32.36663, 53.7166], [32.45717, 53.74039], [32.50112, 53.68594], [32.40499, 53.6656], [32.47777, 53.5548], [32.74968, 53.45597], [32.73257, 53.33494], [32.51725, 53.28431], [32.40773, 53.18856], [32.15368, 53.07594], [31.82373, 53.10042], [31.787, 53.18033], [31.62496, 53.22886], [31.56316, 53.19432], [31.40523, 53.21406], [31.36403, 53.13504], [31.3915, 53.09712], [31.33519, 53.08805], [31.32283, 53.04101], [31.24147, 53.031], [31.35667, 52.97854], [31.592, 52.79011], [31.57277, 52.71613], [31.50406, 52.69707], [31.63869, 52.55361], [31.56316, 52.51518], [31.61397, 52.48843], [31.62084, 52.33849], [31.57971, 52.32146], [31.70735, 52.26711], [31.6895, 52.1973], [31.77877, 52.18636], [31.7822, 52.11406], [31.81722, 52.09955], [31.85018, 52.11305], [31.96141, 52.08015], [31.92159, 52.05144], [32.08813, 52.03319], [32.23331, 52.08085], [32.2777, 52.10266], [32.34044, 52.1434], [32.33083, 52.23685], [32.38988, 52.24946], [32.3528, 52.32842], [32.54781, 52.32423], [32.69475, 52.25535], [32.85405, 52.27888], [32.89937, 52.2461], [33.18913, 52.3754], [33.51323, 52.35779], [33.48027, 52.31499], [33.55718, 52.30324], [33.78789, 52.37204], [34.05239, 52.20132], [34.11199, 52.14087], [34.09413, 52.00835], [34.41136, 51.82793], [34.42922, 51.72852], [34.07765, 51.67065], [34.17599, 51.63253], [34.30562, 51.5205], [34.22048, 51.4187], [34.33446, 51.363], [34.23009, 51.26429], [34.31661, 51.23936], [34.38802, 51.2746], [34.6613, 51.25053], [34.6874, 51.18], [34.82472, 51.17483], [34.97304, 51.2342], [35.14058, 51.23162], [35.12685, 51.16191], [35.20375, 51.04723], [35.31774, 51.08434], [35.40837, 51.04119], [35.32598, 50.94524], [35.39307, 50.92145], [35.41367, 50.80227], [35.47704, 50.77274], [35.48116, 50.66405], [35.39464, 50.64751], [35.47463, 50.49247], [35.58003, 50.45117], [35.61711, 50.35707], [35.73659, 50.35489], [35.80388, 50.41356], [35.8926, 50.43829], [36.06893, 50.45205], [36.20763, 50.3943], [36.30101, 50.29088], [36.47817, 50.31457], [36.58371, 50.28563], [36.56655, 50.2413], [36.64571, 50.218], [36.69377, 50.26982], [36.91762, 50.34963], [37.08468, 50.34935], [37.48204, 50.46079], [37.47243, 50.36277], [37.62486, 50.29966], [37.62879, 50.24481], [37.61113, 50.21976], [37.75807, 50.07896], [37.79515, 50.08425], [37.90776, 50.04194], [38.02999, 49.94482], [38.02999, 49.90592], [38.21675, 49.98104], [38.18517, 50.08161], [38.32524, 50.08866], [38.35408, 50.00664], [38.65688, 49.97176], [38.68677, 50.00904], [38.73311, 49.90238], [38.90477, 49.86787], [38.9391, 49.79524], [39.1808, 49.88911], [39.27968, 49.75976], [39.44496, 49.76067], [39.59142, 49.73758], [39.65047, 49.61761], [39.84548, 49.56064], [40.13249, 49.61672], [40.16683, 49.56865], [40.03636, 49.52321], [40.03087, 49.45452], [40.1141, 49.38798], [40.14912, 49.37681], [40.18331, 49.34996], [40.22176, 49.25683], [40.01988, 49.1761], [39.93437, 49.05709], [39.6836, 49.05121], [39.6683, 48.99454], [39.71353, 48.98959], [39.72649, 48.9754], [39.74874, 48.98675], [39.78368, 48.91596], [39.98967, 48.86901], [40.03636, 48.91957], [40.08168, 48.87443], [39.97182, 48.79398], [39.79466, 48.83739], [39.73104, 48.7325], [39.71765, 48.68673], [39.67226, 48.59368], [39.79764, 48.58668], [39.84548, 48.57821], [39.86196, 48.46633], [39.88794, 48.44226], [39.94847, 48.35055], [39.84136, 48.33321], [39.84273, 48.30947], [39.90041, 48.3049], [39.91465, 48.26743], [39.95248, 48.29972], [39.9693, 48.29904], [39.97325, 48.31399], [39.99241, 48.31768], [40.00752, 48.22445], [39.94847, 48.22811], [39.83724, 48.06501], [39.88256, 48.04482], [39.77544, 48.04206], [39.82213, 47.96396], [39.73935, 47.82876], [38.87979, 47.87719], [38.79628, 47.81109], [38.76379, 47.69346], [38.35062, 47.61631], [38.28679, 47.53552], [38.28954, 47.39255], [38.22225, 47.30788], [38.33074, 47.30508], [38.32112, 47.2585], [38.23049, 47.2324], [38.22955, 47.12069], [38.3384, 46.98085], [38.12112, 46.86078], [37.62608, 46.82615], [35.23066, 45.79231], [35.04991, 45.76827], [36.6645, 45.4514], [36.6545, 45.3417], [36.5049, 45.3136], [36.475, 45.2411], [36.4883, 45.0488], [33.5943, 44.03313], [39.81147, 43.06294], [40.0078, 43.38551], [40.00853, 43.40578], [40.01552, 43.42025], [40.01007, 43.42411], [40.03312, 43.44262], [40.04445, 43.47776], [40.10657, 43.57344], [40.65957, 43.56212], [41.64935, 43.22331], [42.40563, 43.23226], [42.66667, 43.13917], [42.75889, 43.19651], [43.03322, 43.08883], [43.0419, 43.02413], [43.81453, 42.74297], [43.73119, 42.62043], [43.95517, 42.55396], [44.54202, 42.75699], [44.70002, 42.74679], [44.80941, 42.61277], [44.88754, 42.74934], [45.15318, 42.70598], [45.36501, 42.55268], [45.78692, 42.48358], [45.61676, 42.20768], [46.42738, 41.91323], [46.5332, 41.87389], [46.58924, 41.80547], [46.75269, 41.8623], [46.8134, 41.76252], [47.00955, 41.63583], [46.99554, 41.59743], [47.03757, 41.55434], [47.10762, 41.59044], [47.34579, 41.27884], [47.49004, 41.26366], [47.54504, 41.20275], [47.62288, 41.22969], [47.75831, 41.19455], [47.87973, 41.21798], [48.07587, 41.49957], [48.22064, 41.51472], [48.2878, 41.56221], [48.40277, 41.60441], [48.42301, 41.65444], [48.55078, 41.77917], [48.5867, 41.84306], [48.80971, 41.95365], [49.2134, 44.84989], [49.88945, 46.04554], [49.32259, 46.26944], [49.16518, 46.38542], [48.54988, 46.56267], [48.51142, 46.69268], [49.01136, 46.72716], [48.52326, 47.4102], [48.45173, 47.40818], [48.15348, 47.74545], [47.64973, 47.76559], [47.41689, 47.83687], [47.38731, 47.68176], [47.12107, 47.83687], [47.11516, 48.27188], [46.49011, 48.43019], [46.78392, 48.95352], [47.00857, 49.04921], [47.04658, 49.19834], [46.78398, 49.34026], [46.9078, 49.86707], [47.18319, 49.93721], [47.34589, 50.09308], [47.30448, 50.30894], [47.58551, 50.47867], [48.10044, 50.09242], [48.24519, 49.86099], [48.42564, 49.82283], [48.68352, 49.89546], [48.90782, 50.02281], [48.57946, 50.63278], [48.86936, 50.61589], [49.12673, 50.78639], [49.41959, 50.85927], [49.39001, 51.09396], [49.76866, 51.11067], [49.97277, 51.2405], [50.26859, 51.28677], [50.59695, 51.61859], [51.26254, 51.68466], [51.301, 51.48799], [51.77431, 51.49536], [51.8246, 51.67916], [52.36119, 51.74161], [52.54329, 51.48444], [53.46165, 51.49445], [53.69299, 51.23466], [54.12248, 51.11542], [54.46331, 50.85554], [54.41894, 50.61214], [54.55797, 50.52006], [54.71476, 50.61214], [54.56685, 51.01958], [54.72067, 51.03261], [55.67774, 50.54508], [56.11398, 50.7471], [56.17906, 50.93204], [57.17302, 51.11253], [57.44221, 50.88354], [57.74986, 50.93017], [57.75578, 51.13852], [58.3208, 51.15151], [58.87974, 50.70852], [59.48928, 50.64216], [59.51886, 50.49937], [59.81172, 50.54451], [60.01288, 50.8163], [60.17262, 50.83312], [60.31914, 50.67705], [60.81833, 50.6629], [61.4431, 50.80679], [61.56889, 51.23679], [61.6813, 51.25716], [61.55114, 51.32746], [61.50677, 51.40687], [60.95655, 51.48615], [60.92401, 51.61124], [60.5424, 51.61675], [60.36787, 51.66815], [60.50986, 51.7964], [60.09867, 51.87135], [59.99809, 51.98263], [59.91279, 52.06924], [60.17253, 52.25814], [60.17516, 52.39457], [59.25033, 52.46803], [59.22409, 52.28437], [58.79644, 52.43392], [58.94336, 53.953], [59.70487, 54.14846], [59.95217, 54.85853], [57.95234, 54.39672], [57.14829, 54.84204], [57.25137, 55.26262], [58.81825, 55.03378], [59.49035, 55.60486], [59.28419, 56.15739], [57.51527, 56.08729], [57.28024, 56.87898], [58.07604, 57.08308], [58.13789, 57.68097], [58.81412, 57.71602], [58.71104, 58.07475], [59.40376, 58.45822], [59.15636, 59.14682], [58.3853, 59.487], [59.50685, 60.91162], [59.36223, 61.3882], [59.61398, 62.44915], [59.24834, 63.01859], [59.80579, 64.13948], [59.63945, 64.78384], [60.74386, 64.95767], [61.98014, 65.72191], [66.1708, 67.61252], [64.18965, 69.94255], [76.13964, 83.37843], [36.85549, 84.09565], [32.07813, 72.01005], [31.59909, 70.16571], [30.84095, 69.80584], [30.95011, 69.54699], [30.52662, 69.54699], [30.16363, 69.65244], [29.97205, 69.41623], [29.27631, 69.2811], [29.26623, 69.13794], [29.0444, 69.0119], [28.91738, 69.04774], [28.45957, 68.91417], [28.78224, 68.86696], [28.43941, 68.53366], [28.62982, 68.19816], [29.34179, 68.06655], [29.66955, 67.79872], [30.02041, 67.67523], [29.91155, 67.51507], [28.9839, 66.94139], [29.91155, 66.13863], [30.16363, 65.66935], [29.97205, 65.70256], [29.74013, 65.64025], [29.84096, 65.56945], [29.68972, 65.31803], [29.61914, 65.23791], [29.8813, 65.22101], [29.84096, 65.1109], [29.61914, 65.05993], [29.68972, 64.80789], [30.05271, 64.79072], [30.12329, 64.64862], [30.01238, 64.57513], [30.06279, 64.35782], [30.4762, 64.25728], [30.55687, 64.09036], [30.25437, 63.83364], [29.98213, 63.75795], [30.49637, 63.46666], [31.23244, 63.22239], [31.29294, 63.09035], [31.58535, 62.91642], [31.38369, 62.66284], [31.10136, 62.43042], [29.01829, 61.17448], [28.82816, 61.1233], [28.47974, 60.93365], [27.77352, 60.52722], [27.71177, 60.3893], [27.44953, 60.22766], [26.32936, 60.00121]]]] } },
22607 { type: "Feature", properties: { wikidata: "Q1083368", nameEn: "Mainland Finland", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.12697, 69.69193], [28.36883, 69.81658], [28.32849, 69.88605], [27.97558, 69.99671], [27.95542, 70.0965], [27.57226, 70.06215], [27.05802, 69.92069], [26.64461, 69.96565], [26.40261, 69.91377], [25.96904, 69.68397], [25.69679, 69.27039], [25.75729, 68.99383], [25.61613, 68.89602], [25.42455, 68.90328], [25.12206, 68.78684], [25.10189, 68.63307], [24.93048, 68.61102], [24.90023, 68.55579], [24.74898, 68.65143], [24.18432, 68.73936], [24.02299, 68.81601], [23.781, 68.84514], [23.68017, 68.70276], [23.13064, 68.64684], [22.53321, 68.74393], [22.38367, 68.71561], [22.27276, 68.89514], [21.63833, 69.27485], [21.27827, 69.31281], [21.00732, 69.22755], [20.98641, 69.18809], [21.11099, 69.10291], [21.05775, 69.0356], [20.72171, 69.11874], [20.55258, 69.06069], [20.78802, 69.03087], [20.91658, 68.96764], [20.85104, 68.93142], [20.90649, 68.89696], [21.03001, 68.88969], [22.00429, 68.50692], [22.73028, 68.40881], [23.10336, 68.26551], [23.15377, 68.14759], [23.26469, 68.15134], [23.40081, 68.05545], [23.65793, 67.9497], [23.45627, 67.85297], [23.54701, 67.59306], [23.39577, 67.46974], [23.75372, 67.43688], [23.75372, 67.29914], [23.54701, 67.25435], [23.58735, 67.20752], [23.56214, 67.17038], [23.98563, 66.84149], [23.98059, 66.79585], [23.89488, 66.772], [23.85959, 66.56434], [23.63776, 66.43568], [23.67591, 66.3862], [23.64982, 66.30603], [23.71339, 66.21299], [23.90497, 66.15802], [24.15791, 65.85385], [24.14798, 65.83466], [24.15107, 65.81427], [24.14112, 65.39731], [20.15877, 63.06556], [19.23413, 60.61414], [20.96741, 60.71528], [21.15143, 60.54555], [21.08159, 60.20167], [21.02509, 60.12142], [21.35468, 59.67511], [20.5104, 59.15546], [26.32936, 60.00121], [27.44953, 60.22766], [27.71177, 60.3893], [27.77352, 60.52722], [28.47974, 60.93365], [28.82816, 61.1233], [29.01829, 61.17448], [31.10136, 62.43042], [31.38369, 62.66284], [31.58535, 62.91642], [31.29294, 63.09035], [31.23244, 63.22239], [30.49637, 63.46666], [29.98213, 63.75795], [30.25437, 63.83364], [30.55687, 64.09036], [30.4762, 64.25728], [30.06279, 64.35782], [30.01238, 64.57513], [30.12329, 64.64862], [30.05271, 64.79072], [29.68972, 64.80789], [29.61914, 65.05993], [29.84096, 65.1109], [29.8813, 65.22101], [29.61914, 65.23791], [29.68972, 65.31803], [29.84096, 65.56945], [29.74013, 65.64025], [29.97205, 65.70256], [30.16363, 65.66935], [29.91155, 66.13863], [28.9839, 66.94139], [29.91155, 67.51507], [30.02041, 67.67523], [29.66955, 67.79872], [29.34179, 68.06655], [28.62982, 68.19816], [28.43941, 68.53366], [28.78224, 68.86696], [28.45957, 68.91417], [28.91738, 69.04774], [28.81248, 69.11997], [28.8629, 69.22395], [29.31664, 69.47994], [29.12697, 69.69193]]]] } },
22608 { type: "Feature", properties: { wikidata: "Q1184963", nameEn: "Alhucemas Islands", country: "ES", groups: ["EU", "Q191011", "015", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.90602, 35.21494], [-3.88372, 35.20767], [-3.89343, 35.22728], [-3.90602, 35.21494]]]] } },
22609 { type: "Feature", properties: { wikidata: "Q1298289", nameEn: "Egmont Islands", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [70.67958, -8.2663], [72.17991, -6.68509], [70.1848, -6.37445]]]] } },
22610 { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
22611 { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
22612 { type: "Feature", properties: { wikidata: "Q1544253", nameEn: "Great Chagos Bank", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[70.1848, -6.37445], [72.17991, -6.68509], [73.20573, -5.20727], [70.1848, -6.37445]]]] } },
22613 { type: "Feature", properties: { wikidata: "Q1585511", nameEn: "Salomon Atoll", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[72.09518, -5.61768], [73.20573, -5.20727], [72.12587, -4.02588], [72.09518, -5.61768]]]] } },
22614 { type: "Feature", properties: { wikidata: "Q1681727", nameEn: "Saint-Paul and Amsterdam", country: "FR", groups: ["EU", "TF", "Q1451600", "014", "202", "002", "UN"], level: "subterritory" }, geometry: { type: "MultiPolygon", coordinates: [[[[76.31747, -42.16264], [80.15867, -36.04977], [71.22311, -38.75287], [76.31747, -42.16264]]]] } },
22615 { type: "Feature", properties: { wikidata: "Q1901211", nameEn: "East Malaysia", country: "MY", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[110.90339, 7.52694], [109.82788, 2.86812], [109.62558, 1.99182], [109.53794, 1.91771], [109.57923, 1.80624], [109.66397, 1.79972], [109.66397, 1.60425], [110.35354, 0.98869], [110.49182, 0.88088], [110.62374, 0.873], [111.22979, 1.08326], [111.55434, 0.97864], [111.82846, 0.99349], [111.94553, 1.12016], [112.15679, 1.17004], [112.2127, 1.44135], [112.48648, 1.56516], [113.021, 1.57819], [113.01448, 1.42832], [113.64677, 1.23933], [114.03788, 1.44787], [114.57892, 1.5], [114.80706, 1.92351], [114.80706, 2.21665], [115.1721, 2.49671], [115.11343, 2.82879], [115.53713, 3.14776], [115.58276, 3.93499], [115.90217, 4.37708], [117.25801, 4.35108], [117.47313, 4.18857], [117.67641, 4.16535], [118.06469, 4.16638], [118.93936, 4.09009], [119.52945, 5.35672], [117.98544, 6.27477], [117.93857, 6.89845], [117.17735, 7.52841], [116.79524, 7.43869], [115.02521, 5.35005], [115.16236, 5.01011], [115.15092, 4.87604], [115.20737, 4.8256], [115.27819, 4.63661], [115.2851, 4.42295], [115.36346, 4.33563], [115.31275, 4.30806], [115.09978, 4.39123], [115.07737, 4.53418], [115.04064, 4.63706], [115.02278, 4.74137], [115.02955, 4.82087], [115.05038, 4.90275], [114.99417, 4.88201], [114.96982, 4.81146], [114.88841, 4.81905], [114.8266, 4.75062], [114.77303, 4.72871], [114.83189, 4.42387], [114.88039, 4.4257], [114.78539, 4.12205], [114.64211, 4.00694], [114.49922, 4.13108], [114.4416, 4.27588], [114.32176, 4.2552], [114.32176, 4.34942], [114.26876, 4.49878], [114.15813, 4.57], [114.07448, 4.58441], [114.10166, 4.76112], [110.90339, 7.52694]]]] } },
22616 { type: "Feature", properties: { wikidata: "Q1973345", nameEn: "Peninsular Malaysia", country: "MY", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["60"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.46318, 7.22462], [102.09086, 6.23546], [102.08127, 6.22679], [102.07732, 6.193], [102.09182, 6.14161], [102.01835, 6.05407], [101.99209, 6.04075], [101.97114, 6.01992], [101.9714, 6.00575], [101.94712, 5.98421], [101.92819, 5.85511], [101.91776, 5.84269], [101.89188, 5.8386], [101.80144, 5.74505], [101.75074, 5.79091], [101.69773, 5.75881], [101.58019, 5.93534], [101.25524, 5.78633], [101.25755, 5.71065], [101.14062, 5.61613], [100.98815, 5.79464], [101.02708, 5.91013], [101.087, 5.9193], [101.12388, 6.11411], [101.06165, 6.14161], [101.12618, 6.19431], [101.10313, 6.25617], [100.85884, 6.24929], [100.81045, 6.45086], [100.74822, 6.46231], [100.74361, 6.50811], [100.66986, 6.45086], [100.43027, 6.52389], [100.42351, 6.51762], [100.41791, 6.5189], [100.41152, 6.52299], [100.35413, 6.54932], [100.31929, 6.65413], [100.32607, 6.65933], [100.32671, 6.66526], [100.31884, 6.66423], [100.31618, 6.66781], [100.30828, 6.66462], [100.29651, 6.68439], [100.19511, 6.72559], [100.12, 6.42105], [100.0756, 6.4045], [99.91873, 6.50233], [99.50117, 6.44501], [99.31854, 5.99868], [99.75778, 3.86466], [103.03657, 1.30383], [103.56591, 1.19719], [103.62738, 1.35255], [103.67468, 1.43166], [103.7219, 1.46108], [103.74161, 1.4502], [103.76395, 1.45183], [103.81181, 1.47953], [103.86383, 1.46288], [103.89565, 1.42841], [103.93384, 1.42926], [104.00131, 1.42405], [104.02277, 1.4438], [104.04622, 1.44691], [104.07348, 1.43322], [104.08871, 1.42015], [104.09162, 1.39694], [104.08072, 1.35998], [104.12282, 1.27714], [104.34728, 1.33529], [104.56723, 1.44271], [105.01437, 3.24936], [102.46318, 7.22462]]]] } },
22617 { type: "Feature", properties: { wikidata: "Q2093907", nameEn: "Three Kings Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[174.17679, -32.62487], [170.93268, -32.97889], [171.97383, -34.64644], [174.17679, -32.62487]]]] } },
22618 { type: "Feature", properties: { wikidata: "Q2298216", nameEn: "Solander Islands", country: "NZ", groups: ["Q851132", "053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[167.39068, -46.49187], [166.5534, -46.39484], [166.84561, -46.84889], [167.39068, -46.49187]]]] } },
22619 { type: "Feature", properties: { wikidata: "Q2872203", nameEn: "Mainland Australia", country: "AU", groups: ["053", "009", "UN"], level: "subcountryGroup", driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.16419, -23.49578], [123.64533, -39.13605], [159.74028, -39.1978], [159.76765, -29.76946], [154.02855, -24.43238], [152.93188, -20.92631], [147.69992, -17.5933], [145.2855, -9.62524], [143.87386, -9.02382], [143.29772, -9.33993], [142.48658, -9.36754], [142.19246, -9.15378], [141.88934, -9.36111], [141.01842, -9.35091], [135.49042, -9.2276], [127.55165, -9.05052], [125.29076, -12.33139], [88.16419, -23.49578]]]] } },
22620 { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
22621 { type: "Feature", properties: { wikidata: "Q2915956", nameEn: "Mainland Portugal", country: "PT", groups: ["Q12837", "EU", "039", "150", "UN"], level: "subcountryGroup", callingCodes: ["351"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.39881, 36.12218], [-7.37282, 36.96896], [-7.39769, 37.16868], [-7.41133, 37.20314], [-7.41854, 37.23813], [-7.43227, 37.25152], [-7.43974, 37.38913], [-7.46878, 37.47127], [-7.51759, 37.56119], [-7.41981, 37.75729], [-7.33441, 37.81193], [-7.27314, 37.90145], [-7.24544, 37.98884], [-7.12648, 38.00296], [-7.10366, 38.04404], [-7.05966, 38.01966], [-7.00375, 38.01914], [-6.93418, 38.21454], [-7.09389, 38.17227], [-7.15581, 38.27597], [-7.32529, 38.44336], [-7.265, 38.61674], [-7.26174, 38.72107], [-7.03848, 38.87221], [-7.051, 38.907], [-6.95211, 39.0243], [-6.97004, 39.07619], [-7.04011, 39.11919], [-7.10692, 39.10275], [-7.14929, 39.11287], [-7.12811, 39.17101], [-7.23566, 39.20132], [-7.23403, 39.27579], [-7.3149, 39.34857], [-7.2927, 39.45847], [-7.49477, 39.58794], [-7.54121, 39.66717], [-7.33507, 39.64569], [-7.24707, 39.66576], [-7.01613, 39.66877], [-6.97492, 39.81488], [-6.91463, 39.86618], [-6.86737, 40.01986], [-6.94233, 40.10716], [-7.00589, 40.12087], [-7.02544, 40.18564], [-7.00426, 40.23169], [-6.86085, 40.26776], [-6.86085, 40.2976], [-6.80218, 40.33239], [-6.78426, 40.36468], [-6.84618, 40.42177], [-6.84944, 40.46394], [-6.7973, 40.51723], [-6.80218, 40.55067], [-6.84292, 40.56801], [-6.79567, 40.65955], [-6.82826, 40.74603], [-6.82337, 40.84472], [-6.79892, 40.84842], [-6.80707, 40.88047], [-6.84292, 40.89771], [-6.8527, 40.93958], [-6.9357, 41.02888], [-6.913, 41.03922], [-6.88843, 41.03027], [-6.84781, 41.02692], [-6.80942, 41.03629], [-6.79241, 41.05397], [-6.75655, 41.10187], [-6.77319, 41.13049], [-6.69711, 41.1858], [-6.68286, 41.21641], [-6.65046, 41.24725], [-6.55937, 41.24417], [-6.38551, 41.35274], [-6.38553, 41.38655], [-6.3306, 41.37677], [-6.26777, 41.48796], [-6.19128, 41.57638], [-6.29863, 41.66432], [-6.44204, 41.68258], [-6.49907, 41.65823], [-6.54633, 41.68623], [-6.56426, 41.74219], [-6.51374, 41.8758], [-6.56752, 41.88429], [-6.5447, 41.94371], [-6.58544, 41.96674], [-6.61967, 41.94008], [-6.75004, 41.94129], [-6.76959, 41.98734], [-6.81196, 41.99097], [-6.82174, 41.94493], [-6.94396, 41.94403], [-6.95537, 41.96553], [-6.98144, 41.9728], [-7.01078, 41.94977], [-7.07596, 41.94977], [-7.08574, 41.97401], [-7.14115, 41.98855], [-7.18549, 41.97515], [-7.18677, 41.88793], [-7.32366, 41.8406], [-7.37092, 41.85031], [-7.42864, 41.80589], [-7.42854, 41.83262], [-7.44759, 41.84451], [-7.45566, 41.86488], [-7.49803, 41.87095], [-7.52737, 41.83939], [-7.62188, 41.83089], [-7.58603, 41.87944], [-7.65774, 41.88308], [-7.69848, 41.90977], [-7.84188, 41.88065], [-7.88055, 41.84571], [-7.88751, 41.92553], [-7.90707, 41.92432], [-7.92336, 41.8758], [-7.9804, 41.87337], [-8.01136, 41.83453], [-8.0961, 41.81024], [-8.16455, 41.81753], [-8.16944, 41.87944], [-8.19551, 41.87459], [-8.2185, 41.91237], [-8.16232, 41.9828], [-8.08796, 42.01398], [-8.08847, 42.05767], [-8.11729, 42.08537], [-8.18178, 42.06436], [-8.19406, 42.12141], [-8.18947, 42.13853], [-8.1986, 42.15402], [-8.22406, 42.1328], [-8.24681, 42.13993], [-8.2732, 42.12396], [-8.29809, 42.106], [-8.32161, 42.10218], [-8.33912, 42.08358], [-8.36353, 42.09065], [-8.38323, 42.07683], [-8.40143, 42.08052], [-8.42512, 42.07199], [-8.44123, 42.08218], [-8.48185, 42.0811], [-8.52837, 42.07658], [-8.5252, 42.06264], [-8.54563, 42.0537], [-8.58086, 42.05147], [-8.59493, 42.05708], [-8.63791, 42.04691], [-8.64626, 42.03668], [-8.65832, 42.02972], [-8.6681, 41.99703], [-8.69071, 41.98862], [-8.7478, 41.96282], [-8.74606, 41.9469], [-8.75712, 41.92833], [-8.81794, 41.90375], [-8.87157, 41.86488], [-11.19304, 41.83075], [-10.39881, 36.12218]]]] } },
22622 { type: "Feature", properties: { wikidata: "Q3311985", nameEn: "Guernsey", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.49556, 49.79012], [-3.28154, 49.57329], [-2.65349, 49.15373], [-2.36485, 49.48223], [-2.49556, 49.79012]]]] } },
22623 { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
22624 { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
22625 { type: "Feature", properties: { wikidata: "Q6736667", nameEn: "Mainland India", country: "IN", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["91"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.08044, 21.41871], [89.07114, 22.15335], [88.9367, 22.58527], [88.94614, 22.66941], [88.9151, 22.75228], [88.96713, 22.83346], [88.87063, 22.95235], [88.88327, 23.03885], [88.86377, 23.08759], [88.99148, 23.21134], [88.71133, 23.2492], [88.79254, 23.46028], [88.79351, 23.50535], [88.74841, 23.47361], [88.56507, 23.64044], [88.58087, 23.87105], [88.66189, 23.87607], [88.73743, 23.91751], [88.6976, 24.14703], [88.74841, 24.1959], [88.68801, 24.31464], [88.50934, 24.32474], [88.12296, 24.51301], [88.08786, 24.63232], [88.00683, 24.66477], [88.15515, 24.85806], [88.14004, 24.93529], [88.21832, 24.96642], [88.27325, 24.88796], [88.33917, 24.86803], [88.46277, 25.07468], [88.44766, 25.20149], [88.94067, 25.18534], [89.00463, 25.26583], [89.01105, 25.30303], [88.85278, 25.34679], [88.81296, 25.51546], [88.677, 25.46959], [88.4559, 25.59227], [88.45103, 25.66245], [88.242, 25.80811], [88.13138, 25.78773], [88.08804, 25.91334], [88.16581, 26.0238], [88.1844, 26.14417], [88.34757, 26.22216], [88.35153, 26.29123], [88.51649, 26.35923], [88.48749, 26.45855], [88.36938, 26.48683], [88.35153, 26.45241], [88.33093, 26.48929], [88.41196, 26.63837], [88.4298, 26.54489], [88.62144, 26.46783], [88.69485, 26.38353], [88.67837, 26.26291], [88.78961, 26.31093], [88.85004, 26.23211], [89.05328, 26.2469], [88.91321, 26.37984], [88.92357, 26.40711], [88.95612, 26.4564], [89.08899, 26.38845], [89.15869, 26.13708], [89.35953, 26.0077], [89.53515, 26.00382], [89.57101, 25.9682], [89.63968, 26.22595], [89.70201, 26.15138], [89.73581, 26.15818], [89.77865, 26.08387], [89.77728, 26.04254], [89.86592, 25.93115], [89.80585, 25.82489], [89.84388, 25.70042], [89.86129, 25.61714], [89.81208, 25.37244], [89.84086, 25.31854], [89.83371, 25.29548], [89.87629, 25.28337], [89.90478, 25.31038], [90.1155, 25.22686], [90.40034, 25.1534], [90.65042, 25.17788], [90.87427, 25.15799], [91.25517, 25.20677], [91.63648, 25.12846], [92.0316, 25.1834], [92.33957, 25.07593], [92.39147, 25.01471], [92.49887, 24.88796], [92.38626, 24.86055], [92.25854, 24.9191], [92.15796, 24.54435], [92.11662, 24.38997], [91.96603, 24.3799], [91.89258, 24.14674], [91.82596, 24.22345], [91.76004, 24.23848], [91.73257, 24.14703], [91.65292, 24.22095], [91.63782, 24.1132], [91.55542, 24.08687], [91.37414, 24.10693], [91.35741, 23.99072], [91.29587, 24.0041], [91.22308, 23.89616], [91.25192, 23.83463], [91.15579, 23.6599], [91.28293, 23.37538], [91.36453, 23.06612], [91.40848, 23.07117], [91.4035, 23.27522], [91.46615, 23.2328], [91.54993, 23.01051], [91.61571, 22.93929], [91.7324, 23.00043], [91.81634, 23.08001], [91.76417, 23.26619], [91.84789, 23.42235], [91.95642, 23.47361], [91.95093, 23.73284], [92.04706, 23.64229], [92.15417, 23.73409], [92.26541, 23.70392], [92.38214, 23.28705], [92.37665, 22.9435], [92.5181, 22.71441], [92.60029, 22.1522], [92.56616, 22.13554], [92.60949, 21.97638], [92.67532, 22.03547], [92.70416, 22.16017], [92.86208, 22.05456], [92.89504, 21.95143], [92.93899, 22.02656], [92.99804, 21.98964], [92.99255, 22.05965], [93.04885, 22.20595], [93.15734, 22.18687], [93.14224, 22.24535], [93.19991, 22.25425], [93.18206, 22.43716], [93.13537, 22.45873], [93.11477, 22.54374], [93.134, 22.59573], [93.09417, 22.69459], [93.134, 22.92498], [93.12988, 23.05772], [93.2878, 23.00464], [93.38478, 23.13698], [93.36862, 23.35426], [93.38781, 23.36139], [93.39981, 23.38828], [93.38805, 23.4728], [93.43475, 23.68299], [93.3908, 23.7622], [93.3908, 23.92925], [93.36059, 23.93176], [93.32351, 24.04468], [93.34735, 24.10151], [93.41415, 24.07854], [93.46633, 23.97067], [93.50616, 23.94432], [93.62871, 24.00922], [93.75952, 24.0003], [93.80279, 23.92549], [93.92089, 23.95812], [94.14081, 23.83333], [94.30215, 24.23752], [94.32362, 24.27692], [94.45279, 24.56656], [94.50729, 24.59281], [94.5526, 24.70764], [94.60204, 24.70889], [94.73937, 25.00545], [94.74212, 25.13606], [94.57458, 25.20318], [94.68032, 25.47003], [94.80117, 25.49359], [95.18556, 26.07338], [95.11428, 26.1019], [95.12801, 26.38397], [95.05798, 26.45408], [95.23513, 26.68499], [95.30339, 26.65372], [95.437, 26.7083], [95.81603, 27.01335], [95.93002, 27.04149], [96.04949, 27.19428], [96.15591, 27.24572], [96.40779, 27.29818], [96.55761, 27.29928], [96.73888, 27.36638], [96.88445, 27.25046], [96.85287, 27.2065], [96.89132, 27.17474], [97.14675, 27.09041], [97.17422, 27.14052], [96.91431, 27.45752], [96.90112, 27.62149], [97.29919, 27.92233], [97.35824, 27.87256], [97.38845, 28.01329], [97.35412, 28.06663], [97.31292, 28.06784], [97.34547, 28.21385], [97.1289, 28.3619], [96.98882, 28.32564], [96.88445, 28.39452], [96.85561, 28.4875], [96.6455, 28.61657], [96.48895, 28.42955], [96.40929, 28.51526], [96.61391, 28.72742], [96.3626, 29.10607], [96.20467, 29.02325], [96.18682, 29.11087], [96.31316, 29.18643], [96.05361, 29.38167], [95.84899, 29.31464], [95.75149, 29.32063], [95.72086, 29.20797], [95.50842, 29.13487], [95.41091, 29.13007], [95.3038, 29.13847], [95.26122, 29.07727], [95.2214, 29.10727], [95.11291, 29.09527], [95.0978, 29.14446], [94.81353, 29.17804], [94.69318, 29.31739], [94.2752, 29.11687], [94.35897, 29.01965], [93.72797, 28.68821], [93.44621, 28.67189], [93.18069, 28.50319], [93.14635, 28.37035], [92.93075, 28.25671], [92.67486, 28.15018], [92.65472, 28.07632], [92.73025, 28.05814], [92.7275, 27.98662], [92.42538, 27.80092], [92.32101, 27.79363], [92.27432, 27.89077], [91.87057, 27.7195], [91.84722, 27.76325], [91.6469, 27.76358], [91.55819, 27.6144], [91.65007, 27.48287], [92.01132, 27.47352], [92.12019, 27.27829], [92.04702, 27.26861], [92.03457, 27.07334], [92.11863, 26.893], [92.05523, 26.8692], [91.83181, 26.87318], [91.50067, 26.79223], [90.67715, 26.77215], [90.48504, 26.8594], [90.39271, 26.90704], [90.30402, 26.85098], [90.04535, 26.72422], [89.86124, 26.73307], [89.63369, 26.74402], [89.42349, 26.83727], [89.3901, 26.84225], [89.38319, 26.85963], [89.37913, 26.86224], [89.1926, 26.81329], [89.12825, 26.81661], [89.09554, 26.89089], [88.95807, 26.92668], [88.92301, 26.99286], [88.8714, 26.97488], [88.86984, 27.10937], [88.74219, 27.144], [88.91901, 27.32483], [88.82981, 27.38814], [88.77517, 27.45415], [88.88091, 27.85192], [88.83559, 28.01936], [88.63235, 28.12356], [88.54858, 28.06057], [88.25332, 27.9478], [88.1278, 27.95417], [88.13378, 27.88015], [88.1973, 27.85067], [88.19107, 27.79285], [88.04008, 27.49223], [88.07277, 27.43007], [88.01646, 27.21612], [88.01587, 27.21388], [87.9887, 27.11045], [88.11719, 26.98758], [88.13422, 26.98705], [88.12302, 26.95324], [88.19107, 26.75516], [88.1659, 26.68177], [88.16452, 26.64111], [88.09963, 26.54195], [88.09414, 26.43732], [88.00895, 26.36029], [87.90115, 26.44923], [87.89085, 26.48565], [87.84193, 26.43663], [87.7918, 26.46737], [87.76004, 26.40711], [87.67893, 26.43501], [87.66803, 26.40294], [87.59175, 26.38342], [87.55274, 26.40596], [87.51571, 26.43106], [87.46566, 26.44058], [87.37314, 26.40815], [87.34568, 26.34787], [87.26568, 26.37294], [87.26587, 26.40592], [87.24682, 26.4143], [87.18863, 26.40558], [87.14751, 26.40542], [87.09147, 26.45039], [87.0707, 26.58571], [87.04691, 26.58685], [87.01559, 26.53228], [86.95912, 26.52076], [86.94543, 26.52076], [86.82898, 26.43919], [86.76797, 26.45892], [86.74025, 26.42386], [86.69124, 26.45169], [86.62686, 26.46891], [86.61313, 26.48658], [86.57073, 26.49825], [86.54258, 26.53819], [86.49726, 26.54218], [86.31564, 26.61925], [86.26235, 26.61886], [86.22513, 26.58863], [86.13596, 26.60651], [86.02729, 26.66756], [85.8492, 26.56667], [85.85126, 26.60866], [85.83126, 26.61134], [85.76907, 26.63076], [85.72315, 26.67471], [85.73483, 26.79613], [85.66239, 26.84822], [85.61621, 26.86721], [85.59461, 26.85161], [85.5757, 26.85955], [85.56471, 26.84133], [85.47752, 26.79292], [85.34302, 26.74954], [85.21159, 26.75933], [85.18046, 26.80519], [85.19291, 26.86909], [85.15883, 26.86966], [85.02635, 26.85381], [85.05592, 26.88991], [85.00536, 26.89523], [84.97186, 26.9149], [84.96687, 26.95599], [84.85754, 26.98984], [84.82913, 27.01989], [84.793, 26.9968], [84.64496, 27.04669], [84.69166, 27.21294], [84.62161, 27.33885], [84.29315, 27.39], [84.25735, 27.44941], [84.21376, 27.45218], [84.10791, 27.52399], [84.02229, 27.43836], [83.93306, 27.44939], [83.86182, 27.4241], [83.85595, 27.35797], [83.61288, 27.47013], [83.39495, 27.4798], [83.38872, 27.39276], [83.35136, 27.33885], [83.29999, 27.32778], [83.2673, 27.36235], [83.27197, 27.38309], [83.19413, 27.45632], [82.94938, 27.46036], [82.93261, 27.50328], [82.74119, 27.49838], [82.70378, 27.72122], [82.46405, 27.6716], [82.06554, 27.92222], [81.97214, 27.93322], [81.91223, 27.84995], [81.47867, 28.08303], [81.48179, 28.12148], [81.38683, 28.17638], [81.32923, 28.13521], [81.19847, 28.36284], [81.03471, 28.40054], [80.55142, 28.69182], [80.50575, 28.6706], [80.52443, 28.54897], [80.44504, 28.63098], [80.37188, 28.63371], [80.12125, 28.82346], [80.06957, 28.82763], [80.05743, 28.91479], [80.18085, 29.13649], [80.23178, 29.11626], [80.26602, 29.13938], [80.24112, 29.21414], [80.28626, 29.20327], [80.31428, 29.30784], [80.24322, 29.44299], [80.37939, 29.57098], [80.41858, 29.63581], [80.38428, 29.68513], [80.36803, 29.73865], [80.41554, 29.79451], [80.43458, 29.80466], [80.48997, 29.79566], [80.56247, 29.86661], [80.57179, 29.91422], [80.60226, 29.95732], [80.67076, 29.95732], [80.8778, 30.13384], [80.86673, 30.17321], [80.91143, 30.22173], [80.92547, 30.17193], [81.03953, 30.20059], [80.83343, 30.32023], [80.54504, 30.44936], [80.20721, 30.58541], [79.93255, 30.88288], [79.59884, 30.93943], [79.30694, 31.17357], [79.14016, 31.43403], [79.01931, 31.42817], [78.89344, 31.30481], [78.77898, 31.31209], [78.71032, 31.50197], [78.84516, 31.60631], [78.69933, 31.78723], [78.78036, 31.99478], [78.74404, 32.00384], [78.68754, 32.10256], [78.49609, 32.2762], [78.4645, 32.45367], [78.38897, 32.53938], [78.73916, 32.69438], [78.7831, 32.46873], [78.96713, 32.33655], [78.99322, 32.37948], [79.0979, 32.38051], [79.13174, 32.47766], [79.26768, 32.53277], [79.46562, 32.69668], [79.14016, 33.02545], [79.15252, 33.17156], [78.73636, 33.56521], [78.67599, 33.66445], [78.77349, 33.73871], [78.73367, 34.01121], [78.65657, 34.03195], [78.66225, 34.08858], [78.91769, 34.15452], [78.99802, 34.3027], [79.05364, 34.32482], [78.74465, 34.45174], [78.56475, 34.50835], [78.54964, 34.57283], [78.27781, 34.61484], [78.18435, 34.7998], [78.22692, 34.88771], [78.00033, 35.23954], [78.03466, 35.3785], [78.11664, 35.48022], [77.80532, 35.52058], [77.70232, 35.46244], [77.44277, 35.46132], [76.96624, 35.5932], [76.84539, 35.67356], [76.77323, 35.66062], [76.75475, 35.52617], [76.85088, 35.39754], [76.93465, 35.39866], [77.11796, 35.05419], [76.99251, 34.93349], [76.87193, 34.96906], [76.74514, 34.92488], [76.74377, 34.84039], [76.67648, 34.76371], [76.47186, 34.78965], [76.15463, 34.6429], [76.04614, 34.67566], [75.75438, 34.51827], [75.38009, 34.55021], [75.01479, 34.64629], [74.6663, 34.703], [74.58083, 34.77386], [74.31239, 34.79626], [74.12897, 34.70073], [73.96423, 34.68244], [73.93401, 34.63386], [73.93951, 34.57169], [73.89419, 34.54568], [73.88732, 34.48911], [73.74999, 34.3781], [73.74862, 34.34183], [73.8475, 34.32935], [73.90517, 34.35317], [73.98208, 34.2522], [73.90677, 34.10504], [73.88732, 34.05105], [73.91341, 34.01235], [74.21554, 34.03853], [74.25262, 34.01577], [74.26086, 33.92237], [74.14001, 33.83002], [74.05898, 33.82089], [74.00891, 33.75437], [73.96423, 33.73071], [73.98968, 33.66155], [73.97367, 33.64061], [74.03576, 33.56718], [74.10115, 33.56392], [74.18121, 33.4745], [74.17983, 33.3679], [74.08782, 33.26232], [74.01366, 33.25199], [74.02144, 33.18908], [74.15374, 33.13477], [74.17571, 33.07495], [74.31854, 33.02891], [74.34875, 32.97823], [74.31227, 32.92795], [74.41467, 32.90563], [74.45312, 32.77755], [74.6289, 32.75561], [74.64675, 32.82604], [74.7113, 32.84219], [74.65345, 32.71225], [74.69542, 32.66792], [74.64424, 32.60985], [74.65251, 32.56416], [74.67431, 32.56676], [74.68362, 32.49298], [74.84725, 32.49075], [74.97634, 32.45367], [75.03265, 32.49538], [75.28259, 32.36556], [75.38046, 32.26836], [75.25649, 32.10187], [75.00793, 32.03786], [74.9269, 32.0658], [74.86236, 32.04485], [74.79919, 31.95983], [74.58907, 31.87824], [74.47771, 31.72227], [74.57498, 31.60382], [74.61517, 31.55698], [74.59319, 31.50197], [74.64713, 31.45605], [74.59773, 31.4136], [74.53223, 31.30321], [74.51629, 31.13829], [74.56023, 31.08303], [74.60281, 31.10419], [74.60006, 31.13711], [74.6852, 31.12771], [74.67971, 31.05479], [74.5616, 31.04153], [73.88993, 30.36305], [73.95736, 30.28466], [73.97225, 30.19829], [73.80299, 30.06969], [73.58665, 30.01848], [73.3962, 29.94707], [73.28094, 29.56646], [73.05886, 29.1878], [73.01337, 29.16422], [72.94272, 29.02487], [72.40402, 28.78283], [72.29495, 28.66367], [72.20329, 28.3869], [71.9244, 28.11555], [71.89921, 27.96035], [70.79054, 27.68423], [70.60927, 28.02178], [70.37307, 28.01208], [70.12502, 27.8057], [70.03136, 27.56627], [69.58519, 27.18109], [69.50904, 26.74892], [69.88555, 26.56836], [70.05584, 26.60398], [70.17532, 26.55362], [70.17532, 26.24118], [70.08193, 26.08094], [70.0985, 25.93238], [70.2687, 25.71156], [70.37444, 25.67443], [70.53649, 25.68928], [70.60378, 25.71898], [70.67382, 25.68186], [70.66695, 25.39314], [70.89148, 25.15064], [70.94002, 24.92843], [71.09405, 24.69017], [70.97594, 24.60904], [71.00341, 24.46038], [71.12838, 24.42662], [71.04461, 24.34657], [70.94985, 24.3791], [70.85784, 24.30903], [70.88393, 24.27398], [70.71502, 24.23517], [70.57906, 24.27774], [70.5667, 24.43787], [70.11712, 24.30915], [70.03428, 24.172], [69.73335, 24.17007], [69.59579, 24.29777], [69.29778, 24.28712], [69.19341, 24.25646], [69.07806, 24.29777], [68.97781, 24.26021], [68.90914, 24.33156], [68.7416, 24.31904], [68.74643, 23.97027], [68.39339, 23.96838], [68.20763, 23.85849], [68.11329, 23.53945], [76.59015, 5.591], [79.50447, 8.91876], [79.42124, 9.80115], [80.48418, 10.20786], [89.08044, 21.41871]]]] } },
22626 { type: "Feature", properties: { wikidata: "Q9143535", nameEn: "Akrotiri", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.86014, 34.70585], [32.82717, 34.70622], [32.79433, 34.67883], [32.76136, 34.68318], [32.75515, 34.64985], [32.74412, 34.43926], [33.26744, 34.49942], [33.0138, 34.64424], [32.96968, 34.64046], [32.96718, 34.63446], [32.95891, 34.62919], [32.95323, 34.64075], [32.95471, 34.64528], [32.94976, 34.65204], [32.94796, 34.6587], [32.95325, 34.66462], [32.97079, 34.66112], [32.97736, 34.65277], [32.99014, 34.65518], [32.98668, 34.67268], [32.99135, 34.68061], [32.95539, 34.68471], [32.94683, 34.67907], [32.94379, 34.67111], [32.93693, 34.67027], [32.93449, 34.66241], [32.92807, 34.66736], [32.93043, 34.67091], [32.91398, 34.67343], [32.9068, 34.66102], [32.86167, 34.68734], [32.86014, 34.70585]]]] } },
22627 { type: "Feature", properties: { wikidata: "Q9206745", nameEn: "Dhekelia", country: "GB", groups: ["Q644636", "Q37362", "BOTS", "145", "142", "UN"], level: "subterritory", driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.70575, 34.97947], [33.83531, 34.73974], [33.98684, 34.76642], [33.90075, 34.96623], [33.86432, 34.97592], [33.84811, 34.97075], [33.83505, 34.98108], [33.85621, 34.98956], [33.85891, 35.001], [33.85216, 35.00579], [33.84045, 35.00616], [33.82875, 35.01685], [33.83055, 35.02865], [33.81524, 35.04192], [33.8012, 35.04786], [33.82051, 35.0667], [33.8355, 35.05777], [33.85261, 35.0574], [33.88367, 35.07877], [33.89485, 35.06873], [33.90247, 35.07686], [33.91299, 35.07579], [33.91789, 35.08688], [33.89853, 35.11377], [33.88737, 35.11408], [33.88943, 35.12007], [33.88561, 35.12449], [33.87224, 35.12293], [33.87622, 35.10457], [33.87097, 35.09389], [33.87479, 35.08881], [33.8541, 35.07201], [33.84168, 35.06823], [33.82067, 35.07826], [33.78581, 35.05104], [33.76106, 35.04253], [33.73824, 35.05321], [33.71482, 35.03722], [33.70209, 35.04882], [33.7161, 35.07279], [33.70861, 35.07644], [33.69095, 35.06237], [33.68474, 35.06602], [33.67742, 35.05963], [33.67678, 35.03866], [33.69938, 35.03123], [33.69731, 35.01754], [33.71514, 35.00294], [33.70639, 34.99303], [33.70575, 34.97947]], [[33.77312, 34.9976], [33.77553, 34.99518], [33.78516, 34.99582], [33.79191, 34.98914], [33.78917, 34.98854], [33.78571, 34.98951], [33.78318, 34.98699], [33.78149, 34.98854], [33.77843, 34.988], [33.7778, 34.98981], [33.76738, 34.99188], [33.76605, 34.99543], [33.75682, 34.99916], [33.75994, 35.00113], [33.77312, 34.9976]], [[33.74144, 35.01053], [33.7343, 35.01178], [33.73781, 35.02181], [33.74265, 35.02329], [33.74983, 35.02274], [33.7492, 35.01319], [33.74144, 35.01053]]]] } },
22628 { type: "Feature", properties: { wikidata: "Q16390686", nameEn: "Peninsular Spain", country: "ES", groups: ["Q12837", "EU", "039", "150", "UN"], callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.75438, 42.33445], [3.17156, 42.43545], [3.11379, 42.43646], [3.10027, 42.42621], [3.08167, 42.42748], [3.03734, 42.47363], [2.96518, 42.46692], [2.94283, 42.48174], [2.92107, 42.4573], [2.88413, 42.45938], [2.86983, 42.46843], [2.85675, 42.45444], [2.84335, 42.45724], [2.77464, 42.41046], [2.75497, 42.42578], [2.72056, 42.42298], [2.65311, 42.38771], [2.6747, 42.33974], [2.57934, 42.35808], [2.55516, 42.35351], [2.54382, 42.33406], [2.48457, 42.33933], [2.43508, 42.37568], [2.43299, 42.39423], [2.38504, 42.39977], [2.25551, 42.43757], [2.20578, 42.41633], [2.16599, 42.42314], [2.12789, 42.41291], [2.11621, 42.38393], [2.06241, 42.35906], [2.00488, 42.35399], [1.96482, 42.37787], [1.9574, 42.42401], [1.94084, 42.43039], [1.94061, 42.43333], [1.94292, 42.44316], [1.93663, 42.45439], [1.88853, 42.4501], [1.83037, 42.48395], [1.76335, 42.48863], [1.72515, 42.50338], [1.70571, 42.48867], [1.66826, 42.50779], [1.65674, 42.47125], [1.58933, 42.46275], [1.57953, 42.44957], [1.55937, 42.45808], [1.55073, 42.43299], [1.5127, 42.42959], [1.44529, 42.43724], [1.43838, 42.47848], [1.41648, 42.48315], [1.46661, 42.50949], [1.44759, 42.54431], [1.41245, 42.53539], [1.4234, 42.55959], [1.44529, 42.56722], [1.42512, 42.58292], [1.44197, 42.60217], [1.35562, 42.71944], [1.15928, 42.71407], [1.0804, 42.78569], [0.98292, 42.78754], [0.96166, 42.80629], [0.93089, 42.79154], [0.711, 42.86372], [0.66121, 42.84021], [0.65421, 42.75872], [0.67873, 42.69458], [0.40214, 42.69779], [0.36251, 42.72282], [0.29407, 42.67431], [0.25336, 42.7174], [0.17569, 42.73424], [-0.02468, 42.68513], [-0.10519, 42.72761], [-0.16141, 42.79535], [-0.17939, 42.78974], [-0.3122, 42.84788], [-0.38833, 42.80132], [-0.41319, 42.80776], [-0.44334, 42.79939], [-0.50863, 42.82713], [-0.55497, 42.77846], [-0.67637, 42.88303], [-0.69837, 42.87945], [-0.72608, 42.89318], [-0.73422, 42.91228], [-0.72037, 42.92541], [-0.75478, 42.96916], [-0.81652, 42.95166], [-0.97133, 42.96239], [-1.00963, 42.99279], [-1.10333, 43.0059], [-1.22881, 43.05534], [-1.25244, 43.04164], [-1.30531, 43.06859], [-1.30052, 43.09581], [-1.27118, 43.11961], [-1.32209, 43.1127], [-1.34419, 43.09665], [-1.35272, 43.02658], [-1.44067, 43.047], [-1.47555, 43.08372], [-1.41562, 43.12815], [-1.3758, 43.24511], [-1.40942, 43.27272], [-1.45289, 43.27049], [-1.50992, 43.29481], [-1.55963, 43.28828], [-1.57674, 43.25269], [-1.61341, 43.25269], [-1.63052, 43.28591], [-1.62481, 43.30726], [-1.69407, 43.31378], [-1.73074, 43.29481], [-1.7397, 43.32979], [-1.75079, 43.3317], [-1.75334, 43.34107], [-1.77068, 43.34396], [-1.78714, 43.35476], [-1.78332, 43.36399], [-1.79319, 43.37497], [-1.77289, 43.38957], [-1.81005, 43.59738], [-10.14298, 44.17365], [-11.19304, 41.83075], [-8.87157, 41.86488], [-8.81794, 41.90375], [-8.75712, 41.92833], [-8.74606, 41.9469], [-8.7478, 41.96282], [-8.69071, 41.98862], [-8.6681, 41.99703], [-8.65832, 42.02972], [-8.64626, 42.03668], [-8.63791, 42.04691], [-8.59493, 42.05708], [-8.58086, 42.05147], [-8.54563, 42.0537], [-8.5252, 42.06264], [-8.52837, 42.07658], [-8.48185, 42.0811], [-8.44123, 42.08218], [-8.42512, 42.07199], [-8.40143, 42.08052], [-8.38323, 42.07683], [-8.36353, 42.09065], [-8.33912, 42.08358], [-8.32161, 42.10218], [-8.29809, 42.106], [-8.2732, 42.12396], [-8.24681, 42.13993], [-8.22406, 42.1328], [-8.1986, 42.15402], [-8.18947, 42.13853], [-8.19406, 42.12141], [-8.18178, 42.06436], [-8.11729, 42.08537], [-8.08847, 42.05767], [-8.08796, 42.01398], [-8.16232, 41.9828], [-8.2185, 41.91237], [-8.19551, 41.87459], [-8.16944, 41.87944], [-8.16455, 41.81753], [-8.0961, 41.81024], [-8.01136, 41.83453], [-7.9804, 41.87337], [-7.92336, 41.8758], [-7.90707, 41.92432], [-7.88751, 41.92553], [-7.88055, 41.84571], [-7.84188, 41.88065], [-7.69848, 41.90977], [-7.65774, 41.88308], [-7.58603, 41.87944], [-7.62188, 41.83089], [-7.52737, 41.83939], [-7.49803, 41.87095], [-7.45566, 41.86488], [-7.44759, 41.84451], [-7.42854, 41.83262], [-7.42864, 41.80589], [-7.37092, 41.85031], [-7.32366, 41.8406], [-7.18677, 41.88793], [-7.18549, 41.97515], [-7.14115, 41.98855], [-7.08574, 41.97401], [-7.07596, 41.94977], [-7.01078, 41.94977], [-6.98144, 41.9728], [-6.95537, 41.96553], [-6.94396, 41.94403], [-6.82174, 41.94493], [-6.81196, 41.99097], [-6.76959, 41.98734], [-6.75004, 41.94129], [-6.61967, 41.94008], [-6.58544, 41.96674], [-6.5447, 41.94371], [-6.56752, 41.88429], [-6.51374, 41.8758], [-6.56426, 41.74219], [-6.54633, 41.68623], [-6.49907, 41.65823], [-6.44204, 41.68258], [-6.29863, 41.66432], [-6.19128, 41.57638], [-6.26777, 41.48796], [-6.3306, 41.37677], [-6.38553, 41.38655], [-6.38551, 41.35274], [-6.55937, 41.24417], [-6.65046, 41.24725], [-6.68286, 41.21641], [-6.69711, 41.1858], [-6.77319, 41.13049], [-6.75655, 41.10187], [-6.79241, 41.05397], [-6.80942, 41.03629], [-6.84781, 41.02692], [-6.88843, 41.03027], [-6.913, 41.03922], [-6.9357, 41.02888], [-6.8527, 40.93958], [-6.84292, 40.89771], [-6.80707, 40.88047], [-6.79892, 40.84842], [-6.82337, 40.84472], [-6.82826, 40.74603], [-6.79567, 40.65955], [-6.84292, 40.56801], [-6.80218, 40.55067], [-6.7973, 40.51723], [-6.84944, 40.46394], [-6.84618, 40.42177], [-6.78426, 40.36468], [-6.80218, 40.33239], [-6.86085, 40.2976], [-6.86085, 40.26776], [-7.00426, 40.23169], [-7.02544, 40.18564], [-7.00589, 40.12087], [-6.94233, 40.10716], [-6.86737, 40.01986], [-6.91463, 39.86618], [-6.97492, 39.81488], [-7.01613, 39.66877], [-7.24707, 39.66576], [-7.33507, 39.64569], [-7.54121, 39.66717], [-7.49477, 39.58794], [-7.2927, 39.45847], [-7.3149, 39.34857], [-7.23403, 39.27579], [-7.23566, 39.20132], [-7.12811, 39.17101], [-7.14929, 39.11287], [-7.10692, 39.10275], [-7.04011, 39.11919], [-6.97004, 39.07619], [-6.95211, 39.0243], [-7.051, 38.907], [-7.03848, 38.87221], [-7.26174, 38.72107], [-7.265, 38.61674], [-7.32529, 38.44336], [-7.15581, 38.27597], [-7.09389, 38.17227], [-6.93418, 38.21454], [-7.00375, 38.01914], [-7.05966, 38.01966], [-7.10366, 38.04404], [-7.12648, 38.00296], [-7.24544, 37.98884], [-7.27314, 37.90145], [-7.33441, 37.81193], [-7.41981, 37.75729], [-7.51759, 37.56119], [-7.46878, 37.47127], [-7.43974, 37.38913], [-7.43227, 37.25152], [-7.41854, 37.23813], [-7.41133, 37.20314], [-7.39769, 37.16868], [-7.37282, 36.96896], [-7.2725, 35.73269], [-5.10878, 36.05227], [-2.27707, 35.35051], [3.75438, 42.33445]], [[-5.27801, 36.14942], [-5.34064, 36.03744], [-5.40526, 36.15488], [-5.34536, 36.15501], [-5.33822, 36.15272], [-5.27801, 36.14942]]], [[[1.99838, 42.44682], [2.01564, 42.45171], [1.99216, 42.46208], [1.98579, 42.47486], [1.99766, 42.4858], [1.98916, 42.49351], [1.98022, 42.49569], [1.97697, 42.48568], [1.97227, 42.48487], [1.97003, 42.48081], [1.96215, 42.47854], [1.95606, 42.45785], [1.96125, 42.45364], [1.98378, 42.44697], [1.99838, 42.44682]]]] } },
22629 { type: "Feature", properties: { wikidata: "Q98059339", nameEn: "Mainland Norway", country: "NO", groups: ["154", "150", "UN"], callingCodes: ["47"] }, geometry: { type: "MultiPolygon", coordinates: [[[[10.40861, 58.38489], [10.64958, 58.89391], [11.08911, 58.98745], [11.15367, 59.07862], [11.34459, 59.11672], [11.4601, 58.99022], [11.45199, 58.89604], [11.65732, 58.90177], [11.8213, 59.24985], [11.69297, 59.59442], [11.92112, 59.69531], [11.87121, 59.86039], [12.15641, 59.8926], [12.36317, 59.99259], [12.52003, 60.13846], [12.59133, 60.50559], [12.2277, 61.02442], [12.69115, 61.06584], [12.86939, 61.35427], [12.57707, 61.56547], [12.40595, 61.57226], [12.14746, 61.7147], [12.29187, 62.25699], [12.07085, 62.6297], [12.19919, 63.00104], [11.98529, 63.27487], [12.19919, 63.47935], [12.14928, 63.59373], [12.74105, 64.02171], [13.23411, 64.09087], [13.98222, 64.00953], [14.16051, 64.18725], [14.11117, 64.46674], [13.64276, 64.58402], [14.50926, 65.31786], [14.53778, 66.12399], [15.05113, 66.15572], [15.49318, 66.28509], [15.37197, 66.48217], [16.35589, 67.06419], [16.39154, 67.21653], [16.09922, 67.4364], [16.12774, 67.52106], [16.38441, 67.52923], [16.7409, 67.91037], [17.30416, 68.11591], [17.90787, 67.96537], [18.13836, 68.20874], [18.1241, 68.53721], [18.39503, 68.58672], [18.63032, 68.50849], [18.97255, 68.52416], [19.93508, 68.35911], [20.22027, 68.48759], [19.95647, 68.55546], [20.22027, 68.67246], [20.33435, 68.80174], [20.28444, 68.93283], [20.0695, 69.04469], [20.55258, 69.06069], [20.72171, 69.11874], [21.05775, 69.0356], [21.11099, 69.10291], [20.98641, 69.18809], [21.00732, 69.22755], [21.27827, 69.31281], [21.63833, 69.27485], [22.27276, 68.89514], [22.38367, 68.71561], [22.53321, 68.74393], [23.13064, 68.64684], [23.68017, 68.70276], [23.781, 68.84514], [24.02299, 68.81601], [24.18432, 68.73936], [24.74898, 68.65143], [24.90023, 68.55579], [24.93048, 68.61102], [25.10189, 68.63307], [25.12206, 68.78684], [25.42455, 68.90328], [25.61613, 68.89602], [25.75729, 68.99383], [25.69679, 69.27039], [25.96904, 69.68397], [26.40261, 69.91377], [26.64461, 69.96565], [27.05802, 69.92069], [27.57226, 70.06215], [27.95542, 70.0965], [27.97558, 69.99671], [28.32849, 69.88605], [28.36883, 69.81658], [29.12697, 69.69193], [29.31664, 69.47994], [28.8629, 69.22395], [28.81248, 69.11997], [28.91738, 69.04774], [29.0444, 69.0119], [29.26623, 69.13794], [29.27631, 69.2811], [29.97205, 69.41623], [30.16363, 69.65244], [30.52662, 69.54699], [30.95011, 69.54699], [30.84095, 69.80584], [31.59909, 70.16571], [32.07813, 72.01005], [-11.60274, 67.73467], [7.28637, 57.35913], [10.40861, 58.38489]]]] } },
22630 { type: "Feature", properties: { wikidata: "Q98543636", nameEn: "Mainland Ecuador", country: "EC", groups: ["005", "419", "019", "UN"], callingCodes: ["593"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-84.52388, -3.36941], [-80.30602, -3.39149], [-80.20647, -3.431], [-80.24123, -3.46124], [-80.24586, -3.48677], [-80.23651, -3.48652], [-80.22629, -3.501], [-80.20535, -3.51667], [-80.21642, -3.5888], [-80.19848, -3.59249], [-80.18741, -3.63994], [-80.19926, -3.68894], [-80.13232, -3.90317], [-80.46386, -4.01342], [-80.4822, -4.05477], [-80.45023, -4.20938], [-80.32114, -4.21323], [-80.46386, -4.41516], [-80.39256, -4.48269], [-80.13945, -4.29786], [-79.79722, -4.47558], [-79.59402, -4.46848], [-79.26248, -4.95167], [-79.1162, -4.97774], [-79.01659, -5.01481], [-78.85149, -4.66795], [-78.68394, -4.60754], [-78.34362, -3.38633], [-78.24589, -3.39907], [-78.22642, -3.51113], [-78.14324, -3.47653], [-78.19369, -3.36431], [-77.94147, -3.05454], [-76.6324, -2.58397], [-76.05203, -2.12179], [-75.57429, -1.55961], [-75.3872, -0.9374], [-75.22862, -0.95588], [-75.22862, -0.60048], [-75.53615, -0.19213], [-75.60169, -0.18708], [-75.61997, -0.10012], [-75.40192, -0.17196], [-75.25764, -0.11943], [-75.82927, 0.09578], [-76.23441, 0.42294], [-76.41215, 0.38228], [-76.4094, 0.24015], [-76.89177, 0.24736], [-77.52001, 0.40782], [-77.49984, 0.64476], [-77.67815, 0.73863], [-77.66416, 0.81604], [-77.68613, 0.83029], [-77.7148, 0.85003], [-77.85677, 0.80197], [-78.42749, 1.15389], [-78.87137, 1.47457], [-82.12561, 4.00341], [-84.52388, -3.36941]]]] } },
22631 { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
22632 { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
22633 { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
22634 { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
22635 { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
22636 { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
22637 { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
22638 { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
22639 { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
22640 { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
22641 { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
22642 { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
22643 { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
22644 { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
22645 { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
22646 { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
22647 { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
22648 { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
22649 { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
22650 { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
22651 { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
22652 { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
22653 { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
22654 { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
22655 { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
22656 { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
22657 { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
22658 { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
22659 { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
22660 { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
22661 { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
22662 { type: "Feature", properties: { m49: "680", wikidata: "Q3405693", nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01481"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.36485, 49.48223], [-2.65349, 49.15373], [-2.09454, 49.46288], [-2.36485, 49.48223]]]] } },
22663 { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
22664 { type: "Feature", properties: { iso1A2: "AC", iso1A3: "ASC", wikidata: "Q46197", nameEn: "Ascension Island", aliases: ["SH-AC"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["247"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.82771, -8.70814], [-13.33271, -8.07391], [-14.91926, -6.63386], [-14.82771, -8.70814]]]] } },
22665 { type: "Feature", properties: { iso1A2: "AD", iso1A3: "AND", iso1N3: "020", wikidata: "Q228", nameEn: "Andorra", groups: ["Q12837", "039", "150", "UN"], callingCodes: ["376"] }, geometry: { type: "MultiPolygon", coordinates: [[[[1.72515, 42.50338], [1.73683, 42.55492], [1.7858, 42.57698], [1.72588, 42.59098], [1.73452, 42.61515], [1.68267, 42.62533], [1.6625, 42.61982], [1.63485, 42.62957], [1.60085, 42.62703], [1.55418, 42.65669], [1.50867, 42.64483], [1.48043, 42.65203], [1.46718, 42.63296], [1.47986, 42.61346], [1.44197, 42.60217], [1.42512, 42.58292], [1.44529, 42.56722], [1.4234, 42.55959], [1.41245, 42.53539], [1.44759, 42.54431], [1.46661, 42.50949], [1.41648, 42.48315], [1.43838, 42.47848], [1.44529, 42.43724], [1.5127, 42.42959], [1.55073, 42.43299], [1.55937, 42.45808], [1.57953, 42.44957], [1.58933, 42.46275], [1.65674, 42.47125], [1.66826, 42.50779], [1.70571, 42.48867], [1.72515, 42.50338]]]] } },
22666 { type: "Feature", properties: { iso1A2: "AE", iso1A3: "ARE", iso1N3: "784", wikidata: "Q878", nameEn: "United Arab Emirates", groups: ["145", "142", "UN"], callingCodes: ["971"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.26534, 25.62825], [56.25341, 25.61443], [56.26636, 25.60643], [56.25365, 25.60211], [56.20473, 25.61119], [56.18363, 25.65508], [56.14826, 25.66351], [56.13579, 25.73524], [56.17416, 25.77239], [56.13963, 25.82765], [56.19334, 25.9795], [56.15498, 26.06828], [56.08666, 26.05038], [55.81777, 26.18798], [55.14145, 25.62624], [53.97892, 24.64436], [52.82259, 25.51697], [52.35509, 25.00368], [52.02277, 24.75635], [51.83108, 24.71675], [51.58834, 24.66608], [51.41644, 24.39615], [51.58871, 24.27256], [51.59617, 24.12041], [52.56622, 22.94341], [55.13599, 22.63334], [55.2137, 22.71065], [55.22634, 23.10378], [55.57358, 23.669], [55.48677, 23.94946], [55.73301, 24.05994], [55.8308, 24.01633], [56.01799, 24.07426], [55.95472, 24.2172], [55.83367, 24.20193], [55.77658, 24.23476], [55.76558, 24.23227], [55.75257, 24.23466], [55.75382, 24.2466], [55.75939, 24.26114], [55.76781, 24.26209], [55.79145, 24.27914], [55.80747, 24.31069], [55.83395, 24.32776], [55.83271, 24.41521], [55.76461, 24.5287], [55.83271, 24.68567], [55.83408, 24.77858], [55.81348, 24.80102], [55.81116, 24.9116], [55.85094, 24.96858], [55.90849, 24.96771], [55.96316, 25.00857], [56.05715, 24.95727], [56.05106, 24.87461], [55.97467, 24.89639], [55.97836, 24.87673], [56.03535, 24.81161], [56.06128, 24.74457], [56.13684, 24.73699], [56.20062, 24.78565], [56.20568, 24.85063], [56.30269, 24.88334], [56.34873, 24.93205], [56.3227, 24.97284], [56.86325, 25.03856], [56.82555, 25.7713], [56.26534, 25.62825]], [[56.26062, 25.33108], [56.3005, 25.31815], [56.3111, 25.30107], [56.35172, 25.30681], [56.34438, 25.26653], [56.27628, 25.23404], [56.24341, 25.22867], [56.20872, 25.24104], [56.20838, 25.25668], [56.24465, 25.27505], [56.25008, 25.28843], [56.23362, 25.31253], [56.26062, 25.33108]]], [[[56.28423, 25.26344], [56.29379, 25.2754], [56.28102, 25.28486], [56.2716, 25.27916], [56.27086, 25.26128], [56.28423, 25.26344]]]] } },
22667 { type: "Feature", properties: { iso1A2: "AF", iso1A3: "AFG", iso1N3: "004", wikidata: "Q889", nameEn: "Afghanistan", groups: ["034", "142", "UN"], callingCodes: ["93"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.61526, 38.34774], [70.60407, 38.28046], [70.54673, 38.24541], [70.4898, 38.12546], [70.17206, 37.93276], [70.1863, 37.84296], [70.27694, 37.81258], [70.28243, 37.66706], [70.15015, 37.52519], [69.95971, 37.5659], [69.93362, 37.61378], [69.84435, 37.60616], [69.80041, 37.5746], [69.51888, 37.5844], [69.44954, 37.4869], [69.36645, 37.40462], [69.45022, 37.23315], [69.39529, 37.16752], [69.25152, 37.09426], [69.03274, 37.25174], [68.96407, 37.32603], [68.88168, 37.33368], [68.91189, 37.26704], [68.80889, 37.32494], [68.81438, 37.23862], [68.6798, 37.27906], [68.61851, 37.19815], [68.41888, 37.13906], [68.41201, 37.10402], [68.29253, 37.10621], [68.27605, 37.00977], [68.18542, 37.02074], [68.02194, 36.91923], [67.87917, 37.0591], [67.7803, 37.08978], [67.78329, 37.1834], [67.51868, 37.26102], [67.2581, 37.17216], [67.2224, 37.24545], [67.13039, 37.27168], [67.08232, 37.35469], [66.95598, 37.40162], [66.64699, 37.32958], [66.55743, 37.35409], [66.30993, 37.32409], [65.72274, 37.55438], [65.64137, 37.45061], [65.64263, 37.34388], [65.51778, 37.23881], [64.97945, 37.21913], [64.61141, 36.6351], [64.62514, 36.44311], [64.57295, 36.34362], [64.43288, 36.24401], [64.05385, 36.10433], [63.98519, 36.03773], [63.56496, 35.95106], [63.53475, 35.90881], [63.29579, 35.85985], [63.12276, 35.86208], [63.10318, 35.81782], [63.23262, 35.67487], [63.10079, 35.63024], [63.12276, 35.53196], [63.0898, 35.43131], [62.90853, 35.37086], [62.74098, 35.25432], [62.62288, 35.22067], [62.48006, 35.28796], [62.29878, 35.13312], [62.29191, 35.25964], [62.15871, 35.33278], [62.05709, 35.43803], [61.97743, 35.4604], [61.77693, 35.41341], [61.58742, 35.43803], [61.27371, 35.61482], [61.18187, 35.30249], [61.0991, 35.27845], [61.12831, 35.09938], [61.06926, 34.82139], [61.00197, 34.70631], [60.99922, 34.63064], [60.72316, 34.52857], [60.91321, 34.30411], [60.66502, 34.31539], [60.50209, 34.13992], [60.5838, 33.80793], [60.5485, 33.73422], [60.57762, 33.59772], [60.69573, 33.56054], [60.91133, 33.55596], [60.88908, 33.50219], [60.56485, 33.12944], [60.86191, 32.22565], [60.84541, 31.49561], [61.70929, 31.37391], [61.80569, 31.16167], [61.80957, 31.12576], [61.83257, 31.0452], [61.8335, 30.97669], [61.78268, 30.92724], [61.80829, 30.84224], [60.87231, 29.86514], [62.47751, 29.40782], [63.5876, 29.50456], [64.12966, 29.39157], [64.19796, 29.50407], [64.62116, 29.58903], [65.04005, 29.53957], [66.24175, 29.85181], [66.36042, 29.9583], [66.23609, 30.06321], [66.34869, 30.404], [66.28413, 30.57001], [66.39194, 30.9408], [66.42645, 30.95309], [66.58175, 30.97532], [66.68166, 31.07597], [66.72561, 31.20526], [66.83273, 31.26867], [67.04147, 31.31561], [67.03323, 31.24519], [67.29964, 31.19586], [67.78854, 31.33203], [67.7748, 31.4188], [67.62374, 31.40473], [67.58323, 31.52772], [67.72056, 31.52304], [67.86887, 31.63536], [68.00071, 31.6564], [68.1655, 31.82691], [68.25614, 31.80357], [68.27605, 31.75863], [68.44222, 31.76446], [68.57475, 31.83158], [68.6956, 31.75687], [68.79997, 31.61665], [68.91078, 31.59687], [68.95995, 31.64822], [69.00939, 31.62249], [69.11514, 31.70782], [69.20577, 31.85957], [69.3225, 31.93186], [69.27032, 32.14141], [69.27932, 32.29119], [69.23599, 32.45946], [69.2868, 32.53938], [69.38155, 32.56601], [69.44747, 32.6678], [69.43649, 32.7302], [69.38018, 32.76601], [69.47082, 32.85834], [69.5436, 32.8768], [69.49854, 32.88843], [69.49004, 33.01509], [69.57656, 33.09911], [69.71526, 33.09911], [69.79766, 33.13247], [69.85259, 33.09451], [70.02563, 33.14282], [70.07369, 33.22557], [70.13686, 33.21064], [70.32775, 33.34496], [70.17062, 33.53535], [70.20141, 33.64387], [70.14785, 33.6553], [70.14236, 33.71701], [70.00503, 33.73528], [69.85671, 33.93719], [69.87307, 33.9689], [69.90203, 34.04194], [70.54336, 33.9463], [70.88119, 33.97933], [71.07345, 34.06242], [71.06933, 34.10564], [71.09307, 34.11961], [71.09453, 34.13524], [71.13078, 34.16503], [71.12815, 34.26619], [71.17662, 34.36769], [71.02401, 34.44835], [71.0089, 34.54568], [71.11602, 34.63047], [71.08718, 34.69034], [71.28356, 34.80882], [71.29472, 34.87728], [71.50329, 34.97328], [71.49917, 35.00478], [71.55273, 35.02615], [71.52938, 35.09023], [71.67495, 35.21262], [71.5541, 35.28776], [71.54294, 35.31037], [71.65435, 35.4479], [71.49917, 35.6267], [71.55273, 35.71483], [71.37969, 35.95865], [71.19505, 36.04134], [71.60491, 36.39429], [71.80267, 36.49924], [72.18135, 36.71838], [72.6323, 36.84601], [73.82685, 36.91421], [74.04856, 36.82648], [74.43389, 37.00977], [74.53739, 36.96224], [74.56453, 37.03023], [74.49981, 37.24518], [74.80605, 37.21565], [74.88887, 37.23275], [74.8294, 37.3435], [74.68383, 37.3948], [74.56161, 37.37734], [74.41055, 37.3948], [74.23339, 37.41116], [74.20308, 37.34208], [73.8564, 37.26158], [73.82552, 37.22659], [73.64974, 37.23643], [73.61129, 37.27469], [73.76647, 37.33913], [73.77197, 37.4417], [73.29633, 37.46495], [73.06884, 37.31729], [72.79693, 37.22222], [72.66381, 37.02014], [72.54095, 37.00007], [72.31676, 36.98115], [71.83229, 36.68084], [71.67083, 36.67346], [71.57195, 36.74943], [71.51502, 36.89128], [71.48481, 36.93218], [71.46923, 36.99925], [71.45578, 37.03094], [71.43097, 37.05855], [71.44127, 37.11856], [71.4494, 37.18137], [71.4555, 37.21418], [71.47386, 37.2269], [71.48339, 37.23937], [71.4824, 37.24921], [71.48536, 37.26017], [71.50674, 37.31502], [71.49821, 37.31975], [71.4862, 37.33405], [71.47685, 37.40281], [71.49612, 37.4279], [71.5256, 37.47971], [71.50616, 37.50733], [71.49693, 37.53527], [71.5065, 37.60912], [71.51972, 37.61945], [71.54186, 37.69691], [71.55234, 37.73209], [71.53053, 37.76534], [71.54324, 37.77104], [71.55752, 37.78677], [71.59255, 37.79956], [71.58843, 37.92425], [71.51565, 37.95349], [71.32871, 37.88564], [71.296, 37.93403], [71.2809, 37.91995], [71.24969, 37.93031], [71.27278, 37.96496], [71.27622, 37.99946], [71.28922, 38.01272], [71.29878, 38.04429], [71.36444, 38.15358], [71.37803, 38.25641], [71.33869, 38.27335], [71.33114, 38.30339], [71.21291, 38.32797], [71.1451, 38.40106], [71.10957, 38.40671], [71.10592, 38.42077], [71.09542, 38.42517], [71.0556, 38.40176], [71.03545, 38.44779], [70.98693, 38.48862], [70.92728, 38.43021], [70.88719, 38.46826], [70.84376, 38.44688], [70.82538, 38.45394], [70.81697, 38.44507], [70.80521, 38.44447], [70.79766, 38.44944], [70.78702, 38.45031], [70.78581, 38.45502], [70.77132, 38.45548], [70.75455, 38.4252], [70.72485, 38.4131], [70.69807, 38.41861], [70.67438, 38.40597], [70.6761, 38.39144], [70.69189, 38.37031], [70.64966, 38.34999], [70.61526, 38.34774]]]] } },
22668 { type: "Feature", properties: { iso1A2: "AG", iso1A3: "ATG", iso1N3: "028", wikidata: "Q781", nameEn: "Antigua and Barbuda", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.66959, 18.6782], [-62.58307, 16.68909], [-62.1023, 16.97277], [-61.23098, 16.62484], [-61.66959, 18.6782]]]] } },
22669 { type: "Feature", properties: { iso1A2: "AI", iso1A3: "AIA", iso1N3: "660", wikidata: "Q25228", nameEn: "Anguilla", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.79029, 19.11219], [-63.35989, 18.06012], [-62.62718, 18.26185], [-63.79029, 19.11219]]]] } },
22670 { type: "Feature", properties: { iso1A2: "AL", iso1A3: "ALB", iso1N3: "008", wikidata: "Q222", nameEn: "Albania", groups: ["039", "150", "UN"], callingCodes: ["355"] }, geometry: { type: "MultiPolygon", coordinates: [[[[20.07761, 42.55582], [20.01834, 42.54622], [20.00842, 42.5109], [19.9324, 42.51699], [19.82333, 42.46581], [19.76549, 42.50237], [19.74731, 42.57422], [19.77375, 42.58517], [19.73244, 42.66299], [19.65972, 42.62774], [19.4836, 42.40831], [19.42352, 42.36546], [19.42, 42.33019], [19.28623, 42.17745], [19.40687, 42.10024], [19.37548, 42.06835], [19.36867, 42.02564], [19.37691, 41.96977], [19.34601, 41.95675], [19.33812, 41.90669], [19.37451, 41.8842], [19.37597, 41.84849], [19.26406, 41.74971], [19.0384, 40.35325], [19.95905, 39.82857], [19.97622, 39.78684], [19.92466, 39.69533], [19.98042, 39.6504], [20.00957, 39.69227], [20.05189, 39.69112], [20.12956, 39.65805], [20.15988, 39.652], [20.22376, 39.64532], [20.22707, 39.67459], [20.27412, 39.69884], [20.31961, 39.72799], [20.29152, 39.80421], [20.30804, 39.81563], [20.38572, 39.78516], [20.41475, 39.81437], [20.41546, 39.82832], [20.31135, 39.99438], [20.37911, 39.99058], [20.42373, 40.06777], [20.48487, 40.06271], [20.51297, 40.08168], [20.55593, 40.06524], [20.61081, 40.07866], [20.62566, 40.0897], [20.67162, 40.09433], [20.71789, 40.27739], [20.78234, 40.35803], [20.7906, 40.42726], [20.83688, 40.47882], [20.94925, 40.46625], [20.96908, 40.51526], [21.03932, 40.56299], [21.05833, 40.66586], [20.98134, 40.76046], [20.95752, 40.76982], [20.98396, 40.79109], [20.97887, 40.85475], [20.97693, 40.90103], [20.94305, 40.92399], [20.83671, 40.92752], [20.81567, 40.89662], [20.73504, 40.9081], [20.71634, 40.91781], [20.65558, 41.08009], [20.63454, 41.0889], [20.59832, 41.09066], [20.58546, 41.11179], [20.59715, 41.13644], [20.51068, 41.2323], [20.49432, 41.33679], [20.52119, 41.34381], [20.55976, 41.4087], [20.51301, 41.442], [20.49039, 41.49277], [20.45331, 41.51436], [20.45809, 41.5549], [20.52103, 41.56473], [20.55508, 41.58113], [20.51769, 41.65975], [20.52937, 41.69292], [20.51301, 41.72433], [20.53405, 41.78099], [20.57144, 41.7897], [20.55976, 41.87068], [20.59524, 41.8818], [20.57946, 41.91593], [20.63069, 41.94913], [20.59434, 42.03879], [20.55633, 42.08173], [20.56955, 42.12097], [20.48857, 42.25444], [20.3819, 42.3029], [20.34479, 42.32656], [20.24399, 42.32168], [20.21797, 42.41237], [20.17127, 42.50469], [20.07761, 42.55582]]]] } },
22671 { type: "Feature", properties: { iso1A2: "AM", iso1A3: "ARM", iso1N3: "051", wikidata: "Q399", nameEn: "Armenia", groups: ["145", "142", "UN"], callingCodes: ["374"] }, geometry: { type: "MultiPolygon", coordinates: [[[[45.0133, 41.29747], [44.93493, 41.25685], [44.81437, 41.30371], [44.80053, 41.25949], [44.81749, 41.23488], [44.84358, 41.23088], [44.89911, 41.21366], [44.87887, 41.20195], [44.82084, 41.21513], [44.72814, 41.20338], [44.61462, 41.24018], [44.59322, 41.1933], [44.46791, 41.18204], [44.34417, 41.2382], [44.34337, 41.20312], [44.32139, 41.2079], [44.18148, 41.24644], [44.16591, 41.19141], [43.84835, 41.16329], [43.74717, 41.1117], [43.67712, 41.13398], [43.4717, 41.12611], [43.44984, 41.0988], [43.47319, 41.02251], [43.58683, 40.98961], [43.67712, 40.93084], [43.67712, 40.84846], [43.74872, 40.7365], [43.7425, 40.66805], [43.63664, 40.54159], [43.54791, 40.47413], [43.60862, 40.43267], [43.59928, 40.34019], [43.71136, 40.16673], [43.65221, 40.14889], [43.65688, 40.11199], [43.92307, 40.01787], [44.1057, 40.03555], [44.1778, 40.02845], [44.26973, 40.04866], [44.46635, 39.97733], [44.61845, 39.8281], [44.75779, 39.7148], [44.88354, 39.74432], [44.92869, 39.72157], [45.06604, 39.79277], [45.18554, 39.67846], [45.17464, 39.58614], [45.21784, 39.58074], [45.23535, 39.61373], [45.30385, 39.61373], [45.29606, 39.57654], [45.46992, 39.49888], [45.70547, 39.60174], [45.80804, 39.56716], [45.83, 39.46487], [45.79225, 39.3695], [45.99774, 39.28931], [46.02303, 39.09978], [46.06973, 39.0744], [46.14785, 38.84206], [46.20601, 38.85262], [46.34059, 38.92076], [46.53497, 38.86548], [46.51805, 38.94982], [46.54296, 39.07078], [46.44022, 39.19636], [46.52584, 39.18912], [46.54141, 39.15895], [46.58032, 39.21204], [46.63481, 39.23013], [46.56476, 39.24942], [46.50093, 39.33736], [46.43244, 39.35181], [46.37795, 39.42039], [46.4013, 39.45405], [46.53051, 39.47809], [46.51027, 39.52373], [46.57721, 39.54414], [46.57098, 39.56694], [46.52117, 39.58734], [46.42465, 39.57534], [46.40286, 39.63651], [46.18493, 39.60533], [45.96543, 39.78859], [45.82533, 39.82925], [45.7833, 39.9475], [45.60895, 39.97733], [45.59806, 40.0131], [45.78642, 40.03218], [45.83779, 39.98925], [45.97944, 40.181], [45.95609, 40.27846], [45.65098, 40.37696], [45.42994, 40.53804], [45.45484, 40.57707], [45.35366, 40.65979], [45.4206, 40.7424], [45.55914, 40.78366], [45.60584, 40.87436], [45.40814, 40.97904], [45.44083, 41.01663], [45.39725, 41.02603], [45.35677, 40.99784], [45.28859, 41.03757], [45.26162, 41.0228], [45.25897, 41.0027], [45.1994, 41.04518], [45.16493, 41.05068], [45.1634, 41.08082], [45.1313, 41.09369], [45.12923, 41.06059], [45.06784, 41.05379], [45.08028, 41.10917], [45.19942, 41.13299], [45.1969, 41.168], [45.11811, 41.19967], [45.05201, 41.19211], [45.02932, 41.2101], [45.05497, 41.2464], [45.0133, 41.29747]], [[45.21324, 40.9817], [45.21219, 40.99001], [45.20518, 40.99348], [45.19312, 40.98998], [45.18382, 41.0066], [45.20625, 41.01484], [45.23487, 41.00226], [45.23095, 40.97828], [45.21324, 40.9817]], [[45.00864, 41.03411], [44.9903, 41.05657], [44.96031, 41.06345], [44.95383, 41.07553], [44.97169, 41.09176], [45.00864, 41.09407], [45.03406, 41.07931], [45.04517, 41.06653], [45.03792, 41.03938], [45.00864, 41.03411]]], [[[45.50279, 40.58424], [45.56071, 40.64765], [45.51825, 40.67382], [45.47927, 40.65023], [45.50279, 40.58424]]]] } },
22672 { type: "Feature", properties: { iso1A2: "AO", iso1A3: "AGO", iso1N3: "024", wikidata: "Q916", nameEn: "Angola", groups: ["017", "202", "002", "UN"], callingCodes: ["244"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.55507, -5.85631], [13.04371, -5.87078], [12.42245, -6.07585], [11.95767, -5.94705], [12.20376, -5.76338], [12.26557, -5.74031], [12.52318, -5.74353], [12.52301, -5.17481], [12.53599, -5.1618], [12.53586, -5.14658], [12.51589, -5.1332], [12.49815, -5.14058], [12.46297, -5.09408], [12.60251, -5.01715], [12.63465, -4.94632], [12.70868, -4.95505], [12.8733, -4.74346], [13.11195, -4.67745], [13.09648, -4.63739], [12.91489, -4.47907], [12.87096, -4.40315], [12.76844, -4.38709], [12.64835, -4.55937], [12.40964, -4.60609], [12.32324, -4.78415], [12.25587, -4.79437], [12.20901, -4.75642], [12.16068, -4.90089], [12.00924, -5.02627], [11.50888, -5.33417], [10.5065, -17.25284], [11.75063, -17.25013], [12.07076, -17.15165], [12.52111, -17.24495], [12.97145, -16.98567], [13.36212, -16.98048], [13.95896, -17.43141], [14.28743, -17.38814], [18.39229, -17.38927], [18.84226, -17.80375], [21.14283, -17.94318], [21.42741, -18.02787], [23.47474, -17.62877], [23.20038, -17.47563], [22.17217, -16.50269], [22.00323, -16.18028], [21.97988, -13.00148], [24.03339, -12.99091], [23.90937, -12.844], [24.06672, -12.29058], [23.98804, -12.13149], [24.02603, -11.15368], [24.00027, -10.89356], [23.86868, -11.02856], [23.45631, -10.946], [23.16602, -11.10577], [22.54205, -11.05784], [22.25951, -11.24911], [22.17954, -10.85884], [22.32604, -10.76291], [22.19039, -9.94628], [21.84856, -9.59871], [21.79824, -7.29628], [20.56263, -7.28566], [20.61689, -6.90876], [20.31846, -6.91953], [20.30218, -6.98955], [19.5469, -7.00195], [19.33698, -7.99743], [18.33635, -8.00126], [17.5828, -8.13784], [16.96282, -7.21787], [16.55507, -5.85631]]]] } },
22673 { type: "Feature", properties: { iso1A2: "AQ", iso1A3: "ATA", iso1N3: "010", wikidata: "Q51", nameEn: "Antarctica", level: "region", callingCodes: ["672"] }, geometry: { type: "MultiPolygon", coordinates: [[[[180, -60], [-180, -60], [-180, -90], [180, -90], [180, -60]]]] } },
22674 { type: "Feature", properties: { iso1A2: "AR", iso1A3: "ARG", iso1N3: "032", wikidata: "Q414", nameEn: "Argentina", aliases: ["RA"], groups: ["005", "419", "019", "UN"], callingCodes: ["54"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.31343, -50.58411], [-72.33873, -51.59954], [-71.99889, -51.98018], [-69.97824, -52.00845], [-68.41683, -52.33516], [-68.60702, -52.65781], [-68.60733, -54.9125], [-68.01394, -54.8753], [-67.46182, -54.92205], [-67.11046, -54.94199], [-66.07313, -55.19618], [-63.67376, -55.11859], [-54.78916, -36.21945], [-57.83001, -34.69099], [-58.34425, -34.15035], [-58.44442, -33.84033], [-58.40475, -33.11777], [-58.1224, -32.98842], [-58.22362, -32.52416], [-58.10036, -32.25338], [-58.20252, -31.86966], [-58.00076, -31.65016], [-58.0023, -31.53084], [-58.07569, -31.44916], [-57.98127, -31.3872], [-57.9908, -31.34924], [-57.86729, -31.06352], [-57.89476, -30.95994], [-57.8024, -30.77193], [-57.89115, -30.49572], [-57.64859, -30.35095], [-57.61478, -30.25165], [-57.65132, -30.19229], [-57.09386, -29.74211], [-56.81251, -29.48154], [-56.62789, -29.18073], [-56.57295, -29.11357], [-56.54171, -29.11447], [-56.05265, -28.62651], [-56.00458, -28.60421], [-56.01729, -28.51223], [-55.65418, -28.18304], [-55.6262, -28.17124], [-55.33303, -27.94661], [-55.16872, -27.86224], [-55.1349, -27.89759], [-54.90805, -27.73149], [-54.90159, -27.63132], [-54.67657, -27.57214], [-54.50416, -27.48232], [-54.41888, -27.40882], [-54.19268, -27.30751], [-54.19062, -27.27639], [-54.15978, -27.2889], [-53.80144, -27.09844], [-53.73372, -26.6131], [-53.68269, -26.33359], [-53.64505, -26.28089], [-53.64186, -26.25976], [-53.64632, -26.24798], [-53.63881, -26.25075], [-53.63739, -26.2496], [-53.65237, -26.23289], [-53.65018, -26.19501], [-53.73968, -26.10012], [-53.73391, -26.07006], [-53.7264, -26.0664], [-53.73086, -26.05842], [-53.73511, -26.04211], [-53.83691, -25.94849], [-53.90831, -25.55513], [-54.52926, -25.62846], [-54.5502, -25.58915], [-54.59398, -25.59224], [-54.62063, -25.91213], [-54.60664, -25.9691], [-54.67359, -25.98607], [-54.69333, -26.37705], [-54.70732, -26.45099], [-54.80868, -26.55669], [-55.00584, -26.78754], [-55.06351, -26.80195], [-55.16948, -26.96068], [-55.25243, -26.93808], [-55.39611, -26.97679], [-55.62322, -27.1941], [-55.59094, -27.32444], [-55.74475, -27.44485], [-55.89195, -27.3467], [-56.18313, -27.29851], [-56.85337, -27.5165], [-58.04205, -27.2387], [-58.59549, -27.29973], [-58.65321, -27.14028], [-58.3198, -26.83443], [-58.1188, -26.16704], [-57.87176, -25.93604], [-57.57431, -25.47269], [-57.80821, -25.13863], [-58.25492, -24.92528], [-58.33055, -24.97099], [-59.33886, -24.49935], [-59.45482, -24.34787], [-60.03367, -24.00701], [-60.28163, -24.04436], [-60.99754, -23.80934], [-61.0782, -23.62932], [-61.9756, -23.0507], [-62.22768, -22.55807], [-62.51761, -22.37684], [-62.64455, -22.25091], [-62.8078, -22.12534], [-62.81124, -21.9987], [-63.66482, -21.99918], [-63.68113, -22.0544], [-63.70963, -21.99934], [-63.93287, -21.99934], [-64.22918, -22.55807], [-64.31489, -22.88824], [-64.35108, -22.73282], [-64.4176, -22.67692], [-64.58888, -22.25035], [-64.67174, -22.18957], [-64.90014, -22.12136], [-64.99524, -22.08255], [-65.47435, -22.08908], [-65.57743, -22.07675], [-65.58694, -22.09794], [-65.61166, -22.09504], [-65.7467, -22.10105], [-65.9261, -21.93335], [-66.04832, -21.9187], [-66.03836, -21.84829], [-66.24077, -21.77837], [-66.29714, -22.08741], [-66.7298, -22.23644], [-67.18382, -22.81525], [-66.99632, -22.99839], [-67.33563, -24.04237], [-68.24825, -24.42596], [-68.56909, -24.69831], [-68.38372, -25.08636], [-68.57622, -25.32505], [-68.38372, -26.15353], [-68.56909, -26.28146], [-68.59048, -26.49861], [-68.27677, -26.90626], [-68.43363, -27.08414], [-68.77586, -27.16029], [-69.22504, -27.95042], [-69.66709, -28.44055], [-69.80969, -29.07185], [-69.99507, -29.28351], [-69.8596, -30.26131], [-70.14479, -30.36595], [-70.55832, -31.51559], [-69.88099, -33.34489], [-69.87386, -34.13344], [-70.49416, -35.24145], [-70.38008, -36.02375], [-70.95047, -36.4321], [-71.24279, -37.20264], [-70.89532, -38.6923], [-71.37826, -38.91474], [-71.92726, -40.72714], [-71.74901, -42.11711], [-72.15541, -42.15941], [-72.14828, -42.85321], [-71.64206, -43.64774], [-71.81318, -44.38097], [-71.16436, -44.46244], [-71.26418, -44.75684], [-72.06985, -44.81756], [-71.35687, -45.22075], [-71.75614, -45.61611], [-71.68577, -46.55385], [-71.94152, -47.13595], [-72.50478, -47.80586], [-72.27662, -48.28727], [-72.54042, -48.52392], [-72.56894, -48.81116], [-73.09655, -49.14342], [-73.45156, -49.79461], [-73.55259, -49.92488], [-73.15765, -50.78337], [-72.31343, -50.58411]]]] } },
22675 { type: "Feature", properties: { iso1A2: "AS", iso1A3: "ASM", iso1N3: "016", wikidata: "Q16641", nameEn: "American Samoa", aliases: ["US-AS"], country: "US", groups: ["Q1352230", "061", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 684"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-171.39864, -10.21587], [-170.99605, -15.1275], [-166.32598, -15.26169], [-171.39864, -10.21587]]]] } },
22676 { type: "Feature", properties: { iso1A2: "AT", iso1A3: "AUT", iso1N3: "040", wikidata: "Q40", nameEn: "Austria", groups: ["EU", "155", "150", "UN"], callingCodes: ["43"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.34823, 48.98444], [15.28305, 48.98831], [15.26177, 48.95766], [15.16358, 48.94278], [15.15534, 48.99056], [14.99878, 49.01444], [14.97612, 48.96983], [14.98917, 48.90082], [14.95072, 48.79101], [14.98032, 48.77959], [14.9782, 48.7766], [14.98112, 48.77524], [14.9758, 48.76857], [14.95641, 48.75915], [14.94773, 48.76268], [14.81545, 48.7874], [14.80821, 48.77711], [14.80584, 48.73489], [14.72756, 48.69502], [14.71794, 48.59794], [14.66762, 48.58215], [14.60808, 48.62881], [14.56139, 48.60429], [14.4587, 48.64695], [14.43076, 48.58855], [14.33909, 48.55852], [14.20691, 48.5898], [14.09104, 48.5943], [14.01482, 48.63788], [14.06151, 48.66873], [13.84023, 48.76988], [13.82266, 48.75544], [13.81863, 48.73257], [13.79337, 48.71375], [13.81791, 48.69832], [13.81283, 48.68426], [13.81901, 48.6761], [13.82609, 48.62345], [13.80038, 48.59487], [13.80519, 48.58026], [13.76921, 48.55324], [13.7513, 48.5624], [13.74816, 48.53058], [13.72802, 48.51208], [13.66113, 48.53558], [13.65186, 48.55092], [13.62508, 48.55501], [13.59705, 48.57013], [13.57535, 48.55912], [13.51291, 48.59023], [13.50131, 48.58091], [13.50663, 48.57506], [13.46967, 48.55157], [13.45214, 48.56472], [13.43695, 48.55776], [13.45727, 48.51092], [13.42527, 48.45711], [13.43929, 48.43386], [13.40709, 48.37292], [13.30897, 48.31575], [13.26039, 48.29422], [13.18093, 48.29577], [13.126, 48.27867], [13.0851, 48.27711], [13.02083, 48.25689], [12.95306, 48.20629], [12.87126, 48.20318], [12.84475, 48.16556], [12.836, 48.1647], [12.8362, 48.15876], [12.82673, 48.15245], [12.80676, 48.14979], [12.78595, 48.12445], [12.7617, 48.12796], [12.74973, 48.10885], [12.76141, 48.07373], [12.8549, 48.01122], [12.87476, 47.96195], [12.91683, 47.95647], [12.9211, 47.95135], [12.91985, 47.94069], [12.92668, 47.93879], [12.93419, 47.94063], [12.93642, 47.94436], [12.93886, 47.94046], [12.94163, 47.92927], [13.00588, 47.84374], [12.98543, 47.82896], [12.96311, 47.79957], [12.93202, 47.77302], [12.94371, 47.76281], [12.9353, 47.74788], [12.91711, 47.74026], [12.90274, 47.72513], [12.91333, 47.7178], [12.92969, 47.71094], [12.98578, 47.7078], [13.01382, 47.72116], [13.07692, 47.68814], [13.09562, 47.63304], [13.06407, 47.60075], [13.06641, 47.58577], [13.04537, 47.58183], [13.05355, 47.56291], [13.03252, 47.53373], [13.04537, 47.49426], [12.9998, 47.46267], [12.98344, 47.48716], [12.9624, 47.47452], [12.85256, 47.52741], [12.84672, 47.54556], [12.80699, 47.54477], [12.77427, 47.58025], [12.82101, 47.61493], [12.76492, 47.64485], [12.77777, 47.66689], [12.7357, 47.6787], [12.6071, 47.6741], [12.57438, 47.63238], [12.53816, 47.63553], [12.50076, 47.62293], [12.44117, 47.6741], [12.43883, 47.6977], [12.37222, 47.68433], [12.336, 47.69534], [12.27991, 47.68827], [12.26004, 47.67725], [12.24017, 47.69534], [12.26238, 47.73544], [12.2542, 47.7433], [12.22571, 47.71776], [12.18303, 47.70065], [12.16217, 47.70105], [12.16769, 47.68167], [12.18347, 47.66663], [12.18507, 47.65984], [12.19895, 47.64085], [12.20801, 47.61082], [12.20398, 47.60667], [12.18568, 47.6049], [12.17737, 47.60121], [12.18145, 47.61019], [12.17824, 47.61506], [12.13734, 47.60639], [12.05788, 47.61742], [12.02282, 47.61033], [12.0088, 47.62451], [11.85572, 47.60166], [11.84052, 47.58354], [11.63934, 47.59202], [11.60681, 47.57881], [11.58811, 47.55515], [11.58578, 47.52281], [11.52618, 47.50939], [11.4362, 47.51413], [11.38128, 47.47465], [11.4175, 47.44621], [11.33804, 47.44937], [11.29597, 47.42566], [11.27844, 47.39956], [11.22002, 47.3964], [11.25157, 47.43277], [11.20482, 47.43198], [11.12536, 47.41222], [11.11835, 47.39719], [10.97111, 47.39561], [10.97111, 47.41617], [10.98513, 47.42882], [10.92437, 47.46991], [10.93839, 47.48018], [10.90918, 47.48571], [10.87061, 47.4786], [10.86945, 47.5015], [10.91268, 47.51334], [10.88814, 47.53701], [10.77596, 47.51729], [10.7596, 47.53228], [10.6965, 47.54253], [10.68832, 47.55752], [10.63456, 47.5591], [10.60337, 47.56755], [10.56912, 47.53584], [10.48849, 47.54057], [10.47329, 47.58552], [10.43473, 47.58394], [10.44992, 47.5524], [10.4324, 47.50111], [10.44291, 47.48453], [10.46278, 47.47901], [10.47446, 47.43318], [10.4359, 47.41183], [10.4324, 47.38494], [10.39851, 47.37623], [10.33424, 47.30813], [10.23257, 47.27088], [10.17531, 47.27167], [10.17648, 47.29149], [10.2147, 47.31014], [10.19998, 47.32832], [10.23757, 47.37609], [10.22774, 47.38904], [10.2127, 47.38019], [10.17648, 47.38889], [10.16362, 47.36674], [10.11805, 47.37228], [10.09819, 47.35724], [10.06897, 47.40709], [10.1052, 47.4316], [10.09001, 47.46005], [10.07131, 47.45531], [10.03859, 47.48927], [10.00003, 47.48216], [9.96029, 47.53899], [9.92407, 47.53111], [9.87733, 47.54688], [9.87499, 47.52953], [9.8189, 47.54688], [9.82591, 47.58158], [9.80254, 47.59419], [9.76748, 47.5934], [9.72736, 47.53457], [9.55125, 47.53629], [9.56312, 47.49495], [9.58208, 47.48344], [9.59482, 47.46305], [9.60205, 47.46165], [9.60484, 47.46358], [9.60841, 47.47178], [9.62158, 47.45858], [9.62475, 47.45685], [9.6423, 47.45599], [9.65728, 47.45383], [9.65863, 47.44847], [9.64483, 47.43842], [9.6446, 47.43233], [9.65043, 47.41937], [9.65136, 47.40504], [9.6629, 47.39591], [9.67334, 47.39191], [9.67445, 47.38429], [9.6711, 47.37824], [9.66243, 47.37136], [9.65427, 47.36824], [9.62476, 47.36639], [9.59978, 47.34671], [9.58513, 47.31334], [9.55857, 47.29919], [9.54773, 47.2809], [9.53116, 47.27029], [9.56766, 47.24281], [9.55176, 47.22585], [9.56981, 47.21926], [9.58264, 47.20673], [9.56539, 47.17124], [9.62623, 47.14685], [9.63395, 47.08443], [9.61216, 47.07732], [9.60717, 47.06091], [9.87935, 47.01337], [9.88266, 46.93343], [9.98058, 46.91434], [10.10715, 46.84296], [10.22675, 46.86942], [10.24128, 46.93147], [10.30031, 46.92093], [10.36933, 47.00212], [10.48376, 46.93891], [10.47197, 46.85698], [10.54783, 46.84505], [10.66405, 46.87614], [10.75753, 46.82258], [10.72974, 46.78972], [11.00764, 46.76896], [11.10618, 46.92966], [11.33355, 46.99862], [11.50739, 47.00644], [11.74789, 46.98484], [12.19254, 47.09331], [12.21781, 47.03996], [12.11675, 47.01241], [12.2006, 46.88854], [12.27591, 46.88651], [12.38708, 46.71529], [12.59992, 46.6595], [12.94445, 46.60401], [13.27627, 46.56059], [13.64088, 46.53438], [13.7148, 46.5222], [13.89837, 46.52331], [14.00422, 46.48474], [14.04002, 46.49117], [14.12097, 46.47724], [14.15989, 46.43327], [14.28326, 46.44315], [14.314, 46.43327], [14.42608, 46.44614], [14.45877, 46.41717], [14.52176, 46.42617], [14.56463, 46.37208], [14.5942, 46.43434], [14.66892, 46.44936], [14.72185, 46.49974], [14.81836, 46.51046], [14.83549, 46.56614], [14.86419, 46.59411], [14.87129, 46.61], [14.92283, 46.60848], [14.96002, 46.63459], [14.98024, 46.6009], [15.01451, 46.641], [15.14215, 46.66131], [15.23711, 46.63994], [15.41235, 46.65556], [15.45514, 46.63697], [15.46906, 46.61321], [15.54431, 46.6312], [15.55333, 46.64988], [15.54533, 46.66985], [15.59826, 46.68908], [15.62317, 46.67947], [15.63255, 46.68069], [15.6365, 46.6894], [15.6543, 46.69228], [15.6543, 46.70616], [15.67411, 46.70735], [15.69523, 46.69823], [15.72279, 46.69548], [15.73823, 46.70011], [15.76771, 46.69863], [15.78518, 46.70712], [15.8162, 46.71897], [15.87691, 46.7211], [15.94864, 46.68769], [15.98512, 46.68463], [15.99988, 46.67947], [16.04036, 46.6549], [16.04347, 46.68694], [16.02808, 46.71094], [15.99769, 46.7266], [15.98432, 46.74991], [15.99126, 46.78199], [15.99054, 46.82772], [16.05786, 46.83927], [16.10983, 46.867], [16.19904, 46.94134], [16.22403, 46.939], [16.27594, 46.9643], [16.28202, 47.00159], [16.51369, 47.00084], [16.43936, 47.03548], [16.52176, 47.05747], [16.46134, 47.09395], [16.52863, 47.13974], [16.44932, 47.14418], [16.46442, 47.16845], [16.4523, 47.18812], [16.42801, 47.18422], [16.41739, 47.20649], [16.43663, 47.21127], [16.44142, 47.25079], [16.47782, 47.25918], [16.45104, 47.41181], [16.49908, 47.39416], [16.52414, 47.41007], [16.57152, 47.40868], [16.6718, 47.46139], [16.64821, 47.50155], [16.71059, 47.52692], [16.64193, 47.63114], [16.58699, 47.61772], [16.4222, 47.66537], [16.55129, 47.72268], [16.53514, 47.73837], [16.54779, 47.75074], [16.61183, 47.76171], [16.65679, 47.74197], [16.72089, 47.73469], [16.7511, 47.67878], [16.82938, 47.68432], [16.86509, 47.72268], [16.87538, 47.68895], [17.08893, 47.70928], [17.05048, 47.79377], [17.07039, 47.81129], [17.00997, 47.86245], [17.08275, 47.87719], [17.11022, 47.92461], [17.09786, 47.97336], [17.16001, 48.00636], [17.07039, 48.0317], [17.09168, 48.09366], [17.05735, 48.14179], [17.02919, 48.13996], [16.97701, 48.17385], [16.89461, 48.31332], [16.90903, 48.32519], [16.84243, 48.35258], [16.83317, 48.38138], [16.83588, 48.3844], [16.8497, 48.38321], [16.85204, 48.44968], [16.94611, 48.53614], [16.93955, 48.60371], [16.90354, 48.71541], [16.79779, 48.70998], [16.71883, 48.73806], [16.68518, 48.7281], [16.67008, 48.77699], [16.46134, 48.80865], [16.40915, 48.74576], [16.37345, 48.729], [16.06034, 48.75436], [15.84404, 48.86921], [15.78087, 48.87644], [15.75341, 48.8516], [15.6921, 48.85973], [15.61622, 48.89541], [15.51357, 48.91549], [15.48027, 48.94481], [15.34823, 48.98444]]]] } },
22677 { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
22678 { type: "Feature", properties: { iso1A2: "AW", iso1A3: "ABW", iso1N3: "533", wikidata: "Q21203", nameEn: "Aruba", aliases: ["NL-AW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["297"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-70.00823, 12.98375], [-70.35625, 12.58277], [-69.60231, 12.17], [-70.00823, 12.98375]]]] } },
22679 { type: "Feature", properties: { iso1A2: "AX", iso1A3: "ALA", iso1N3: "248", wikidata: "Q5689", nameEn: "\xC5land Islands", country: "FI", groups: ["EU", "154", "150", "UN"], callingCodes: ["358 18", "358 457"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.08191, 60.19152], [20.5104, 59.15546], [21.35468, 59.67511], [21.02509, 60.12142], [21.08159, 60.20167], [21.15143, 60.54555], [20.96741, 60.71528], [19.23413, 60.61414], [19.08191, 60.19152]]]] } },
22680 { type: "Feature", properties: { iso1A2: "AZ", iso1A3: "AZE", iso1N3: "031", wikidata: "Q227", nameEn: "Azerbaijan", groups: ["145", "142", "UN"], callingCodes: ["994"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [46.3984, 41.84399], [46.30863, 41.79133], [46.23962, 41.75811], [46.20538, 41.77205], [46.17891, 41.72094], [46.19759, 41.62327], [46.24429, 41.59883], [46.26531, 41.63339], [46.28182, 41.60089], [46.3253, 41.60912], [46.34039, 41.5947], [46.34126, 41.57454], [46.29794, 41.5724], [46.33925, 41.4963], [46.40307, 41.48464], [46.4669, 41.43331], [46.63658, 41.37727], [46.72375, 41.28609], [46.66148, 41.20533], [46.63969, 41.09515], [46.55096, 41.1104], [46.48558, 41.0576], [46.456, 41.09984], [46.37661, 41.10805], [46.27698, 41.19011], [46.13221, 41.19479], [45.95786, 41.17956], [45.80842, 41.2229], [45.69946, 41.29545], [45.75705, 41.35157], [45.71035, 41.36208], [45.68389, 41.3539], [45.45973, 41.45898], [45.4006, 41.42402], [45.31352, 41.47168], [45.26285, 41.46433], [45.1797, 41.42231], [45.09867, 41.34065], [45.0133, 41.29747], [45.05497, 41.2464], [45.02932, 41.2101], [45.05201, 41.19211], [45.11811, 41.19967], [45.1969, 41.168], [45.19942, 41.13299], [45.08028, 41.10917], [45.06784, 41.05379], [45.12923, 41.06059], [45.1313, 41.09369], [45.1634, 41.08082], [45.16493, 41.05068], [45.1994, 41.04518], [45.25897, 41.0027], [45.26162, 41.0228], [45.28859, 41.03757], [45.35677, 40.99784], [45.39725, 41.02603], [45.44083, 41.01663], [45.40814, 40.97904], [45.60584, 40.87436], [45.55914, 40.78366], [45.4206, 40.7424], [45.35366, 40.65979], [45.45484, 40.57707], [45.42994, 40.53804], [45.65098, 40.37696], [45.95609, 40.27846], [45.97944, 40.181], [45.83779, 39.98925], [45.78642, 40.03218], [45.59806, 40.0131], [45.60895, 39.97733], [45.7833, 39.9475], [45.82533, 39.82925], [45.96543, 39.78859], [46.18493, 39.60533], [46.40286, 39.63651], [46.42465, 39.57534], [46.52117, 39.58734], [46.57098, 39.56694], [46.57721, 39.54414], [46.51027, 39.52373], [46.53051, 39.47809], [46.4013, 39.45405], [46.37795, 39.42039], [46.43244, 39.35181], [46.50093, 39.33736], [46.56476, 39.24942], [46.63481, 39.23013], [46.58032, 39.21204], [46.54141, 39.15895], [46.52584, 39.18912], [46.44022, 39.19636], [46.54296, 39.07078], [46.51805, 38.94982], [46.53497, 38.86548], [46.75752, 39.03231], [46.83822, 39.13143], [46.92539, 39.16644], [46.95341, 39.13505], [47.05771, 39.20143], [47.05927, 39.24846], [47.31301, 39.37492], [47.38978, 39.45999], [47.50099, 39.49615], [47.84774, 39.66285], [47.98977, 39.70999], [48.34264, 39.42935], [48.37385, 39.37584], [48.15984, 39.30028], [48.12404, 39.25208], [48.15361, 39.19419], [48.31239, 39.09278], [48.33884, 39.03022], [48.28437, 38.97186], [48.08627, 38.94434], [48.07734, 38.91616], [48.01409, 38.90333], [48.02581, 38.82705], [48.24773, 38.71883], [48.3146, 38.59958], [48.45084, 38.61013], [48.58793, 38.45076], [48.62217, 38.40198], [48.70001, 38.40564], [48.78979, 38.45026], [48.81072, 38.44853], [48.84969, 38.45015], [48.88288, 38.43975], [52.39847, 39.43556], [48.80971, 41.95365], [48.5867, 41.84306], [48.55078, 41.77917], [48.42301, 41.65444], [48.40277, 41.60441], [48.2878, 41.56221], [48.22064, 41.51472], [48.07587, 41.49957], [47.87973, 41.21798], [47.75831, 41.19455], [47.62288, 41.22969], [47.54504, 41.20275], [47.49004, 41.26366], [47.34579, 41.27884], [47.10762, 41.59044], [47.03757, 41.55434], [46.99554, 41.59743], [47.00955, 41.63583], [46.8134, 41.76252], [46.75269, 41.8623], [46.58924, 41.80547], [46.5332, 41.87389], [46.42738, 41.91323]], [[45.50279, 40.58424], [45.47927, 40.65023], [45.51825, 40.67382], [45.56071, 40.64765], [45.50279, 40.58424]]], [[[45.00864, 41.03411], [45.03792, 41.03938], [45.04517, 41.06653], [45.03406, 41.07931], [45.00864, 41.09407], [44.97169, 41.09176], [44.95383, 41.07553], [44.96031, 41.06345], [44.9903, 41.05657], [45.00864, 41.03411]]], [[[45.21324, 40.9817], [45.23095, 40.97828], [45.23487, 41.00226], [45.20625, 41.01484], [45.18382, 41.0066], [45.19312, 40.98998], [45.20518, 40.99348], [45.21219, 40.99001], [45.21324, 40.9817]]], [[[45.46992, 39.49888], [45.29606, 39.57654], [45.30385, 39.61373], [45.23535, 39.61373], [45.21784, 39.58074], [45.17464, 39.58614], [45.18554, 39.67846], [45.06604, 39.79277], [44.92869, 39.72157], [44.88354, 39.74432], [44.75779, 39.7148], [44.80977, 39.65768], [44.81043, 39.62677], [44.88916, 39.59653], [44.96746, 39.42998], [45.05932, 39.36435], [45.08751, 39.35052], [45.16168, 39.21952], [45.30489, 39.18333], [45.40148, 39.09007], [45.40452, 39.07224], [45.44811, 39.04927], [45.44966, 38.99243], [45.6131, 38.964], [45.6155, 38.94304], [45.65172, 38.95199], [45.83883, 38.90768], [45.90266, 38.87739], [45.94624, 38.89072], [46.00228, 38.87376], [46.06766, 38.87861], [46.14785, 38.84206], [46.06973, 39.0744], [46.02303, 39.09978], [45.99774, 39.28931], [45.79225, 39.3695], [45.83, 39.46487], [45.80804, 39.56716], [45.70547, 39.60174], [45.46992, 39.49888]]]] } },
22681 { type: "Feature", properties: { iso1A2: "BA", iso1A3: "BIH", iso1N3: "070", wikidata: "Q225", nameEn: "Bosnia and Herzegovina", groups: ["039", "150", "UN"], callingCodes: ["387"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.84826, 45.04489], [17.66571, 45.13408], [17.59104, 45.10816], [17.51469, 45.10791], [17.47589, 45.12656], [17.45615, 45.12523], [17.4498, 45.16119], [17.41229, 45.13335], [17.33573, 45.14521], [17.32092, 45.16246], [17.26815, 45.18444], [17.25131, 45.14957], [17.24325, 45.146], [17.18438, 45.14764], [17.0415, 45.20759], [16.9385, 45.22742], [16.92405, 45.27607], [16.83804, 45.18951], [16.81137, 45.18434], [16.78219, 45.19002], [16.74845, 45.20393], [16.64962, 45.20714], [16.60194, 45.23042], [16.56559, 45.22307], [16.5501, 45.2212], [16.52982, 45.22713], [16.49155, 45.21153], [16.4634, 45.14522], [16.40023, 45.1147], [16.38309, 45.05955], [16.38219, 45.05139], [16.3749, 45.05206], [16.35863, 45.03529], [16.35404, 45.00241], [16.29036, 44.99732], [16.12153, 45.09616], [15.98412, 45.23088], [15.83512, 45.22459], [15.76371, 45.16508], [15.78842, 45.11519], [15.74585, 45.0638], [15.78568, 44.97401], [15.74723, 44.96818], [15.76096, 44.87045], [15.79472, 44.8455], [15.72584, 44.82334], [15.8255, 44.71501], [15.89348, 44.74964], [16.05828, 44.61538], [16.00884, 44.58605], [16.03012, 44.55572], [16.10566, 44.52586], [16.16814, 44.40679], [16.12969, 44.38275], [16.21346, 44.35231], [16.18688, 44.27012], [16.36864, 44.08263], [16.43662, 44.07523], [16.43629, 44.02826], [16.50528, 44.0244], [16.55472, 43.95326], [16.70922, 43.84887], [16.75316, 43.77157], [16.80736, 43.76011], [17.00585, 43.58037], [17.15828, 43.49376], [17.24411, 43.49376], [17.29699, 43.44542], [17.25579, 43.40353], [17.286, 43.33065], [17.46986, 43.16559], [17.64268, 43.08595], [17.70879, 42.97223], [17.5392, 42.92787], [17.6444, 42.88641], [17.68151, 42.92725], [17.7948, 42.89556], [17.80854, 42.9182], [17.88201, 42.83668], [18.24318, 42.6112], [18.36197, 42.61423], [18.43735, 42.55921], [18.49778, 42.58409], [18.53751, 42.57376], [18.55504, 42.58409], [18.52232, 42.62279], [18.57373, 42.64429], [18.54841, 42.68328], [18.54603, 42.69171], [18.55221, 42.69045], [18.56789, 42.72074], [18.47324, 42.74992], [18.45921, 42.81682], [18.47633, 42.85829], [18.4935, 42.86433], [18.49661, 42.89306], [18.49076, 42.95553], [18.52232, 43.01451], [18.66254, 43.03928], [18.64735, 43.14766], [18.66605, 43.2056], [18.71747, 43.2286], [18.6976, 43.25243], [18.76538, 43.29838], [18.85342, 43.32426], [18.84794, 43.33735], [18.83912, 43.34795], [18.90911, 43.36383], [18.95819, 43.32899], [18.95001, 43.29327], [19.00844, 43.24988], [19.04233, 43.30008], [19.08206, 43.29668], [19.08673, 43.31453], [19.04071, 43.397], [19.01078, 43.43854], [18.96053, 43.45042], [18.95469, 43.49367], [18.91379, 43.50299], [19.01078, 43.55806], [19.04934, 43.50384], [19.13933, 43.5282], [19.15685, 43.53943], [19.22807, 43.5264], [19.24774, 43.53061], [19.2553, 43.5938], [19.33426, 43.58833], [19.36653, 43.60921], [19.41941, 43.54056], [19.42696, 43.57987], [19.50455, 43.58385], [19.5176, 43.71403], [19.3986, 43.79668], [19.23465, 43.98764], [19.24363, 44.01502], [19.38439, 43.96611], [19.52515, 43.95573], [19.56498, 43.99922], [19.61836, 44.01464], [19.61991, 44.05254], [19.57467, 44.04716], [19.55999, 44.06894], [19.51167, 44.08158], [19.47321, 44.1193], [19.48386, 44.14332], [19.47338, 44.15034], [19.43905, 44.13088], [19.40927, 44.16722], [19.3588, 44.18353], [19.34773, 44.23244], [19.32464, 44.27185], [19.26945, 44.26957], [19.23306, 44.26097], [19.20508, 44.2917], [19.18328, 44.28383], [19.16741, 44.28648], [19.13332, 44.31492], [19.13556, 44.338], [19.11547, 44.34218], [19.1083, 44.3558], [19.11865, 44.36712], [19.10298, 44.36924], [19.10365, 44.37795], [19.10704, 44.38249], [19.10749, 44.39421], [19.11785, 44.40313], [19.14681, 44.41463], [19.14837, 44.45253], [19.12278, 44.50132], [19.13369, 44.52521], [19.16699, 44.52197], [19.26388, 44.65412], [19.32543, 44.74058], [19.36722, 44.88164], [19.18183, 44.92055], [19.01994, 44.85493], [18.8704, 44.85097], [18.76347, 44.90669], [18.76369, 44.93707], [18.80661, 44.93561], [18.78357, 44.97741], [18.65723, 45.07544], [18.47939, 45.05871], [18.41896, 45.11083], [18.32077, 45.1021], [18.24387, 45.13699], [18.1624, 45.07654], [18.03121, 45.12632], [18.01594, 45.15163], [17.99479, 45.14958], [17.97834, 45.13831], [17.97336, 45.12245], [17.93706, 45.08016], [17.87148, 45.04645], [17.84826, 45.04489]]]] } },
22682 { type: "Feature", properties: { iso1A2: "BB", iso1A3: "BRB", iso1N3: "052", wikidata: "Q244", nameEn: "Barbados", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.56442, 13.24471], [-59.80731, 13.87556], [-59.82929, 12.70644], [-58.56442, 13.24471]]]] } },
22683 { type: "Feature", properties: { iso1A2: "BD", iso1A3: "BGD", iso1N3: "050", wikidata: "Q902", nameEn: "Bangladesh", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["880"] }, geometry: { type: "MultiPolygon", coordinates: [[[[89.15869, 26.13708], [89.08899, 26.38845], [88.95612, 26.4564], [88.92357, 26.40711], [88.91321, 26.37984], [89.05328, 26.2469], [88.85004, 26.23211], [88.78961, 26.31093], [88.67837, 26.26291], [88.69485, 26.38353], [88.62144, 26.46783], [88.4298, 26.54489], [88.41196, 26.63837], [88.33093, 26.48929], [88.35153, 26.45241], [88.36938, 26.48683], [88.48749, 26.45855], [88.51649, 26.35923], [88.35153, 26.29123], [88.34757, 26.22216], [88.1844, 26.14417], [88.16581, 26.0238], [88.08804, 25.91334], [88.13138, 25.78773], [88.242, 25.80811], [88.45103, 25.66245], [88.4559, 25.59227], [88.677, 25.46959], [88.81296, 25.51546], [88.85278, 25.34679], [89.01105, 25.30303], [89.00463, 25.26583], [88.94067, 25.18534], [88.44766, 25.20149], [88.46277, 25.07468], [88.33917, 24.86803], [88.27325, 24.88796], [88.21832, 24.96642], [88.14004, 24.93529], [88.15515, 24.85806], [88.00683, 24.66477], [88.08786, 24.63232], [88.12296, 24.51301], [88.50934, 24.32474], [88.68801, 24.31464], [88.74841, 24.1959], [88.6976, 24.14703], [88.73743, 23.91751], [88.66189, 23.87607], [88.58087, 23.87105], [88.56507, 23.64044], [88.74841, 23.47361], [88.79351, 23.50535], [88.79254, 23.46028], [88.71133, 23.2492], [88.99148, 23.21134], [88.86377, 23.08759], [88.88327, 23.03885], [88.87063, 22.95235], [88.96713, 22.83346], [88.9151, 22.75228], [88.94614, 22.66941], [88.9367, 22.58527], [89.07114, 22.15335], [89.08044, 21.41871], [92.47409, 20.38654], [92.26071, 21.05697], [92.17752, 21.17445], [92.20087, 21.337], [92.37939, 21.47764], [92.43158, 21.37025], [92.55105, 21.3856], [92.60187, 21.24615], [92.68152, 21.28454], [92.59775, 21.6092], [92.62187, 21.87037], [92.60949, 21.97638], [92.56616, 22.13554], [92.60029, 22.1522], [92.5181, 22.71441], [92.37665, 22.9435], [92.38214, 23.28705], [92.26541, 23.70392], [92.15417, 23.73409], [92.04706, 23.64229], [91.95093, 23.73284], [91.95642, 23.47361], [91.84789, 23.42235], [91.76417, 23.26619], [91.81634, 23.08001], [91.7324, 23.00043], [91.61571, 22.93929], [91.54993, 23.01051], [91.46615, 23.2328], [91.4035, 23.27522], [91.40848, 23.07117], [91.36453, 23.06612], [91.28293, 23.37538], [91.15579, 23.6599], [91.25192, 23.83463], [91.22308, 23.89616], [91.29587, 24.0041], [91.35741, 23.99072], [91.37414, 24.10693], [91.55542, 24.08687], [91.63782, 24.1132], [91.65292, 24.22095], [91.73257, 24.14703], [91.76004, 24.23848], [91.82596, 24.22345], [91.89258, 24.14674], [91.96603, 24.3799], [92.11662, 24.38997], [92.15796, 24.54435], [92.25854, 24.9191], [92.38626, 24.86055], [92.49887, 24.88796], [92.39147, 25.01471], [92.33957, 25.07593], [92.0316, 25.1834], [91.63648, 25.12846], [91.25517, 25.20677], [90.87427, 25.15799], [90.65042, 25.17788], [90.40034, 25.1534], [90.1155, 25.22686], [89.90478, 25.31038], [89.87629, 25.28337], [89.83371, 25.29548], [89.84086, 25.31854], [89.81208, 25.37244], [89.86129, 25.61714], [89.84388, 25.70042], [89.80585, 25.82489], [89.86592, 25.93115], [89.77728, 26.04254], [89.77865, 26.08387], [89.73581, 26.15818], [89.70201, 26.15138], [89.63968, 26.22595], [89.57101, 25.9682], [89.53515, 26.00382], [89.35953, 26.0077], [89.15869, 26.13708]]]] } },
22684 { type: "Feature", properties: { iso1A2: "BE", iso1A3: "BEL", iso1N3: "056", wikidata: "Q31", nameEn: "Belgium", groups: ["EU", "155", "150", "UN"], callingCodes: ["32"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.93295, 51.44945], [4.93909, 51.44632], [4.9524, 51.45014], [4.95244, 51.45207], [4.93295, 51.44945]]], [[[4.91493, 51.4353], [4.92652, 51.43329], [4.92952, 51.42984], [4.93986, 51.43064], [4.94265, 51.44003], [4.93471, 51.43861], [4.93416, 51.44185], [4.94025, 51.44193], [4.93544, 51.44634], [4.92879, 51.44161], [4.92815, 51.43856], [4.92566, 51.44273], [4.92811, 51.4437], [4.92287, 51.44741], [4.91811, 51.44621], [4.92227, 51.44252], [4.91935, 51.43634], [4.91493, 51.4353]]], [[[4.82946, 51.4213], [4.82409, 51.44736], [4.84139, 51.4799], [4.78803, 51.50284], [4.77321, 51.50529], [4.74578, 51.48937], [4.72935, 51.48424], [4.65442, 51.42352], [4.57489, 51.4324], [4.53521, 51.4243], [4.52846, 51.45002], [4.54675, 51.47265], [4.5388, 51.48184], [4.47736, 51.4778], [4.38122, 51.44905], [4.39747, 51.43316], [4.38064, 51.41965], [4.43777, 51.36989], [4.39292, 51.35547], [4.34086, 51.35738], [4.33265, 51.37687], [4.21923, 51.37443], [4.24024, 51.35371], [4.16721, 51.29348], [4.05165, 51.24171], [4.01957, 51.24504], [3.97889, 51.22537], [3.90125, 51.20371], [3.78783, 51.2151], [3.78999, 51.25766], [3.58939, 51.30064], [3.51502, 51.28697], [3.52698, 51.2458], [3.43488, 51.24135], [3.41704, 51.25933], [3.38289, 51.27331], [3.35847, 51.31572], [3.38696, 51.33436], [3.36263, 51.37112], [2.56575, 51.85301], [2.18458, 51.52087], [2.55904, 51.07014], [2.57551, 51.00326], [2.63074, 50.94746], [2.59093, 50.91751], [2.63331, 50.81457], [2.71165, 50.81295], [2.81056, 50.71773], [2.8483, 50.72276], [2.86985, 50.7033], [2.87937, 50.70298], [2.88504, 50.70656], [2.90069, 50.69263], [2.91036, 50.6939], [2.90873, 50.702], [2.95019, 50.75138], [2.96778, 50.75242], [3.00537, 50.76588], [3.04314, 50.77674], [3.09163, 50.77717], [3.10614, 50.78303], [3.11206, 50.79416], [3.11987, 50.79188], [3.1257, 50.78603], [3.15017, 50.79031], [3.16476, 50.76843], [3.18339, 50.74981], [3.18811, 50.74025], [3.20064, 50.73547], [3.19017, 50.72569], [3.20845, 50.71662], [3.22042, 50.71019], [3.24593, 50.71389], [3.26063, 50.70086], [3.26141, 50.69151], [3.2536, 50.68977], [3.264, 50.67668], [3.23951, 50.6585], [3.2729, 50.60718], [3.28575, 50.52724], [3.37693, 50.49538], [3.44629, 50.51009], [3.47385, 50.53397], [3.51564, 50.5256], [3.49509, 50.48885], [3.5683, 50.50192], [3.58361, 50.49049], [3.61014, 50.49568], [3.64426, 50.46275], [3.66153, 50.45165], [3.67494, 50.40239], [3.67262, 50.38663], [3.65709, 50.36873], [3.66976, 50.34563], [3.71009, 50.30305], [3.70987, 50.3191], [3.73911, 50.34809], [3.84314, 50.35219], [3.90781, 50.32814], [3.96771, 50.34989], [4.0268, 50.35793], [4.0689, 50.3254], [4.10237, 50.31247], [4.10957, 50.30234], [4.11954, 50.30425], [4.13665, 50.25609], [4.16808, 50.25786], [4.15524, 50.2833], [4.17347, 50.28838], [4.17861, 50.27443], [4.20651, 50.27333], [4.21945, 50.25539], [4.15524, 50.21103], [4.16014, 50.19239], [4.13561, 50.13078], [4.20147, 50.13535], [4.23101, 50.06945], [4.16294, 50.04719], [4.13508, 50.01976], [4.14239, 49.98034], [4.20532, 49.95803], [4.31963, 49.97043], [4.35051, 49.95315], [4.43488, 49.94122], [4.51098, 49.94659], [4.5414, 49.96911], [4.68695, 49.99685], [4.70064, 50.09384], [4.75237, 50.11314], [4.82438, 50.16878], [4.83279, 50.15331], [4.88602, 50.15182], [4.8382, 50.06738], [4.78827, 49.95609], [4.88529, 49.9236], [4.85134, 49.86457], [4.86965, 49.82271], [4.85464, 49.78995], [4.96714, 49.79872], [5.09249, 49.76193], [5.14545, 49.70287], [5.26232, 49.69456], [5.31465, 49.66846], [5.33039, 49.6555], [5.30214, 49.63055], [5.3137, 49.61225], [5.33851, 49.61599], [5.34837, 49.62889], [5.3974, 49.61596], [5.43713, 49.5707], [5.46734, 49.52648], [5.46541, 49.49825], [5.55001, 49.52729], [5.60909, 49.51228], [5.64505, 49.55146], [5.75649, 49.54321], [5.7577, 49.55915], [5.77435, 49.56298], [5.79195, 49.55228], [5.81838, 49.54777], [5.84143, 49.5533], [5.84692, 49.55663], [5.8424, 49.56082], [5.87256, 49.57539], [5.86986, 49.58756], [5.84971, 49.58674], [5.84826, 49.5969], [5.8762, 49.60898], [5.87609, 49.62047], [5.88393, 49.62802], [5.88552, 49.63507], [5.90599, 49.63853], [5.90164, 49.6511], [5.9069, 49.66377], [5.86175, 49.67862], [5.86527, 49.69291], [5.88677, 49.70951], [5.86503, 49.72739], [5.84193, 49.72161], [5.82562, 49.72395], [5.83149, 49.74729], [5.82245, 49.75048], [5.78871, 49.7962], [5.75409, 49.79239], [5.74953, 49.81428], [5.74364, 49.82058], [5.74844, 49.82435], [5.7404, 49.83452], [5.74076, 49.83823], [5.74975, 49.83933], [5.74953, 49.84709], [5.75884, 49.84811], [5.74567, 49.85368], [5.75861, 49.85631], [5.75269, 49.8711], [5.78415, 49.87922], [5.73621, 49.89796], [5.77314, 49.93646], [5.77291, 49.96056], [5.80833, 49.96451], [5.81163, 49.97142], [5.83467, 49.97823], [5.83968, 49.9892], [5.82331, 49.99662], [5.81866, 50.01286], [5.8551, 50.02683], [5.86904, 50.04614], [5.85474, 50.06342], [5.8857, 50.07824], [5.89488, 50.11476], [5.95929, 50.13295], [5.96453, 50.17259], [6.02488, 50.18283], [6.03093, 50.16362], [6.06406, 50.15344], [6.08577, 50.17246], [6.12028, 50.16374], [6.1137, 50.13668], [6.1379, 50.12964], [6.15298, 50.14126], [6.14132, 50.14971], [6.14588, 50.17106], [6.18739, 50.1822], [6.18364, 50.20815], [6.16853, 50.2234], [6.208, 50.25179], [6.28797, 50.27458], [6.29949, 50.30887], [6.32488, 50.32333], [6.35701, 50.31139], [6.40641, 50.32425], [6.40785, 50.33557], [6.3688, 50.35898], [6.34406, 50.37994], [6.36852, 50.40776], [6.37219, 50.45397], [6.34005, 50.46083], [6.3465, 50.48833], [6.30809, 50.50058], [6.26637, 50.50272], [6.22335, 50.49578], [6.20599, 50.52089], [6.19193, 50.5212], [6.18716, 50.52653], [6.19579, 50.5313], [6.19735, 50.53576], [6.17802, 50.54179], [6.17739, 50.55875], [6.20281, 50.56952], [6.22581, 50.5907], [6.24005, 50.58732], [6.24888, 50.59869], [6.2476, 50.60392], [6.26957, 50.62444], [6.17852, 50.6245], [6.11707, 50.72231], [6.04428, 50.72861], [6.0406, 50.71848], [6.0326, 50.72647], [6.03889, 50.74618], [6.01976, 50.75398], [5.97545, 50.75441], [5.95942, 50.7622], [5.89132, 50.75124], [5.89129, 50.75125], [5.88734, 50.77092], [5.84888, 50.75448], [5.84548, 50.76542], [5.80673, 50.7558], [5.77513, 50.78308], [5.76533, 50.78159], [5.74356, 50.7691], [5.73904, 50.75674], [5.72216, 50.76398], [5.69469, 50.75529], [5.68091, 50.75804], [5.70107, 50.7827], [5.68995, 50.79641], [5.70118, 50.80764], [5.65259, 50.82309], [5.64009, 50.84742], [5.64504, 50.87107], [5.67886, 50.88142], [5.69858, 50.91046], [5.71626, 50.90796], [5.72644, 50.91167], [5.72545, 50.92312], [5.74644, 50.94723], [5.75927, 50.95601], [5.74752, 50.96202], [5.72875, 50.95428], [5.71864, 50.96092], [5.76242, 50.99703], [5.77688, 51.02483], [5.75961, 51.03113], [5.77258, 51.06196], [5.79835, 51.05834], [5.79903, 51.09371], [5.82921, 51.09328], [5.83226, 51.10585], [5.8109, 51.10861], [5.80798, 51.11661], [5.85508, 51.14445], [5.82564, 51.16753], [5.77697, 51.1522], [5.77735, 51.17845], [5.74617, 51.18928], [5.70344, 51.1829], [5.65528, 51.18736], [5.65145, 51.19788], [5.5603, 51.22249], [5.5569, 51.26544], [5.515, 51.29462], [5.48476, 51.30053], [5.46519, 51.2849], [5.4407, 51.28169], [5.41672, 51.26248], [5.347, 51.27502], [5.33886, 51.26314], [5.29716, 51.26104], [5.26461, 51.26693], [5.23814, 51.26064], [5.22542, 51.26888], [5.24244, 51.30495], [5.2002, 51.32243], [5.16222, 51.31035], [5.13377, 51.31592], [5.13105, 51.34791], [5.07102, 51.39469], [5.10456, 51.43163], [5.07891, 51.4715], [5.04774, 51.47022], [5.03281, 51.48679], [5.0106, 51.47167], [5.00393, 51.44406], [4.92152, 51.39487], [4.90016, 51.41404], [4.84988, 51.41502], [4.78941, 51.41102], [4.77229, 51.41337], [4.76577, 51.43046], [4.78314, 51.43319], [4.82946, 51.4213]]]] } },
22685 { type: "Feature", properties: { iso1A2: "BF", iso1A3: "BFA", iso1N3: "854", wikidata: "Q965", nameEn: "Burkina Faso", groups: ["011", "202", "002", "UN"], callingCodes: ["226"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.23859, 15.00135], [0.06588, 14.96961], [-0.24673, 15.07805], [-0.72004, 15.08655], [-1.05875, 14.7921], [-1.32166, 14.72774], [-1.68083, 14.50023], [-1.97945, 14.47709], [-1.9992, 14.19011], [-2.10223, 14.14878], [-2.47587, 14.29671], [-2.66175, 14.14713], [-2.84667, 14.05532], [-2.90831, 13.81174], [-2.88189, 13.64921], [-3.26407, 13.70699], [-3.28396, 13.5422], [-3.23599, 13.29035], [-3.43507, 13.27272], [-3.4313, 13.1588], [-3.54454, 13.1781], [-3.7911, 13.36665], [-3.96282, 13.38164], [-3.90558, 13.44375], [-3.96501, 13.49778], [-4.34477, 13.12927], [-4.21819, 12.95722], [-4.238, 12.71467], [-4.47356, 12.71252], [-4.41412, 12.31922], [-4.57703, 12.19875], [-4.54841, 12.1385], [-4.62546, 12.13204], [-4.62987, 12.06531], [-4.70692, 12.06746], [-4.72893, 12.01579], [-5.07897, 11.97918], [-5.26389, 11.84778], [-5.40258, 11.8327], [-5.26389, 11.75728], [-5.29251, 11.61715], [-5.22867, 11.60421], [-5.20665, 11.43811], [-5.25509, 11.36905], [-5.25949, 11.24816], [-5.32553, 11.21578], [-5.32994, 11.13371], [-5.49284, 11.07538], [-5.41579, 10.84628], [-5.47083, 10.75329], [-5.46643, 10.56074], [-5.51058, 10.43177], [-5.39602, 10.2929], [-5.12465, 10.29788], [-4.96453, 9.99923], [-4.96621, 9.89132], [-4.6426, 9.70696], [-4.31392, 9.60062], [-4.25999, 9.76012], [-3.69703, 9.94279], [-3.31779, 9.91125], [-3.27228, 9.84981], [-3.19306, 9.93781], [-3.16609, 9.85147], [-3.00765, 9.74019], [-2.93012, 9.57403], [-2.76494, 9.40778], [-2.68802, 9.49343], [-2.76534, 9.56589], [-2.74174, 9.83172], [-2.83108, 10.40252], [-2.94232, 10.64281], [-2.83373, 11.0067], [-0.67143, 10.99811], [-0.61937, 10.91305], [-0.44298, 11.04292], [-0.42391, 11.11661], [-0.38219, 11.12596], [-0.35955, 11.07801], [-0.28566, 11.12713], [-0.27374, 11.17157], [-0.13493, 11.14075], [0.50388, 11.01011], [0.48852, 10.98561], [0.50521, 10.98035], [0.4958, 10.93269], [0.66104, 10.99964], [0.91245, 10.99597], [0.9813, 11.08876], [1.03409, 11.04719], [1.42823, 11.46822], [2.00988, 11.42227], [2.29983, 11.68254], [2.39723, 11.89473], [2.05785, 12.35539], [2.26349, 12.41915], [0.99167, 13.10727], [0.99253, 13.37515], [1.18873, 13.31771], [1.21217, 13.37853], [1.24516, 13.33968], [1.28509, 13.35488], [1.24429, 13.39373], [1.20088, 13.38951], [1.02813, 13.46635], [0.99514, 13.5668], [0.77637, 13.64442], [0.77377, 13.6866], [0.61924, 13.68491], [0.38051, 14.05575], [0.16936, 14.51654], [0.23859, 15.00135]]]] } },
22686 { type: "Feature", properties: { iso1A2: "BG", iso1A3: "BGR", iso1N3: "100", wikidata: "Q219", nameEn: "Bulgaria", groups: ["EU", "151", "150", "UN"], callingCodes: ["359"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.05288, 43.79494], [22.85314, 43.84452], [22.83753, 43.88055], [22.87873, 43.9844], [23.01674, 44.01946], [23.04988, 44.07694], [22.67173, 44.21564], [22.61711, 44.16938], [22.61688, 44.06534], [22.41449, 44.00514], [22.35558, 43.81281], [22.41043, 43.69566], [22.47582, 43.6558], [22.53397, 43.47225], [22.82036, 43.33665], [22.89727, 43.22417], [23.00806, 43.19279], [22.98104, 43.11199], [22.89521, 43.03625], [22.78397, 42.98253], [22.74826, 42.88701], [22.54302, 42.87774], [22.43309, 42.82057], [22.4997, 42.74144], [22.43983, 42.56851], [22.55669, 42.50144], [22.51961, 42.3991], [22.47498, 42.3915], [22.45919, 42.33822], [22.34773, 42.31725], [22.38136, 42.30339], [22.47251, 42.20393], [22.50289, 42.19527], [22.51224, 42.15457], [22.67701, 42.06614], [22.86749, 42.02275], [22.90254, 41.87587], [22.96682, 41.77137], [23.01239, 41.76527], [23.03342, 41.71034], [22.95513, 41.63265], [22.96331, 41.35782], [22.93334, 41.34104], [23.1833, 41.31755], [23.21953, 41.33773], [23.22771, 41.37106], [23.31301, 41.40525], [23.33639, 41.36317], [23.40416, 41.39999], [23.52453, 41.40262], [23.63203, 41.37632], [23.67644, 41.41139], [23.76525, 41.40175], [23.80148, 41.43943], [23.89613, 41.45257], [23.91483, 41.47971], [23.96975, 41.44118], [24.06908, 41.46132], [24.06323, 41.53222], [24.10063, 41.54796], [24.18126, 41.51735], [24.27124, 41.57682], [24.30513, 41.51297], [24.52599, 41.56808], [24.61129, 41.42278], [24.71529, 41.41928], [24.8041, 41.34913], [24.82514, 41.4035], [24.86136, 41.39298], [24.90928, 41.40876], [24.942, 41.38685], [25.11611, 41.34212], [25.28322, 41.23411], [25.48187, 41.28506], [25.52394, 41.2798], [25.55082, 41.31667], [25.61042, 41.30614], [25.66183, 41.31316], [25.70507, 41.29209], [25.8266, 41.34563], [25.87919, 41.30526], [26.12926, 41.35878], [26.16548, 41.42278], [26.20288, 41.43943], [26.14796, 41.47533], [26.176, 41.50072], [26.17951, 41.55409], [26.14328, 41.55496], [26.15146, 41.60828], [26.07083, 41.64584], [26.06148, 41.70345], [26.16841, 41.74858], [26.21325, 41.73223], [26.22888, 41.74139], [26.2654, 41.71544], [26.30255, 41.70925], [26.35957, 41.71149], [26.32952, 41.73637], [26.33589, 41.76802], [26.36952, 41.82265], [26.53968, 41.82653], [26.57961, 41.90024], [26.56051, 41.92995], [26.62996, 41.97644], [26.79143, 41.97386], [26.95638, 42.00741], [27.03277, 42.0809], [27.08486, 42.08735], [27.19251, 42.06028], [27.22376, 42.10152], [27.27411, 42.10409], [27.45478, 41.96591], [27.52379, 41.93756], [27.55191, 41.90928], [27.69949, 41.97515], [27.81235, 41.94803], [27.83492, 41.99709], [27.91479, 41.97902], [28.02971, 41.98066], [28.32297, 41.98371], [29.24336, 43.70874], [28.23293, 43.76], [27.99558, 43.84193], [27.92008, 44.00761], [27.73468, 43.95326], [27.64542, 44.04958], [27.60834, 44.01206], [27.39757, 44.0141], [27.26845, 44.12602], [26.95141, 44.13555], [26.62712, 44.05698], [26.38764, 44.04356], [26.10115, 43.96908], [26.05584, 43.90925], [25.94911, 43.85745], [25.72792, 43.69263], [25.39528, 43.61866], [25.17144, 43.70261], [25.10718, 43.6831], [24.96682, 43.72693], [24.73542, 43.68523], [24.62281, 43.74082], [24.50264, 43.76314], [24.35364, 43.70211], [24.18149, 43.68218], [23.73978, 43.80627], [23.61687, 43.79289], [23.4507, 43.84936], [23.26772, 43.84843], [23.05288, 43.79494]]]] } },
22687 { type: "Feature", properties: { iso1A2: "BH", iso1A3: "BHR", iso1N3: "048", wikidata: "Q398", nameEn: "Bahrain", groups: ["145", "142", "UN"], callingCodes: ["973"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.93865, 26.30758], [50.71771, 26.73086], [50.38162, 26.53976], [50.26923, 26.08243], [50.302, 25.87592], [50.57069, 25.57887], [50.80824, 25.54641], [50.7801, 25.595], [50.86149, 25.6965], [50.81266, 25.88946], [50.93865, 26.30758]]]] } },
22688 { type: "Feature", properties: { iso1A2: "BI", iso1A3: "BDI", iso1N3: "108", wikidata: "Q967", nameEn: "Burundi", groups: ["014", "202", "002", "UN"], callingCodes: ["257"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.54501, -2.41404], [30.42933, -2.31064], [30.14034, -2.43626], [29.95911, -2.33348], [29.88237, -2.75105], [29.36805, -2.82933], [29.32234, -2.6483], [29.0562, -2.58632], [29.04081, -2.7416], [29.00167, -2.78523], [29.00404, -2.81978], [29.0505, -2.81774], [29.09119, -2.87871], [29.09797, -2.91935], [29.16037, -2.95457], [29.17258, -2.99385], [29.25633, -3.05471], [29.21463, -3.3514], [29.23708, -3.75856], [29.43673, -4.44845], [29.63827, -4.44681], [29.75109, -4.45836], [29.77289, -4.41733], [29.82885, -4.36153], [29.88172, -4.35743], [30.03323, -4.26631], [30.22042, -4.01738], [30.45915, -3.56532], [30.84165, -3.25152], [30.83823, -2.97837], [30.6675, -2.98987], [30.57926, -2.89791], [30.4987, -2.9573], [30.40662, -2.86151], [30.52747, -2.65841], [30.41789, -2.66266], [30.54501, -2.41404]]]] } },
22689 { type: "Feature", properties: { iso1A2: "BJ", iso1A3: "BEN", iso1N3: "204", wikidata: "Q962", nameEn: "Benin", aliases: ["DY"], groups: ["011", "202", "002", "UN"], callingCodes: ["229"] }, geometry: { type: "MultiPolygon", coordinates: [[[[3.59375, 11.70269], [3.48187, 11.86092], [3.31613, 11.88495], [3.25352, 12.01467], [2.83978, 12.40585], [2.6593, 12.30631], [2.37783, 12.24804], [2.39657, 12.10952], [2.45824, 11.98672], [2.39723, 11.89473], [2.29983, 11.68254], [2.00988, 11.42227], [1.42823, 11.46822], [1.03409, 11.04719], [0.9813, 11.08876], [0.91245, 10.99597], [0.8804, 10.803], [0.80358, 10.71459], [0.77666, 10.37665], [1.35507, 9.99525], [1.36624, 9.5951], [1.33675, 9.54765], [1.41746, 9.3226], [1.5649, 9.16941], [1.61838, 9.0527], [1.64249, 6.99562], [1.55877, 6.99737], [1.61812, 6.74843], [1.58105, 6.68619], [1.76906, 6.43189], [1.79826, 6.28221], [1.62913, 6.24075], [1.67336, 6.02702], [2.74181, 6.13349], [2.70566, 6.38038], [2.70464, 6.50831], [2.74334, 6.57291], [2.7325, 6.64057], [2.78204, 6.70514], [2.78823, 6.76356], [2.73405, 6.78508], [2.74024, 6.92802], [2.71702, 6.95722], [2.76965, 7.13543], [2.74489, 7.42565], [2.79442, 7.43486], [2.78668, 7.5116], [2.73405, 7.5423], [2.73095, 7.7755], [2.67523, 7.87825], [2.77907, 9.06924], [3.08017, 9.10006], [3.14147, 9.28375], [3.13928, 9.47167], [3.25093, 9.61632], [3.34726, 9.70696], [3.32099, 9.78032], [3.35383, 9.83641], [3.54429, 9.87739], [3.66908, 10.18136], [3.57275, 10.27185], [3.6844, 10.46351], [3.78292, 10.40538], [3.84243, 10.59316], [3.71505, 11.13015], [3.49175, 11.29765], [3.59375, 11.70269]]]] } },
22690 { type: "Feature", properties: { iso1A2: "BL", iso1A3: "BLM", iso1N3: "652", wikidata: "Q25362", nameEn: "Saint-Barth\xE9lemy", country: "FR", groups: ["EU", "Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.62718, 18.26185], [-63.1055, 17.86651], [-62.34423, 17.49165], [-62.62718, 18.26185]]]] } },
22691 { type: "Feature", properties: { iso1A2: "BM", iso1A3: "BMU", iso1N3: "060", wikidata: "Q23635", nameEn: "Bermuda", country: "GB", groups: ["BOTS", "021", "003", "019", "UN"], driveSide: "left", callingCodes: ["1 441"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.20987, 32.6953], [-65.31453, 32.68437], [-65.63955, 31.43417], [-63.20987, 32.6953]]]] } },
22692 { type: "Feature", properties: { iso1A2: "BN", iso1A3: "BRN", iso1N3: "096", wikidata: "Q921", nameEn: "Brunei", groups: ["Q36117", "035", "142", "UN"], driveSide: "left", callingCodes: ["673"] }, geometry: { type: "MultiPolygon", coordinates: [[[[115.16236, 5.01011], [115.02521, 5.35005], [114.10166, 4.76112], [114.07448, 4.58441], [114.15813, 4.57], [114.26876, 4.49878], [114.32176, 4.34942], [114.32176, 4.2552], [114.4416, 4.27588], [114.49922, 4.13108], [114.64211, 4.00694], [114.78539, 4.12205], [114.88039, 4.4257], [114.83189, 4.42387], [114.77303, 4.72871], [114.8266, 4.75062], [114.88841, 4.81905], [114.96982, 4.81146], [114.99417, 4.88201], [115.05038, 4.90275], [115.02955, 4.82087], [115.02278, 4.74137], [115.04064, 4.63706], [115.07737, 4.53418], [115.09978, 4.39123], [115.31275, 4.30806], [115.36346, 4.33563], [115.2851, 4.42295], [115.27819, 4.63661], [115.20737, 4.8256], [115.15092, 4.87604], [115.16236, 5.01011]]]] } },
22693 { type: "Feature", properties: { iso1A2: "BO", iso1A3: "BOL", iso1N3: "068", wikidata: "Q750", nameEn: "Bolivia", groups: ["005", "419", "019", "UN"], callingCodes: ["591"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.90248, -12.52544], [-64.22539, -12.45267], [-64.30708, -12.46398], [-64.99778, -11.98604], [-65.30027, -11.48749], [-65.28141, -10.86289], [-65.35402, -10.78685], [-65.37923, -10.35141], [-65.29019, -9.86253], [-65.40615, -9.63894], [-65.56244, -9.84266], [-65.68343, -9.75323], [-67.17784, -10.34016], [-68.71533, -11.14749], [-68.7651, -11.0496], [-68.75179, -11.03688], [-68.75265, -11.02383], [-68.74802, -11.00891], [-69.42792, -10.93451], [-69.47839, -10.95254], [-69.57156, -10.94555], [-68.98115, -11.8979], [-68.65044, -12.50689], [-68.85615, -12.87769], [-68.8864, -13.40792], [-69.05265, -13.68546], [-68.88135, -14.18639], [-69.36254, -14.94634], [-69.14856, -15.23478], [-69.40336, -15.61358], [-69.20291, -16.16668], [-69.09986, -16.22693], [-68.96238, -16.194], [-68.79464, -16.33272], [-68.98358, -16.42165], [-69.04027, -16.57214], [-69.00853, -16.66769], [-69.16896, -16.72233], [-69.62883, -17.28142], [-69.46863, -17.37466], [-69.46897, -17.4988], [-69.46623, -17.60518], [-69.34126, -17.72753], [-69.28671, -17.94844], [-69.07496, -18.03715], [-69.14807, -18.16893], [-69.07432, -18.28259], [-68.94987, -18.93302], [-68.87082, -19.06003], [-68.80602, -19.08355], [-68.61989, -19.27584], [-68.41218, -19.40499], [-68.66761, -19.72118], [-68.54611, -19.84651], [-68.57132, -20.03134], [-68.74273, -20.08817], [-68.7276, -20.46178], [-68.44023, -20.62701], [-68.55383, -20.7355], [-68.53957, -20.91542], [-68.40403, -20.94562], [-68.18816, -21.28614], [-67.85114, -22.87076], [-67.54284, -22.89771], [-67.18382, -22.81525], [-66.7298, -22.23644], [-66.29714, -22.08741], [-66.24077, -21.77837], [-66.03836, -21.84829], [-66.04832, -21.9187], [-65.9261, -21.93335], [-65.7467, -22.10105], [-65.61166, -22.09504], [-65.58694, -22.09794], [-65.57743, -22.07675], [-65.47435, -22.08908], [-64.99524, -22.08255], [-64.90014, -22.12136], [-64.67174, -22.18957], [-64.58888, -22.25035], [-64.4176, -22.67692], [-64.35108, -22.73282], [-64.31489, -22.88824], [-64.22918, -22.55807], [-63.93287, -21.99934], [-63.70963, -21.99934], [-63.68113, -22.0544], [-63.66482, -21.99918], [-62.81124, -21.9987], [-62.8078, -22.12534], [-62.64455, -22.25091], [-62.2757, -21.06657], [-62.26883, -20.55311], [-61.93912, -20.10053], [-61.73723, -19.63958], [-60.00638, -19.2981], [-59.06965, -19.29148], [-58.23216, -19.80058], [-58.16225, -20.16193], [-57.8496, -19.98346], [-58.14215, -19.76276], [-57.78463, -19.03259], [-57.71113, -19.03161], [-57.69134, -19.00544], [-57.71995, -18.97546], [-57.71995, -18.89573], [-57.76764, -18.90087], [-57.56807, -18.25655], [-57.48237, -18.24219], [-57.69877, -17.8431], [-57.73949, -17.56095], [-57.90082, -17.44555], [-57.99661, -17.5273], [-58.32935, -17.28195], [-58.5058, -16.80958], [-58.30918, -16.3699], [-58.32431, -16.25861], [-58.41506, -16.32636], [-60.16069, -16.26479], [-60.23797, -15.50267], [-60.58224, -15.09887], [-60.23968, -15.09515], [-60.27887, -14.63021], [-60.46037, -14.22496], [-60.48053, -13.77981], [-61.05527, -13.50054], [-61.81151, -13.49564], [-63.76259, -12.42952], [-63.90248, -12.52544]]]] } },
22694 { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
22695 { type: "Feature", properties: { iso1A2: "BR", iso1A3: "BRA", iso1N3: "076", wikidata: "Q155", nameEn: "Brazil", groups: ["005", "419", "019", "UN"], callingCodes: ["55"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.69361, 4.34069], [-59.78878, 4.45637], [-60.15953, 4.53456], [-60.04189, 4.69801], [-59.98129, 5.07097], [-60.20944, 5.28754], [-60.32352, 5.21299], [-60.73204, 5.20931], [-60.5802, 4.94312], [-60.86539, 4.70512], [-60.98303, 4.54167], [-61.15703, 4.49839], [-61.31457, 4.54167], [-61.29675, 4.44216], [-61.48569, 4.43149], [-61.54629, 4.2822], [-62.13094, 4.08309], [-62.44822, 4.18621], [-62.57656, 4.04754], [-62.74411, 4.03331], [-62.7655, 3.73099], [-62.98296, 3.59935], [-63.21111, 3.96219], [-63.4464, 3.9693], [-63.42233, 3.89995], [-63.50611, 3.83592], [-63.67099, 4.01731], [-63.70218, 3.91417], [-63.86082, 3.94796], [-63.99183, 3.90172], [-64.14512, 4.12932], [-64.57648, 4.12576], [-64.72977, 4.28931], [-64.84028, 4.24665], [-64.48379, 3.7879], [-64.02908, 2.79797], [-64.0257, 2.48156], [-63.39114, 2.4317], [-63.39827, 2.16098], [-64.06135, 1.94722], [-64.08274, 1.64792], [-64.34654, 1.35569], [-64.38932, 1.5125], [-65.11657, 1.12046], [-65.57288, 0.62856], [-65.50158, 0.92086], [-65.6727, 1.01353], [-66.28507, 0.74585], [-66.85795, 1.22998], [-67.08222, 1.17441], [-67.15784, 1.80439], [-67.299, 1.87494], [-67.40488, 2.22258], [-67.9292, 1.82455], [-68.18632, 2.00091], [-68.26699, 1.83463], [-68.18128, 1.72881], [-69.38621, 1.70865], [-69.53746, 1.76408], [-69.83491, 1.69353], [-69.82987, 1.07864], [-69.26017, 1.06856], [-69.14422, 0.84172], [-69.20976, 0.57958], [-69.47696, 0.71065], [-70.04162, 0.55437], [-70.03658, -0.19681], [-69.603, -0.51947], [-69.59796, -0.75136], [-69.4215, -1.01853], [-69.43395, -1.42219], [-69.94708, -4.2431], [-70.00888, -4.37833], [-70.11305, -4.27281], [-70.19582, -4.3607], [-70.33236, -4.15214], [-70.77601, -4.15717], [-70.96814, -4.36915], [-71.87003, -4.51661], [-72.64391, -5.0391], [-72.83973, -5.14765], [-73.24579, -6.05764], [-73.12983, -6.43852], [-73.73986, -6.87919], [-73.77011, -7.28944], [-73.96938, -7.58465], [-73.65485, -7.77897], [-73.76576, -7.89884], [-72.92886, -9.04074], [-73.21498, -9.40904], [-72.72216, -9.41397], [-72.31883, -9.5184], [-72.14742, -9.98049], [-71.23394, -9.9668], [-70.53373, -9.42628], [-70.58453, -9.58303], [-70.55429, -9.76692], [-70.62487, -9.80666], [-70.64134, -11.0108], [-70.51395, -10.92249], [-70.38791, -11.07096], [-69.90896, -10.92744], [-69.57835, -10.94051], [-69.57156, -10.94555], [-69.47839, -10.95254], [-69.42792, -10.93451], [-68.74802, -11.00891], [-68.75265, -11.02383], [-68.75179, -11.03688], [-68.7651, -11.0496], [-68.71533, -11.14749], [-67.17784, -10.34016], [-65.68343, -9.75323], [-65.56244, -9.84266], [-65.40615, -9.63894], [-65.29019, -9.86253], [-65.37923, -10.35141], [-65.35402, -10.78685], [-65.28141, -10.86289], [-65.30027, -11.48749], [-64.99778, -11.98604], [-64.30708, -12.46398], [-64.22539, -12.45267], [-63.90248, -12.52544], [-63.76259, -12.42952], [-61.81151, -13.49564], [-61.05527, -13.50054], [-60.48053, -13.77981], [-60.46037, -14.22496], [-60.27887, -14.63021], [-60.23968, -15.09515], [-60.58224, -15.09887], [-60.23797, -15.50267], [-60.16069, -16.26479], [-58.41506, -16.32636], [-58.32431, -16.25861], [-58.30918, -16.3699], [-58.5058, -16.80958], [-58.32935, -17.28195], [-57.99661, -17.5273], [-57.90082, -17.44555], [-57.73949, -17.56095], [-57.69877, -17.8431], [-57.48237, -18.24219], [-57.56807, -18.25655], [-57.76764, -18.90087], [-57.71995, -18.89573], [-57.71995, -18.97546], [-57.69134, -19.00544], [-57.71113, -19.03161], [-57.78463, -19.03259], [-58.14215, -19.76276], [-57.8496, -19.98346], [-58.16225, -20.16193], [-57.84536, -20.93155], [-57.93492, -21.65505], [-57.88239, -21.6868], [-57.94642, -21.73799], [-57.98625, -22.09157], [-56.6508, -22.28387], [-56.5212, -22.11556], [-56.45893, -22.08072], [-56.23206, -22.25347], [-55.8331, -22.29008], [-55.74941, -22.46436], [-55.741, -22.52018], [-55.72366, -22.5519], [-55.6986, -22.56268], [-55.68742, -22.58407], [-55.62493, -22.62765], [-55.63849, -22.95122], [-55.5446, -23.22811], [-55.52288, -23.2595], [-55.5555, -23.28237], [-55.43585, -23.87157], [-55.44117, -23.9185], [-55.41784, -23.9657], [-55.12292, -23.99669], [-55.0518, -23.98666], [-55.02691, -23.97317], [-54.6238, -23.83078], [-54.32807, -24.01865], [-54.28207, -24.07305], [-54.4423, -25.13381], [-54.62033, -25.46026], [-54.60196, -25.48397], [-54.59509, -25.53696], [-54.59398, -25.59224], [-54.5502, -25.58915], [-54.52926, -25.62846], [-53.90831, -25.55513], [-53.83691, -25.94849], [-53.73511, -26.04211], [-53.73086, -26.05842], [-53.7264, -26.0664], [-53.73391, -26.07006], [-53.73968, -26.10012], [-53.65018, -26.19501], [-53.65237, -26.23289], [-53.63739, -26.2496], [-53.63881, -26.25075], [-53.64632, -26.24798], [-53.64186, -26.25976], [-53.64505, -26.28089], [-53.68269, -26.33359], [-53.73372, -26.6131], [-53.80144, -27.09844], [-54.15978, -27.2889], [-54.19062, -27.27639], [-54.19268, -27.30751], [-54.41888, -27.40882], [-54.50416, -27.48232], [-54.67657, -27.57214], [-54.90159, -27.63132], [-54.90805, -27.73149], [-55.1349, -27.89759], [-55.16872, -27.86224], [-55.33303, -27.94661], [-55.6262, -28.17124], [-55.65418, -28.18304], [-56.01729, -28.51223], [-56.00458, -28.60421], [-56.05265, -28.62651], [-56.54171, -29.11447], [-56.57295, -29.11357], [-56.62789, -29.18073], [-56.81251, -29.48154], [-57.09386, -29.74211], [-57.65132, -30.19229], [-57.22502, -30.26121], [-56.90236, -30.02578], [-56.49267, -30.39471], [-56.4795, -30.3899], [-56.4619, -30.38457], [-55.87388, -31.05053], [-55.58866, -30.84117], [-55.5634, -30.8686], [-55.55373, -30.8732], [-55.55218, -30.88193], [-55.54572, -30.89051], [-55.53431, -30.89714], [-55.53276, -30.90218], [-55.52712, -30.89997], [-55.51862, -30.89828], [-55.50841, -30.9027], [-55.50821, -30.91349], [-54.17384, -31.86168], [-53.76024, -32.0751], [-53.39572, -32.58596], [-53.37671, -32.57005], [-53.1111, -32.71147], [-53.53459, -33.16843], [-53.52794, -33.68908], [-53.44031, -33.69344], [-53.39593, -33.75169], [-53.37138, -33.74313], [-52.83257, -34.01481], [-28.34015, -20.99094], [-28.99601, 1.86593], [-51.35485, 4.8383], [-51.63798, 4.51394], [-51.61983, 4.14596], [-51.79599, 3.89336], [-51.82312, 3.85825], [-51.85573, 3.83427], [-52.31787, 3.17896], [-52.6906, 2.37298], [-52.96539, 2.1881], [-53.78743, 2.34412], [-54.16286, 2.10779], [-54.6084, 2.32856], [-55.01919, 2.564], [-55.71493, 2.40342], [-55.96292, 2.53188], [-56.13054, 2.27723], [-55.92159, 2.05236], [-55.89863, 1.89861], [-55.99278, 1.83137], [-56.47045, 1.95135], [-56.7659, 1.89509], [-57.07092, 1.95304], [-57.09109, 2.01854], [-57.23981, 1.95808], [-57.35073, 1.98327], [-57.55743, 1.69605], [-57.77281, 1.73344], [-57.97336, 1.64566], [-58.01873, 1.51966], [-58.33887, 1.58014], [-58.4858, 1.48399], [-58.53571, 1.29154], [-58.84229, 1.17749], [-58.92072, 1.31293], [-59.25583, 1.40559], [-59.74066, 1.87596], [-59.7264, 2.27497], [-59.91177, 2.36759], [-59.99733, 2.92312], [-59.79769, 3.37162], [-59.86899, 3.57089], [-59.51963, 3.91951], [-59.73353, 4.20399], [-59.69361, 4.34069]]]] } },
22696 { type: "Feature", properties: { iso1A2: "BS", iso1A3: "BHS", iso1N3: "044", wikidata: "Q778", nameEn: "The Bahamas", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-72.98446, 20.4801], [-71.70065, 25.7637], [-78.91214, 27.76553], [-80.65727, 23.71953], [-72.98446, 20.4801]]]] } },
22697 { type: "Feature", properties: { iso1A2: "BT", iso1A3: "BTN", iso1N3: "064", wikidata: "Q917", nameEn: "Bhutan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["975"] }, geometry: { type: "MultiPolygon", coordinates: [[[[91.6469, 27.76358], [91.5629, 27.84823], [91.48973, 27.93903], [91.46327, 28.0064], [91.25779, 28.07509], [91.20019, 27.98715], [90.69894, 28.07784], [90.58842, 28.02838], [90.13387, 28.19178], [89.79762, 28.23979], [89.59525, 28.16433], [89.12825, 27.62502], [89.0582, 27.60985], [88.97213, 27.51671], [88.95355, 27.4106], [89.00216, 27.32532], [88.96947, 27.30319], [88.93678, 27.33777], [88.91901, 27.32483], [88.74219, 27.144], [88.86984, 27.10937], [88.8714, 26.97488], [88.92301, 26.99286], [88.95807, 26.92668], [89.09554, 26.89089], [89.12825, 26.81661], [89.1926, 26.81329], [89.37913, 26.86224], [89.38319, 26.85963], [89.3901, 26.84225], [89.42349, 26.83727], [89.63369, 26.74402], [89.86124, 26.73307], [90.04535, 26.72422], [90.30402, 26.85098], [90.39271, 26.90704], [90.48504, 26.8594], [90.67715, 26.77215], [91.50067, 26.79223], [91.83181, 26.87318], [92.05523, 26.8692], [92.11863, 26.893], [92.03457, 27.07334], [92.04702, 27.26861], [92.12019, 27.27829], [92.01132, 27.47352], [91.65007, 27.48287], [91.55819, 27.6144], [91.6469, 27.76358]]]] } },
22698 { type: "Feature", properties: { iso1A2: "BV", iso1A3: "BVT", iso1N3: "074", wikidata: "Q23408", nameEn: "Bouvet Island", country: "NO", groups: ["005", "419", "019", "UN"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.54042, -54.0949], [2.28941, -54.13089], [3.35353, -55.17558], [4.54042, -54.0949]]]] } },
22699 { type: "Feature", properties: { iso1A2: "BW", iso1A3: "BWA", iso1N3: "072", wikidata: "Q963", nameEn: "Botswana", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["267"] }, geometry: { type: "MultiPolygon", coordinates: [[[[25.26433, -17.79571], [25.16882, -17.78253], [25.05895, -17.84452], [24.95586, -17.79674], [24.73364, -17.89338], [24.71887, -17.9218], [24.6303, -17.9863], [24.57485, -18.07151], [24.40577, -17.95726], [24.19416, -18.01919], [23.61088, -18.4881], [23.29618, -17.99855], [23.0996, -18.00075], [21.45556, -18.31795], [20.99904, -18.31743], [20.99751, -22.00026], [19.99912, -21.99991], [19.99817, -24.76768], [20.02809, -24.78725], [20.03678, -24.81004], [20.29826, -24.94869], [20.64795, -25.47827], [20.86081, -26.14892], [20.61754, -26.4692], [20.63275, -26.78181], [20.68596, -26.9039], [20.87031, -26.80047], [21.13353, -26.86661], [21.37869, -26.82083], [21.69322, -26.86152], [21.7854, -26.79199], [21.77114, -26.69015], [21.83291, -26.65959], [21.90703, -26.66808], [22.06192, -26.61882], [22.21206, -26.3773], [22.41921, -26.23078], [22.56365, -26.19668], [22.70808, -25.99186], [22.86012, -25.50572], [23.03497, -25.29971], [23.47588, -25.29971], [23.9244, -25.64286], [24.18287, -25.62916], [24.36531, -25.773], [24.44703, -25.73021], [24.67319, -25.81749], [24.8946, -25.80723], [25.01718, -25.72507], [25.12266, -25.75931], [25.33076, -25.76616], [25.58543, -25.6343], [25.6643, -25.4491], [25.69661, -25.29284], [25.72702, -25.25503], [25.88571, -24.87802], [25.84295, -24.78661], [25.8515, -24.75727], [26.39409, -24.63468], [26.46346, -24.60358], [26.51667, -24.47219], [26.84165, -24.24885], [26.99749, -23.65486], [27.33768, -23.40917], [27.52393, -23.37952], [27.6066, -23.21894], [27.74154, -23.2137], [27.93539, -23.04941], [27.93729, -22.96194], [28.04752, -22.90243], [28.04562, -22.8394], [28.34874, -22.5694], [28.63287, -22.55887], [28.91889, -22.44299], [29.0151, -22.22907], [29.10881, -22.21202], [29.15268, -22.21399], [29.18974, -22.18599], [29.21955, -22.17771], [29.37703, -22.19581], [29.3533, -22.18363], [29.24648, -22.05967], [29.1974, -22.07472], [29.14501, -22.07275], [29.08495, -22.04867], [29.04108, -22.00563], [29.02191, -21.95665], [29.02191, -21.90647], [29.04023, -21.85864], [29.07763, -21.81877], [28.58114, -21.63455], [28.49942, -21.66634], [28.29416, -21.59037], [28.01669, -21.57624], [27.91407, -21.31621], [27.69171, -21.08409], [27.72972, -20.51735], [27.69361, -20.48531], [27.28865, -20.49873], [27.29831, -20.28935], [27.21278, -20.08244], [26.72246, -19.92707], [26.17227, -19.53709], [25.96226, -19.08152], [25.99837, -19.02943], [25.94326, -18.90362], [25.82353, -18.82808], [25.79217, -18.6355], [25.68859, -18.56165], [25.53465, -18.39041], [25.39972, -18.12691], [25.31799, -18.07091], [25.23909, -17.90832], [25.26433, -17.79571]]]] } },
22700 { type: "Feature", properties: { iso1A2: "BY", iso1A3: "BLR", iso1N3: "112", wikidata: "Q184", nameEn: "Belarus", groups: ["151", "150", "UN"], callingCodes: ["375"] }, geometry: { type: "MultiPolygon", coordinates: [[[[28.15217, 56.16964], [27.97865, 56.11849], [27.63065, 55.89687], [27.61683, 55.78558], [27.3541, 55.8089], [27.27804, 55.78299], [27.1559, 55.85032], [26.97153, 55.8102], [26.87448, 55.7172], [26.76872, 55.67658], [26.71802, 55.70645], [26.64888, 55.70515], [26.63231, 55.67968], [26.63167, 55.57887], [26.55094, 55.5093], [26.5522, 55.40277], [26.44937, 55.34832], [26.5709, 55.32572], [26.6714, 55.33902], [26.80929, 55.31642], [26.83266, 55.30444], [26.835, 55.28182], [26.73017, 55.24226], [26.72983, 55.21788], [26.68075, 55.19787], [26.69243, 55.16718], [26.54753, 55.14181], [26.51481, 55.16051], [26.46249, 55.12814], [26.35121, 55.1525], [26.30628, 55.12536], [26.23202, 55.10439], [26.26941, 55.08032], [26.20397, 54.99729], [26.13386, 54.98924], [26.05907, 54.94631], [25.99129, 54.95705], [25.89462, 54.93438], [25.74122, 54.80108], [25.75977, 54.57252], [25.68045, 54.5321], [25.64813, 54.48704], [25.62203, 54.4656], [25.63371, 54.42075], [25.5376, 54.33158], [25.55425, 54.31591], [25.68513, 54.31727], [25.78553, 54.23327], [25.78563, 54.15747], [25.71084, 54.16704], [25.64875, 54.1259], [25.54724, 54.14925], [25.51452, 54.17799], [25.56823, 54.25212], [25.509, 54.30267], [25.35559, 54.26544], [25.22705, 54.26271], [25.19199, 54.219], [25.0728, 54.13419], [24.991, 54.14241], [24.96894, 54.17589], [24.77131, 54.11091], [24.85311, 54.02862], [24.74279, 53.96663], [24.69185, 53.96543], [24.69652, 54.01901], [24.62275, 54.00217], [24.44411, 53.90076], [24.34128, 53.90076], [24.19638, 53.96405], [23.98837, 53.92554], [23.95098, 53.9613], [23.81309, 53.94205], [23.80543, 53.89558], [23.71726, 53.93379], [23.61677, 53.92691], [23.51284, 53.95052], [23.62004, 53.60942], [23.81995, 53.24131], [23.85657, 53.22923], [23.91393, 53.16469], [23.87548, 53.0831], [23.92184, 53.02079], [23.94689, 52.95919], [23.91805, 52.94016], [23.93763, 52.71332], [23.73615, 52.6149], [23.58296, 52.59868], [23.45112, 52.53774], [23.34141, 52.44845], [23.18196, 52.28812], [23.20071, 52.22848], [23.47859, 52.18215], [23.54314, 52.12148], [23.61, 52.11264], [23.64066, 52.07626], [23.68733, 51.9906], [23.61523, 51.92066], [23.62691, 51.78208], [23.53198, 51.74298], [23.57053, 51.55938], [23.56236, 51.53673], [23.62751, 51.50512], [23.6736, 51.50255], [23.60906, 51.62122], [23.7766, 51.66809], [23.91118, 51.63316], [23.8741, 51.59734], [23.99907, 51.58369], [24.13075, 51.66979], [24.3163, 51.75063], [24.29021, 51.80841], [24.37123, 51.88222], [24.98784, 51.91273], [25.20228, 51.97143], [25.46163, 51.92205], [25.73673, 51.91973], [25.80574, 51.94556], [25.83217, 51.92587], [26.00408, 51.92967], [26.19084, 51.86781], [26.39367, 51.87315], [26.46962, 51.80501], [26.69759, 51.82284], [26.80043, 51.75777], [26.9489, 51.73788], [26.99422, 51.76933], [27.20602, 51.77291], [27.20948, 51.66713], [27.26613, 51.65957], [27.24828, 51.60161], [27.47212, 51.61184], [27.51058, 51.5854], [27.55727, 51.63486], [27.71932, 51.60672], [27.67125, 51.50854], [27.76052, 51.47604], [27.85253, 51.62293], [27.91844, 51.61952], [27.95827, 51.56065], [28.10658, 51.57857], [28.23452, 51.66988], [28.37592, 51.54505], [28.47051, 51.59734], [28.64429, 51.5664], [28.69161, 51.44695], [28.73143, 51.46236], [28.75615, 51.41442], [28.78224, 51.45294], [28.76027, 51.48802], [28.81795, 51.55552], [28.95528, 51.59222], [28.99098, 51.56833], [29.1187, 51.65872], [29.16402, 51.64679], [29.20659, 51.56918], [29.25603, 51.57089], [29.25191, 51.49828], [29.32881, 51.37843], [29.42357, 51.4187], [29.49773, 51.39814], [29.54372, 51.48372], [29.7408, 51.53417], [29.77376, 51.4461], [30.17888, 51.51025], [30.34642, 51.42555], [30.36153, 51.33984], [30.56203, 51.25655], [30.64992, 51.35014], [30.51946, 51.59649], [30.68804, 51.82806], [30.76443, 51.89739], [30.90897, 52.00699], [30.95589, 52.07775], [31.13332, 52.1004], [31.25142, 52.04131], [31.38326, 52.12991], [31.7822, 52.11406], [31.77877, 52.18636], [31.6895, 52.1973], [31.70735, 52.26711], [31.57971, 52.32146], [31.62084, 52.33849], [31.61397, 52.48843], [31.56316, 52.51518], [31.63869, 52.55361], [31.50406, 52.69707], [31.57277, 52.71613], [31.592, 52.79011], [31.35667, 52.97854], [31.24147, 53.031], [31.32283, 53.04101], [31.33519, 53.08805], [31.3915, 53.09712], [31.36403, 53.13504], [31.40523, 53.21406], [31.56316, 53.19432], [31.62496, 53.22886], [31.787, 53.18033], [31.82373, 53.10042], [32.15368, 53.07594], [32.40773, 53.18856], [32.51725, 53.28431], [32.73257, 53.33494], [32.74968, 53.45597], [32.47777, 53.5548], [32.40499, 53.6656], [32.50112, 53.68594], [32.45717, 53.74039], [32.36663, 53.7166], [32.12621, 53.81586], [31.89137, 53.78099], [31.77028, 53.80015], [31.85019, 53.91801], [31.88744, 54.03653], [31.89599, 54.0837], [31.57002, 54.14535], [31.30791, 54.25315], [31.3177, 54.34067], [31.22945, 54.46585], [31.08543, 54.50361], [31.21399, 54.63113], [31.19339, 54.66947], [30.99187, 54.67046], [30.98226, 54.68872], [31.0262, 54.70698], [30.97127, 54.71967], [30.95479, 54.74346], [30.75165, 54.80699], [30.8264, 54.90062], [30.81759, 54.94064], [30.93144, 54.9585], [30.95754, 54.98609], [30.9081, 55.02232], [30.94243, 55.03964], [31.00972, 55.02783], [31.02071, 55.06167], [30.97369, 55.17134], [30.87944, 55.28223], [30.81946, 55.27931], [30.8257, 55.3313], [30.93144, 55.3914], [30.90123, 55.46621], [30.95204, 55.50667], [30.93419, 55.6185], [30.86003, 55.63169], [30.7845, 55.58514], [30.72957, 55.66268], [30.67464, 55.64176], [30.63344, 55.73079], [30.51037, 55.76568], [30.51346, 55.78982], [30.48257, 55.81066], [30.30987, 55.83592], [30.27776, 55.86819], [30.12136, 55.8358], [29.97975, 55.87281], [29.80672, 55.79569], [29.61446, 55.77716], [29.51283, 55.70294], [29.3604, 55.75862], [29.44692, 55.95978], [29.21717, 55.98971], [29.08299, 56.03427], [28.73418, 55.97131], [28.63668, 56.07262], [28.68337, 56.10173], [28.5529, 56.11705], [28.43068, 56.09407], [28.37987, 56.11399], [28.36888, 56.05805], [28.30571, 56.06035], [28.15217, 56.16964]]]] } },
22701 { type: "Feature", properties: { iso1A2: "BZ", iso1A3: "BLZ", iso1N3: "084", wikidata: "Q242", nameEn: "Belize", groups: ["013", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["501"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-88.3268, 18.49048], [-88.48242, 18.49164], [-88.71505, 18.0707], [-88.8716, 17.89535], [-89.03839, 18.0067], [-89.15105, 17.95104], [-89.14985, 17.81563], [-89.15025, 17.04813], [-89.22683, 15.88619], [-89.17418, 15.90898], [-89.02415, 15.9063], [-88.95358, 15.88698], [-88.40779, 16.09624], [-86.92368, 17.61462], [-87.84815, 18.18511], [-87.85693, 18.18266], [-87.86657, 18.19971], [-87.87604, 18.18313], [-87.90671, 18.15213], [-88.03165, 18.16657], [-88.03238, 18.41778], [-88.26593, 18.47617], [-88.29909, 18.47591], [-88.3268, 18.49048]]]] } },
22702 { type: "Feature", properties: { iso1A2: "CA", iso1A3: "CAN", iso1N3: "124", wikidata: "Q16", nameEn: "Canada", groups: ["021", "003", "019", "UN"], callingCodes: ["1"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.20349, 45.1722], [-67.19603, 45.16771], [-67.15965, 45.16179], [-67.11316, 45.11176], [-67.0216, 44.95333], [-66.96824, 44.90965], [-66.98249, 44.87071], [-66.96824, 44.83078], [-66.93432, 44.82597], [-67.16117, 44.20069], [-61.98255, 37.34815], [-56.27503, 47.39728], [-53.12387, 41.40385], [-46.37635, 57.3249], [-77.52957, 77.23408], [-68.21821, 80.48551], [-49.33696, 84.57952], [-140.97446, 84.39275], [-141.00116, 60.30648], [-140.5227, 60.22077], [-140.45648, 60.30919], [-139.98024, 60.18027], [-139.68991, 60.33693], [-139.05831, 60.35205], [-139.20603, 60.08896], [-139.05365, 59.99655], [-138.71149, 59.90728], [-138.62145, 59.76431], [-137.60623, 59.24465], [-137.4925, 58.89415], [-136.82619, 59.16198], [-136.52365, 59.16752], [-136.47323, 59.46617], [-136.33727, 59.44466], [-136.22381, 59.55526], [-136.31566, 59.59083], [-135.48007, 59.79937], [-135.03069, 59.56208], [-135.00267, 59.28745], [-134.7047, 59.2458], [-134.55699, 59.1297], [-134.48059, 59.13231], [-134.27175, 58.8634], [-133.84645, 58.73543], [-133.38523, 58.42773], [-131.8271, 56.62247], [-130.77769, 56.36185], [-130.33965, 56.10849], [-130.10173, 56.12178], [-130.00093, 56.00325], [-130.00857, 55.91344], [-130.15373, 55.74895], [-129.97513, 55.28029], [-130.08035, 55.21556], [-130.18765, 55.07744], [-130.27203, 54.97174], [-130.44184, 54.85377], [-130.64499, 54.76912], [-130.61931, 54.70835], [-133.92876, 54.62289], [-133.36909, 48.51151], [-125.03842, 48.53282], [-123.50039, 48.21223], [-123.15614, 48.35395], [-123.26565, 48.6959], [-123.0093, 48.76586], [-123.0093, 48.83186], [-123.32163, 49.00419], [-95.15355, 48.9996], [-95.15357, 49.384], [-95.12903, 49.37056], [-95.05825, 49.35311], [-95.01419, 49.35647], [-94.99532, 49.36579], [-94.95681, 49.37035], [-94.85381, 49.32492], [-94.8159, 49.32299], [-94.82487, 49.29483], [-94.77355, 49.11998], [-94.75017, 49.09931], [-94.687, 48.84077], [-94.70087, 48.8339], [-94.70486, 48.82365], [-94.69669, 48.80918], [-94.69335, 48.77883], [-94.58903, 48.71803], [-94.54885, 48.71543], [-94.53826, 48.70216], [-94.44258, 48.69223], [-94.4174, 48.71049], [-94.27153, 48.70232], [-94.25172, 48.68404], [-94.25104, 48.65729], [-94.23215, 48.65202], [-93.85769, 48.63284], [-93.83288, 48.62745], [-93.80676, 48.58232], [-93.80939, 48.52439], [-93.79267, 48.51631], [-93.66382, 48.51845], [-93.47022, 48.54357], [-93.44472, 48.59147], [-93.40693, 48.60948], [-93.39758, 48.60364], [-93.3712, 48.60599], [-93.33946, 48.62787], [-93.25391, 48.64266], [-92.94973, 48.60866], [-92.7287, 48.54005], [-92.6342, 48.54133], [-92.62747, 48.50278], [-92.69927, 48.49573], [-92.71323, 48.46081], [-92.65606, 48.43471], [-92.50712, 48.44921], [-92.45588, 48.40624], [-92.48147, 48.36609], [-92.37185, 48.22259], [-92.27167, 48.25046], [-92.30939, 48.31251], [-92.26662, 48.35651], [-92.202, 48.35252], [-92.14732, 48.36578], [-92.05339, 48.35958], [-91.98929, 48.25409], [-91.86125, 48.21278], [-91.71231, 48.19875], [-91.70451, 48.11805], [-91.55649, 48.10611], [-91.58025, 48.04339], [-91.45829, 48.07454], [-91.43248, 48.04912], [-91.25025, 48.08522], [-91.08016, 48.18096], [-90.87588, 48.2484], [-90.75045, 48.09143], [-90.56444, 48.12184], [-90.56312, 48.09488], [-90.07418, 48.11043], [-89.89974, 47.98109], [-89.77248, 48.02607], [-89.57972, 48.00023], [-89.48837, 48.01412], [-88.37033, 48.30586], [-84.85871, 46.88881], [-84.55635, 46.45974], [-84.47607, 46.45225], [-84.4481, 46.48972], [-84.42101, 46.49853], [-84.34174, 46.50683], [-84.29893, 46.49127], [-84.26351, 46.49508], [-84.2264, 46.53337], [-84.1945, 46.54061], [-84.17723, 46.52753], [-84.12885, 46.53068], [-84.11196, 46.50248], [-84.13451, 46.39218], [-84.11254, 46.32329], [-84.11615, 46.2681], [-84.09756, 46.25512], [-84.1096, 46.23987], [-83.95399, 46.05634], [-83.90453, 46.05922], [-83.83329, 46.12169], [-83.57017, 46.105], [-83.43746, 45.99749], [-83.59589, 45.82131], [-82.48419, 45.30225], [-82.42469, 42.992], [-82.4146, 42.97626], [-82.4253, 42.95423], [-82.45331, 42.93139], [-82.4826, 42.8068], [-82.46613, 42.76615], [-82.51063, 42.66025], [-82.51858, 42.611], [-82.57583, 42.5718], [-82.58873, 42.54984], [-82.64242, 42.55594], [-82.82964, 42.37355], [-83.02253, 42.33045], [-83.07837, 42.30978], [-83.09837, 42.28877], [-83.12724, 42.2376], [-83.14962, 42.04089], [-83.11184, 41.95671], [-82.67862, 41.67615], [-78.93684, 42.82887], [-78.90712, 42.89733], [-78.90905, 42.93022], [-78.93224, 42.95229], [-78.96312, 42.95509], [-78.98126, 42.97], [-79.02074, 42.98444], [-79.02424, 43.01983], [-78.99941, 43.05612], [-79.01055, 43.06659], [-79.07486, 43.07845], [-79.05671, 43.10937], [-79.06881, 43.12029], [-79.0427, 43.13934], [-79.04652, 43.16396], [-79.05384, 43.17418], [-79.05002, 43.20133], [-79.05544, 43.21224], [-79.05512, 43.25375], [-79.06921, 43.26183], [-79.25796, 43.54052], [-76.79706, 43.63099], [-76.43859, 44.09393], [-76.35324, 44.13493], [-76.31222, 44.19894], [-76.244, 44.19643], [-76.1664, 44.23051], [-76.16285, 44.28262], [-76.00018, 44.34896], [-75.95947, 44.34463], [-75.8217, 44.43176], [-75.76813, 44.51537], [-75.41441, 44.76614], [-75.2193, 44.87821], [-75.01363, 44.95608], [-74.99101, 44.98051], [-74.8447, 45.00606], [-74.66689, 45.00646], [-74.32699, 44.99029], [-73.35025, 45.00942], [-71.50067, 45.01357], [-71.48735, 45.07784], [-71.42778, 45.12624], [-71.40364, 45.21382], [-71.44252, 45.2361], [-71.37133, 45.24624], [-71.29371, 45.29996], [-71.22338, 45.25184], [-71.19723, 45.25438], [-71.14568, 45.24128], [-71.08364, 45.30623], [-71.01866, 45.31573], [-71.0107, 45.34819], [-70.95193, 45.33895], [-70.91169, 45.29849], [-70.89864, 45.2398], [-70.84816, 45.22698], [-70.80236, 45.37444], [-70.82638, 45.39828], [-70.78372, 45.43269], [-70.65383, 45.37592], [-70.62518, 45.42286], [-70.72651, 45.49771], [-70.68516, 45.56964], [-70.54019, 45.67291], [-70.38934, 45.73215], [-70.41523, 45.79497], [-70.25976, 45.89675], [-70.24694, 45.95138], [-70.31025, 45.96424], [-70.23855, 46.1453], [-70.29078, 46.18832], [-70.18547, 46.35357], [-70.05812, 46.41768], [-69.99966, 46.69543], [-69.22119, 47.46461], [-69.05148, 47.42012], [-69.05073, 47.30076], [-69.05039, 47.2456], [-68.89222, 47.1807], [-68.70125, 47.24399], [-68.60575, 47.24659], [-68.57914, 47.28431], [-68.38332, 47.28723], [-68.37458, 47.35851], [-68.23244, 47.35712], [-67.94843, 47.1925], [-67.87993, 47.10377], [-67.78578, 47.06473], [-67.78111, 45.9392], [-67.75196, 45.91814], [-67.80961, 45.87531], [-67.75654, 45.82324], [-67.80653, 45.80022], [-67.80705, 45.69528], [-67.6049, 45.60725], [-67.43815, 45.59162], [-67.42144, 45.50584], [-67.50578, 45.48971], [-67.42394, 45.37969], [-67.48201, 45.27351], [-67.34927, 45.122], [-67.29754, 45.14865], [-67.29748, 45.18173], [-67.27039, 45.1934], [-67.22751, 45.16344], [-67.20349, 45.1722]]]] } },
22703 { type: "Feature", properties: { iso1A2: "CC", iso1A3: "CCK", iso1N3: "166", wikidata: "Q36004", nameEn: "Cocos (Keeling) Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[96.61846, -10.82438], [96.02343, -12.68334], [97.93979, -12.33309], [96.61846, -10.82438]]]] } },
22704 { type: "Feature", properties: { iso1A2: "CD", iso1A3: "COD", iso1N3: "180", wikidata: "Q974", nameEn: "Democratic Republic of the Congo", aliases: ["ZR"], groups: ["017", "202", "002", "UN"], callingCodes: ["243"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.44012, 5.07349], [27.09575, 5.22305], [26.93064, 5.13535], [26.85579, 5.03887], [26.74572, 5.10685], [26.48595, 5.04984], [26.13371, 5.25594], [25.86073, 5.19455], [25.53271, 5.37431], [25.34558, 5.29101], [25.31256, 5.03668], [24.71816, 4.90509], [24.46719, 5.0915], [23.38847, 4.60013], [22.94817, 4.82392], [22.89094, 4.79321], [22.84691, 4.69887], [22.78526, 4.71423], [22.6928, 4.47285], [22.60915, 4.48821], [22.5431, 4.22041], [22.45504, 4.13039], [22.27682, 4.11347], [22.10721, 4.20723], [21.6405, 4.317], [21.55904, 4.25553], [21.25744, 4.33676], [21.21341, 4.29285], [21.11214, 4.33895], [21.08793, 4.39603], [20.90383, 4.44877], [20.60184, 4.42394], [18.62755, 3.47564], [18.63857, 3.19342], [18.10683, 2.26876], [18.08034, 1.58553], [17.85887, 1.04327], [17.86989, 0.58873], [17.95255, 0.48128], [17.93877, 0.32424], [17.81204, 0.23884], [17.66051, -0.26535], [17.72112, -0.52707], [17.32438, -0.99265], [16.97999, -1.12762], [16.70724, -1.45815], [16.50336, -1.8795], [16.16173, -2.16586], [16.22785, -2.59528], [16.1755, -3.25014], [16.21407, -3.2969], [15.89448, -3.9513], [15.53081, -4.042], [15.48121, -4.22062], [15.41785, -4.28381], [15.32693, -4.27282], [15.25411, -4.31121], [15.1978, -4.32388], [14.83101, -4.80838], [14.67948, -4.92093], [14.5059, -4.84956], [14.41499, -4.8825], [14.37366, -4.56125], [14.47284, -4.42941], [14.3957, -4.36623], [14.40672, -4.28381], [13.9108, -4.50906], [13.81162, -4.41842], [13.71794, -4.44864], [13.70417, -4.72601], [13.50305, -4.77818], [13.41764, -4.89897], [13.11182, -4.5942], [13.09648, -4.63739], [13.11195, -4.67745], [12.8733, -4.74346], [12.70868, -4.95505], [12.63465, -4.94632], [12.60251, -5.01715], [12.46297, -5.09408], [12.49815, -5.14058], [12.51589, -5.1332], [12.53586, -5.14658], [12.53599, -5.1618], [12.52301, -5.17481], [12.52318, -5.74353], [12.26557, -5.74031], [12.20376, -5.76338], [11.95767, -5.94705], [12.42245, -6.07585], [13.04371, -5.87078], [16.55507, -5.85631], [16.96282, -7.21787], [17.5828, -8.13784], [18.33635, -8.00126], [19.33698, -7.99743], [19.5469, -7.00195], [20.30218, -6.98955], [20.31846, -6.91953], [20.61689, -6.90876], [20.56263, -7.28566], [21.79824, -7.29628], [21.84856, -9.59871], [22.19039, -9.94628], [22.32604, -10.76291], [22.17954, -10.85884], [22.25951, -11.24911], [22.54205, -11.05784], [23.16602, -11.10577], [23.45631, -10.946], [23.86868, -11.02856], [24.00027, -10.89356], [24.34528, -11.06816], [24.42612, -11.44975], [25.34069, -11.19707], [25.33058, -11.65767], [26.01777, -11.91488], [26.88687, -12.01868], [27.04351, -11.61312], [27.22541, -11.60323], [27.21025, -11.76157], [27.59932, -12.22123], [28.33199, -12.41375], [29.01918, -13.41353], [29.60531, -13.21685], [29.65078, -13.41844], [29.81551, -13.44683], [29.8139, -12.14898], [29.48404, -12.23604], [29.4992, -12.43843], [29.18592, -12.37921], [28.48357, -11.87532], [28.37241, -11.57848], [28.65032, -10.65133], [28.62795, -9.92942], [28.68532, -9.78], [28.56208, -9.49122], [28.51627, -9.44726], [28.52636, -9.35379], [28.36562, -9.30091], [28.38526, -9.23393], [28.9711, -8.66935], [28.88917, -8.4831], [30.79243, -8.27382], [30.2567, -7.14121], [29.52552, -6.2731], [29.43673, -4.44845], [29.23708, -3.75856], [29.21463, -3.3514], [29.25633, -3.05471], [29.17258, -2.99385], [29.16037, -2.95457], [29.09797, -2.91935], [29.09119, -2.87871], [29.0505, -2.81774], [29.00404, -2.81978], [29.00167, -2.78523], [29.04081, -2.7416], [29.00357, -2.70596], [28.94346, -2.69124], [28.89793, -2.66111], [28.90226, -2.62385], [28.89288, -2.55848], [28.87943, -2.55165], [28.86193, -2.53185], [28.86209, -2.5231], [28.87497, -2.50887], [28.88846, -2.50493], [28.89342, -2.49017], [28.89132, -2.47557], [28.86846, -2.44866], [28.86826, -2.41888], [28.89601, -2.37321], [28.95642, -2.37321], [29.00051, -2.29001], [29.105, -2.27043], [29.17562, -2.12278], [29.11847, -1.90576], [29.24458, -1.69663], [29.24323, -1.66826], [29.36322, -1.50887], [29.45038, -1.5054], [29.53062, -1.40499], [29.59061, -1.39016], [29.58388, -0.89821], [29.63006, -0.8997], [29.62708, -0.71055], [29.67176, -0.55714], [29.67474, -0.47969], [29.65091, -0.46777], [29.72687, -0.08051], [29.7224, 0.07291], [29.77454, 0.16675], [29.81922, 0.16824], [29.87284, 0.39166], [29.97413, 0.52124], [29.95477, 0.64486], [29.98307, 0.84295], [30.1484, 0.89805], [30.22139, 0.99635], [30.24671, 1.14974], [30.48503, 1.21675], [31.30127, 2.11006], [31.28042, 2.17853], [31.20148, 2.2217], [31.1985, 2.29462], [31.12104, 2.27676], [31.07934, 2.30207], [31.06593, 2.35862], [30.96911, 2.41071], [30.91102, 2.33332], [30.83059, 2.42559], [30.74271, 2.43601], [30.75612, 2.5863], [30.8857, 2.83923], [30.8574, 2.9508], [30.77101, 3.04897], [30.84251, 3.26908], [30.93486, 3.40737], [30.94081, 3.50847], [30.85153, 3.48867], [30.85997, 3.5743], [30.80713, 3.60506], [30.78512, 3.67097], [30.56277, 3.62703], [30.57378, 3.74567], [30.55396, 3.84451], [30.47691, 3.83353], [30.27658, 3.95653], [30.22374, 3.93896], [30.1621, 4.10586], [30.06964, 4.13221], [29.79666, 4.37809], [29.82087, 4.56246], [29.49726, 4.7007], [29.43341, 4.50101], [29.22207, 4.34297], [29.03054, 4.48784], [28.8126, 4.48784], [28.6651, 4.42638], [28.20719, 4.35614], [27.79551, 4.59976], [27.76469, 4.79284], [27.65462, 4.89375], [27.56656, 4.89375], [27.44012, 5.07349]]]] } },
22705 { type: "Feature", properties: { iso1A2: "CF", iso1A3: "CAF", iso1N3: "140", wikidata: "Q929", nameEn: "Central African Republic", groups: ["017", "202", "002", "UN"], callingCodes: ["236"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.87758, 10.91915], [22.45889, 11.00246], [21.72139, 10.64136], [21.71479, 10.29932], [21.63553, 10.217], [21.52766, 10.2105], [21.34934, 9.95907], [21.26348, 9.97642], [20.82979, 9.44696], [20.36748, 9.11019], [19.06421, 9.00367], [18.86388, 8.87971], [19.11044, 8.68172], [18.79783, 8.25929], [18.67455, 8.22226], [18.62612, 8.14163], [18.64153, 8.08714], [18.6085, 8.05009], [18.02731, 8.01085], [17.93926, 7.95853], [17.67288, 7.98905], [16.8143, 7.53971], [16.6668, 7.67281], [16.658, 7.75353], [16.59415, 7.76444], [16.58315, 7.88657], [16.41583, 7.77971], [16.40703, 7.68809], [15.79942, 7.44149], [15.73118, 7.52006], [15.49743, 7.52179], [15.23397, 7.25135], [15.04717, 6.77085], [14.96311, 6.75693], [14.79966, 6.39043], [14.80122, 6.34866], [14.74206, 6.26356], [14.56149, 6.18928], [14.43073, 6.08867], [14.42917, 6.00508], [14.49455, 5.91683], [14.60974, 5.91838], [14.62375, 5.70466], [14.58951, 5.59777], [14.62531, 5.51411], [14.52724, 5.28319], [14.57083, 5.23979], [14.65489, 5.21343], [14.73383, 4.6135], [15.00825, 4.41458], [15.08609, 4.30282], [15.10644, 4.1362], [15.17482, 4.05131], [15.07686, 4.01805], [15.73522, 3.24348], [15.77725, 3.26835], [16.05449, 3.02306], [16.08252, 2.45708], [16.19357, 2.21537], [16.50126, 2.84739], [16.46701, 2.92512], [16.57598, 3.47999], [16.68283, 3.54257], [17.01746, 3.55136], [17.35649, 3.63045], [17.46876, 3.70515], [17.60966, 3.63705], [17.83421, 3.61068], [17.85842, 3.53378], [18.05656, 3.56893], [18.14902, 3.54476], [18.17323, 3.47665], [18.24148, 3.50302], [18.2723, 3.57992], [18.39558, 3.58212], [18.49245, 3.63924], [18.58711, 3.49423], [18.62755, 3.47564], [20.60184, 4.42394], [20.90383, 4.44877], [21.08793, 4.39603], [21.11214, 4.33895], [21.21341, 4.29285], [21.25744, 4.33676], [21.55904, 4.25553], [21.6405, 4.317], [22.10721, 4.20723], [22.27682, 4.11347], [22.45504, 4.13039], [22.5431, 4.22041], [22.60915, 4.48821], [22.6928, 4.47285], [22.78526, 4.71423], [22.84691, 4.69887], [22.89094, 4.79321], [22.94817, 4.82392], [23.38847, 4.60013], [24.46719, 5.0915], [24.71816, 4.90509], [25.31256, 5.03668], [25.34558, 5.29101], [25.53271, 5.37431], [25.86073, 5.19455], [26.13371, 5.25594], [26.48595, 5.04984], [26.74572, 5.10685], [26.85579, 5.03887], [26.93064, 5.13535], [27.09575, 5.22305], [27.44012, 5.07349], [27.26886, 5.25876], [27.23017, 5.37167], [27.28621, 5.56382], [27.22705, 5.62889], [27.22705, 5.71254], [26.51721, 6.09655], [26.58259, 6.1987], [26.32729, 6.36272], [26.38022, 6.63493], [25.90076, 7.09549], [25.37461, 7.33024], [25.35281, 7.42595], [25.20337, 7.50312], [25.20649, 7.61115], [25.29214, 7.66675], [25.25319, 7.8487], [24.98855, 7.96588], [24.85156, 8.16933], [24.35965, 8.26177], [24.13238, 8.36959], [24.25691, 8.69288], [23.51905, 8.71749], [23.59065, 8.99743], [23.44744, 8.99128], [23.4848, 9.16959], [23.56263, 9.19418], [23.64358, 9.28637], [23.64981, 9.44303], [23.62179, 9.53823], [23.69155, 9.67566], [23.67164, 9.86923], [23.3128, 10.45214], [23.02221, 10.69235], [22.87758, 10.91915]]]] } },
22706 { type: "Feature", properties: { iso1A2: "CG", iso1A3: "COG", iso1N3: "178", wikidata: "Q971", nameEn: "Republic of the Congo", groups: ["017", "202", "002", "UN"], callingCodes: ["242"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.62755, 3.47564], [18.58711, 3.49423], [18.49245, 3.63924], [18.39558, 3.58212], [18.2723, 3.57992], [18.24148, 3.50302], [18.17323, 3.47665], [18.14902, 3.54476], [18.05656, 3.56893], [17.85842, 3.53378], [17.83421, 3.61068], [17.60966, 3.63705], [17.46876, 3.70515], [17.35649, 3.63045], [17.01746, 3.55136], [16.68283, 3.54257], [16.57598, 3.47999], [16.46701, 2.92512], [16.50126, 2.84739], [16.19357, 2.21537], [16.15568, 2.18955], [16.08563, 2.19733], [16.05294, 1.9811], [16.14634, 1.70259], [16.02647, 1.65591], [16.02959, 1.76483], [15.48942, 1.98265], [15.34776, 1.91264], [15.22634, 2.03243], [15.00996, 1.98887], [14.61145, 2.17866], [13.29457, 2.16106], [13.13461, 1.57238], [13.25447, 1.32339], [13.15519, 1.23368], [13.89582, 1.4261], [14.25186, 1.39842], [14.48179, 0.9152], [14.26066, 0.57255], [14.10909, 0.58563], [13.88648, 0.26652], [13.90632, -0.2287], [14.06862, -0.20826], [14.2165, -0.38261], [14.41887, -0.44799], [14.52569, -0.57818], [14.41838, -1.89412], [14.25932, -1.97624], [14.23518, -2.15671], [14.16202, -2.23916], [14.23829, -2.33715], [14.10442, -2.49268], [13.85846, -2.46935], [13.92073, -2.35581], [13.75884, -2.09293], [13.47977, -2.43224], [13.02759, -2.33098], [12.82172, -1.91091], [12.61312, -1.8129], [12.44656, -1.92025], [12.47925, -2.32626], [12.04895, -2.41704], [11.96866, -2.33559], [11.74605, -2.39936], [11.57637, -2.33379], [11.64487, -2.61865], [11.5359, -2.85654], [11.64798, -2.81146], [11.80365, -3.00424], [11.70558, -3.0773], [11.70227, -3.17465], [11.96554, -3.30267], [11.8318, -3.5812], [11.92719, -3.62768], [11.87083, -3.71571], [11.68608, -3.68942], [11.57949, -3.52798], [11.48764, -3.51089], [11.22301, -3.69888], [11.12647, -3.94169], [10.75913, -4.39519], [11.50888, -5.33417], [12.00924, -5.02627], [12.16068, -4.90089], [12.20901, -4.75642], [12.25587, -4.79437], [12.32324, -4.78415], [12.40964, -4.60609], [12.64835, -4.55937], [12.76844, -4.38709], [12.87096, -4.40315], [12.91489, -4.47907], [13.09648, -4.63739], [13.11182, -4.5942], [13.41764, -4.89897], [13.50305, -4.77818], [13.70417, -4.72601], [13.71794, -4.44864], [13.81162, -4.41842], [13.9108, -4.50906], [14.40672, -4.28381], [14.3957, -4.36623], [14.47284, -4.42941], [14.37366, -4.56125], [14.41499, -4.8825], [14.5059, -4.84956], [14.67948, -4.92093], [14.83101, -4.80838], [15.1978, -4.32388], [15.25411, -4.31121], [15.32693, -4.27282], [15.41785, -4.28381], [15.48121, -4.22062], [15.53081, -4.042], [15.89448, -3.9513], [16.21407, -3.2969], [16.1755, -3.25014], [16.22785, -2.59528], [16.16173, -2.16586], [16.50336, -1.8795], [16.70724, -1.45815], [16.97999, -1.12762], [17.32438, -0.99265], [17.72112, -0.52707], [17.66051, -0.26535], [17.81204, 0.23884], [17.93877, 0.32424], [17.95255, 0.48128], [17.86989, 0.58873], [17.85887, 1.04327], [18.08034, 1.58553], [18.10683, 2.26876], [18.63857, 3.19342], [18.62755, 3.47564]]]] } },
22707 { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[8.72809, 47.69282], [8.72617, 47.69651], [8.73671, 47.7169], [8.70543, 47.73121], [8.74251, 47.75168], [8.71778, 47.76571], [8.68985, 47.75686], [8.68022, 47.78599], [8.65292, 47.80066], [8.64425, 47.76398], [8.62408, 47.7626], [8.61657, 47.79998], [8.56415, 47.80633], [8.56814, 47.78001], [8.48868, 47.77215], [8.45771, 47.7493], [8.44807, 47.72426], [8.40569, 47.69855], [8.4211, 47.68407], [8.40473, 47.67499], [8.41346, 47.66676], [8.42264, 47.66667], [8.44711, 47.65379], [8.4667, 47.65747], [8.46605, 47.64103], [8.49656, 47.64709], [8.5322, 47.64687], [8.52801, 47.66059], [8.56141, 47.67088], [8.57683, 47.66158], [8.6052, 47.67258], [8.61113, 47.66332], [8.62884, 47.65098], [8.62049, 47.63757], [8.60412, 47.63735], [8.61471, 47.64514], [8.60701, 47.65271], [8.59545, 47.64298], [8.60348, 47.61204], [8.57586, 47.59537], [8.55756, 47.62394], [8.51686, 47.63476], [8.50747, 47.61897], [8.45578, 47.60121], [8.46637, 47.58389], [8.48949, 47.588], [8.49431, 47.58107], [8.43235, 47.56617], [8.39477, 47.57826], [8.38273, 47.56608], [8.35512, 47.57014], [8.32735, 47.57133], [8.30277, 47.58607], [8.29524, 47.5919], [8.29722, 47.60603], [8.2824, 47.61225], [8.26313, 47.6103], [8.25863, 47.61571], [8.23809, 47.61204], [8.22577, 47.60385], [8.22011, 47.6181], [8.20617, 47.62141], [8.19378, 47.61636], [8.1652, 47.5945], [8.14947, 47.59558], [8.13823, 47.59147], [8.13662, 47.58432], [8.11543, 47.5841], [8.10395, 47.57918], [8.10002, 47.56504], [8.08557, 47.55768], [8.06663, 47.56374], [8.04383, 47.55443], [8.02136, 47.55096], [8.00113, 47.55616], [7.97581, 47.55493], [7.95682, 47.55789], [7.94494, 47.54511], [7.91251, 47.55031], [7.90673, 47.57674], [7.88664, 47.58854], [7.84412, 47.5841], [7.81901, 47.58798], [7.79486, 47.55691], [7.75261, 47.54599], [7.71961, 47.54219], [7.69642, 47.53297], [7.68101, 47.53232], [7.6656, 47.53752], [7.66174, 47.54554], [7.65083, 47.54662], [7.63338, 47.56256], [7.67655, 47.56435], [7.68904, 47.57133], [7.67115, 47.5871], [7.68486, 47.59601], [7.69385, 47.60099], [7.68229, 47.59905], [7.67395, 47.59212], [7.64599, 47.59695], [7.64213, 47.5944], [7.64309, 47.59151], [7.61929, 47.57683], [7.60459, 47.57869], [7.60523, 47.58519], [7.58945, 47.59017], [7.58386, 47.57536], [7.56684, 47.57785], [7.56548, 47.57617], [7.55689, 47.57232], [7.55652, 47.56779], [7.53634, 47.55553], [7.52831, 47.55347], [7.51723, 47.54578], [7.50873, 47.54546], [7.49691, 47.53821], [7.50588, 47.52856], [7.51904, 47.53515], [7.53199, 47.5284], [7.5229, 47.51644], [7.49804, 47.51798], [7.51076, 47.49651], [7.47534, 47.47932], [7.43356, 47.49712], [7.42923, 47.48628], [7.4583, 47.47216], [7.4462, 47.46264], [7.43088, 47.45846], [7.40308, 47.43638], [7.35603, 47.43432], [7.33526, 47.44186], [7.24669, 47.4205], [7.17026, 47.44312], [7.19583, 47.49455], [7.16249, 47.49025], [7.12781, 47.50371], [7.07425, 47.48863], [7.0231, 47.50522], [6.98425, 47.49432], [7.0024, 47.45264], [6.93953, 47.43388], [6.93744, 47.40714], [6.88542, 47.37262], [6.87959, 47.35335], [7.03125, 47.36996], [7.0564, 47.35134], [7.05305, 47.33304], [6.94316, 47.28747], [6.95108, 47.26428], [6.9508, 47.24338], [6.8489, 47.15933], [6.76788, 47.1208], [6.68823, 47.06616], [6.71531, 47.0494], [6.43341, 46.92703], [6.46456, 46.88865], [6.43216, 46.80336], [6.45209, 46.77502], [6.38351, 46.73171], [6.27135, 46.68251], [6.11084, 46.57649], [6.1567, 46.54402], [6.07269, 46.46244], [6.08427, 46.44305], [6.06407, 46.41676], [6.09926, 46.40768], [6.15016, 46.3778], [6.15985, 46.37721], [6.16987, 46.36759], [6.15738, 46.3491], [6.13876, 46.33844], [6.1198, 46.31157], [6.11697, 46.29547], [6.1013, 46.28512], [6.11926, 46.2634], [6.12446, 46.25059], [6.10071, 46.23772], [6.08563, 46.24651], [6.07072, 46.24085], [6.0633, 46.24583], [6.05029, 46.23518], [6.04602, 46.23127], [6.03342, 46.2383], [6.02461, 46.23313], [5.97542, 46.21525], [5.96515, 46.19638], [5.99573, 46.18587], [5.98846, 46.17046], [5.98188, 46.17392], [5.97508, 46.15863], [5.9641, 46.14412], [5.95781, 46.12925], [5.97893, 46.13303], [5.9871, 46.14499], [6.01791, 46.14228], [6.03614, 46.13712], [6.04564, 46.14031], [6.05203, 46.15191], [6.07491, 46.14879], [6.09199, 46.15191], [6.09926, 46.14373], [6.13397, 46.1406], [6.15305, 46.15194], [6.18116, 46.16187], [6.18871, 46.16644], [6.18707, 46.17999], [6.19552, 46.18401], [6.19807, 46.18369], [6.20539, 46.19163], [6.21114, 46.1927], [6.21273, 46.19409], [6.21603, 46.19507], [6.21844, 46.19837], [6.22222, 46.19888], [6.22175, 46.20045], [6.23544, 46.20714], [6.23913, 46.20511], [6.24821, 46.20531], [6.26007, 46.21165], [6.27694, 46.21566], [6.29663, 46.22688], [6.31041, 46.24417], [6.29474, 46.26221], [6.26749, 46.24745], [6.24952, 46.26255], [6.23775, 46.27822], [6.25137, 46.29014], [6.24826, 46.30175], [6.21981, 46.31304], [6.25432, 46.3632], [6.53358, 46.45431], [6.82312, 46.42661], [6.8024, 46.39171], [6.77152, 46.34784], [6.86052, 46.28512], [6.78968, 46.14058], [6.89321, 46.12548], [6.87868, 46.03855], [6.93862, 46.06502], [7.00946, 45.9944], [7.04151, 45.92435], [7.10685, 45.85653], [7.56343, 45.97421], [7.85949, 45.91485], [7.9049, 45.99945], [7.98881, 45.99867], [8.02906, 46.10331], [8.11383, 46.11577], [8.16866, 46.17817], [8.08814, 46.26692], [8.31162, 46.38044], [8.30648, 46.41587], [8.42464, 46.46367], [8.46317, 46.43712], [8.45032, 46.26869], [8.62242, 46.12112], [8.75697, 46.10395], [8.80778, 46.10085], [8.85617, 46.0748], [8.79414, 46.00913], [8.78585, 45.98973], [8.79362, 45.99207], [8.8319, 45.9879], [8.85121, 45.97239], [8.86688, 45.96135], [8.88904, 45.95465], [8.93649, 45.86775], [8.94372, 45.86587], [8.93504, 45.86245], [8.91129, 45.8388], [8.94737, 45.84285], [8.9621, 45.83707], [8.99663, 45.83466], [9.00324, 45.82055], [9.0298, 45.82127], [9.03279, 45.82865], [9.03793, 45.83548], [9.03505, 45.83976], [9.04059, 45.8464], [9.04546, 45.84968], [9.06642, 45.8761], [9.09065, 45.89906], [8.99257, 45.9698], [9.01618, 46.04928], [9.24503, 46.23616], [9.29226, 46.32717], [9.25502, 46.43743], [9.28136, 46.49685], [9.36128, 46.5081], [9.40487, 46.46621], [9.45936, 46.50873], [9.46117, 46.37481], [9.57015, 46.2958], [9.71273, 46.29266], [9.73086, 46.35071], [9.95249, 46.38045], [10.07055, 46.21668], [10.14439, 46.22992], [10.17862, 46.25626], [10.10506, 46.3372], [10.165, 46.41051], [10.03715, 46.44479], [10.10307, 46.61003], [10.23674, 46.63484], [10.25309, 46.57432], [10.46136, 46.53164], [10.49375, 46.62049], [10.44686, 46.64162], [10.40475, 46.63671], [10.38659, 46.67847], [10.47197, 46.85698], [10.48376, 46.93891], [10.36933, 47.00212], [10.30031, 46.92093], [10.24128, 46.93147], [10.22675, 46.86942], [10.10715, 46.84296], [9.98058, 46.91434], [9.88266, 46.93343], [9.87935, 47.01337], [9.60717, 47.06091], [9.55721, 47.04762], [9.54041, 47.06495], [9.47548, 47.05257], [9.47139, 47.06402], [9.51362, 47.08505], [9.52089, 47.10019], [9.51044, 47.13727], [9.48774, 47.17402], [9.4891, 47.19346], [9.50318, 47.22153], [9.52406, 47.24959], [9.53116, 47.27029], [9.54773, 47.2809], [9.55857, 47.29919], [9.58513, 47.31334], [9.59978, 47.34671], [9.62476, 47.36639], [9.65427, 47.36824], [9.66243, 47.37136], [9.6711, 47.37824], [9.67445, 47.38429], [9.67334, 47.39191], [9.6629, 47.39591], [9.65136, 47.40504], [9.65043, 47.41937], [9.6446, 47.43233], [9.64483, 47.43842], [9.65863, 47.44847], [9.65728, 47.45383], [9.6423, 47.45599], [9.62475, 47.45685], [9.62158, 47.45858], [9.60841, 47.47178], [9.60484, 47.46358], [9.60205, 47.46165], [9.59482, 47.46305], [9.58208, 47.48344], [9.56312, 47.49495], [9.55125, 47.53629], [9.25619, 47.65939], [9.18203, 47.65598], [9.17593, 47.65399], [9.1755, 47.65584], [9.1705, 47.65513], [9.15181, 47.66904], [9.13845, 47.66389], [9.09891, 47.67801], [9.02093, 47.6868], [8.94093, 47.65596], [8.89946, 47.64769], [8.87625, 47.65441], [8.87383, 47.67045], [8.85065, 47.68209], [8.86989, 47.70504], [8.82002, 47.71458], [8.80663, 47.73821], [8.77309, 47.72059], [8.76965, 47.7075], [8.79966, 47.70222], [8.79511, 47.67462], [8.75856, 47.68969], [8.72809, 47.69282]], [[8.95861, 45.96485], [8.96668, 45.98436], [8.97741, 45.98317], [8.97604, 45.96151], [8.95861, 45.96485]], [[8.70847, 47.68904], [8.68985, 47.69552], [8.66837, 47.68437], [8.65769, 47.68928], [8.67508, 47.6979], [8.66416, 47.71367], [8.70237, 47.71453], [8.71773, 47.69088], [8.70847, 47.68904]]]] }, properties: { iso1A2: "CH", iso1A3: "CHE", iso1N3: "756", wikidata: "Q39", nameEn: "Switzerland", groups: ["155", "150", "UN"], callingCodes: ["41"] } },
22708 { type: "Feature", properties: { iso1A2: "CI", iso1A3: "CIV", iso1N3: "384", wikidata: "Q1008", nameEn: "C\xF4te d'Ivoire", groups: ["011", "202", "002", "UN"], callingCodes: ["225"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-7.52774, 3.7105], [-3.34019, 4.17519], [-3.10675, 5.08515], [-3.11073, 5.12675], [-3.063, 5.13665], [-2.96554, 5.10397], [-2.95261, 5.12477], [-2.75502, 5.10657], [-2.73074, 5.1364], [-2.77625, 5.34621], [-2.72737, 5.34789], [-2.76614, 5.60963], [-2.85378, 5.65156], [-2.93132, 5.62137], [-2.96671, 5.6415], [-2.95323, 5.71865], [-3.01896, 5.71697], [-3.25999, 6.62521], [-3.21954, 6.74407], [-3.23327, 6.81744], [-2.95438, 7.23737], [-2.97822, 7.27165], [-2.92339, 7.60847], [-2.79467, 7.86002], [-2.78395, 7.94974], [-2.74819, 7.92613], [-2.67787, 8.02055], [-2.61232, 8.02645], [-2.62901, 8.11495], [-2.49037, 8.20872], [-2.58243, 8.7789], [-2.66357, 9.01771], [-2.77799, 9.04949], [-2.69814, 9.22717], [-2.68802, 9.49343], [-2.76494, 9.40778], [-2.93012, 9.57403], [-3.00765, 9.74019], [-3.16609, 9.85147], [-3.19306, 9.93781], [-3.27228, 9.84981], [-3.31779, 9.91125], [-3.69703, 9.94279], [-4.25999, 9.76012], [-4.31392, 9.60062], [-4.6426, 9.70696], [-4.96621, 9.89132], [-4.96453, 9.99923], [-5.12465, 10.29788], [-5.39602, 10.2929], [-5.51058, 10.43177], [-5.65135, 10.46767], [-5.78124, 10.43952], [-5.99478, 10.19694], [-6.18851, 10.24244], [-6.1731, 10.46983], [-6.24795, 10.74248], [-6.325, 10.68624], [-6.40646, 10.69922], [-6.42847, 10.5694], [-6.52974, 10.59104], [-6.63541, 10.66893], [-6.68164, 10.35074], [-6.93921, 10.35291], [-7.01186, 10.25111], [-6.97444, 10.21644], [-7.00966, 10.15794], [-7.0603, 10.14711], [-7.13331, 10.24877], [-7.3707, 10.24677], [-7.44555, 10.44602], [-7.52261, 10.4655], [-7.54462, 10.40921], [-7.63048, 10.46334], [-7.92107, 10.15577], [-7.97971, 10.17117], [-8.01225, 10.1021], [-8.11921, 10.04577], [-8.15652, 9.94288], [-8.09434, 9.86936], [-8.14657, 9.55062], [-8.03463, 9.39604], [-7.85056, 9.41812], [-7.90777, 9.20456], [-7.73862, 9.08422], [-7.92518, 8.99332], [-7.95503, 8.81146], [-7.69882, 8.66148], [-7.65653, 8.36873], [-7.92518, 8.50652], [-8.22991, 8.48438], [-8.2411, 8.24196], [-8.062, 8.16071], [-7.98675, 8.20134], [-7.99919, 8.11023], [-7.94695, 8.00925], [-8.06449, 8.04989], [-8.13414, 7.87991], [-8.09931, 7.78626], [-8.21374, 7.54466], [-8.4003, 7.6285], [-8.47114, 7.55676], [-8.41935, 7.51203], [-8.37458, 7.25794], [-8.29249, 7.1691], [-8.31736, 6.82837], [-8.59456, 6.50612], [-8.48652, 6.43797], [-8.45666, 6.49977], [-8.38453, 6.35887], [-8.3298, 6.36381], [-8.17557, 6.28222], [-8.00642, 6.31684], [-7.90692, 6.27728], [-7.83478, 6.20309], [-7.8497, 6.08932], [-7.79747, 6.07696], [-7.78254, 5.99037], [-7.70294, 5.90625], [-7.67309, 5.94337], [-7.48155, 5.80974], [-7.46165, 5.84934], [-7.43677, 5.84687], [-7.43926, 5.74787], [-7.37209, 5.61173], [-7.43428, 5.42355], [-7.36463, 5.32944], [-7.46165, 5.26256], [-7.48901, 5.14118], [-7.55369, 5.08667], [-7.53876, 4.94294], [-7.59349, 4.8909], [-7.53259, 4.35145], [-7.52774, 3.7105]]]] } },
22709 { type: "Feature", properties: { iso1A2: "CK", iso1A3: "COK", iso1N3: "184", wikidata: "Q26988", nameEn: "Cook Islands", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["682"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.15106, -10.26955], [-156.45576, -31.75456], [-156.48634, -15.52824], [-156.50903, -7.4975], [-168.15106, -10.26955]]]] } },
22710 { type: "Feature", properties: { iso1A2: "CL", iso1A3: "CHL", iso1N3: "152", wikidata: "Q298", nameEn: "Chile", groups: ["005", "419", "019", "UN"], callingCodes: ["56"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.60702, -52.65781], [-68.41683, -52.33516], [-69.97824, -52.00845], [-71.99889, -51.98018], [-72.33873, -51.59954], [-72.31343, -50.58411], [-73.15765, -50.78337], [-73.55259, -49.92488], [-73.45156, -49.79461], [-73.09655, -49.14342], [-72.56894, -48.81116], [-72.54042, -48.52392], [-72.27662, -48.28727], [-72.50478, -47.80586], [-71.94152, -47.13595], [-71.68577, -46.55385], [-71.75614, -45.61611], [-71.35687, -45.22075], [-72.06985, -44.81756], [-71.26418, -44.75684], [-71.16436, -44.46244], [-71.81318, -44.38097], [-71.64206, -43.64774], [-72.14828, -42.85321], [-72.15541, -42.15941], [-71.74901, -42.11711], [-71.92726, -40.72714], [-71.37826, -38.91474], [-70.89532, -38.6923], [-71.24279, -37.20264], [-70.95047, -36.4321], [-70.38008, -36.02375], [-70.49416, -35.24145], [-69.87386, -34.13344], [-69.88099, -33.34489], [-70.55832, -31.51559], [-70.14479, -30.36595], [-69.8596, -30.26131], [-69.99507, -29.28351], [-69.80969, -29.07185], [-69.66709, -28.44055], [-69.22504, -27.95042], [-68.77586, -27.16029], [-68.43363, -27.08414], [-68.27677, -26.90626], [-68.59048, -26.49861], [-68.56909, -26.28146], [-68.38372, -26.15353], [-68.57622, -25.32505], [-68.38372, -25.08636], [-68.56909, -24.69831], [-68.24825, -24.42596], [-67.33563, -24.04237], [-66.99632, -22.99839], [-67.18382, -22.81525], [-67.54284, -22.89771], [-67.85114, -22.87076], [-68.18816, -21.28614], [-68.40403, -20.94562], [-68.53957, -20.91542], [-68.55383, -20.7355], [-68.44023, -20.62701], [-68.7276, -20.46178], [-68.74273, -20.08817], [-68.57132, -20.03134], [-68.54611, -19.84651], [-68.66761, -19.72118], [-68.41218, -19.40499], [-68.61989, -19.27584], [-68.80602, -19.08355], [-68.87082, -19.06003], [-68.94987, -18.93302], [-69.07432, -18.28259], [-69.14807, -18.16893], [-69.07496, -18.03715], [-69.28671, -17.94844], [-69.34126, -17.72753], [-69.46623, -17.60518], [-69.46897, -17.4988], [-69.66483, -17.65083], [-69.79087, -17.65563], [-69.82868, -17.72048], [-69.75305, -17.94605], [-69.81607, -18.12582], [-69.96732, -18.25992], [-70.16394, -18.31737], [-70.31267, -18.31258], [-70.378, -18.3495], [-70.59118, -18.35072], [-113.52687, -26.52828], [-68.11646, -58.14883], [-66.07313, -55.19618], [-67.11046, -54.94199], [-67.46182, -54.92205], [-68.01394, -54.8753], [-68.60733, -54.9125], [-68.60702, -52.65781]]]] } },
22711 { type: "Feature", properties: { iso1A2: "CM", iso1A3: "CMR", iso1N3: "120", wikidata: "Q1009", nameEn: "Cameroon", groups: ["017", "202", "002", "UN"], callingCodes: ["237"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.83314, 12.62963], [14.55058, 12.78256], [14.56101, 12.91036], [14.46881, 13.08259], [14.08251, 13.0797], [14.20204, 12.53405], [14.17523, 12.41916], [14.22215, 12.36533], [14.4843, 12.35223], [14.6474, 12.17466], [14.61612, 11.7798], [14.55207, 11.72001], [14.64591, 11.66166], [14.6124, 11.51283], [14.17821, 11.23831], [13.97489, 11.30258], [13.78945, 11.00154], [13.7403, 11.00593], [13.70753, 10.94451], [13.73434, 10.9255], [13.54964, 10.61236], [13.5705, 10.53183], [13.43644, 10.13326], [13.34111, 10.12299], [13.25025, 10.03647], [13.25323, 10.00127], [13.286, 9.9822], [13.27409, 9.93232], [13.24132, 9.91031], [13.25025, 9.86042], [13.29941, 9.8296], [13.25472, 9.76795], [13.22642, 9.57266], [13.02385, 9.49334], [12.85628, 9.36698], [12.91958, 9.33905], [12.90022, 9.11411], [12.81085, 8.91992], [12.79, 8.75361], [12.71701, 8.7595], [12.68722, 8.65938], [12.44146, 8.6152], [12.4489, 8.52536], [12.26123, 8.43696], [12.24782, 8.17904], [12.19271, 8.10826], [12.20909, 7.97553], [11.99908, 7.67302], [12.01844, 7.52981], [11.93205, 7.47812], [11.84864, 7.26098], [11.87396, 7.09398], [11.63117, 6.9905], [11.55818, 6.86186], [11.57755, 6.74059], [11.51499, 6.60892], [11.42264, 6.5882], [11.42041, 6.53789], [11.09495, 6.51717], [11.09644, 6.68437], [10.94302, 6.69325], [10.8179, 6.83377], [10.83727, 6.9358], [10.60789, 7.06885], [10.59746, 7.14719], [10.57214, 7.16345], [10.53639, 6.93432], [10.21466, 6.88996], [10.15135, 7.03781], [9.86314, 6.77756], [9.77824, 6.79088], [9.70674, 6.51717], [9.51757, 6.43874], [8.84209, 5.82562], [8.88156, 5.78857], [8.83687, 5.68483], [8.92029, 5.58403], [8.78027, 5.1243], [8.60302, 4.87353], [8.34397, 4.30689], [9.22018, 3.72052], [9.81162, 2.33797], [9.82123, 2.35097], [9.83754, 2.32428], [9.83238, 2.29079], [9.84716, 2.24676], [9.89012, 2.20457], [9.90749, 2.20049], [9.991, 2.16561], [11.3561, 2.17217], [11.37116, 2.29975], [13.28534, 2.25716], [13.29457, 2.16106], [14.61145, 2.17866], [15.00996, 1.98887], [15.22634, 2.03243], [15.34776, 1.91264], [15.48942, 1.98265], [16.02959, 1.76483], [16.02647, 1.65591], [16.14634, 1.70259], [16.05294, 1.9811], [16.08563, 2.19733], [16.15568, 2.18955], [16.19357, 2.21537], [16.08252, 2.45708], [16.05449, 3.02306], [15.77725, 3.26835], [15.73522, 3.24348], [15.07686, 4.01805], [15.17482, 4.05131], [15.10644, 4.1362], [15.08609, 4.30282], [15.00825, 4.41458], [14.73383, 4.6135], [14.65489, 5.21343], [14.57083, 5.23979], [14.52724, 5.28319], [14.62531, 5.51411], [14.58951, 5.59777], [14.62375, 5.70466], [14.60974, 5.91838], [14.49455, 5.91683], [14.42917, 6.00508], [14.43073, 6.08867], [14.56149, 6.18928], [14.74206, 6.26356], [14.80122, 6.34866], [14.79966, 6.39043], [14.96311, 6.75693], [15.04717, 6.77085], [15.23397, 7.25135], [15.49743, 7.52179], [15.56964, 7.58936], [15.59272, 7.7696], [15.50743, 7.79302], [15.20426, 8.50892], [15.09484, 8.65982], [14.83566, 8.80557], [14.35707, 9.19611], [14.37094, 9.2954], [13.97544, 9.6365], [14.01793, 9.73169], [14.1317, 9.82413], [14.20411, 10.00055], [14.4673, 10.00264], [14.80082, 9.93818], [14.95722, 9.97926], [15.05999, 9.94845], [15.14043, 9.99246], [15.24618, 9.99246], [15.41408, 9.92876], [15.68761, 9.99344], [15.50535, 10.1098], [15.30874, 10.31063], [15.23724, 10.47764], [15.14936, 10.53915], [15.15532, 10.62846], [15.06737, 10.80921], [15.09127, 10.87431], [15.04957, 11.02347], [15.10021, 11.04101], [15.0585, 11.40481], [15.13149, 11.5537], [15.06595, 11.71126], [15.11579, 11.79313], [15.04808, 11.8731], [15.05786, 12.0608], [15.0349, 12.10698], [15.00146, 12.1223], [14.96952, 12.0925], [14.89019, 12.16593], [14.90827, 12.3269], [14.83314, 12.62963]]]] } },
22712 { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
22713 { type: "Feature", properties: { iso1A2: "CO", iso1A3: "COL", iso1N3: "170", wikidata: "Q739", nameEn: "Colombia", groups: ["005", "419", "019", "UN"], callingCodes: ["57"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.19849, 12.65801], [-81.58685, 18.0025], [-82.06974, 14.49418], [-82.56142, 11.91792], [-78.79327, 9.93766], [-77.58292, 9.22278], [-77.32389, 8.81247], [-77.45064, 8.49991], [-77.17257, 7.97422], [-77.57185, 7.51147], [-77.72514, 7.72348], [-77.72157, 7.47612], [-77.81426, 7.48319], [-77.89178, 7.22681], [-78.06168, 7.07793], [-82.12561, 4.00341], [-78.87137, 1.47457], [-78.42749, 1.15389], [-77.85677, 0.80197], [-77.7148, 0.85003], [-77.68613, 0.83029], [-77.66416, 0.81604], [-77.67815, 0.73863], [-77.49984, 0.64476], [-77.52001, 0.40782], [-76.89177, 0.24736], [-76.4094, 0.24015], [-76.41215, 0.38228], [-76.23441, 0.42294], [-75.82927, 0.09578], [-75.25764, -0.11943], [-75.18513, -0.0308], [-74.42701, -0.50218], [-74.26675, -0.97229], [-73.65312, -1.26222], [-72.92587, -2.44514], [-71.75223, -2.15058], [-70.94377, -2.23142], [-70.04609, -2.73906], [-70.71396, -3.7921], [-70.52393, -3.87553], [-70.3374, -3.79505], [-69.94708, -4.2431], [-69.43395, -1.42219], [-69.4215, -1.01853], [-69.59796, -0.75136], [-69.603, -0.51947], [-70.03658, -0.19681], [-70.04162, 0.55437], [-69.47696, 0.71065], [-69.20976, 0.57958], [-69.14422, 0.84172], [-69.26017, 1.06856], [-69.82987, 1.07864], [-69.83491, 1.69353], [-69.53746, 1.76408], [-69.38621, 1.70865], [-68.18128, 1.72881], [-68.26699, 1.83463], [-68.18632, 2.00091], [-67.9292, 1.82455], [-67.40488, 2.22258], [-67.299, 1.87494], [-67.15784, 1.80439], [-67.08222, 1.17441], [-66.85795, 1.22998], [-67.21967, 2.35778], [-67.65696, 2.81691], [-67.85862, 2.79173], [-67.85862, 2.86727], [-67.30945, 3.38393], [-67.50067, 3.75812], [-67.62671, 3.74303], [-67.85358, 4.53249], [-67.83341, 5.31104], [-67.59141, 5.5369], [-67.63914, 5.64963], [-67.58558, 5.84537], [-67.43513, 5.98835], [-67.4625, 6.20625], [-67.60654, 6.2891], [-69.41843, 6.1072], [-70.10716, 6.96516], [-70.7596, 7.09799], [-71.03941, 6.98163], [-71.37234, 7.01588], [-71.42212, 7.03854], [-71.44118, 7.02116], [-71.82441, 7.04314], [-72.04895, 7.03837], [-72.19437, 7.37034], [-72.43132, 7.40034], [-72.47415, 7.48928], [-72.45321, 7.57232], [-72.47827, 7.65604], [-72.46763, 7.79518], [-72.44454, 7.86031], [-72.46183, 7.90682], [-72.45806, 7.91141], [-72.47042, 7.92306], [-72.48183, 7.92909], [-72.48801, 7.94329], [-72.47213, 7.96106], [-72.39137, 8.03534], [-72.35163, 8.01163], [-72.36987, 8.19976], [-72.4042, 8.36513], [-72.65474, 8.61428], [-72.77415, 9.10165], [-72.94052, 9.10663], [-73.02119, 9.27584], [-73.36905, 9.16636], [-72.98085, 9.85253], [-72.88002, 10.44309], [-72.4767, 11.1117], [-72.24983, 11.14138], [-71.9675, 11.65536], [-71.3275, 11.85], [-70.92579, 11.96275], [-71.19849, 12.65801]]]] } },
22714 { type: "Feature", properties: { iso1A2: "CP", iso1A3: "CPT", wikidata: "Q161258", nameEn: "Clipperton Island", country: "FR", groups: ["EU", "013", "003", "019", "UN"], isoStatus: "excRes" }, geometry: { type: "MultiPolygon", coordinates: [[[[-110.36279, 9.79626], [-108.755, 9.84085], [-109.04145, 11.13245], [-110.36279, 9.79626]]]] } },
22715 { type: "Feature", properties: { iso1A2: "CR", iso1A3: "CRI", iso1N3: "188", wikidata: "Q800", nameEn: "Costa Rica", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["506"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.68276, 11.01562], [-83.66597, 10.79916], [-83.90838, 10.71161], [-84.68197, 11.07568], [-84.92439, 10.9497], [-85.60529, 11.22607], [-85.71223, 11.06868], [-86.14524, 11.09059], [-87.41779, 5.02401], [-82.94503, 7.93865], [-82.89978, 8.04083], [-82.89137, 8.05755], [-82.88641, 8.10219], [-82.9388, 8.26634], [-83.05209, 8.33394], [-82.93056, 8.43465], [-82.8679, 8.44042], [-82.8382, 8.48117], [-82.83322, 8.52464], [-82.83975, 8.54755], [-82.82739, 8.60153], [-82.8794, 8.6981], [-82.92068, 8.74832], [-82.91377, 8.774], [-82.88253, 8.83331], [-82.72126, 8.97125], [-82.93516, 9.07687], [-82.93516, 9.46741], [-82.84871, 9.4973], [-82.87919, 9.62645], [-82.77206, 9.59573], [-82.66667, 9.49746], [-82.61345, 9.49881], [-82.56507, 9.57279], [-82.51044, 9.65379], [-83.54024, 10.96805], [-83.68276, 11.01562]]]] } },
22716 { type: "Feature", properties: { iso1A2: "CU", iso1A3: "CUB", iso1N3: "192", wikidata: "Q241", nameEn: "Cuba", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["53"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-73.62304, 20.6935], [-82.02215, 24.23074], [-85.77883, 21.92705], [-74.81171, 18.82201], [-73.62304, 20.6935]]]] } },
22717 { type: "Feature", properties: { iso1A2: "CV", iso1A3: "CPV", iso1N3: "132", wikidata: "Q1011", nameEn: "Cape Verde", groups: ["Q105472", "011", "202", "002", "UN"], callingCodes: ["238"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-28.81604, 14.57305], [-20.39702, 14.12816], [-23.37101, 19.134], [-28.81604, 14.57305]]]] } },
22718 { type: "Feature", properties: { iso1A2: "CW", iso1A3: "CUW", iso1N3: "531", wikidata: "Q25279", nameEn: "Cura\xE7ao", aliases: ["NL-CW"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["599"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-68.90012, 12.62309], [-69.59009, 12.46019], [-68.99639, 11.79035], [-68.33524, 11.78151], [-68.90012, 12.62309]]]] } },
22719 { type: "Feature", properties: { iso1A2: "CX", iso1A3: "CXR", iso1N3: "162", wikidata: "Q31063", nameEn: "Christmas Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["61"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.66835, -9.31927], [104.67494, -11.2566], [106.66176, -11.14349], [105.66835, -9.31927]]]] } },
22720 { type: "Feature", properties: { iso1A2: "CY", iso1A3: "CYP", iso1N3: "196", wikidata: "Q229", nameEn: "Republic of Cyprus", groups: ["Q644636", "EU", "145", "142", "UN"], driveSide: "left", callingCodes: ["357"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.46489, 35.48584], [30.15137, 34.08517], [32.74412, 34.43926], [32.75515, 34.64985], [32.76136, 34.68318], [32.79433, 34.67883], [32.82717, 34.70622], [32.86014, 34.70585], [32.86167, 34.68734], [32.9068, 34.66102], [32.91398, 34.67343], [32.93043, 34.67091], [32.92807, 34.66736], [32.93449, 34.66241], [32.93693, 34.67027], [32.94379, 34.67111], [32.94683, 34.67907], [32.95539, 34.68471], [32.99135, 34.68061], [32.98668, 34.67268], [32.99014, 34.65518], [32.97736, 34.65277], [32.97079, 34.66112], [32.95325, 34.66462], [32.94796, 34.6587], [32.94976, 34.65204], [32.95471, 34.64528], [32.95323, 34.64075], [32.95891, 34.62919], [32.96718, 34.63446], [32.96968, 34.64046], [33.0138, 34.64424], [33.26744, 34.49942], [33.83531, 34.73974], [33.70575, 34.97947], [33.70639, 34.99303], [33.71514, 35.00294], [33.69731, 35.01754], [33.69938, 35.03123], [33.67678, 35.03866], [33.63765, 35.03869], [33.61215, 35.0527], [33.59658, 35.03635], [33.567, 35.04803], [33.57478, 35.06049], [33.53975, 35.08151], [33.48915, 35.06594], [33.47666, 35.00701], [33.45256, 35.00288], [33.45178, 35.02078], [33.47825, 35.04103], [33.48136, 35.0636], [33.46813, 35.10564], [33.41675, 35.16325], [33.4076, 35.20062], [33.38575, 35.2018], [33.37248, 35.18698], [33.3717, 35.1788], [33.36569, 35.17479], [33.35612, 35.17402], [33.35596, 35.17942], [33.34964, 35.17803], [33.35056, 35.18328], [33.31955, 35.18096], [33.3072, 35.16816], [33.27068, 35.16815], [33.15138, 35.19504], [33.11105, 35.15639], [33.08249, 35.17319], [33.01192, 35.15639], [32.94471, 35.09422], [32.86406, 35.1043], [32.85733, 35.07742], [32.70779, 35.14127], [32.70947, 35.18328], [32.64864, 35.19967], [32.60361, 35.16647], [32.46489, 35.48584]]], [[[33.74144, 35.01053], [33.7492, 35.01319], [33.74983, 35.02274], [33.74265, 35.02329], [33.73781, 35.02181], [33.7343, 35.01178], [33.74144, 35.01053]]], [[[33.77312, 34.9976], [33.75994, 35.00113], [33.75682, 34.99916], [33.76605, 34.99543], [33.76738, 34.99188], [33.7778, 34.98981], [33.77843, 34.988], [33.78149, 34.98854], [33.78318, 34.98699], [33.78571, 34.98951], [33.78917, 34.98854], [33.79191, 34.98914], [33.78516, 34.99582], [33.77553, 34.99518], [33.77312, 34.9976]]]] } },
22721 { type: "Feature", properties: { iso1A2: "CZ", iso1A3: "CZE", iso1N3: "203", wikidata: "Q213", nameEn: "Czechia", groups: ["EU", "151", "150", "UN"], callingCodes: ["420"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.82803, 50.86966], [14.79139, 50.81438], [14.70661, 50.84096], [14.61993, 50.86049], [14.63434, 50.8883], [14.65259, 50.90513], [14.64802, 50.93241], [14.58024, 50.91443], [14.56374, 50.922], [14.59702, 50.96148], [14.59908, 50.98685], [14.58215, 50.99306], [14.56432, 51.01008], [14.53438, 51.00374], [14.53321, 51.01679], [14.49873, 51.02242], [14.50809, 51.0427], [14.49991, 51.04692], [14.49154, 51.04382], [14.49202, 51.02286], [14.45827, 51.03712], [14.41335, 51.02086], [14.30098, 51.05515], [14.25665, 50.98935], [14.28776, 50.97718], [14.32353, 50.98556], [14.32793, 50.97379], [14.30251, 50.96606], [14.31422, 50.95243], [14.39848, 50.93866], [14.38691, 50.89907], [14.30098, 50.88448], [14.27123, 50.89386], [14.24314, 50.88761], [14.22331, 50.86049], [14.02982, 50.80662], [13.98864, 50.8177], [13.89113, 50.78533], [13.89444, 50.74142], [13.82942, 50.7251], [13.76316, 50.73487], [13.70204, 50.71771], [13.65977, 50.73096], [13.52474, 50.70394], [13.53748, 50.67654], [13.5226, 50.64721], [13.49742, 50.63133], [13.46413, 50.60102], [13.42189, 50.61243], [13.37485, 50.64931], [13.37805, 50.627], [13.32264, 50.60317], [13.32594, 50.58009], [13.29454, 50.57904], [13.25158, 50.59268], [13.19043, 50.50237], [13.13424, 50.51709], [13.08301, 50.50132], [13.0312, 50.50944], [13.02038, 50.4734], [13.02147, 50.44763], [12.98433, 50.42016], [12.94058, 50.40944], [12.82465, 50.45738], [12.73476, 50.43237], [12.73044, 50.42268], [12.70731, 50.39948], [12.67261, 50.41949], [12.51356, 50.39694], [12.48747, 50.37278], [12.49214, 50.35228], [12.48256, 50.34784], [12.46643, 50.35527], [12.43722, 50.33774], [12.43371, 50.32506], [12.39924, 50.32302], [12.40158, 50.29521], [12.36594, 50.28289], [12.35425, 50.23993], [12.33263, 50.24367], [12.32445, 50.20442], [12.33847, 50.19432], [12.32596, 50.17146], [12.29232, 50.17524], [12.28063, 50.19544], [12.28755, 50.22429], [12.23943, 50.24594], [12.24791, 50.25525], [12.26953, 50.25189], [12.25119, 50.27079], [12.20823, 50.2729], [12.18013, 50.32146], [12.10907, 50.32041], [12.13716, 50.27396], [12.09287, 50.25032], [12.19335, 50.19997], [12.21484, 50.16399], [12.1917, 50.13434], [12.2073, 50.10315], [12.23709, 50.10213], [12.27433, 50.0771], [12.26111, 50.06331], [12.30798, 50.05719], [12.49908, 49.97305], [12.47264, 49.94222], [12.55197, 49.92094], [12.48256, 49.83575], [12.46603, 49.78882], [12.40489, 49.76321], [12.4462, 49.70233], [12.52553, 49.68415], [12.53544, 49.61888], [12.56188, 49.6146], [12.60155, 49.52887], [12.64782, 49.52565], [12.64121, 49.47628], [12.669, 49.42935], [12.71227, 49.42363], [12.75854, 49.3989], [12.78168, 49.34618], [12.88414, 49.33541], [12.88249, 49.35479], [12.94859, 49.34079], [13.03618, 49.30417], [13.02957, 49.27399], [13.05883, 49.26259], [13.17665, 49.16713], [13.17019, 49.14339], [13.20405, 49.12303], [13.23689, 49.11412], [13.28242, 49.1228], [13.39479, 49.04812], [13.40802, 48.98851], [13.50221, 48.93752], [13.50552, 48.97441], [13.58319, 48.96899], [13.61624, 48.9462], [13.67739, 48.87886], [13.73854, 48.88538], [13.76994, 48.83537], [13.78977, 48.83319], [13.8096, 48.77877], [13.84023, 48.76988], [14.06151, 48.66873], [14.01482, 48.63788], [14.09104, 48.5943], [14.20691, 48.5898], [14.33909, 48.55852], [14.43076, 48.58855], [14.4587, 48.64695], [14.56139, 48.60429], [14.60808, 48.62881], [14.66762, 48.58215], [14.71794, 48.59794], [14.72756, 48.69502], [14.80584, 48.73489], [14.80821, 48.77711], [14.81545, 48.7874], [14.94773, 48.76268], [14.95641, 48.75915], [14.9758, 48.76857], [14.98112, 48.77524], [14.9782, 48.7766], [14.98032, 48.77959], [14.95072, 48.79101], [14.98917, 48.90082], [14.97612, 48.96983], [14.99878, 49.01444], [15.15534, 48.99056], [15.16358, 48.94278], [15.26177, 48.95766], [15.28305, 48.98831], [15.34823, 48.98444], [15.48027, 48.94481], [15.51357, 48.91549], [15.61622, 48.89541], [15.6921, 48.85973], [15.75341, 48.8516], [15.78087, 48.87644], [15.84404, 48.86921], [16.06034, 48.75436], [16.37345, 48.729], [16.40915, 48.74576], [16.46134, 48.80865], [16.67008, 48.77699], [16.68518, 48.7281], [16.71883, 48.73806], [16.79779, 48.70998], [16.90354, 48.71541], [16.93955, 48.60371], [17.00215, 48.70887], [17.11202, 48.82925], [17.19355, 48.87602], [17.29054, 48.85546], [17.3853, 48.80936], [17.45671, 48.85004], [17.5295, 48.81117], [17.7094, 48.86721], [17.73126, 48.87885], [17.77944, 48.92318], [17.87831, 48.92679], [17.91814, 49.01784], [18.06885, 49.03157], [18.1104, 49.08624], [18.15022, 49.24518], [18.18456, 49.28909], [18.36446, 49.3267], [18.4139, 49.36517], [18.4084, 49.40003], [18.44686, 49.39467], [18.54848, 49.47059], [18.53063, 49.49022], [18.57183, 49.51162], [18.6144, 49.49824], [18.67757, 49.50895], [18.74761, 49.492], [18.84521, 49.51672], [18.84786, 49.5446], [18.80479, 49.6815], [18.72838, 49.68163], [18.69817, 49.70473], [18.62676, 49.71983], [18.62943, 49.74603], [18.62645, 49.75002], [18.61368, 49.75426], [18.61278, 49.7618], [18.57183, 49.83334], [18.60341, 49.86256], [18.57045, 49.87849], [18.57697, 49.91565], [18.54299, 49.92537], [18.54495, 49.9079], [18.53423, 49.89906], [18.41604, 49.93498], [18.33562, 49.94747], [18.33278, 49.92415], [18.31914, 49.91565], [18.27794, 49.93863], [18.27107, 49.96779], [18.21752, 49.97309], [18.20241, 49.99958], [18.10628, 50.00223], [18.07898, 50.04535], [18.03212, 50.06574], [18.00396, 50.04954], [18.04585, 50.03311], [18.04585, 50.01194], [18.00191, 50.01723], [17.86886, 49.97452], [17.77669, 50.02253], [17.7506, 50.07896], [17.6888, 50.12037], [17.66683, 50.10275], [17.59404, 50.16437], [17.70528, 50.18812], [17.76296, 50.23382], [17.72176, 50.25665], [17.74648, 50.29966], [17.69292, 50.32859], [17.67764, 50.28977], [17.58889, 50.27837], [17.3702, 50.28123], [17.34548, 50.2628], [17.34273, 50.32947], [17.27681, 50.32246], [17.19991, 50.3654], [17.19579, 50.38817], [17.14498, 50.38117], [17.1224, 50.39494], [16.89229, 50.45117], [16.85933, 50.41093], [16.90877, 50.38642], [16.94448, 50.31281], [16.99803, 50.30316], [17.02138, 50.27772], [16.99803, 50.25753], [17.02825, 50.23118], [17.00353, 50.21449], [16.98018, 50.24172], [16.8456, 50.20834], [16.7014, 50.09659], [16.63137, 50.1142], [16.55446, 50.16613], [16.56407, 50.21009], [16.42674, 50.32509], [16.39379, 50.3207], [16.3622, 50.34875], [16.36495, 50.37679], [16.30289, 50.38292], [16.28118, 50.36891], [16.22821, 50.41054], [16.21585, 50.40627], [16.19526, 50.43291], [16.31413, 50.50274], [16.34572, 50.49575], [16.44597, 50.58041], [16.33611, 50.66579], [16.23174, 50.67101], [16.20839, 50.63096], [16.10265, 50.66405], [16.02437, 50.60046], [15.98317, 50.61528], [16.0175, 50.63009], [15.97219, 50.69799], [15.87331, 50.67188], [15.81683, 50.75666], [15.73186, 50.73885], [15.43798, 50.80833], [15.3803, 50.77187], [15.36656, 50.83956], [15.2773, 50.8907], [15.27043, 50.97724], [15.2361, 50.99886], [15.1743, 50.9833], [15.16744, 51.01959], [15.11937, 50.99021], [15.10152, 51.01095], [15.06218, 51.02269], [15.03895, 51.0123], [15.02433, 51.0242], [14.96419, 50.99108], [15.01088, 50.97984], [14.99852, 50.86817], [14.82803, 50.86966]]]] } },
22722 { type: "Feature", properties: { iso1A2: "DE", iso1A3: "DEU", iso1N3: "276", wikidata: "Q183", nameEn: "Germany", groups: ["EU", "155", "150", "UN"], callingCodes: ["49"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.70847, 47.68904], [8.71773, 47.69088], [8.70237, 47.71453], [8.66416, 47.71367], [8.67508, 47.6979], [8.65769, 47.68928], [8.66837, 47.68437], [8.68985, 47.69552], [8.70847, 47.68904]]], [[[8.72617, 47.69651], [8.72809, 47.69282], [8.75856, 47.68969], [8.79511, 47.67462], [8.79966, 47.70222], [8.76965, 47.7075], [8.77309, 47.72059], [8.80663, 47.73821], [8.82002, 47.71458], [8.86989, 47.70504], [8.85065, 47.68209], [8.87383, 47.67045], [8.87625, 47.65441], [8.89946, 47.64769], [8.94093, 47.65596], [9.02093, 47.6868], [9.09891, 47.67801], [9.13845, 47.66389], [9.15181, 47.66904], [9.1705, 47.65513], [9.1755, 47.65584], [9.17593, 47.65399], [9.18203, 47.65598], [9.25619, 47.65939], [9.55125, 47.53629], [9.72736, 47.53457], [9.76748, 47.5934], [9.80254, 47.59419], [9.82591, 47.58158], [9.8189, 47.54688], [9.87499, 47.52953], [9.87733, 47.54688], [9.92407, 47.53111], [9.96029, 47.53899], [10.00003, 47.48216], [10.03859, 47.48927], [10.07131, 47.45531], [10.09001, 47.46005], [10.1052, 47.4316], [10.06897, 47.40709], [10.09819, 47.35724], [10.11805, 47.37228], [10.16362, 47.36674], [10.17648, 47.38889], [10.2127, 47.38019], [10.22774, 47.38904], [10.23757, 47.37609], [10.19998, 47.32832], [10.2147, 47.31014], [10.17648, 47.29149], [10.17531, 47.27167], [10.23257, 47.27088], [10.33424, 47.30813], [10.39851, 47.37623], [10.4324, 47.38494], [10.4359, 47.41183], [10.47446, 47.43318], [10.46278, 47.47901], [10.44291, 47.48453], [10.4324, 47.50111], [10.44992, 47.5524], [10.43473, 47.58394], [10.47329, 47.58552], [10.48849, 47.54057], [10.56912, 47.53584], [10.60337, 47.56755], [10.63456, 47.5591], [10.68832, 47.55752], [10.6965, 47.54253], [10.7596, 47.53228], [10.77596, 47.51729], [10.88814, 47.53701], [10.91268, 47.51334], [10.86945, 47.5015], [10.87061, 47.4786], [10.90918, 47.48571], [10.93839, 47.48018], [10.92437, 47.46991], [10.98513, 47.42882], [10.97111, 47.41617], [10.97111, 47.39561], [11.11835, 47.39719], [11.12536, 47.41222], [11.20482, 47.43198], [11.25157, 47.43277], [11.22002, 47.3964], [11.27844, 47.39956], [11.29597, 47.42566], [11.33804, 47.44937], [11.4175, 47.44621], [11.38128, 47.47465], [11.4362, 47.51413], [11.52618, 47.50939], [11.58578, 47.52281], [11.58811, 47.55515], [11.60681, 47.57881], [11.63934, 47.59202], [11.84052, 47.58354], [11.85572, 47.60166], [12.0088, 47.62451], [12.02282, 47.61033], [12.05788, 47.61742], [12.13734, 47.60639], [12.17824, 47.61506], [12.18145, 47.61019], [12.17737, 47.60121], [12.18568, 47.6049], [12.20398, 47.60667], [12.20801, 47.61082], [12.19895, 47.64085], [12.18507, 47.65984], [12.18347, 47.66663], [12.16769, 47.68167], [12.16217, 47.70105], [12.18303, 47.70065], [12.22571, 47.71776], [12.2542, 47.7433], [12.26238, 47.73544], [12.24017, 47.69534], [12.26004, 47.67725], [12.27991, 47.68827], [12.336, 47.69534], [12.37222, 47.68433], [12.43883, 47.6977], [12.44117, 47.6741], [12.50076, 47.62293], [12.53816, 47.63553], [12.57438, 47.63238], [12.6071, 47.6741], [12.7357, 47.6787], [12.77777, 47.66689], [12.76492, 47.64485], [12.82101, 47.61493], [12.77427, 47.58025], [12.80699, 47.54477], [12.84672, 47.54556], [12.85256, 47.52741], [12.9624, 47.47452], [12.98344, 47.48716], [12.9998, 47.46267], [13.04537, 47.49426], [13.03252, 47.53373], [13.05355, 47.56291], [13.04537, 47.58183], [13.06641, 47.58577], [13.06407, 47.60075], [13.09562, 47.63304], [13.07692, 47.68814], [13.01382, 47.72116], [12.98578, 47.7078], [12.92969, 47.71094], [12.91333, 47.7178], [12.90274, 47.72513], [12.91711, 47.74026], [12.9353, 47.74788], [12.94371, 47.76281], [12.93202, 47.77302], [12.96311, 47.79957], [12.98543, 47.82896], [13.00588, 47.84374], [12.94163, 47.92927], [12.93886, 47.94046], [12.93642, 47.94436], [12.93419, 47.94063], [12.92668, 47.93879], [12.91985, 47.94069], [12.9211, 47.95135], [12.91683, 47.95647], [12.87476, 47.96195], [12.8549, 48.01122], [12.76141, 48.07373], [12.74973, 48.10885], [12.7617, 48.12796], [12.78595, 48.12445], [12.80676, 48.14979], [12.82673, 48.15245], [12.8362, 48.15876], [12.836, 48.1647], [12.84475, 48.16556], [12.87126, 48.20318], [12.95306, 48.20629], [13.02083, 48.25689], [13.0851, 48.27711], [13.126, 48.27867], [13.18093, 48.29577], [13.26039, 48.29422], [13.30897, 48.31575], [13.40709, 48.37292], [13.43929, 48.43386], [13.42527, 48.45711], [13.45727, 48.51092], [13.43695, 48.55776], [13.45214, 48.56472], [13.46967, 48.55157], [13.50663, 48.57506], [13.50131, 48.58091], [13.51291, 48.59023], [13.57535, 48.55912], [13.59705, 48.57013], [13.62508, 48.55501], [13.65186, 48.55092], [13.66113, 48.53558], [13.72802, 48.51208], [13.74816, 48.53058], [13.7513, 48.5624], [13.76921, 48.55324], [13.80519, 48.58026], [13.80038, 48.59487], [13.82609, 48.62345], [13.81901, 48.6761], [13.81283, 48.68426], [13.81791, 48.69832], [13.79337, 48.71375], [13.81863, 48.73257], [13.82266, 48.75544], [13.84023, 48.76988], [13.8096, 48.77877], [13.78977, 48.83319], [13.76994, 48.83537], [13.73854, 48.88538], [13.67739, 48.87886], [13.61624, 48.9462], [13.58319, 48.96899], [13.50552, 48.97441], [13.50221, 48.93752], [13.40802, 48.98851], [13.39479, 49.04812], [13.28242, 49.1228], [13.23689, 49.11412], [13.20405, 49.12303], [13.17019, 49.14339], [13.17665, 49.16713], [13.05883, 49.26259], [13.02957, 49.27399], [13.03618, 49.30417], [12.94859, 49.34079], [12.88249, 49.35479], [12.88414, 49.33541], [12.78168, 49.34618], [12.75854, 49.3989], [12.71227, 49.42363], [12.669, 49.42935], [12.64121, 49.47628], [12.64782, 49.52565], [12.60155, 49.52887], [12.56188, 49.6146], [12.53544, 49.61888], [12.52553, 49.68415], [12.4462, 49.70233], [12.40489, 49.76321], [12.46603, 49.78882], [12.48256, 49.83575], [12.55197, 49.92094], [12.47264, 49.94222], [12.49908, 49.97305], [12.30798, 50.05719], [12.26111, 50.06331], [12.27433, 50.0771], [12.23709, 50.10213], [12.2073, 50.10315], [12.1917, 50.13434], [12.21484, 50.16399], [12.19335, 50.19997], [12.09287, 50.25032], [12.13716, 50.27396], [12.10907, 50.32041], [12.18013, 50.32146], [12.20823, 50.2729], [12.25119, 50.27079], [12.26953, 50.25189], [12.24791, 50.25525], [12.23943, 50.24594], [12.28755, 50.22429], [12.28063, 50.19544], [12.29232, 50.17524], [12.32596, 50.17146], [12.33847, 50.19432], [12.32445, 50.20442], [12.33263, 50.24367], [12.35425, 50.23993], [12.36594, 50.28289], [12.40158, 50.29521], [12.39924, 50.32302], [12.43371, 50.32506], [12.43722, 50.33774], [12.46643, 50.35527], [12.48256, 50.34784], [12.49214, 50.35228], [12.48747, 50.37278], [12.51356, 50.39694], [12.67261, 50.41949], [12.70731, 50.39948], [12.73044, 50.42268], [12.73476, 50.43237], [12.82465, 50.45738], [12.94058, 50.40944], [12.98433, 50.42016], [13.02147, 50.44763], [13.02038, 50.4734], [13.0312, 50.50944], [13.08301, 50.50132], [13.13424, 50.51709], [13.19043, 50.50237], [13.25158, 50.59268], [13.29454, 50.57904], [13.32594, 50.58009], [13.32264, 50.60317], [13.37805, 50.627], [13.37485, 50.64931], [13.42189, 50.61243], [13.46413, 50.60102], [13.49742, 50.63133], [13.5226, 50.64721], [13.53748, 50.67654], [13.52474, 50.70394], [13.65977, 50.73096], [13.70204, 50.71771], [13.76316, 50.73487], [13.82942, 50.7251], [13.89444, 50.74142], [13.89113, 50.78533], [13.98864, 50.8177], [14.02982, 50.80662], [14.22331, 50.86049], [14.24314, 50.88761], [14.27123, 50.89386], [14.30098, 50.88448], [14.38691, 50.89907], [14.39848, 50.93866], [14.31422, 50.95243], [14.30251, 50.96606], [14.32793, 50.97379], [14.32353, 50.98556], [14.28776, 50.97718], [14.25665, 50.98935], [14.30098, 51.05515], [14.41335, 51.02086], [14.45827, 51.03712], [14.49202, 51.02286], [14.49154, 51.04382], [14.49991, 51.04692], [14.50809, 51.0427], [14.49873, 51.02242], [14.53321, 51.01679], [14.53438, 51.00374], [14.56432, 51.01008], [14.58215, 50.99306], [14.59908, 50.98685], [14.59702, 50.96148], [14.56374, 50.922], [14.58024, 50.91443], [14.64802, 50.93241], [14.65259, 50.90513], [14.63434, 50.8883], [14.61993, 50.86049], [14.70661, 50.84096], [14.79139, 50.81438], [14.82803, 50.86966], [14.81664, 50.88148], [14.89681, 50.9422], [14.89252, 50.94999], [14.92942, 50.99744], [14.95529, 51.04552], [14.97938, 51.07742], [14.98229, 51.11354], [14.99689, 51.12205], [14.99079, 51.14284], [14.99646, 51.14365], [15.00083, 51.14974], [14.99414, 51.15813], [14.99311, 51.16249], [15.0047, 51.16874], [15.01242, 51.21285], [15.04288, 51.28387], [14.98008, 51.33449], [14.96899, 51.38367], [14.9652, 51.44793], [14.94749, 51.47155], [14.73219, 51.52922], [14.72652, 51.53902], [14.73047, 51.54606], [14.71125, 51.56209], [14.7727, 51.61263], [14.75759, 51.62318], [14.75392, 51.67445], [14.69065, 51.70842], [14.66386, 51.73282], [14.64625, 51.79472], [14.60493, 51.80473], [14.59089, 51.83302], [14.6588, 51.88359], [14.6933, 51.9044], [14.70601, 51.92944], [14.7177, 51.94048], [14.72163, 51.95188], [14.71836, 51.95606], [14.7139, 51.95643], [14.70488, 51.97679], [14.71339, 52.00337], [14.76026, 52.06624], [14.72971, 52.09167], [14.6917, 52.10283], [14.67683, 52.13936], [14.70616, 52.16927], [14.68344, 52.19612], [14.71319, 52.22144], [14.70139, 52.25038], [14.58149, 52.28007], [14.56378, 52.33838], [14.55228, 52.35264], [14.54423, 52.42568], [14.63056, 52.48993], [14.60081, 52.53116], [14.6289, 52.57136], [14.61073, 52.59847], [14.22071, 52.81175], [14.13806, 52.82392], [14.12256, 52.84311], [14.15873, 52.87715], [14.14056, 52.95786], [14.25954, 53.00264], [14.35044, 53.05829], [14.38679, 53.13669], [14.36696, 53.16444], [14.37853, 53.20405], [14.40662, 53.21098], [14.45125, 53.26241], [14.44133, 53.27427], [14.4215, 53.27724], [14.35209, 53.49506], [14.3273, 53.50587], [14.30416, 53.55499], [14.31904, 53.61581], [14.2853, 53.63392], [14.28477, 53.65955], [14.27133, 53.66613], [14.2836, 53.67721], [14.26782, 53.69866], [14.27249, 53.74464], [14.21323, 53.8664], [14.20823, 53.90776], [14.18544, 53.91258], [14.20647, 53.91671], [14.22634, 53.9291], [14.20811, 54.12784], [13.93395, 54.84044], [12.85844, 54.82438], [11.90309, 54.38543], [11.00303, 54.63689], [10.31111, 54.65968], [10.16755, 54.73883], [9.89314, 54.84171], [9.73563, 54.8247], [9.61187, 54.85548], [9.62734, 54.88057], [9.58937, 54.88785], [9.4659, 54.83131], [9.43155, 54.82586], [9.41213, 54.84254], [9.38532, 54.83968], [9.36496, 54.81749], [9.33849, 54.80233], [9.32771, 54.80602], [9.2474, 54.8112], [9.23445, 54.83432], [9.24631, 54.84726], [9.20571, 54.85841], [9.14275, 54.87421], [9.04629, 54.87249], [8.92795, 54.90452], [8.81178, 54.90518], [8.76387, 54.8948], [8.63979, 54.91069], [8.55769, 54.91837], [8.45719, 55.06747], [8.02459, 55.09613], [5.45168, 54.20039], [6.91025, 53.44221], [7.00198, 53.32672], [7.19052, 53.31866], [7.21679, 53.20058], [7.22681, 53.18165], [7.17898, 53.13817], [7.21694, 53.00742], [7.07253, 52.81083], [7.04557, 52.63318], [6.77307, 52.65375], [6.71641, 52.62905], [6.69507, 52.488], [6.94293, 52.43597], [6.99041, 52.47235], [7.03417, 52.40237], [7.07044, 52.37805], [7.02703, 52.27941], [7.06365, 52.23789], [7.03729, 52.22695], [6.9897, 52.2271], [6.97189, 52.20329], [6.83984, 52.11728], [6.76117, 52.11895], [6.68128, 52.05052], [6.83035, 51.9905], [6.82357, 51.96711], [6.72319, 51.89518], [6.68386, 51.91861], [6.58556, 51.89386], [6.50231, 51.86313], [6.47179, 51.85395], [6.38815, 51.87257], [6.40704, 51.82771], [6.30593, 51.84998], [6.29872, 51.86801], [6.21443, 51.86801], [6.15349, 51.90439], [6.11551, 51.89769], [6.16902, 51.84094], [6.10337, 51.84829], [6.06705, 51.86136], [5.99848, 51.83195], [5.94568, 51.82786], [5.98665, 51.76944], [5.95003, 51.7493], [6.04091, 51.71821], [6.02767, 51.6742], [6.11759, 51.65609], [6.09055, 51.60564], [6.18017, 51.54096], [6.21724, 51.48568], [6.20654, 51.40049], [6.22641, 51.39948], [6.22674, 51.36135], [6.16977, 51.33169], [6.07889, 51.24432], [6.07889, 51.17038], [6.17384, 51.19589], [6.16706, 51.15677], [5.98292, 51.07469], [5.9541, 51.03496], [5.9134, 51.06736], [5.86735, 51.05182], [5.87849, 51.01969], [5.90493, 51.00198], [5.90296, 50.97356], [5.95282, 50.98728], [6.02697, 50.98303], [6.01615, 50.93367], [6.09297, 50.92066], [6.07486, 50.89307], [6.08805, 50.87223], [6.07693, 50.86025], [6.07431, 50.84674], [6.05702, 50.85179], [6.05623, 50.8572], [6.01921, 50.84435], [6.02328, 50.81694], [6.00462, 50.80065], [5.98404, 50.80988], [5.97497, 50.79992], [6.02624, 50.77453], [6.01976, 50.75398], [6.03889, 50.74618], [6.0326, 50.72647], [6.0406, 50.71848], [6.04428, 50.72861], [6.11707, 50.72231], [6.17852, 50.6245], [6.26957, 50.62444], [6.2476, 50.60392], [6.24888, 50.59869], [6.24005, 50.58732], [6.22581, 50.5907], [6.20281, 50.56952], [6.17739, 50.55875], [6.17802, 50.54179], [6.19735, 50.53576], [6.19579, 50.5313], [6.18716, 50.52653], [6.19193, 50.5212], [6.20599, 50.52089], [6.22335, 50.49578], [6.26637, 50.50272], [6.30809, 50.50058], [6.3465, 50.48833], [6.34005, 50.46083], [6.37219, 50.45397], [6.36852, 50.40776], [6.34406, 50.37994], [6.3688, 50.35898], [6.40785, 50.33557], [6.40641, 50.32425], [6.35701, 50.31139], [6.32488, 50.32333], [6.29949, 50.30887], [6.28797, 50.27458], [6.208, 50.25179], [6.16853, 50.2234], [6.18364, 50.20815], [6.18739, 50.1822], [6.14588, 50.17106], [6.14132, 50.14971], [6.15298, 50.14126], [6.1379, 50.12964], [6.12055, 50.09171], [6.11274, 50.05916], [6.13458, 50.04141], [6.13044, 50.02929], [6.14666, 50.02207], [6.13794, 50.01466], [6.13273, 50.02019], [6.1295, 50.01849], [6.13806, 50.01056], [6.14948, 50.00908], [6.14147, 49.99563], [6.1701, 49.98518], [6.16466, 49.97086], [6.17872, 49.9537], [6.18554, 49.95622], [6.18045, 49.96611], [6.19089, 49.96991], [6.19856, 49.95053], [6.22094, 49.94955], [6.22608, 49.929], [6.21882, 49.92403], [6.22926, 49.92096], [6.23496, 49.89972], [6.26146, 49.88203], [6.28874, 49.87592], [6.29692, 49.86685], [6.30963, 49.87021], [6.32303, 49.85133], [6.32098, 49.83728], [6.33585, 49.83785], [6.34267, 49.84974], [6.36576, 49.85032], [6.40022, 49.82029], [6.42521, 49.81591], [6.42905, 49.81091], [6.44131, 49.81443], [6.45425, 49.81164], [6.47111, 49.82263], [6.48718, 49.81267], [6.50647, 49.80916], [6.51215, 49.80124], [6.52121, 49.81338], [6.53122, 49.80666], [6.52169, 49.79787], [6.50534, 49.78952], [6.51669, 49.78336], [6.51056, 49.77515], [6.51828, 49.76855], [6.51646, 49.75961], [6.50174, 49.75292], [6.50193, 49.73291], [6.51805, 49.72425], [6.51397, 49.72058], [6.50261, 49.72718], [6.49535, 49.72645], [6.49694, 49.72205], [6.5042, 49.71808], [6.50647, 49.71353], [6.49785, 49.71118], [6.48014, 49.69767], [6.46048, 49.69092], [6.44654, 49.67799], [6.42937, 49.66857], [6.42726, 49.66078], [6.43768, 49.66021], [6.4413, 49.65722], [6.41861, 49.61723], [6.39822, 49.60081], [6.385, 49.59946], [6.37464, 49.58886], [6.38342, 49.5799], [6.38024, 49.57593], [6.36676, 49.57813], [6.35825, 49.57053], [6.38228, 49.55855], [6.38072, 49.55171], [6.35666, 49.52931], [6.36788, 49.50377], [6.36907, 49.48931], [6.36778, 49.46937], [6.38352, 49.46463], [6.39168, 49.4667], [6.40274, 49.46546], [6.42432, 49.47683], [6.55404, 49.42464], [6.533, 49.40748], [6.60091, 49.36864], [6.58807, 49.35358], [6.572, 49.35027], [6.60186, 49.31055], [6.66583, 49.28065], [6.69274, 49.21661], [6.71843, 49.2208], [6.73256, 49.20486], [6.71137, 49.18808], [6.73765, 49.16375], [6.78265, 49.16793], [6.83385, 49.15162], [6.84703, 49.15734], [6.86225, 49.18185], [6.85016, 49.19354], [6.85119, 49.20038], [6.83555, 49.21249], [6.85939, 49.22376], [6.89298, 49.20863], [6.91875, 49.22261], [6.93831, 49.2223], [6.94028, 49.21641], [6.95963, 49.203], [6.97273, 49.2099], [7.01318, 49.19018], [7.03459, 49.19096], [7.0274, 49.17042], [7.03178, 49.15734], [7.04662, 49.13724], [7.04409, 49.12123], [7.04843, 49.11422], [7.05548, 49.11185], [7.06642, 49.11415], [7.07162, 49.1255], [7.09007, 49.13094], [7.07859, 49.15031], [7.10715, 49.15631], [7.10384, 49.13787], [7.12504, 49.14253], [7.1358, 49.1282], [7.1593, 49.1204], [7.23473, 49.12971], [7.29514, 49.11426], [7.3195, 49.14231], [7.35995, 49.14399], [7.3662, 49.17308], [7.44052, 49.18354], [7.44455, 49.16765], [7.49473, 49.17], [7.49172, 49.13915], [7.53012, 49.09818], [7.56416, 49.08136], [7.62575, 49.07654], [7.63618, 49.05428], [7.75948, 49.04562], [7.79557, 49.06583], [7.86386, 49.03499], [7.93641, 49.05544], [7.97783, 49.03161], [8.14189, 48.97833], [8.22604, 48.97352], [8.20031, 48.95856], [8.19989, 48.95825], [8.12813, 48.87985], [8.10253, 48.81829], [8.06802, 48.78957], [8.0326, 48.79017], [8.01534, 48.76085], [7.96994, 48.75606], [7.96812, 48.72491], [7.89002, 48.66317], [7.84098, 48.64217], [7.80057, 48.5857], [7.80167, 48.54758], [7.80647, 48.51239], [7.76833, 48.48945], [7.73109, 48.39192], [7.74562, 48.32736], [7.69022, 48.30018], [7.6648, 48.22219], [7.57137, 48.12292], [7.56966, 48.03265], [7.62302, 47.97898], [7.55673, 47.87371], [7.52921, 47.77747], [7.54761, 47.72912], [7.53722, 47.71635], [7.51266, 47.70197], [7.51915, 47.68335], [7.52067, 47.66437], [7.53384, 47.65115], [7.5591, 47.63849], [7.57423, 47.61628], [7.58851, 47.60794], [7.59301, 47.60058], [7.58945, 47.59017], [7.60523, 47.58519], [7.60459, 47.57869], [7.61929, 47.57683], [7.64309, 47.59151], [7.64213, 47.5944], [7.64599, 47.59695], [7.67395, 47.59212], [7.68229, 47.59905], [7.69385, 47.60099], [7.68486, 47.59601], [7.67115, 47.5871], [7.68904, 47.57133], [7.67655, 47.56435], [7.63338, 47.56256], [7.65083, 47.54662], [7.66174, 47.54554], [7.6656, 47.53752], [7.68101, 47.53232], [7.69642, 47.53297], [7.71961, 47.54219], [7.75261, 47.54599], [7.79486, 47.55691], [7.81901, 47.58798], [7.84412, 47.5841], [7.88664, 47.58854], [7.90673, 47.57674], [7.91251, 47.55031], [7.94494, 47.54511], [7.95682, 47.55789], [7.97581, 47.55493], [8.00113, 47.55616], [8.02136, 47.55096], [8.04383, 47.55443], [8.06663, 47.56374], [8.08557, 47.55768], [8.10002, 47.56504], [8.10395, 47.57918], [8.11543, 47.5841], [8.13662, 47.58432], [8.13823, 47.59147], [8.14947, 47.59558], [8.1652, 47.5945], [8.19378, 47.61636], [8.20617, 47.62141], [8.22011, 47.6181], [8.22577, 47.60385], [8.23809, 47.61204], [8.25863, 47.61571], [8.26313, 47.6103], [8.2824, 47.61225], [8.29722, 47.60603], [8.29524, 47.5919], [8.30277, 47.58607], [8.32735, 47.57133], [8.35512, 47.57014], [8.38273, 47.56608], [8.39477, 47.57826], [8.43235, 47.56617], [8.49431, 47.58107], [8.48949, 47.588], [8.46637, 47.58389], [8.45578, 47.60121], [8.50747, 47.61897], [8.51686, 47.63476], [8.55756, 47.62394], [8.57586, 47.59537], [8.60348, 47.61204], [8.59545, 47.64298], [8.60701, 47.65271], [8.61471, 47.64514], [8.60412, 47.63735], [8.62049, 47.63757], [8.62884, 47.65098], [8.61113, 47.66332], [8.6052, 47.67258], [8.57683, 47.66158], [8.56141, 47.67088], [8.52801, 47.66059], [8.5322, 47.64687], [8.49656, 47.64709], [8.46605, 47.64103], [8.4667, 47.65747], [8.44711, 47.65379], [8.42264, 47.66667], [8.41346, 47.66676], [8.40473, 47.67499], [8.4211, 47.68407], [8.40569, 47.69855], [8.44807, 47.72426], [8.45771, 47.7493], [8.48868, 47.77215], [8.56814, 47.78001], [8.56415, 47.80633], [8.61657, 47.79998], [8.62408, 47.7626], [8.64425, 47.76398], [8.65292, 47.80066], [8.68022, 47.78599], [8.68985, 47.75686], [8.71778, 47.76571], [8.74251, 47.75168], [8.70543, 47.73121], [8.73671, 47.7169], [8.72617, 47.69651]]]] } },
22723 { type: "Feature", properties: { iso1A2: "DG", iso1A3: "DGA", wikidata: "Q184851", nameEn: "Diego Garcia", country: "GB", groups: ["IO", "BOTS", "014", "202", "002", "UN"], isoStatus: "excRes", callingCodes: ["246"] }, geometry: { type: "MultiPolygon", coordinates: [[[[73.14823, -7.76302], [73.09982, -6.07324], [71.43792, -7.73904], [73.14823, -7.76302]]]] } },
22724 { type: "Feature", properties: { iso1A2: "DJ", iso1A3: "DJI", iso1N3: "262", wikidata: "Q977", nameEn: "Djibouti", groups: ["014", "202", "002", "UN"], callingCodes: ["253"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.90659, 12.3823], [43.90659, 12.3823], [43.32909, 12.59711], [43.29075, 12.79154], [42.86195, 12.58747], [42.7996, 12.42629], [42.6957, 12.36201], [42.46941, 12.52661], [42.4037, 12.46478], [41.95461, 11.81157], [41.82878, 11.72361], [41.77727, 11.49902], [41.8096, 11.33606], [41.80056, 10.97127], [42.06302, 10.92599], [42.13691, 10.97586], [42.42669, 10.98493], [42.62989, 11.09711], [42.75111, 11.06992], [42.79037, 10.98493], [42.95776, 10.98533], [43.90659, 12.3823]]]] } },
22725 { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
22726 { type: "Feature", properties: { iso1A2: "DM", iso1A3: "DMA", iso1N3: "212", wikidata: "Q784", nameEn: "Dominica", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 767"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.32485, 14.91445], [-60.86656, 15.82603], [-61.95646, 15.5094], [-61.32485, 14.91445]]]] } },
22727 { type: "Feature", properties: { iso1A2: "DO", iso1A3: "DOM", iso1N3: "214", wikidata: "Q786", nameEn: "Dominican Republic", groups: ["029", "003", "419", "019", "UN"], callingCodes: ["1 809", "1 829", "1 849"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-67.87844, 21.7938], [-72.38946, 20.27111], [-71.77419, 19.73128], [-71.75865, 19.70231], [-71.7429, 19.58445], [-71.71449, 19.55364], [-71.71268, 19.53374], [-71.6802, 19.45008], [-71.69448, 19.37866], [-71.77766, 19.33823], [-71.73229, 19.26686], [-71.62642, 19.21212], [-71.65337, 19.11759], [-71.69938, 19.10916], [-71.71088, 19.08353], [-71.74088, 19.0437], [-71.88102, 18.95007], [-71.77766, 18.95007], [-71.72624, 18.87802], [-71.71885, 18.78423], [-71.82556, 18.62551], [-71.95412, 18.64939], [-72.00201, 18.62312], [-71.88102, 18.50125], [-71.90875, 18.45821], [-71.69952, 18.34101], [-71.78271, 18.18302], [-71.75465, 18.14405], [-71.74994, 18.11115], [-71.73783, 18.07177], [-71.75671, 18.03456], [-72.29523, 17.48026], [-68.39466, 16.14167], [-67.87844, 21.7938]]]] } },
22728 { type: "Feature", properties: { iso1A2: "DZ", iso1A3: "DZA", iso1N3: "012", wikidata: "Q262", nameEn: "Algeria", groups: ["015", "002", "UN"], callingCodes: ["213"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.59123, 37.14286], [5.10072, 39.89531], [-2.27707, 35.35051], [-2.21248, 35.08532], [-2.21445, 35.04378], [-2.04734, 34.93218], [-1.97833, 34.93218], [-1.97469, 34.886], [-1.73707, 34.74226], [-1.84569, 34.61907], [-1.69788, 34.48056], [-1.78042, 34.39018], [-1.64666, 34.10405], [-1.73494, 33.71721], [-1.59508, 33.59929], [-1.67067, 33.27084], [-1.46249, 33.0499], [-1.54244, 32.95499], [-1.37794, 32.73628], [-0.9912, 32.52467], [-1.24998, 32.32993], [-1.24453, 32.1917], [-1.15735, 32.12096], [-1.22829, 32.07832], [-2.46166, 32.16603], [-2.93873, 32.06557], [-2.82784, 31.79459], [-3.66314, 31.6339], [-3.66386, 31.39202], [-3.77647, 31.31912], [-3.77103, 31.14984], [-3.54944, 31.0503], [-3.65418, 30.85566], [-3.64735, 30.67539], [-4.31774, 30.53229], [-4.6058, 30.28343], [-5.21671, 29.95253], [-5.58831, 29.48103], [-5.72121, 29.52322], [-5.75616, 29.61407], [-6.69965, 29.51623], [-6.78351, 29.44634], [-6.95824, 29.50924], [-7.61585, 29.36252], [-8.6715, 28.71194], [-8.66879, 27.6666], [-8.66674, 27.31569], [-4.83423, 24.99935], [1.15698, 21.12843], [1.20992, 20.73533], [3.24648, 19.81703], [3.12501, 19.1366], [3.36082, 18.9745], [4.26651, 19.14224], [5.8153, 19.45101], [7.38361, 20.79165], [7.48273, 20.87258], [11.96886, 23.51735], [11.62498, 24.26669], [11.41061, 24.21456], [10.85323, 24.5595], [10.33159, 24.5465], [10.02432, 24.98124], [10.03146, 25.35635], [9.38834, 26.19288], [9.51696, 26.39148], [9.89569, 26.57696], [9.78136, 29.40961], [9.3876, 30.16738], [9.55544, 30.23971], [9.07483, 32.07865], [8.35999, 32.50101], [8.31895, 32.83483], [8.1179, 33.05086], [8.11433, 33.10175], [7.83028, 33.18851], [7.73687, 33.42114], [7.54088, 33.7726], [7.52851, 34.06493], [7.66174, 34.20167], [7.74207, 34.16492], [7.81242, 34.21841], [7.86264, 34.3987], [8.20482, 34.57575], [8.29655, 34.72798], [8.25189, 34.92009], [8.30727, 34.95378], [8.3555, 35.10007], [8.47318, 35.23376], [8.30329, 35.29884], [8.36086, 35.47774], [8.35371, 35.66373], [8.26472, 35.73669], [8.2626, 35.91733], [8.40731, 36.42208], [8.18936, 36.44939], [8.16167, 36.48817], [8.47609, 36.66607], [8.46537, 36.7706], [8.57613, 36.78062], [8.67706, 36.8364], [8.62972, 36.86499], [8.64044, 36.9401], [8.59123, 37.14286]]]] } },
22729 { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
22730 { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
22731 { type: "Feature", properties: { iso1A2: "EE", iso1A3: "EST", iso1N3: "233", wikidata: "Q191", nameEn: "Estonia", aliases: ["EW"], groups: ["EU", "154", "150", "UN"], callingCodes: ["372"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.32936, 60.00121], [20.5104, 59.15546], [19.84909, 57.57876], [22.80496, 57.87798], [23.20055, 57.56697], [24.26221, 57.91787], [24.3579, 57.87471], [25.19484, 58.0831], [25.28237, 57.98539], [25.29581, 58.08288], [25.73499, 57.90193], [26.05949, 57.84744], [26.0324, 57.79037], [26.02456, 57.78342], [26.027, 57.78158], [26.0266, 57.77441], [26.02069, 57.77169], [26.02415, 57.76865], [26.03332, 57.7718], [26.0543, 57.76105], [26.08098, 57.76619], [26.2029, 57.7206], [26.1866, 57.6849], [26.29253, 57.59244], [26.46527, 57.56885], [26.54675, 57.51813], [26.90364, 57.62823], [27.34698, 57.52242], [27.31919, 57.57672], [27.40393, 57.62125], [27.3746, 57.66834], [27.52615, 57.72843], [27.50171, 57.78842], [27.56689, 57.83356], [27.78526, 57.83963], [27.81841, 57.89244], [27.67282, 57.92627], [27.62393, 58.09462], [27.48541, 58.22615], [27.55489, 58.39525], [27.36366, 58.78381], [27.74429, 58.98351], [27.80482, 59.1116], [27.87978, 59.18097], [27.90911, 59.24353], [28.00689, 59.28351], [28.14215, 59.28934], [28.19284, 59.35791], [28.20537, 59.36491], [28.21137, 59.38058], [28.19061, 59.39962], [28.04187, 59.47017], [27.85643, 59.58538], [26.90044, 59.63819], [26.32936, 60.00121]]]] } },
22732 { type: "Feature", properties: { iso1A2: "EG", iso1A3: "EGY", iso1N3: "818", wikidata: "Q79", nameEn: "Egypt", groups: ["015", "002", "UN"], callingCodes: ["20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.62659, 31.82938], [26.92891, 33.39516], [24.8458, 31.39877], [25.01077, 30.73861], [24.71117, 30.17441], [24.99968, 29.24574], [24.99885, 21.99535], [33.17563, 22.00405], [34.0765, 22.00501], [37.8565, 22.00903], [34.4454, 27.91479], [34.8812, 29.36878], [34.92298, 29.45305], [34.26742, 31.21998], [34.24012, 31.29591], [34.23572, 31.2966], [34.21853, 31.32363], [34.052, 31.46619], [33.62659, 31.82938]]]] } },
22733 { type: "Feature", properties: { iso1A2: "EH", iso1A3: "ESH", iso1N3: "732", wikidata: "Q6250", nameEn: "Western Sahara", groups: ["015", "002"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.66879, 27.6666], [-8.77527, 27.66663], [-8.71787, 26.9898], [-9.08698, 26.98639], [-9.56957, 26.90042], [-9.81998, 26.71379], [-10.68417, 26.90984], [-11.35695, 26.8505], [-11.23622, 26.72023], [-11.38635, 26.611], [-11.62052, 26.05229], [-12.06001, 26.04442], [-12.12281, 25.13682], [-12.92147, 24.39502], [-13.00628, 24.01923], [-13.75627, 23.77231], [-14.10361, 22.75501], [-14.1291, 22.41636], [-14.48112, 22.00886], [-14.47329, 21.63839], [-14.78487, 21.36587], [-16.44269, 21.39745], [-16.9978, 21.36239], [-17.02707, 21.34022], [-17.21511, 21.34226], [-17.35589, 20.80492], [-17.0471, 20.76408], [-17.0695, 20.85742], [-17.06781, 20.92697], [-17.0396, 20.9961], [-17.0357, 21.05368], [-16.99806, 21.12142], [-16.95474, 21.33997], [-13.01525, 21.33343], [-13.08438, 22.53866], [-13.15313, 22.75649], [-13.10753, 22.89493], [-13.00412, 23.02297], [-12.5741, 23.28975], [-12.36213, 23.3187], [-12.14969, 23.41935], [-12.00251, 23.4538], [-12.0002, 25.9986], [-8.66721, 25.99918], [-8.66674, 27.31569], [-8.66879, 27.6666]]]] } },
22734 { type: "Feature", properties: { iso1A2: "ER", iso1A3: "ERI", iso1N3: "232", wikidata: "Q986", nameEn: "Eritrea", groups: ["014", "202", "002", "UN"], callingCodes: ["291"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.99158, 15.81743], [39.63762, 18.37348], [38.57727, 17.98125], [38.45916, 17.87167], [38.37133, 17.66269], [38.13362, 17.53906], [37.50967, 17.32199], [37.42694, 17.04041], [36.99777, 17.07172], [36.92193, 16.23451], [36.76371, 15.80831], [36.69761, 15.75323], [36.54276, 15.23478], [36.44337, 15.14963], [36.54376, 14.25597], [36.56536, 14.26177], [36.55659, 14.28237], [36.63364, 14.31172], [36.85787, 14.32201], [37.01622, 14.2561], [37.09486, 14.27155], [37.13206, 14.40746], [37.3106, 14.44657], [37.47319, 14.2149], [37.528, 14.18413], [37.91287, 14.89447], [38.0364, 14.72745], [38.25562, 14.67287], [38.3533, 14.51323], [38.45748, 14.41445], [38.78306, 14.4754], [38.98058, 14.54895], [39.02834, 14.63717], [39.16074, 14.65187], [39.14772, 14.61827], [39.19547, 14.56996], [39.23888, 14.56365], [39.26927, 14.48801], [39.2302, 14.44598], [39.2519, 14.40393], [39.37685, 14.54402], [39.52756, 14.49011], [39.50585, 14.55735], [39.58182, 14.60987], [39.76632, 14.54264], [39.9443, 14.41024], [40.07236, 14.54264], [40.14649, 14.53969], [40.21128, 14.39342], [40.25686, 14.41445], [40.9167, 14.11152], [41.25097, 13.60787], [41.62864, 13.38626], [42.05841, 12.80912], [42.21469, 12.75832], [42.2798, 12.6355], [42.4037, 12.46478], [42.46941, 12.52661], [42.6957, 12.36201], [42.7996, 12.42629], [42.86195, 12.58747], [43.29075, 12.79154], [40.99158, 15.81743]]]] } },
22735 { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
22736 { type: "Feature", properties: { iso1A2: "ET", iso1A3: "ETH", iso1N3: "231", wikidata: "Q115", nameEn: "Ethiopia", groups: ["014", "202", "002", "UN"], callingCodes: ["251"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.4037, 12.46478], [42.2798, 12.6355], [42.21469, 12.75832], [42.05841, 12.80912], [41.62864, 13.38626], [41.25097, 13.60787], [40.9167, 14.11152], [40.25686, 14.41445], [40.21128, 14.39342], [40.14649, 14.53969], [40.07236, 14.54264], [39.9443, 14.41024], [39.76632, 14.54264], [39.58182, 14.60987], [39.50585, 14.55735], [39.52756, 14.49011], [39.37685, 14.54402], [39.2519, 14.40393], [39.2302, 14.44598], [39.26927, 14.48801], [39.23888, 14.56365], [39.19547, 14.56996], [39.14772, 14.61827], [39.16074, 14.65187], [39.02834, 14.63717], [38.98058, 14.54895], [38.78306, 14.4754], [38.45748, 14.41445], [38.3533, 14.51323], [38.25562, 14.67287], [38.0364, 14.72745], [37.91287, 14.89447], [37.528, 14.18413], [37.47319, 14.2149], [37.3106, 14.44657], [37.13206, 14.40746], [37.09486, 14.27155], [37.01622, 14.2561], [36.85787, 14.32201], [36.63364, 14.31172], [36.55659, 14.28237], [36.56536, 14.26177], [36.54376, 14.25597], [36.44653, 13.95666], [36.48824, 13.83954], [36.38993, 13.56459], [36.24545, 13.36759], [36.13374, 12.92665], [36.16651, 12.88019], [36.14268, 12.70879], [36.01458, 12.72478], [35.70476, 12.67101], [35.24302, 11.91132], [35.11492, 11.85156], [35.05832, 11.71158], [35.09556, 11.56278], [34.95704, 11.24448], [35.01215, 11.19626], [34.93172, 10.95946], [34.97789, 10.91559], [34.97491, 10.86147], [34.86916, 10.78832], [34.86618, 10.74588], [34.77532, 10.69027], [34.77383, 10.74588], [34.59062, 10.89072], [34.4372, 10.781], [34.2823, 10.53508], [34.34783, 10.23914], [34.32102, 10.11599], [34.22718, 10.02506], [34.20484, 9.9033], [34.13186, 9.7492], [34.08717, 9.55243], [34.10229, 9.50238], [34.14304, 9.04654], [34.14453, 8.60204], [34.01346, 8.50041], [33.89579, 8.4842], [33.87195, 8.41938], [33.71407, 8.3678], [33.66938, 8.44442], [33.54575, 8.47094], [33.3119, 8.45474], [33.19721, 8.40317], [33.1853, 8.29264], [33.18083, 8.13047], [33.08401, 8.05822], [33.0006, 7.90333], [33.04944, 7.78989], [33.24637, 7.77939], [33.32531, 7.71297], [33.44745, 7.7543], [33.71407, 7.65983], [33.87642, 7.5491], [34.02984, 7.36449], [34.03878, 7.27437], [34.01495, 7.25664], [34.19369, 7.12807], [34.19369, 7.04382], [34.35753, 6.91963], [34.47669, 6.91076], [34.53925, 6.82794], [34.53776, 6.74808], [34.65096, 6.72589], [34.77459, 6.5957], [34.87736, 6.60161], [35.01738, 6.46991], [34.96227, 6.26415], [35.00546, 5.89387], [35.12611, 5.68937], [35.13058, 5.62118], [35.31188, 5.50106], [35.29938, 5.34042], [35.50792, 5.42431], [35.8576, 5.33413], [35.81968, 5.10757], [35.82118, 4.77382], [35.9419, 4.61933], [35.95449, 4.53244], [36.03924, 4.44406], [36.84474, 4.44518], [37.07724, 4.33503], [38.14168, 3.62487], [38.45812, 3.60445], [38.52336, 3.62551], [38.91938, 3.51198], [39.07736, 3.5267], [39.19954, 3.47834], [39.49444, 3.45521], [39.51551, 3.40895], [39.55132, 3.39634], [39.58339, 3.47434], [39.76808, 3.67058], [39.86043, 3.86974], [40.77498, 4.27683], [41.1754, 3.94079], [41.89488, 3.97375], [42.07619, 4.17667], [42.55853, 4.20518], [42.84526, 4.28357], [42.97746, 4.44032], [43.04177, 4.57923], [43.40263, 4.79289], [44.02436, 4.9451], [44.98104, 4.91821], [47.97917, 8.00124], [47.92477, 8.00111], [46.99339, 7.9989], [44.19222, 8.93028], [43.32613, 9.59205], [43.23518, 9.84605], [43.0937, 9.90579], [42.87643, 10.18441], [42.69452, 10.62672], [42.95776, 10.98533], [42.79037, 10.98493], [42.75111, 11.06992], [42.62989, 11.09711], [42.42669, 10.98493], [42.13691, 10.97586], [42.06302, 10.92599], [41.80056, 10.97127], [41.8096, 11.33606], [41.77727, 11.49902], [41.82878, 11.72361], [41.95461, 11.81157], [42.4037, 12.46478]]]] } },
22737 { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
22738 { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
22739 { type: "Feature", properties: { iso1A2: "FJ", iso1A3: "FJI", iso1N3: "242", wikidata: "Q712", nameEn: "Fiji", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["679"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174.245, -23.1974], [179.99999, -22.5], [179.99999, -11.5], [174, -11.5], [174.245, -23.1974]]], [[[-176.76826, -14.95183], [-180, -14.96041], [-180, -22.90585], [-176.74538, -22.89767], [-176.76826, -14.95183]]]] } },
22740 { type: "Feature", properties: { iso1A2: "FK", iso1A3: "FLK", iso1N3: "238", wikidata: "Q9648", nameEn: "Falkland Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.67376, -55.11859], [-54.56126, -51.26248], [-61.26735, -50.63919], [-63.67376, -55.11859]]]] } },
22741 { type: "Feature", properties: { iso1A2: "FM", iso1A3: "FSM", iso1N3: "583", wikidata: "Q702", nameEn: "Federated States of Micronesia", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["691"] }, geometry: { type: "MultiPolygon", coordinates: [[[[138.20583, 13.3783], [136.27107, 6.73747], [156.88247, -1.39237], [165.19726, 6.22546], [138.20583, 13.3783]]]] } },
22742 { type: "Feature", properties: { iso1A2: "FO", iso1A3: "FRO", iso1N3: "234", wikidata: "Q4628", nameEn: "Faroe Islands", country: "DK", groups: ["154", "150", "UN"], callingCodes: ["298"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.51774, 62.35338], [-6.51083, 60.95272], [-5.70102, 62.77194], [-8.51774, 62.35338]]]] } },
22743 { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
22744 { type: "Feature", properties: { iso1A2: "FX", iso1A3: "FXX", iso1N3: "249", wikidata: "Q212429", nameEn: "Metropolitan France", country: "FR", groups: ["EU", "155", "150", "UN"], isoStatus: "excRes", callingCodes: ["33"] }, geometry: { type: "MultiPolygon", coordinates: [[[[2.55904, 51.07014], [2.18458, 51.52087], [1.17405, 50.74239], [-2.02963, 49.91866], [-2.09454, 49.46288], [-1.83944, 49.23037], [-2.00491, 48.86706], [-2.65349, 49.15373], [-6.28985, 48.93406], [-1.81005, 43.59738], [-1.77289, 43.38957], [-1.79319, 43.37497], [-1.78332, 43.36399], [-1.78714, 43.35476], [-1.77068, 43.34396], [-1.75334, 43.34107], [-1.75079, 43.3317], [-1.7397, 43.32979], [-1.73074, 43.29481], [-1.69407, 43.31378], [-1.62481, 43.30726], [-1.63052, 43.28591], [-1.61341, 43.25269], [-1.57674, 43.25269], [-1.55963, 43.28828], [-1.50992, 43.29481], [-1.45289, 43.27049], [-1.40942, 43.27272], [-1.3758, 43.24511], [-1.41562, 43.12815], [-1.47555, 43.08372], [-1.44067, 43.047], [-1.35272, 43.02658], [-1.34419, 43.09665], [-1.32209, 43.1127], [-1.27118, 43.11961], [-1.30052, 43.09581], [-1.30531, 43.06859], [-1.25244, 43.04164], [-1.22881, 43.05534], [-1.10333, 43.0059], [-1.00963, 42.99279], [-0.97133, 42.96239], [-0.81652, 42.95166], [-0.75478, 42.96916], [-0.72037, 42.92541], [-0.73422, 42.91228], [-0.72608, 42.89318], [-0.69837, 42.87945], [-0.67637, 42.88303], [-0.55497, 42.77846], [-0.50863, 42.82713], [-0.44334, 42.79939], [-0.41319, 42.80776], [-0.38833, 42.80132], [-0.3122, 42.84788], [-0.17939, 42.78974], [-0.16141, 42.79535], [-0.10519, 42.72761], [-0.02468, 42.68513], [0.17569, 42.73424], [0.25336, 42.7174], [0.29407, 42.67431], [0.36251, 42.72282], [0.40214, 42.69779], [0.67873, 42.69458], [0.65421, 42.75872], [0.66121, 42.84021], [0.711, 42.86372], [0.93089, 42.79154], [0.96166, 42.80629], [0.98292, 42.78754], [1.0804, 42.78569], [1.15928, 42.71407], [1.35562, 42.71944], [1.44197, 42.60217], [1.47986, 42.61346], [1.46718, 42.63296], [1.48043, 42.65203], [1.50867, 42.64483], [1.55418, 42.65669], [1.60085, 42.62703], [1.63485, 42.62957], [1.6625, 42.61982], [1.68267, 42.62533], [1.73452, 42.61515], [1.72588, 42.59098], [1.7858, 42.57698], [1.73683, 42.55492], [1.72515, 42.50338], [1.76335, 42.48863], [1.83037, 42.48395], [1.88853, 42.4501], [1.93663, 42.45439], [1.94292, 42.44316], [1.94061, 42.43333], [1.94084, 42.43039], [1.9574, 42.42401], [1.96482, 42.37787], [2.00488, 42.35399], [2.06241, 42.35906], [2.11621, 42.38393], [2.12789, 42.41291], [2.16599, 42.42314], [2.20578, 42.41633], [2.25551, 42.43757], [2.38504, 42.39977], [2.43299, 42.39423], [2.43508, 42.37568], [2.48457, 42.33933], [2.54382, 42.33406], [2.55516, 42.35351], [2.57934, 42.35808], [2.6747, 42.33974], [2.65311, 42.38771], [2.72056, 42.42298], [2.75497, 42.42578], [2.77464, 42.41046], [2.84335, 42.45724], [2.85675, 42.45444], [2.86983, 42.46843], [2.88413, 42.45938], [2.92107, 42.4573], [2.94283, 42.48174], [2.96518, 42.46692], [3.03734, 42.47363], [3.08167, 42.42748], [3.10027, 42.42621], [3.11379, 42.43646], [3.17156, 42.43545], [3.75438, 42.33445], [7.60802, 41.05927], [10.09675, 41.44089], [9.56115, 43.20816], [7.50102, 43.51859], [7.42422, 43.72209], [7.40903, 43.7296], [7.41113, 43.73156], [7.41291, 43.73168], [7.41298, 43.73311], [7.41233, 43.73439], [7.42062, 43.73977], [7.42299, 43.74176], [7.42443, 43.74087], [7.42809, 43.74396], [7.43013, 43.74895], [7.43624, 43.75014], [7.43708, 43.75197], [7.4389, 43.75151], [7.4379, 43.74963], [7.47823, 43.73341], [7.53006, 43.78405], [7.50423, 43.84345], [7.49355, 43.86551], [7.51162, 43.88301], [7.56075, 43.89932], [7.56858, 43.94506], [7.60771, 43.95772], [7.65266, 43.9763], [7.66848, 43.99943], [7.6597, 44.03009], [7.72508, 44.07578], [7.66878, 44.12795], [7.68694, 44.17487], [7.63245, 44.17877], [7.62155, 44.14881], [7.36364, 44.11882], [7.34547, 44.14359], [7.27827, 44.1462], [7.16929, 44.20352], [7.00764, 44.23736], [6.98221, 44.28289], [6.89171, 44.36637], [6.88784, 44.42043], [6.94504, 44.43112], [6.86233, 44.49834], [6.85507, 44.53072], [6.96042, 44.62129], [6.95133, 44.66264], [7.00582, 44.69364], [7.07484, 44.68073], [7.00401, 44.78782], [7.02217, 44.82519], [6.93499, 44.8664], [6.90774, 44.84322], [6.75518, 44.89915], [6.74519, 44.93661], [6.74791, 45.01939], [6.66981, 45.02324], [6.62803, 45.11175], [6.7697, 45.16044], [6.85144, 45.13226], [6.96706, 45.20841], [7.07074, 45.21228], [7.13115, 45.25386], [7.10572, 45.32924], [7.18019, 45.40071], [7.00037, 45.509], [6.98948, 45.63869], [6.80785, 45.71864], [6.80785, 45.83265], [6.95315, 45.85163], [7.04151, 45.92435], [7.00946, 45.9944], [6.93862, 46.06502], [6.87868, 46.03855], [6.89321, 46.12548], [6.78968, 46.14058], [6.86052, 46.28512], [6.77152, 46.34784], [6.8024, 46.39171], [6.82312, 46.42661], [6.53358, 46.45431], [6.25432, 46.3632], [6.21981, 46.31304], [6.24826, 46.30175], [6.25137, 46.29014], [6.23775, 46.27822], [6.24952, 46.26255], [6.26749, 46.24745], [6.29474, 46.26221], [6.31041, 46.24417], [6.29663, 46.22688], [6.27694, 46.21566], [6.26007, 46.21165], [6.24821, 46.20531], [6.23913, 46.20511], [6.23544, 46.20714], [6.22175, 46.20045], [6.22222, 46.19888], [6.21844, 46.19837], [6.21603, 46.19507], [6.21273, 46.19409], [6.21114, 46.1927], [6.20539, 46.19163], [6.19807, 46.18369], [6.19552, 46.18401], [6.18707, 46.17999], [6.18871, 46.16644], [6.18116, 46.16187], [6.15305, 46.15194], [6.13397, 46.1406], [6.09926, 46.14373], [6.09199, 46.15191], [6.07491, 46.14879], [6.05203, 46.15191], [6.04564, 46.14031], [6.03614, 46.13712], [6.01791, 46.14228], [5.9871, 46.14499], [5.97893, 46.13303], [5.95781, 46.12925], [5.9641, 46.14412], [5.97508, 46.15863], [5.98188, 46.17392], [5.98846, 46.17046], [5.99573, 46.18587], [5.96515, 46.19638], [5.97542, 46.21525], [6.02461, 46.23313], [6.03342, 46.2383], [6.04602, 46.23127], [6.05029, 46.23518], [6.0633, 46.24583], [6.07072, 46.24085], [6.08563, 46.24651], [6.10071, 46.23772], [6.12446, 46.25059], [6.11926, 46.2634], [6.1013, 46.28512], [6.11697, 46.29547], [6.1198, 46.31157], [6.13876, 46.33844], [6.15738, 46.3491], [6.16987, 46.36759], [6.15985, 46.37721], [6.15016, 46.3778], [6.09926, 46.40768], [6.06407, 46.41676], [6.08427, 46.44305], [6.07269, 46.46244], [6.1567, 46.54402], [6.11084, 46.57649], [6.27135, 46.68251], [6.38351, 46.73171], [6.45209, 46.77502], [6.43216, 46.80336], [6.46456, 46.88865], [6.43341, 46.92703], [6.71531, 47.0494], [6.68823, 47.06616], [6.76788, 47.1208], [6.8489, 47.15933], [6.9508, 47.24338], [6.95108, 47.26428], [6.94316, 47.28747], [7.05305, 47.33304], [7.0564, 47.35134], [7.03125, 47.36996], [6.87959, 47.35335], [6.88542, 47.37262], [6.93744, 47.40714], [6.93953, 47.43388], [7.0024, 47.45264], [6.98425, 47.49432], [7.0231, 47.50522], [7.07425, 47.48863], [7.12781, 47.50371], [7.16249, 47.49025], [7.19583, 47.49455], [7.17026, 47.44312], [7.24669, 47.4205], [7.33526, 47.44186], [7.35603, 47.43432], [7.40308, 47.43638], [7.43088, 47.45846], [7.4462, 47.46264], [7.4583, 47.47216], [7.42923, 47.48628], [7.43356, 47.49712], [7.47534, 47.47932], [7.51076, 47.49651], [7.49804, 47.51798], [7.5229, 47.51644], [7.53199, 47.5284], [7.51904, 47.53515], [7.50588, 47.52856], [7.49691, 47.53821], [7.50873, 47.54546], [7.51723, 47.54578], [7.52831, 47.55347], [7.53634, 47.55553], [7.55652, 47.56779], [7.55689, 47.57232], [7.56548, 47.57617], [7.56684, 47.57785], [7.58386, 47.57536], [7.58945, 47.59017], [7.59301, 47.60058], [7.58851, 47.60794], [7.57423, 47.61628], [7.5591, 47.63849], [7.53384, 47.65115], [7.52067, 47.66437], [7.51915, 47.68335], [7.51266, 47.70197], [7.53722, 47.71635], [7.54761, 47.72912], [7.52921, 47.77747], [7.55673, 47.87371], [7.62302, 47.97898], [7.56966, 48.03265], [7.57137, 48.12292], [7.6648, 48.22219], [7.69022, 48.30018], [7.74562, 48.32736], [7.73109, 48.39192], [7.76833, 48.48945], [7.80647, 48.51239], [7.80167, 48.54758], [7.80057, 48.5857], [7.84098, 48.64217], [7.89002, 48.66317], [7.96812, 48.72491], [7.96994, 48.75606], [8.01534, 48.76085], [8.0326, 48.79017], [8.06802, 48.78957], [8.10253, 48.81829], [8.12813, 48.87985], [8.19989, 48.95825], [8.20031, 48.95856], [8.22604, 48.97352], [8.14189, 48.97833], [7.97783, 49.03161], [7.93641, 49.05544], [7.86386, 49.03499], [7.79557, 49.06583], [7.75948, 49.04562], [7.63618, 49.05428], [7.62575, 49.07654], [7.56416, 49.08136], [7.53012, 49.09818], [7.49172, 49.13915], [7.49473, 49.17], [7.44455, 49.16765], [7.44052, 49.18354], [7.3662, 49.17308], [7.35995, 49.14399], [7.3195, 49.14231], [7.29514, 49.11426], [7.23473, 49.12971], [7.1593, 49.1204], [7.1358, 49.1282], [7.12504, 49.14253], [7.10384, 49.13787], [7.10715, 49.15631], [7.07859, 49.15031], [7.09007, 49.13094], [7.07162, 49.1255], [7.06642, 49.11415], [7.05548, 49.11185], [7.04843, 49.11422], [7.04409, 49.12123], [7.04662, 49.13724], [7.03178, 49.15734], [7.0274, 49.17042], [7.03459, 49.19096], [7.01318, 49.19018], [6.97273, 49.2099], [6.95963, 49.203], [6.94028, 49.21641], [6.93831, 49.2223], [6.91875, 49.22261], [6.89298, 49.20863], [6.85939, 49.22376], [6.83555, 49.21249], [6.85119, 49.20038], [6.85016, 49.19354], [6.86225, 49.18185], [6.84703, 49.15734], [6.83385, 49.15162], [6.78265, 49.16793], [6.73765, 49.16375], [6.71137, 49.18808], [6.73256, 49.20486], [6.71843, 49.2208], [6.69274, 49.21661], [6.66583, 49.28065], [6.60186, 49.31055], [6.572, 49.35027], [6.58807, 49.35358], [6.60091, 49.36864], [6.533, 49.40748], [6.55404, 49.42464], [6.42432, 49.47683], [6.40274, 49.46546], [6.39168, 49.4667], [6.38352, 49.46463], [6.36778, 49.46937], [6.3687, 49.4593], [6.28818, 49.48465], [6.27875, 49.503], [6.25029, 49.50609], [6.2409, 49.51408], [6.19543, 49.50536], [6.17386, 49.50934], [6.15366, 49.50226], [6.16115, 49.49297], [6.14321, 49.48796], [6.12814, 49.49365], [6.12346, 49.4735], [6.10325, 49.4707], [6.09845, 49.46351], [6.10072, 49.45268], [6.08373, 49.45594], [6.07887, 49.46399], [6.05553, 49.46663], [6.04176, 49.44801], [6.02743, 49.44845], [6.02648, 49.45451], [5.97693, 49.45513], [5.96876, 49.49053], [5.94224, 49.49608], [5.94128, 49.50034], [5.86571, 49.50015], [5.83389, 49.52152], [5.83467, 49.52717], [5.84466, 49.53027], [5.83648, 49.5425], [5.81664, 49.53775], [5.80871, 49.5425], [5.81838, 49.54777], [5.79195, 49.55228], [5.77435, 49.56298], [5.7577, 49.55915], [5.75649, 49.54321], [5.64505, 49.55146], [5.60909, 49.51228], [5.55001, 49.52729], [5.46541, 49.49825], [5.46734, 49.52648], [5.43713, 49.5707], [5.3974, 49.61596], [5.34837, 49.62889], [5.33851, 49.61599], [5.3137, 49.61225], [5.30214, 49.63055], [5.33039, 49.6555], [5.31465, 49.66846], [5.26232, 49.69456], [5.14545, 49.70287], [5.09249, 49.76193], [4.96714, 49.79872], [4.85464, 49.78995], [4.86965, 49.82271], [4.85134, 49.86457], [4.88529, 49.9236], [4.78827, 49.95609], [4.8382, 50.06738], [4.88602, 50.15182], [4.83279, 50.15331], [4.82438, 50.16878], [4.75237, 50.11314], [4.70064, 50.09384], [4.68695, 49.99685], [4.5414, 49.96911], [4.51098, 49.94659], [4.43488, 49.94122], [4.35051, 49.95315], [4.31963, 49.97043], [4.20532, 49.95803], [4.14239, 49.98034], [4.13508, 50.01976], [4.16294, 50.04719], [4.23101, 50.06945], [4.20147, 50.13535], [4.13561, 50.13078], [4.16014, 50.19239], [4.15524, 50.21103], [4.21945, 50.25539], [4.20651, 50.27333], [4.17861, 50.27443], [4.17347, 50.28838], [4.15524, 50.2833], [4.16808, 50.25786], [4.13665, 50.25609], [4.11954, 50.30425], [4.10957, 50.30234], [4.10237, 50.31247], [4.0689, 50.3254], [4.0268, 50.35793], [3.96771, 50.34989], [3.90781, 50.32814], [3.84314, 50.35219], [3.73911, 50.34809], [3.70987, 50.3191], [3.71009, 50.30305], [3.66976, 50.34563], [3.65709, 50.36873], [3.67262, 50.38663], [3.67494, 50.40239], [3.66153, 50.45165], [3.64426, 50.46275], [3.61014, 50.49568], [3.58361, 50.49049], [3.5683, 50.50192], [3.49509, 50.48885], [3.51564, 50.5256], [3.47385, 50.53397], [3.44629, 50.51009], [3.37693, 50.49538], [3.28575, 50.52724], [3.2729, 50.60718], [3.23951, 50.6585], [3.264, 50.67668], [3.2536, 50.68977], [3.26141, 50.69151], [3.26063, 50.70086], [3.24593, 50.71389], [3.22042, 50.71019], [3.20845, 50.71662], [3.19017, 50.72569], [3.20064, 50.73547], [3.18811, 50.74025], [3.18339, 50.74981], [3.16476, 50.76843], [3.15017, 50.79031], [3.1257, 50.78603], [3.11987, 50.79188], [3.11206, 50.79416], [3.10614, 50.78303], [3.09163, 50.77717], [3.04314, 50.77674], [3.00537, 50.76588], [2.96778, 50.75242], [2.95019, 50.75138], [2.90873, 50.702], [2.91036, 50.6939], [2.90069, 50.69263], [2.88504, 50.70656], [2.87937, 50.70298], [2.86985, 50.7033], [2.8483, 50.72276], [2.81056, 50.71773], [2.71165, 50.81295], [2.63331, 50.81457], [2.59093, 50.91751], [2.63074, 50.94746], [2.57551, 51.00326], [2.55904, 51.07014]], [[1.99838, 42.44682], [1.98378, 42.44697], [1.96125, 42.45364], [1.95606, 42.45785], [1.96215, 42.47854], [1.97003, 42.48081], [1.97227, 42.48487], [1.97697, 42.48568], [1.98022, 42.49569], [1.98916, 42.49351], [1.99766, 42.4858], [1.98579, 42.47486], [1.99216, 42.46208], [2.01564, 42.45171], [1.99838, 42.44682]]]] } },
22745 { type: "Feature", properties: { iso1A2: "GA", iso1A3: "GAB", iso1N3: "266", wikidata: "Q1000", nameEn: "Gabon", groups: ["017", "202", "002", "UN"], callingCodes: ["241"] }, geometry: { type: "MultiPolygon", coordinates: [[[[13.29457, 2.16106], [13.28534, 2.25716], [11.37116, 2.29975], [11.3561, 2.17217], [11.35307, 1.00251], [9.79648, 1.0019], [9.75065, 1.06753], [9.66433, 1.06723], [7.24416, -0.64092], [10.75913, -4.39519], [11.12647, -3.94169], [11.22301, -3.69888], [11.48764, -3.51089], [11.57949, -3.52798], [11.68608, -3.68942], [11.87083, -3.71571], [11.92719, -3.62768], [11.8318, -3.5812], [11.96554, -3.30267], [11.70227, -3.17465], [11.70558, -3.0773], [11.80365, -3.00424], [11.64798, -2.81146], [11.5359, -2.85654], [11.64487, -2.61865], [11.57637, -2.33379], [11.74605, -2.39936], [11.96866, -2.33559], [12.04895, -2.41704], [12.47925, -2.32626], [12.44656, -1.92025], [12.61312, -1.8129], [12.82172, -1.91091], [13.02759, -2.33098], [13.47977, -2.43224], [13.75884, -2.09293], [13.92073, -2.35581], [13.85846, -2.46935], [14.10442, -2.49268], [14.23829, -2.33715], [14.16202, -2.23916], [14.23518, -2.15671], [14.25932, -1.97624], [14.41838, -1.89412], [14.52569, -0.57818], [14.41887, -0.44799], [14.2165, -0.38261], [14.06862, -0.20826], [13.90632, -0.2287], [13.88648, 0.26652], [14.10909, 0.58563], [14.26066, 0.57255], [14.48179, 0.9152], [14.25186, 1.39842], [13.89582, 1.4261], [13.15519, 1.23368], [13.25447, 1.32339], [13.13461, 1.57238], [13.29457, 2.16106]]]] } },
22746 { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
22747 { type: "Feature", properties: { iso1A2: "GD", iso1A3: "GRD", iso1N3: "308", wikidata: "Q769", nameEn: "Grenada", aliases: ["WG"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 473"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-61.77886, 11.36496], [-59.94058, 12.34011], [-62.64026, 12.69984]]]] } },
22748 { type: "Feature", properties: { iso1A2: "GE", iso1A3: "GEO", iso1N3: "268", wikidata: "Q230", nameEn: "Georgia", groups: ["145", "142", "UN"], callingCodes: ["995"] }, geometry: { type: "MultiPolygon", coordinates: [[[[46.42738, 41.91323], [45.61676, 42.20768], [45.78692, 42.48358], [45.36501, 42.55268], [45.15318, 42.70598], [44.88754, 42.74934], [44.80941, 42.61277], [44.70002, 42.74679], [44.54202, 42.75699], [43.95517, 42.55396], [43.73119, 42.62043], [43.81453, 42.74297], [43.0419, 43.02413], [43.03322, 43.08883], [42.75889, 43.19651], [42.66667, 43.13917], [42.40563, 43.23226], [41.64935, 43.22331], [40.65957, 43.56212], [40.10657, 43.57344], [40.04445, 43.47776], [40.03312, 43.44262], [40.01007, 43.42411], [40.01552, 43.42025], [40.00853, 43.40578], [40.0078, 43.38551], [39.81147, 43.06294], [40.89217, 41.72528], [41.54366, 41.52185], [41.7148, 41.4932], [41.7124, 41.47417], [41.81939, 41.43621], [41.95134, 41.52466], [42.26387, 41.49346], [42.51772, 41.43606], [42.59202, 41.58183], [42.72794, 41.59714], [42.84471, 41.58912], [42.78995, 41.50126], [42.84899, 41.47265], [42.8785, 41.50516], [43.02956, 41.37891], [43.21707, 41.30331], [43.13373, 41.25503], [43.1945, 41.25242], [43.23096, 41.17536], [43.36118, 41.2028], [43.44973, 41.17666], [43.4717, 41.12611], [43.67712, 41.13398], [43.74717, 41.1117], [43.84835, 41.16329], [44.16591, 41.19141], [44.18148, 41.24644], [44.32139, 41.2079], [44.34337, 41.20312], [44.34417, 41.2382], [44.46791, 41.18204], [44.59322, 41.1933], [44.61462, 41.24018], [44.72814, 41.20338], [44.82084, 41.21513], [44.87887, 41.20195], [44.89911, 41.21366], [44.84358, 41.23088], [44.81749, 41.23488], [44.80053, 41.25949], [44.81437, 41.30371], [44.93493, 41.25685], [45.0133, 41.29747], [45.09867, 41.34065], [45.1797, 41.42231], [45.26285, 41.46433], [45.31352, 41.47168], [45.4006, 41.42402], [45.45973, 41.45898], [45.68389, 41.3539], [45.71035, 41.36208], [45.75705, 41.35157], [45.69946, 41.29545], [45.80842, 41.2229], [45.95786, 41.17956], [46.13221, 41.19479], [46.27698, 41.19011], [46.37661, 41.10805], [46.456, 41.09984], [46.48558, 41.0576], [46.55096, 41.1104], [46.63969, 41.09515], [46.66148, 41.20533], [46.72375, 41.28609], [46.63658, 41.37727], [46.4669, 41.43331], [46.40307, 41.48464], [46.33925, 41.4963], [46.29794, 41.5724], [46.34126, 41.57454], [46.34039, 41.5947], [46.3253, 41.60912], [46.28182, 41.60089], [46.26531, 41.63339], [46.24429, 41.59883], [46.19759, 41.62327], [46.17891, 41.72094], [46.20538, 41.77205], [46.23962, 41.75811], [46.30863, 41.79133], [46.3984, 41.84399], [46.42738, 41.91323]]]] } },
22749 { type: "Feature", properties: { iso1A2: "GF", iso1A3: "GUF", iso1N3: "254", wikidata: "Q3769", nameEn: "French Guiana", country: "FR", groups: ["Q3320166", "EU", "005", "419", "019", "UN"], callingCodes: ["594"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-51.35485, 4.8383], [-53.7094, 6.2264], [-54.01074, 5.68785], [-54.01877, 5.52789], [-54.26916, 5.26909], [-54.4717, 4.91964], [-54.38444, 4.13222], [-54.19367, 3.84387], [-54.05128, 3.63557], [-53.98914, 3.627], [-53.9849, 3.58697], [-54.28534, 2.67798], [-54.42864, 2.42442], [-54.6084, 2.32856], [-54.16286, 2.10779], [-53.78743, 2.34412], [-52.96539, 2.1881], [-52.6906, 2.37298], [-52.31787, 3.17896], [-51.85573, 3.83427], [-51.82312, 3.85825], [-51.79599, 3.89336], [-51.61983, 4.14596], [-51.63798, 4.51394], [-51.35485, 4.8383]]]] } },
22750 { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
22751 { type: "Feature", properties: { iso1A2: "GH", iso1A3: "GHA", iso1N3: "288", wikidata: "Q117", nameEn: "Ghana", groups: ["011", "202", "002", "UN"], callingCodes: ["233"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-0.13493, 11.14075], [-0.27374, 11.17157], [-0.28566, 11.12713], [-0.35955, 11.07801], [-0.38219, 11.12596], [-0.42391, 11.11661], [-0.44298, 11.04292], [-0.61937, 10.91305], [-0.67143, 10.99811], [-2.83373, 11.0067], [-2.94232, 10.64281], [-2.83108, 10.40252], [-2.74174, 9.83172], [-2.76534, 9.56589], [-2.68802, 9.49343], [-2.69814, 9.22717], [-2.77799, 9.04949], [-2.66357, 9.01771], [-2.58243, 8.7789], [-2.49037, 8.20872], [-2.62901, 8.11495], [-2.61232, 8.02645], [-2.67787, 8.02055], [-2.74819, 7.92613], [-2.78395, 7.94974], [-2.79467, 7.86002], [-2.92339, 7.60847], [-2.97822, 7.27165], [-2.95438, 7.23737], [-3.23327, 6.81744], [-3.21954, 6.74407], [-3.25999, 6.62521], [-3.01896, 5.71697], [-2.95323, 5.71865], [-2.96671, 5.6415], [-2.93132, 5.62137], [-2.85378, 5.65156], [-2.76614, 5.60963], [-2.72737, 5.34789], [-2.77625, 5.34621], [-2.73074, 5.1364], [-2.75502, 5.10657], [-2.95261, 5.12477], [-2.96554, 5.10397], [-3.063, 5.13665], [-3.11073, 5.12675], [-3.10675, 5.08515], [-3.34019, 4.17519], [1.07031, 5.15655], [1.27574, 5.93551], [1.19771, 6.11522], [1.19966, 6.17069], [1.09187, 6.17074], [1.05969, 6.22998], [1.03108, 6.24064], [0.99652, 6.33779], [0.89283, 6.33779], [0.71048, 6.53083], [0.74862, 6.56517], [0.63659, 6.63857], [0.6497, 6.73682], [0.58176, 6.76049], [0.57406, 6.80348], [0.52853, 6.82921], [0.56508, 6.92971], [0.52098, 6.94391], [0.52217, 6.9723], [0.59606, 7.01252], [0.65327, 7.31643], [0.62943, 7.41099], [0.57223, 7.39326], [0.52455, 7.45354], [0.51979, 7.58706], [0.58295, 7.62368], [0.62943, 7.85751], [0.58891, 8.12779], [0.6056, 8.13959], [0.61156, 8.18324], [0.5913, 8.19622], [0.63897, 8.25873], [0.73432, 8.29529], [0.64731, 8.48866], [0.47211, 8.59945], [0.37319, 8.75262], [0.52455, 8.87746], [0.45424, 9.04581], [0.56388, 9.40697], [0.49118, 9.48339], [0.36485, 9.49749], [0.33148, 9.44812], [0.25758, 9.42696], [0.2254, 9.47869], [0.31241, 9.50337], [0.30406, 9.521], [0.2409, 9.52335], [0.23851, 9.57389], [0.38153, 9.58682], [0.36008, 9.6256], [0.29334, 9.59387], [0.26712, 9.66437], [0.28261, 9.69022], [0.32313, 9.6491], [0.34816, 9.66907], [0.34816, 9.71607], [0.32075, 9.72781], [0.36366, 10.03309], [0.41252, 10.02018], [0.41371, 10.06361], [0.35293, 10.09412], [0.39584, 10.31112], [0.33028, 10.30408], [0.29453, 10.41546], [0.18846, 10.4096], [0.12886, 10.53149], [-0.05945, 10.63458], [-0.09141, 10.7147], [-0.07327, 10.71845], [-0.07183, 10.76794], [-0.0228, 10.81916], [-0.02685, 10.8783], [-908e-5, 10.91644], [-63e-4, 10.96417], [0.03355, 10.9807], [0.02395, 11.06229], [342e-5, 11.08317], [-514e-5, 11.10763], [-0.0275, 11.11202], [-0.05733, 11.08628], [-0.14462, 11.10811], [-0.13493, 11.14075]]]] } },
22752 { type: "Feature", properties: { iso1A2: "GI", iso1A3: "GIB", iso1N3: "292", wikidata: "Q1410", nameEn: "Gibraltar", country: "GB", groups: ["Q12837", "BOTS", "039", "150", "UN"], callingCodes: ["350"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.34064, 36.03744], [-5.27801, 36.14942], [-5.33822, 36.15272], [-5.34536, 36.15501], [-5.40526, 36.15488], [-5.34064, 36.03744]]]] } },
22753 { type: "Feature", properties: { iso1A2: "GL", iso1A3: "GRL", iso1N3: "304", wikidata: "Q223", nameEn: "Greenland", country: "DK", groups: ["Q1451600", "021", "003", "019", "UN"], callingCodes: ["299"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-49.33696, 84.57952], [-68.21821, 80.48551], [-77.52957, 77.23408], [-46.37635, 57.3249], [-9.68082, 72.73731], [-5.7106, 84.28058], [-49.33696, 84.57952]]]] } },
22754 { type: "Feature", properties: { iso1A2: "GM", iso1A3: "GMB", iso1N3: "270", wikidata: "Q1005", nameEn: "The Gambia", groups: ["011", "202", "002", "UN"], callingCodes: ["220"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-15.14917, 13.57989], [-14.36795, 13.23033], [-13.79409, 13.34472], [-13.8955, 13.59126], [-14.34721, 13.46578], [-14.93719, 13.80173], [-15.36504, 13.79313], [-15.47902, 13.58758], [-17.43598, 13.59273], [-17.43966, 13.04579], [-16.74676, 13.06025], [-16.69343, 13.16791], [-15.80355, 13.16729], [-15.80478, 13.34832], [-15.26908, 13.37768], [-15.14917, 13.57989]]]] } },
22755 { type: "Feature", properties: { iso1A2: "GN", iso1A3: "GIN", iso1N3: "324", wikidata: "Q1006", nameEn: "Guinea", groups: ["011", "202", "002", "UN"], callingCodes: ["224"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-11.37536, 12.40788], [-11.46267, 12.44559], [-11.91331, 12.42008], [-12.35415, 12.32758], [-12.87336, 12.51892], [-13.06603, 12.49342], [-13.05296, 12.64003], [-13.70523, 12.68013], [-13.7039, 12.60313], [-13.65089, 12.49515], [-13.64168, 12.42764], [-13.70851, 12.24978], [-13.92745, 12.24077], [-13.94589, 12.16869], [-13.7039, 12.00869], [-13.7039, 11.70195], [-14.09799, 11.63649], [-14.26623, 11.67486], [-14.31513, 11.60713], [-14.51173, 11.49708], [-14.66677, 11.51188], [-14.77786, 11.36323], [-14.95993, 10.99244], [-15.07174, 10.89557], [-15.96748, 10.162], [-14.36218, 8.64107], [-13.29911, 9.04245], [-13.18586, 9.0925], [-13.08953, 9.0409], [-12.94095, 9.26335], [-12.76788, 9.3133], [-12.47254, 9.86834], [-12.24262, 9.92386], [-12.12634, 9.87203], [-11.91023, 9.93927], [-11.89624, 9.99763], [-11.2118, 10.00098], [-10.6534, 9.29919], [-10.74484, 9.07998], [-10.5783, 9.06386], [-10.56197, 8.81225], [-10.47707, 8.67669], [-10.61422, 8.5314], [-10.70565, 8.29235], [-10.63934, 8.35326], [-10.54891, 8.31174], [-10.37257, 8.48941], [-10.27575, 8.48711], [-10.203, 8.47991], [-10.14579, 8.52665], [-10.05375, 8.50697], [-10.05873, 8.42578], [-9.77763, 8.54633], [-9.47415, 8.35195], [-9.50898, 8.18455], [-9.41445, 8.02448], [-9.44928, 7.9284], [-9.35724, 7.74111], [-9.37465, 7.62032], [-9.48161, 7.37122], [-9.41943, 7.41809], [-9.305, 7.42056], [-9.20798, 7.38109], [-9.18311, 7.30461], [-9.09107, 7.1985], [-8.93435, 7.2824], [-8.85724, 7.26019], [-8.8448, 7.35149], [-8.72789, 7.51429], [-8.67814, 7.69428], [-8.55874, 7.70167], [-8.55874, 7.62525], [-8.47114, 7.55676], [-8.4003, 7.6285], [-8.21374, 7.54466], [-8.09931, 7.78626], [-8.13414, 7.87991], [-8.06449, 8.04989], [-7.94695, 8.00925], [-7.99919, 8.11023], [-7.98675, 8.20134], [-8.062, 8.16071], [-8.2411, 8.24196], [-8.22991, 8.48438], [-7.92518, 8.50652], [-7.65653, 8.36873], [-7.69882, 8.66148], [-7.95503, 8.81146], [-7.92518, 8.99332], [-7.73862, 9.08422], [-7.90777, 9.20456], [-7.85056, 9.41812], [-8.03463, 9.39604], [-8.14657, 9.55062], [-8.09434, 9.86936], [-8.15652, 9.94288], [-8.11921, 10.04577], [-8.01225, 10.1021], [-7.97971, 10.17117], [-7.9578, 10.2703], [-8.10207, 10.44649], [-8.22711, 10.41722], [-8.32614, 10.69273], [-8.2667, 10.91762], [-8.35083, 11.06234], [-8.66923, 10.99397], [-8.40058, 11.37466], [-8.80854, 11.66715], [-8.94784, 12.34842], [-9.13689, 12.50875], [-9.38067, 12.48446], [-9.32097, 12.29009], [-9.63938, 12.18312], [-9.714, 12.0226], [-10.30604, 12.24634], [-10.71897, 11.91552], [-10.80355, 12.1053], [-10.99758, 12.24634], [-11.24136, 12.01286], [-11.50006, 12.17826], [-11.37536, 12.40788]]]] } },
22756 { type: "Feature", properties: { iso1A2: "GP", iso1A3: "GLP", iso1N3: "312", wikidata: "Q17012", nameEn: "Guadeloupe", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-60.03183, 16.1129], [-61.60296, 16.73066], [-63.00549, 15.26166], [-60.03183, 16.1129]]]] } },
22757 { type: "Feature", properties: { iso1A2: "GQ", iso1A3: "GNQ", iso1N3: "226", wikidata: "Q983", nameEn: "Equatorial Guinea", groups: ["017", "202", "002", "UN"], callingCodes: ["240"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.22018, 3.72052], [8.34397, 4.30689], [7.71762, 0.6674], [3.35016, -3.29031], [9.66433, 1.06723], [9.75065, 1.06753], [9.79648, 1.0019], [11.35307, 1.00251], [11.3561, 2.17217], [9.991, 2.16561], [9.90749, 2.20049], [9.89012, 2.20457], [9.84716, 2.24676], [9.83238, 2.29079], [9.83754, 2.32428], [9.82123, 2.35097], [9.81162, 2.33797], [9.22018, 3.72052]]]] } },
22758 { type: "Feature", properties: { iso1A2: "GR", iso1A3: "GRC", iso1N3: "300", wikidata: "Q41", nameEn: "Greece", aliases: ["EL"], groups: ["EU", "039", "150", "UN"], callingCodes: ["30"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.03489, 40.73051], [26.0754, 40.72772], [26.08638, 40.73214], [26.12495, 40.74283], [26.12854, 40.77339], [26.15685, 40.80709], [26.21351, 40.83298], [26.20856, 40.86048], [26.26169, 40.9168], [26.29441, 40.89119], [26.28623, 40.93005], [26.32259, 40.94042], [26.35894, 40.94292], [26.33297, 40.98388], [26.3606, 41.02027], [26.31928, 41.07386], [26.32259, 41.24929], [26.39861, 41.25053], [26.5209, 41.33993], [26.5837, 41.32131], [26.62997, 41.34613], [26.61767, 41.42281], [26.59742, 41.48058], [26.59196, 41.60491], [26.5209, 41.62592], [26.47958, 41.67037], [26.35957, 41.71149], [26.30255, 41.70925], [26.2654, 41.71544], [26.22888, 41.74139], [26.21325, 41.73223], [26.16841, 41.74858], [26.06148, 41.70345], [26.07083, 41.64584], [26.15146, 41.60828], [26.14328, 41.55496], [26.17951, 41.55409], [26.176, 41.50072], [26.14796, 41.47533], [26.20288, 41.43943], [26.16548, 41.42278], [26.12926, 41.35878], [25.87919, 41.30526], [25.8266, 41.34563], [25.70507, 41.29209], [25.66183, 41.31316], [25.61042, 41.30614], [25.55082, 41.31667], [25.52394, 41.2798], [25.48187, 41.28506], [25.28322, 41.23411], [25.11611, 41.34212], [24.942, 41.38685], [24.90928, 41.40876], [24.86136, 41.39298], [24.82514, 41.4035], [24.8041, 41.34913], [24.71529, 41.41928], [24.61129, 41.42278], [24.52599, 41.56808], [24.30513, 41.51297], [24.27124, 41.57682], [24.18126, 41.51735], [24.10063, 41.54796], [24.06323, 41.53222], [24.06908, 41.46132], [23.96975, 41.44118], [23.91483, 41.47971], [23.89613, 41.45257], [23.80148, 41.43943], [23.76525, 41.40175], [23.67644, 41.41139], [23.63203, 41.37632], [23.52453, 41.40262], [23.40416, 41.39999], [23.33639, 41.36317], [23.31301, 41.40525], [23.22771, 41.37106], [23.21953, 41.33773], [23.1833, 41.31755], [22.93334, 41.34104], [22.81199, 41.3398], [22.76408, 41.32225], [22.74538, 41.16321], [22.71266, 41.13945], [22.65306, 41.18168], [22.62852, 41.14385], [22.58295, 41.11568], [22.5549, 41.13065], [22.42285, 41.11921], [22.26744, 41.16409], [22.17629, 41.15969], [22.1424, 41.12449], [22.06527, 41.15617], [21.90869, 41.09191], [21.91102, 41.04786], [21.7556, 40.92525], [21.69601, 40.9429], [21.57448, 40.86076], [21.53007, 40.90759], [21.41555, 40.9173], [21.35595, 40.87578], [21.25779, 40.86165], [21.21105, 40.8855], [21.15262, 40.85546], [20.97887, 40.85475], [20.98396, 40.79109], [20.95752, 40.76982], [20.98134, 40.76046], [21.05833, 40.66586], [21.03932, 40.56299], [20.96908, 40.51526], [20.94925, 40.46625], [20.83688, 40.47882], [20.7906, 40.42726], [20.78234, 40.35803], [20.71789, 40.27739], [20.67162, 40.09433], [20.62566, 40.0897], [20.61081, 40.07866], [20.55593, 40.06524], [20.51297, 40.08168], [20.48487, 40.06271], [20.42373, 40.06777], [20.37911, 39.99058], [20.31135, 39.99438], [20.41546, 39.82832], [20.41475, 39.81437], [20.38572, 39.78516], [20.30804, 39.81563], [20.29152, 39.80421], [20.31961, 39.72799], [20.27412, 39.69884], [20.22707, 39.67459], [20.22376, 39.64532], [20.15988, 39.652], [20.12956, 39.65805], [20.05189, 39.69112], [20.00957, 39.69227], [19.98042, 39.6504], [19.92466, 39.69533], [19.97622, 39.78684], [19.95905, 39.82857], [19.0384, 40.35325], [19.20409, 39.7532], [22.5213, 33.45682], [29.73302, 35.92555], [29.69611, 36.10365], [29.61805, 36.14179], [29.61002, 36.1731], [29.48192, 36.18377], [29.30783, 36.01033], [28.23708, 36.56812], [27.95037, 36.46155], [27.89482, 36.69898], [27.46117, 36.53789], [27.24613, 36.71622], [27.45627, 36.9008], [27.20312, 36.94571], [27.14757, 37.32], [26.95583, 37.64989], [26.99377, 37.69034], [27.16428, 37.72343], [27.05537, 37.9131], [26.21136, 38.17558], [26.24183, 38.44695], [26.32173, 38.48731], [26.21136, 38.65436], [26.61814, 38.81372], [26.70773, 39.0312], [26.43357, 39.43096], [25.94257, 39.39358], [25.61285, 40.17161], [26.04292, 40.3958], [25.94795, 40.72797], [26.03489, 40.73051]]]] } },
22759 { type: "Feature", properties: { iso1A2: "GS", iso1A3: "SGS", iso1N3: "239", wikidata: "Q35086", nameEn: "South Georgia and South Sandwich Islands", country: "GB", groups: ["BOTS", "005", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["500"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-35.26394, -43.68272], [-53.39656, -59.87088], [-22.31757, -59.85974], [-35.26394, -43.68272]]]] } },
22760 { type: "Feature", properties: { iso1A2: "GT", iso1A3: "GTM", iso1N3: "320", wikidata: "Q774", nameEn: "Guatemala", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["502"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.14985, 17.81563], [-90.98678, 17.81655], [-90.99199, 17.25192], [-91.43809, 17.25373], [-91.04436, 16.92175], [-90.69064, 16.70697], [-90.61212, 16.49832], [-90.40499, 16.40524], [-90.44567, 16.07573], [-91.73182, 16.07371], [-92.20983, 15.26077], [-92.0621, 15.07406], [-92.1454, 14.98143], [-92.1423, 14.88647], [-92.18161, 14.84147], [-92.1454, 14.6804], [-92.2261, 14.53423], [-92.37213, 14.39277], [-90.55276, 12.8866], [-90.11344, 13.73679], [-90.10505, 13.85104], [-89.88937, 14.0396], [-89.81807, 14.07073], [-89.76103, 14.02923], [-89.73251, 14.04133], [-89.75569, 14.07073], [-89.70756, 14.1537], [-89.61844, 14.21937], [-89.52397, 14.22628], [-89.50614, 14.26084], [-89.58814, 14.33165], [-89.57441, 14.41637], [-89.39028, 14.44561], [-89.34776, 14.43013], [-89.35189, 14.47553], [-89.23719, 14.58046], [-89.15653, 14.57802], [-89.13132, 14.71582], [-89.23467, 14.85596], [-89.15149, 14.97775], [-89.18048, 14.99967], [-89.15149, 15.07392], [-88.97343, 15.14039], [-88.32467, 15.63665], [-88.31459, 15.66942], [-88.24022, 15.69247], [-88.22552, 15.72294], [-88.20359, 16.03858], [-88.40779, 16.09624], [-88.95358, 15.88698], [-89.02415, 15.9063], [-89.17418, 15.90898], [-89.22683, 15.88619], [-89.15025, 17.04813], [-89.14985, 17.81563]]]] } },
22761 { type: "Feature", properties: { iso1A2: "GU", iso1A3: "GUM", iso1N3: "316", wikidata: "Q16635", nameEn: "Guam", aliases: ["US-GU"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 671"] }, geometry: { type: "MultiPolygon", coordinates: [[[[146.25931, 13.85876], [143.82485, 13.92273], [144.61642, 12.82462], [146.25931, 13.85876]]]] } },
22762 { type: "Feature", properties: { iso1A2: "GW", iso1A3: "GNB", iso1N3: "624", wikidata: "Q1007", nameEn: "Guinea-Bissau", groups: ["011", "202", "002", "UN"], callingCodes: ["245"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.31513, 11.60713], [-14.26623, 11.67486], [-14.09799, 11.63649], [-13.7039, 11.70195], [-13.7039, 12.00869], [-13.94589, 12.16869], [-13.92745, 12.24077], [-13.70851, 12.24978], [-13.64168, 12.42764], [-13.65089, 12.49515], [-13.7039, 12.60313], [-13.70523, 12.68013], [-15.17582, 12.6847], [-15.67302, 12.42974], [-16.20591, 12.46157], [-16.38191, 12.36449], [-16.70562, 12.34803], [-17.4623, 11.92379], [-15.96748, 10.162], [-15.07174, 10.89557], [-14.95993, 10.99244], [-14.77786, 11.36323], [-14.66677, 11.51188], [-14.51173, 11.49708], [-14.31513, 11.60713]]]] } },
22763 { type: "Feature", properties: { iso1A2: "GY", iso1A3: "GUY", iso1N3: "328", wikidata: "Q734", nameEn: "Guyana", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["592"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.84822, 6.73257], [-59.54058, 8.6862], [-59.98508, 8.53046], [-59.85562, 8.35213], [-59.80661, 8.28906], [-59.83156, 8.23261], [-59.97059, 8.20791], [-60.02407, 8.04557], [-60.38056, 7.8302], [-60.51959, 7.83373], [-60.64793, 7.56877], [-60.71923, 7.55817], [-60.59802, 7.33194], [-60.63367, 7.25061], [-60.54098, 7.14804], [-60.44116, 7.20817], [-60.28074, 7.1162], [-60.39419, 6.94847], [-60.54873, 6.8631], [-61.13632, 6.70922], [-61.20762, 6.58174], [-61.15058, 6.19558], [-61.4041, 5.95304], [-60.73204, 5.20931], [-60.32352, 5.21299], [-60.20944, 5.28754], [-59.98129, 5.07097], [-60.04189, 4.69801], [-60.15953, 4.53456], [-59.78878, 4.45637], [-59.69361, 4.34069], [-59.73353, 4.20399], [-59.51963, 3.91951], [-59.86899, 3.57089], [-59.79769, 3.37162], [-59.99733, 2.92312], [-59.91177, 2.36759], [-59.7264, 2.27497], [-59.74066, 1.87596], [-59.25583, 1.40559], [-58.92072, 1.31293], [-58.84229, 1.17749], [-58.53571, 1.29154], [-58.4858, 1.48399], [-58.33887, 1.58014], [-58.01873, 1.51966], [-57.97336, 1.64566], [-57.77281, 1.73344], [-57.55743, 1.69605], [-57.35073, 1.98327], [-57.23981, 1.95808], [-57.09109, 2.01854], [-57.07092, 1.95304], [-56.7659, 1.89509], [-56.47045, 1.95135], [-56.55439, 2.02003], [-56.70519, 2.02964], [-57.35891, 3.32121], [-58.0307, 3.95513], [-57.8699, 4.89394], [-57.37442, 5.0208], [-57.22536, 5.15605], [-57.31629, 5.33714], [-56.84822, 6.73257]]]] } },
22764 { type: "Feature", properties: { iso1A2: "HK", iso1A3: "HKG", iso1N3: "344", wikidata: "Q8646", nameEn: "Hong Kong", country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["852"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.92195, 22.13873], [114.50148, 22.15017], [114.44998, 22.55977], [114.25154, 22.55977], [114.22888, 22.5436], [114.22185, 22.55343], [114.20655, 22.55706], [114.18338, 22.55444], [114.17247, 22.55944], [114.1597, 22.56041], [114.15123, 22.55163], [114.1482, 22.54091], [114.13823, 22.54319], [114.12665, 22.54003], [114.11656, 22.53415], [114.11181, 22.52878], [114.1034, 22.5352], [114.09692, 22.53435], [114.09048, 22.53716], [114.08606, 22.53276], [114.07817, 22.52997], [114.07267, 22.51855], [114.06272, 22.51617], [114.05729, 22.51104], [114.05438, 22.5026], [114.03113, 22.5065], [113.86771, 22.42972], [113.81621, 22.2163], [113.83338, 22.1826], [113.92195, 22.13873]]]] } },
22765 { type: "Feature", properties: { iso1A2: "HM", iso1A3: "HMD", iso1N3: "334", wikidata: "Q131198", nameEn: "Heard Island and McDonald Islands", country: "AU", groups: ["053", "009", "UN"], driveSide: "left" }, geometry: { type: "MultiPolygon", coordinates: [[[[71.08716, -53.87687], [75.44182, -53.99822], [72.87012, -51.48322], [71.08716, -53.87687]]]] } },
22766 { type: "Feature", properties: { iso1A2: "HN", iso1A3: "HND", iso1N3: "340", wikidata: "Q783", nameEn: "Honduras", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["504"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.86109, 17.73736], [-88.20359, 16.03858], [-88.22552, 15.72294], [-88.24022, 15.69247], [-88.31459, 15.66942], [-88.32467, 15.63665], [-88.97343, 15.14039], [-89.15149, 15.07392], [-89.18048, 14.99967], [-89.15149, 14.97775], [-89.23467, 14.85596], [-89.13132, 14.71582], [-89.15653, 14.57802], [-89.23719, 14.58046], [-89.35189, 14.47553], [-89.34776, 14.43013], [-89.04187, 14.33644], [-88.94608, 14.20207], [-88.85785, 14.17763], [-88.815, 14.11652], [-88.73182, 14.10919], [-88.70661, 14.04317], [-88.49738, 13.97224], [-88.48982, 13.86458], [-88.25791, 13.91108], [-88.23018, 13.99915], [-88.07641, 13.98447], [-88.00331, 13.86948], [-87.7966, 13.91353], [-87.68821, 13.80829], [-87.73106, 13.75443], [-87.78148, 13.52906], [-87.71657, 13.50577], [-87.72115, 13.46083], [-87.73841, 13.44169], [-87.77354, 13.45767], [-87.83467, 13.44655], [-87.84675, 13.41078], [-87.80177, 13.35689], [-87.73714, 13.32715], [-87.69751, 13.25228], [-87.55124, 13.12523], [-87.37107, 12.98646], [-87.06306, 13.00892], [-87.03785, 12.98682], [-86.93197, 13.05313], [-86.93383, 13.18677], [-86.87066, 13.30641], [-86.71267, 13.30348], [-86.76812, 13.79605], [-86.35219, 13.77157], [-86.14801, 14.04317], [-86.00685, 14.08474], [-86.03458, 13.99181], [-85.75477, 13.8499], [-85.73964, 13.9698], [-85.45762, 14.11304], [-85.32149, 14.2562], [-85.18602, 14.24929], [-85.1575, 14.53934], [-84.90082, 14.80489], [-84.82596, 14.82212], [-84.70119, 14.68078], [-84.48373, 14.63249], [-84.10584, 14.76353], [-83.89551, 14.76697], [-83.62101, 14.89448], [-83.49268, 15.01158], [-83.13724, 15.00002], [-83.04763, 15.03256], [-82.06974, 14.49418], [-81.58685, 18.0025], [-83.86109, 17.73736]]]] } },
22767 { type: "Feature", properties: { iso1A2: "HR", iso1A3: "HRV", iso1N3: "191", wikidata: "Q224", nameEn: "Croatia", groups: ["EU", "039", "150", "UN"], callingCodes: ["385"] }, geometry: { type: "MultiPolygon", coordinates: [[[[17.6444, 42.88641], [17.5392, 42.92787], [17.70879, 42.97223], [17.64268, 43.08595], [17.46986, 43.16559], [17.286, 43.33065], [17.25579, 43.40353], [17.29699, 43.44542], [17.24411, 43.49376], [17.15828, 43.49376], [17.00585, 43.58037], [16.80736, 43.76011], [16.75316, 43.77157], [16.70922, 43.84887], [16.55472, 43.95326], [16.50528, 44.0244], [16.43629, 44.02826], [16.43662, 44.07523], [16.36864, 44.08263], [16.18688, 44.27012], [16.21346, 44.35231], [16.12969, 44.38275], [16.16814, 44.40679], [16.10566, 44.52586], [16.03012, 44.55572], [16.00884, 44.58605], [16.05828, 44.61538], [15.89348, 44.74964], [15.8255, 44.71501], [15.72584, 44.82334], [15.79472, 44.8455], [15.76096, 44.87045], [15.74723, 44.96818], [15.78568, 44.97401], [15.74585, 45.0638], [15.78842, 45.11519], [15.76371, 45.16508], [15.83512, 45.22459], [15.98412, 45.23088], [16.12153, 45.09616], [16.29036, 44.99732], [16.35404, 45.00241], [16.35863, 45.03529], [16.3749, 45.05206], [16.38219, 45.05139], [16.38309, 45.05955], [16.40023, 45.1147], [16.4634, 45.14522], [16.49155, 45.21153], [16.52982, 45.22713], [16.5501, 45.2212], [16.56559, 45.22307], [16.60194, 45.23042], [16.64962, 45.20714], [16.74845, 45.20393], [16.78219, 45.19002], [16.81137, 45.18434], [16.83804, 45.18951], [16.92405, 45.27607], [16.9385, 45.22742], [17.0415, 45.20759], [17.18438, 45.14764], [17.24325, 45.146], [17.25131, 45.14957], [17.26815, 45.18444], [17.32092, 45.16246], [17.33573, 45.14521], [17.41229, 45.13335], [17.4498, 45.16119], [17.45615, 45.12523], [17.47589, 45.12656], [17.51469, 45.10791], [17.59104, 45.10816], [17.66571, 45.13408], [17.84826, 45.04489], [17.87148, 45.04645], [17.93706, 45.08016], [17.97336, 45.12245], [17.97834, 45.13831], [17.99479, 45.14958], [18.01594, 45.15163], [18.03121, 45.12632], [18.1624, 45.07654], [18.24387, 45.13699], [18.32077, 45.1021], [18.41896, 45.11083], [18.47939, 45.05871], [18.65723, 45.07544], [18.78357, 44.97741], [18.80661, 44.93561], [18.76369, 44.93707], [18.76347, 44.90669], [18.8704, 44.85097], [19.01994, 44.85493], [18.98957, 44.90645], [19.02871, 44.92541], [19.06853, 44.89915], [19.15573, 44.95409], [19.05205, 44.97692], [19.1011, 45.01191], [19.07952, 45.14668], [19.14063, 45.12972], [19.19144, 45.17863], [19.43589, 45.17137], [19.41941, 45.23475], [19.28208, 45.23813], [19.10774, 45.29547], [18.97446, 45.37528], [18.99918, 45.49333], [19.08364, 45.48804], [19.07471, 45.53086], [18.94562, 45.53712], [18.88776, 45.57253], [18.96691, 45.66731], [18.90305, 45.71863], [18.85783, 45.85493], [18.81394, 45.91329], [18.80211, 45.87995], [18.6792, 45.92057], [18.57483, 45.80772], [18.44368, 45.73972], [18.12439, 45.78905], [18.08869, 45.76511], [17.99805, 45.79671], [17.87377, 45.78522], [17.66545, 45.84207], [17.56821, 45.93728], [17.35672, 45.95209], [17.14592, 46.16697], [16.8903, 46.28122], [16.8541, 46.36255], [16.7154, 46.39523], [16.6639, 46.45203], [16.59527, 46.47524], [16.52604, 46.47831], [16.5007, 46.49644], [16.44036, 46.5171], [16.38771, 46.53608], [16.37193, 46.55008], [16.29793, 46.5121], [16.26733, 46.51505], [16.26759, 46.50566], [16.23961, 46.49653], [16.25124, 46.48067], [16.27398, 46.42875], [16.27329, 46.41467], [16.30162, 46.40437], [16.30233, 46.37837], [16.18824, 46.38282], [16.14859, 46.40547], [16.05281, 46.39141], [16.05065, 46.3833], [16.07314, 46.36458], [16.07616, 46.3463], [15.97965, 46.30652], [15.79284, 46.25811], [15.78817, 46.21719], [15.75479, 46.20336], [15.75436, 46.21969], [15.67395, 46.22478], [15.6434, 46.21396], [15.64904, 46.19229], [15.59909, 46.14761], [15.6083, 46.11992], [15.62317, 46.09103], [15.72977, 46.04682], [15.71246, 46.01196], [15.70327, 46.00015], [15.70636, 45.92116], [15.67967, 45.90455], [15.68383, 45.88867], [15.68232, 45.86819], [15.70411, 45.8465], [15.66662, 45.84085], [15.64185, 45.82915], [15.57952, 45.84953], [15.52234, 45.82195], [15.47325, 45.8253], [15.47531, 45.79802], [15.40836, 45.79491], [15.25423, 45.72275], [15.30872, 45.69014], [15.34919, 45.71623], [15.4057, 45.64727], [15.38952, 45.63682], [15.34214, 45.64702], [15.34695, 45.63382], [15.31027, 45.6303], [15.27747, 45.60504], [15.29837, 45.5841], [15.30249, 45.53224], [15.38188, 45.48752], [15.33051, 45.45258], [15.27758, 45.46678], [15.16862, 45.42309], [15.05187, 45.49079], [15.02385, 45.48533], [14.92266, 45.52788], [14.90554, 45.47769], [14.81992, 45.45913], [14.80124, 45.49515], [14.71718, 45.53442], [14.68605, 45.53006], [14.69694, 45.57366], [14.59576, 45.62812], [14.60977, 45.66403], [14.57397, 45.67165], [14.53816, 45.6205], [14.5008, 45.60852], [14.49769, 45.54424], [14.36693, 45.48642], [14.32487, 45.47142], [14.27681, 45.4902], [14.26611, 45.48239], [14.24239, 45.50607], [14.22371, 45.50388], [14.20348, 45.46896], [14.07116, 45.48752], [14.00578, 45.52352], [13.96063, 45.50825], [13.99488, 45.47551], [13.97309, 45.45258], [13.90771, 45.45149], [13.88124, 45.42637], [13.81742, 45.43729], [13.7785, 45.46787], [13.67398, 45.4436], [13.62902, 45.45898], [13.56979, 45.4895], [13.45644, 45.59464], [13.05142, 45.33128], [13.12821, 44.48877], [16.15283, 42.18525], [18.45131, 42.21682], [18.54128, 42.39171], [18.52152, 42.42302], [18.43588, 42.48556], [18.44307, 42.51077], [18.43735, 42.55921], [18.36197, 42.61423], [18.24318, 42.6112], [17.88201, 42.83668], [17.80854, 42.9182], [17.7948, 42.89556], [17.68151, 42.92725], [17.6444, 42.88641]]]] } },
22768 { type: "Feature", properties: { iso1A2: "HT", iso1A3: "HTI", iso1N3: "332", wikidata: "Q790", nameEn: "Haiti", aliases: ["RH"], groups: ["029", "003", "419", "019", "UN"], callingCodes: ["509"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.71885, 18.78423], [-71.72624, 18.87802], [-71.77766, 18.95007], [-71.88102, 18.95007], [-71.74088, 19.0437], [-71.71088, 19.08353], [-71.69938, 19.10916], [-71.65337, 19.11759], [-71.62642, 19.21212], [-71.73229, 19.26686], [-71.77766, 19.33823], [-71.69448, 19.37866], [-71.6802, 19.45008], [-71.71268, 19.53374], [-71.71449, 19.55364], [-71.7429, 19.58445], [-71.75865, 19.70231], [-71.77419, 19.73128], [-72.38946, 20.27111], [-73.37289, 20.43199], [-74.7289, 18.71009], [-74.76465, 18.06252], [-72.29523, 17.48026], [-71.75671, 18.03456], [-71.73783, 18.07177], [-71.74994, 18.11115], [-71.75465, 18.14405], [-71.78271, 18.18302], [-71.69952, 18.34101], [-71.90875, 18.45821], [-71.88102, 18.50125], [-72.00201, 18.62312], [-71.95412, 18.64939], [-71.82556, 18.62551], [-71.71885, 18.78423]]]] } },
22769 { type: "Feature", properties: { iso1A2: "HU", iso1A3: "HUN", iso1N3: "348", wikidata: "Q28", nameEn: "Hungary", groups: ["EU", "151", "150", "UN"], callingCodes: ["36"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.72525, 48.34628], [21.67134, 48.3989], [21.6068, 48.50365], [21.44063, 48.58456], [21.11516, 48.49546], [20.83248, 48.5824], [20.5215, 48.53336], [20.29943, 48.26104], [20.24312, 48.2784], [19.92452, 48.1283], [19.63338, 48.25006], [19.52489, 48.19791], [19.47957, 48.09437], [19.28182, 48.08336], [19.23924, 48.0595], [19.01952, 48.07052], [18.82176, 48.04206], [18.76134, 47.97499], [18.76821, 47.87469], [18.8506, 47.82308], [18.74074, 47.8157], [18.66521, 47.76772], [18.56496, 47.76588], [18.29305, 47.73541], [18.02938, 47.75665], [17.71215, 47.7548], [17.23699, 48.02094], [17.16001, 48.00636], [17.09786, 47.97336], [17.11022, 47.92461], [17.08275, 47.87719], [17.00997, 47.86245], [17.07039, 47.81129], [17.05048, 47.79377], [17.08893, 47.70928], [16.87538, 47.68895], [16.86509, 47.72268], [16.82938, 47.68432], [16.7511, 47.67878], [16.72089, 47.73469], [16.65679, 47.74197], [16.61183, 47.76171], [16.54779, 47.75074], [16.53514, 47.73837], [16.55129, 47.72268], [16.4222, 47.66537], [16.58699, 47.61772], [16.64193, 47.63114], [16.71059, 47.52692], [16.64821, 47.50155], [16.6718, 47.46139], [16.57152, 47.40868], [16.52414, 47.41007], [16.49908, 47.39416], [16.45104, 47.41181], [16.47782, 47.25918], [16.44142, 47.25079], [16.43663, 47.21127], [16.41739, 47.20649], [16.42801, 47.18422], [16.4523, 47.18812], [16.46442, 47.16845], [16.44932, 47.14418], [16.52863, 47.13974], [16.46134, 47.09395], [16.52176, 47.05747], [16.43936, 47.03548], [16.51369, 47.00084], [16.28202, 47.00159], [16.27594, 46.9643], [16.22403, 46.939], [16.19904, 46.94134], [16.10983, 46.867], [16.14365, 46.8547], [16.15711, 46.85434], [16.21892, 46.86961], [16.2365, 46.87775], [16.2941, 46.87137], [16.34547, 46.83836], [16.3408, 46.80641], [16.31303, 46.79838], [16.30966, 46.7787], [16.37816, 46.69975], [16.42641, 46.69228], [16.41863, 46.66238], [16.38594, 46.6549], [16.39217, 46.63673], [16.50139, 46.56684], [16.52885, 46.53303], [16.52604, 46.5051], [16.59527, 46.47524], [16.6639, 46.45203], [16.7154, 46.39523], [16.8541, 46.36255], [16.8903, 46.28122], [17.14592, 46.16697], [17.35672, 45.95209], [17.56821, 45.93728], [17.66545, 45.84207], [17.87377, 45.78522], [17.99805, 45.79671], [18.08869, 45.76511], [18.12439, 45.78905], [18.44368, 45.73972], [18.57483, 45.80772], [18.6792, 45.92057], [18.80211, 45.87995], [18.81394, 45.91329], [18.99712, 45.93537], [19.01284, 45.96529], [19.0791, 45.96458], [19.10388, 46.04015], [19.14543, 45.9998], [19.28826, 45.99694], [19.52473, 46.1171], [19.56113, 46.16824], [19.66007, 46.19005], [19.81491, 46.1313], [19.93508, 46.17553], [20.01816, 46.17696], [20.03533, 46.14509], [20.09713, 46.17315], [20.26068, 46.12332], [20.28324, 46.1438], [20.35573, 46.16629], [20.45377, 46.14405], [20.49718, 46.18721], [20.63863, 46.12728], [20.76085, 46.21002], [20.74574, 46.25467], [20.86797, 46.28884], [21.06572, 46.24897], [21.16872, 46.30118], [21.28061, 46.44941], [21.26929, 46.4993], [21.33214, 46.63035], [21.43926, 46.65109], [21.5151, 46.72147], [21.48935, 46.7577], [21.52028, 46.84118], [21.59307, 46.86935], [21.59581, 46.91628], [21.68645, 46.99595], [21.648, 47.03902], [21.78395, 47.11104], [21.94463, 47.38046], [22.01055, 47.37767], [22.03389, 47.42508], [22.00917, 47.50492], [22.31816, 47.76126], [22.41979, 47.7391], [22.46559, 47.76583], [22.67247, 47.7871], [22.76617, 47.8417], [22.77991, 47.87211], [22.89849, 47.95851], [22.84276, 47.98602], [22.87847, 48.04665], [22.81804, 48.11363], [22.73427, 48.12005], [22.66835, 48.09162], [22.58733, 48.10813], [22.59007, 48.15121], [22.49806, 48.25189], [22.38133, 48.23726], [22.2083, 48.42534], [22.14689, 48.4005], [21.83339, 48.36242], [21.8279, 48.33321], [21.72525, 48.34628]]]] } },
22770 { type: "Feature", properties: { iso1A2: "IC", wikidata: "Q5813", nameEn: "Canary Islands", country: "ES", groups: ["Q3320166", "Q105472", "EU", "039", "150", "UN"], isoStatus: "excRes", callingCodes: ["34"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-12.00985, 30.24121], [-25.3475, 27.87574], [-14.43883, 27.02969], [-12.00985, 30.24121]]]] } },
22771 { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
22772 { type: "Feature", geometry: { type: "MultiPolygon", coordinates: [[[[-6.26218, 54.09785], [-6.29003, 54.11278], [-6.32694, 54.09337], [-6.36279, 54.11248], [-6.36605, 54.07234], [-6.47849, 54.06947], [-6.62842, 54.03503], [-6.66264, 54.0666], [-6.6382, 54.17071], [-6.70175, 54.20218], [-6.74575, 54.18788], [-6.81583, 54.22791], [-6.85179, 54.29176], [-6.87775, 54.34682], [-7.02034, 54.4212], [-7.19145, 54.31296], [-7.14908, 54.22732], [-7.25012, 54.20063], [-7.26316, 54.13863], [-7.29493, 54.12013], [-7.29687, 54.1354], [-7.28017, 54.16714], [-7.29157, 54.17191], [-7.34005, 54.14698], [-7.30553, 54.11869], [-7.32834, 54.11475], [-7.44567, 54.1539], [-7.4799, 54.12239], [-7.55812, 54.12239], [-7.69501, 54.20731], [-7.81397, 54.20159], [-7.8596, 54.21779], [-7.87101, 54.29299], [-8.04555, 54.36292], [-8.179, 54.46763], [-8.04538, 54.48941], [-7.99812, 54.54427], [-7.8596, 54.53671], [-7.70315, 54.62077], [-7.93293, 54.66603], [-7.83352, 54.73854], [-7.75041, 54.7103], [-7.64449, 54.75265], [-7.54671, 54.74606], [-7.54508, 54.79401], [-7.47626, 54.83084], [-7.4473, 54.87003], [-7.44404, 54.9403], [-7.40004, 54.94498], [-7.4033, 55.00391], [-7.34464, 55.04688], [-7.2471, 55.06933], [-6.34755, 55.49206], [-7.75229, 55.93854], [-11.75, 54], [-11, 51], [-6.03913, 51.13217], [-5.37267, 53.63269], [-6.26218, 54.09785]]]] }, properties: { iso1A2: "IE", iso1A3: "IRL", iso1N3: "372", wikidata: "Q27", nameEn: "Republic of Ireland", groups: ["EU", "Q22890", "154", "150", "UN"], driveSide: "left", callingCodes: ["353"] } },
22773 { type: "Feature", properties: { iso1A2: "IL", iso1A3: "ISR", iso1N3: "376", wikidata: "Q801", nameEn: "Israel", groups: ["145", "142", "UN"], callingCodes: ["972"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.052, 31.46619], [34.29262, 31.70393], [34.48681, 31.59711], [34.56797, 31.54197], [34.48892, 31.48365], [34.40077, 31.40926], [34.36505, 31.36404], [34.37381, 31.30598], [34.36523, 31.28963], [34.29417, 31.24194], [34.26742, 31.21998], [34.92298, 29.45305], [34.97718, 29.54294], [34.98207, 29.58147], [35.02147, 29.66343], [35.14108, 30.07374], [35.19183, 30.34636], [35.16218, 30.43535], [35.19595, 30.50297], [35.21379, 30.60401], [35.29311, 30.71365], [35.33456, 30.81224], [35.33984, 30.8802], [35.41371, 30.95565], [35.43658, 31.12444], [35.40316, 31.25535], [35.47672, 31.49578], [35.39675, 31.49572], [35.22921, 31.37445], [35.13033, 31.3551], [35.02459, 31.35979], [34.92571, 31.34337], [34.88932, 31.37093], [34.87833, 31.39321], [34.89756, 31.43891], [34.93258, 31.47816], [34.94356, 31.50743], [34.9415, 31.55601], [34.95249, 31.59813], [35.00879, 31.65426], [35.08226, 31.69107], [35.10782, 31.71594], [35.11895, 31.71454], [35.12933, 31.7325], [35.13931, 31.73012], [35.15119, 31.73634], [35.15474, 31.73352], [35.16478, 31.73242], [35.18023, 31.72067], [35.20538, 31.72388], [35.21937, 31.71578], [35.22392, 31.71899], [35.23972, 31.70896], [35.24315, 31.71244], [35.2438, 31.7201], [35.24981, 31.72543], [35.25182, 31.73945], [35.26319, 31.74846], [35.25225, 31.7678], [35.26058, 31.79064], [35.25573, 31.81362], [35.26404, 31.82567], [35.251, 31.83085], [35.25753, 31.8387], [35.24816, 31.8458], [35.2304, 31.84222], [35.2249, 31.85433], [35.22817, 31.8638], [35.22567, 31.86745], [35.22294, 31.87889], [35.22014, 31.88264], [35.2136, 31.88241], [35.21276, 31.88153], [35.21016, 31.88237], [35.20945, 31.8815], [35.20791, 31.8821], [35.20673, 31.88151], [35.20381, 31.86716], [35.21128, 31.863], [35.216, 31.83894], [35.21469, 31.81835], [35.19461, 31.82687], [35.18169, 31.82542], [35.18603, 31.80901], [35.14174, 31.81325], [35.07677, 31.85627], [35.05617, 31.85685], [35.01978, 31.82944], [34.9724, 31.83352], [34.99712, 31.85569], [35.03489, 31.85919], [35.03978, 31.89276], [35.03489, 31.92448], [35.00124, 31.93264], [34.98682, 31.96935], [35.00261, 32.027], [34.9863, 32.09551], [34.99437, 32.10962], [34.98507, 32.12606], [34.99039, 32.14626], [34.96009, 32.17503], [34.95703, 32.19522], [34.98885, 32.20758], [35.01841, 32.23981], [35.02939, 32.2671], [35.01119, 32.28684], [35.01772, 32.33863], [35.04243, 32.35008], [35.05142, 32.3667], [35.0421, 32.38242], [35.05311, 32.4024], [35.05423, 32.41754], [35.07059, 32.4585], [35.08564, 32.46948], [35.09236, 32.47614], [35.10024, 32.47856], [35.10882, 32.4757], [35.15937, 32.50466], [35.2244, 32.55289], [35.25049, 32.52453], [35.29306, 32.50947], [35.30685, 32.51024], [35.35212, 32.52047], [35.40224, 32.50136], [35.42034, 32.46009], [35.41598, 32.45593], [35.41048, 32.43706], [35.42078, 32.41562], [35.55807, 32.38674], [35.55494, 32.42687], [35.57485, 32.48669], [35.56614, 32.64393], [35.59813, 32.65159], [35.61669, 32.67999], [35.66527, 32.681], [35.68467, 32.70715], [35.75983, 32.74803], [35.78745, 32.77938], [35.83758, 32.82817], [35.84021, 32.8725], [35.87012, 32.91976], [35.89298, 32.9456], [35.87188, 32.98028], [35.84802, 33.1031], [35.81911, 33.11077], [35.81911, 33.1336], [35.84285, 33.16673], [35.83846, 33.19397], [35.81647, 33.2028], [35.81295, 33.24841], [35.77513, 33.27342], [35.813, 33.3172], [35.77477, 33.33609], [35.62019, 33.27278], [35.62283, 33.24226], [35.58502, 33.26653], [35.58326, 33.28381], [35.56523, 33.28969], [35.55555, 33.25844], [35.54544, 33.25513], [35.54808, 33.236], [35.5362, 33.23196], [35.54228, 33.19865], [35.52573, 33.11921], [35.50335, 33.114], [35.50272, 33.09056], [35.448, 33.09264], [35.43059, 33.06659], [35.35223, 33.05617], [35.31429, 33.10515], [35.1924, 33.08743], [35.10645, 33.09318], [34.78515, 33.20368], [33.62659, 31.82938], [34.052, 31.46619]]]] } },
22774 { type: "Feature", properties: { iso1A2: "IM", iso1A3: "IMN", iso1N3: "833", wikidata: "Q9676", nameEn: "Isle of Man", country: "GB", groups: ["Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01624", "44 07624", "44 07524", "44 07924"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-3.98763, 54.07351], [-4.1819, 54.57861], [-5.6384, 53.81157], [-3.98763, 54.07351]]]] } },
22775 { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
22776 { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
22777 { type: "Feature", properties: { iso1A2: "IQ", iso1A3: "IRQ", iso1N3: "368", wikidata: "Q796", nameEn: "Iraq", groups: ["145", "142", "UN"], callingCodes: ["964"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.78887, 37.38615], [42.56725, 37.14878], [42.35724, 37.10998], [42.36697, 37.0627], [41.81736, 36.58782], [41.40058, 36.52502], [41.28864, 36.35368], [41.2564, 36.06012], [41.37027, 35.84095], [41.38184, 35.62502], [41.26569, 35.42708], [41.21654, 35.1508], [41.2345, 34.80049], [41.12388, 34.65742], [40.97676, 34.39788], [40.64314, 34.31604], [38.79171, 33.37328], [39.08202, 32.50304], [38.98762, 32.47694], [39.04251, 32.30203], [39.26157, 32.35555], [39.29903, 32.23259], [40.01521, 32.05667], [42.97601, 30.72204], [42.97796, 30.48295], [44.72255, 29.19736], [46.42415, 29.05947], [46.5527, 29.10283], [46.89695, 29.50584], [47.15166, 30.01044], [47.37192, 30.10421], [47.7095, 30.10453], [48.01114, 29.98906], [48.06782, 30.02906], [48.17332, 30.02448], [48.40479, 29.85763], [48.59531, 29.66815], [48.83867, 29.78572], [48.61441, 29.93675], [48.51011, 29.96238], [48.44785, 30.00148], [48.4494, 30.04456], [48.43384, 30.08233], [48.38869, 30.11062], [48.38714, 30.13485], [48.41671, 30.17254], [48.41117, 30.19846], [48.26393, 30.3408], [48.24385, 30.33846], [48.21279, 30.31644], [48.19425, 30.32796], [48.18321, 30.39703], [48.14585, 30.44133], [48.02443, 30.4789], [48.03221, 30.9967], [47.68219, 31.00004], [47.6804, 31.39086], [47.86337, 31.78422], [47.64771, 32.07666], [47.52474, 32.15972], [47.57144, 32.20583], [47.37529, 32.47808], [47.17218, 32.45393], [46.46788, 32.91992], [46.32298, 32.9731], [46.17198, 32.95612], [46.09103, 32.98354], [46.15175, 33.07229], [46.03966, 33.09577], [46.05367, 33.13097], [46.11905, 33.11924], [46.20623, 33.20395], [45.99919, 33.5082], [45.86687, 33.49263], [45.96183, 33.55751], [45.89801, 33.63661], [45.77814, 33.60938], [45.50261, 33.94968], [45.42789, 33.9458], [45.41077, 33.97421], [45.47264, 34.03099], [45.56176, 34.15088], [45.58667, 34.30147], [45.53552, 34.35148], [45.49171, 34.3439], [45.46697, 34.38221], [45.43879, 34.45949], [45.51883, 34.47692], [45.53219, 34.60441], [45.59074, 34.55558], [45.60224, 34.55057], [45.73923, 34.54416], [45.70031, 34.69277], [45.65672, 34.7222], [45.68284, 34.76624], [45.70031, 34.82322], [45.73641, 34.83975], [45.79682, 34.85133], [45.78904, 34.91135], [45.86532, 34.89858], [45.89477, 34.95805], [45.87864, 35.03441], [45.92173, 35.0465], [45.92203, 35.09538], [45.93108, 35.08148], [45.94756, 35.09188], [46.06508, 35.03699], [46.07747, 35.0838], [46.11763, 35.07551], [46.19116, 35.11097], [46.15642, 35.1268], [46.16229, 35.16984], [46.19738, 35.18536], [46.18457, 35.22561], [46.11367, 35.23729], [46.15474, 35.2883], [46.13152, 35.32548], [46.05358, 35.38568], [45.98453, 35.49848], [46.01518, 35.52012], [45.97584, 35.58132], [46.03028, 35.57416], [46.01307, 35.59756], [46.0165, 35.61501], [45.99452, 35.63574], [46.0117, 35.65059], [46.01631, 35.69139], [46.23736, 35.71414], [46.34166, 35.78363], [46.32921, 35.82655], [46.17198, 35.8013], [46.08325, 35.8581], [45.94711, 35.82218], [45.89784, 35.83708], [45.81442, 35.82107], [45.76145, 35.79898], [45.6645, 35.92872], [45.60018, 35.96069], [45.55245, 35.99943], [45.46594, 36.00042], [45.38275, 35.97156], [45.33916, 35.99424], [45.37652, 36.06222], [45.37312, 36.09917], [45.32235, 36.17383], [45.30038, 36.27769], [45.26261, 36.3001], [45.27394, 36.35846], [45.23953, 36.43257], [45.11811, 36.40751], [45.00759, 36.5402], [45.06985, 36.62645], [45.06985, 36.6814], [45.01537, 36.75128], [44.84725, 36.77622], [44.83479, 36.81362], [44.90173, 36.86096], [44.91199, 36.91468], [44.89862, 37.01897], [44.81611, 37.04383], [44.75229, 37.11958], [44.78319, 37.1431], [44.76698, 37.16162], [44.63179, 37.19229], [44.42631, 37.05825], [44.38117, 37.05825], [44.35315, 37.04955], [44.35937, 37.02843], [44.30645, 36.97373], [44.25975, 36.98119], [44.18503, 37.09551], [44.22239, 37.15756], [44.27998, 37.16501], [44.2613, 37.25055], [44.13521, 37.32486], [44.02002, 37.33229], [43.90949, 37.22453], [43.84878, 37.22205], [43.82699, 37.19477], [43.8052, 37.22825], [43.7009, 37.23692], [43.63085, 37.21957], [43.56702, 37.25675], [43.50787, 37.24436], [43.33508, 37.33105], [43.30083, 37.30629], [43.11403, 37.37436], [42.93705, 37.32015], [42.78887, 37.38615]]]] } },
22778 { type: "Feature", properties: { iso1A2: "IR", iso1A3: "IRN", iso1N3: "364", wikidata: "Q794", nameEn: "Iran", groups: ["034", "142", "UN"], callingCodes: ["98"] }, geometry: { type: "MultiPolygon", coordinates: [[[[44.96746, 39.42998], [44.88916, 39.59653], [44.81043, 39.62677], [44.71806, 39.71124], [44.65422, 39.72163], [44.6137, 39.78393], [44.47298, 39.68788], [44.48111, 39.61579], [44.41849, 39.56659], [44.42832, 39.4131], [44.37921, 39.4131], [44.29818, 39.378], [44.22452, 39.4169], [44.03667, 39.39223], [44.1043, 39.19842], [44.20946, 39.13975], [44.18863, 38.93881], [44.30322, 38.81581], [44.26155, 38.71427], [44.28065, 38.6465], [44.32058, 38.62752], [44.3207, 38.49799], [44.3119, 38.37887], [44.38309, 38.36117], [44.44386, 38.38295], [44.50115, 38.33939], [44.42476, 38.25763], [44.22509, 37.88859], [44.3883, 37.85433], [44.45948, 37.77065], [44.55498, 37.783], [44.62096, 37.71985], [44.56887, 37.6429], [44.61401, 37.60165], [44.58449, 37.45018], [44.81021, 37.2915], [44.75986, 37.21549], [44.7868, 37.16644], [44.78319, 37.1431], [44.75229, 37.11958], [44.81611, 37.04383], [44.89862, 37.01897], [44.91199, 36.91468], [44.90173, 36.86096], [44.83479, 36.81362], [44.84725, 36.77622], [45.01537, 36.75128], [45.06985, 36.6814], [45.06985, 36.62645], [45.00759, 36.5402], [45.11811, 36.40751], [45.23953, 36.43257], [45.27394, 36.35846], [45.26261, 36.3001], [45.30038, 36.27769], [45.32235, 36.17383], [45.37312, 36.09917], [45.37652, 36.06222], [45.33916, 35.99424], [45.38275, 35.97156], [45.46594, 36.00042], [45.55245, 35.99943], [45.60018, 35.96069], [45.6645, 35.92872], [45.76145, 35.79898], [45.81442, 35.82107], [45.89784, 35.83708], [45.94711, 35.82218], [46.08325, 35.8581], [46.17198, 35.8013], [46.32921, 35.82655], [46.34166, 35.78363], [46.23736, 35.71414], [46.01631, 35.69139], [46.0117, 35.65059], [45.99452, 35.63574], [46.0165, 35.61501], [46.01307, 35.59756], [46.03028, 35.57416], [45.97584, 35.58132], [46.01518, 35.52012], [45.98453, 35.49848], [46.05358, 35.38568], [46.13152, 35.32548], [46.15474, 35.2883], [46.11367, 35.23729], [46.18457, 35.22561], [46.19738, 35.18536], [46.16229, 35.16984], [46.15642, 35.1268], [46.19116, 35.11097], [46.11763, 35.07551], [46.07747, 35.0838], [46.06508, 35.03699], [45.94756, 35.09188], [45.93108, 35.08148], [45.92203, 35.09538], [45.92173, 35.0465], [45.87864, 35.03441], [45.89477, 34.95805], [45.86532, 34.89858], [45.78904, 34.91135], [45.79682, 34.85133], [45.73641, 34.83975], [45.70031, 34.82322], [45.68284, 34.76624], [45.65672, 34.7222], [45.70031, 34.69277], [45.73923, 34.54416], [45.60224, 34.55057], [45.59074, 34.55558], [45.53219, 34.60441], [45.51883, 34.47692], [45.43879, 34.45949], [45.46697, 34.38221], [45.49171, 34.3439], [45.53552, 34.35148], [45.58667, 34.30147], [45.56176, 34.15088], [45.47264, 34.03099], [45.41077, 33.97421], [45.42789, 33.9458], [45.50261, 33.94968], [45.77814, 33.60938], [45.89801, 33.63661], [45.96183, 33.55751], [45.86687, 33.49263], [45.99919, 33.5082], [46.20623, 33.20395], [46.11905, 33.11924], [46.05367, 33.13097], [46.03966, 33.09577], [46.15175, 33.07229], [46.09103, 32.98354], [46.17198, 32.95612], [46.32298, 32.9731], [46.46788, 32.91992], [47.17218, 32.45393], [47.37529, 32.47808], [47.57144, 32.20583], [47.52474, 32.15972], [47.64771, 32.07666], [47.86337, 31.78422], [47.6804, 31.39086], [47.68219, 31.00004], [48.03221, 30.9967], [48.02443, 30.4789], [48.14585, 30.44133], [48.18321, 30.39703], [48.19425, 30.32796], [48.21279, 30.31644], [48.24385, 30.33846], [48.26393, 30.3408], [48.41117, 30.19846], [48.41671, 30.17254], [48.38714, 30.13485], [48.38869, 30.11062], [48.43384, 30.08233], [48.4494, 30.04456], [48.44785, 30.00148], [48.51011, 29.96238], [48.61441, 29.93675], [48.83867, 29.78572], [49.98877, 27.87827], [50.37726, 27.89227], [54.39838, 25.68383], [55.14145, 25.62624], [55.81777, 26.18798], [56.2644, 26.58649], [56.68954, 26.76645], [56.79239, 26.41236], [56.82555, 25.7713], [56.86325, 25.03856], [61.46682, 24.57869], [61.6433, 25.27541], [61.683, 25.66638], [61.83968, 25.7538], [61.83831, 26.07249], [61.89391, 26.26251], [62.05117, 26.31647], [62.21304, 26.26601], [62.31484, 26.528], [62.77352, 26.64099], [63.1889, 26.65072], [63.18688, 26.83844], [63.25005, 26.84212], [63.25005, 27.08692], [63.32283, 27.14437], [63.19649, 27.25674], [62.80604, 27.22412], [62.79684, 27.34381], [62.84905, 27.47627], [62.7638, 28.02992], [62.79412, 28.28108], [62.59499, 28.24842], [62.40259, 28.42703], [61.93581, 28.55284], [61.65978, 28.77937], [61.53765, 29.00507], [61.31508, 29.38903], [60.87231, 29.86514], [61.80829, 30.84224], [61.78268, 30.92724], [61.8335, 30.97669], [61.83257, 31.0452], [61.80957, 31.12576], [61.80569, 31.16167], [61.70929, 31.37391], [60.84541, 31.49561], [60.86191, 32.22565], [60.56485, 33.12944], [60.88908, 33.50219], [60.91133, 33.55596], [60.69573, 33.56054], [60.57762, 33.59772], [60.5485, 33.73422], [60.5838, 33.80793], [60.50209, 34.13992], [60.66502, 34.31539], [60.91321, 34.30411], [60.72316, 34.52857], [60.99922, 34.63064], [61.00197, 34.70631], [61.06926, 34.82139], [61.12831, 35.09938], [61.0991, 35.27845], [61.18187, 35.30249], [61.27371, 35.61482], [61.22719, 35.67038], [61.26152, 35.80749], [61.22444, 35.92879], [61.12007, 35.95992], [61.22719, 36.12759], [61.1393, 36.38782], [61.18187, 36.55348], [61.14516, 36.64644], [60.34767, 36.63214], [60.00768, 37.04102], [59.74678, 37.12499], [59.55178, 37.13594], [59.39385, 37.34257], [59.39797, 37.47892], [59.33507, 37.53146], [59.22905, 37.51161], [58.9338, 37.67374], [58.6921, 37.64548], [58.5479, 37.70526], [58.47786, 37.6433], [58.39959, 37.63134], [58.22999, 37.6856], [58.21399, 37.77281], [57.79534, 37.89299], [57.35042, 37.98546], [57.37236, 38.09321], [57.21169, 38.28965], [57.03453, 38.18717], [56.73928, 38.27887], [56.62255, 38.24005], [56.43303, 38.26054], [56.32454, 38.18502], [56.33278, 38.08132], [55.97847, 38.08024], [55.76561, 38.12238], [55.44152, 38.08564], [55.13412, 37.94705], [54.851, 37.75739], [54.77684, 37.62264], [54.81804, 37.61285], [54.77822, 37.51597], [54.67247, 37.43532], [54.58664, 37.45809], [54.36211, 37.34912], [54.24565, 37.32047], [53.89734, 37.3464], [48.88288, 38.43975], [48.84969, 38.45015], [48.81072, 38.44853], [48.78979, 38.45026], [48.70001, 38.40564], [48.62217, 38.40198], [48.58793, 38.45076], [48.45084, 38.61013], [48.3146, 38.59958], [48.24773, 38.71883], [48.02581, 38.82705], [48.01409, 38.90333], [48.07734, 38.91616], [48.08627, 38.94434], [48.28437, 38.97186], [48.33884, 39.03022], [48.31239, 39.09278], [48.15361, 39.19419], [48.12404, 39.25208], [48.15984, 39.30028], [48.37385, 39.37584], [48.34264, 39.42935], [47.98977, 39.70999], [47.84774, 39.66285], [47.50099, 39.49615], [47.38978, 39.45999], [47.31301, 39.37492], [47.05927, 39.24846], [47.05771, 39.20143], [46.95341, 39.13505], [46.92539, 39.16644], [46.83822, 39.13143], [46.75752, 39.03231], [46.53497, 38.86548], [46.34059, 38.92076], [46.20601, 38.85262], [46.14785, 38.84206], [46.06766, 38.87861], [46.00228, 38.87376], [45.94624, 38.89072], [45.90266, 38.87739], [45.83883, 38.90768], [45.65172, 38.95199], [45.6155, 38.94304], [45.6131, 38.964], [45.44966, 38.99243], [45.44811, 39.04927], [45.40452, 39.07224], [45.40148, 39.09007], [45.30489, 39.18333], [45.16168, 39.21952], [45.08751, 39.35052], [45.05932, 39.36435], [44.96746, 39.42998]]]] } },
22779 { type: "Feature", properties: { iso1A2: "IS", iso1A3: "ISL", iso1N3: "352", wikidata: "Q189", nameEn: "Iceland", groups: ["154", "150", "UN"], callingCodes: ["354"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-33.15676, 62.62995], [-8.25539, 63.0423], [-15.70914, 69.67442], [-33.15676, 62.62995]]]] } },
22780 { type: "Feature", properties: { iso1A2: "IT", iso1A3: "ITA", iso1N3: "380", wikidata: "Q38", nameEn: "Italy", groups: ["EU", "039", "150", "UN"], callingCodes: ["39"] }, geometry: { type: "MultiPolygon", coordinates: [[[[8.95861, 45.96485], [8.97604, 45.96151], [8.97741, 45.98317], [8.96668, 45.98436], [8.95861, 45.96485]]], [[[7.63035, 43.57419], [9.56115, 43.20816], [10.09675, 41.44089], [7.60802, 41.05927], [7.89009, 38.19924], [11.2718, 37.6713], [12.13667, 34.20326], [14.02721, 36.53141], [17.67657, 35.68918], [18.83516, 40.36999], [16.15283, 42.18525], [13.12821, 44.48877], [13.05142, 45.33128], [13.45644, 45.59464], [13.6076, 45.64761], [13.7198, 45.59352], [13.74587, 45.59811], [13.78445, 45.5825], [13.84106, 45.58185], [13.86771, 45.59898], [13.8695, 45.60835], [13.9191, 45.6322], [13.87933, 45.65207], [13.83422, 45.68703], [13.83332, 45.70855], [13.8235, 45.7176], [13.66986, 45.79955], [13.59784, 45.8072], [13.58858, 45.83503], [13.57563, 45.8425], [13.58644, 45.88173], [13.59565, 45.89446], [13.60857, 45.89907], [13.61931, 45.91782], [13.63815, 45.93607], [13.6329, 45.94894], [13.64307, 45.98326], [13.63458, 45.98947], [13.62074, 45.98388], [13.58903, 45.99009], [13.56759, 45.96991], [13.52963, 45.96588], [13.50104, 45.98078], [13.47474, 46.00546], [13.49702, 46.01832], [13.50998, 46.04498], [13.49568, 46.04839], [13.50104, 46.05986], [13.57072, 46.09022], [13.64053, 46.13587], [13.66472, 46.17392], [13.64451, 46.18966], [13.56682, 46.18703], [13.56114, 46.2054], [13.47587, 46.22725], [13.42218, 46.20758], [13.37671, 46.29668], [13.44808, 46.33507], [13.43418, 46.35992], [13.47019, 46.3621], [13.5763, 46.40915], [13.5763, 46.42613], [13.59777, 46.44137], [13.68684, 46.43881], [13.7148, 46.5222], [13.64088, 46.53438], [13.27627, 46.56059], [12.94445, 46.60401], [12.59992, 46.6595], [12.38708, 46.71529], [12.27591, 46.88651], [12.2006, 46.88854], [12.11675, 47.01241], [12.21781, 47.03996], [12.19254, 47.09331], [11.74789, 46.98484], [11.50739, 47.00644], [11.33355, 46.99862], [11.10618, 46.92966], [11.00764, 46.76896], [10.72974, 46.78972], [10.75753, 46.82258], [10.66405, 46.87614], [10.54783, 46.84505], [10.47197, 46.85698], [10.38659, 46.67847], [10.40475, 46.63671], [10.44686, 46.64162], [10.49375, 46.62049], [10.46136, 46.53164], [10.25309, 46.57432], [10.23674, 46.63484], [10.10307, 46.61003], [10.03715, 46.44479], [10.165, 46.41051], [10.10506, 46.3372], [10.17862, 46.25626], [10.14439, 46.22992], [10.07055, 46.21668], [9.95249, 46.38045], [9.73086, 46.35071], [9.71273, 46.29266], [9.57015, 46.2958], [9.46117, 46.37481], [9.45936, 46.50873], [9.40487, 46.46621], [9.36128, 46.5081], [9.28136, 46.49685], [9.25502, 46.43743], [9.29226, 46.32717], [9.24503, 46.23616], [9.01618, 46.04928], [8.99257, 45.9698], [9.09065, 45.89906], [9.06642, 45.8761], [9.04546, 45.84968], [9.04059, 45.8464], [9.03505, 45.83976], [9.03793, 45.83548], [9.03279, 45.82865], [9.0298, 45.82127], [9.00324, 45.82055], [8.99663, 45.83466], [8.9621, 45.83707], [8.94737, 45.84285], [8.91129, 45.8388], [8.93504, 45.86245], [8.94372, 45.86587], [8.93649, 45.86775], [8.88904, 45.95465], [8.86688, 45.96135], [8.85121, 45.97239], [8.8319, 45.9879], [8.79362, 45.99207], [8.78585, 45.98973], [8.79414, 46.00913], [8.85617, 46.0748], [8.80778, 46.10085], [8.75697, 46.10395], [8.62242, 46.12112], [8.45032, 46.26869], [8.46317, 46.43712], [8.42464, 46.46367], [8.30648, 46.41587], [8.31162, 46.38044], [8.08814, 46.26692], [8.16866, 46.17817], [8.11383, 46.11577], [8.02906, 46.10331], [7.98881, 45.99867], [7.9049, 45.99945], [7.85949, 45.91485], [7.56343, 45.97421], [7.10685, 45.85653], [7.04151, 45.92435], [6.95315, 45.85163], [6.80785, 45.83265], [6.80785, 45.71864], [6.98948, 45.63869], [7.00037, 45.509], [7.18019, 45.40071], [7.10572, 45.32924], [7.13115, 45.25386], [7.07074, 45.21228], [6.96706, 45.20841], [6.85144, 45.13226], [6.7697, 45.16044], [6.62803, 45.11175], [6.66981, 45.02324], [6.74791, 45.01939], [6.74519, 44.93661], [6.75518, 44.89915], [6.90774, 44.84322], [6.93499, 44.8664], [7.02217, 44.82519], [7.00401, 44.78782], [7.07484, 44.68073], [7.00582, 44.69364], [6.95133, 44.66264], [6.96042, 44.62129], [6.85507, 44.53072], [6.86233, 44.49834], [6.94504, 44.43112], [6.88784, 44.42043], [6.89171, 44.36637], [6.98221, 44.28289], [7.00764, 44.23736], [7.16929, 44.20352], [7.27827, 44.1462], [7.34547, 44.14359], [7.36364, 44.11882], [7.62155, 44.14881], [7.63245, 44.17877], [7.68694, 44.17487], [7.66878, 44.12795], [7.72508, 44.07578], [7.6597, 44.03009], [7.66848, 43.99943], [7.65266, 43.9763], [7.60771, 43.95772], [7.56858, 43.94506], [7.56075, 43.89932], [7.51162, 43.88301], [7.49355, 43.86551], [7.50423, 43.84345], [7.53006, 43.78405], [7.63035, 43.57419]], [[12.45181, 41.90056], [12.44834, 41.90095], [12.44582, 41.90194], [12.44815, 41.90326], [12.44984, 41.90545], [12.45091, 41.90625], [12.45543, 41.90738], [12.45561, 41.90629], [12.45762, 41.9058], [12.45755, 41.9033], [12.45826, 41.90281], [12.45834, 41.90174], [12.4577, 41.90115], [12.45691, 41.90125], [12.45626, 41.90172], [12.45435, 41.90143], [12.45446, 41.90028], [12.45181, 41.90056]], [[12.45648, 43.89369], [12.44184, 43.90498], [12.41641, 43.89991], [12.40935, 43.9024], [12.41233, 43.90956], [12.40733, 43.92379], [12.41551, 43.92984], [12.41165, 43.93769], [12.40506, 43.94325], [12.40415, 43.95485], [12.41414, 43.95273], [12.42005, 43.9578], [12.43662, 43.95698], [12.44684, 43.96597], [12.46205, 43.97463], [12.47853, 43.98052], [12.49406, 43.98492], [12.50678, 43.99113], [12.51463, 43.99122], [12.5154, 43.98508], [12.51064, 43.98165], [12.51109, 43.97201], [12.50622, 43.97131], [12.50875, 43.96198], [12.50655, 43.95796], [12.51427, 43.94897], [12.51553, 43.94096], [12.50496, 43.93017], [12.50269, 43.92363], [12.49724, 43.92248], [12.49247, 43.91774], [12.49429, 43.90973], [12.48771, 43.89706], [12.45648, 43.89369]]]] } },
22781 { type: "Feature", properties: { iso1A2: "JE", iso1A3: "JEY", iso1N3: "832", wikidata: "Q785", nameEn: "Bailiwick of Jersey", country: "GB", groups: ["830", "Q185086", "154", "150", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["44 01534"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.00491, 48.86706], [-1.83944, 49.23037], [-2.09454, 49.46288], [-2.65349, 49.15373], [-2.00491, 48.86706]]]] } },
22782 { type: "Feature", properties: { iso1A2: "JM", iso1A3: "JAM", iso1N3: "388", wikidata: "Q766", nameEn: "Jamaica", aliases: ["JA"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 876", "1 658"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.09729, 17.36817], [-78.9741, 19.59515], [-78.34606, 16.57862], [-74.09729, 17.36817]]]] } },
22783 { type: "Feature", properties: { iso1A2: "JO", iso1A3: "JOR", iso1N3: "400", wikidata: "Q810", nameEn: "Jordan", groups: ["145", "142", "UN"], callingCodes: ["962"] }, geometry: { type: "MultiPolygon", coordinates: [[[[39.04251, 32.30203], [38.98762, 32.47694], [39.08202, 32.50304], [38.79171, 33.37328], [36.83946, 32.31293], [36.40959, 32.37908], [36.23948, 32.50108], [36.20875, 32.49529], [36.20379, 32.52751], [36.08074, 32.51463], [36.02239, 32.65911], [35.96633, 32.66237], [35.93307, 32.71966], [35.88405, 32.71321], [35.75983, 32.74803], [35.68467, 32.70715], [35.66527, 32.681], [35.61669, 32.67999], [35.59813, 32.65159], [35.56614, 32.64393], [35.57485, 32.48669], [35.55494, 32.42687], [35.55807, 32.38674], [35.57111, 32.21877], [35.52012, 32.04076], [35.54375, 31.96587], [35.52758, 31.9131], [35.55941, 31.76535], [35.47672, 31.49578], [35.40316, 31.25535], [35.43658, 31.12444], [35.41371, 30.95565], [35.33984, 30.8802], [35.33456, 30.81224], [35.29311, 30.71365], [35.21379, 30.60401], [35.19595, 30.50297], [35.16218, 30.43535], [35.19183, 30.34636], [35.14108, 30.07374], [35.02147, 29.66343], [34.98207, 29.58147], [34.97718, 29.54294], [34.92298, 29.45305], [34.8812, 29.36878], [36.07081, 29.18469], [36.50005, 29.49696], [36.75083, 29.86903], [37.4971, 29.99949], [37.66395, 30.33245], [37.99354, 30.49998], [36.99791, 31.50081], [38.99233, 31.99721], [39.29903, 32.23259], [39.26157, 32.35555], [39.04251, 32.30203]]]] } },
22784 { type: "Feature", properties: { iso1A2: "JP", iso1A3: "JPN", iso1N3: "392", wikidata: "Q17", nameEn: "Japan", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["81"] }, geometry: { type: "MultiPolygon", coordinates: [[[[145.82361, 43.38904], [145.23667, 43.76813], [145.82343, 44.571], [140.9182, 45.92937], [133.61399, 37.41], [129.2669, 34.87122], [122.26612, 25.98197], [123.92912, 17.8782], [155.16731, 23.60141], [145.82361, 43.38904]]]] } },
22785 { type: "Feature", properties: { iso1A2: "KE", iso1A3: "KEN", iso1N3: "404", wikidata: "Q114", nameEn: "Kenya", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["254"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.9419, 4.61933], [35.51424, 4.61643], [35.42366, 4.76969], [35.47843, 4.91872], [35.30992, 4.90402], [35.34151, 5.02364], [34.47601, 4.72162], [33.9873, 4.23316], [34.06046, 4.15235], [34.15429, 3.80464], [34.45815, 3.67385], [34.44922, 3.51627], [34.39112, 3.48802], [34.41794, 3.44342], [34.40006, 3.37949], [34.45815, 3.18319], [34.56242, 3.11478], [34.60114, 2.93034], [34.65774, 2.8753], [34.73967, 2.85447], [34.78137, 2.76223], [34.77244, 2.70272], [34.95267, 2.47209], [34.90947, 2.42447], [34.98692, 1.97348], [34.9899, 1.6668], [34.92734, 1.56109], [34.87819, 1.5596], [34.7918, 1.36752], [34.82606, 1.30944], [34.82606, 1.26626], [34.80223, 1.22754], [34.67562, 1.21265], [34.58029, 1.14712], [34.57427, 1.09868], [34.52369, 1.10692], [34.43349, 0.85254], [34.40041, 0.80266], [34.31516, 0.75693], [34.27345, 0.63182], [34.20196, 0.62289], [34.13493, 0.58118], [34.11408, 0.48884], [34.08727, 0.44713], [34.10067, 0.36372], [33.90936, 0.10581], [33.98449, -0.13079], [33.9264, -0.54188], [33.93107, -0.99298], [34.02286, -1.00779], [34.03084, -1.05101], [34.0824, -1.02264], [37.67199, -3.06222], [37.71745, -3.304], [37.5903, -3.42735], [37.63099, -3.50723], [37.75036, -3.54243], [37.81321, -3.69179], [39.21631, -4.67835], [39.44306, -4.93877], [39.62121, -4.68136], [41.75542, -1.85308], [41.56362, -1.66375], [41.56, -1.59812], [41.00099, -0.83068], [40.98767, 2.82959], [41.31368, 3.14314], [41.89488, 3.97375], [41.1754, 3.94079], [40.77498, 4.27683], [39.86043, 3.86974], [39.76808, 3.67058], [39.58339, 3.47434], [39.55132, 3.39634], [39.51551, 3.40895], [39.49444, 3.45521], [39.19954, 3.47834], [39.07736, 3.5267], [38.91938, 3.51198], [38.52336, 3.62551], [38.45812, 3.60445], [38.14168, 3.62487], [37.07724, 4.33503], [36.84474, 4.44518], [36.03924, 4.44406], [35.95449, 4.53244], [35.9419, 4.61933]]]] } },
22786 { type: "Feature", properties: { iso1A2: "KG", iso1A3: "KGZ", iso1N3: "417", wikidata: "Q813", nameEn: "Kyrgyzstan", groups: ["143", "142", "UN"], callingCodes: ["996"] }, geometry: { type: "MultiPolygon", coordinates: [[[[74.88756, 42.98612], [74.75, 42.99029], [74.70331, 43.02519], [74.64615, 43.05881], [74.57491, 43.13702], [74.22489, 43.24657], [73.55634, 43.03071], [73.50992, 42.82356], [73.44393, 42.43098], [71.88792, 42.83578], [71.62405, 42.76613], [71.53272, 42.8014], [71.2724, 42.77853], [71.22785, 42.69248], [71.17807, 42.67381], [71.15232, 42.60486], [70.97717, 42.50147], [70.85973, 42.30188], [70.94483, 42.26238], [71.13263, 42.28356], [71.28719, 42.18033], [70.69777, 41.92554], [70.17682, 41.5455], [70.48909, 41.40335], [70.67586, 41.47953], [70.78572, 41.36419], [70.77885, 41.24813], [70.86263, 41.23833], [70.9615, 41.16393], [71.02193, 41.19494], [71.11806, 41.15359], [71.25813, 41.18796], [71.27187, 41.11015], [71.34877, 41.16807], [71.40198, 41.09436], [71.46148, 41.13958], [71.43814, 41.19644], [71.46688, 41.31883], [71.57227, 41.29175], [71.6787, 41.42111], [71.65914, 41.49599], [71.73054, 41.54713], [71.71132, 41.43012], [71.76625, 41.4466], [71.83914, 41.3546], [71.91457, 41.2982], [71.85964, 41.19081], [72.07249, 41.11739], [72.10745, 41.15483], [72.16433, 41.16483], [72.17594, 41.15522], [72.14864, 41.13363], [72.1792, 41.10621], [72.21061, 41.05607], [72.17594, 41.02377], [72.18339, 40.99571], [72.324, 41.03381], [72.34026, 41.04539], [72.34757, 41.06104], [72.36138, 41.04384], [72.38511, 41.02785], [72.45206, 41.03018], [72.48742, 40.97136], [72.55109, 40.96046], [72.59136, 40.86947], [72.68157, 40.84942], [72.84291, 40.85512], [72.94454, 40.8094], [73.01869, 40.84681], [73.13267, 40.83512], [73.13412, 40.79122], [73.0612, 40.76678], [72.99133, 40.76457], [72.93296, 40.73089], [72.8722, 40.71111], [72.85372, 40.7116], [72.84754, 40.67229], [72.80137, 40.67856], [72.74866, 40.60873], [72.74894, 40.59592], [72.75982, 40.57273], [72.74862, 40.57131], [72.74768, 40.58051], [72.73995, 40.58409], [72.69579, 40.59778], [72.66713, 40.59076], [72.66713, 40.5219], [72.47795, 40.5532], [72.40517, 40.61917], [72.34406, 40.60144], [72.41714, 40.55736], [72.38384, 40.51535], [72.41513, 40.50856], [72.44191, 40.48222], [72.40346, 40.4007], [72.24368, 40.46091], [72.18648, 40.49893], [71.96401, 40.31907], [72.05464, 40.27586], [71.85002, 40.25647], [71.82646, 40.21872], [71.73054, 40.14818], [71.71719, 40.17886], [71.69621, 40.18492], [71.70569, 40.20391], [71.68386, 40.26984], [71.61931, 40.26775], [71.61725, 40.20615], [71.51549, 40.22986], [71.51215, 40.26943], [71.4246, 40.28619], [71.36663, 40.31593], [71.13042, 40.34106], [71.05901, 40.28765], [70.95789, 40.28761], [70.9818, 40.22392], [70.80495, 40.16813], [70.7928, 40.12797], [70.65827, 40.0981], [70.65946, 39.9878], [70.58912, 39.95211], [70.55033, 39.96619], [70.47557, 39.93216], [70.57384, 39.99394], [70.58297, 40.00891], [70.01283, 40.23288], [69.67001, 40.10639], [69.64704, 40.12165], [69.57615, 40.10524], [69.55555, 40.12296], [69.53794, 40.11833], [69.53855, 40.0887], [69.5057, 40.03277], [69.53615, 39.93991], [69.43557, 39.92877], [69.43134, 39.98431], [69.35649, 40.01994], [69.26938, 39.8127], [69.3594, 39.52516], [69.68677, 39.59281], [69.87491, 39.53882], [70.11111, 39.58223], [70.2869, 39.53141], [70.44757, 39.60128], [70.64087, 39.58792], [70.7854, 39.38933], [71.06418, 39.41586], [71.08752, 39.50704], [71.49814, 39.61397], [71.55856, 39.57588], [71.5517, 39.45722], [71.62688, 39.44056], [71.76816, 39.45456], [71.80164, 39.40631], [71.7522, 39.32031], [71.79202, 39.27355], [71.90601, 39.27674], [72.04059, 39.36704], [72.09689, 39.26823], [72.17242, 39.2661], [72.23834, 39.17248], [72.33173, 39.33093], [72.62027, 39.39696], [72.85934, 39.35116], [73.18454, 39.35536], [73.31912, 39.38615], [73.45096, 39.46677], [73.59831, 39.46425], [73.87018, 39.47879], [73.94683, 39.60733], [73.92354, 39.69565], [73.9051, 39.75073], [73.83006, 39.76136], [73.97049, 40.04378], [74.25533, 40.13191], [74.35063, 40.09742], [74.69875, 40.34668], [74.85996, 40.32857], [74.78168, 40.44886], [74.82013, 40.52197], [75.08243, 40.43945], [75.22834, 40.45382], [75.5854, 40.66874], [75.69663, 40.28642], [75.91361, 40.2948], [75.96168, 40.38064], [76.33659, 40.3482], [76.5261, 40.46114], [76.75681, 40.95354], [76.99302, 41.0696], [77.28004, 41.0033], [77.3693, 41.0375], [77.52723, 41.00227], [77.76206, 41.01574], [77.81287, 41.14307], [78.12873, 41.23091], [78.15757, 41.38565], [78.3732, 41.39603], [79.92977, 42.04113], [80.17842, 42.03211], [80.17807, 42.21166], [79.97364, 42.42816], [79.52921, 42.44778], [79.19763, 42.804], [78.91502, 42.76839], [78.48469, 42.89649], [75.82823, 42.94848], [75.72174, 42.79672], [75.29966, 42.86183], [75.22619, 42.85528], [74.88756, 42.98612]], [[70.74189, 39.86319], [70.63105, 39.77923], [70.59667, 39.83542], [70.54998, 39.85137], [70.52631, 39.86989], [70.53651, 39.89155], [70.74189, 39.86319]], [[71.86463, 39.98598], [71.84316, 39.95582], [71.7504, 39.93701], [71.71511, 39.96348], [71.78838, 40.01404], [71.86463, 39.98598]], [[71.21139, 40.03369], [71.1427, 39.95026], [71.23067, 39.93581], [71.16101, 39.88423], [71.10531, 39.91354], [71.04979, 39.89808], [71.10501, 39.95568], [71.09063, 39.99], [71.11668, 39.99291], [71.11037, 40.01984], [71.01035, 40.05481], [71.00236, 40.18154], [71.06305, 40.1771], [71.12218, 40.03052], [71.21139, 40.03369]]]] } },
22787 { type: "Feature", properties: { iso1A2: "KH", iso1A3: "KHM", iso1N3: "116", wikidata: "Q424", nameEn: "Cambodia", groups: ["035", "142", "UN"], callingCodes: ["855"] }, geometry: { type: "MultiPolygon", coordinates: [[[[105.87328, 11.55953], [105.81645, 11.56876], [105.80867, 11.60536], [105.8507, 11.66635], [105.88962, 11.67854], [105.95188, 11.63738], [106.00792, 11.7197], [106.02038, 11.77457], [106.06708, 11.77761], [106.13158, 11.73283], [106.18539, 11.75171], [106.26478, 11.72122], [106.30525, 11.67549], [106.37219, 11.69836], [106.44691, 11.66787], [106.45158, 11.68616], [106.41577, 11.76999], [106.44535, 11.8279], [106.44068, 11.86294], [106.4687, 11.86751], [106.4111, 11.97413], [106.70687, 11.96956], [106.79405, 12.0807], [106.92325, 12.06548], [106.99953, 12.08983], [107.15831, 12.27547], [107.34511, 12.33327], [107.42917, 12.24657], [107.4463, 12.29373], [107.55059, 12.36824], [107.5755, 12.52177], [107.55993, 12.7982], [107.49611, 12.88926], [107.49144, 13.01215], [107.62843, 13.3668], [107.61909, 13.52577], [107.53503, 13.73908], [107.45252, 13.78897], [107.46498, 13.91593], [107.44318, 13.99751], [107.38247, 13.99147], [107.35757, 14.02319], [107.37158, 14.07906], [107.33577, 14.11832], [107.40427, 14.24509], [107.39493, 14.32655], [107.44941, 14.41552], [107.48521, 14.40346], [107.52569, 14.54665], [107.52102, 14.59034], [107.55371, 14.628], [107.54361, 14.69092], [107.47238, 14.61523], [107.44435, 14.52785], [107.37897, 14.54443], [107.3276, 14.58812], [107.29803, 14.58963], [107.26534, 14.54292], [107.256, 14.48716], [107.21241, 14.48716], [107.17038, 14.41782], [107.09722, 14.3937], [107.03962, 14.45099], [107.04585, 14.41782], [106.98825, 14.36806], [106.9649, 14.3198], [106.90574, 14.33639], [106.8497, 14.29416], [106.80767, 14.31226], [106.73762, 14.42687], [106.63333, 14.44194], [106.59908, 14.50977], [106.57106, 14.50525], [106.54148, 14.59565], [106.50723, 14.58963], [106.45898, 14.55045], [106.47766, 14.50977], [106.43874, 14.52032], [106.40916, 14.45249], [106.32355, 14.44043], [106.25194, 14.48415], [106.21302, 14.36203], [106.00131, 14.36957], [105.99509, 14.32734], [106.02311, 14.30623], [106.04801, 14.20363], [106.10872, 14.18401], [106.11962, 14.11307], [106.18656, 14.06324], [106.16632, 14.01794], [106.10094, 13.98471], [106.10405, 13.9137], [105.90791, 13.92881], [105.78182, 14.02247], [105.78338, 14.08438], [105.5561, 14.15684], [105.44869, 14.10703], [105.36775, 14.09948], [105.2759, 14.17496], [105.20894, 14.34967], [105.17748, 14.34432], [105.14012, 14.23873], [105.08408, 14.20402], [105.02804, 14.23722], [104.97667, 14.38806], [104.69335, 14.42726], [104.55014, 14.36091], [104.27616, 14.39861], [103.93836, 14.3398], [103.70175, 14.38052], [103.71109, 14.4348], [103.53518, 14.42575], [103.39353, 14.35639], [103.16469, 14.33075], [102.93275, 14.19044], [102.91251, 14.01531], [102.77864, 13.93374], [102.72727, 13.77806], [102.56848, 13.69366], [102.5481, 13.6589], [102.58635, 13.6286], [102.62483, 13.60883], [102.57573, 13.60461], [102.5358, 13.56933], [102.44601, 13.5637], [102.36859, 13.57488], [102.33828, 13.55613], [102.361, 13.50551], [102.35563, 13.47307], [102.35692, 13.38274], [102.34611, 13.35618], [102.36001, 13.31142], [102.36146, 13.26006], [102.43422, 13.09061], [102.46011, 13.08057], [102.52275, 12.99813], [102.48694, 12.97537], [102.49335, 12.92711], [102.53053, 12.77506], [102.4994, 12.71736], [102.51963, 12.66117], [102.57567, 12.65358], [102.7796, 12.43781], [102.78116, 12.40284], [102.73134, 12.37091], [102.70176, 12.1686], [102.77026, 12.06815], [102.78427, 11.98746], [102.83957, 11.8519], [102.90973, 11.75613], [102.91449, 11.65512], [102.52395, 11.25257], [102.47649, 9.66162], [103.99198, 10.48391], [104.43778, 10.42386], [104.47963, 10.43046], [104.49869, 10.4057], [104.59018, 10.53073], [104.87933, 10.52833], [104.95094, 10.64003], [105.09571, 10.72722], [105.02722, 10.89236], [105.08326, 10.95656], [105.11449, 10.96332], [105.34011, 10.86179], [105.42884, 10.96878], [105.50045, 10.94586], [105.77751, 11.03671], [105.86376, 10.89839], [105.84603, 10.85873], [105.93403, 10.83853], [105.94535, 10.9168], [106.06708, 10.8098], [106.18539, 10.79451], [106.14301, 10.98176], [106.20095, 10.97795], [106.1757, 11.07301], [106.1527, 11.10476], [106.10444, 11.07879], [105.86782, 11.28343], [105.88962, 11.43605], [105.87328, 11.55953]]]] } },
22788 { type: "Feature", properties: { iso1A2: "KI", iso1A3: "KIR", iso1N3: "296", wikidata: "Q710", nameEn: "Kiribati", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["686"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [169, -3.5], [178, -3.5], [178, 3.9], [169, 3.9]]], [[[-161.06795, 5.2462], [-158.12991, -1.86122], [-175.33482, -1.40631], [-175.31804, -7.54825], [-156.50903, -7.4975], [-156.48634, -15.52824], [-135.59706, -4.70473], [-161.06795, 5.2462]]]] } },
22789 { type: "Feature", properties: { iso1A2: "KM", iso1A3: "COM", iso1N3: "174", wikidata: "Q970", nameEn: "Comoros", groups: ["014", "202", "002", "UN"], callingCodes: ["269"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.63904, -10.02522], [43.28731, -13.97126], [45.4971, -11.75965], [42.63904, -10.02522]]]] } },
22790 { type: "Feature", properties: { iso1A2: "KN", iso1A3: "KNA", iso1N3: "659", wikidata: "Q763", nameEn: "St. Kitts and Nevis", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 869"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.29333, 17.43155], [-62.76692, 17.64353], [-63.09677, 17.21372], [-62.63813, 16.65446], [-62.29333, 17.43155]]]] } },
22791 { type: "Feature", properties: { iso1A2: "KP", iso1A3: "PRK", iso1N3: "408", wikidata: "Q423", nameEn: "North Korea", groups: ["030", "142", "UN"], callingCodes: ["850"] }, geometry: { type: "MultiPolygon", coordinates: [[[[130.26095, 42.9027], [130.09764, 42.91425], [130.12957, 42.98361], [129.96409, 42.97306], [129.95082, 43.01051], [129.8865, 43.00395], [129.85261, 42.96494], [129.83277, 42.86746], [129.80719, 42.79218], [129.7835, 42.76521], [129.77183, 42.69435], [129.75294, 42.59409], [129.72541, 42.43739], [129.60482, 42.44461], [129.54701, 42.37254], [129.42882, 42.44702], [129.28541, 42.41574], [129.22423, 42.3553], [129.22285, 42.26491], [129.15178, 42.17224], [128.96068, 42.06657], [128.94007, 42.03537], [128.04487, 42.01769], [128.15119, 41.74568], [128.30716, 41.60322], [128.20061, 41.40895], [128.18546, 41.41279], [128.12967, 41.37931], [128.03311, 41.39232], [128.02633, 41.42103], [127.92943, 41.44291], [127.29712, 41.49473], [127.17841, 41.59714], [126.90729, 41.79955], [126.60631, 41.65565], [126.53189, 41.35206], [126.242, 41.15454], [126.00335, 40.92835], [125.76869, 40.87908], [125.71172, 40.85223], [124.86913, 40.45387], [124.40719, 40.13655], [124.38556, 40.11047], [124.3322, 40.05573], [124.37089, 40.03004], [124.35029, 39.95639], [124.23201, 39.9248], [124.17532, 39.8232], [123.90497, 38.79949], [123.85601, 37.49093], [124.67666, 38.05679], [124.84224, 37.977], [124.87921, 37.80827], [125.06408, 37.66334], [125.37112, 37.62643], [125.81159, 37.72949], [126.13074, 37.70512], [126.18776, 37.74728], [126.19097, 37.81462], [126.24402, 37.83113], [126.43239, 37.84095], [126.46818, 37.80873], [126.56709, 37.76857], [126.59918, 37.76364], [126.66067, 37.7897], [126.68793, 37.83728], [126.68793, 37.9175], [126.67023, 37.95852], [126.84961, 38.0344], [126.88106, 38.10246], [126.95887, 38.1347], [126.95338, 38.17735], [127.04479, 38.25518], [127.15749, 38.30722], [127.38727, 38.33227], [127.49672, 38.30647], [127.55013, 38.32257], [128.02917, 38.31861], [128.27652, 38.41657], [128.31105, 38.58462], [128.37487, 38.62345], [128.65655, 38.61914], [131.95041, 41.5445], [130.65022, 42.32281], [130.66367, 42.38024], [130.64181, 42.41422], [130.60805, 42.4317], [130.56835, 42.43281], [130.55143, 42.52158], [130.50123, 42.61636], [130.44361, 42.54849], [130.41826, 42.6011], [130.2385, 42.71127], [130.23068, 42.80125], [130.26095, 42.9027]]]] } },
22792 { type: "Feature", properties: { iso1A2: "KR", iso1A3: "KOR", iso1N3: "410", wikidata: "Q884", nameEn: "South Korea", groups: ["030", "142", "UN"], callingCodes: ["82"] }, geometry: { type: "MultiPolygon", coordinates: [[[[133.11729, 37.53115], [128.65655, 38.61914], [128.37487, 38.62345], [128.31105, 38.58462], [128.27652, 38.41657], [128.02917, 38.31861], [127.55013, 38.32257], [127.49672, 38.30647], [127.38727, 38.33227], [127.15749, 38.30722], [127.04479, 38.25518], [126.95338, 38.17735], [126.95887, 38.1347], [126.88106, 38.10246], [126.84961, 38.0344], [126.67023, 37.95852], [126.68793, 37.9175], [126.68793, 37.83728], [126.66067, 37.7897], [126.59918, 37.76364], [126.56709, 37.76857], [126.46818, 37.80873], [126.43239, 37.84095], [126.24402, 37.83113], [126.19097, 37.81462], [126.18776, 37.74728], [126.13074, 37.70512], [125.81159, 37.72949], [125.37112, 37.62643], [125.06408, 37.66334], [124.87921, 37.80827], [124.84224, 37.977], [124.67666, 38.05679], [123.85601, 37.49093], [122.80525, 33.30571], [125.99728, 32.63328], [129.2669, 34.87122], [133.11729, 37.53115]]]] } },
22793 { type: "Feature", properties: { iso1A2: "KW", iso1A3: "KWT", iso1N3: "414", wikidata: "Q817", nameEn: "Kuwait", groups: ["145", "142", "UN"], callingCodes: ["965"] }, geometry: { type: "MultiPolygon", coordinates: [[[[49.00421, 28.81495], [48.59531, 29.66815], [48.40479, 29.85763], [48.17332, 30.02448], [48.06782, 30.02906], [48.01114, 29.98906], [47.7095, 30.10453], [47.37192, 30.10421], [47.15166, 30.01044], [46.89695, 29.50584], [46.5527, 29.10283], [47.46202, 29.0014], [47.58376, 28.83382], [47.59863, 28.66798], [47.70561, 28.5221], [48.42991, 28.53628], [49.00421, 28.81495]]]] } },
22794 { type: "Feature", properties: { iso1A2: "KY", iso1A3: "CYM", iso1N3: "136", wikidata: "Q5785", nameEn: "Cayman Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 345"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-82.11509, 19.60401], [-80.36068, 18.11751], [-79.32727, 20.06742], [-82.11509, 19.60401]]]] } },
22795 { type: "Feature", properties: { iso1A2: "KZ", iso1A3: "KAZ", iso1N3: "398", wikidata: "Q232", nameEn: "Kazakhstan", groups: ["143", "142", "UN"], callingCodes: ["7"] }, geometry: { type: "MultiPolygon", coordinates: [[[[68.90865, 55.38148], [68.19206, 55.18823], [68.26661, 55.09226], [68.21308, 54.98645], [65.20174, 54.55216], [65.24663, 54.35721], [65.11033, 54.33028], [64.97216, 54.4212], [63.97686, 54.29763], [64.02715, 54.22679], [63.91224, 54.20013], [63.80604, 54.27079], [62.58651, 54.05871], [62.56876, 53.94047], [62.45931, 53.90737], [62.38535, 54.03961], [62.00966, 54.04134], [62.03913, 53.94768], [61.65318, 54.02445], [61.56941, 53.95703], [61.47603, 54.08048], [61.3706, 54.08464], [61.26863, 53.92797], [60.99796, 53.93699], [61.14283, 53.90063], [61.22574, 53.80268], [60.90626, 53.62937], [61.55706, 53.57144], [61.57185, 53.50112], [61.37957, 53.45887], [61.29082, 53.50992], [61.14291, 53.41481], [61.19024, 53.30536], [62.14574, 53.09626], [62.12799, 52.99133], [62.0422, 52.96105], [61.23462, 53.03227], [61.05842, 52.92217], [60.71989, 52.75923], [60.71693, 52.66245], [60.84118, 52.63912], [60.84709, 52.52228], [60.98021, 52.50068], [61.05417, 52.35096], [60.78201, 52.22067], [60.72581, 52.15538], [60.48915, 52.15175], [60.19925, 51.99173], [59.99809, 51.98263], [60.09867, 51.87135], [60.50986, 51.7964], [60.36787, 51.66815], [60.5424, 51.61675], [60.92401, 51.61124], [60.95655, 51.48615], [61.50677, 51.40687], [61.55114, 51.32746], [61.6813, 51.25716], [61.56889, 51.23679], [61.4431, 50.80679], [60.81833, 50.6629], [60.31914, 50.67705], [60.17262, 50.83312], [60.01288, 50.8163], [59.81172, 50.54451], [59.51886, 50.49937], [59.48928, 50.64216], [58.87974, 50.70852], [58.3208, 51.15151], [57.75578, 51.13852], [57.74986, 50.93017], [57.44221, 50.88354], [57.17302, 51.11253], [56.17906, 50.93204], [56.11398, 50.7471], [55.67774, 50.54508], [54.72067, 51.03261], [54.56685, 51.01958], [54.71476, 50.61214], [54.55797, 50.52006], [54.41894, 50.61214], [54.46331, 50.85554], [54.12248, 51.11542], [53.69299, 51.23466], [53.46165, 51.49445], [52.54329, 51.48444], [52.36119, 51.74161], [51.8246, 51.67916], [51.77431, 51.49536], [51.301, 51.48799], [51.26254, 51.68466], [50.59695, 51.61859], [50.26859, 51.28677], [49.97277, 51.2405], [49.76866, 51.11067], [49.39001, 51.09396], [49.41959, 50.85927], [49.12673, 50.78639], [48.86936, 50.61589], [48.57946, 50.63278], [48.90782, 50.02281], [48.68352, 49.89546], [48.42564, 49.82283], [48.24519, 49.86099], [48.10044, 50.09242], [47.58551, 50.47867], [47.30448, 50.30894], [47.34589, 50.09308], [47.18319, 49.93721], [46.9078, 49.86707], [46.78398, 49.34026], [47.04658, 49.19834], [47.00857, 49.04921], [46.78392, 48.95352], [46.49011, 48.43019], [47.11516, 48.27188], [47.12107, 47.83687], [47.38731, 47.68176], [47.41689, 47.83687], [47.64973, 47.76559], [48.15348, 47.74545], [48.45173, 47.40818], [48.52326, 47.4102], [49.01136, 46.72716], [48.51142, 46.69268], [48.54988, 46.56267], [49.16518, 46.38542], [49.32259, 46.26944], [49.88945, 46.04554], [49.2134, 44.84989], [52.26048, 41.69249], [52.47884, 41.78034], [52.97575, 42.1308], [54.20635, 42.38477], [54.95182, 41.92424], [55.45471, 41.25609], [56.00314, 41.32584], [55.97584, 44.99322], [55.97584, 44.99328], [55.97584, 44.99338], [55.97584, 44.99343], [55.97584, 44.99348], [55.97584, 44.99353], [55.97584, 44.99359], [55.97584, 44.99369], [55.97584, 44.99374], [55.97584, 44.99384], [55.97584, 44.9939], [55.97584, 44.994], [55.97584, 44.99405], [55.97584, 44.99415], [55.97584, 44.99421], [55.97584, 44.99426], [55.97584, 44.99431], [55.97584, 44.99436], [55.97584, 44.99441], [55.97594, 44.99446], [55.97605, 44.99452], [55.97605, 44.99457], [55.97605, 44.99462], [55.97605, 44.99467], [55.97605, 44.99477], [55.97615, 44.99477], [55.97615, 44.99483], [55.97615, 44.99493], [55.97615, 44.99498], [55.97615, 44.99503], [55.97615, 44.99508], [55.97625, 44.99514], [55.97636, 44.99519], [55.97636, 44.99524], [55.97646, 44.99529], [55.97646, 44.99534], [55.97656, 44.99539], [55.97667, 44.99545], [55.97677, 44.9955], [55.97677, 44.99555], [55.97677, 44.9956], [55.97687, 44.9956], [55.97698, 44.99565], [55.97698, 44.9957], [55.97708, 44.99576], [55.97718, 44.99581], [55.97729, 44.99586], [55.97739, 44.99586], [55.97739, 44.99591], [55.97749, 44.99591], [55.9776, 44.99591], [55.9777, 44.99596], [55.9777, 44.99601], [55.9778, 44.99607], [55.97791, 44.99607], [55.97801, 44.99607], [55.97801, 44.99612], [55.97811, 44.99617], [55.97822, 44.99617], [55.97832, 44.99622], [55.97842, 44.99622], [58.59711, 45.58671], [61.01475, 44.41383], [62.01711, 43.51008], [63.34656, 43.64003], [64.53885, 43.56941], [64.96464, 43.74748], [65.18666, 43.48835], [65.53277, 43.31856], [65.85194, 42.85481], [66.09482, 42.93426], [66.00546, 41.94455], [66.53302, 41.87388], [66.69129, 41.1311], [67.9644, 41.14611], [67.98511, 41.02794], [68.08273, 41.08148], [68.1271, 41.0324], [67.96736, 40.83798], [68.49983, 40.56437], [68.63, 40.59358], [68.58444, 40.91447], [68.49983, 40.99669], [68.62221, 41.03019], [68.65662, 40.93861], [68.73945, 40.96989], [68.7217, 41.05025], [69.01308, 41.22804], [69.05006, 41.36183], [69.15137, 41.43078], [69.17701, 41.43769], [69.18528, 41.45175], [69.20439, 41.45391], [69.22671, 41.46298], [69.23332, 41.45847], [69.25059, 41.46693], [69.29778, 41.43673], [69.35554, 41.47211], [69.37468, 41.46555], [69.45081, 41.46246], [69.39485, 41.51518], [69.45751, 41.56863], [69.49545, 41.545], [70.94483, 42.26238], [70.85973, 42.30188], [70.97717, 42.50147], [71.15232, 42.60486], [71.17807, 42.67381], [71.22785, 42.69248], [71.2724, 42.77853], [71.53272, 42.8014], [71.62405, 42.76613], [71.88792, 42.83578], [73.44393, 42.43098], [73.50992, 42.82356], [73.55634, 43.03071], [74.22489, 43.24657], [74.57491, 43.13702], [74.64615, 43.05881], [74.70331, 43.02519], [74.75, 42.99029], [74.88756, 42.98612], [75.22619, 42.85528], [75.29966, 42.86183], [75.72174, 42.79672], [75.82823, 42.94848], [78.48469, 42.89649], [78.91502, 42.76839], [79.19763, 42.804], [79.52921, 42.44778], [79.97364, 42.42816], [80.17807, 42.21166], [80.26841, 42.23797], [80.16892, 42.61137], [80.26886, 42.8366], [80.38169, 42.83142], [80.58999, 42.9011], [80.3735, 43.01557], [80.62913, 43.141], [80.78817, 43.14235], [80.77771, 43.30065], [80.69718, 43.32589], [80.75156, 43.44948], [80.40031, 44.10986], [80.40229, 44.23319], [80.38384, 44.63073], [79.8987, 44.89957], [80.11169, 45.03352], [81.73278, 45.3504], [82.51374, 45.1755], [82.58474, 45.40027], [82.21792, 45.56619], [83.04622, 47.19053], [83.92184, 46.98912], [84.73077, 47.01394], [84.93995, 46.87399], [85.22443, 47.04816], [85.54294, 47.06171], [85.69696, 47.2898], [85.61067, 47.49753], [85.5169, 48.05493], [85.73581, 48.3939], [86.38069, 48.46064], [86.75343, 48.70331], [86.73568, 48.99918], [86.87238, 49.12432], [87.28386, 49.11626], [87.31465, 49.23603], [87.03071, 49.25142], [86.82606, 49.51796], [86.61307, 49.60239], [86.79056, 49.74787], [86.63674, 49.80136], [86.18709, 49.50259], [85.24047, 49.60239], [84.99198, 50.06793], [84.29385, 50.27257], [83.8442, 50.87375], [83.14607, 51.00796], [82.55443, 50.75412], [81.94999, 50.79307], [81.46581, 50.77658], [81.41248, 50.97524], [81.06091, 50.94833], [81.16999, 51.15662], [80.80318, 51.28262], [80.44819, 51.20855], [80.4127, 50.95581], [80.08138, 50.77658], [79.11255, 52.01171], [77.90383, 53.29807], [76.54243, 53.99329], [76.44076, 54.16017], [76.82266, 54.1798], [76.91052, 54.4677], [75.3668, 54.07439], [75.43398, 53.98652], [75.07405, 53.80831], [73.39218, 53.44623], [73.25412, 53.61532], [73.68921, 53.86522], [73.74778, 54.07194], [73.37963, 53.96132], [72.71026, 54.1161], [72.43415, 53.92685], [72.17477, 54.36303], [71.96141, 54.17736], [71.10379, 54.13326], [71.08706, 54.33376], [71.24185, 54.64965], [71.08288, 54.71253], [70.96009, 55.10558], [70.76493, 55.3027], [70.19179, 55.1476], [69.74917, 55.35545], [69.34224, 55.36344], [68.90865, 55.38148]]]] } },
22796 { type: "Feature", properties: { iso1A2: "LA", iso1A3: "LAO", iso1N3: "418", wikidata: "Q819", nameEn: "Laos", groups: ["035", "142", "UN"], callingCodes: ["856"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.1245, 22.43372], [102.03633, 22.46164], [101.98487, 22.42766], [101.91344, 22.44417], [101.90714, 22.38688], [101.86828, 22.38397], [101.7685, 22.50337], [101.68973, 22.46843], [101.61306, 22.27515], [101.56789, 22.28876], [101.53638, 22.24794], [101.60675, 22.13513], [101.57525, 22.13026], [101.62566, 21.96574], [101.7791, 21.83019], [101.74555, 21.72852], [101.83257, 21.61562], [101.80001, 21.57461], [101.7475, 21.5873], [101.7727, 21.51794], [101.74224, 21.48276], [101.74014, 21.30967], [101.84412, 21.25291], [101.83887, 21.20983], [101.76745, 21.21571], [101.79266, 21.19025], [101.7622, 21.14813], [101.70548, 21.14911], [101.66977, 21.20004], [101.60886, 21.17947], [101.59491, 21.18621], [101.6068, 21.23329], [101.54563, 21.25668], [101.29326, 21.17254], [101.2229, 21.23271], [101.26912, 21.36482], [101.19349, 21.41959], [101.2124, 21.56422], [101.15156, 21.56129], [101.16198, 21.52808], [101.00234, 21.39612], [100.80173, 21.2934], [100.72716, 21.31786], [100.63578, 21.05639], [100.55281, 21.02796], [100.50974, 20.88574], [100.64628, 20.88279], [100.60112, 20.8347], [100.51079, 20.82194], [100.36375, 20.82783], [100.1957, 20.68247], [100.08404, 20.36626], [100.09999, 20.31614], [100.09337, 20.26293], [100.11785, 20.24787], [100.1712, 20.24324], [100.16668, 20.2986], [100.22076, 20.31598], [100.25769, 20.3992], [100.33383, 20.4028], [100.37439, 20.35156], [100.41473, 20.25625], [100.44992, 20.23644], [100.4537, 20.19971], [100.47567, 20.19133], [100.51052, 20.14928], [100.55218, 20.17741], [100.58808, 20.15791], [100.5094, 19.87904], [100.398, 19.75047], [100.49604, 19.53504], [100.58219, 19.49164], [100.64606, 19.55884], [100.77231, 19.48324], [100.90302, 19.61901], [101.08928, 19.59748], [101.26545, 19.59242], [101.26991, 19.48324], [101.21347, 19.46223], [101.20604, 19.35296], [101.24911, 19.33334], [101.261, 19.12717], [101.35606, 19.04716], [101.25803, 18.89545], [101.22832, 18.73377], [101.27585, 18.68875], [101.06047, 18.43247], [101.18227, 18.34367], [101.15108, 18.25624], [101.19118, 18.2125], [101.1793, 18.0544], [101.02185, 17.87637], [100.96541, 17.57926], [101.15108, 17.47586], [101.44667, 17.7392], [101.72294, 17.92867], [101.78087, 18.07559], [101.88485, 18.02474], [102.11359, 18.21532], [102.45523, 17.97106], [102.59234, 17.96127], [102.60971, 17.95411], [102.61432, 17.92273], [102.5896, 17.84889], [102.59485, 17.83537], [102.68194, 17.80151], [102.69946, 17.81686], [102.67543, 17.84529], [102.68538, 17.86653], [102.75954, 17.89561], [102.79044, 17.93612], [102.81988, 17.94233], [102.86323, 17.97531], [102.95812, 18.0054], [102.9912, 17.9949], [103.01998, 17.97095], [103.0566, 18.00144], [103.07823, 18.03833], [103.07343, 18.12351], [103.1493, 18.17799], [103.14994, 18.23172], [103.17093, 18.2618], [103.29757, 18.30475], [103.23818, 18.34875], [103.24779, 18.37807], [103.30977, 18.4341], [103.41044, 18.4486], [103.47773, 18.42841], [103.60957, 18.40528], [103.699, 18.34125], [103.82449, 18.33979], [103.85642, 18.28666], [103.93916, 18.33914], [103.97725, 18.33631], [104.06533, 18.21656], [104.10927, 18.10826], [104.21776, 17.99335], [104.2757, 17.86139], [104.35432, 17.82871], [104.45404, 17.66788], [104.69867, 17.53038], [104.80061, 17.39367], [104.80716, 17.19025], [104.73712, 17.01404], [104.7373, 16.91125], [104.76442, 16.84752], [104.7397, 16.81005], [104.76099, 16.69302], [104.73349, 16.565], [104.88057, 16.37311], [105.00262, 16.25627], [105.06204, 16.09792], [105.42001, 16.00657], [105.38508, 15.987], [105.34115, 15.92737], [105.37959, 15.84074], [105.42285, 15.76971], [105.46573, 15.74742], [105.61756, 15.68792], [105.60446, 15.53301], [105.58191, 15.41031], [105.47635, 15.3796], [105.4692, 15.33709], [105.50662, 15.32054], [105.58043, 15.32724], [105.46661, 15.13132], [105.61162, 15.00037], [105.5121, 14.80802], [105.53864, 14.55731], [105.43783, 14.43865], [105.20894, 14.34967], [105.2759, 14.17496], [105.36775, 14.09948], [105.44869, 14.10703], [105.5561, 14.15684], [105.78338, 14.08438], [105.78182, 14.02247], [105.90791, 13.92881], [106.10405, 13.9137], [106.10094, 13.98471], [106.16632, 14.01794], [106.18656, 14.06324], [106.11962, 14.11307], [106.10872, 14.18401], [106.04801, 14.20363], [106.02311, 14.30623], [105.99509, 14.32734], [106.00131, 14.36957], [106.21302, 14.36203], [106.25194, 14.48415], [106.32355, 14.44043], [106.40916, 14.45249], [106.43874, 14.52032], [106.47766, 14.50977], [106.45898, 14.55045], [106.50723, 14.58963], [106.54148, 14.59565], [106.57106, 14.50525], [106.59908, 14.50977], [106.63333, 14.44194], [106.73762, 14.42687], [106.80767, 14.31226], [106.8497, 14.29416], [106.90574, 14.33639], [106.9649, 14.3198], [106.98825, 14.36806], [107.04585, 14.41782], [107.03962, 14.45099], [107.09722, 14.3937], [107.17038, 14.41782], [107.21241, 14.48716], [107.256, 14.48716], [107.26534, 14.54292], [107.29803, 14.58963], [107.3276, 14.58812], [107.37897, 14.54443], [107.44435, 14.52785], [107.47238, 14.61523], [107.54361, 14.69092], [107.51579, 14.79282], [107.59285, 14.87795], [107.48277, 14.93751], [107.46516, 15.00982], [107.61486, 15.0566], [107.61926, 15.13949], [107.58844, 15.20111], [107.62587, 15.2266], [107.60605, 15.37524], [107.62367, 15.42193], [107.53341, 15.40496], [107.50699, 15.48771], [107.3815, 15.49832], [107.34408, 15.62345], [107.27583, 15.62769], [107.27143, 15.71459], [107.21859, 15.74638], [107.21419, 15.83747], [107.34188, 15.89464], [107.39471, 15.88829], [107.46296, 16.01106], [107.44975, 16.08511], [107.33968, 16.05549], [107.25822, 16.13587], [107.14595, 16.17816], [107.15035, 16.26271], [107.09091, 16.3092], [107.02597, 16.31132], [106.97385, 16.30204], [106.96638, 16.34938], [106.88067, 16.43594], [106.88727, 16.52671], [106.84104, 16.55415], [106.74418, 16.41904], [106.65832, 16.47816], [106.66052, 16.56892], [106.61477, 16.60713], [106.58267, 16.6012], [106.59013, 16.62259], [106.55485, 16.68704], [106.55265, 16.86831], [106.52183, 16.87884], [106.51963, 16.92097], [106.54824, 16.92729], [106.55045, 17.0031], [106.50862, 16.9673], [106.43597, 17.01362], [106.31929, 17.20509], [106.29287, 17.3018], [106.24444, 17.24714], [106.18991, 17.28227], [106.09019, 17.36399], [105.85744, 17.63221], [105.76612, 17.67147], [105.60381, 17.89356], [105.64784, 17.96687], [105.46292, 18.22008], [105.38366, 18.15315], [105.15942, 18.38691], [105.10408, 18.43533], [105.1327, 18.58355], [105.19654, 18.64196], [105.12829, 18.70453], [104.64617, 18.85668], [104.5361, 18.97747], [103.87125, 19.31854], [104.06058, 19.43484], [104.10832, 19.51575], [104.05617, 19.61743], [104.06498, 19.66926], [104.23229, 19.70242], [104.41281, 19.70035], [104.53169, 19.61743], [104.64837, 19.62365], [104.68359, 19.72729], [104.8355, 19.80395], [104.8465, 19.91783], [104.9874, 20.09573], [104.91695, 20.15567], [104.86852, 20.14121], [104.61315, 20.24452], [104.62195, 20.36633], [104.72102, 20.40554], [104.66158, 20.47774], [104.47886, 20.37459], [104.40621, 20.3849], [104.38199, 20.47155], [104.63957, 20.6653], [104.27412, 20.91433], [104.11121, 20.96779], [103.98024, 20.91531], [103.82282, 20.8732], [103.73478, 20.6669], [103.68633, 20.66324], [103.45737, 20.82382], [103.38032, 20.79501], [103.21497, 20.89832], [103.12055, 20.89994], [103.03469, 21.05821], [102.97745, 21.05821], [102.89825, 21.24707], [102.80794, 21.25736], [102.88939, 21.3107], [102.94223, 21.46034], [102.86297, 21.4255], [102.98846, 21.58936], [102.97965, 21.74076], [102.86077, 21.71213], [102.85637, 21.84501], [102.81894, 21.83888], [102.82115, 21.73667], [102.74189, 21.66713], [102.67145, 21.65894], [102.62301, 21.91447], [102.49092, 21.99002], [102.51734, 22.02676], [102.18712, 22.30403], [102.14099, 22.40092], [102.1245, 22.43372]]]] } },
22797 { type: "Feature", properties: { iso1A2: "LB", iso1A3: "LBN", iso1N3: "422", wikidata: "Q822", nameEn: "Lebanon", aliases: ["RL"], groups: ["145", "142", "UN"], callingCodes: ["961"] }, geometry: { type: "MultiPolygon", coordinates: [[[[35.94816, 33.47886], [35.94465, 33.52774], [36.05723, 33.57904], [35.9341, 33.6596], [36.06778, 33.82927], [36.14517, 33.85118], [36.3967, 33.83365], [36.38263, 33.86579], [36.28589, 33.91981], [36.41078, 34.05253], [36.50576, 34.05982], [36.5128, 34.09916], [36.62537, 34.20251], [36.59195, 34.2316], [36.58667, 34.27667], [36.60778, 34.31009], [36.56556, 34.31881], [36.53039, 34.3798], [36.55853, 34.41609], [36.46179, 34.46541], [36.4442, 34.50165], [36.34745, 34.5002], [36.3369, 34.52629], [36.39846, 34.55672], [36.41429, 34.61175], [36.45299, 34.59438], [36.46003, 34.6378], [36.42941, 34.62505], [36.35384, 34.65447], [36.35135, 34.68516], [36.32399, 34.69334], [36.29165, 34.62991], [35.98718, 34.64977], [35.97386, 34.63322], [35.48515, 34.70851], [34.78515, 33.20368], [35.10645, 33.09318], [35.1924, 33.08743], [35.31429, 33.10515], [35.35223, 33.05617], [35.43059, 33.06659], [35.448, 33.09264], [35.50272, 33.09056], [35.50335, 33.114], [35.52573, 33.11921], [35.54228, 33.19865], [35.5362, 33.23196], [35.54808, 33.236], [35.54544, 33.25513], [35.55555, 33.25844], [35.56523, 33.28969], [35.58326, 33.28381], [35.58502, 33.26653], [35.62283, 33.24226], [35.62019, 33.27278], [35.77477, 33.33609], [35.81324, 33.36354], [35.82577, 33.40479], [35.88668, 33.43183], [35.94816, 33.47886]]]] } },
22798 { type: "Feature", properties: { iso1A2: "LC", iso1A3: "LCA", iso1N3: "662", wikidata: "Q760", nameEn: "St. Lucia", aliases: ["WL"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 758"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.69315, 14.26451], [-59.94058, 12.34011], [-59.95997, 14.20285]]]] } },
22799 { type: "Feature", properties: { iso1A2: "LI", iso1A3: "LIE", iso1N3: "438", wikidata: "Q347", nameEn: "Liechtenstein", aliases: ["FL"], groups: ["155", "150", "UN"], callingCodes: ["423"] }, geometry: { type: "MultiPolygon", coordinates: [[[[9.60717, 47.06091], [9.61216, 47.07732], [9.63395, 47.08443], [9.62623, 47.14685], [9.56539, 47.17124], [9.58264, 47.20673], [9.56981, 47.21926], [9.55176, 47.22585], [9.56766, 47.24281], [9.53116, 47.27029], [9.52406, 47.24959], [9.50318, 47.22153], [9.4891, 47.19346], [9.48774, 47.17402], [9.51044, 47.13727], [9.52089, 47.10019], [9.51362, 47.08505], [9.47139, 47.06402], [9.47548, 47.05257], [9.54041, 47.06495], [9.55721, 47.04762], [9.60717, 47.06091]]]] } },
22800 { type: "Feature", properties: { iso1A2: "LK", iso1A3: "LKA", iso1N3: "144", wikidata: "Q854", nameEn: "Sri Lanka", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["94"] }, geometry: { type: "MultiPolygon", coordinates: [[[[76.59015, 5.591], [85.15017, 5.21497], [80.48418, 10.20786], [79.42124, 9.80115], [79.50447, 8.91876], [76.59015, 5.591]]]] } },
22801 { type: "Feature", properties: { iso1A2: "LR", iso1A3: "LBR", iso1N3: "430", wikidata: "Q1014", nameEn: "Liberia", groups: ["011", "202", "002", "UN"], callingCodes: ["231"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-8.47114, 7.55676], [-8.55874, 7.62525], [-8.55874, 7.70167], [-8.67814, 7.69428], [-8.72789, 7.51429], [-8.8448, 7.35149], [-8.85724, 7.26019], [-8.93435, 7.2824], [-9.09107, 7.1985], [-9.18311, 7.30461], [-9.20798, 7.38109], [-9.305, 7.42056], [-9.41943, 7.41809], [-9.48161, 7.37122], [-9.37465, 7.62032], [-9.35724, 7.74111], [-9.44928, 7.9284], [-9.41445, 8.02448], [-9.50898, 8.18455], [-9.47415, 8.35195], [-9.77763, 8.54633], [-10.05873, 8.42578], [-10.05375, 8.50697], [-10.14579, 8.52665], [-10.203, 8.47991], [-10.27575, 8.48711], [-10.30084, 8.30008], [-10.31635, 8.28554], [-10.29839, 8.21283], [-10.35227, 8.15223], [-10.45023, 8.15627], [-10.51554, 8.1393], [-10.57523, 8.04829], [-10.60492, 8.04072], [-10.60422, 7.7739], [-11.29417, 7.21576], [-11.4027, 6.97746], [-11.50429, 6.92704], [-12.15048, 6.15992], [-7.52774, 3.7105], [-7.53259, 4.35145], [-7.59349, 4.8909], [-7.53876, 4.94294], [-7.55369, 5.08667], [-7.48901, 5.14118], [-7.46165, 5.26256], [-7.36463, 5.32944], [-7.43428, 5.42355], [-7.37209, 5.61173], [-7.43926, 5.74787], [-7.43677, 5.84687], [-7.46165, 5.84934], [-7.48155, 5.80974], [-7.67309, 5.94337], [-7.70294, 5.90625], [-7.78254, 5.99037], [-7.79747, 6.07696], [-7.8497, 6.08932], [-7.83478, 6.20309], [-7.90692, 6.27728], [-8.00642, 6.31684], [-8.17557, 6.28222], [-8.3298, 6.36381], [-8.38453, 6.35887], [-8.45666, 6.49977], [-8.48652, 6.43797], [-8.59456, 6.50612], [-8.31736, 6.82837], [-8.29249, 7.1691], [-8.37458, 7.25794], [-8.41935, 7.51203], [-8.47114, 7.55676]]]] } },
22802 { type: "Feature", properties: { iso1A2: "LS", iso1A3: "LSO", iso1N3: "426", wikidata: "Q1013", nameEn: "Lesotho", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["266"] }, geometry: { type: "MultiPolygon", coordinates: [[[[29.33204, -29.45598], [29.44883, -29.3772], [29.40524, -29.21246], [28.68043, -28.58744], [28.65091, -28.57025], [28.40612, -28.6215], [28.30518, -28.69531], [28.2348, -28.69471], [28.1317, -28.7293], [28.02503, -28.85991], [27.98675, -28.8787], [27.9392, -28.84864], [27.88933, -28.88156], [27.8907, -28.91612], [27.75458, -28.89839], [27.55974, -29.18954], [27.5158, -29.2261], [27.54258, -29.25575], [27.48679, -29.29349], [27.45125, -29.29708], [27.47254, -29.31968], [27.4358, -29.33465], [27.33464, -29.48161], [27.01016, -29.65439], [27.09489, -29.72796], [27.22719, -30.00718], [27.29603, -30.05473], [27.32555, -30.14785], [27.40778, -30.14577], [27.37293, -30.19401], [27.36649, -30.27246], [27.38108, -30.33456], [27.45452, -30.32239], [27.56901, -30.42504], [27.56781, -30.44562], [27.62137, -30.50509], [27.6521, -30.51707], [27.67819, -30.53437], [27.69467, -30.55862], [27.74814, -30.60635], [28.12073, -30.68072], [28.2319, -30.28476], [28.399, -30.1592], [28.68627, -30.12885], [28.80222, -30.10579], [28.9338, -30.05072], [29.16548, -29.91706], [29.12553, -29.76266], [29.28545, -29.58456], [29.33204, -29.45598]]]] } },
22803 { type: "Feature", properties: { iso1A2: "LT", iso1A3: "LTU", iso1N3: "440", wikidata: "Q37", nameEn: "Lithuania", groups: ["EU", "154", "150", "UN"], callingCodes: ["370"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.89005, 56.46666], [24.83686, 56.41565], [24.70022, 56.40483], [24.57353, 56.31525], [24.58143, 56.29125], [24.42746, 56.26522], [24.32334, 56.30226], [24.13139, 56.24881], [24.02657, 56.3231], [23.75726, 56.37282], [23.49803, 56.34307], [23.40486, 56.37689], [23.31606, 56.3827], [23.17312, 56.36795], [23.09531, 56.30511], [22.96988, 56.41213], [22.83048, 56.367], [22.69354, 56.36284], [22.56441, 56.39305], [22.3361, 56.4016], [22.09728, 56.42851], [22.00548, 56.41508], [21.74558, 56.33181], [21.57888, 56.31406], [21.49736, 56.29106], [21.24644, 56.16917], [21.15016, 56.07818], [20.68447, 56.04073], [20.60454, 55.40986], [20.95181, 55.27994], [21.26425, 55.24456], [21.35465, 55.28427], [21.38446, 55.29348], [21.46766, 55.21115], [21.51095, 55.18507], [21.55605, 55.20311], [21.64954, 55.1791], [21.85521, 55.09493], [21.96505, 55.07353], [21.99543, 55.08691], [22.03984, 55.07888], [22.02582, 55.05078], [22.06087, 55.02935], [22.11697, 55.02131], [22.14267, 55.05345], [22.31562, 55.0655], [22.47688, 55.04408], [22.58907, 55.07085], [22.60075, 55.01863], [22.65451, 54.97037], [22.68723, 54.9811], [22.76422, 54.92521], [22.85083, 54.88711], [22.87317, 54.79492], [22.73631, 54.72952], [22.73397, 54.66604], [22.75467, 54.6483], [22.74225, 54.64339], [22.7522, 54.63525], [22.68021, 54.58486], [22.71293, 54.56454], [22.67788, 54.532], [22.70208, 54.45312], [22.7253, 54.41732], [22.79705, 54.36264], [22.83756, 54.40827], [23.00584, 54.38514], [22.99649, 54.35927], [23.05726, 54.34565], [23.04323, 54.31567], [23.104, 54.29794], [23.13905, 54.31567], [23.15526, 54.31076], [23.15938, 54.29894], [23.24656, 54.25701], [23.3494, 54.25155], [23.39525, 54.21672], [23.42418, 54.17911], [23.45223, 54.17775], [23.49196, 54.14764], [23.52702, 54.04622], [23.48261, 53.98855], [23.51284, 53.95052], [23.61677, 53.92691], [23.71726, 53.93379], [23.80543, 53.89558], [23.81309, 53.94205], [23.95098, 53.9613], [23.98837, 53.92554], [24.19638, 53.96405], [24.34128, 53.90076], [24.44411, 53.90076], [24.62275, 54.00217], [24.69652, 54.01901], [24.69185, 53.96543], [24.74279, 53.96663], [24.85311, 54.02862], [24.77131, 54.11091], [24.96894, 54.17589], [24.991, 54.14241], [25.0728, 54.13419], [25.19199, 54.219], [25.22705, 54.26271], [25.35559, 54.26544], [25.509, 54.30267], [25.56823, 54.25212], [25.51452, 54.17799], [25.54724, 54.14925], [25.64875, 54.1259], [25.71084, 54.16704], [25.78563, 54.15747], [25.78553, 54.23327], [25.68513, 54.31727], [25.55425, 54.31591], [25.5376, 54.33158], [25.63371, 54.42075], [25.62203, 54.4656], [25.64813, 54.48704], [25.68045, 54.5321], [25.75977, 54.57252], [25.74122, 54.80108], [25.89462, 54.93438], [25.99129, 54.95705], [26.05907, 54.94631], [26.13386, 54.98924], [26.20397, 54.99729], [26.26941, 55.08032], [26.23202, 55.10439], [26.30628, 55.12536], [26.35121, 55.1525], [26.46249, 55.12814], [26.51481, 55.16051], [26.54753, 55.14181], [26.69243, 55.16718], [26.68075, 55.19787], [26.72983, 55.21788], [26.73017, 55.24226], [26.835, 55.28182], [26.83266, 55.30444], [26.80929, 55.31642], [26.6714, 55.33902], [26.5709, 55.32572], [26.44937, 55.34832], [26.5522, 55.40277], [26.55094, 55.5093], [26.63167, 55.57887], [26.63231, 55.67968], [26.58248, 55.6754], [26.46661, 55.70375], [26.39561, 55.71156], [26.18509, 55.86813], [26.03815, 55.95884], [25.90047, 56.0013], [25.85893, 56.00188], [25.81773, 56.05444], [25.69246, 56.08892], [25.68588, 56.14725], [25.53621, 56.16663], [25.39751, 56.15707], [25.23099, 56.19147], [25.09325, 56.1878], [25.05762, 56.26742], [24.89005, 56.46666]]]] } },
22804 { type: "Feature", properties: { iso1A2: "LU", iso1A3: "LUX", iso1N3: "442", wikidata: "Q32", nameEn: "Luxembourg", groups: ["EU", "155", "150", "UN"], callingCodes: ["352"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.1379, 50.12964], [6.1137, 50.13668], [6.12028, 50.16374], [6.08577, 50.17246], [6.06406, 50.15344], [6.03093, 50.16362], [6.02488, 50.18283], [5.96453, 50.17259], [5.95929, 50.13295], [5.89488, 50.11476], [5.8857, 50.07824], [5.85474, 50.06342], [5.86904, 50.04614], [5.8551, 50.02683], [5.81866, 50.01286], [5.82331, 49.99662], [5.83968, 49.9892], [5.83467, 49.97823], [5.81163, 49.97142], [5.80833, 49.96451], [5.77291, 49.96056], [5.77314, 49.93646], [5.73621, 49.89796], [5.78415, 49.87922], [5.75269, 49.8711], [5.75861, 49.85631], [5.74567, 49.85368], [5.75884, 49.84811], [5.74953, 49.84709], [5.74975, 49.83933], [5.74076, 49.83823], [5.7404, 49.83452], [5.74844, 49.82435], [5.74364, 49.82058], [5.74953, 49.81428], [5.75409, 49.79239], [5.78871, 49.7962], [5.82245, 49.75048], [5.83149, 49.74729], [5.82562, 49.72395], [5.84193, 49.72161], [5.86503, 49.72739], [5.88677, 49.70951], [5.86527, 49.69291], [5.86175, 49.67862], [5.9069, 49.66377], [5.90164, 49.6511], [5.90599, 49.63853], [5.88552, 49.63507], [5.88393, 49.62802], [5.87609, 49.62047], [5.8762, 49.60898], [5.84826, 49.5969], [5.84971, 49.58674], [5.86986, 49.58756], [5.87256, 49.57539], [5.8424, 49.56082], [5.84692, 49.55663], [5.84143, 49.5533], [5.81838, 49.54777], [5.80871, 49.5425], [5.81664, 49.53775], [5.83648, 49.5425], [5.84466, 49.53027], [5.83467, 49.52717], [5.83389, 49.52152], [5.86571, 49.50015], [5.94128, 49.50034], [5.94224, 49.49608], [5.96876, 49.49053], [5.97693, 49.45513], [6.02648, 49.45451], [6.02743, 49.44845], [6.04176, 49.44801], [6.05553, 49.46663], [6.07887, 49.46399], [6.08373, 49.45594], [6.10072, 49.45268], [6.09845, 49.46351], [6.10325, 49.4707], [6.12346, 49.4735], [6.12814, 49.49365], [6.14321, 49.48796], [6.16115, 49.49297], [6.15366, 49.50226], [6.17386, 49.50934], [6.19543, 49.50536], [6.2409, 49.51408], [6.25029, 49.50609], [6.27875, 49.503], [6.28818, 49.48465], [6.3687, 49.4593], [6.36778, 49.46937], [6.36907, 49.48931], [6.36788, 49.50377], [6.35666, 49.52931], [6.38072, 49.55171], [6.38228, 49.55855], [6.35825, 49.57053], [6.36676, 49.57813], [6.38024, 49.57593], [6.38342, 49.5799], [6.37464, 49.58886], [6.385, 49.59946], [6.39822, 49.60081], [6.41861, 49.61723], [6.4413, 49.65722], [6.43768, 49.66021], [6.42726, 49.66078], [6.42937, 49.66857], [6.44654, 49.67799], [6.46048, 49.69092], [6.48014, 49.69767], [6.49785, 49.71118], [6.50647, 49.71353], [6.5042, 49.71808], [6.49694, 49.72205], [6.49535, 49.72645], [6.50261, 49.72718], [6.51397, 49.72058], [6.51805, 49.72425], [6.50193, 49.73291], [6.50174, 49.75292], [6.51646, 49.75961], [6.51828, 49.76855], [6.51056, 49.77515], [6.51669, 49.78336], [6.50534, 49.78952], [6.52169, 49.79787], [6.53122, 49.80666], [6.52121, 49.81338], [6.51215, 49.80124], [6.50647, 49.80916], [6.48718, 49.81267], [6.47111, 49.82263], [6.45425, 49.81164], [6.44131, 49.81443], [6.42905, 49.81091], [6.42521, 49.81591], [6.40022, 49.82029], [6.36576, 49.85032], [6.34267, 49.84974], [6.33585, 49.83785], [6.32098, 49.83728], [6.32303, 49.85133], [6.30963, 49.87021], [6.29692, 49.86685], [6.28874, 49.87592], [6.26146, 49.88203], [6.23496, 49.89972], [6.22926, 49.92096], [6.21882, 49.92403], [6.22608, 49.929], [6.22094, 49.94955], [6.19856, 49.95053], [6.19089, 49.96991], [6.18045, 49.96611], [6.18554, 49.95622], [6.17872, 49.9537], [6.16466, 49.97086], [6.1701, 49.98518], [6.14147, 49.99563], [6.14948, 50.00908], [6.13806, 50.01056], [6.1295, 50.01849], [6.13273, 50.02019], [6.13794, 50.01466], [6.14666, 50.02207], [6.13044, 50.02929], [6.13458, 50.04141], [6.11274, 50.05916], [6.12055, 50.09171], [6.1379, 50.12964]]]] } },
22805 { type: "Feature", properties: { iso1A2: "LV", iso1A3: "LVA", iso1N3: "428", wikidata: "Q211", nameEn: "Latvia", groups: ["EU", "154", "150", "UN"], callingCodes: ["371"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.34698, 57.52242], [26.90364, 57.62823], [26.54675, 57.51813], [26.46527, 57.56885], [26.29253, 57.59244], [26.1866, 57.6849], [26.2029, 57.7206], [26.08098, 57.76619], [26.0543, 57.76105], [26.03332, 57.7718], [26.02415, 57.76865], [26.02069, 57.77169], [26.0266, 57.77441], [26.027, 57.78158], [26.02456, 57.78342], [26.0324, 57.79037], [26.05949, 57.84744], [25.73499, 57.90193], [25.29581, 58.08288], [25.28237, 57.98539], [25.19484, 58.0831], [24.3579, 57.87471], [24.26221, 57.91787], [23.20055, 57.56697], [22.80496, 57.87798], [19.84909, 57.57876], [19.64795, 57.06466], [20.68447, 56.04073], [21.15016, 56.07818], [21.24644, 56.16917], [21.49736, 56.29106], [21.57888, 56.31406], [21.74558, 56.33181], [22.00548, 56.41508], [22.09728, 56.42851], [22.3361, 56.4016], [22.56441, 56.39305], [22.69354, 56.36284], [22.83048, 56.367], [22.96988, 56.41213], [23.09531, 56.30511], [23.17312, 56.36795], [23.31606, 56.3827], [23.40486, 56.37689], [23.49803, 56.34307], [23.75726, 56.37282], [24.02657, 56.3231], [24.13139, 56.24881], [24.32334, 56.30226], [24.42746, 56.26522], [24.58143, 56.29125], [24.57353, 56.31525], [24.70022, 56.40483], [24.83686, 56.41565], [24.89005, 56.46666], [25.05762, 56.26742], [25.09325, 56.1878], [25.23099, 56.19147], [25.39751, 56.15707], [25.53621, 56.16663], [25.68588, 56.14725], [25.69246, 56.08892], [25.81773, 56.05444], [25.85893, 56.00188], [25.90047, 56.0013], [26.03815, 55.95884], [26.18509, 55.86813], [26.39561, 55.71156], [26.46661, 55.70375], [26.58248, 55.6754], [26.63231, 55.67968], [26.64888, 55.70515], [26.71802, 55.70645], [26.76872, 55.67658], [26.87448, 55.7172], [26.97153, 55.8102], [27.1559, 55.85032], [27.27804, 55.78299], [27.3541, 55.8089], [27.61683, 55.78558], [27.63065, 55.89687], [27.97865, 56.11849], [28.15217, 56.16964], [28.23716, 56.27588], [28.16599, 56.37806], [28.19057, 56.44637], [28.10069, 56.524], [28.13526, 56.57989], [28.04768, 56.59004], [27.86101, 56.88204], [27.66511, 56.83921], [27.86101, 57.29402], [27.52453, 57.42826], [27.56832, 57.53728], [27.34698, 57.52242]]]] } },
22806 { type: "Feature", properties: { iso1A2: "LY", iso1A3: "LBY", iso1N3: "434", wikidata: "Q1016", nameEn: "Libya", groups: ["015", "002", "UN"], callingCodes: ["218"] }, geometry: { type: "MultiPolygon", coordinates: [[[[26.92891, 33.39516], [11.58941, 33.36891], [11.55852, 33.1409], [11.51549, 33.09826], [11.46037, 32.6307], [11.57828, 32.48013], [11.53898, 32.4138], [11.04234, 32.2145], [10.7315, 31.97235], [10.62788, 31.96629], [10.48497, 31.72956], [10.31364, 31.72648], [10.12239, 31.42098], [10.29516, 30.90337], [9.88152, 30.34074], [9.76848, 30.34366], [9.55544, 30.23971], [9.3876, 30.16738], [9.78136, 29.40961], [9.89569, 26.57696], [9.51696, 26.39148], [9.38834, 26.19288], [10.03146, 25.35635], [10.02432, 24.98124], [10.33159, 24.5465], [10.85323, 24.5595], [11.41061, 24.21456], [11.62498, 24.26669], [11.96886, 23.51735], [13.5631, 23.16574], [14.22918, 22.61719], [14.99751, 23.00539], [15.99566, 23.49639], [23.99539, 19.49944], [23.99715, 20.00038], [24.99794, 19.99661], [24.99885, 21.99535], [24.99968, 29.24574], [24.71117, 30.17441], [25.01077, 30.73861], [24.8458, 31.39877], [26.92891, 33.39516]]]] } },
22807 { type: "Feature", properties: { iso1A2: "MA", iso1A3: "MAR", iso1N3: "504", wikidata: "Q1028", nameEn: "Morocco", groups: ["015", "002", "UN"], callingCodes: ["212"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-2.27707, 35.35051], [-5.10878, 36.05227], [-7.2725, 35.73269], [-14.43883, 27.02969], [-17.27295, 21.93519], [-17.21511, 21.34226], [-17.02707, 21.34022], [-16.9978, 21.36239], [-16.44269, 21.39745], [-14.78487, 21.36587], [-14.47329, 21.63839], [-14.48112, 22.00886], [-14.1291, 22.41636], [-14.10361, 22.75501], [-13.75627, 23.77231], [-13.00628, 24.01923], [-12.92147, 24.39502], [-12.12281, 25.13682], [-12.06001, 26.04442], [-11.62052, 26.05229], [-11.38635, 26.611], [-11.23622, 26.72023], [-11.35695, 26.8505], [-10.68417, 26.90984], [-9.81998, 26.71379], [-9.56957, 26.90042], [-9.08698, 26.98639], [-8.71787, 26.9898], [-8.77527, 27.66663], [-8.66879, 27.6666], [-8.6715, 28.71194], [-7.61585, 29.36252], [-6.95824, 29.50924], [-6.78351, 29.44634], [-6.69965, 29.51623], [-5.75616, 29.61407], [-5.72121, 29.52322], [-5.58831, 29.48103], [-5.21671, 29.95253], [-4.6058, 30.28343], [-4.31774, 30.53229], [-3.64735, 30.67539], [-3.65418, 30.85566], [-3.54944, 31.0503], [-3.77103, 31.14984], [-3.77647, 31.31912], [-3.66386, 31.39202], [-3.66314, 31.6339], [-2.82784, 31.79459], [-2.93873, 32.06557], [-2.46166, 32.16603], [-1.22829, 32.07832], [-1.15735, 32.12096], [-1.24453, 32.1917], [-1.24998, 32.32993], [-0.9912, 32.52467], [-1.37794, 32.73628], [-1.54244, 32.95499], [-1.46249, 33.0499], [-1.67067, 33.27084], [-1.59508, 33.59929], [-1.73494, 33.71721], [-1.64666, 34.10405], [-1.78042, 34.39018], [-1.69788, 34.48056], [-1.84569, 34.61907], [-1.73707, 34.74226], [-1.97469, 34.886], [-1.97833, 34.93218], [-2.04734, 34.93218], [-2.21445, 35.04378], [-2.21248, 35.08532], [-2.27707, 35.35051]], [[-2.91909, 35.33927], [-2.92272, 35.27509], [-2.93893, 35.26737], [-2.95065, 35.26576], [-2.95431, 35.2728], [-2.96516, 35.27967], [-2.96826, 35.28296], [-2.96507, 35.28801], [-2.97035, 35.28852], [-2.96978, 35.29459], [-2.96648, 35.30475], [-2.96038, 35.31609], [-2.91909, 35.33927]], [[-3.90602, 35.21494], [-3.89343, 35.22728], [-3.88372, 35.20767], [-3.90602, 35.21494]], [[-4.30191, 35.17419], [-4.29436, 35.17149], [-4.30112, 35.17058], [-4.30191, 35.17419]], [[-2.40316, 35.16893], [-2.45965, 35.16527], [-2.43262, 35.20652], [-2.40316, 35.16893]], [[-5.38491, 35.92591], [-5.21179, 35.90091], [-5.34379, 35.8711], [-5.35844, 35.87375], [-5.37338, 35.88417], [-5.38491, 35.92591]]]] } },
22808 { type: "Feature", properties: { iso1A2: "MC", iso1A3: "MCO", iso1N3: "492", wikidata: "Q235", nameEn: "Monaco", groups: ["155", "150", "UN"], callingCodes: ["377"] }, geometry: { type: "MultiPolygon", coordinates: [[[[7.47823, 43.73341], [7.4379, 43.74963], [7.4389, 43.75151], [7.43708, 43.75197], [7.43624, 43.75014], [7.43013, 43.74895], [7.42809, 43.74396], [7.42443, 43.74087], [7.42299, 43.74176], [7.42062, 43.73977], [7.41233, 43.73439], [7.41298, 43.73311], [7.41291, 43.73168], [7.41113, 43.73156], [7.40903, 43.7296], [7.42422, 43.72209], [7.47823, 43.73341]]]] } },
22809 { type: "Feature", properties: { iso1A2: "MD", iso1A3: "MDA", iso1N3: "498", wikidata: "Q217", nameEn: "Moldova", groups: ["151", "150", "UN"], callingCodes: ["373"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.74422, 48.45926], [27.6658, 48.44034], [27.59027, 48.46311], [27.5889, 48.49224], [27.46942, 48.454], [27.44333, 48.41209], [27.37741, 48.41026], [27.37604, 48.44398], [27.32159, 48.4434], [27.27855, 48.37534], [27.13434, 48.37288], [27.08078, 48.43214], [27.0231, 48.42485], [27.03821, 48.37653], [26.93384, 48.36558], [26.85556, 48.41095], [26.71274, 48.40388], [26.82809, 48.31629], [26.79239, 48.29071], [26.6839, 48.35828], [26.62823, 48.25804], [26.81161, 48.25049], [26.87708, 48.19919], [26.94265, 48.1969], [26.98042, 48.15752], [26.96119, 48.13003], [27.04118, 48.12522], [27.02985, 48.09083], [27.15622, 47.98538], [27.1618, 47.92391], [27.29069, 47.73722], [27.25519, 47.71366], [27.32202, 47.64009], [27.3979, 47.59473], [27.47942, 47.48113], [27.55731, 47.46637], [27.60263, 47.32507], [27.68706, 47.28962], [27.73172, 47.29248], [27.81892, 47.1381], [28.09095, 46.97621], [28.12173, 46.82283], [28.24808, 46.64305], [28.22281, 46.50481], [28.25769, 46.43334], [28.18902, 46.35283], [28.19864, 46.31869], [28.10937, 46.22852], [28.13684, 46.18099], [28.08612, 46.01105], [28.13111, 45.92819], [28.16568, 45.6421], [28.08927, 45.6051], [28.18741, 45.47358], [28.21139, 45.46895], [28.30201, 45.54744], [28.41836, 45.51715], [28.43072, 45.48538], [28.51449, 45.49982], [28.49252, 45.56716], [28.54196, 45.58062], [28.51587, 45.6613], [28.47879, 45.66994], [28.52823, 45.73803], [28.70401, 45.78019], [28.69852, 45.81753], [28.78503, 45.83475], [28.74383, 45.96664], [28.98004, 46.00385], [29.00613, 46.04962], [28.94643, 46.09176], [29.06656, 46.19716], [28.94953, 46.25852], [28.98478, 46.31803], [29.004, 46.31495], [28.9306, 46.45699], [29.01241, 46.46177], [29.02409, 46.49582], [29.23547, 46.55435], [29.24886, 46.37912], [29.35357, 46.49505], [29.49914, 46.45889], [29.5939, 46.35472], [29.6763, 46.36041], [29.66359, 46.4215], [29.74496, 46.45605], [29.88329, 46.35851], [29.94114, 46.40114], [30.09103, 46.38694], [30.16794, 46.40967], [30.02511, 46.45132], [29.88916, 46.54302], [29.94409, 46.56002], [29.9743, 46.75325], [29.94522, 46.80055], [29.98814, 46.82358], [29.87405, 46.88199], [29.75458, 46.8604], [29.72986, 46.92234], [29.57056, 46.94766], [29.62137, 47.05069], [29.61038, 47.09932], [29.53044, 47.07851], [29.49732, 47.12878], [29.57696, 47.13581], [29.54996, 47.24962], [29.59665, 47.25521], [29.5733, 47.36508], [29.48678, 47.36043], [29.47854, 47.30366], [29.39889, 47.30179], [29.3261, 47.44664], [29.18603, 47.43387], [29.11743, 47.55001], [29.22414, 47.60012], [29.22242, 47.73607], [29.27255, 47.79953], [29.20663, 47.80367], [29.27804, 47.88893], [29.19839, 47.89261], [29.1723, 47.99013], [28.9306, 47.96255], [28.8414, 48.03392], [28.85232, 48.12506], [28.69896, 48.13106], [28.53921, 48.17453], [28.48428, 48.0737], [28.42454, 48.12047], [28.43701, 48.15832], [28.38712, 48.17567], [28.34009, 48.13147], [28.30609, 48.14018], [28.30586, 48.1597], [28.34912, 48.1787], [28.36996, 48.20543], [28.35519, 48.24957], [28.32508, 48.23384], [28.2856, 48.23202], [28.19314, 48.20749], [28.17666, 48.25963], [28.07504, 48.23494], [28.09873, 48.3124], [28.04527, 48.32661], [27.95883, 48.32368], [27.88391, 48.36699], [27.87533, 48.4037], [27.81902, 48.41874], [27.79225, 48.44244], [27.74422, 48.45926]]]] } },
22810 { type: "Feature", properties: { iso1A2: "ME", iso1A3: "MNE", iso1N3: "499", wikidata: "Q236", nameEn: "Montenegro", groups: ["039", "150", "UN"], callingCodes: ["382"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.22807, 43.5264], [19.15685, 43.53943], [19.13933, 43.5282], [19.04934, 43.50384], [19.01078, 43.55806], [18.91379, 43.50299], [18.95469, 43.49367], [18.96053, 43.45042], [19.01078, 43.43854], [19.04071, 43.397], [19.08673, 43.31453], [19.08206, 43.29668], [19.04233, 43.30008], [19.00844, 43.24988], [18.95001, 43.29327], [18.95819, 43.32899], [18.90911, 43.36383], [18.83912, 43.34795], [18.84794, 43.33735], [18.85342, 43.32426], [18.76538, 43.29838], [18.6976, 43.25243], [18.71747, 43.2286], [18.66605, 43.2056], [18.64735, 43.14766], [18.66254, 43.03928], [18.52232, 43.01451], [18.49076, 42.95553], [18.49661, 42.89306], [18.4935, 42.86433], [18.47633, 42.85829], [18.45921, 42.81682], [18.47324, 42.74992], [18.56789, 42.72074], [18.55221, 42.69045], [18.54603, 42.69171], [18.54841, 42.68328], [18.57373, 42.64429], [18.52232, 42.62279], [18.55504, 42.58409], [18.53751, 42.57376], [18.49778, 42.58409], [18.43735, 42.55921], [18.44307, 42.51077], [18.43588, 42.48556], [18.52152, 42.42302], [18.54128, 42.39171], [18.45131, 42.21682], [19.26406, 41.74971], [19.37597, 41.84849], [19.37451, 41.8842], [19.33812, 41.90669], [19.34601, 41.95675], [19.37691, 41.96977], [19.36867, 42.02564], [19.37548, 42.06835], [19.40687, 42.10024], [19.28623, 42.17745], [19.42, 42.33019], [19.42352, 42.36546], [19.4836, 42.40831], [19.65972, 42.62774], [19.73244, 42.66299], [19.77375, 42.58517], [19.74731, 42.57422], [19.76549, 42.50237], [19.82333, 42.46581], [19.9324, 42.51699], [20.00842, 42.5109], [20.01834, 42.54622], [20.07761, 42.55582], [20.0969, 42.65559], [20.02915, 42.71147], [20.02088, 42.74789], [20.04898, 42.77701], [20.2539, 42.76245], [20.27869, 42.81945], [20.35692, 42.8335], [20.34528, 42.90676], [20.16415, 42.97177], [20.14896, 42.99058], [20.12325, 42.96237], [20.05431, 42.99571], [20.04729, 43.02732], [19.98887, 43.0538], [19.96549, 43.11098], [19.92576, 43.08539], [19.79255, 43.11951], [19.76918, 43.16044], [19.64063, 43.19027], [19.62661, 43.2286], [19.54598, 43.25158], [19.52962, 43.31623], [19.48171, 43.32644], [19.44315, 43.38846], [19.22229, 43.47926], [19.22807, 43.5264]]]] } },
22811 { type: "Feature", properties: { iso1A2: "MF", iso1A3: "MAF", iso1N3: "663", wikidata: "Q126125", nameEn: "Saint-Martin", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["590"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.93924, 18.02904], [-62.62718, 18.26185], [-63.35989, 18.06012], [-63.33064, 17.9615], [-63.13502, 18.05445], [-63.11042, 18.05339], [-63.09686, 18.04608], [-63.07759, 18.04943], [-63.0579, 18.06614], [-63.04039, 18.05619], [-63.02323, 18.05757], [-62.93924, 18.02904]]]] } },
22812 { type: "Feature", properties: { iso1A2: "MG", iso1A3: "MDG", iso1N3: "450", wikidata: "Q1019", nameEn: "Madagascar", aliases: ["RM"], groups: ["014", "202", "002", "UN"], callingCodes: ["261"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.93891, -10.85085], [45.84651, -12.77177], [42.14681, -19.63341], [45.80092, -33.00974], [51.93891, -10.85085]]]] } },
22813 { type: "Feature", properties: { iso1A2: "MH", iso1A3: "MHL", iso1N3: "584", wikidata: "Q709", nameEn: "Marshall Islands", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["692"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169, 3.9], [173.53711, 5.70687], [169.29099, 15.77133], [159.04653, 10.59067], [169, 3.9]]]] } },
22814 { type: "Feature", properties: { iso1A2: "MK", iso1A3: "MKD", iso1N3: "807", wikidata: "Q221", nameEn: "North Macedonia", groups: ["039", "150", "UN"], callingCodes: ["389"] }, geometry: { type: "MultiPolygon", coordinates: [[[[22.34773, 42.31725], [22.29275, 42.34913], [22.29605, 42.37477], [22.16384, 42.32103], [22.02908, 42.29848], [21.94405, 42.34669], [21.91595, 42.30392], [21.84654, 42.3247], [21.77176, 42.2648], [21.70111, 42.23789], [21.58992, 42.25915], [21.52145, 42.24465], [21.50823, 42.27156], [21.43882, 42.2789], [21.43882, 42.23609], [21.38428, 42.24465], [21.30496, 42.1418], [21.29913, 42.13954], [21.31983, 42.10993], [21.22728, 42.08909], [21.16614, 42.19815], [21.11491, 42.20794], [20.75464, 42.05229], [20.76786, 41.91839], [20.68523, 41.85318], [20.59524, 41.8818], [20.55976, 41.87068], [20.57144, 41.7897], [20.53405, 41.78099], [20.51301, 41.72433], [20.52937, 41.69292], [20.51769, 41.65975], [20.55508, 41.58113], [20.52103, 41.56473], [20.45809, 41.5549], [20.45331, 41.51436], [20.49039, 41.49277], [20.51301, 41.442], [20.55976, 41.4087], [20.52119, 41.34381], [20.49432, 41.33679], [20.51068, 41.2323], [20.59715, 41.13644], [20.58546, 41.11179], [20.59832, 41.09066], [20.63454, 41.0889], [20.65558, 41.08009], [20.71634, 40.91781], [20.73504, 40.9081], [20.81567, 40.89662], [20.83671, 40.92752], [20.94305, 40.92399], [20.97693, 40.90103], [20.97887, 40.85475], [21.15262, 40.85546], [21.21105, 40.8855], [21.25779, 40.86165], [21.35595, 40.87578], [21.41555, 40.9173], [21.53007, 40.90759], [21.57448, 40.86076], [21.69601, 40.9429], [21.7556, 40.92525], [21.91102, 41.04786], [21.90869, 41.09191], [22.06527, 41.15617], [22.1424, 41.12449], [22.17629, 41.15969], [22.26744, 41.16409], [22.42285, 41.11921], [22.5549, 41.13065], [22.58295, 41.11568], [22.62852, 41.14385], [22.65306, 41.18168], [22.71266, 41.13945], [22.74538, 41.16321], [22.76408, 41.32225], [22.81199, 41.3398], [22.93334, 41.34104], [22.96331, 41.35782], [22.95513, 41.63265], [23.03342, 41.71034], [23.01239, 41.76527], [22.96682, 41.77137], [22.90254, 41.87587], [22.86749, 42.02275], [22.67701, 42.06614], [22.51224, 42.15457], [22.50289, 42.19527], [22.47251, 42.20393], [22.38136, 42.30339], [22.34773, 42.31725]]]] } },
22815 { type: "Feature", properties: { iso1A2: "ML", iso1A3: "MLI", iso1N3: "466", wikidata: "Q912", nameEn: "Mali", groups: ["011", "202", "002", "UN"], callingCodes: ["223"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-4.83423, 24.99935], [-6.57191, 25.0002], [-5.60725, 16.49919], [-5.33435, 16.33354], [-5.50165, 15.50061], [-9.32979, 15.50032], [-9.31106, 15.69412], [-9.33314, 15.7044], [-9.44673, 15.60553], [-9.40447, 15.4396], [-10.71721, 15.4223], [-10.90932, 15.11001], [-11.43483, 15.62339], [-11.70705, 15.51558], [-11.94903, 14.76143], [-12.23936, 14.76324], [-11.93043, 13.84505], [-12.06897, 13.71049], [-11.83345, 13.33333], [-11.63025, 13.39174], [-11.39935, 12.97808], [-11.37536, 12.40788], [-11.50006, 12.17826], [-11.24136, 12.01286], [-10.99758, 12.24634], [-10.80355, 12.1053], [-10.71897, 11.91552], [-10.30604, 12.24634], [-9.714, 12.0226], [-9.63938, 12.18312], [-9.32097, 12.29009], [-9.38067, 12.48446], [-9.13689, 12.50875], [-8.94784, 12.34842], [-8.80854, 11.66715], [-8.40058, 11.37466], [-8.66923, 10.99397], [-8.35083, 11.06234], [-8.2667, 10.91762], [-8.32614, 10.69273], [-8.22711, 10.41722], [-8.10207, 10.44649], [-7.9578, 10.2703], [-7.97971, 10.17117], [-7.92107, 10.15577], [-7.63048, 10.46334], [-7.54462, 10.40921], [-7.52261, 10.4655], [-7.44555, 10.44602], [-7.3707, 10.24677], [-7.13331, 10.24877], [-7.0603, 10.14711], [-7.00966, 10.15794], [-6.97444, 10.21644], [-7.01186, 10.25111], [-6.93921, 10.35291], [-6.68164, 10.35074], [-6.63541, 10.66893], [-6.52974, 10.59104], [-6.42847, 10.5694], [-6.40646, 10.69922], [-6.325, 10.68624], [-6.24795, 10.74248], [-6.1731, 10.46983], [-6.18851, 10.24244], [-5.99478, 10.19694], [-5.78124, 10.43952], [-5.65135, 10.46767], [-5.51058, 10.43177], [-5.46643, 10.56074], [-5.47083, 10.75329], [-5.41579, 10.84628], [-5.49284, 11.07538], [-5.32994, 11.13371], [-5.32553, 11.21578], [-5.25949, 11.24816], [-5.25509, 11.36905], [-5.20665, 11.43811], [-5.22867, 11.60421], [-5.29251, 11.61715], [-5.26389, 11.75728], [-5.40258, 11.8327], [-5.26389, 11.84778], [-5.07897, 11.97918], [-4.72893, 12.01579], [-4.70692, 12.06746], [-4.62987, 12.06531], [-4.62546, 12.13204], [-4.54841, 12.1385], [-4.57703, 12.19875], [-4.41412, 12.31922], [-4.47356, 12.71252], [-4.238, 12.71467], [-4.21819, 12.95722], [-4.34477, 13.12927], [-3.96501, 13.49778], [-3.90558, 13.44375], [-3.96282, 13.38164], [-3.7911, 13.36665], [-3.54454, 13.1781], [-3.4313, 13.1588], [-3.43507, 13.27272], [-3.23599, 13.29035], [-3.28396, 13.5422], [-3.26407, 13.70699], [-2.88189, 13.64921], [-2.90831, 13.81174], [-2.84667, 14.05532], [-2.66175, 14.14713], [-2.47587, 14.29671], [-2.10223, 14.14878], [-1.9992, 14.19011], [-1.97945, 14.47709], [-1.68083, 14.50023], [-1.32166, 14.72774], [-1.05875, 14.7921], [-0.72004, 15.08655], [-0.24673, 15.07805], [0.06588, 14.96961], [0.23859, 15.00135], [0.72632, 14.95898], [0.96711, 14.98275], [1.31275, 15.27978], [3.01806, 15.34571], [3.03134, 15.42221], [3.50368, 15.35934], [4.19893, 16.39923], [4.21787, 17.00118], [4.26762, 17.00432], [4.26651, 19.14224], [3.36082, 18.9745], [3.12501, 19.1366], [3.24648, 19.81703], [1.20992, 20.73533], [1.15698, 21.12843], [-4.83423, 24.99935]]]] } },
22816 { type: "Feature", properties: { iso1A2: "MM", iso1A3: "MMR", iso1N3: "104", wikidata: "Q836", nameEn: "Myanmar", aliases: ["Burma", "BU"], groups: ["035", "142", "UN"], callingCodes: ["95"] }, geometry: { type: "MultiPolygon", coordinates: [[[[92.62187, 21.87037], [92.59775, 21.6092], [92.68152, 21.28454], [92.60187, 21.24615], [92.55105, 21.3856], [92.43158, 21.37025], [92.37939, 21.47764], [92.20087, 21.337], [92.17752, 21.17445], [92.26071, 21.05697], [92.47409, 20.38654], [92.61042, 13.76986], [94.6371, 13.81803], [97.63455, 9.60854], [98.12555, 9.44056], [98.33094, 9.91973], [98.47298, 9.95782], [98.52291, 9.92389], [98.55174, 9.92804], [98.7391, 10.31488], [98.81944, 10.52761], [98.77275, 10.62548], [98.78511, 10.68351], [98.86819, 10.78336], [99.0069, 10.85485], [98.99701, 10.92962], [99.02337, 10.97217], [99.06938, 10.94857], [99.32756, 11.28545], [99.31573, 11.32081], [99.39485, 11.3925], [99.47598, 11.62434], [99.5672, 11.62732], [99.64108, 11.78948], [99.64891, 11.82699], [99.53424, 12.02317], [99.56445, 12.14805], [99.47519, 12.1353], [99.409, 12.60603], [99.29254, 12.68921], [99.18905, 12.84799], [99.18748, 12.9898], [99.10646, 13.05804], [99.12225, 13.19847], [99.20617, 13.20575], [99.16695, 13.72621], [98.97356, 14.04868], [98.56762, 14.37701], [98.24874, 14.83013], [98.18821, 15.13125], [98.22, 15.21327], [98.30446, 15.30667], [98.40522, 15.25268], [98.41906, 15.27103], [98.39351, 15.34177], [98.4866, 15.39154], [98.56027, 15.33471], [98.58598, 15.46821], [98.541, 15.65406], [98.59853, 15.87197], [98.57019, 16.04578], [98.69585, 16.13353], [98.8376, 16.11706], [98.92656, 16.36425], [98.84485, 16.42354], [98.68074, 16.27068], [98.63817, 16.47424], [98.57912, 16.55983], [98.5695, 16.62826], [98.51113, 16.64503], [98.51833, 16.676], [98.51472, 16.68521], [98.51579, 16.69433], [98.51043, 16.70107], [98.49713, 16.69022], [98.50253, 16.7139], [98.46994, 16.73613], [98.53833, 16.81934], [98.49603, 16.8446], [98.52624, 16.89979], [98.39441, 17.06266], [98.34566, 17.04822], [98.10439, 17.33847], [98.11185, 17.36829], [97.91829, 17.54504], [97.76407, 17.71595], [97.66794, 17.88005], [97.73723, 17.97912], [97.60841, 18.23846], [97.64116, 18.29778], [97.56219, 18.33885], [97.50383, 18.26844], [97.34522, 18.54596], [97.36444, 18.57138], [97.5258, 18.4939], [97.76752, 18.58097], [97.73836, 18.88478], [97.66487, 18.9371], [97.73654, 18.9812], [97.73797, 19.04261], [97.83479, 19.09972], [97.84024, 19.22217], [97.78606, 19.26769], [97.84186, 19.29526], [97.78769, 19.39429], [97.88423, 19.5041], [97.84715, 19.55782], [98.04364, 19.65755], [98.03314, 19.80941], [98.13829, 19.78541], [98.24884, 19.67876], [98.51182, 19.71303], [98.56065, 19.67807], [98.83661, 19.80931], [98.98679, 19.7419], [99.0735, 20.10298], [99.20328, 20.12877], [99.416, 20.08614], [99.52943, 20.14811], [99.5569, 20.20676], [99.46077, 20.36198], [99.46008, 20.39673], [99.68255, 20.32077], [99.81096, 20.33687], [99.86383, 20.44371], [99.88211, 20.44488], [99.88451, 20.44596], [99.89168, 20.44548], [99.89301, 20.44311], [99.89692, 20.44789], [99.90499, 20.4487], [99.91616, 20.44986], [99.95721, 20.46301], [100.08404, 20.36626], [100.1957, 20.68247], [100.36375, 20.82783], [100.51079, 20.82194], [100.60112, 20.8347], [100.64628, 20.88279], [100.50974, 20.88574], [100.55281, 21.02796], [100.63578, 21.05639], [100.72716, 21.31786], [100.80173, 21.2934], [101.00234, 21.39612], [101.16198, 21.52808], [101.15156, 21.56129], [101.11744, 21.77659], [100.87265, 21.67396], [100.72143, 21.51898], [100.57861, 21.45637], [100.4811, 21.46148], [100.42892, 21.54325], [100.35201, 21.53176], [100.25863, 21.47043], [100.18447, 21.51898], [100.1625, 21.48704], [100.12542, 21.50365], [100.10757, 21.59945], [100.17486, 21.65306], [100.12679, 21.70539], [100.04956, 21.66843], [99.98654, 21.71064], [99.94003, 21.82782], [99.99084, 21.97053], [99.96612, 22.05965], [99.85351, 22.04183], [99.47585, 22.13345], [99.33166, 22.09656], [99.1552, 22.15874], [99.19176, 22.16983], [99.17318, 22.18025], [99.28771, 22.4105], [99.37972, 22.50188], [99.38247, 22.57544], [99.31243, 22.73893], [99.45654, 22.85726], [99.43537, 22.94086], [99.54218, 22.90014], [99.52214, 23.08218], [99.34127, 23.13099], [99.25741, 23.09025], [99.04601, 23.12215], [99.05975, 23.16382], [98.88597, 23.18656], [98.92515, 23.29535], [98.93958, 23.31414], [98.87573, 23.33038], [98.92104, 23.36946], [98.87683, 23.48995], [98.82877, 23.47908], [98.80294, 23.5345], [98.88396, 23.59555], [98.81775, 23.694], [98.82933, 23.72921], [98.79607, 23.77947], [98.68209, 23.80492], [98.67797, 23.9644], [98.89632, 24.10612], [98.87998, 24.15624], [98.85319, 24.13042], [98.59256, 24.08371], [98.54476, 24.13119], [98.20666, 24.11406], [98.07806, 24.07988], [98.06703, 24.08028], [98.0607, 24.07812], [98.05671, 24.07961], [98.05302, 24.07408], [98.04709, 24.07616], [97.99583, 24.04932], [97.98691, 24.03897], [97.93951, 24.01953], [97.90998, 24.02094], [97.88616, 24.00463], [97.88414, 23.99405], [97.88814, 23.98605], [97.89683, 23.98389], [97.89676, 23.97931], [97.8955, 23.97758], [97.88811, 23.97446], [97.86545, 23.97723], [97.84328, 23.97603], [97.79416, 23.95663], [97.79456, 23.94836], [97.72302, 23.89288], [97.64667, 23.84574], [97.5247, 23.94032], [97.62363, 24.00506], [97.72903, 24.12606], [97.75305, 24.16902], [97.72799, 24.18883], [97.72998, 24.2302], [97.76799, 24.26365], [97.71941, 24.29652], [97.66723, 24.30027], [97.65624, 24.33781], [97.7098, 24.35658], [97.66998, 24.45288], [97.60029, 24.4401], [97.52757, 24.43748], [97.56286, 24.54535], [97.56525, 24.72838], [97.54675, 24.74202], [97.5542, 24.74943], [97.56383, 24.75535], [97.56648, 24.76475], [97.64354, 24.79171], [97.70181, 24.84557], [97.73127, 24.83015], [97.76481, 24.8289], [97.79949, 24.85655], [97.72903, 24.91332], [97.72216, 25.08508], [97.77023, 25.11492], [97.83614, 25.2715], [97.92541, 25.20815], [98.14925, 25.41547], [98.12591, 25.50722], [98.18084, 25.56298], [98.16848, 25.62739], [98.25774, 25.6051], [98.31268, 25.55307], [98.40606, 25.61129], [98.54064, 25.85129], [98.63128, 25.79937], [98.70818, 25.86241], [98.60763, 26.01512], [98.57085, 26.11547], [98.63128, 26.15492], [98.66884, 26.09165], [98.7329, 26.17218], [98.67797, 26.24487], [98.72741, 26.36183], [98.77547, 26.61994], [98.7333, 26.85615], [98.69582, 27.56499], [98.43353, 27.67086], [98.42529, 27.55404], [98.32641, 27.51385], [98.13964, 27.9478], [98.15337, 28.12114], [97.90069, 28.3776], [97.79632, 28.33168], [97.70705, 28.5056], [97.56835, 28.55628], [97.50518, 28.49716], [97.47085, 28.2688], [97.41729, 28.29783], [97.34547, 28.21385], [97.31292, 28.06784], [97.35412, 28.06663], [97.38845, 28.01329], [97.35824, 27.87256], [97.29919, 27.92233], [96.90112, 27.62149], [96.91431, 27.45752], [97.17422, 27.14052], [97.14675, 27.09041], [96.89132, 27.17474], [96.85287, 27.2065], [96.88445, 27.25046], [96.73888, 27.36638], [96.55761, 27.29928], [96.40779, 27.29818], [96.15591, 27.24572], [96.04949, 27.19428], [95.93002, 27.04149], [95.81603, 27.01335], [95.437, 26.7083], [95.30339, 26.65372], [95.23513, 26.68499], [95.05798, 26.45408], [95.12801, 26.38397], [95.11428, 26.1019], [95.18556, 26.07338], [94.80117, 25.49359], [94.68032, 25.47003], [94.57458, 25.20318], [94.74212, 25.13606], [94.73937, 25.00545], [94.60204, 24.70889], [94.5526, 24.70764], [94.50729, 24.59281], [94.45279, 24.56656], [94.32362, 24.27692], [94.30215, 24.23752], [94.14081, 23.83333], [93.92089, 23.95812], [93.80279, 23.92549], [93.75952, 24.0003], [93.62871, 24.00922], [93.50616, 23.94432], [93.46633, 23.97067], [93.41415, 24.07854], [93.34735, 24.10151], [93.32351, 24.04468], [93.36059, 23.93176], [93.3908, 23.92925], [93.3908, 23.7622], [93.43475, 23.68299], [93.38805, 23.4728], [93.39981, 23.38828], [93.38781, 23.36139], [93.36862, 23.35426], [93.38478, 23.13698], [93.2878, 23.00464], [93.12988, 23.05772], [93.134, 22.92498], [93.09417, 22.69459], [93.134, 22.59573], [93.11477, 22.54374], [93.13537, 22.45873], [93.18206, 22.43716], [93.19991, 22.25425], [93.14224, 22.24535], [93.15734, 22.18687], [93.04885, 22.20595], [92.99255, 22.05965], [92.99804, 21.98964], [92.93899, 22.02656], [92.89504, 21.95143], [92.86208, 22.05456], [92.70416, 22.16017], [92.67532, 22.03547], [92.60949, 21.97638], [92.62187, 21.87037]]]] } },
22817 { type: "Feature", properties: { iso1A2: "MN", iso1A3: "MNG", iso1N3: "496", wikidata: "Q711", nameEn: "Mongolia", groups: ["030", "142", "UN"], callingCodes: ["976"] }, geometry: { type: "MultiPolygon", coordinates: [[[[102.14032, 51.35566], [101.5044, 51.50467], [101.39085, 51.45753], [100.61116, 51.73028], [99.89203, 51.74903], [99.75578, 51.90108], [99.27888, 51.96876], [98.87768, 52.14563], [98.74142, 51.8637], [98.33222, 51.71832], [98.22053, 51.46579], [98.05257, 51.46696], [97.83305, 51.00248], [98.01472, 50.86652], [97.9693, 50.78044], [98.06393, 50.61262], [98.31373, 50.4996], [98.29481, 50.33561], [97.85197, 49.91339], [97.76871, 49.99861], [97.56432, 49.92801], [97.56811, 49.84265], [97.24639, 49.74737], [96.97388, 49.88413], [95.80056, 50.04239], [95.74757, 49.97915], [95.02465, 49.96941], [94.97166, 50.04725], [94.6121, 50.04239], [94.49477, 50.17832], [94.39258, 50.22193], [94.30823, 50.57498], [92.99595, 50.63183], [93.01109, 50.79001], [92.44714, 50.78762], [92.07173, 50.69585], [91.86048, 50.73734], [89.59711, 49.90851], [89.70687, 49.72535], [88.82499, 49.44808], [88.42449, 49.48821], [88.17223, 49.46934], [88.15543, 49.30314], [87.98977, 49.18147], [87.81333, 49.17354], [87.88171, 48.95853], [87.73822, 48.89582], [88.0788, 48.71436], [87.96361, 48.58478], [88.58939, 48.34531], [88.58316, 48.21893], [88.8011, 48.11302], [88.93186, 48.10263], [89.0711, 47.98528], [89.55453, 48.0423], [89.76624, 47.82745], [90.06512, 47.88177], [90.10871, 47.7375], [90.33598, 47.68303], [90.48854, 47.41826], [90.48542, 47.30438], [90.76108, 46.99399], [90.84035, 46.99525], [91.03649, 46.72916], [91.0147, 46.58171], [91.07696, 46.57315], [90.89639, 46.30711], [90.99672, 46.14207], [91.03026, 46.04194], [90.70907, 45.73437], [90.65114, 45.49314], [90.89169, 45.19667], [91.64048, 45.07408], [93.51161, 44.95964], [94.10003, 44.71016], [94.71959, 44.35284], [95.01191, 44.25274], [95.39772, 44.2805], [95.32891, 44.02407], [95.52594, 43.99353], [95.89543, 43.2528], [96.35658, 42.90363], [96.37926, 42.72055], [97.1777, 42.7964], [99.50671, 42.56535], [100.33297, 42.68231], [100.84979, 42.67087], [101.80515, 42.50074], [102.07645, 42.22519], [102.72403, 42.14675], [103.92804, 41.78246], [104.52258, 41.8706], [104.51667, 41.66113], [105.0123, 41.63188], [106.76517, 42.28741], [107.24774, 42.36107], [107.29755, 42.41395], [107.49681, 42.46221], [107.57258, 42.40898], [108.84489, 42.40246], [109.00679, 42.45302], [109.452, 42.44842], [109.89402, 42.63111], [110.08401, 42.6411], [110.4327, 42.78293], [111.0149, 43.3289], [111.59087, 43.51207], [111.79758, 43.6637], [111.93776, 43.68709], [111.96289, 43.81596], [111.40498, 44.3461], [111.76275, 44.98032], [111.98695, 45.09074], [112.4164, 45.06858], [112.74662, 44.86297], [113.70918, 44.72891], [114.5166, 45.27189], [114.54801, 45.38337], [114.74612, 45.43585], [114.94546, 45.37377], [115.60329, 45.44717], [116.16989, 45.68603], [116.27366, 45.78637], [116.24012, 45.8778], [116.26678, 45.96479], [116.58612, 46.30211], [116.75551, 46.33083], [116.83166, 46.38637], [117.36609, 46.36335], [117.41782, 46.57862], [117.60748, 46.59771], [117.69554, 46.50991], [118.30534, 46.73519], [118.78747, 46.68689], [118.8337, 46.77742], [118.89974, 46.77139], [118.92616, 46.72765], [119.00541, 46.74273], [119.10448, 46.65516], [119.24978, 46.64761], [119.32827, 46.61433], [119.42827, 46.63783], [119.65265, 46.62342], [119.68127, 46.59015], [119.77373, 46.62947], [119.80455, 46.67631], [119.89261, 46.66423], [119.91242, 46.90091], [119.85518, 46.92196], [119.71209, 47.19192], [119.62403, 47.24575], [119.56019, 47.24874], [119.54918, 47.29505], [119.31964, 47.42617], [119.35892, 47.48104], [119.13995, 47.53997], [119.12343, 47.66458], [118.7564, 47.76947], [118.55766, 47.99277], [118.29654, 48.00246], [118.22677, 48.03853], [118.11009, 48.04], [118.03676, 48.00982], [117.80196, 48.01661], [117.50181, 47.77216], [117.37875, 47.63627], [116.9723, 47.87285], [116.67405, 47.89039], [116.4465, 47.83662], [116.21879, 47.88505], [115.94296, 47.67741], [115.57128, 47.91988], [115.52082, 48.15367], [115.811, 48.25699], [115.78876, 48.51781], [116.06565, 48.81716], [116.03781, 48.87014], [116.71193, 49.83813], [116.62502, 49.92919], [116.22402, 50.04477], [115.73602, 49.87688], [115.26068, 49.97367], [114.9703, 50.19254], [114.325, 50.28098], [113.20216, 49.83356], [113.02647, 49.60772], [110.64493, 49.1816], [110.39891, 49.25083], [110.24373, 49.16676], [109.51325, 49.22859], [109.18017, 49.34709], [108.53969, 49.32325], [108.27937, 49.53167], [107.95387, 49.66659], [107.96116, 49.93191], [107.36407, 49.97612], [107.1174, 50.04239], [107.00007, 50.1977], [106.80326, 50.30177], [106.58373, 50.34044], [106.51122, 50.34408], [106.49628, 50.32436], [106.47156, 50.31909], [106.07865, 50.33474], [106.05562, 50.40582], [105.32528, 50.4648], [103.70343, 50.13952], [102.71178, 50.38873], [102.32194, 50.67982], [102.14032, 51.35566]]]] } },
22818 { type: "Feature", properties: { iso1A2: "MO", iso1A3: "MAC", iso1N3: "446", wikidata: "Q14773", nameEn: "Macau", aliases: ["Macao"], country: "CN", groups: ["030", "142", "UN"], driveSide: "left", callingCodes: ["853"] }, geometry: { type: "MultiPolygon", coordinates: [[[[113.54942, 22.14519], [113.54839, 22.10909], [113.57191, 22.07696], [113.63011, 22.10782], [113.60504, 22.20464], [113.57123, 22.20416], [113.56865, 22.20973], [113.5508, 22.21672], [113.54333, 22.21688], [113.54093, 22.21314], [113.53593, 22.2137], [113.53301, 22.21235], [113.53552, 22.20607], [113.52659, 22.18271], [113.54093, 22.15497], [113.54942, 22.14519]]]] } },
22819 { type: "Feature", properties: { iso1A2: "MP", iso1A3: "MNP", iso1N3: "580", wikidata: "Q16644", nameEn: "Northern Mariana Islands", aliases: ["US-MP"], country: "US", groups: ["Q1352230", "Q153732", "057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[135.52896, 14.32623], [152.19114, 13.63487], [145.05972, 21.28731], [135.52896, 14.32623]]]] } },
22820 { type: "Feature", properties: { iso1A2: "MQ", iso1A3: "MTQ", iso1N3: "474", wikidata: "Q17054", nameEn: "Martinique", country: "FR", groups: ["Q3320166", "EU", "029", "003", "419", "019", "UN"], callingCodes: ["596"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-59.95997, 14.20285], [-61.07821, 15.25109], [-61.69315, 14.26451], [-59.95997, 14.20285]]]] } },
22821 { type: "Feature", properties: { iso1A2: "MR", iso1A3: "MRT", iso1N3: "478", wikidata: "Q1025", nameEn: "Mauritania", groups: ["011", "202", "002", "UN"], callingCodes: ["222"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-5.60725, 16.49919], [-6.57191, 25.0002], [-4.83423, 24.99935], [-8.66674, 27.31569], [-8.66721, 25.99918], [-12.0002, 25.9986], [-12.00251, 23.4538], [-12.14969, 23.41935], [-12.36213, 23.3187], [-12.5741, 23.28975], [-13.00412, 23.02297], [-13.10753, 22.89493], [-13.15313, 22.75649], [-13.08438, 22.53866], [-13.01525, 21.33343], [-16.95474, 21.33997], [-16.99806, 21.12142], [-17.0357, 21.05368], [-17.0396, 20.9961], [-17.06781, 20.92697], [-17.0695, 20.85742], [-17.0471, 20.76408], [-17.15288, 16.07139], [-16.50854, 16.09032], [-16.48967, 16.0496], [-16.44814, 16.09753], [-16.4429, 16.20605], [-16.27016, 16.51565], [-15.6509, 16.50315], [-15.00557, 16.64997], [-14.32144, 16.61495], [-13.80075, 16.13961], [-13.43135, 16.09022], [-13.11029, 15.52116], [-12.23936, 14.76324], [-11.94903, 14.76143], [-11.70705, 15.51558], [-11.43483, 15.62339], [-10.90932, 15.11001], [-10.71721, 15.4223], [-9.40447, 15.4396], [-9.44673, 15.60553], [-9.33314, 15.7044], [-9.31106, 15.69412], [-9.32979, 15.50032], [-5.50165, 15.50061], [-5.33435, 16.33354], [-5.60725, 16.49919]]]] } },
22822 { type: "Feature", properties: { iso1A2: "MS", iso1A3: "MSR", iso1N3: "500", wikidata: "Q13353", nameEn: "Montserrat", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 664"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.91508, 16.51165], [-62.1023, 16.97277], [-62.58307, 16.68909], [-61.91508, 16.51165]]]] } },
22823 { type: "Feature", properties: { iso1A2: "MT", iso1A3: "MLT", iso1N3: "470", wikidata: "Q233", nameEn: "Malta", groups: ["EU", "039", "150", "UN"], driveSide: "left", callingCodes: ["356"] }, geometry: { type: "MultiPolygon", coordinates: [[[[15.70991, 35.79901], [14.07544, 36.41525], [13.27636, 35.20764], [15.70991, 35.79901]]]] } },
22824 { type: "Feature", properties: { iso1A2: "MU", iso1A3: "MUS", iso1N3: "480", wikidata: "Q1027", nameEn: "Mauritius", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["230"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.09755, -9.55401], [57.50644, -31.92637], [68.4673, -19.15185], [56.09755, -9.55401]]]] } },
22825 { type: "Feature", properties: { iso1A2: "MV", iso1A3: "MDV", iso1N3: "462", wikidata: "Q826", nameEn: "Maldives", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["960"] }, geometry: { type: "MultiPolygon", coordinates: [[[[71.9161, 8.55531], [72.57428, -3.7623], [76.59015, 5.591], [71.9161, 8.55531]]]] } },
22826 { type: "Feature", properties: { iso1A2: "MW", iso1A3: "MWI", iso1N3: "454", wikidata: "Q1020", nameEn: "Malawi", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["265"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.48052, -9.62442], [33.31581, -9.48554], [33.14925, -9.49322], [32.99397, -9.36712], [32.95389, -9.40138], [33.00476, -9.5133], [33.00256, -9.63053], [33.05485, -9.61316], [33.10163, -9.66525], [33.12144, -9.58929], [33.2095, -9.61099], [33.31517, -9.82364], [33.36581, -9.81063], [33.37902, -9.9104], [33.31297, -10.05133], [33.53863, -10.20148], [33.54797, -10.36077], [33.70675, -10.56896], [33.47636, -10.78465], [33.28022, -10.84428], [33.25998, -10.88862], [33.39697, -11.15296], [33.29267, -11.3789], [33.29267, -11.43536], [33.23663, -11.40637], [33.24252, -11.59302], [33.32692, -11.59248], [33.33937, -11.91252], [33.25998, -12.14242], [33.3705, -12.34931], [33.47636, -12.32498], [33.54485, -12.35996], [33.37517, -12.54085], [33.28177, -12.54692], [33.18837, -12.61377], [33.05917, -12.59554], [32.94397, -12.76868], [32.96733, -12.88251], [33.02181, -12.88707], [32.98289, -13.12671], [33.0078, -13.19492], [32.86113, -13.47292], [32.84176, -13.52794], [32.73683, -13.57682], [32.68436, -13.55769], [32.66468, -13.60019], [32.68654, -13.64268], [32.7828, -13.64805], [32.84528, -13.71576], [32.76962, -13.77224], [32.79015, -13.80755], [32.88985, -13.82956], [32.99042, -13.95689], [33.02977, -14.05022], [33.07568, -13.98447], [33.16749, -13.93992], [33.24249, -14.00019], [33.66677, -14.61306], [33.7247, -14.4989], [33.88503, -14.51652], [33.92898, -14.47929], [34.08588, -14.48893], [34.18733, -14.43823], [34.22355, -14.43607], [34.34453, -14.3985], [34.35843, -14.38652], [34.39277, -14.39467], [34.4192, -14.43191], [34.44641, -14.47746], [34.45053, -14.49873], [34.47628, -14.53363], [34.48932, -14.53646], [34.49636, -14.55091], [34.52366, -14.5667], [34.53962, -14.59776], [34.55112, -14.64494], [34.53516, -14.67782], [34.52057, -14.68263], [34.54503, -14.74672], [34.567, -14.77345], [34.61522, -14.99583], [34.57503, -15.30619], [34.43126, -15.44778], [34.44981, -15.60864], [34.25195, -15.90321], [34.43126, -16.04737], [34.40344, -16.20923], [35.04805, -16.83167], [35.13771, -16.81687], [35.17017, -16.93521], [35.04805, -17.00027], [35.0923, -17.13235], [35.3062, -17.1244], [35.27065, -16.93817], [35.30929, -16.82871], [35.27219, -16.69402], [35.14235, -16.56812], [35.25828, -16.4792], [35.30157, -16.2211], [35.43355, -16.11371], [35.52365, -16.15414], [35.70107, -16.10147], [35.80487, -16.03907], [35.85303, -15.41913], [35.78799, -15.17428], [35.91812, -14.89514], [35.87212, -14.89478], [35.86945, -14.67481], [35.5299, -14.27714], [35.47989, -14.15594], [34.86229, -13.48958], [34.60253, -13.48487], [34.37831, -12.17408], [34.46088, -12.0174], [34.70739, -12.15652], [34.82903, -12.04837], [34.57917, -11.87849], [34.64241, -11.57499], [34.96296, -11.57354], [34.91153, -11.39799], [34.79375, -11.32245], [34.63305, -11.11731], [34.61161, -11.01611], [34.67047, -10.93796], [34.65946, -10.6828], [34.57581, -10.56271], [34.51911, -10.12279], [34.54499, -10.0678], [34.03865, -9.49398], [33.95829, -9.54066], [33.9638, -9.62206], [33.93298, -9.71647], [33.76677, -9.58516], [33.48052, -9.62442]]]] } },
22827 { type: "Feature", properties: { iso1A2: "MX", iso1A3: "MEX", iso1N3: "484", wikidata: "Q96", nameEn: "Mexico", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["52"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-117.1243, 32.53427], [-118.48109, 32.5991], [-120.12904, 18.41089], [-92.37213, 14.39277], [-92.2261, 14.53423], [-92.1454, 14.6804], [-92.18161, 14.84147], [-92.1423, 14.88647], [-92.1454, 14.98143], [-92.0621, 15.07406], [-92.20983, 15.26077], [-91.73182, 16.07371], [-90.44567, 16.07573], [-90.40499, 16.40524], [-90.61212, 16.49832], [-90.69064, 16.70697], [-91.04436, 16.92175], [-91.43809, 17.25373], [-90.99199, 17.25192], [-90.98678, 17.81655], [-89.14985, 17.81563], [-89.15105, 17.95104], [-89.03839, 18.0067], [-88.8716, 17.89535], [-88.71505, 18.0707], [-88.48242, 18.49164], [-88.3268, 18.49048], [-88.29909, 18.47591], [-88.26593, 18.47617], [-88.03238, 18.41778], [-88.03165, 18.16657], [-87.90671, 18.15213], [-87.87604, 18.18313], [-87.86657, 18.19971], [-87.85693, 18.18266], [-87.84815, 18.18511], [-86.92368, 17.61462], [-85.9092, 21.8218], [-96.92418, 25.97377], [-97.13927, 25.96583], [-97.35946, 25.92189], [-97.37332, 25.83854], [-97.42511, 25.83969], [-97.45669, 25.86874], [-97.49828, 25.89877], [-97.52025, 25.88518], [-97.66511, 26.01708], [-97.95155, 26.0625], [-97.97017, 26.05232], [-98.24603, 26.07191], [-98.27075, 26.09457], [-98.30491, 26.10475], [-98.35126, 26.15129], [-99.00546, 26.3925], [-99.03053, 26.41249], [-99.08477, 26.39849], [-99.53573, 27.30926], [-99.49744, 27.43746], [-99.482, 27.47128], [-99.48045, 27.49016], [-99.50208, 27.50021], [-99.52955, 27.49747], [-99.51478, 27.55836], [-99.55409, 27.61314], [-100.50029, 28.66117], [-100.51222, 28.70679], [-100.5075, 28.74066], [-100.52313, 28.75598], [-100.59809, 28.88197], [-100.63689, 28.90812], [-100.67294, 29.09744], [-100.79696, 29.24688], [-100.87982, 29.296], [-100.94056, 29.33371], [-100.94579, 29.34523], [-100.96725, 29.3477], [-101.01128, 29.36947], [-101.05686, 29.44738], [-101.47277, 29.7744], [-102.60596, 29.8192], [-103.15787, 28.93865], [-104.37752, 29.54255], [-104.39363, 29.55396], [-104.3969, 29.57105], [-104.5171, 29.64671], [-104.77674, 30.4236], [-106.00363, 31.39181], [-106.09025, 31.40569], [-106.20346, 31.46305], [-106.23711, 31.51262], [-106.24612, 31.54193], [-106.28084, 31.56173], [-106.30305, 31.62154], [-106.33419, 31.66303], [-106.34864, 31.69663], [-106.3718, 31.71165], [-106.38003, 31.73151], [-106.41773, 31.75196], [-106.43419, 31.75478], [-106.45244, 31.76523], [-106.46726, 31.75998], [-106.47298, 31.75054], [-106.48815, 31.74769], [-106.50111, 31.75714], [-106.50962, 31.76155], [-106.51251, 31.76922], [-106.52266, 31.77509], [-106.529, 31.784], [-108.20899, 31.78534], [-108.20979, 31.33316], [-111.07523, 31.33232], [-114.82011, 32.49609], [-114.79524, 32.55731], [-114.81141, 32.55543], [-114.80584, 32.62028], [-114.76736, 32.64094], [-114.71871, 32.71894], [-115.88053, 32.63624], [-117.1243, 32.53427]]]] } },
22828 { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
22829 { type: "Feature", properties: { iso1A2: "MZ", iso1A3: "MOZ", iso1N3: "508", wikidata: "Q1029", nameEn: "Mozambique", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["258"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.74206, -10.25691], [40.44265, -10.4618], [40.00295, -10.80255], [39.58249, -10.96043], [39.24395, -11.17433], [38.88996, -11.16978], [38.47258, -11.4199], [38.21598, -11.27289], [37.93618, -11.26228], [37.8388, -11.3123], [37.76614, -11.53352], [37.3936, -11.68949], [36.80309, -11.56836], [36.62068, -11.72884], [36.19094, -11.70008], [36.19094, -11.57593], [35.82767, -11.41081], [35.63599, -11.55927], [34.96296, -11.57354], [34.64241, -11.57499], [34.57917, -11.87849], [34.82903, -12.04837], [34.70739, -12.15652], [34.46088, -12.0174], [34.37831, -12.17408], [34.60253, -13.48487], [34.86229, -13.48958], [35.47989, -14.15594], [35.5299, -14.27714], [35.86945, -14.67481], [35.87212, -14.89478], [35.91812, -14.89514], [35.78799, -15.17428], [35.85303, -15.41913], [35.80487, -16.03907], [35.70107, -16.10147], [35.52365, -16.15414], [35.43355, -16.11371], [35.30157, -16.2211], [35.25828, -16.4792], [35.14235, -16.56812], [35.27219, -16.69402], [35.30929, -16.82871], [35.27065, -16.93817], [35.3062, -17.1244], [35.0923, -17.13235], [35.04805, -17.00027], [35.17017, -16.93521], [35.13771, -16.81687], [35.04805, -16.83167], [34.40344, -16.20923], [34.43126, -16.04737], [34.25195, -15.90321], [34.44981, -15.60864], [34.43126, -15.44778], [34.57503, -15.30619], [34.61522, -14.99583], [34.567, -14.77345], [34.54503, -14.74672], [34.52057, -14.68263], [34.53516, -14.67782], [34.55112, -14.64494], [34.53962, -14.59776], [34.52366, -14.5667], [34.49636, -14.55091], [34.48932, -14.53646], [34.47628, -14.53363], [34.45053, -14.49873], [34.44641, -14.47746], [34.4192, -14.43191], [34.39277, -14.39467], [34.35843, -14.38652], [34.34453, -14.3985], [34.22355, -14.43607], [34.18733, -14.43823], [34.08588, -14.48893], [33.92898, -14.47929], [33.88503, -14.51652], [33.7247, -14.4989], [33.66677, -14.61306], [33.24249, -14.00019], [30.22098, -14.99447], [30.41902, -15.62269], [30.42568, -15.9962], [30.91597, -15.99924], [30.97761, -16.05848], [31.13171, -15.98019], [31.30563, -16.01193], [31.42451, -16.15154], [31.67988, -16.19595], [31.90223, -16.34388], [31.91324, -16.41569], [32.02772, -16.43892], [32.28529, -16.43892], [32.42838, -16.4727], [32.71017, -16.59932], [32.69917, -16.66893], [32.78943, -16.70267], [32.97655, -16.70689], [32.91051, -16.89446], [32.84113, -16.92259], [32.96554, -17.11971], [33.00517, -17.30477], [33.0426, -17.3468], [32.96554, -17.48964], [32.98536, -17.55891], [33.0492, -17.60298], [32.94133, -17.99705], [33.03159, -18.35054], [33.02278, -18.4696], [32.88629, -18.51344], [32.88629, -18.58023], [32.95013, -18.69079], [32.9017, -18.7992], [32.82465, -18.77419], [32.70137, -18.84712], [32.73439, -18.92628], [32.69917, -18.94293], [32.72118, -19.02204], [32.84006, -19.0262], [32.87088, -19.09279], [32.85107, -19.29238], [32.77966, -19.36098], [32.78282, -19.47513], [32.84446, -19.48343], [32.84666, -19.68462], [32.95013, -19.67219], [33.06461, -19.77787], [33.01178, -20.02007], [32.93032, -20.03868], [32.85987, -20.16686], [32.85987, -20.27841], [32.66174, -20.56106], [32.55167, -20.56312], [32.48122, -20.63319], [32.51644, -20.91929], [32.37115, -21.133], [32.48236, -21.32873], [32.41234, -21.31246], [31.38336, -22.36919], [31.30611, -22.422], [31.55779, -23.176], [31.56539, -23.47268], [31.67942, -23.60858], [31.70223, -23.72695], [31.77445, -23.90082], [31.87707, -23.95293], [31.90368, -24.18892], [31.9835, -24.29983], [32.03196, -25.10785], [32.01676, -25.38117], [31.97875, -25.46356], [32.00631, -25.65044], [31.92649, -25.84216], [31.974, -25.95387], [32.00916, -25.999], [32.08599, -26.00978], [32.10435, -26.15656], [32.07352, -26.40185], [32.13409, -26.5317], [32.13315, -26.84345], [32.19409, -26.84032], [32.22302, -26.84136], [32.29584, -26.852], [32.35222, -26.86027], [34.51034, -26.91792], [42.99868, -12.65261], [40.74206, -10.25691]]]] } },
22830 { type: "Feature", properties: { iso1A2: "NA", iso1A3: "NAM", iso1N3: "516", wikidata: "Q1030", nameEn: "Namibia", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["264"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.28743, -17.38814], [13.95896, -17.43141], [13.36212, -16.98048], [12.97145, -16.98567], [12.52111, -17.24495], [12.07076, -17.15165], [11.75063, -17.25013], [10.5065, -17.25284], [12.51595, -32.27486], [16.45332, -28.63117], [16.46592, -28.57126], [16.59922, -28.53246], [16.90446, -28.057], [17.15405, -28.08573], [17.4579, -28.68718], [18.99885, -28.89165], [19.99882, -28.42622], [19.99817, -24.76768], [19.99912, -21.99991], [20.99751, -22.00026], [20.99904, -18.31743], [21.45556, -18.31795], [23.0996, -18.00075], [23.29618, -17.99855], [23.61088, -18.4881], [24.19416, -18.01919], [24.40577, -17.95726], [24.57485, -18.07151], [24.6303, -17.9863], [24.71887, -17.9218], [24.73364, -17.89338], [24.95586, -17.79674], [25.05895, -17.84452], [25.16882, -17.78253], [25.26433, -17.79571], [25.00198, -17.58221], [24.70864, -17.49501], [24.5621, -17.52963], [24.38712, -17.46818], [24.32811, -17.49082], [24.23619, -17.47489], [23.47474, -17.62877], [21.42741, -18.02787], [21.14283, -17.94318], [18.84226, -17.80375], [18.39229, -17.38927], [14.28743, -17.38814]]]] } },
22831 { type: "Feature", properties: { iso1A2: "NC", iso1A3: "NCL", iso1N3: "540", wikidata: "Q33788", nameEn: "New Caledonia", country: "FR", groups: ["EU", "Q1451600", "054", "009", "UN"], callingCodes: ["687"] }, geometry: { type: "MultiPolygon", coordinates: [[[[159.77159, -28.41151], [174.245, -23.1974], [156.73836, -14.50464], [159.77159, -28.41151]]]] } },
22832 { type: "Feature", properties: { iso1A2: "NE", iso1A3: "NER", iso1N3: "562", wikidata: "Q1032", nameEn: "Niger", aliases: ["RN"], groups: ["011", "202", "002", "UN"], callingCodes: ["227"] }, geometry: { type: "MultiPolygon", coordinates: [[[[14.22918, 22.61719], [13.5631, 23.16574], [11.96886, 23.51735], [7.48273, 20.87258], [7.38361, 20.79165], [5.8153, 19.45101], [4.26651, 19.14224], [4.26762, 17.00432], [4.21787, 17.00118], [4.19893, 16.39923], [3.50368, 15.35934], [3.03134, 15.42221], [3.01806, 15.34571], [1.31275, 15.27978], [0.96711, 14.98275], [0.72632, 14.95898], [0.23859, 15.00135], [0.16936, 14.51654], [0.38051, 14.05575], [0.61924, 13.68491], [0.77377, 13.6866], [0.77637, 13.64442], [0.99514, 13.5668], [1.02813, 13.46635], [1.20088, 13.38951], [1.24429, 13.39373], [1.28509, 13.35488], [1.24516, 13.33968], [1.21217, 13.37853], [1.18873, 13.31771], [0.99253, 13.37515], [0.99167, 13.10727], [2.26349, 12.41915], [2.05785, 12.35539], [2.39723, 11.89473], [2.45824, 11.98672], [2.39657, 12.10952], [2.37783, 12.24804], [2.6593, 12.30631], [2.83978, 12.40585], [3.25352, 12.01467], [3.31613, 11.88495], [3.48187, 11.86092], [3.59375, 11.70269], [3.61075, 11.69181], [3.67988, 11.75429], [3.67122, 11.80865], [3.63063, 11.83042], [3.61955, 11.91847], [3.67775, 11.97599], [3.63136, 12.11826], [3.66364, 12.25884], [3.65111, 12.52223], [3.94339, 12.74979], [4.10006, 12.98862], [4.14367, 13.17189], [4.14186, 13.47586], [4.23456, 13.47725], [4.4668, 13.68286], [4.87425, 13.78], [4.9368, 13.7345], [5.07396, 13.75052], [5.21026, 13.73627], [5.27797, 13.75474], [5.35437, 13.83567], [5.52957, 13.8845], [6.15771, 13.64564], [6.27411, 13.67835], [6.43053, 13.6006], [6.69617, 13.34057], [6.94445, 12.99825], [7.0521, 13.00076], [7.12676, 13.02445], [7.22399, 13.1293], [7.39241, 13.09717], [7.81085, 13.34902], [8.07997, 13.30847], [8.25185, 13.20369], [8.41853, 13.06166], [8.49493, 13.07519], [8.60431, 13.01768], [8.64251, 12.93985], [8.97413, 12.83661], [9.65995, 12.80614], [10.00373, 13.18171], [10.19993, 13.27129], [10.46731, 13.28819], [10.66004, 13.36422], [11.4535, 13.37773], [11.88236, 13.2527], [12.04209, 13.14452], [12.16189, 13.10056], [12.19315, 13.12423], [12.47095, 13.06673], [12.58033, 13.27805], [12.6793, 13.29157], [12.87376, 13.48919], [13.05085, 13.53984], [13.19844, 13.52802], [13.33213, 13.71195], [13.6302, 13.71094], [13.47559, 14.40881], [13.48259, 14.46704], [13.68573, 14.55276], [13.67878, 14.64013], [13.809, 14.72915], [13.78991, 14.87519], [13.86301, 15.04043], [14.37425, 15.72591], [15.50373, 16.89649], [15.6032, 18.77402], [15.75098, 19.93002], [15.99632, 20.35364], [15.6721, 20.70069], [15.59841, 20.74039], [15.56004, 20.79488], [15.55382, 20.86507], [15.57248, 20.92138], [15.62515, 20.95395], [15.28332, 21.44557], [15.20213, 21.49365], [15.19692, 21.99339], [14.99751, 23.00539], [14.22918, 22.61719]]]] } },
22833 { type: "Feature", properties: { iso1A2: "NF", iso1A3: "NFK", iso1N3: "574", wikidata: "Q31057", nameEn: "Norfolk Island", country: "AU", groups: ["053", "009", "UN"], driveSide: "left", callingCodes: ["672 3"] }, geometry: { type: "MultiPolygon", coordinates: [[[[169.82316, -28.16667], [166.29505, -28.29175], [167.94076, -30.60745], [169.82316, -28.16667]]]] } },
22834 { type: "Feature", properties: { iso1A2: "NG", iso1A3: "NGA", iso1N3: "566", wikidata: "Q1033", nameEn: "Nigeria", groups: ["011", "202", "002", "UN"], callingCodes: ["234"] }, geometry: { type: "MultiPolygon", coordinates: [[[[6.15771, 13.64564], [5.52957, 13.8845], [5.35437, 13.83567], [5.27797, 13.75474], [5.21026, 13.73627], [5.07396, 13.75052], [4.9368, 13.7345], [4.87425, 13.78], [4.4668, 13.68286], [4.23456, 13.47725], [4.14186, 13.47586], [4.14367, 13.17189], [4.10006, 12.98862], [3.94339, 12.74979], [3.65111, 12.52223], [3.66364, 12.25884], [3.63136, 12.11826], [3.67775, 11.97599], [3.61955, 11.91847], [3.63063, 11.83042], [3.67122, 11.80865], [3.67988, 11.75429], [3.61075, 11.69181], [3.59375, 11.70269], [3.49175, 11.29765], [3.71505, 11.13015], [3.84243, 10.59316], [3.78292, 10.40538], [3.6844, 10.46351], [3.57275, 10.27185], [3.66908, 10.18136], [3.54429, 9.87739], [3.35383, 9.83641], [3.32099, 9.78032], [3.34726, 9.70696], [3.25093, 9.61632], [3.13928, 9.47167], [3.14147, 9.28375], [3.08017, 9.10006], [2.77907, 9.06924], [2.67523, 7.87825], [2.73095, 7.7755], [2.73405, 7.5423], [2.78668, 7.5116], [2.79442, 7.43486], [2.74489, 7.42565], [2.76965, 7.13543], [2.71702, 6.95722], [2.74024, 6.92802], [2.73405, 6.78508], [2.78823, 6.76356], [2.78204, 6.70514], [2.7325, 6.64057], [2.74334, 6.57291], [2.70464, 6.50831], [2.70566, 6.38038], [2.74181, 6.13349], [5.87055, 3.78489], [8.34397, 4.30689], [8.60302, 4.87353], [8.78027, 5.1243], [8.92029, 5.58403], [8.83687, 5.68483], [8.88156, 5.78857], [8.84209, 5.82562], [9.51757, 6.43874], [9.70674, 6.51717], [9.77824, 6.79088], [9.86314, 6.77756], [10.15135, 7.03781], [10.21466, 6.88996], [10.53639, 6.93432], [10.57214, 7.16345], [10.59746, 7.14719], [10.60789, 7.06885], [10.83727, 6.9358], [10.8179, 6.83377], [10.94302, 6.69325], [11.09644, 6.68437], [11.09495, 6.51717], [11.42041, 6.53789], [11.42264, 6.5882], [11.51499, 6.60892], [11.57755, 6.74059], [11.55818, 6.86186], [11.63117, 6.9905], [11.87396, 7.09398], [11.84864, 7.26098], [11.93205, 7.47812], [12.01844, 7.52981], [11.99908, 7.67302], [12.20909, 7.97553], [12.19271, 8.10826], [12.24782, 8.17904], [12.26123, 8.43696], [12.4489, 8.52536], [12.44146, 8.6152], [12.68722, 8.65938], [12.71701, 8.7595], [12.79, 8.75361], [12.81085, 8.91992], [12.90022, 9.11411], [12.91958, 9.33905], [12.85628, 9.36698], [13.02385, 9.49334], [13.22642, 9.57266], [13.25472, 9.76795], [13.29941, 9.8296], [13.25025, 9.86042], [13.24132, 9.91031], [13.27409, 9.93232], [13.286, 9.9822], [13.25323, 10.00127], [13.25025, 10.03647], [13.34111, 10.12299], [13.43644, 10.13326], [13.5705, 10.53183], [13.54964, 10.61236], [13.73434, 10.9255], [13.70753, 10.94451], [13.7403, 11.00593], [13.78945, 11.00154], [13.97489, 11.30258], [14.17821, 11.23831], [14.6124, 11.51283], [14.64591, 11.66166], [14.55207, 11.72001], [14.61612, 11.7798], [14.6474, 12.17466], [14.4843, 12.35223], [14.22215, 12.36533], [14.17523, 12.41916], [14.20204, 12.53405], [14.08251, 13.0797], [13.6302, 13.71094], [13.33213, 13.71195], [13.19844, 13.52802], [13.05085, 13.53984], [12.87376, 13.48919], [12.6793, 13.29157], [12.58033, 13.27805], [12.47095, 13.06673], [12.19315, 13.12423], [12.16189, 13.10056], [12.04209, 13.14452], [11.88236, 13.2527], [11.4535, 13.37773], [10.66004, 13.36422], [10.46731, 13.28819], [10.19993, 13.27129], [10.00373, 13.18171], [9.65995, 12.80614], [8.97413, 12.83661], [8.64251, 12.93985], [8.60431, 13.01768], [8.49493, 13.07519], [8.41853, 13.06166], [8.25185, 13.20369], [8.07997, 13.30847], [7.81085, 13.34902], [7.39241, 13.09717], [7.22399, 13.1293], [7.12676, 13.02445], [7.0521, 13.00076], [6.94445, 12.99825], [6.69617, 13.34057], [6.43053, 13.6006], [6.27411, 13.67835], [6.15771, 13.64564]]]] } },
22835 { type: "Feature", properties: { iso1A2: "NI", iso1A3: "NIC", iso1N3: "558", wikidata: "Q811", nameEn: "Nicaragua", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["505"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-83.13724, 15.00002], [-83.49268, 15.01158], [-83.62101, 14.89448], [-83.89551, 14.76697], [-84.10584, 14.76353], [-84.48373, 14.63249], [-84.70119, 14.68078], [-84.82596, 14.82212], [-84.90082, 14.80489], [-85.1575, 14.53934], [-85.18602, 14.24929], [-85.32149, 14.2562], [-85.45762, 14.11304], [-85.73964, 13.9698], [-85.75477, 13.8499], [-86.03458, 13.99181], [-86.00685, 14.08474], [-86.14801, 14.04317], [-86.35219, 13.77157], [-86.76812, 13.79605], [-86.71267, 13.30348], [-86.87066, 13.30641], [-86.93383, 13.18677], [-86.93197, 13.05313], [-87.03785, 12.98682], [-87.06306, 13.00892], [-87.37107, 12.98646], [-87.55124, 13.12523], [-87.7346, 13.13228], [-88.11443, 12.63306], [-86.14524, 11.09059], [-85.71223, 11.06868], [-85.60529, 11.22607], [-84.92439, 10.9497], [-84.68197, 11.07568], [-83.90838, 10.71161], [-83.66597, 10.79916], [-83.68276, 11.01562], [-82.56142, 11.91792], [-82.06974, 14.49418], [-83.04763, 15.03256], [-83.13724, 15.00002]]]] } },
22836 { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
22837 { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
22838 { type: "Feature", properties: { iso1A2: "NP", iso1A3: "NPL", iso1N3: "524", wikidata: "Q837", nameEn: "Nepal", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["977"] }, geometry: { type: "MultiPolygon", coordinates: [[[[88.13378, 27.88015], [87.82681, 27.95248], [87.72718, 27.80938], [87.56996, 27.84517], [87.11696, 27.84104], [87.03757, 27.94835], [86.75582, 28.04182], [86.74181, 28.10638], [86.56265, 28.09569], [86.51609, 27.96623], [86.42736, 27.91122], [86.22966, 27.9786], [86.18607, 28.17364], [86.088, 28.09264], [86.08333, 28.02121], [86.12069, 27.93047], [86.06309, 27.90021], [85.94946, 27.9401], [85.97813, 27.99023], [85.90743, 28.05144], [85.84672, 28.18187], [85.74864, 28.23126], [85.71907, 28.38064], [85.69105, 28.38475], [85.60854, 28.25045], [85.59765, 28.30529], [85.4233, 28.32996], [85.38127, 28.28336], [85.10729, 28.34092], [85.18668, 28.54076], [85.19135, 28.62825], [85.06059, 28.68562], [84.85511, 28.58041], [84.62317, 28.73887], [84.47528, 28.74023], [84.2231, 28.89571], [84.24801, 29.02783], [84.18107, 29.23451], [83.97559, 29.33091], [83.82303, 29.30513], [83.63156, 29.16249], [83.44787, 29.30513], [83.28131, 29.56813], [83.07116, 29.61957], [82.73024, 29.81695], [82.5341, 29.9735], [82.38622, 30.02608], [82.16984, 30.0692], [82.19475, 30.16884], [82.10757, 30.23745], [82.10135, 30.35439], [81.99082, 30.33423], [81.62033, 30.44703], [81.5459, 30.37688], [81.41018, 30.42153], [81.39928, 30.21862], [81.33355, 30.15303], [81.2623, 30.14596], [81.29032, 30.08806], [81.24362, 30.0126], [81.12842, 30.01395], [81.03953, 30.20059], [80.92547, 30.17193], [80.91143, 30.22173], [80.86673, 30.17321], [80.8778, 30.13384], [80.67076, 29.95732], [80.60226, 29.95732], [80.57179, 29.91422], [80.56247, 29.86661], [80.48997, 29.79566], [80.43458, 29.80466], [80.41554, 29.79451], [80.36803, 29.73865], [80.38428, 29.68513], [80.41858, 29.63581], [80.37939, 29.57098], [80.24322, 29.44299], [80.31428, 29.30784], [80.28626, 29.20327], [80.24112, 29.21414], [80.26602, 29.13938], [80.23178, 29.11626], [80.18085, 29.13649], [80.05743, 28.91479], [80.06957, 28.82763], [80.12125, 28.82346], [80.37188, 28.63371], [80.44504, 28.63098], [80.52443, 28.54897], [80.50575, 28.6706], [80.55142, 28.69182], [81.03471, 28.40054], [81.19847, 28.36284], [81.32923, 28.13521], [81.38683, 28.17638], [81.48179, 28.12148], [81.47867, 28.08303], [81.91223, 27.84995], [81.97214, 27.93322], [82.06554, 27.92222], [82.46405, 27.6716], [82.70378, 27.72122], [82.74119, 27.49838], [82.93261, 27.50328], [82.94938, 27.46036], [83.19413, 27.45632], [83.27197, 27.38309], [83.2673, 27.36235], [83.29999, 27.32778], [83.35136, 27.33885], [83.38872, 27.39276], [83.39495, 27.4798], [83.61288, 27.47013], [83.85595, 27.35797], [83.86182, 27.4241], [83.93306, 27.44939], [84.02229, 27.43836], [84.10791, 27.52399], [84.21376, 27.45218], [84.25735, 27.44941], [84.29315, 27.39], [84.62161, 27.33885], [84.69166, 27.21294], [84.64496, 27.04669], [84.793, 26.9968], [84.82913, 27.01989], [84.85754, 26.98984], [84.96687, 26.95599], [84.97186, 26.9149], [85.00536, 26.89523], [85.05592, 26.88991], [85.02635, 26.85381], [85.15883, 26.86966], [85.19291, 26.86909], [85.18046, 26.80519], [85.21159, 26.75933], [85.34302, 26.74954], [85.47752, 26.79292], [85.56471, 26.84133], [85.5757, 26.85955], [85.59461, 26.85161], [85.61621, 26.86721], [85.66239, 26.84822], [85.73483, 26.79613], [85.72315, 26.67471], [85.76907, 26.63076], [85.83126, 26.61134], [85.85126, 26.60866], [85.8492, 26.56667], [86.02729, 26.66756], [86.13596, 26.60651], [86.22513, 26.58863], [86.26235, 26.61886], [86.31564, 26.61925], [86.49726, 26.54218], [86.54258, 26.53819], [86.57073, 26.49825], [86.61313, 26.48658], [86.62686, 26.46891], [86.69124, 26.45169], [86.74025, 26.42386], [86.76797, 26.45892], [86.82898, 26.43919], [86.94543, 26.52076], [86.95912, 26.52076], [87.01559, 26.53228], [87.04691, 26.58685], [87.0707, 26.58571], [87.09147, 26.45039], [87.14751, 26.40542], [87.18863, 26.40558], [87.24682, 26.4143], [87.26587, 26.40592], [87.26568, 26.37294], [87.34568, 26.34787], [87.37314, 26.40815], [87.46566, 26.44058], [87.51571, 26.43106], [87.55274, 26.40596], [87.59175, 26.38342], [87.66803, 26.40294], [87.67893, 26.43501], [87.76004, 26.40711], [87.7918, 26.46737], [87.84193, 26.43663], [87.89085, 26.48565], [87.90115, 26.44923], [88.00895, 26.36029], [88.09414, 26.43732], [88.09963, 26.54195], [88.16452, 26.64111], [88.1659, 26.68177], [88.19107, 26.75516], [88.12302, 26.95324], [88.13422, 26.98705], [88.11719, 26.98758], [87.9887, 27.11045], [88.01587, 27.21388], [88.01646, 27.21612], [88.07277, 27.43007], [88.04008, 27.49223], [88.19107, 27.79285], [88.1973, 27.85067], [88.13378, 27.88015]]]] } },
22839 { type: "Feature", properties: { iso1A2: "NR", iso1A3: "NRU", iso1N3: "520", wikidata: "Q697", nameEn: "Nauru", groups: ["057", "009", "UN"], driveSide: "left", callingCodes: ["674"] }, geometry: { type: "MultiPolygon", coordinates: [[[[166.95155, 0.14829], [166.21778, -0.7977], [167.60042, -0.88259], [166.95155, 0.14829]]]] } },
22840 { type: "Feature", properties: { iso1A2: "NU", iso1A3: "NIU", iso1N3: "570", wikidata: "Q34020", nameEn: "Niue", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["683"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-170.83899, -18.53439], [-170.82274, -20.44429], [-168.63096, -18.60489], [-170.83899, -18.53439]]]] } },
22841 { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
22842 { type: "Feature", properties: { iso1A2: "OM", iso1A3: "OMN", iso1N3: "512", wikidata: "Q842", nameEn: "Oman", groups: ["145", "142", "UN"], callingCodes: ["968"] }, geometry: { type: "MultiPolygon", coordinates: [[[[56.82555, 25.7713], [56.79239, 26.41236], [56.68954, 26.76645], [56.2644, 26.58649], [55.81777, 26.18798], [56.08666, 26.05038], [56.15498, 26.06828], [56.19334, 25.9795], [56.13963, 25.82765], [56.17416, 25.77239], [56.13579, 25.73524], [56.14826, 25.66351], [56.18363, 25.65508], [56.20473, 25.61119], [56.25365, 25.60211], [56.26636, 25.60643], [56.25341, 25.61443], [56.26534, 25.62825], [56.82555, 25.7713]]], [[[56.26062, 25.33108], [56.23362, 25.31253], [56.25008, 25.28843], [56.24465, 25.27505], [56.20838, 25.25668], [56.20872, 25.24104], [56.24341, 25.22867], [56.27628, 25.23404], [56.34438, 25.26653], [56.35172, 25.30681], [56.3111, 25.30107], [56.3005, 25.31815], [56.26062, 25.33108]], [[56.28423, 25.26344], [56.27086, 25.26128], [56.2716, 25.27916], [56.28102, 25.28486], [56.29379, 25.2754], [56.28423, 25.26344]]], [[[61.45114, 22.55394], [56.86325, 25.03856], [56.3227, 24.97284], [56.34873, 24.93205], [56.30269, 24.88334], [56.20568, 24.85063], [56.20062, 24.78565], [56.13684, 24.73699], [56.06128, 24.74457], [56.03535, 24.81161], [55.97836, 24.87673], [55.97467, 24.89639], [56.05106, 24.87461], [56.05715, 24.95727], [55.96316, 25.00857], [55.90849, 24.96771], [55.85094, 24.96858], [55.81116, 24.9116], [55.81348, 24.80102], [55.83408, 24.77858], [55.83271, 24.68567], [55.76461, 24.5287], [55.83271, 24.41521], [55.83395, 24.32776], [55.80747, 24.31069], [55.79145, 24.27914], [55.76781, 24.26209], [55.75939, 24.26114], [55.75382, 24.2466], [55.75257, 24.23466], [55.76558, 24.23227], [55.77658, 24.23476], [55.83367, 24.20193], [55.95472, 24.2172], [56.01799, 24.07426], [55.8308, 24.01633], [55.73301, 24.05994], [55.48677, 23.94946], [55.57358, 23.669], [55.22634, 23.10378], [55.2137, 22.71065], [55.66469, 21.99658], [54.99756, 20.00083], [52.00311, 19.00083], [52.78009, 17.35124], [52.74267, 17.29519], [52.81185, 17.28568], [57.49095, 8.14549], [61.45114, 22.55394]]]] } },
22843 { type: "Feature", properties: { iso1A2: "PA", iso1A3: "PAN", iso1N3: "591", wikidata: "Q804", nameEn: "Panama", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["507"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-77.32389, 8.81247], [-77.58292, 9.22278], [-78.79327, 9.93766], [-82.51044, 9.65379], [-82.56507, 9.57279], [-82.61345, 9.49881], [-82.66667, 9.49746], [-82.77206, 9.59573], [-82.87919, 9.62645], [-82.84871, 9.4973], [-82.93516, 9.46741], [-82.93516, 9.07687], [-82.72126, 8.97125], [-82.88253, 8.83331], [-82.91377, 8.774], [-82.92068, 8.74832], [-82.8794, 8.6981], [-82.82739, 8.60153], [-82.83975, 8.54755], [-82.83322, 8.52464], [-82.8382, 8.48117], [-82.8679, 8.44042], [-82.93056, 8.43465], [-83.05209, 8.33394], [-82.9388, 8.26634], [-82.88641, 8.10219], [-82.89137, 8.05755], [-82.89978, 8.04083], [-82.94503, 7.93865], [-82.13751, 6.97312], [-78.06168, 7.07793], [-77.89178, 7.22681], [-77.81426, 7.48319], [-77.72157, 7.47612], [-77.72514, 7.72348], [-77.57185, 7.51147], [-77.17257, 7.97422], [-77.45064, 8.49991], [-77.32389, 8.81247]]]] } },
22844 { type: "Feature", properties: { iso1A2: "PE", iso1A3: "PER", iso1N3: "604", wikidata: "Q419", nameEn: "Peru", groups: ["005", "419", "019", "UN"], callingCodes: ["51"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-74.26675, -0.97229], [-74.42701, -0.50218], [-75.18513, -0.0308], [-75.25764, -0.11943], [-75.40192, -0.17196], [-75.61997, -0.10012], [-75.60169, -0.18708], [-75.53615, -0.19213], [-75.22862, -0.60048], [-75.22862, -0.95588], [-75.3872, -0.9374], [-75.57429, -1.55961], [-76.05203, -2.12179], [-76.6324, -2.58397], [-77.94147, -3.05454], [-78.19369, -3.36431], [-78.14324, -3.47653], [-78.22642, -3.51113], [-78.24589, -3.39907], [-78.34362, -3.38633], [-78.68394, -4.60754], [-78.85149, -4.66795], [-79.01659, -5.01481], [-79.1162, -4.97774], [-79.26248, -4.95167], [-79.59402, -4.46848], [-79.79722, -4.47558], [-80.13945, -4.29786], [-80.39256, -4.48269], [-80.46386, -4.41516], [-80.32114, -4.21323], [-80.45023, -4.20938], [-80.4822, -4.05477], [-80.46386, -4.01342], [-80.13232, -3.90317], [-80.19926, -3.68894], [-80.18741, -3.63994], [-80.19848, -3.59249], [-80.21642, -3.5888], [-80.20535, -3.51667], [-80.22629, -3.501], [-80.23651, -3.48652], [-80.24586, -3.48677], [-80.24123, -3.46124], [-80.20647, -3.431], [-80.30602, -3.39149], [-84.52388, -3.36941], [-85.71054, -21.15413], [-70.59118, -18.35072], [-70.378, -18.3495], [-70.31267, -18.31258], [-70.16394, -18.31737], [-69.96732, -18.25992], [-69.81607, -18.12582], [-69.75305, -17.94605], [-69.82868, -17.72048], [-69.79087, -17.65563], [-69.66483, -17.65083], [-69.46897, -17.4988], [-69.46863, -17.37466], [-69.62883, -17.28142], [-69.16896, -16.72233], [-69.00853, -16.66769], [-69.04027, -16.57214], [-68.98358, -16.42165], [-68.79464, -16.33272], [-68.96238, -16.194], [-69.09986, -16.22693], [-69.20291, -16.16668], [-69.40336, -15.61358], [-69.14856, -15.23478], [-69.36254, -14.94634], [-68.88135, -14.18639], [-69.05265, -13.68546], [-68.8864, -13.40792], [-68.85615, -12.87769], [-68.65044, -12.50689], [-68.98115, -11.8979], [-69.57156, -10.94555], [-69.57835, -10.94051], [-69.90896, -10.92744], [-70.38791, -11.07096], [-70.51395, -10.92249], [-70.64134, -11.0108], [-70.62487, -9.80666], [-70.55429, -9.76692], [-70.58453, -9.58303], [-70.53373, -9.42628], [-71.23394, -9.9668], [-72.14742, -9.98049], [-72.31883, -9.5184], [-72.72216, -9.41397], [-73.21498, -9.40904], [-72.92886, -9.04074], [-73.76576, -7.89884], [-73.65485, -7.77897], [-73.96938, -7.58465], [-73.77011, -7.28944], [-73.73986, -6.87919], [-73.12983, -6.43852], [-73.24579, -6.05764], [-72.83973, -5.14765], [-72.64391, -5.0391], [-71.87003, -4.51661], [-70.96814, -4.36915], [-70.77601, -4.15717], [-70.33236, -4.15214], [-70.19582, -4.3607], [-70.11305, -4.27281], [-70.00888, -4.37833], [-69.94708, -4.2431], [-70.3374, -3.79505], [-70.52393, -3.87553], [-70.71396, -3.7921], [-70.04609, -2.73906], [-70.94377, -2.23142], [-71.75223, -2.15058], [-72.92587, -2.44514], [-73.65312, -1.26222], [-74.26675, -0.97229]]]] } },
22845 { type: "Feature", properties: { iso1A2: "PF", iso1A3: "PYF", iso1N3: "258", wikidata: "Q30971", nameEn: "French Polynesia", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["689"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-135.59706, -4.70473], [-156.48634, -15.52824], [-156.45576, -31.75456], [-133.59543, -28.4709], [-135.59706, -4.70473]]]] } },
22846 { type: "Feature", properties: { iso1A2: "PG", iso1A3: "PNG", iso1N3: "598", wikidata: "Q691", nameEn: "Papua New Guinea", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["675"] }, geometry: { type: "MultiPolygon", coordinates: [[[[141.03157, 2.12829], [140.99813, -6.3233], [140.85295, -6.72996], [140.90448, -6.85033], [141.01763, -6.90181], [141.01842, -9.35091], [141.88934, -9.36111], [142.19246, -9.15378], [142.48658, -9.36754], [143.29772, -9.33993], [143.87386, -9.02382], [145.2855, -9.62524], [156.73836, -14.50464], [154.74815, -7.33315], [155.60735, -6.92266], [155.69784, -6.92661], [155.92557, -6.84664], [156.03993, -6.65703], [156.03296, -6.55528], [160.43769, -4.17974], [141.03157, 2.12829]]]] } },
22847 { type: "Feature", properties: { iso1A2: "PH", iso1A3: "PHL", iso1N3: "608", wikidata: "Q928", nameEn: "Philippines", aliases: ["PI", "RP"], groups: ["035", "142", "UN"], callingCodes: ["63"] }, geometry: { type: "MultiPolygon", coordinates: [[[[129.19694, 7.84182], [121.8109, 21.77688], [120.69238, 21.52331], [118.82252, 14.67191], [115.39742, 10.92666], [116.79524, 7.43869], [117.17735, 7.52841], [117.93857, 6.89845], [117.98544, 6.27477], [119.52945, 5.35672], [118.93936, 4.09009], [118.06469, 4.16638], [121.14448, 2.12444], [129.19694, 7.84182]]]] } },
22848 { type: "Feature", properties: { iso1A2: "PK", iso1A3: "PAK", iso1N3: "586", wikidata: "Q843", nameEn: "Pakistan", groups: ["034", "142", "UN"], driveSide: "left", callingCodes: ["92"] }, geometry: { type: "MultiPolygon", coordinates: [[[[75.72737, 36.7529], [75.45562, 36.71971], [75.40481, 36.95382], [75.13839, 37.02622], [74.56453, 37.03023], [74.53739, 36.96224], [74.43389, 37.00977], [74.04856, 36.82648], [73.82685, 36.91421], [72.6323, 36.84601], [72.18135, 36.71838], [71.80267, 36.49924], [71.60491, 36.39429], [71.19505, 36.04134], [71.37969, 35.95865], [71.55273, 35.71483], [71.49917, 35.6267], [71.65435, 35.4479], [71.54294, 35.31037], [71.5541, 35.28776], [71.67495, 35.21262], [71.52938, 35.09023], [71.55273, 35.02615], [71.49917, 35.00478], [71.50329, 34.97328], [71.29472, 34.87728], [71.28356, 34.80882], [71.08718, 34.69034], [71.11602, 34.63047], [71.0089, 34.54568], [71.02401, 34.44835], [71.17662, 34.36769], [71.12815, 34.26619], [71.13078, 34.16503], [71.09453, 34.13524], [71.09307, 34.11961], [71.06933, 34.10564], [71.07345, 34.06242], [70.88119, 33.97933], [70.54336, 33.9463], [69.90203, 34.04194], [69.87307, 33.9689], [69.85671, 33.93719], [70.00503, 33.73528], [70.14236, 33.71701], [70.14785, 33.6553], [70.20141, 33.64387], [70.17062, 33.53535], [70.32775, 33.34496], [70.13686, 33.21064], [70.07369, 33.22557], [70.02563, 33.14282], [69.85259, 33.09451], [69.79766, 33.13247], [69.71526, 33.09911], [69.57656, 33.09911], [69.49004, 33.01509], [69.49854, 32.88843], [69.5436, 32.8768], [69.47082, 32.85834], [69.38018, 32.76601], [69.43649, 32.7302], [69.44747, 32.6678], [69.38155, 32.56601], [69.2868, 32.53938], [69.23599, 32.45946], [69.27932, 32.29119], [69.27032, 32.14141], [69.3225, 31.93186], [69.20577, 31.85957], [69.11514, 31.70782], [69.00939, 31.62249], [68.95995, 31.64822], [68.91078, 31.59687], [68.79997, 31.61665], [68.6956, 31.75687], [68.57475, 31.83158], [68.44222, 31.76446], [68.27605, 31.75863], [68.25614, 31.80357], [68.1655, 31.82691], [68.00071, 31.6564], [67.86887, 31.63536], [67.72056, 31.52304], [67.58323, 31.52772], [67.62374, 31.40473], [67.7748, 31.4188], [67.78854, 31.33203], [67.29964, 31.19586], [67.03323, 31.24519], [67.04147, 31.31561], [66.83273, 31.26867], [66.72561, 31.20526], [66.68166, 31.07597], [66.58175, 30.97532], [66.42645, 30.95309], [66.39194, 30.9408], [66.28413, 30.57001], [66.34869, 30.404], [66.23609, 30.06321], [66.36042, 29.9583], [66.24175, 29.85181], [65.04005, 29.53957], [64.62116, 29.58903], [64.19796, 29.50407], [64.12966, 29.39157], [63.5876, 29.50456], [62.47751, 29.40782], [60.87231, 29.86514], [61.31508, 29.38903], [61.53765, 29.00507], [61.65978, 28.77937], [61.93581, 28.55284], [62.40259, 28.42703], [62.59499, 28.24842], [62.79412, 28.28108], [62.7638, 28.02992], [62.84905, 27.47627], [62.79684, 27.34381], [62.80604, 27.22412], [63.19649, 27.25674], [63.32283, 27.14437], [63.25005, 27.08692], [63.25005, 26.84212], [63.18688, 26.83844], [63.1889, 26.65072], [62.77352, 26.64099], [62.31484, 26.528], [62.21304, 26.26601], [62.05117, 26.31647], [61.89391, 26.26251], [61.83831, 26.07249], [61.83968, 25.7538], [61.683, 25.66638], [61.6433, 25.27541], [61.46682, 24.57869], [68.11329, 23.53945], [68.20763, 23.85849], [68.39339, 23.96838], [68.74643, 23.97027], [68.7416, 24.31904], [68.90914, 24.33156], [68.97781, 24.26021], [69.07806, 24.29777], [69.19341, 24.25646], [69.29778, 24.28712], [69.59579, 24.29777], [69.73335, 24.17007], [70.03428, 24.172], [70.11712, 24.30915], [70.5667, 24.43787], [70.57906, 24.27774], [70.71502, 24.23517], [70.88393, 24.27398], [70.85784, 24.30903], [70.94985, 24.3791], [71.04461, 24.34657], [71.12838, 24.42662], [71.00341, 24.46038], [70.97594, 24.60904], [71.09405, 24.69017], [70.94002, 24.92843], [70.89148, 25.15064], [70.66695, 25.39314], [70.67382, 25.68186], [70.60378, 25.71898], [70.53649, 25.68928], [70.37444, 25.67443], [70.2687, 25.71156], [70.0985, 25.93238], [70.08193, 26.08094], [70.17532, 26.24118], [70.17532, 26.55362], [70.05584, 26.60398], [69.88555, 26.56836], [69.50904, 26.74892], [69.58519, 27.18109], [70.03136, 27.56627], [70.12502, 27.8057], [70.37307, 28.01208], [70.60927, 28.02178], [70.79054, 27.68423], [71.89921, 27.96035], [71.9244, 28.11555], [72.20329, 28.3869], [72.29495, 28.66367], [72.40402, 28.78283], [72.94272, 29.02487], [73.01337, 29.16422], [73.05886, 29.1878], [73.28094, 29.56646], [73.3962, 29.94707], [73.58665, 30.01848], [73.80299, 30.06969], [73.97225, 30.19829], [73.95736, 30.28466], [73.88993, 30.36305], [74.5616, 31.04153], [74.67971, 31.05479], [74.6852, 31.12771], [74.60006, 31.13711], [74.60281, 31.10419], [74.56023, 31.08303], [74.51629, 31.13829], [74.53223, 31.30321], [74.59773, 31.4136], [74.64713, 31.45605], [74.59319, 31.50197], [74.61517, 31.55698], [74.57498, 31.60382], [74.47771, 31.72227], [74.58907, 31.87824], [74.79919, 31.95983], [74.86236, 32.04485], [74.9269, 32.0658], [75.00793, 32.03786], [75.25649, 32.10187], [75.38046, 32.26836], [75.28259, 32.36556], [75.03265, 32.49538], [74.97634, 32.45367], [74.84725, 32.49075], [74.68362, 32.49298], [74.67431, 32.56676], [74.65251, 32.56416], [74.64424, 32.60985], [74.69542, 32.66792], [74.65345, 32.71225], [74.7113, 32.84219], [74.64675, 32.82604], [74.6289, 32.75561], [74.45312, 32.77755], [74.41467, 32.90563], [74.31227, 32.92795], [74.34875, 32.97823], [74.31854, 33.02891], [74.17571, 33.07495], [74.15374, 33.13477], [74.02144, 33.18908], [74.01366, 33.25199], [74.08782, 33.26232], [74.17983, 33.3679], [74.18121, 33.4745], [74.10115, 33.56392], [74.03576, 33.56718], [73.97367, 33.64061], [73.98968, 33.66155], [73.96423, 33.73071], [74.00891, 33.75437], [74.05898, 33.82089], [74.14001, 33.83002], [74.26086, 33.92237], [74.25262, 34.01577], [74.21554, 34.03853], [73.91341, 34.01235], [73.88732, 34.05105], [73.90677, 34.10504], [73.98208, 34.2522], [73.90517, 34.35317], [73.8475, 34.32935], [73.74862, 34.34183], [73.74999, 34.3781], [73.88732, 34.48911], [73.89419, 34.54568], [73.93951, 34.57169], [73.93401, 34.63386], [73.96423, 34.68244], [74.12897, 34.70073], [74.31239, 34.79626], [74.58083, 34.77386], [74.6663, 34.703], [75.01479, 34.64629], [75.38009, 34.55021], [75.75438, 34.51827], [76.04614, 34.67566], [76.15463, 34.6429], [76.47186, 34.78965], [76.67648, 34.76371], [76.74377, 34.84039], [76.74514, 34.92488], [76.87193, 34.96906], [76.99251, 34.93349], [77.11796, 35.05419], [76.93465, 35.39866], [76.85088, 35.39754], [76.75475, 35.52617], [76.77323, 35.66062], [76.50961, 35.8908], [76.33453, 35.84296], [76.14913, 35.82848], [76.15325, 35.9264], [75.93028, 36.13136], [76.00906, 36.17511], [76.0324, 36.41198], [75.92391, 36.56986], [75.72737, 36.7529]]]] } },
22849 { type: "Feature", properties: { iso1A2: "PL", iso1A3: "POL", iso1N3: "616", wikidata: "Q36", nameEn: "Poland", groups: ["EU", "151", "150", "UN"], callingCodes: ["48"] }, geometry: { type: "MultiPolygon", coordinates: [[[[18.57853, 55.25302], [14.20811, 54.12784], [14.22634, 53.9291], [14.20647, 53.91671], [14.18544, 53.91258], [14.20823, 53.90776], [14.21323, 53.8664], [14.27249, 53.74464], [14.26782, 53.69866], [14.2836, 53.67721], [14.27133, 53.66613], [14.28477, 53.65955], [14.2853, 53.63392], [14.31904, 53.61581], [14.30416, 53.55499], [14.3273, 53.50587], [14.35209, 53.49506], [14.4215, 53.27724], [14.44133, 53.27427], [14.45125, 53.26241], [14.40662, 53.21098], [14.37853, 53.20405], [14.36696, 53.16444], [14.38679, 53.13669], [14.35044, 53.05829], [14.25954, 53.00264], [14.14056, 52.95786], [14.15873, 52.87715], [14.12256, 52.84311], [14.13806, 52.82392], [14.22071, 52.81175], [14.61073, 52.59847], [14.6289, 52.57136], [14.60081, 52.53116], [14.63056, 52.48993], [14.54423, 52.42568], [14.55228, 52.35264], [14.56378, 52.33838], [14.58149, 52.28007], [14.70139, 52.25038], [14.71319, 52.22144], [14.68344, 52.19612], [14.70616, 52.16927], [14.67683, 52.13936], [14.6917, 52.10283], [14.72971, 52.09167], [14.76026, 52.06624], [14.71339, 52.00337], [14.70488, 51.97679], [14.7139, 51.95643], [14.71836, 51.95606], [14.72163, 51.95188], [14.7177, 51.94048], [14.70601, 51.92944], [14.6933, 51.9044], [14.6588, 51.88359], [14.59089, 51.83302], [14.60493, 51.80473], [14.64625, 51.79472], [14.66386, 51.73282], [14.69065, 51.70842], [14.75392, 51.67445], [14.75759, 51.62318], [14.7727, 51.61263], [14.71125, 51.56209], [14.73047, 51.54606], [14.72652, 51.53902], [14.73219, 51.52922], [14.94749, 51.47155], [14.9652, 51.44793], [14.96899, 51.38367], [14.98008, 51.33449], [15.04288, 51.28387], [15.01242, 51.21285], [15.0047, 51.16874], [14.99311, 51.16249], [14.99414, 51.15813], [15.00083, 51.14974], [14.99646, 51.14365], [14.99079, 51.14284], [14.99689, 51.12205], [14.98229, 51.11354], [14.97938, 51.07742], [14.95529, 51.04552], [14.92942, 50.99744], [14.89252, 50.94999], [14.89681, 50.9422], [14.81664, 50.88148], [14.82803, 50.86966], [14.99852, 50.86817], [15.01088, 50.97984], [14.96419, 50.99108], [15.02433, 51.0242], [15.03895, 51.0123], [15.06218, 51.02269], [15.10152, 51.01095], [15.11937, 50.99021], [15.16744, 51.01959], [15.1743, 50.9833], [15.2361, 50.99886], [15.27043, 50.97724], [15.2773, 50.8907], [15.36656, 50.83956], [15.3803, 50.77187], [15.43798, 50.80833], [15.73186, 50.73885], [15.81683, 50.75666], [15.87331, 50.67188], [15.97219, 50.69799], [16.0175, 50.63009], [15.98317, 50.61528], [16.02437, 50.60046], [16.10265, 50.66405], [16.20839, 50.63096], [16.23174, 50.67101], [16.33611, 50.66579], [16.44597, 50.58041], [16.34572, 50.49575], [16.31413, 50.50274], [16.19526, 50.43291], [16.21585, 50.40627], [16.22821, 50.41054], [16.28118, 50.36891], [16.30289, 50.38292], [16.36495, 50.37679], [16.3622, 50.34875], [16.39379, 50.3207], [16.42674, 50.32509], [16.56407, 50.21009], [16.55446, 50.16613], [16.63137, 50.1142], [16.7014, 50.09659], [16.8456, 50.20834], [16.98018, 50.24172], [17.00353, 50.21449], [17.02825, 50.23118], [16.99803, 50.25753], [17.02138, 50.27772], [16.99803, 50.30316], [16.94448, 50.31281], [16.90877, 50.38642], [16.85933, 50.41093], [16.89229, 50.45117], [17.1224, 50.39494], [17.14498, 50.38117], [17.19579, 50.38817], [17.19991, 50.3654], [17.27681, 50.32246], [17.34273, 50.32947], [17.34548, 50.2628], [17.3702, 50.28123], [17.58889, 50.27837], [17.67764, 50.28977], [17.69292, 50.32859], [17.74648, 50.29966], [17.72176, 50.25665], [17.76296, 50.23382], [17.70528, 50.18812], [17.59404, 50.16437], [17.66683, 50.10275], [17.6888, 50.12037], [17.7506, 50.07896], [17.77669, 50.02253], [17.86886, 49.97452], [18.00191, 50.01723], [18.04585, 50.01194], [18.04585, 50.03311], [18.00396, 50.04954], [18.03212, 50.06574], [18.07898, 50.04535], [18.10628, 50.00223], [18.20241, 49.99958], [18.21752, 49.97309], [18.27107, 49.96779], [18.27794, 49.93863], [18.31914, 49.91565], [18.33278, 49.92415], [18.33562, 49.94747], [18.41604, 49.93498], [18.53423, 49.89906], [18.54495, 49.9079], [18.54299, 49.92537], [18.57697, 49.91565], [18.57045, 49.87849], [18.60341, 49.86256], [18.57183, 49.83334], [18.61278, 49.7618], [18.61368, 49.75426], [18.62645, 49.75002], [18.62943, 49.74603], [18.62676, 49.71983], [18.69817, 49.70473], [18.72838, 49.68163], [18.80479, 49.6815], [18.84786, 49.5446], [18.84521, 49.51672], [18.94536, 49.52143], [18.97283, 49.49914], [18.9742, 49.39557], [19.18019, 49.41165], [19.25435, 49.53391], [19.36009, 49.53747], [19.37795, 49.574], [19.45348, 49.61583], [19.52626, 49.57311], [19.53313, 49.52856], [19.57845, 49.46077], [19.64162, 49.45184], [19.6375, 49.40897], [19.72127, 49.39288], [19.78581, 49.41701], [19.82237, 49.27806], [19.75286, 49.20751], [19.86409, 49.19316], [19.90529, 49.23532], [19.98494, 49.22904], [20.08238, 49.1813], [20.13738, 49.31685], [20.21977, 49.35265], [20.31453, 49.34817], [20.31728, 49.39914], [20.39939, 49.3896], [20.46422, 49.41612], [20.5631, 49.375], [20.61666, 49.41791], [20.72274, 49.41813], [20.77971, 49.35383], [20.9229, 49.29626], [20.98733, 49.30774], [21.09799, 49.37176], [21.041, 49.41791], [21.12477, 49.43666], [21.19756, 49.4054], [21.27858, 49.45988], [21.43376, 49.41433], [21.62328, 49.4447], [21.77983, 49.35443], [21.82927, 49.39467], [21.96385, 49.3437], [22.04427, 49.22136], [22.56155, 49.08865], [22.89122, 49.00725], [22.86336, 49.10513], [22.72009, 49.20288], [22.748, 49.32759], [22.69444, 49.49378], [22.64534, 49.53094], [22.78304, 49.65543], [22.80261, 49.69098], [22.83179, 49.69875], [22.99329, 49.84249], [23.28221, 50.0957], [23.67635, 50.33385], [23.71382, 50.38248], [23.79445, 50.40481], [23.99563, 50.41289], [24.03668, 50.44507], [24.07048, 50.5071], [24.0996, 50.60752], [24.0595, 50.71625], [23.95925, 50.79271], [23.99254, 50.83847], [24.0952, 50.83262], [24.14524, 50.86128], [24.04576, 50.90196], [23.92217, 51.00836], [23.90376, 51.07697], [23.80678, 51.18405], [23.63858, 51.32182], [23.69905, 51.40871], [23.62751, 51.50512], [23.56236, 51.53673], [23.57053, 51.55938], [23.53198, 51.74298], [23.62691, 51.78208], [23.61523, 51.92066], [23.68733, 51.9906], [23.64066, 52.07626], [23.61, 52.11264], [23.54314, 52.12148], [23.47859, 52.18215], [23.20071, 52.22848], [23.18196, 52.28812], [23.34141, 52.44845], [23.45112, 52.53774], [23.58296, 52.59868], [23.73615, 52.6149], [23.93763, 52.71332], [23.91805, 52.94016], [23.94689, 52.95919], [23.92184, 53.02079], [23.87548, 53.0831], [23.91393, 53.16469], [23.85657, 53.22923], [23.81995, 53.24131], [23.62004, 53.60942], [23.51284, 53.95052], [23.48261, 53.98855], [23.52702, 54.04622], [23.49196, 54.14764], [23.45223, 54.17775], [23.42418, 54.17911], [23.39525, 54.21672], [23.3494, 54.25155], [23.24656, 54.25701], [23.15938, 54.29894], [23.15526, 54.31076], [23.13905, 54.31567], [23.104, 54.29794], [23.04323, 54.31567], [23.05726, 54.34565], [22.99649, 54.35927], [23.00584, 54.38514], [22.83756, 54.40827], [22.79705, 54.36264], [21.41123, 54.32395], [20.63871, 54.3706], [19.8038, 54.44203], [19.64312, 54.45423], [18.57853, 55.25302]]]] } },
22850 { type: "Feature", properties: { iso1A2: "PM", iso1A3: "SPM", iso1N3: "666", wikidata: "Q34617", nameEn: "Saint Pierre and Miquelon", country: "FR", groups: ["EU", "Q1451600", "021", "003", "019", "UN"], callingCodes: ["508"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-56.72993, 46.65575], [-55.90758, 46.6223], [-56.27503, 47.39728], [-56.72993, 46.65575]]]] } },
22851 { type: "Feature", properties: { iso1A2: "PN", iso1A3: "PCN", iso1N3: "612", wikidata: "Q35672", nameEn: "Pitcairn Islands", country: "GB", groups: ["BOTS", "061", "009", "UN"], driveSide: "left", callingCodes: ["64"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-133.59543, -28.4709], [-122.0366, -24.55017], [-133.61511, -21.93325], [-133.59543, -28.4709]]]] } },
22852 { type: "Feature", properties: { iso1A2: "PR", iso1A3: "PRI", iso1N3: "630", wikidata: "Q1183", nameEn: "Puerto Rico", aliases: ["US-PR"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], roadSpeedUnit: "mph", callingCodes: ["1 787", "1 939"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.27974, 17.56928], [-65.02435, 18.73231], [-67.99519, 18.97186], [-68.23894, 17.84663], [-65.27974, 17.56928]]]] } },
22853 { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
22854 { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
22855 { type: "Feature", properties: { iso1A2: "PW", iso1A3: "PLW", iso1N3: "585", wikidata: "Q695", nameEn: "Palau", groups: ["057", "009", "UN"], roadSpeedUnit: "mph", callingCodes: ["680"] }, geometry: { type: "MultiPolygon", coordinates: [[[[128.97621, 3.08804], [136.39296, 1.54187], [136.04605, 12.45908], [128.97621, 3.08804]]]] } },
22856 { type: "Feature", properties: { iso1A2: "PY", iso1A3: "PRY", iso1N3: "600", wikidata: "Q733", nameEn: "Paraguay", groups: ["005", "419", "019", "UN"], callingCodes: ["595"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-58.16225, -20.16193], [-58.23216, -19.80058], [-59.06965, -19.29148], [-60.00638, -19.2981], [-61.73723, -19.63958], [-61.93912, -20.10053], [-62.26883, -20.55311], [-62.2757, -21.06657], [-62.64455, -22.25091], [-62.51761, -22.37684], [-62.22768, -22.55807], [-61.9756, -23.0507], [-61.0782, -23.62932], [-60.99754, -23.80934], [-60.28163, -24.04436], [-60.03367, -24.00701], [-59.45482, -24.34787], [-59.33886, -24.49935], [-58.33055, -24.97099], [-58.25492, -24.92528], [-57.80821, -25.13863], [-57.57431, -25.47269], [-57.87176, -25.93604], [-58.1188, -26.16704], [-58.3198, -26.83443], [-58.65321, -27.14028], [-58.59549, -27.29973], [-58.04205, -27.2387], [-56.85337, -27.5165], [-56.18313, -27.29851], [-55.89195, -27.3467], [-55.74475, -27.44485], [-55.59094, -27.32444], [-55.62322, -27.1941], [-55.39611, -26.97679], [-55.25243, -26.93808], [-55.16948, -26.96068], [-55.06351, -26.80195], [-55.00584, -26.78754], [-54.80868, -26.55669], [-54.70732, -26.45099], [-54.69333, -26.37705], [-54.67359, -25.98607], [-54.60664, -25.9691], [-54.62063, -25.91213], [-54.59398, -25.59224], [-54.59509, -25.53696], [-54.60196, -25.48397], [-54.62033, -25.46026], [-54.4423, -25.13381], [-54.28207, -24.07305], [-54.32807, -24.01865], [-54.6238, -23.83078], [-55.02691, -23.97317], [-55.0518, -23.98666], [-55.12292, -23.99669], [-55.41784, -23.9657], [-55.44117, -23.9185], [-55.43585, -23.87157], [-55.5555, -23.28237], [-55.52288, -23.2595], [-55.5446, -23.22811], [-55.63849, -22.95122], [-55.62493, -22.62765], [-55.68742, -22.58407], [-55.6986, -22.56268], [-55.72366, -22.5519], [-55.741, -22.52018], [-55.74941, -22.46436], [-55.8331, -22.29008], [-56.23206, -22.25347], [-56.45893, -22.08072], [-56.5212, -22.11556], [-56.6508, -22.28387], [-57.98625, -22.09157], [-57.94642, -21.73799], [-57.88239, -21.6868], [-57.93492, -21.65505], [-57.84536, -20.93155], [-58.16225, -20.16193]]]] } },
22857 { type: "Feature", properties: { iso1A2: "QA", iso1A3: "QAT", iso1N3: "634", wikidata: "Q846", nameEn: "Qatar", groups: ["145", "142", "UN"], callingCodes: ["974"] }, geometry: { type: "MultiPolygon", coordinates: [[[[50.92992, 24.54396], [51.09638, 24.46907], [51.29972, 24.50747], [51.39468, 24.62785], [51.58834, 24.66608], [51.83108, 24.71675], [51.83682, 26.70231], [50.93865, 26.30758], [50.81266, 25.88946], [50.86149, 25.6965], [50.7801, 25.595], [50.80824, 25.54641], [50.57069, 25.57887], [50.8133, 24.74049], [50.92992, 24.54396]]]] } },
22858 { type: "Feature", properties: { iso1A2: "RE", iso1A3: "REU", iso1N3: "638", wikidata: "Q17070", nameEn: "R\xE9union", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[53.37984, -21.23941], [56.73473, -21.9174], [56.62373, -20.2711], [53.37984, -21.23941]]]] } },
22859 { type: "Feature", properties: { iso1A2: "RO", iso1A3: "ROU", iso1N3: "642", wikidata: "Q218", nameEn: "Romania", groups: ["EU", "151", "150", "UN"], callingCodes: ["40"] }, geometry: { type: "MultiPolygon", coordinates: [[[[27.15622, 47.98538], [27.02985, 48.09083], [27.04118, 48.12522], [26.96119, 48.13003], [26.98042, 48.15752], [26.94265, 48.1969], [26.87708, 48.19919], [26.81161, 48.25049], [26.62823, 48.25804], [26.55202, 48.22445], [26.33504, 48.18418], [26.17711, 47.99246], [26.05901, 47.9897], [25.77723, 47.93919], [25.63878, 47.94924], [25.23778, 47.89403], [25.11144, 47.75203], [24.88896, 47.7234], [24.81893, 47.82031], [24.70632, 47.84428], [24.61994, 47.95062], [24.43578, 47.97131], [24.34926, 47.9244], [24.22566, 47.90231], [24.11281, 47.91487], [24.06466, 47.95317], [24.02999, 47.95087], [24.00801, 47.968], [23.98553, 47.96076], [23.96337, 47.96672], [23.94192, 47.94868], [23.89352, 47.94512], [23.8602, 47.9329], [23.80904, 47.98142], [23.75188, 47.99705], [23.66262, 47.98786], [23.63894, 48.00293], [23.5653, 48.00499], [23.52803, 48.01818], [23.4979, 47.96858], [23.33577, 48.0237], [23.27397, 48.08245], [23.15999, 48.12188], [23.1133, 48.08061], [23.08858, 48.00716], [23.0158, 47.99338], [22.92241, 48.02002], [22.94301, 47.96672], [22.89849, 47.95851], [22.77991, 47.87211], [22.76617, 47.8417], [22.67247, 47.7871], [22.46559, 47.76583], [22.41979, 47.7391], [22.31816, 47.76126], [22.00917, 47.50492], [22.03389, 47.42508], [22.01055, 47.37767], [21.94463, 47.38046], [21.78395, 47.11104], [21.648, 47.03902], [21.68645, 46.99595], [21.59581, 46.91628], [21.59307, 46.86935], [21.52028, 46.84118], [21.48935, 46.7577], [21.5151, 46.72147], [21.43926, 46.65109], [21.33214, 46.63035], [21.26929, 46.4993], [21.28061, 46.44941], [21.16872, 46.30118], [21.06572, 46.24897], [20.86797, 46.28884], [20.74574, 46.25467], [20.76085, 46.21002], [20.63863, 46.12728], [20.49718, 46.18721], [20.45377, 46.14405], [20.35573, 46.16629], [20.28324, 46.1438], [20.26068, 46.12332], [20.35862, 45.99356], [20.54818, 45.89939], [20.65645, 45.82801], [20.70069, 45.7493], [20.77416, 45.75601], [20.78446, 45.78522], [20.82364, 45.77738], [20.80361, 45.65875], [20.76798, 45.60969], [20.83321, 45.53567], [20.77217, 45.49788], [20.86026, 45.47295], [20.87948, 45.42743], [21.09894, 45.30144], [21.17612, 45.32566], [21.20392, 45.2677], [21.29398, 45.24148], [21.48278, 45.19557], [21.51299, 45.15345], [21.4505, 45.04294], [21.35855, 45.01941], [21.54938, 44.9327], [21.56328, 44.89502], [21.48202, 44.87199], [21.44013, 44.87613], [21.35643, 44.86364], [21.38802, 44.78133], [21.55007, 44.77304], [21.60019, 44.75208], [21.61942, 44.67059], [21.67504, 44.67107], [21.71692, 44.65349], [21.7795, 44.66165], [21.99364, 44.63395], [22.08016, 44.49844], [22.13234, 44.47444], [22.18315, 44.48179], [22.30844, 44.6619], [22.45301, 44.7194], [22.61917, 44.61489], [22.69196, 44.61587], [22.76749, 44.54446], [22.70981, 44.51852], [22.61368, 44.55719], [22.56493, 44.53419], [22.54021, 44.47836], [22.45436, 44.47258], [22.56012, 44.30712], [22.68166, 44.28206], [22.67173, 44.21564], [23.04988, 44.07694], [23.01674, 44.01946], [22.87873, 43.9844], [22.83753, 43.88055], [22.85314, 43.84452], [23.05288, 43.79494], [23.26772, 43.84843], [23.4507, 43.84936], [23.61687, 43.79289], [23.73978, 43.80627], [24.18149, 43.68218], [24.35364, 43.70211], [24.50264, 43.76314], [24.62281, 43.74082], [24.73542, 43.68523], [24.96682, 43.72693], [25.10718, 43.6831], [25.17144, 43.70261], [25.39528, 43.61866], [25.72792, 43.69263], [25.94911, 43.85745], [26.05584, 43.90925], [26.10115, 43.96908], [26.38764, 44.04356], [26.62712, 44.05698], [26.95141, 44.13555], [27.26845, 44.12602], [27.39757, 44.0141], [27.60834, 44.01206], [27.64542, 44.04958], [27.73468, 43.95326], [27.92008, 44.00761], [27.99558, 43.84193], [28.23293, 43.76], [29.24336, 43.70874], [30.04414, 45.08461], [29.69272, 45.19227], [29.65428, 45.25629], [29.68175, 45.26885], [29.59798, 45.38857], [29.42632, 45.44545], [29.24779, 45.43388], [28.96077, 45.33164], [28.94292, 45.28045], [28.81383, 45.3384], [28.78911, 45.24179], [28.71358, 45.22631], [28.5735, 45.24759], [28.34554, 45.32102], [28.28504, 45.43907], [28.21139, 45.46895], [28.18741, 45.47358], [28.08927, 45.6051], [28.16568, 45.6421], [28.13111, 45.92819], [28.08612, 46.01105], [28.13684, 46.18099], [28.10937, 46.22852], [28.19864, 46.31869], [28.18902, 46.35283], [28.25769, 46.43334], [28.22281, 46.50481], [28.24808, 46.64305], [28.12173, 46.82283], [28.09095, 46.97621], [27.81892, 47.1381], [27.73172, 47.29248], [27.68706, 47.28962], [27.60263, 47.32507], [27.55731, 47.46637], [27.47942, 47.48113], [27.3979, 47.59473], [27.32202, 47.64009], [27.25519, 47.71366], [27.29069, 47.73722], [27.1618, 47.92391], [27.15622, 47.98538]]]] } },
22860 { type: "Feature", properties: { iso1A2: "RS", iso1A3: "SRB", iso1N3: "688", wikidata: "Q403", nameEn: "Serbia", groups: ["039", "150", "UN"], callingCodes: ["381"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.66007, 46.19005], [19.56113, 46.16824], [19.52473, 46.1171], [19.28826, 45.99694], [19.14543, 45.9998], [19.10388, 46.04015], [19.0791, 45.96458], [19.01284, 45.96529], [18.99712, 45.93537], [18.81394, 45.91329], [18.85783, 45.85493], [18.90305, 45.71863], [18.96691, 45.66731], [18.88776, 45.57253], [18.94562, 45.53712], [19.07471, 45.53086], [19.08364, 45.48804], [18.99918, 45.49333], [18.97446, 45.37528], [19.10774, 45.29547], [19.28208, 45.23813], [19.41941, 45.23475], [19.43589, 45.17137], [19.19144, 45.17863], [19.14063, 45.12972], [19.07952, 45.14668], [19.1011, 45.01191], [19.05205, 44.97692], [19.15573, 44.95409], [19.06853, 44.89915], [19.02871, 44.92541], [18.98957, 44.90645], [19.01994, 44.85493], [19.18183, 44.92055], [19.36722, 44.88164], [19.32543, 44.74058], [19.26388, 44.65412], [19.16699, 44.52197], [19.13369, 44.52521], [19.12278, 44.50132], [19.14837, 44.45253], [19.14681, 44.41463], [19.11785, 44.40313], [19.10749, 44.39421], [19.10704, 44.38249], [19.10365, 44.37795], [19.10298, 44.36924], [19.11865, 44.36712], [19.1083, 44.3558], [19.11547, 44.34218], [19.13556, 44.338], [19.13332, 44.31492], [19.16741, 44.28648], [19.18328, 44.28383], [19.20508, 44.2917], [19.23306, 44.26097], [19.26945, 44.26957], [19.32464, 44.27185], [19.34773, 44.23244], [19.3588, 44.18353], [19.40927, 44.16722], [19.43905, 44.13088], [19.47338, 44.15034], [19.48386, 44.14332], [19.47321, 44.1193], [19.51167, 44.08158], [19.55999, 44.06894], [19.57467, 44.04716], [19.61991, 44.05254], [19.61836, 44.01464], [19.56498, 43.99922], [19.52515, 43.95573], [19.38439, 43.96611], [19.24363, 44.01502], [19.23465, 43.98764], [19.3986, 43.79668], [19.5176, 43.71403], [19.50455, 43.58385], [19.42696, 43.57987], [19.41941, 43.54056], [19.36653, 43.60921], [19.33426, 43.58833], [19.2553, 43.5938], [19.24774, 43.53061], [19.22807, 43.5264], [19.22229, 43.47926], [19.44315, 43.38846], [19.48171, 43.32644], [19.52962, 43.31623], [19.54598, 43.25158], [19.62661, 43.2286], [19.64063, 43.19027], [19.76918, 43.16044], [19.79255, 43.11951], [19.92576, 43.08539], [19.96549, 43.11098], [19.98887, 43.0538], [20.04729, 43.02732], [20.05431, 42.99571], [20.12325, 42.96237], [20.14896, 42.99058], [20.16415, 42.97177], [20.34528, 42.90676], [20.35692, 42.8335], [20.40594, 42.84853], [20.43734, 42.83157], [20.53484, 42.8885], [20.48692, 42.93208], [20.59929, 43.01067], [20.64557, 43.00826], [20.69515, 43.09641], [20.59929, 43.20492], [20.68688, 43.21335], [20.73811, 43.25068], [20.82145, 43.26769], [20.88685, 43.21697], [20.83727, 43.17842], [20.96287, 43.12416], [21.00749, 43.13984], [21.05378, 43.10707], [21.08952, 43.13471], [21.14465, 43.11089], [21.16734, 42.99694], [21.2041, 43.02277], [21.23877, 43.00848], [21.23534, 42.95523], [21.2719, 42.8994], [21.32974, 42.90424], [21.36941, 42.87397], [21.44047, 42.87276], [21.39045, 42.74888], [21.47498, 42.74695], [21.59154, 42.72643], [21.58755, 42.70418], [21.6626, 42.67813], [21.75025, 42.70125], [21.79413, 42.65923], [21.75672, 42.62695], [21.7327, 42.55041], [21.70522, 42.54176], [21.7035, 42.51899], [21.62556, 42.45106], [21.64209, 42.41081], [21.62887, 42.37664], [21.59029, 42.38042], [21.57021, 42.3647], [21.53467, 42.36809], [21.5264, 42.33634], [21.56772, 42.30946], [21.58992, 42.25915], [21.70111, 42.23789], [21.77176, 42.2648], [21.84654, 42.3247], [21.91595, 42.30392], [21.94405, 42.34669], [22.02908, 42.29848], [22.16384, 42.32103], [22.29605, 42.37477], [22.29275, 42.34913], [22.34773, 42.31725], [22.45919, 42.33822], [22.47498, 42.3915], [22.51961, 42.3991], [22.55669, 42.50144], [22.43983, 42.56851], [22.4997, 42.74144], [22.43309, 42.82057], [22.54302, 42.87774], [22.74826, 42.88701], [22.78397, 42.98253], [22.89521, 43.03625], [22.98104, 43.11199], [23.00806, 43.19279], [22.89727, 43.22417], [22.82036, 43.33665], [22.53397, 43.47225], [22.47582, 43.6558], [22.41043, 43.69566], [22.35558, 43.81281], [22.41449, 44.00514], [22.61688, 44.06534], [22.61711, 44.16938], [22.67173, 44.21564], [22.68166, 44.28206], [22.56012, 44.30712], [22.45436, 44.47258], [22.54021, 44.47836], [22.56493, 44.53419], [22.61368, 44.55719], [22.70981, 44.51852], [22.76749, 44.54446], [22.69196, 44.61587], [22.61917, 44.61489], [22.45301, 44.7194], [22.30844, 44.6619], [22.18315, 44.48179], [22.13234, 44.47444], [22.08016, 44.49844], [21.99364, 44.63395], [21.7795, 44.66165], [21.71692, 44.65349], [21.67504, 44.67107], [21.61942, 44.67059], [21.60019, 44.75208], [21.55007, 44.77304], [21.38802, 44.78133], [21.35643, 44.86364], [21.44013, 44.87613], [21.48202, 44.87199], [21.56328, 44.89502], [21.54938, 44.9327], [21.35855, 45.01941], [21.4505, 45.04294], [21.51299, 45.15345], [21.48278, 45.19557], [21.29398, 45.24148], [21.20392, 45.2677], [21.17612, 45.32566], [21.09894, 45.30144], [20.87948, 45.42743], [20.86026, 45.47295], [20.77217, 45.49788], [20.83321, 45.53567], [20.76798, 45.60969], [20.80361, 45.65875], [20.82364, 45.77738], [20.78446, 45.78522], [20.77416, 45.75601], [20.70069, 45.7493], [20.65645, 45.82801], [20.54818, 45.89939], [20.35862, 45.99356], [20.26068, 46.12332], [20.09713, 46.17315], [20.03533, 46.14509], [20.01816, 46.17696], [19.93508, 46.17553], [19.81491, 46.1313], [19.66007, 46.19005]]]] } },
22861 { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
22862 { type: "Feature", properties: { iso1A2: "RW", iso1A3: "RWA", iso1N3: "646", wikidata: "Q1037", nameEn: "Rwanda", groups: ["014", "202", "002", "UN"], callingCodes: ["250"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.47194, -1.0555], [30.35212, -1.06896], [30.16369, -1.34303], [29.912, -1.48269], [29.82657, -1.31187], [29.59061, -1.39016], [29.53062, -1.40499], [29.45038, -1.5054], [29.36322, -1.50887], [29.24323, -1.66826], [29.24458, -1.69663], [29.11847, -1.90576], [29.17562, -2.12278], [29.105, -2.27043], [29.00051, -2.29001], [28.95642, -2.37321], [28.89601, -2.37321], [28.86826, -2.41888], [28.86846, -2.44866], [28.89132, -2.47557], [28.89342, -2.49017], [28.88846, -2.50493], [28.87497, -2.50887], [28.86209, -2.5231], [28.86193, -2.53185], [28.87943, -2.55165], [28.89288, -2.55848], [28.90226, -2.62385], [28.89793, -2.66111], [28.94346, -2.69124], [29.00357, -2.70596], [29.04081, -2.7416], [29.0562, -2.58632], [29.32234, -2.6483], [29.36805, -2.82933], [29.88237, -2.75105], [29.95911, -2.33348], [30.14034, -2.43626], [30.42933, -2.31064], [30.54501, -2.41404], [30.83915, -2.35795], [30.89303, -2.08223], [30.80802, -1.91477], [30.84079, -1.64652], [30.71974, -1.43244], [30.57123, -1.33264], [30.50889, -1.16412], [30.45116, -1.10641], [30.47194, -1.0555]]]] } },
22863 { type: "Feature", properties: { iso1A2: "SA", iso1A3: "SAU", iso1N3: "682", wikidata: "Q851", nameEn: "Saudi Arabia", groups: ["145", "142", "UN"], callingCodes: ["966"] }, geometry: { type: "MultiPolygon", coordinates: [[[[40.01521, 32.05667], [39.29903, 32.23259], [38.99233, 31.99721], [36.99791, 31.50081], [37.99354, 30.49998], [37.66395, 30.33245], [37.4971, 29.99949], [36.75083, 29.86903], [36.50005, 29.49696], [36.07081, 29.18469], [34.8812, 29.36878], [34.4454, 27.91479], [37.8565, 22.00903], [39.63762, 18.37348], [40.99158, 15.81743], [42.15205, 16.40211], [42.76801, 16.40371], [42.94625, 16.39721], [42.94351, 16.49467], [42.97215, 16.51093], [43.11601, 16.53166], [43.15274, 16.67248], [43.22066, 16.65179], [43.21325, 16.74416], [43.25857, 16.75304], [43.26303, 16.79479], [43.24801, 16.80613], [43.22956, 16.80613], [43.22012, 16.83932], [43.18338, 16.84852], [43.1398, 16.90696], [43.19328, 16.94703], [43.1813, 16.98438], [43.18233, 17.02673], [43.23967, 17.03428], [43.17787, 17.14717], [43.20156, 17.25901], [43.32653, 17.31179], [43.22533, 17.38343], [43.29185, 17.53224], [43.43005, 17.56148], [43.70631, 17.35762], [44.50126, 17.47475], [46.31018, 17.20464], [46.76494, 17.29151], [47.00571, 16.94765], [47.48245, 17.10808], [47.58351, 17.50366], [48.19996, 18.20584], [49.04884, 18.59899], [52.00311, 19.00083], [54.99756, 20.00083], [55.66469, 21.99658], [55.2137, 22.71065], [55.13599, 22.63334], [52.56622, 22.94341], [51.59617, 24.12041], [51.58871, 24.27256], [51.41644, 24.39615], [51.58834, 24.66608], [51.39468, 24.62785], [51.29972, 24.50747], [51.09638, 24.46907], [50.92992, 24.54396], [50.8133, 24.74049], [50.57069, 25.57887], [50.302, 25.87592], [50.26923, 26.08243], [50.38162, 26.53976], [50.71771, 26.73086], [50.37726, 27.89227], [49.98877, 27.87827], [49.00421, 28.81495], [48.42991, 28.53628], [47.70561, 28.5221], [47.59863, 28.66798], [47.58376, 28.83382], [47.46202, 29.0014], [46.5527, 29.10283], [46.42415, 29.05947], [44.72255, 29.19736], [42.97796, 30.48295], [42.97601, 30.72204], [40.01521, 32.05667]]]] } },
22864 { type: "Feature", properties: { iso1A2: "SB", iso1A3: "SLB", iso1N3: "090", wikidata: "Q685", nameEn: "Solomon Islands", groups: ["054", "009", "UN"], driveSide: "left", callingCodes: ["677"] }, geometry: { type: "MultiPolygon", coordinates: [[[[172.71443, -12.01327], [160.43769, -4.17974], [156.03296, -6.55528], [156.03993, -6.65703], [155.92557, -6.84664], [155.69784, -6.92661], [155.60735, -6.92266], [154.74815, -7.33315], [156.73836, -14.50464], [172.71443, -12.01327]]]] } },
22865 { type: "Feature", properties: { iso1A2: "SC", iso1A3: "SYC", iso1N3: "690", wikidata: "Q1042", nameEn: "Seychelles", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["248"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.75112, -10.38913], [54.83239, -10.93575], [66.3222, 5.65313], [43.75112, -10.38913]]]] } },
22866 { type: "Feature", properties: { iso1A2: "SD", iso1A3: "SDN", iso1N3: "729", wikidata: "Q1049", nameEn: "Sudan", groups: ["015", "002", "UN"], callingCodes: ["249"] }, geometry: { type: "MultiPolygon", coordinates: [[[[37.8565, 22.00903], [34.0765, 22.00501], [33.99686, 21.76784], [33.57251, 21.72406], [33.17563, 22.00405], [24.99885, 21.99535], [24.99794, 19.99661], [23.99715, 20.00038], [23.99539, 19.49944], [23.99997, 15.69575], [23.62785, 15.7804], [23.38812, 15.69649], [23.10792, 15.71297], [22.93201, 15.55107], [22.92579, 15.47007], [22.99584, 15.40105], [22.99584, 15.22989], [22.66115, 14.86308], [22.70474, 14.69149], [22.38562, 14.58907], [22.44944, 14.24986], [22.55997, 14.23024], [22.5553, 14.11704], [22.22995, 13.96754], [22.08674, 13.77863], [22.29689, 13.3731], [22.1599, 13.19281], [22.02914, 13.13976], [21.94819, 13.05637], [21.81432, 12.81362], [21.89371, 12.68001], [21.98711, 12.63292], [22.15679, 12.66634], [22.22684, 12.74682], [22.46345, 12.61925], [22.38873, 12.45514], [22.50548, 12.16769], [22.48369, 12.02766], [22.64092, 12.07485], [22.54907, 11.64372], [22.7997, 11.40424], [22.93124, 11.41645], [22.97249, 11.21955], [22.87758, 10.91915], [23.02221, 10.69235], [23.3128, 10.45214], [23.67164, 9.86923], [23.69155, 9.67566], [24.09319, 9.66572], [24.12744, 9.73784], [24.49389, 9.79962], [24.84653, 9.80643], [24.97739, 9.9081], [25.05688, 10.06776], [25.0918, 10.33718], [25.78141, 10.42599], [25.93163, 10.38159], [25.93241, 10.17941], [26.21338, 9.91545], [26.35815, 9.57946], [26.70685, 9.48735], [27.14427, 9.62858], [27.90704, 9.61323], [28.99983, 9.67155], [29.06988, 9.74826], [29.53844, 9.75133], [29.54, 10.07949], [29.94629, 10.29245], [30.00389, 10.28633], [30.53005, 9.95992], [30.82893, 9.71451], [30.84605, 9.7498], [31.28504, 9.75287], [31.77539, 10.28939], [31.99177, 10.65065], [32.46967, 11.04662], [32.39358, 11.18207], [32.39578, 11.70208], [32.10079, 11.95203], [32.73921, 11.95203], [32.73921, 12.22757], [33.25876, 12.22111], [33.13988, 11.43248], [33.26977, 10.83632], [33.24645, 10.77913], [33.52294, 10.64382], [33.66604, 10.44254], [33.80913, 10.32994], [33.90159, 10.17179], [33.96984, 10.15446], [33.99185, 9.99623], [33.96323, 9.80972], [33.9082, 9.762], [33.87958, 9.49937], [34.10229, 9.50238], [34.08717, 9.55243], [34.13186, 9.7492], [34.20484, 9.9033], [34.22718, 10.02506], [34.32102, 10.11599], [34.34783, 10.23914], [34.2823, 10.53508], [34.4372, 10.781], [34.59062, 10.89072], [34.77383, 10.74588], [34.77532, 10.69027], [34.86618, 10.74588], [34.86916, 10.78832], [34.97491, 10.86147], [34.97789, 10.91559], [34.93172, 10.95946], [35.01215, 11.19626], [34.95704, 11.24448], [35.09556, 11.56278], [35.05832, 11.71158], [35.11492, 11.85156], [35.24302, 11.91132], [35.70476, 12.67101], [36.01458, 12.72478], [36.14268, 12.70879], [36.16651, 12.88019], [36.13374, 12.92665], [36.24545, 13.36759], [36.38993, 13.56459], [36.48824, 13.83954], [36.44653, 13.95666], [36.54376, 14.25597], [36.44337, 15.14963], [36.54276, 15.23478], [36.69761, 15.75323], [36.76371, 15.80831], [36.92193, 16.23451], [36.99777, 17.07172], [37.42694, 17.04041], [37.50967, 17.32199], [38.13362, 17.53906], [38.37133, 17.66269], [38.45916, 17.87167], [38.57727, 17.98125], [39.63762, 18.37348], [37.8565, 22.00903]]]] } },
22867 { type: "Feature", properties: { iso1A2: "SE", iso1A3: "SWE", iso1N3: "752", wikidata: "Q34", nameEn: "Sweden", groups: ["EU", "154", "150", "UN"], callingCodes: ["46"] }, geometry: { type: "MultiPolygon", coordinates: [[[[24.15791, 65.85385], [23.90497, 66.15802], [23.71339, 66.21299], [23.64982, 66.30603], [23.67591, 66.3862], [23.63776, 66.43568], [23.85959, 66.56434], [23.89488, 66.772], [23.98059, 66.79585], [23.98563, 66.84149], [23.56214, 67.17038], [23.58735, 67.20752], [23.54701, 67.25435], [23.75372, 67.29914], [23.75372, 67.43688], [23.39577, 67.46974], [23.54701, 67.59306], [23.45627, 67.85297], [23.65793, 67.9497], [23.40081, 68.05545], [23.26469, 68.15134], [23.15377, 68.14759], [23.10336, 68.26551], [22.73028, 68.40881], [22.00429, 68.50692], [21.03001, 68.88969], [20.90649, 68.89696], [20.85104, 68.93142], [20.91658, 68.96764], [20.78802, 69.03087], [20.55258, 69.06069], [20.0695, 69.04469], [20.28444, 68.93283], [20.33435, 68.80174], [20.22027, 68.67246], [19.95647, 68.55546], [20.22027, 68.48759], [19.93508, 68.35911], [18.97255, 68.52416], [18.63032, 68.50849], [18.39503, 68.58672], [18.1241, 68.53721], [18.13836, 68.20874], [17.90787, 67.96537], [17.30416, 68.11591], [16.7409, 67.91037], [16.38441, 67.52923], [16.12774, 67.52106], [16.09922, 67.4364], [16.39154, 67.21653], [16.35589, 67.06419], [15.37197, 66.48217], [15.49318, 66.28509], [15.05113, 66.15572], [14.53778, 66.12399], [14.50926, 65.31786], [13.64276, 64.58402], [14.11117, 64.46674], [14.16051, 64.18725], [13.98222, 64.00953], [13.23411, 64.09087], [12.74105, 64.02171], [12.14928, 63.59373], [12.19919, 63.47935], [11.98529, 63.27487], [12.19919, 63.00104], [12.07085, 62.6297], [12.29187, 62.25699], [12.14746, 61.7147], [12.40595, 61.57226], [12.57707, 61.56547], [12.86939, 61.35427], [12.69115, 61.06584], [12.2277, 61.02442], [12.59133, 60.50559], [12.52003, 60.13846], [12.36317, 59.99259], [12.15641, 59.8926], [11.87121, 59.86039], [11.92112, 59.69531], [11.69297, 59.59442], [11.8213, 59.24985], [11.65732, 58.90177], [11.45199, 58.89604], [11.4601, 58.99022], [11.34459, 59.11672], [11.15367, 59.07862], [11.08911, 58.98745], [10.64958, 58.89391], [10.40861, 58.38489], [12.16597, 56.60205], [12.07466, 56.29488], [12.65312, 56.04345], [12.6372, 55.91371], [12.88472, 55.63369], [12.60345, 55.42675], [12.84405, 55.13257], [14.28399, 55.1553], [14.89259, 55.5623], [15.79951, 55.54655], [19.64795, 57.06466], [19.84909, 57.57876], [20.5104, 59.15546], [19.08191, 60.19152], [19.23413, 60.61414], [20.15877, 63.06556], [24.14112, 65.39731], [24.15107, 65.81427], [24.14798, 65.83466], [24.15791, 65.85385]]]] } },
22868 { type: "Feature", properties: { iso1A2: "SG", iso1A3: "SGP", iso1N3: "702", wikidata: "Q334", nameEn: "Singapore", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["65"] }, geometry: { type: "MultiPolygon", coordinates: [[[[104.00131, 1.42405], [103.93384, 1.42926], [103.89565, 1.42841], [103.86383, 1.46288], [103.81181, 1.47953], [103.76395, 1.45183], [103.74161, 1.4502], [103.7219, 1.46108], [103.67468, 1.43166], [103.62738, 1.35255], [103.56591, 1.19719], [103.66049, 1.18825], [103.74084, 1.12902], [104.03085, 1.26954], [104.12282, 1.27714], [104.08072, 1.35998], [104.09162, 1.39694], [104.08871, 1.42015], [104.07348, 1.43322], [104.04622, 1.44691], [104.02277, 1.4438], [104.00131, 1.42405]]]] } },
22869 { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
22870 { type: "Feature", properties: { iso1A2: "SI", iso1A3: "SVN", iso1N3: "705", wikidata: "Q215", nameEn: "Slovenia", groups: ["EU", "039", "150", "UN"], callingCodes: ["386"] }, geometry: { type: "MultiPolygon", coordinates: [[[[16.50139, 46.56684], [16.39217, 46.63673], [16.38594, 46.6549], [16.41863, 46.66238], [16.42641, 46.69228], [16.37816, 46.69975], [16.30966, 46.7787], [16.31303, 46.79838], [16.3408, 46.80641], [16.34547, 46.83836], [16.2941, 46.87137], [16.2365, 46.87775], [16.21892, 46.86961], [16.15711, 46.85434], [16.14365, 46.8547], [16.10983, 46.867], [16.05786, 46.83927], [15.99054, 46.82772], [15.99126, 46.78199], [15.98432, 46.74991], [15.99769, 46.7266], [16.02808, 46.71094], [16.04347, 46.68694], [16.04036, 46.6549], [15.99988, 46.67947], [15.98512, 46.68463], [15.94864, 46.68769], [15.87691, 46.7211], [15.8162, 46.71897], [15.78518, 46.70712], [15.76771, 46.69863], [15.73823, 46.70011], [15.72279, 46.69548], [15.69523, 46.69823], [15.67411, 46.70735], [15.6543, 46.70616], [15.6543, 46.69228], [15.6365, 46.6894], [15.63255, 46.68069], [15.62317, 46.67947], [15.59826, 46.68908], [15.54533, 46.66985], [15.55333, 46.64988], [15.54431, 46.6312], [15.46906, 46.61321], [15.45514, 46.63697], [15.41235, 46.65556], [15.23711, 46.63994], [15.14215, 46.66131], [15.01451, 46.641], [14.98024, 46.6009], [14.96002, 46.63459], [14.92283, 46.60848], [14.87129, 46.61], [14.86419, 46.59411], [14.83549, 46.56614], [14.81836, 46.51046], [14.72185, 46.49974], [14.66892, 46.44936], [14.5942, 46.43434], [14.56463, 46.37208], [14.52176, 46.42617], [14.45877, 46.41717], [14.42608, 46.44614], [14.314, 46.43327], [14.28326, 46.44315], [14.15989, 46.43327], [14.12097, 46.47724], [14.04002, 46.49117], [14.00422, 46.48474], [13.89837, 46.52331], [13.7148, 46.5222], [13.68684, 46.43881], [13.59777, 46.44137], [13.5763, 46.42613], [13.5763, 46.40915], [13.47019, 46.3621], [13.43418, 46.35992], [13.44808, 46.33507], [13.37671, 46.29668], [13.42218, 46.20758], [13.47587, 46.22725], [13.56114, 46.2054], [13.56682, 46.18703], [13.64451, 46.18966], [13.66472, 46.17392], [13.64053, 46.13587], [13.57072, 46.09022], [13.50104, 46.05986], [13.49568, 46.04839], [13.50998, 46.04498], [13.49702, 46.01832], [13.47474, 46.00546], [13.50104, 45.98078], [13.52963, 45.96588], [13.56759, 45.96991], [13.58903, 45.99009], [13.62074, 45.98388], [13.63458, 45.98947], [13.64307, 45.98326], [13.6329, 45.94894], [13.63815, 45.93607], [13.61931, 45.91782], [13.60857, 45.89907], [13.59565, 45.89446], [13.58644, 45.88173], [13.57563, 45.8425], [13.58858, 45.83503], [13.59784, 45.8072], [13.66986, 45.79955], [13.8235, 45.7176], [13.83332, 45.70855], [13.83422, 45.68703], [13.87933, 45.65207], [13.9191, 45.6322], [13.8695, 45.60835], [13.86771, 45.59898], [13.84106, 45.58185], [13.78445, 45.5825], [13.74587, 45.59811], [13.7198, 45.59352], [13.6076, 45.64761], [13.45644, 45.59464], [13.56979, 45.4895], [13.62902, 45.45898], [13.67398, 45.4436], [13.7785, 45.46787], [13.81742, 45.43729], [13.88124, 45.42637], [13.90771, 45.45149], [13.97309, 45.45258], [13.99488, 45.47551], [13.96063, 45.50825], [14.00578, 45.52352], [14.07116, 45.48752], [14.20348, 45.46896], [14.22371, 45.50388], [14.24239, 45.50607], [14.26611, 45.48239], [14.27681, 45.4902], [14.32487, 45.47142], [14.36693, 45.48642], [14.49769, 45.54424], [14.5008, 45.60852], [14.53816, 45.6205], [14.57397, 45.67165], [14.60977, 45.66403], [14.59576, 45.62812], [14.69694, 45.57366], [14.68605, 45.53006], [14.71718, 45.53442], [14.80124, 45.49515], [14.81992, 45.45913], [14.90554, 45.47769], [14.92266, 45.52788], [15.02385, 45.48533], [15.05187, 45.49079], [15.16862, 45.42309], [15.27758, 45.46678], [15.33051, 45.45258], [15.38188, 45.48752], [15.30249, 45.53224], [15.29837, 45.5841], [15.27747, 45.60504], [15.31027, 45.6303], [15.34695, 45.63382], [15.34214, 45.64702], [15.38952, 45.63682], [15.4057, 45.64727], [15.34919, 45.71623], [15.30872, 45.69014], [15.25423, 45.72275], [15.40836, 45.79491], [15.47531, 45.79802], [15.47325, 45.8253], [15.52234, 45.82195], [15.57952, 45.84953], [15.64185, 45.82915], [15.66662, 45.84085], [15.70411, 45.8465], [15.68232, 45.86819], [15.68383, 45.88867], [15.67967, 45.90455], [15.70636, 45.92116], [15.70327, 46.00015], [15.71246, 46.01196], [15.72977, 46.04682], [15.62317, 46.09103], [15.6083, 46.11992], [15.59909, 46.14761], [15.64904, 46.19229], [15.6434, 46.21396], [15.67395, 46.22478], [15.75436, 46.21969], [15.75479, 46.20336], [15.78817, 46.21719], [15.79284, 46.25811], [15.97965, 46.30652], [16.07616, 46.3463], [16.07314, 46.36458], [16.05065, 46.3833], [16.05281, 46.39141], [16.14859, 46.40547], [16.18824, 46.38282], [16.30233, 46.37837], [16.30162, 46.40437], [16.27329, 46.41467], [16.27398, 46.42875], [16.25124, 46.48067], [16.23961, 46.49653], [16.26759, 46.50566], [16.26733, 46.51505], [16.29793, 46.5121], [16.37193, 46.55008], [16.38771, 46.53608], [16.44036, 46.5171], [16.5007, 46.49644], [16.52604, 46.47831], [16.59527, 46.47524], [16.52604, 46.5051], [16.52885, 46.53303], [16.50139, 46.56684]]]] } },
22871 { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
22872 { type: "Feature", properties: { iso1A2: "SK", iso1A3: "SVK", iso1N3: "703", wikidata: "Q214", nameEn: "Slovakia", groups: ["EU", "151", "150", "UN"], callingCodes: ["421"] }, geometry: { type: "MultiPolygon", coordinates: [[[[19.82237, 49.27806], [19.78581, 49.41701], [19.72127, 49.39288], [19.6375, 49.40897], [19.64162, 49.45184], [19.57845, 49.46077], [19.53313, 49.52856], [19.52626, 49.57311], [19.45348, 49.61583], [19.37795, 49.574], [19.36009, 49.53747], [19.25435, 49.53391], [19.18019, 49.41165], [18.9742, 49.39557], [18.97283, 49.49914], [18.94536, 49.52143], [18.84521, 49.51672], [18.74761, 49.492], [18.67757, 49.50895], [18.6144, 49.49824], [18.57183, 49.51162], [18.53063, 49.49022], [18.54848, 49.47059], [18.44686, 49.39467], [18.4084, 49.40003], [18.4139, 49.36517], [18.36446, 49.3267], [18.18456, 49.28909], [18.15022, 49.24518], [18.1104, 49.08624], [18.06885, 49.03157], [17.91814, 49.01784], [17.87831, 48.92679], [17.77944, 48.92318], [17.73126, 48.87885], [17.7094, 48.86721], [17.5295, 48.81117], [17.45671, 48.85004], [17.3853, 48.80936], [17.29054, 48.85546], [17.19355, 48.87602], [17.11202, 48.82925], [17.00215, 48.70887], [16.93955, 48.60371], [16.94611, 48.53614], [16.85204, 48.44968], [16.8497, 48.38321], [16.83588, 48.3844], [16.83317, 48.38138], [16.84243, 48.35258], [16.90903, 48.32519], [16.89461, 48.31332], [16.97701, 48.17385], [17.02919, 48.13996], [17.05735, 48.14179], [17.09168, 48.09366], [17.07039, 48.0317], [17.16001, 48.00636], [17.23699, 48.02094], [17.71215, 47.7548], [18.02938, 47.75665], [18.29305, 47.73541], [18.56496, 47.76588], [18.66521, 47.76772], [18.74074, 47.8157], [18.8506, 47.82308], [18.76821, 47.87469], [18.76134, 47.97499], [18.82176, 48.04206], [19.01952, 48.07052], [19.23924, 48.0595], [19.28182, 48.08336], [19.47957, 48.09437], [19.52489, 48.19791], [19.63338, 48.25006], [19.92452, 48.1283], [20.24312, 48.2784], [20.29943, 48.26104], [20.5215, 48.53336], [20.83248, 48.5824], [21.11516, 48.49546], [21.44063, 48.58456], [21.6068, 48.50365], [21.67134, 48.3989], [21.72525, 48.34628], [21.8279, 48.33321], [21.83339, 48.36242], [22.14689, 48.4005], [22.16023, 48.56548], [22.21379, 48.6218], [22.34151, 48.68893], [22.42934, 48.92857], [22.48296, 48.99172], [22.54338, 49.01424], [22.56155, 49.08865], [22.04427, 49.22136], [21.96385, 49.3437], [21.82927, 49.39467], [21.77983, 49.35443], [21.62328, 49.4447], [21.43376, 49.41433], [21.27858, 49.45988], [21.19756, 49.4054], [21.12477, 49.43666], [21.041, 49.41791], [21.09799, 49.37176], [20.98733, 49.30774], [20.9229, 49.29626], [20.77971, 49.35383], [20.72274, 49.41813], [20.61666, 49.41791], [20.5631, 49.375], [20.46422, 49.41612], [20.39939, 49.3896], [20.31728, 49.39914], [20.31453, 49.34817], [20.21977, 49.35265], [20.13738, 49.31685], [20.08238, 49.1813], [19.98494, 49.22904], [19.90529, 49.23532], [19.86409, 49.19316], [19.75286, 49.20751], [19.82237, 49.27806]]]] } },
22873 { type: "Feature", properties: { iso1A2: "SL", iso1A3: "SLE", iso1N3: "694", wikidata: "Q1044", nameEn: "Sierra Leone", groups: ["011", "202", "002", "UN"], callingCodes: ["232"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-10.27575, 8.48711], [-10.37257, 8.48941], [-10.54891, 8.31174], [-10.63934, 8.35326], [-10.70565, 8.29235], [-10.61422, 8.5314], [-10.47707, 8.67669], [-10.56197, 8.81225], [-10.5783, 9.06386], [-10.74484, 9.07998], [-10.6534, 9.29919], [-11.2118, 10.00098], [-11.89624, 9.99763], [-11.91023, 9.93927], [-12.12634, 9.87203], [-12.24262, 9.92386], [-12.47254, 9.86834], [-12.76788, 9.3133], [-12.94095, 9.26335], [-13.08953, 9.0409], [-13.18586, 9.0925], [-13.29911, 9.04245], [-14.36218, 8.64107], [-12.15048, 6.15992], [-11.50429, 6.92704], [-11.4027, 6.97746], [-11.29417, 7.21576], [-10.60422, 7.7739], [-10.60492, 8.04072], [-10.57523, 8.04829], [-10.51554, 8.1393], [-10.45023, 8.15627], [-10.35227, 8.15223], [-10.29839, 8.21283], [-10.31635, 8.28554], [-10.30084, 8.30008], [-10.27575, 8.48711]]]] } },
22874 { type: "Feature", properties: { iso1A2: "SM", iso1A3: "SMR", iso1N3: "674", wikidata: "Q238", nameEn: "San Marino", groups: ["039", "150", "UN"], callingCodes: ["378"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45648, 43.89369], [12.48771, 43.89706], [12.49429, 43.90973], [12.49247, 43.91774], [12.49724, 43.92248], [12.50269, 43.92363], [12.50496, 43.93017], [12.51553, 43.94096], [12.51427, 43.94897], [12.50655, 43.95796], [12.50875, 43.96198], [12.50622, 43.97131], [12.51109, 43.97201], [12.51064, 43.98165], [12.5154, 43.98508], [12.51463, 43.99122], [12.50678, 43.99113], [12.49406, 43.98492], [12.47853, 43.98052], [12.46205, 43.97463], [12.44684, 43.96597], [12.43662, 43.95698], [12.42005, 43.9578], [12.41414, 43.95273], [12.40415, 43.95485], [12.40506, 43.94325], [12.41165, 43.93769], [12.41551, 43.92984], [12.40733, 43.92379], [12.41233, 43.90956], [12.40935, 43.9024], [12.41641, 43.89991], [12.44184, 43.90498], [12.45648, 43.89369]]]] } },
22875 { type: "Feature", properties: { iso1A2: "SN", iso1A3: "SEN", iso1N3: "686", wikidata: "Q1041", nameEn: "Senegal", groups: ["011", "202", "002", "UN"], callingCodes: ["221"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-14.32144, 16.61495], [-15.00557, 16.64997], [-15.6509, 16.50315], [-16.27016, 16.51565], [-16.4429, 16.20605], [-16.44814, 16.09753], [-16.48967, 16.0496], [-16.50854, 16.09032], [-17.15288, 16.07139], [-18.35085, 14.63444], [-17.43598, 13.59273], [-15.47902, 13.58758], [-15.36504, 13.79313], [-14.93719, 13.80173], [-14.34721, 13.46578], [-13.8955, 13.59126], [-13.79409, 13.34472], [-14.36795, 13.23033], [-15.14917, 13.57989], [-15.26908, 13.37768], [-15.80478, 13.34832], [-15.80355, 13.16729], [-16.69343, 13.16791], [-16.74676, 13.06025], [-17.43966, 13.04579], [-17.4623, 11.92379], [-16.70562, 12.34803], [-16.38191, 12.36449], [-16.20591, 12.46157], [-15.67302, 12.42974], [-15.17582, 12.6847], [-13.70523, 12.68013], [-13.05296, 12.64003], [-13.06603, 12.49342], [-12.87336, 12.51892], [-12.35415, 12.32758], [-11.91331, 12.42008], [-11.46267, 12.44559], [-11.37536, 12.40788], [-11.39935, 12.97808], [-11.63025, 13.39174], [-11.83345, 13.33333], [-12.06897, 13.71049], [-11.93043, 13.84505], [-12.23936, 14.76324], [-13.11029, 15.52116], [-13.43135, 16.09022], [-13.80075, 16.13961], [-14.32144, 16.61495]]]] } },
22876 { type: "Feature", properties: { iso1A2: "SO", iso1A3: "SOM", iso1N3: "706", wikidata: "Q1045", nameEn: "Somalia", groups: ["014", "202", "002", "UN"], callingCodes: ["252"] }, geometry: { type: "MultiPolygon", coordinates: [[[[51.12877, 12.56479], [43.90659, 12.3823], [42.95776, 10.98533], [42.69452, 10.62672], [42.87643, 10.18441], [43.0937, 9.90579], [43.23518, 9.84605], [43.32613, 9.59205], [44.19222, 8.93028], [46.99339, 7.9989], [47.92477, 8.00111], [47.97917, 8.00124], [44.98104, 4.91821], [44.02436, 4.9451], [43.40263, 4.79289], [43.04177, 4.57923], [42.97746, 4.44032], [42.84526, 4.28357], [42.55853, 4.20518], [42.07619, 4.17667], [41.89488, 3.97375], [41.31368, 3.14314], [40.98767, 2.82959], [41.00099, -0.83068], [41.56, -1.59812], [41.56362, -1.66375], [41.75542, -1.85308], [57.49095, 8.14549], [51.12877, 12.56479]]]] } },
22877 { type: "Feature", properties: { iso1A2: "SR", iso1A3: "SUR", iso1N3: "740", wikidata: "Q730", nameEn: "Suriname", groups: ["005", "419", "019", "UN"], driveSide: "left", callingCodes: ["597"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-54.26916, 5.26909], [-54.01877, 5.52789], [-54.01074, 5.68785], [-53.7094, 6.2264], [-56.84822, 6.73257], [-57.31629, 5.33714], [-57.22536, 5.15605], [-57.37442, 5.0208], [-57.8699, 4.89394], [-58.0307, 3.95513], [-57.35891, 3.32121], [-56.70519, 2.02964], [-56.55439, 2.02003], [-56.47045, 1.95135], [-55.99278, 1.83137], [-55.89863, 1.89861], [-55.92159, 2.05236], [-56.13054, 2.27723], [-55.96292, 2.53188], [-55.71493, 2.40342], [-55.01919, 2.564], [-54.6084, 2.32856], [-54.42864, 2.42442], [-54.28534, 2.67798], [-53.9849, 3.58697], [-53.98914, 3.627], [-54.05128, 3.63557], [-54.19367, 3.84387], [-54.38444, 4.13222], [-54.4717, 4.91964], [-54.26916, 5.26909]]]] } },
22878 { type: "Feature", properties: { iso1A2: "SS", iso1A3: "SSD", iso1N3: "728", wikidata: "Q958", nameEn: "South Sudan", groups: ["014", "202", "002", "UN"], callingCodes: ["211"] }, geometry: { type: "MultiPolygon", coordinates: [[[[34.10229, 9.50238], [33.87958, 9.49937], [33.9082, 9.762], [33.96323, 9.80972], [33.99185, 9.99623], [33.96984, 10.15446], [33.90159, 10.17179], [33.80913, 10.32994], [33.66604, 10.44254], [33.52294, 10.64382], [33.24645, 10.77913], [33.26977, 10.83632], [33.13988, 11.43248], [33.25876, 12.22111], [32.73921, 12.22757], [32.73921, 11.95203], [32.10079, 11.95203], [32.39578, 11.70208], [32.39358, 11.18207], [32.46967, 11.04662], [31.99177, 10.65065], [31.77539, 10.28939], [31.28504, 9.75287], [30.84605, 9.7498], [30.82893, 9.71451], [30.53005, 9.95992], [30.00389, 10.28633], [29.94629, 10.29245], [29.54, 10.07949], [29.53844, 9.75133], [29.06988, 9.74826], [28.99983, 9.67155], [27.90704, 9.61323], [27.14427, 9.62858], [26.70685, 9.48735], [26.35815, 9.57946], [26.21338, 9.91545], [25.93241, 10.17941], [25.93163, 10.38159], [25.78141, 10.42599], [25.0918, 10.33718], [25.05688, 10.06776], [24.97739, 9.9081], [24.84653, 9.80643], [24.49389, 9.79962], [24.12744, 9.73784], [24.09319, 9.66572], [23.69155, 9.67566], [23.62179, 9.53823], [23.64981, 9.44303], [23.64358, 9.28637], [23.56263, 9.19418], [23.4848, 9.16959], [23.44744, 8.99128], [23.59065, 8.99743], [23.51905, 8.71749], [24.25691, 8.69288], [24.13238, 8.36959], [24.35965, 8.26177], [24.85156, 8.16933], [24.98855, 7.96588], [25.25319, 7.8487], [25.29214, 7.66675], [25.20649, 7.61115], [25.20337, 7.50312], [25.35281, 7.42595], [25.37461, 7.33024], [25.90076, 7.09549], [26.38022, 6.63493], [26.32729, 6.36272], [26.58259, 6.1987], [26.51721, 6.09655], [27.22705, 5.71254], [27.22705, 5.62889], [27.28621, 5.56382], [27.23017, 5.37167], [27.26886, 5.25876], [27.44012, 5.07349], [27.56656, 4.89375], [27.65462, 4.89375], [27.76469, 4.79284], [27.79551, 4.59976], [28.20719, 4.35614], [28.6651, 4.42638], [28.8126, 4.48784], [29.03054, 4.48784], [29.22207, 4.34297], [29.43341, 4.50101], [29.49726, 4.7007], [29.82087, 4.56246], [29.79666, 4.37809], [30.06964, 4.13221], [30.1621, 4.10586], [30.22374, 3.93896], [30.27658, 3.95653], [30.47691, 3.83353], [30.55396, 3.84451], [30.57378, 3.74567], [30.56277, 3.62703], [30.78512, 3.67097], [30.80713, 3.60506], [30.85997, 3.5743], [30.85153, 3.48867], [30.97601, 3.693], [31.16666, 3.79853], [31.29476, 3.8015], [31.50478, 3.67814], [31.50776, 3.63652], [31.72075, 3.74354], [31.81459, 3.82083], [31.86821, 3.78664], [31.96205, 3.6499], [31.95907, 3.57408], [32.05187, 3.589], [32.08491, 3.56287], [32.08866, 3.53543], [32.19888, 3.50867], [32.20782, 3.6053], [32.41337, 3.748], [32.72021, 3.77327], [32.89746, 3.81339], [33.02852, 3.89296], [33.18356, 3.77812], [33.51264, 3.75068], [33.9873, 4.23316], [34.47601, 4.72162], [35.34151, 5.02364], [35.30992, 4.90402], [35.47843, 4.91872], [35.42366, 4.76969], [35.51424, 4.61643], [35.9419, 4.61933], [35.82118, 4.77382], [35.81968, 5.10757], [35.8576, 5.33413], [35.50792, 5.42431], [35.29938, 5.34042], [35.31188, 5.50106], [35.13058, 5.62118], [35.12611, 5.68937], [35.00546, 5.89387], [34.96227, 6.26415], [35.01738, 6.46991], [34.87736, 6.60161], [34.77459, 6.5957], [34.65096, 6.72589], [34.53776, 6.74808], [34.53925, 6.82794], [34.47669, 6.91076], [34.35753, 6.91963], [34.19369, 7.04382], [34.19369, 7.12807], [34.01495, 7.25664], [34.03878, 7.27437], [34.02984, 7.36449], [33.87642, 7.5491], [33.71407, 7.65983], [33.44745, 7.7543], [33.32531, 7.71297], [33.24637, 7.77939], [33.04944, 7.78989], [33.0006, 7.90333], [33.08401, 8.05822], [33.18083, 8.13047], [33.1853, 8.29264], [33.19721, 8.40317], [33.3119, 8.45474], [33.54575, 8.47094], [33.66938, 8.44442], [33.71407, 8.3678], [33.87195, 8.41938], [33.89579, 8.4842], [34.01346, 8.50041], [34.14453, 8.60204], [34.14304, 9.04654], [34.10229, 9.50238]]]] } },
22879 { type: "Feature", properties: { iso1A2: "ST", iso1A3: "STP", iso1N3: "678", wikidata: "Q1039", nameEn: "S\xE3o Tom\xE9 and Principe", groups: ["017", "202", "002", "UN"], callingCodes: ["239"] }, geometry: { type: "MultiPolygon", coordinates: [[[[4.34149, 1.91417], [6.6507, -0.28606], [7.9035, 1.92304], [4.34149, 1.91417]]]] } },
22880 { type: "Feature", properties: { iso1A2: "SV", iso1A3: "SLV", iso1N3: "222", wikidata: "Q792", nameEn: "El Salvador", groups: ["013", "003", "419", "019", "UN"], callingCodes: ["503"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-89.34776, 14.43013], [-89.39028, 14.44561], [-89.57441, 14.41637], [-89.58814, 14.33165], [-89.50614, 14.26084], [-89.52397, 14.22628], [-89.61844, 14.21937], [-89.70756, 14.1537], [-89.75569, 14.07073], [-89.73251, 14.04133], [-89.76103, 14.02923], [-89.81807, 14.07073], [-89.88937, 14.0396], [-90.10505, 13.85104], [-90.11344, 13.73679], [-90.55276, 12.8866], [-88.11443, 12.63306], [-87.7346, 13.13228], [-87.55124, 13.12523], [-87.69751, 13.25228], [-87.73714, 13.32715], [-87.80177, 13.35689], [-87.84675, 13.41078], [-87.83467, 13.44655], [-87.77354, 13.45767], [-87.73841, 13.44169], [-87.72115, 13.46083], [-87.71657, 13.50577], [-87.78148, 13.52906], [-87.73106, 13.75443], [-87.68821, 13.80829], [-87.7966, 13.91353], [-88.00331, 13.86948], [-88.07641, 13.98447], [-88.23018, 13.99915], [-88.25791, 13.91108], [-88.48982, 13.86458], [-88.49738, 13.97224], [-88.70661, 14.04317], [-88.73182, 14.10919], [-88.815, 14.11652], [-88.85785, 14.17763], [-88.94608, 14.20207], [-89.04187, 14.33644], [-89.34776, 14.43013]]]] } },
22881 { type: "Feature", properties: { iso1A2: "SX", iso1A3: "SXM", iso1N3: "534", wikidata: "Q26273", nameEn: "Sint Maarten", aliases: ["NL-SX"], country: "NL", groups: ["Q1451600", "029", "003", "419", "019", "UN"], callingCodes: ["1 721"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-63.33064, 17.9615], [-63.1055, 17.86651], [-62.93924, 18.02904], [-63.02323, 18.05757], [-63.04039, 18.05619], [-63.0579, 18.06614], [-63.07759, 18.04943], [-63.09686, 18.04608], [-63.11042, 18.05339], [-63.13502, 18.05445], [-63.33064, 17.9615]]]] } },
22882 { type: "Feature", properties: { iso1A2: "SY", iso1A3: "SYR", iso1N3: "760", wikidata: "Q858", nameEn: "Syria", groups: ["145", "142", "UN"], callingCodes: ["963"] }, geometry: { type: "MultiPolygon", coordinates: [[[[42.23683, 37.2863], [42.21548, 37.28026], [42.20454, 37.28715], [42.22381, 37.30238], [42.22257, 37.31395], [42.2112, 37.32491], [42.19301, 37.31323], [42.18225, 37.28569], [42.00894, 37.17209], [41.515, 37.08084], [41.21937, 37.07665], [40.90856, 37.13147], [40.69136, 37.0996], [39.81589, 36.75538], [39.21538, 36.66834], [39.03217, 36.70911], [38.74042, 36.70629], [38.55908, 36.84429], [38.38859, 36.90064], [38.21064, 36.91842], [37.81974, 36.76055], [37.68048, 36.75065], [37.49103, 36.66904], [37.47253, 36.63243], [37.21988, 36.6736], [37.16177, 36.66069], [37.10894, 36.6704], [37.08279, 36.63495], [37.02088, 36.66422], [37.01647, 36.69512], [37.04619, 36.71101], [37.04399, 36.73483], [36.99886, 36.74012], [36.99557, 36.75997], [36.66727, 36.82901], [36.61581, 36.74629], [36.62681, 36.71189], [36.57398, 36.65186], [36.58829, 36.58295], [36.54206, 36.49539], [36.6081, 36.33772], [36.65653, 36.33861], [36.68672, 36.23677], [36.6125, 36.22592], [36.50463, 36.2419], [36.4617, 36.20461], [36.39206, 36.22088], [36.37474, 36.01163], [36.33956, 35.98687], [36.30099, 36.00985], [36.28338, 36.00273], [36.29769, 35.96086], [36.27678, 35.94839], [36.25366, 35.96264], [36.19973, 35.95195], [36.17441, 35.92076], [36.1623, 35.80925], [36.14029, 35.81015], [36.13919, 35.83692], [36.11827, 35.85923], [35.99829, 35.88242], [36.01844, 35.92403], [36.00514, 35.94113], [35.98499, 35.94107], [35.931, 35.92109], [35.51152, 36.10954], [35.48515, 34.70851], [35.97386, 34.63322], [35.98718, 34.64977], [36.29165, 34.62991], [36.32399, 34.69334], [36.35135, 34.68516], [36.35384, 34.65447], [36.42941, 34.62505], [36.46003, 34.6378], [36.45299, 34.59438], [36.41429, 34.61175], [36.39846, 34.55672], [36.3369, 34.52629], [36.34745, 34.5002], [36.4442, 34.50165], [36.46179, 34.46541], [36.55853, 34.41609], [36.53039, 34.3798], [36.56556, 34.31881], [36.60778, 34.31009], [36.58667, 34.27667], [36.59195, 34.2316], [36.62537, 34.20251], [36.5128, 34.09916], [36.50576, 34.05982], [36.41078, 34.05253], [36.28589, 33.91981], [36.38263, 33.86579], [36.3967, 33.83365], [36.14517, 33.85118], [36.06778, 33.82927], [35.9341, 33.6596], [36.05723, 33.57904], [35.94465, 33.52774], [35.94816, 33.47886], [35.88668, 33.43183], [35.82577, 33.40479], [35.81324, 33.36354], [35.77477, 33.33609], [35.813, 33.3172], [35.77513, 33.27342], [35.81295, 33.24841], [35.81647, 33.2028], [35.83846, 33.19397], [35.84285, 33.16673], [35.81911, 33.1336], [35.81911, 33.11077], [35.84802, 33.1031], [35.87188, 32.98028], [35.89298, 32.9456], [35.87012, 32.91976], [35.84021, 32.8725], [35.83758, 32.82817], [35.78745, 32.77938], [35.75983, 32.74803], [35.88405, 32.71321], [35.93307, 32.71966], [35.96633, 32.66237], [36.02239, 32.65911], [36.08074, 32.51463], [36.20379, 32.52751], [36.20875, 32.49529], [36.23948, 32.50108], [36.40959, 32.37908], [36.83946, 32.31293], [38.79171, 33.37328], [40.64314, 34.31604], [40.97676, 34.39788], [41.12388, 34.65742], [41.2345, 34.80049], [41.21654, 35.1508], [41.26569, 35.42708], [41.38184, 35.62502], [41.37027, 35.84095], [41.2564, 36.06012], [41.28864, 36.35368], [41.40058, 36.52502], [41.81736, 36.58782], [42.36697, 37.0627], [42.35724, 37.10998], [42.32313, 37.17814], [42.34735, 37.22548], [42.2824, 37.2798], [42.26039, 37.27017], [42.23683, 37.2863]]]] } },
22883 { type: "Feature", properties: { iso1A2: "SZ", iso1A3: "SWZ", iso1N3: "748", wikidata: "Q1050", nameEn: "Eswatini", aliases: ["Swaziland"], groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["268"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.86881, -25.99973], [31.4175, -25.71886], [31.31237, -25.7431], [31.13073, -25.91558], [30.95819, -26.26303], [30.78927, -26.48271], [30.81101, -26.84722], [30.88826, -26.79622], [30.97757, -26.92706], [30.96088, -27.0245], [31.15027, -27.20151], [31.49834, -27.31549], [31.97592, -27.31675], [31.97463, -27.11057], [32.00893, -26.8096], [32.09664, -26.80721], [32.13315, -26.84345], [32.13409, -26.5317], [32.07352, -26.40185], [32.10435, -26.15656], [32.08599, -26.00978], [32.00916, -25.999], [31.974, -25.95387], [31.86881, -25.99973]]]] } },
22884 { type: "Feature", properties: { iso1A2: "TA", iso1A3: "TAA", wikidata: "Q220982", nameEn: "Tristan da Cunha", aliases: ["SH-TA"], country: "GB", groups: ["SH", "BOTS", "011", "202", "002", "UN"], isoStatus: "excRes", driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["290 8", "44 20"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-13.38232, -34.07258], [-16.67337, -41.9188], [-5.88482, -41.4829], [-13.38232, -34.07258]]]] } },
22885 { type: "Feature", properties: { iso1A2: "TC", iso1A3: "TCA", iso1N3: "796", wikidata: "Q18221", nameEn: "Turks and Caicos Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 649"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.70065, 25.7637], [-72.98446, 20.4801], [-69.80718, 21.35956], [-71.70065, 25.7637]]]] } },
22886 { type: "Feature", properties: { iso1A2: "TD", iso1A3: "TCD", iso1N3: "148", wikidata: "Q657", nameEn: "Chad", groups: ["017", "202", "002", "UN"], callingCodes: ["235"] }, geometry: { type: "MultiPolygon", coordinates: [[[[23.99539, 19.49944], [15.99566, 23.49639], [14.99751, 23.00539], [15.19692, 21.99339], [15.20213, 21.49365], [15.28332, 21.44557], [15.62515, 20.95395], [15.57248, 20.92138], [15.55382, 20.86507], [15.56004, 20.79488], [15.59841, 20.74039], [15.6721, 20.70069], [15.99632, 20.35364], [15.75098, 19.93002], [15.6032, 18.77402], [15.50373, 16.89649], [14.37425, 15.72591], [13.86301, 15.04043], [13.78991, 14.87519], [13.809, 14.72915], [13.67878, 14.64013], [13.68573, 14.55276], [13.48259, 14.46704], [13.47559, 14.40881], [13.6302, 13.71094], [14.08251, 13.0797], [14.46881, 13.08259], [14.56101, 12.91036], [14.55058, 12.78256], [14.83314, 12.62963], [14.90827, 12.3269], [14.89019, 12.16593], [14.96952, 12.0925], [15.00146, 12.1223], [15.0349, 12.10698], [15.05786, 12.0608], [15.04808, 11.8731], [15.11579, 11.79313], [15.06595, 11.71126], [15.13149, 11.5537], [15.0585, 11.40481], [15.10021, 11.04101], [15.04957, 11.02347], [15.09127, 10.87431], [15.06737, 10.80921], [15.15532, 10.62846], [15.14936, 10.53915], [15.23724, 10.47764], [15.30874, 10.31063], [15.50535, 10.1098], [15.68761, 9.99344], [15.41408, 9.92876], [15.24618, 9.99246], [15.14043, 9.99246], [15.05999, 9.94845], [14.95722, 9.97926], [14.80082, 9.93818], [14.4673, 10.00264], [14.20411, 10.00055], [14.1317, 9.82413], [14.01793, 9.73169], [13.97544, 9.6365], [14.37094, 9.2954], [14.35707, 9.19611], [14.83566, 8.80557], [15.09484, 8.65982], [15.20426, 8.50892], [15.50743, 7.79302], [15.59272, 7.7696], [15.56964, 7.58936], [15.49743, 7.52179], [15.73118, 7.52006], [15.79942, 7.44149], [16.40703, 7.68809], [16.41583, 7.77971], [16.58315, 7.88657], [16.59415, 7.76444], [16.658, 7.75353], [16.6668, 7.67281], [16.8143, 7.53971], [17.67288, 7.98905], [17.93926, 7.95853], [18.02731, 8.01085], [18.6085, 8.05009], [18.64153, 8.08714], [18.62612, 8.14163], [18.67455, 8.22226], [18.79783, 8.25929], [19.11044, 8.68172], [18.86388, 8.87971], [19.06421, 9.00367], [20.36748, 9.11019], [20.82979, 9.44696], [21.26348, 9.97642], [21.34934, 9.95907], [21.52766, 10.2105], [21.63553, 10.217], [21.71479, 10.29932], [21.72139, 10.64136], [22.45889, 11.00246], [22.87758, 10.91915], [22.97249, 11.21955], [22.93124, 11.41645], [22.7997, 11.40424], [22.54907, 11.64372], [22.64092, 12.07485], [22.48369, 12.02766], [22.50548, 12.16769], [22.38873, 12.45514], [22.46345, 12.61925], [22.22684, 12.74682], [22.15679, 12.66634], [21.98711, 12.63292], [21.89371, 12.68001], [21.81432, 12.81362], [21.94819, 13.05637], [22.02914, 13.13976], [22.1599, 13.19281], [22.29689, 13.3731], [22.08674, 13.77863], [22.22995, 13.96754], [22.5553, 14.11704], [22.55997, 14.23024], [22.44944, 14.24986], [22.38562, 14.58907], [22.70474, 14.69149], [22.66115, 14.86308], [22.99584, 15.22989], [22.99584, 15.40105], [22.92579, 15.47007], [22.93201, 15.55107], [23.10792, 15.71297], [23.38812, 15.69649], [23.62785, 15.7804], [23.99997, 15.69575], [23.99539, 19.49944]]]] } },
22887 { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
22888 { type: "Feature", properties: { iso1A2: "TG", iso1A3: "TGO", iso1N3: "768", wikidata: "Q945", nameEn: "Togo", groups: ["011", "202", "002", "UN"], callingCodes: ["228"] }, geometry: { type: "MultiPolygon", coordinates: [[[[0.50388, 11.01011], [-0.13493, 11.14075], [-0.14462, 11.10811], [-0.05733, 11.08628], [-0.0275, 11.11202], [-514e-5, 11.10763], [342e-5, 11.08317], [0.02395, 11.06229], [0.03355, 10.9807], [-63e-4, 10.96417], [-908e-5, 10.91644], [-0.02685, 10.8783], [-0.0228, 10.81916], [-0.07183, 10.76794], [-0.07327, 10.71845], [-0.09141, 10.7147], [-0.05945, 10.63458], [0.12886, 10.53149], [0.18846, 10.4096], [0.29453, 10.41546], [0.33028, 10.30408], [0.39584, 10.31112], [0.35293, 10.09412], [0.41371, 10.06361], [0.41252, 10.02018], [0.36366, 10.03309], [0.32075, 9.72781], [0.34816, 9.71607], [0.34816, 9.66907], [0.32313, 9.6491], [0.28261, 9.69022], [0.26712, 9.66437], [0.29334, 9.59387], [0.36008, 9.6256], [0.38153, 9.58682], [0.23851, 9.57389], [0.2409, 9.52335], [0.30406, 9.521], [0.31241, 9.50337], [0.2254, 9.47869], [0.25758, 9.42696], [0.33148, 9.44812], [0.36485, 9.49749], [0.49118, 9.48339], [0.56388, 9.40697], [0.45424, 9.04581], [0.52455, 8.87746], [0.37319, 8.75262], [0.47211, 8.59945], [0.64731, 8.48866], [0.73432, 8.29529], [0.63897, 8.25873], [0.5913, 8.19622], [0.61156, 8.18324], [0.6056, 8.13959], [0.58891, 8.12779], [0.62943, 7.85751], [0.58295, 7.62368], [0.51979, 7.58706], [0.52455, 7.45354], [0.57223, 7.39326], [0.62943, 7.41099], [0.65327, 7.31643], [0.59606, 7.01252], [0.52217, 6.9723], [0.52098, 6.94391], [0.56508, 6.92971], [0.52853, 6.82921], [0.57406, 6.80348], [0.58176, 6.76049], [0.6497, 6.73682], [0.63659, 6.63857], [0.74862, 6.56517], [0.71048, 6.53083], [0.89283, 6.33779], [0.99652, 6.33779], [1.03108, 6.24064], [1.05969, 6.22998], [1.09187, 6.17074], [1.19966, 6.17069], [1.19771, 6.11522], [1.27574, 5.93551], [1.67336, 6.02702], [1.62913, 6.24075], [1.79826, 6.28221], [1.76906, 6.43189], [1.58105, 6.68619], [1.61812, 6.74843], [1.55877, 6.99737], [1.64249, 6.99562], [1.61838, 9.0527], [1.5649, 9.16941], [1.41746, 9.3226], [1.33675, 9.54765], [1.36624, 9.5951], [1.35507, 9.99525], [0.77666, 10.37665], [0.80358, 10.71459], [0.8804, 10.803], [0.91245, 10.99597], [0.66104, 10.99964], [0.4958, 10.93269], [0.50521, 10.98035], [0.48852, 10.98561], [0.50388, 11.01011]]]] } },
22889 { type: "Feature", properties: { iso1A2: "TH", iso1A3: "THA", iso1N3: "764", wikidata: "Q869", nameEn: "Thailand", groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["66"] }, geometry: { type: "MultiPolygon", coordinates: [[[[100.08404, 20.36626], [99.95721, 20.46301], [99.91616, 20.44986], [99.90499, 20.4487], [99.89692, 20.44789], [99.89301, 20.44311], [99.89168, 20.44548], [99.88451, 20.44596], [99.88211, 20.44488], [99.86383, 20.44371], [99.81096, 20.33687], [99.68255, 20.32077], [99.46008, 20.39673], [99.46077, 20.36198], [99.5569, 20.20676], [99.52943, 20.14811], [99.416, 20.08614], [99.20328, 20.12877], [99.0735, 20.10298], [98.98679, 19.7419], [98.83661, 19.80931], [98.56065, 19.67807], [98.51182, 19.71303], [98.24884, 19.67876], [98.13829, 19.78541], [98.03314, 19.80941], [98.04364, 19.65755], [97.84715, 19.55782], [97.88423, 19.5041], [97.78769, 19.39429], [97.84186, 19.29526], [97.78606, 19.26769], [97.84024, 19.22217], [97.83479, 19.09972], [97.73797, 19.04261], [97.73654, 18.9812], [97.66487, 18.9371], [97.73836, 18.88478], [97.76752, 18.58097], [97.5258, 18.4939], [97.36444, 18.57138], [97.34522, 18.54596], [97.50383, 18.26844], [97.56219, 18.33885], [97.64116, 18.29778], [97.60841, 18.23846], [97.73723, 17.97912], [97.66794, 17.88005], [97.76407, 17.71595], [97.91829, 17.54504], [98.11185, 17.36829], [98.10439, 17.33847], [98.34566, 17.04822], [98.39441, 17.06266], [98.52624, 16.89979], [98.49603, 16.8446], [98.53833, 16.81934], [98.46994, 16.73613], [98.50253, 16.7139], [98.49713, 16.69022], [98.51043, 16.70107], [98.51579, 16.69433], [98.51472, 16.68521], [98.51833, 16.676], [98.51113, 16.64503], [98.5695, 16.62826], [98.57912, 16.55983], [98.63817, 16.47424], [98.68074, 16.27068], [98.84485, 16.42354], [98.92656, 16.36425], [98.8376, 16.11706], [98.69585, 16.13353], [98.57019, 16.04578], [98.59853, 15.87197], [98.541, 15.65406], [98.58598, 15.46821], [98.56027, 15.33471], [98.4866, 15.39154], [98.39351, 15.34177], [98.41906, 15.27103], [98.40522, 15.25268], [98.30446, 15.30667], [98.22, 15.21327], [98.18821, 15.13125], [98.24874, 14.83013], [98.56762, 14.37701], [98.97356, 14.04868], [99.16695, 13.72621], [99.20617, 13.20575], [99.12225, 13.19847], [99.10646, 13.05804], [99.18748, 12.9898], [99.18905, 12.84799], [99.29254, 12.68921], [99.409, 12.60603], [99.47519, 12.1353], [99.56445, 12.14805], [99.53424, 12.02317], [99.64891, 11.82699], [99.64108, 11.78948], [99.5672, 11.62732], [99.47598, 11.62434], [99.39485, 11.3925], [99.31573, 11.32081], [99.32756, 11.28545], [99.06938, 10.94857], [99.02337, 10.97217], [98.99701, 10.92962], [99.0069, 10.85485], [98.86819, 10.78336], [98.78511, 10.68351], [98.77275, 10.62548], [98.81944, 10.52761], [98.7391, 10.31488], [98.55174, 9.92804], [98.52291, 9.92389], [98.47298, 9.95782], [98.33094, 9.91973], [98.12555, 9.44056], [97.63455, 9.60854], [97.19814, 8.18901], [99.31854, 5.99868], [99.50117, 6.44501], [99.91873, 6.50233], [100.0756, 6.4045], [100.12, 6.42105], [100.19511, 6.72559], [100.29651, 6.68439], [100.30828, 6.66462], [100.31618, 6.66781], [100.31884, 6.66423], [100.32671, 6.66526], [100.32607, 6.65933], [100.31929, 6.65413], [100.35413, 6.54932], [100.41152, 6.52299], [100.41791, 6.5189], [100.42351, 6.51762], [100.43027, 6.52389], [100.66986, 6.45086], [100.74361, 6.50811], [100.74822, 6.46231], [100.81045, 6.45086], [100.85884, 6.24929], [101.10313, 6.25617], [101.12618, 6.19431], [101.06165, 6.14161], [101.12388, 6.11411], [101.087, 5.9193], [101.02708, 5.91013], [100.98815, 5.79464], [101.14062, 5.61613], [101.25755, 5.71065], [101.25524, 5.78633], [101.58019, 5.93534], [101.69773, 5.75881], [101.75074, 5.79091], [101.80144, 5.74505], [101.89188, 5.8386], [101.91776, 5.84269], [101.92819, 5.85511], [101.94712, 5.98421], [101.9714, 6.00575], [101.97114, 6.01992], [101.99209, 6.04075], [102.01835, 6.05407], [102.09182, 6.14161], [102.07732, 6.193], [102.08127, 6.22679], [102.09086, 6.23546], [102.46318, 7.22462], [102.47649, 9.66162], [102.52395, 11.25257], [102.91449, 11.65512], [102.90973, 11.75613], [102.83957, 11.8519], [102.78427, 11.98746], [102.77026, 12.06815], [102.70176, 12.1686], [102.73134, 12.37091], [102.78116, 12.40284], [102.7796, 12.43781], [102.57567, 12.65358], [102.51963, 12.66117], [102.4994, 12.71736], [102.53053, 12.77506], [102.49335, 12.92711], [102.48694, 12.97537], [102.52275, 12.99813], [102.46011, 13.08057], [102.43422, 13.09061], [102.36146, 13.26006], [102.36001, 13.31142], [102.34611, 13.35618], [102.35692, 13.38274], [102.35563, 13.47307], [102.361, 13.50551], [102.33828, 13.55613], [102.36859, 13.57488], [102.44601, 13.5637], [102.5358, 13.56933], [102.57573, 13.60461], [102.62483, 13.60883], [102.58635, 13.6286], [102.5481, 13.6589], [102.56848, 13.69366], [102.72727, 13.77806], [102.77864, 13.93374], [102.91251, 14.01531], [102.93275, 14.19044], [103.16469, 14.33075], [103.39353, 14.35639], [103.53518, 14.42575], [103.71109, 14.4348], [103.70175, 14.38052], [103.93836, 14.3398], [104.27616, 14.39861], [104.55014, 14.36091], [104.69335, 14.42726], [104.97667, 14.38806], [105.02804, 14.23722], [105.08408, 14.20402], [105.14012, 14.23873], [105.17748, 14.34432], [105.20894, 14.34967], [105.43783, 14.43865], [105.53864, 14.55731], [105.5121, 14.80802], [105.61162, 15.00037], [105.46661, 15.13132], [105.58043, 15.32724], [105.50662, 15.32054], [105.4692, 15.33709], [105.47635, 15.3796], [105.58191, 15.41031], [105.60446, 15.53301], [105.61756, 15.68792], [105.46573, 15.74742], [105.42285, 15.76971], [105.37959, 15.84074], [105.34115, 15.92737], [105.38508, 15.987], [105.42001, 16.00657], [105.06204, 16.09792], [105.00262, 16.25627], [104.88057, 16.37311], [104.73349, 16.565], [104.76099, 16.69302], [104.7397, 16.81005], [104.76442, 16.84752], [104.7373, 16.91125], [104.73712, 17.01404], [104.80716, 17.19025], [104.80061, 17.39367], [104.69867, 17.53038], [104.45404, 17.66788], [104.35432, 17.82871], [104.2757, 17.86139], [104.21776, 17.99335], [104.10927, 18.10826], [104.06533, 18.21656], [103.97725, 18.33631], [103.93916, 18.33914], [103.85642, 18.28666], [103.82449, 18.33979], [103.699, 18.34125], [103.60957, 18.40528], [103.47773, 18.42841], [103.41044, 18.4486], [103.30977, 18.4341], [103.24779, 18.37807], [103.23818, 18.34875], [103.29757, 18.30475], [103.17093, 18.2618], [103.14994, 18.23172], [103.1493, 18.17799], [103.07343, 18.12351], [103.07823, 18.03833], [103.0566, 18.00144], [103.01998, 17.97095], [102.9912, 17.9949], [102.95812, 18.0054], [102.86323, 17.97531], [102.81988, 17.94233], [102.79044, 17.93612], [102.75954, 17.89561], [102.68538, 17.86653], [102.67543, 17.84529], [102.69946, 17.81686], [102.68194, 17.80151], [102.59485, 17.83537], [102.5896, 17.84889], [102.61432, 17.92273], [102.60971, 17.95411], [102.59234, 17.96127], [102.45523, 17.97106], [102.11359, 18.21532], [101.88485, 18.02474], [101.78087, 18.07559], [101.72294, 17.92867], [101.44667, 17.7392], [101.15108, 17.47586], [100.96541, 17.57926], [101.02185, 17.87637], [101.1793, 18.0544], [101.19118, 18.2125], [101.15108, 18.25624], [101.18227, 18.34367], [101.06047, 18.43247], [101.27585, 18.68875], [101.22832, 18.73377], [101.25803, 18.89545], [101.35606, 19.04716], [101.261, 19.12717], [101.24911, 19.33334], [101.20604, 19.35296], [101.21347, 19.46223], [101.26991, 19.48324], [101.26545, 19.59242], [101.08928, 19.59748], [100.90302, 19.61901], [100.77231, 19.48324], [100.64606, 19.55884], [100.58219, 19.49164], [100.49604, 19.53504], [100.398, 19.75047], [100.5094, 19.87904], [100.58808, 20.15791], [100.55218, 20.17741], [100.51052, 20.14928], [100.47567, 20.19133], [100.4537, 20.19971], [100.44992, 20.23644], [100.41473, 20.25625], [100.37439, 20.35156], [100.33383, 20.4028], [100.25769, 20.3992], [100.22076, 20.31598], [100.16668, 20.2986], [100.1712, 20.24324], [100.11785, 20.24787], [100.09337, 20.26293], [100.09999, 20.31614], [100.08404, 20.36626]]]] } },
22890 { type: "Feature", properties: { iso1A2: "TJ", iso1A3: "TJK", iso1N3: "762", wikidata: "Q863", nameEn: "Tajikistan", groups: ["143", "142", "UN"], callingCodes: ["992"] }, geometry: { type: "MultiPolygon", coordinates: [[[[70.45251, 41.04438], [70.38028, 41.02014], [70.36655, 40.90296], [69.69434, 40.62615], [69.59441, 40.70181], [69.53021, 40.77621], [69.38327, 40.7918], [69.32834, 40.70233], [69.3455, 40.57988], [69.2643, 40.57506], [69.21063, 40.54469], [69.27066, 40.49274], [69.28525, 40.41894], [69.30774, 40.36102], [69.33794, 40.34819], [69.32833, 40.29794], [69.30808, 40.2821], [69.24817, 40.30357], [69.25229, 40.26362], [69.30104, 40.24502], [69.30448, 40.18774], [69.2074, 40.21488], [69.15659, 40.2162], [69.04544, 40.22904], [68.85832, 40.20885], [68.84357, 40.18604], [68.79276, 40.17555], [68.77902, 40.20492], [68.5332, 40.14826], [68.52771, 40.11676], [68.62796, 40.07789], [69.01523, 40.15771], [69.01935, 40.11466], [68.96579, 40.06949], [68.84906, 40.04952], [68.93695, 39.91167], [68.88889, 39.87163], [68.63071, 39.85265], [68.61972, 39.68905], [68.54166, 39.53929], [68.12053, 39.56317], [67.70992, 39.66156], [67.62889, 39.60234], [67.44899, 39.57799], [67.46547, 39.53564], [67.39681, 39.52505], [67.46822, 39.46146], [67.45998, 39.315], [67.36522, 39.31287], [67.33226, 39.23739], [67.67833, 39.14479], [67.68915, 39.00775], [68.09704, 39.02589], [68.19743, 38.85985], [68.06948, 38.82115], [68.12877, 38.73677], [68.05598, 38.71641], [68.0807, 38.64136], [68.05873, 38.56087], [68.11366, 38.47169], [68.06274, 38.39435], [68.13289, 38.40822], [68.40343, 38.19484], [68.27159, 37.91477], [68.12635, 37.93], [67.81566, 37.43107], [67.8474, 37.31594], [67.78329, 37.1834], [67.7803, 37.08978], [67.87917, 37.0591], [68.02194, 36.91923], [68.18542, 37.02074], [68.27605, 37.00977], [68.29253, 37.10621], [68.41201, 37.10402], [68.41888, 37.13906], [68.61851, 37.19815], [68.6798, 37.27906], [68.81438, 37.23862], [68.80889, 37.32494], [68.91189, 37.26704], [68.88168, 37.33368], [68.96407, 37.32603], [69.03274, 37.25174], [69.25152, 37.09426], [69.39529, 37.16752], [69.45022, 37.23315], [69.36645, 37.40462], [69.44954, 37.4869], [69.51888, 37.5844], [69.80041, 37.5746], [69.84435, 37.60616], [69.93362, 37.61378], [69.95971, 37.5659], [70.15015, 37.52519], [70.28243, 37.66706], [70.27694, 37.81258], [70.1863, 37.84296], [70.17206, 37.93276], [70.4898, 38.12546], [70.54673, 38.24541], [70.60407, 38.28046], [70.61526, 38.34774], [70.64966, 38.34999], [70.69189, 38.37031], [70.6761, 38.39144], [70.67438, 38.40597], [70.69807, 38.41861], [70.72485, 38.4131], [70.75455, 38.4252], [70.77132, 38.45548], [70.78581, 38.45502], [70.78702, 38.45031], [70.79766, 38.44944], [70.80521, 38.44447], [70.81697, 38.44507], [70.82538, 38.45394], [70.84376, 38.44688], [70.88719, 38.46826], [70.92728, 38.43021], [70.98693, 38.48862], [71.03545, 38.44779], [71.0556, 38.40176], [71.09542, 38.42517], [71.10592, 38.42077], [71.10957, 38.40671], [71.1451, 38.40106], [71.21291, 38.32797], [71.33114, 38.30339], [71.33869, 38.27335], [71.37803, 38.25641], [71.36444, 38.15358], [71.29878, 38.04429], [71.28922, 38.01272], [71.27622, 37.99946], [71.27278, 37.96496], [71.24969, 37.93031], [71.2809, 37.91995], [71.296, 37.93403], [71.32871, 37.88564], [71.51565, 37.95349], [71.58843, 37.92425], [71.59255, 37.79956], [71.55752, 37.78677], [71.54324, 37.77104], [71.53053, 37.76534], [71.55234, 37.73209], [71.54186, 37.69691], [71.51972, 37.61945], [71.5065, 37.60912], [71.49693, 37.53527], [71.50616, 37.50733], [71.5256, 37.47971], [71.49612, 37.4279], [71.47685, 37.40281], [71.4862, 37.33405], [71.49821, 37.31975], [71.50674, 37.31502], [71.48536, 37.26017], [71.4824, 37.24921], [71.48339, 37.23937], [71.47386, 37.2269], [71.4555, 37.21418], [71.4494, 37.18137], [71.44127, 37.11856], [71.43097, 37.05855], [71.45578, 37.03094], [71.46923, 36.99925], [71.48481, 36.93218], [71.51502, 36.89128], [71.57195, 36.74943], [71.67083, 36.67346], [71.83229, 36.68084], [72.31676, 36.98115], [72.54095, 37.00007], [72.66381, 37.02014], [72.79693, 37.22222], [73.06884, 37.31729], [73.29633, 37.46495], [73.77197, 37.4417], [73.76647, 37.33913], [73.61129, 37.27469], [73.64974, 37.23643], [73.82552, 37.22659], [73.8564, 37.26158], [74.20308, 37.34208], [74.23339, 37.41116], [74.41055, 37.3948], [74.56161, 37.37734], [74.68383, 37.3948], [74.8294, 37.3435], [74.88887, 37.23275], [75.12328, 37.31839], [75.09719, 37.37297], [75.15899, 37.41443], [75.06011, 37.52779], [74.94338, 37.55501], [74.8912, 37.67576], [75.00935, 37.77486], [74.92416, 37.83428], [74.9063, 38.03033], [74.82665, 38.07359], [74.80331, 38.19889], [74.69894, 38.22155], [74.69619, 38.42947], [74.51217, 38.47034], [74.17022, 38.65504], [73.97933, 38.52945], [73.79806, 38.61106], [73.80656, 38.66449], [73.7033, 38.84782], [73.7445, 38.93867], [73.82964, 38.91517], [73.81728, 39.04007], [73.75823, 39.023], [73.60638, 39.24534], [73.54572, 39.27567], [73.55396, 39.3543], [73.5004, 39.38402], [73.59241, 39.40843], [73.59831, 39.46425], [73.45096, 39.46677], [73.31912, 39.38615], [73.18454, 39.35536], [72.85934, 39.35116], [72.62027, 39.39696], [72.33173, 39.33093], [72.23834, 39.17248], [72.17242, 39.2661], [72.09689, 39.26823], [72.04059, 39.36704], [71.90601, 39.27674], [71.79202, 39.27355], [71.7522, 39.32031], [71.80164, 39.40631], [71.76816, 39.45456], [71.62688, 39.44056], [71.5517, 39.45722], [71.55856, 39.57588], [71.49814, 39.61397], [71.08752, 39.50704], [71.06418, 39.41586], [70.7854, 39.38933], [70.64087, 39.58792], [70.44757, 39.60128], [70.2869, 39.53141], [70.11111, 39.58223], [69.87491, 39.53882], [69.68677, 39.59281], [69.3594, 39.52516], [69.26938, 39.8127], [69.35649, 40.01994], [69.43134, 39.98431], [69.43557, 39.92877], [69.53615, 39.93991], [69.5057, 40.03277], [69.53855, 40.0887], [69.53794, 40.11833], [69.55555, 40.12296], [69.57615, 40.10524], [69.64704, 40.12165], [69.67001, 40.10639], [70.01283, 40.23288], [70.58297, 40.00891], [70.57384, 39.99394], [70.47557, 39.93216], [70.55033, 39.96619], [70.58912, 39.95211], [70.65946, 39.9878], [70.65827, 40.0981], [70.7928, 40.12797], [70.80495, 40.16813], [70.9818, 40.22392], [70.8607, 40.217], [70.62342, 40.17396], [70.56394, 40.26421], [70.57149, 40.3442], [70.37511, 40.38605], [70.32626, 40.45174], [70.49871, 40.52503], [70.80009, 40.72825], [70.45251, 41.04438]]], [[[70.68112, 40.90612], [70.6158, 40.97661], [70.56077, 41.00642], [70.54223, 40.98787], [70.57501, 40.98941], [70.6721, 40.90555], [70.68112, 40.90612]]], [[[70.74189, 39.86319], [70.53651, 39.89155], [70.52631, 39.86989], [70.54998, 39.85137], [70.59667, 39.83542], [70.63105, 39.77923], [70.74189, 39.86319]]]] } },
22891 { type: "Feature", properties: { iso1A2: "TK", iso1A3: "TKL", iso1N3: "772", wikidata: "Q36823", nameEn: "Tokelau", country: "NZ", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["690"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-168.251, -9.44289], [-174.18635, -7.80441], [-174.17993, -10.13616], [-168.251, -9.44289]]]] } },
22892 { type: "Feature", properties: { iso1A2: "TL", iso1A3: "TLS", iso1N3: "626", wikidata: "Q574", nameEn: "East Timor", aliases: ["Timor-Leste", "TP"], groups: ["035", "142", "UN"], driveSide: "left", callingCodes: ["670"] }, geometry: { type: "MultiPolygon", coordinates: [[[[124.46701, -9.13002], [124.94011, -8.85617], [124.97742, -9.08128], [125.11764, -8.96359], [125.18632, -9.03142], [125.18907, -9.16434], [125.09434, -9.19669], [125.04044, -9.17093], [124.97892, -9.19281], [125.09025, -9.46406], [125.68138, -9.85176], [127.55165, -9.05052], [127.42116, -8.22471], [125.87691, -8.31789], [125.58506, -7.95311], [124.92337, -8.75859], [124.33472, -9.11416], [124.04628, -9.22671], [124.04286, -9.34243], [124.10539, -9.41206], [124.14517, -9.42324], [124.21247, -9.36904], [124.28115, -9.42189], [124.28115, -9.50453], [124.3535, -9.48493], [124.35258, -9.43002], [124.38554, -9.3582], [124.45971, -9.30263], [124.46701, -9.13002]]]] } },
22893 { type: "Feature", properties: { iso1A2: "TM", iso1A3: "TKM", iso1N3: "795", wikidata: "Q874", nameEn: "Turkmenistan", groups: ["143", "142", "UN"], callingCodes: ["993"] }, geometry: { type: "MultiPolygon", coordinates: [[[[60.5078, 41.21694], [60.06581, 41.4363], [60.18117, 41.60082], [60.06032, 41.76287], [60.08504, 41.80997], [60.33223, 41.75058], [59.95046, 41.97966], [60.0356, 42.01028], [60.04659, 42.08982], [59.96419, 42.1428], [60.00539, 42.212], [59.94633, 42.27655], [59.4341, 42.29738], [59.2955, 42.37064], [59.17317, 42.52248], [58.93422, 42.5407], [58.6266, 42.79314], [58.57991, 42.64988], [58.27504, 42.69632], [58.14321, 42.62159], [58.29427, 42.56497], [58.51674, 42.30348], [58.40688, 42.29535], [58.3492, 42.43335], [57.99214, 42.50021], [57.90975, 42.4374], [57.92897, 42.24047], [57.84932, 42.18555], [57.6296, 42.16519], [57.30275, 42.14076], [57.03633, 41.92043], [56.96218, 41.80383], [57.03359, 41.41777], [57.13796, 41.36625], [57.03423, 41.25435], [56.00314, 41.32584], [55.45471, 41.25609], [54.95182, 41.92424], [54.20635, 42.38477], [52.97575, 42.1308], [52.47884, 41.78034], [52.26048, 41.69249], [51.7708, 40.29239], [53.89734, 37.3464], [54.24565, 37.32047], [54.36211, 37.34912], [54.58664, 37.45809], [54.67247, 37.43532], [54.77822, 37.51597], [54.81804, 37.61285], [54.77684, 37.62264], [54.851, 37.75739], [55.13412, 37.94705], [55.44152, 38.08564], [55.76561, 38.12238], [55.97847, 38.08024], [56.33278, 38.08132], [56.32454, 38.18502], [56.43303, 38.26054], [56.62255, 38.24005], [56.73928, 38.27887], [57.03453, 38.18717], [57.21169, 38.28965], [57.37236, 38.09321], [57.35042, 37.98546], [57.79534, 37.89299], [58.21399, 37.77281], [58.22999, 37.6856], [58.39959, 37.63134], [58.47786, 37.6433], [58.5479, 37.70526], [58.6921, 37.64548], [58.9338, 37.67374], [59.22905, 37.51161], [59.33507, 37.53146], [59.39797, 37.47892], [59.39385, 37.34257], [59.55178, 37.13594], [59.74678, 37.12499], [60.00768, 37.04102], [60.34767, 36.63214], [61.14516, 36.64644], [61.18187, 36.55348], [61.1393, 36.38782], [61.22719, 36.12759], [61.12007, 35.95992], [61.22444, 35.92879], [61.26152, 35.80749], [61.22719, 35.67038], [61.27371, 35.61482], [61.58742, 35.43803], [61.77693, 35.41341], [61.97743, 35.4604], [62.05709, 35.43803], [62.15871, 35.33278], [62.29191, 35.25964], [62.29878, 35.13312], [62.48006, 35.28796], [62.62288, 35.22067], [62.74098, 35.25432], [62.90853, 35.37086], [63.0898, 35.43131], [63.12276, 35.53196], [63.10079, 35.63024], [63.23262, 35.67487], [63.10318, 35.81782], [63.12276, 35.86208], [63.29579, 35.85985], [63.53475, 35.90881], [63.56496, 35.95106], [63.98519, 36.03773], [64.05385, 36.10433], [64.43288, 36.24401], [64.57295, 36.34362], [64.62514, 36.44311], [64.61141, 36.6351], [64.97945, 37.21913], [65.51778, 37.23881], [65.64263, 37.34388], [65.64137, 37.45061], [65.72274, 37.55438], [66.30993, 37.32409], [66.55743, 37.35409], [66.52303, 37.39827], [66.65761, 37.45497], [66.52852, 37.58568], [66.53676, 37.80084], [66.67684, 37.96776], [66.56697, 38.0435], [66.41042, 38.02403], [66.24013, 38.16238], [65.83913, 38.25733], [65.55873, 38.29052], [64.32576, 38.98691], [64.19086, 38.95561], [63.70778, 39.22349], [63.6913, 39.27666], [62.43337, 39.98528], [62.34273, 40.43206], [62.11751, 40.58242], [61.87856, 41.12257], [61.4446, 41.29407], [61.39732, 41.19873], [61.33199, 41.14946], [61.22212, 41.14946], [61.03261, 41.25691], [60.5078, 41.21694]]]] } },
22894 { type: "Feature", properties: { iso1A2: "TN", iso1A3: "TUN", iso1N3: "788", wikidata: "Q948", nameEn: "Tunisia", groups: ["015", "002", "UN"], callingCodes: ["216"] }, geometry: { type: "MultiPolygon", coordinates: [[[[11.2718, 37.6713], [7.89009, 38.19924], [8.59123, 37.14286], [8.64044, 36.9401], [8.62972, 36.86499], [8.67706, 36.8364], [8.57613, 36.78062], [8.46537, 36.7706], [8.47609, 36.66607], [8.16167, 36.48817], [8.18936, 36.44939], [8.40731, 36.42208], [8.2626, 35.91733], [8.26472, 35.73669], [8.35371, 35.66373], [8.36086, 35.47774], [8.30329, 35.29884], [8.47318, 35.23376], [8.3555, 35.10007], [8.30727, 34.95378], [8.25189, 34.92009], [8.29655, 34.72798], [8.20482, 34.57575], [7.86264, 34.3987], [7.81242, 34.21841], [7.74207, 34.16492], [7.66174, 34.20167], [7.52851, 34.06493], [7.54088, 33.7726], [7.73687, 33.42114], [7.83028, 33.18851], [8.11433, 33.10175], [8.1179, 33.05086], [8.31895, 32.83483], [8.35999, 32.50101], [9.07483, 32.07865], [9.55544, 30.23971], [9.76848, 30.34366], [9.88152, 30.34074], [10.29516, 30.90337], [10.12239, 31.42098], [10.31364, 31.72648], [10.48497, 31.72956], [10.62788, 31.96629], [10.7315, 31.97235], [11.04234, 32.2145], [11.53898, 32.4138], [11.57828, 32.48013], [11.46037, 32.6307], [11.51549, 33.09826], [11.55852, 33.1409], [11.58941, 33.36891], [11.2718, 37.6713]]]] } },
22895 { type: "Feature", properties: { iso1A2: "TO", iso1A3: "TON", iso1N3: "776", wikidata: "Q678", nameEn: "Tonga", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["676"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-176.74538, -22.89767], [-180, -22.90585], [-180, -24.21376], [-173.10761, -24.19665], [-173.13438, -14.94228], [-176.76826, -14.95183], [-176.74538, -22.89767]]]] } },
22896 { type: "Feature", properties: { iso1A2: "TR", iso1A3: "TUR", iso1N3: "792", wikidata: "Q43", nameEn: "Turkey", groups: ["145", "142", "UN"], callingCodes: ["90"] }, geometry: { type: "MultiPolygon", coordinates: [[[[41.54366, 41.52185], [40.89217, 41.72528], [34.8305, 42.4581], [28.32297, 41.98371], [28.02971, 41.98066], [27.91479, 41.97902], [27.83492, 41.99709], [27.81235, 41.94803], [27.69949, 41.97515], [27.55191, 41.90928], [27.52379, 41.93756], [27.45478, 41.96591], [27.27411, 42.10409], [27.22376, 42.10152], [27.19251, 42.06028], [27.08486, 42.08735], [27.03277, 42.0809], [26.95638, 42.00741], [26.79143, 41.97386], [26.62996, 41.97644], [26.56051, 41.92995], [26.57961, 41.90024], [26.53968, 41.82653], [26.36952, 41.82265], [26.33589, 41.76802], [26.32952, 41.73637], [26.35957, 41.71149], [26.47958, 41.67037], [26.5209, 41.62592], [26.59196, 41.60491], [26.59742, 41.48058], [26.61767, 41.42281], [26.62997, 41.34613], [26.5837, 41.32131], [26.5209, 41.33993], [26.39861, 41.25053], [26.32259, 41.24929], [26.31928, 41.07386], [26.3606, 41.02027], [26.33297, 40.98388], [26.35894, 40.94292], [26.32259, 40.94042], [26.28623, 40.93005], [26.29441, 40.89119], [26.26169, 40.9168], [26.20856, 40.86048], [26.21351, 40.83298], [26.15685, 40.80709], [26.12854, 40.77339], [26.12495, 40.74283], [26.08638, 40.73214], [26.0754, 40.72772], [26.03489, 40.73051], [25.94795, 40.72797], [26.04292, 40.3958], [25.61285, 40.17161], [25.94257, 39.39358], [26.43357, 39.43096], [26.70773, 39.0312], [26.61814, 38.81372], [26.21136, 38.65436], [26.32173, 38.48731], [26.24183, 38.44695], [26.21136, 38.17558], [27.05537, 37.9131], [27.16428, 37.72343], [26.99377, 37.69034], [26.95583, 37.64989], [27.14757, 37.32], [27.20312, 36.94571], [27.45627, 36.9008], [27.24613, 36.71622], [27.46117, 36.53789], [27.89482, 36.69898], [27.95037, 36.46155], [28.23708, 36.56812], [29.30783, 36.01033], [29.48192, 36.18377], [29.61002, 36.1731], [29.61805, 36.14179], [29.69611, 36.10365], [29.73302, 35.92555], [32.82353, 35.70297], [35.51152, 36.10954], [35.931, 35.92109], [35.98499, 35.94107], [36.00514, 35.94113], [36.01844, 35.92403], [35.99829, 35.88242], [36.11827, 35.85923], [36.13919, 35.83692], [36.14029, 35.81015], [36.1623, 35.80925], [36.17441, 35.92076], [36.19973, 35.95195], [36.25366, 35.96264], [36.27678, 35.94839], [36.29769, 35.96086], [36.28338, 36.00273], [36.30099, 36.00985], [36.33956, 35.98687], [36.37474, 36.01163], [36.39206, 36.22088], [36.4617, 36.20461], [36.50463, 36.2419], [36.6125, 36.22592], [36.68672, 36.23677], [36.65653, 36.33861], [36.6081, 36.33772], [36.54206, 36.49539], [36.58829, 36.58295], [36.57398, 36.65186], [36.62681, 36.71189], [36.61581, 36.74629], [36.66727, 36.82901], [36.99557, 36.75997], [36.99886, 36.74012], [37.04399, 36.73483], [37.04619, 36.71101], [37.01647, 36.69512], [37.02088, 36.66422], [37.08279, 36.63495], [37.10894, 36.6704], [37.16177, 36.66069], [37.21988, 36.6736], [37.47253, 36.63243], [37.49103, 36.66904], [37.68048, 36.75065], [37.81974, 36.76055], [38.21064, 36.91842], [38.38859, 36.90064], [38.55908, 36.84429], [38.74042, 36.70629], [39.03217, 36.70911], [39.21538, 36.66834], [39.81589, 36.75538], [40.69136, 37.0996], [40.90856, 37.13147], [41.21937, 37.07665], [41.515, 37.08084], [42.00894, 37.17209], [42.18225, 37.28569], [42.19301, 37.31323], [42.2112, 37.32491], [42.22257, 37.31395], [42.22381, 37.30238], [42.20454, 37.28715], [42.21548, 37.28026], [42.23683, 37.2863], [42.26039, 37.27017], [42.2824, 37.2798], [42.34735, 37.22548], [42.32313, 37.17814], [42.35724, 37.10998], [42.56725, 37.14878], [42.78887, 37.38615], [42.93705, 37.32015], [43.11403, 37.37436], [43.30083, 37.30629], [43.33508, 37.33105], [43.50787, 37.24436], [43.56702, 37.25675], [43.63085, 37.21957], [43.7009, 37.23692], [43.8052, 37.22825], [43.82699, 37.19477], [43.84878, 37.22205], [43.90949, 37.22453], [44.02002, 37.33229], [44.13521, 37.32486], [44.2613, 37.25055], [44.27998, 37.16501], [44.22239, 37.15756], [44.18503, 37.09551], [44.25975, 36.98119], [44.30645, 36.97373], [44.35937, 37.02843], [44.35315, 37.04955], [44.38117, 37.05825], [44.42631, 37.05825], [44.63179, 37.19229], [44.76698, 37.16162], [44.78319, 37.1431], [44.7868, 37.16644], [44.75986, 37.21549], [44.81021, 37.2915], [44.58449, 37.45018], [44.61401, 37.60165], [44.56887, 37.6429], [44.62096, 37.71985], [44.55498, 37.783], [44.45948, 37.77065], [44.3883, 37.85433], [44.22509, 37.88859], [44.42476, 38.25763], [44.50115, 38.33939], [44.44386, 38.38295], [44.38309, 38.36117], [44.3119, 38.37887], [44.3207, 38.49799], [44.32058, 38.62752], [44.28065, 38.6465], [44.26155, 38.71427], [44.30322, 38.81581], [44.18863, 38.93881], [44.20946, 39.13975], [44.1043, 39.19842], [44.03667, 39.39223], [44.22452, 39.4169], [44.29818, 39.378], [44.37921, 39.4131], [44.42832, 39.4131], [44.41849, 39.56659], [44.48111, 39.61579], [44.47298, 39.68788], [44.6137, 39.78393], [44.65422, 39.72163], [44.71806, 39.71124], [44.81043, 39.62677], [44.80977, 39.65768], [44.75779, 39.7148], [44.61845, 39.8281], [44.46635, 39.97733], [44.26973, 40.04866], [44.1778, 40.02845], [44.1057, 40.03555], [43.92307, 40.01787], [43.65688, 40.11199], [43.65221, 40.14889], [43.71136, 40.16673], [43.59928, 40.34019], [43.60862, 40.43267], [43.54791, 40.47413], [43.63664, 40.54159], [43.7425, 40.66805], [43.74872, 40.7365], [43.67712, 40.84846], [43.67712, 40.93084], [43.58683, 40.98961], [43.47319, 41.02251], [43.44984, 41.0988], [43.4717, 41.12611], [43.44973, 41.17666], [43.36118, 41.2028], [43.23096, 41.17536], [43.1945, 41.25242], [43.13373, 41.25503], [43.21707, 41.30331], [43.02956, 41.37891], [42.8785, 41.50516], [42.84899, 41.47265], [42.78995, 41.50126], [42.84471, 41.58912], [42.72794, 41.59714], [42.59202, 41.58183], [42.51772, 41.43606], [42.26387, 41.49346], [41.95134, 41.52466], [41.81939, 41.43621], [41.7124, 41.47417], [41.7148, 41.4932], [41.54366, 41.52185]]]] } },
22897 { type: "Feature", properties: { iso1A2: "TT", iso1A3: "TTO", iso1N3: "780", wikidata: "Q754", nameEn: "Trinidad and Tobago", groups: ["029", "003", "419", "019", "UN"], driveSide: "left", callingCodes: ["1 868"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-61.62505, 11.18974], [-62.08693, 10.04435], [-60.89962, 9.81445], [-60.07172, 11.77667], [-61.62505, 11.18974]]]] } },
22898 { type: "Feature", properties: { iso1A2: "TV", iso1A3: "TUV", iso1N3: "798", wikidata: "Q672", nameEn: "Tuvalu", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["688"] }, geometry: { type: "MultiPolygon", coordinates: [[[[174, -5], [174, -11.5], [179.99999, -11.5], [179.99999, -5], [174, -5]]]] } },
22899 { type: "Feature", properties: { iso1A2: "TW", iso1A3: "TWN", iso1N3: "158", wikidata: "Q865", nameEn: "Taiwan", aliases: ["RC"], groups: ["030", "142"], callingCodes: ["886"] }, geometry: { type: "MultiPolygon", coordinates: [[[[121.8109, 21.77688], [122.26612, 25.98197], [120.5128, 26.536], [120.0693, 26.3959], [119.78816, 26.2348], [119.98511, 25.37624], [119.42295, 25.0886], [118.6333, 24.46259], [118.42453, 24.54644], [118.35291, 24.51645], [118.28244, 24.51231], [118.11703, 24.39734], [120.69238, 21.52331], [121.8109, 21.77688]]]] } },
22900 { type: "Feature", properties: { iso1A2: "TZ", iso1A3: "TZA", iso1N3: "834", wikidata: "Q924", nameEn: "Tanzania", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["255"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.80408, -0.99911], [30.76635, -0.9852], [30.70631, -1.01175], [30.64166, -1.06601], [30.47194, -1.0555], [30.45116, -1.10641], [30.50889, -1.16412], [30.57123, -1.33264], [30.71974, -1.43244], [30.84079, -1.64652], [30.80802, -1.91477], [30.89303, -2.08223], [30.83915, -2.35795], [30.54501, -2.41404], [30.41789, -2.66266], [30.52747, -2.65841], [30.40662, -2.86151], [30.4987, -2.9573], [30.57926, -2.89791], [30.6675, -2.98987], [30.83823, -2.97837], [30.84165, -3.25152], [30.45915, -3.56532], [30.22042, -4.01738], [30.03323, -4.26631], [29.88172, -4.35743], [29.82885, -4.36153], [29.77289, -4.41733], [29.75109, -4.45836], [29.63827, -4.44681], [29.43673, -4.44845], [29.52552, -6.2731], [30.2567, -7.14121], [30.79243, -8.27382], [31.00796, -8.58615], [31.37533, -8.60769], [31.57147, -8.70619], [31.57147, -8.81388], [31.71158, -8.91386], [31.81587, -8.88618], [31.94663, -8.93846], [31.94196, -9.02303], [31.98866, -9.07069], [32.08206, -9.04609], [32.16146, -9.05993], [32.25486, -9.13371], [32.43543, -9.11988], [32.49147, -9.14754], [32.53661, -9.24281], [32.75611, -9.28583], [32.76233, -9.31963], [32.95389, -9.40138], [32.99397, -9.36712], [33.14925, -9.49322], [33.31581, -9.48554], [33.48052, -9.62442], [33.76677, -9.58516], [33.93298, -9.71647], [33.9638, -9.62206], [33.95829, -9.54066], [34.03865, -9.49398], [34.54499, -10.0678], [34.51911, -10.12279], [34.57581, -10.56271], [34.65946, -10.6828], [34.67047, -10.93796], [34.61161, -11.01611], [34.63305, -11.11731], [34.79375, -11.32245], [34.91153, -11.39799], [34.96296, -11.57354], [35.63599, -11.55927], [35.82767, -11.41081], [36.19094, -11.57593], [36.19094, -11.70008], [36.62068, -11.72884], [36.80309, -11.56836], [37.3936, -11.68949], [37.76614, -11.53352], [37.8388, -11.3123], [37.93618, -11.26228], [38.21598, -11.27289], [38.47258, -11.4199], [38.88996, -11.16978], [39.24395, -11.17433], [39.58249, -10.96043], [40.00295, -10.80255], [40.44265, -10.4618], [40.74206, -10.25691], [40.14328, -4.64201], [39.62121, -4.68136], [39.44306, -4.93877], [39.21631, -4.67835], [37.81321, -3.69179], [37.75036, -3.54243], [37.63099, -3.50723], [37.5903, -3.42735], [37.71745, -3.304], [37.67199, -3.06222], [34.0824, -1.02264], [34.03084, -1.05101], [34.02286, -1.00779], [33.93107, -0.99298], [30.80408, -0.99911]]]] } },
22901 { type: "Feature", properties: { iso1A2: "UA", iso1A3: "UKR", iso1N3: "804", wikidata: "Q212", nameEn: "Ukraine", groups: ["151", "150", "UN"], callingCodes: ["380"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.57318, 46.10317], [33.61467, 46.13561], [33.63854, 46.14147], [33.61517, 46.22615], [33.646, 46.23028], [33.74047, 46.18555], [33.79715, 46.20482], [33.85234, 46.19863], [33.91549, 46.15938], [34.05272, 46.10838], [34.07311, 46.11769], [34.12929, 46.10494], [34.181, 46.06804], [34.25111, 46.0532], [34.33912, 46.06114], [34.41221, 46.00245], [34.44155, 45.95995], [34.48729, 45.94267], [34.52011, 45.95097], [34.55889, 45.99347], [34.60861, 45.99347], [34.66679, 45.97136], [34.75479, 45.90705], [34.80153, 45.90047], [34.79905, 45.81009], [34.96015, 45.75634], [35.23066, 45.79231], [37.62608, 46.82615], [38.12112, 46.86078], [38.3384, 46.98085], [38.22955, 47.12069], [38.23049, 47.2324], [38.32112, 47.2585], [38.33074, 47.30508], [38.22225, 47.30788], [38.28954, 47.39255], [38.28679, 47.53552], [38.35062, 47.61631], [38.76379, 47.69346], [38.79628, 47.81109], [38.87979, 47.87719], [39.73935, 47.82876], [39.82213, 47.96396], [39.77544, 48.04206], [39.88256, 48.04482], [39.83724, 48.06501], [39.94847, 48.22811], [40.00752, 48.22445], [39.99241, 48.31768], [39.97325, 48.31399], [39.9693, 48.29904], [39.95248, 48.29972], [39.91465, 48.26743], [39.90041, 48.3049], [39.84273, 48.30947], [39.84136, 48.33321], [39.94847, 48.35055], [39.88794, 48.44226], [39.86196, 48.46633], [39.84548, 48.57821], [39.79764, 48.58668], [39.67226, 48.59368], [39.71765, 48.68673], [39.73104, 48.7325], [39.79466, 48.83739], [39.97182, 48.79398], [40.08168, 48.87443], [40.03636, 48.91957], [39.98967, 48.86901], [39.78368, 48.91596], [39.74874, 48.98675], [39.72649, 48.9754], [39.71353, 48.98959], [39.6683, 48.99454], [39.6836, 49.05121], [39.93437, 49.05709], [40.01988, 49.1761], [40.22176, 49.25683], [40.18331, 49.34996], [40.14912, 49.37681], [40.1141, 49.38798], [40.03087, 49.45452], [40.03636, 49.52321], [40.16683, 49.56865], [40.13249, 49.61672], [39.84548, 49.56064], [39.65047, 49.61761], [39.59142, 49.73758], [39.44496, 49.76067], [39.27968, 49.75976], [39.1808, 49.88911], [38.9391, 49.79524], [38.90477, 49.86787], [38.73311, 49.90238], [38.68677, 50.00904], [38.65688, 49.97176], [38.35408, 50.00664], [38.32524, 50.08866], [38.18517, 50.08161], [38.21675, 49.98104], [38.02999, 49.90592], [38.02999, 49.94482], [37.90776, 50.04194], [37.79515, 50.08425], [37.75807, 50.07896], [37.61113, 50.21976], [37.62879, 50.24481], [37.62486, 50.29966], [37.47243, 50.36277], [37.48204, 50.46079], [37.08468, 50.34935], [36.91762, 50.34963], [36.69377, 50.26982], [36.64571, 50.218], [36.56655, 50.2413], [36.58371, 50.28563], [36.47817, 50.31457], [36.30101, 50.29088], [36.20763, 50.3943], [36.06893, 50.45205], [35.8926, 50.43829], [35.80388, 50.41356], [35.73659, 50.35489], [35.61711, 50.35707], [35.58003, 50.45117], [35.47463, 50.49247], [35.39464, 50.64751], [35.48116, 50.66405], [35.47704, 50.77274], [35.41367, 50.80227], [35.39307, 50.92145], [35.32598, 50.94524], [35.40837, 51.04119], [35.31774, 51.08434], [35.20375, 51.04723], [35.12685, 51.16191], [35.14058, 51.23162], [34.97304, 51.2342], [34.82472, 51.17483], [34.6874, 51.18], [34.6613, 51.25053], [34.38802, 51.2746], [34.31661, 51.23936], [34.23009, 51.26429], [34.33446, 51.363], [34.22048, 51.4187], [34.30562, 51.5205], [34.17599, 51.63253], [34.07765, 51.67065], [34.42922, 51.72852], [34.41136, 51.82793], [34.09413, 52.00835], [34.11199, 52.14087], [34.05239, 52.20132], [33.78789, 52.37204], [33.55718, 52.30324], [33.48027, 52.31499], [33.51323, 52.35779], [33.18913, 52.3754], [32.89937, 52.2461], [32.85405, 52.27888], [32.69475, 52.25535], [32.54781, 52.32423], [32.3528, 52.32842], [32.38988, 52.24946], [32.33083, 52.23685], [32.34044, 52.1434], [32.2777, 52.10266], [32.23331, 52.08085], [32.08813, 52.03319], [31.92159, 52.05144], [31.96141, 52.08015], [31.85018, 52.11305], [31.81722, 52.09955], [31.7822, 52.11406], [31.38326, 52.12991], [31.25142, 52.04131], [31.13332, 52.1004], [30.95589, 52.07775], [30.90897, 52.00699], [30.76443, 51.89739], [30.68804, 51.82806], [30.51946, 51.59649], [30.64992, 51.35014], [30.56203, 51.25655], [30.36153, 51.33984], [30.34642, 51.42555], [30.17888, 51.51025], [29.77376, 51.4461], [29.7408, 51.53417], [29.54372, 51.48372], [29.49773, 51.39814], [29.42357, 51.4187], [29.32881, 51.37843], [29.25191, 51.49828], [29.25603, 51.57089], [29.20659, 51.56918], [29.16402, 51.64679], [29.1187, 51.65872], [28.99098, 51.56833], [28.95528, 51.59222], [28.81795, 51.55552], [28.76027, 51.48802], [28.78224, 51.45294], [28.75615, 51.41442], [28.73143, 51.46236], [28.69161, 51.44695], [28.64429, 51.5664], [28.47051, 51.59734], [28.37592, 51.54505], [28.23452, 51.66988], [28.10658, 51.57857], [27.95827, 51.56065], [27.91844, 51.61952], [27.85253, 51.62293], [27.76052, 51.47604], [27.67125, 51.50854], [27.71932, 51.60672], [27.55727, 51.63486], [27.51058, 51.5854], [27.47212, 51.61184], [27.24828, 51.60161], [27.26613, 51.65957], [27.20948, 51.66713], [27.20602, 51.77291], [26.99422, 51.76933], [26.9489, 51.73788], [26.80043, 51.75777], [26.69759, 51.82284], [26.46962, 51.80501], [26.39367, 51.87315], [26.19084, 51.86781], [26.00408, 51.92967], [25.83217, 51.92587], [25.80574, 51.94556], [25.73673, 51.91973], [25.46163, 51.92205], [25.20228, 51.97143], [24.98784, 51.91273], [24.37123, 51.88222], [24.29021, 51.80841], [24.3163, 51.75063], [24.13075, 51.66979], [23.99907, 51.58369], [23.8741, 51.59734], [23.91118, 51.63316], [23.7766, 51.66809], [23.60906, 51.62122], [23.6736, 51.50255], [23.62751, 51.50512], [23.69905, 51.40871], [23.63858, 51.32182], [23.80678, 51.18405], [23.90376, 51.07697], [23.92217, 51.00836], [24.04576, 50.90196], [24.14524, 50.86128], [24.0952, 50.83262], [23.99254, 50.83847], [23.95925, 50.79271], [24.0595, 50.71625], [24.0996, 50.60752], [24.07048, 50.5071], [24.03668, 50.44507], [23.99563, 50.41289], [23.79445, 50.40481], [23.71382, 50.38248], [23.67635, 50.33385], [23.28221, 50.0957], [22.99329, 49.84249], [22.83179, 49.69875], [22.80261, 49.69098], [22.78304, 49.65543], [22.64534, 49.53094], [22.69444, 49.49378], [22.748, 49.32759], [22.72009, 49.20288], [22.86336, 49.10513], [22.89122, 49.00725], [22.56155, 49.08865], [22.54338, 49.01424], [22.48296, 48.99172], [22.42934, 48.92857], [22.34151, 48.68893], [22.21379, 48.6218], [22.16023, 48.56548], [22.14689, 48.4005], [22.2083, 48.42534], [22.38133, 48.23726], [22.49806, 48.25189], [22.59007, 48.15121], [22.58733, 48.10813], [22.66835, 48.09162], [22.73427, 48.12005], [22.81804, 48.11363], [22.87847, 48.04665], [22.84276, 47.98602], [22.89849, 47.95851], [22.94301, 47.96672], [22.92241, 48.02002], [23.0158, 47.99338], [23.08858, 48.00716], [23.1133, 48.08061], [23.15999, 48.12188], [23.27397, 48.08245], [23.33577, 48.0237], [23.4979, 47.96858], [23.52803, 48.01818], [23.5653, 48.00499], [23.63894, 48.00293], [23.66262, 47.98786], [23.75188, 47.99705], [23.80904, 47.98142], [23.8602, 47.9329], [23.89352, 47.94512], [23.94192, 47.94868], [23.96337, 47.96672], [23.98553, 47.96076], [24.00801, 47.968], [24.02999, 47.95087], [24.06466, 47.95317], [24.11281, 47.91487], [24.22566, 47.90231], [24.34926, 47.9244], [24.43578, 47.97131], [24.61994, 47.95062], [24.70632, 47.84428], [24.81893, 47.82031], [24.88896, 47.7234], [25.11144, 47.75203], [25.23778, 47.89403], [25.63878, 47.94924], [25.77723, 47.93919], [26.05901, 47.9897], [26.17711, 47.99246], [26.33504, 48.18418], [26.55202, 48.22445], [26.62823, 48.25804], [26.6839, 48.35828], [26.79239, 48.29071], [26.82809, 48.31629], [26.71274, 48.40388], [26.85556, 48.41095], [26.93384, 48.36558], [27.03821, 48.37653], [27.0231, 48.42485], [27.08078, 48.43214], [27.13434, 48.37288], [27.27855, 48.37534], [27.32159, 48.4434], [27.37604, 48.44398], [27.37741, 48.41026], [27.44333, 48.41209], [27.46942, 48.454], [27.5889, 48.49224], [27.59027, 48.46311], [27.6658, 48.44034], [27.74422, 48.45926], [27.79225, 48.44244], [27.81902, 48.41874], [27.87533, 48.4037], [27.88391, 48.36699], [27.95883, 48.32368], [28.04527, 48.32661], [28.09873, 48.3124], [28.07504, 48.23494], [28.17666, 48.25963], [28.19314, 48.20749], [28.2856, 48.23202], [28.32508, 48.23384], [28.35519, 48.24957], [28.36996, 48.20543], [28.34912, 48.1787], [28.30586, 48.1597], [28.30609, 48.14018], [28.34009, 48.13147], [28.38712, 48.17567], [28.43701, 48.15832], [28.42454, 48.12047], [28.48428, 48.0737], [28.53921, 48.17453], [28.69896, 48.13106], [28.85232, 48.12506], [28.8414, 48.03392], [28.9306, 47.96255], [29.1723, 47.99013], [29.19839, 47.89261], [29.27804, 47.88893], [29.20663, 47.80367], [29.27255, 47.79953], [29.22242, 47.73607], [29.22414, 47.60012], [29.11743, 47.55001], [29.18603, 47.43387], [29.3261, 47.44664], [29.39889, 47.30179], [29.47854, 47.30366], [29.48678, 47.36043], [29.5733, 47.36508], [29.59665, 47.25521], [29.54996, 47.24962], [29.57696, 47.13581], [29.49732, 47.12878], [29.53044, 47.07851], [29.61038, 47.09932], [29.62137, 47.05069], [29.57056, 46.94766], [29.72986, 46.92234], [29.75458, 46.8604], [29.87405, 46.88199], [29.98814, 46.82358], [29.94522, 46.80055], [29.9743, 46.75325], [29.94409, 46.56002], [29.88916, 46.54302], [30.02511, 46.45132], [30.16794, 46.40967], [30.09103, 46.38694], [29.94114, 46.40114], [29.88329, 46.35851], [29.74496, 46.45605], [29.66359, 46.4215], [29.6763, 46.36041], [29.5939, 46.35472], [29.49914, 46.45889], [29.35357, 46.49505], [29.24886, 46.37912], [29.23547, 46.55435], [29.02409, 46.49582], [29.01241, 46.46177], [28.9306, 46.45699], [29.004, 46.31495], [28.98478, 46.31803], [28.94953, 46.25852], [29.06656, 46.19716], [28.94643, 46.09176], [29.00613, 46.04962], [28.98004, 46.00385], [28.74383, 45.96664], [28.78503, 45.83475], [28.69852, 45.81753], [28.70401, 45.78019], [28.52823, 45.73803], [28.47879, 45.66994], [28.51587, 45.6613], [28.54196, 45.58062], [28.49252, 45.56716], [28.51449, 45.49982], [28.43072, 45.48538], [28.41836, 45.51715], [28.30201, 45.54744], [28.21139, 45.46895], [28.28504, 45.43907], [28.34554, 45.32102], [28.5735, 45.24759], [28.71358, 45.22631], [28.78911, 45.24179], [28.81383, 45.3384], [28.94292, 45.28045], [28.96077, 45.33164], [29.24779, 45.43388], [29.42632, 45.44545], [29.59798, 45.38857], [29.68175, 45.26885], [29.65428, 45.25629], [29.69272, 45.19227], [30.04414, 45.08461], [31.62627, 45.50633], [33.54017, 46.0123], [33.59087, 46.06013], [33.57318, 46.10317]]]] } },
22902 { type: "Feature", properties: { iso1A2: "UG", iso1A3: "UGA", iso1N3: "800", wikidata: "Q1036", nameEn: "Uganda", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["256"] }, geometry: { type: "MultiPolygon", coordinates: [[[[33.93107, -0.99298], [33.9264, -0.54188], [33.98449, -0.13079], [33.90936, 0.10581], [34.10067, 0.36372], [34.08727, 0.44713], [34.11408, 0.48884], [34.13493, 0.58118], [34.20196, 0.62289], [34.27345, 0.63182], [34.31516, 0.75693], [34.40041, 0.80266], [34.43349, 0.85254], [34.52369, 1.10692], [34.57427, 1.09868], [34.58029, 1.14712], [34.67562, 1.21265], [34.80223, 1.22754], [34.82606, 1.26626], [34.82606, 1.30944], [34.7918, 1.36752], [34.87819, 1.5596], [34.92734, 1.56109], [34.9899, 1.6668], [34.98692, 1.97348], [34.90947, 2.42447], [34.95267, 2.47209], [34.77244, 2.70272], [34.78137, 2.76223], [34.73967, 2.85447], [34.65774, 2.8753], [34.60114, 2.93034], [34.56242, 3.11478], [34.45815, 3.18319], [34.40006, 3.37949], [34.41794, 3.44342], [34.39112, 3.48802], [34.44922, 3.51627], [34.45815, 3.67385], [34.15429, 3.80464], [34.06046, 4.15235], [33.9873, 4.23316], [33.51264, 3.75068], [33.18356, 3.77812], [33.02852, 3.89296], [32.89746, 3.81339], [32.72021, 3.77327], [32.41337, 3.748], [32.20782, 3.6053], [32.19888, 3.50867], [32.08866, 3.53543], [32.08491, 3.56287], [32.05187, 3.589], [31.95907, 3.57408], [31.96205, 3.6499], [31.86821, 3.78664], [31.81459, 3.82083], [31.72075, 3.74354], [31.50776, 3.63652], [31.50478, 3.67814], [31.29476, 3.8015], [31.16666, 3.79853], [30.97601, 3.693], [30.85153, 3.48867], [30.94081, 3.50847], [30.93486, 3.40737], [30.84251, 3.26908], [30.77101, 3.04897], [30.8574, 2.9508], [30.8857, 2.83923], [30.75612, 2.5863], [30.74271, 2.43601], [30.83059, 2.42559], [30.91102, 2.33332], [30.96911, 2.41071], [31.06593, 2.35862], [31.07934, 2.30207], [31.12104, 2.27676], [31.1985, 2.29462], [31.20148, 2.2217], [31.28042, 2.17853], [31.30127, 2.11006], [30.48503, 1.21675], [30.24671, 1.14974], [30.22139, 0.99635], [30.1484, 0.89805], [29.98307, 0.84295], [29.95477, 0.64486], [29.97413, 0.52124], [29.87284, 0.39166], [29.81922, 0.16824], [29.77454, 0.16675], [29.7224, 0.07291], [29.72687, -0.08051], [29.65091, -0.46777], [29.67474, -0.47969], [29.67176, -0.55714], [29.62708, -0.71055], [29.63006, -0.8997], [29.58388, -0.89821], [29.59061, -1.39016], [29.82657, -1.31187], [29.912, -1.48269], [30.16369, -1.34303], [30.35212, -1.06896], [30.47194, -1.0555], [30.64166, -1.06601], [30.70631, -1.01175], [30.76635, -0.9852], [30.80408, -0.99911], [33.93107, -0.99298]]]] } },
22903 { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
22904 { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
22905 { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
22906 { type: "Feature", properties: { iso1A2: "UY", iso1A3: "URY", iso1N3: "858", wikidata: "Q77", nameEn: "Uruguay", groups: ["005", "419", "019", "UN"], callingCodes: ["598"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-57.65132, -30.19229], [-57.61478, -30.25165], [-57.64859, -30.35095], [-57.89115, -30.49572], [-57.8024, -30.77193], [-57.89476, -30.95994], [-57.86729, -31.06352], [-57.9908, -31.34924], [-57.98127, -31.3872], [-58.07569, -31.44916], [-58.0023, -31.53084], [-58.00076, -31.65016], [-58.20252, -31.86966], [-58.10036, -32.25338], [-58.22362, -32.52416], [-58.1224, -32.98842], [-58.40475, -33.11777], [-58.44442, -33.84033], [-58.34425, -34.15035], [-57.83001, -34.69099], [-54.78916, -36.21945], [-52.83257, -34.01481], [-53.37138, -33.74313], [-53.39593, -33.75169], [-53.44031, -33.69344], [-53.52794, -33.68908], [-53.53459, -33.16843], [-53.1111, -32.71147], [-53.37671, -32.57005], [-53.39572, -32.58596], [-53.76024, -32.0751], [-54.17384, -31.86168], [-55.50821, -30.91349], [-55.50841, -30.9027], [-55.51862, -30.89828], [-55.52712, -30.89997], [-55.53276, -30.90218], [-55.53431, -30.89714], [-55.54572, -30.89051], [-55.55218, -30.88193], [-55.55373, -30.8732], [-55.5634, -30.8686], [-55.58866, -30.84117], [-55.87388, -31.05053], [-56.4619, -30.38457], [-56.4795, -30.3899], [-56.49267, -30.39471], [-56.90236, -30.02578], [-57.22502, -30.26121], [-57.65132, -30.19229]]]] } },
22907 { type: "Feature", properties: { iso1A2: "UZ", iso1A3: "UZB", iso1N3: "860", wikidata: "Q265", nameEn: "Uzbekistan", groups: ["143", "142", "UN"], callingCodes: ["998"] }, geometry: { type: "MultiPolygon", coordinates: [[[[65.85194, 42.85481], [65.53277, 43.31856], [65.18666, 43.48835], [64.96464, 43.74748], [64.53885, 43.56941], [63.34656, 43.64003], [62.01711, 43.51008], [61.01475, 44.41383], [58.59711, 45.58671], [55.97842, 44.99622], [55.97832, 44.99622], [55.97822, 44.99617], [55.97811, 44.99617], [55.97801, 44.99612], [55.97801, 44.99607], [55.97791, 44.99607], [55.9778, 44.99607], [55.9777, 44.99601], [55.9777, 44.99596], [55.9776, 44.99591], [55.97749, 44.99591], [55.97739, 44.99591], [55.97739, 44.99586], [55.97729, 44.99586], [55.97718, 44.99581], [55.97708, 44.99576], [55.97698, 44.9957], [55.97698, 44.99565], [55.97687, 44.9956], [55.97677, 44.9956], [55.97677, 44.99555], [55.97677, 44.9955], [55.97667, 44.99545], [55.97656, 44.99539], [55.97646, 44.99534], [55.97646, 44.99529], [55.97636, 44.99524], [55.97636, 44.99519], [55.97625, 44.99514], [55.97615, 44.99508], [55.97615, 44.99503], [55.97615, 44.99498], [55.97615, 44.99493], [55.97615, 44.99483], [55.97615, 44.99477], [55.97605, 44.99477], [55.97605, 44.99467], [55.97605, 44.99462], [55.97605, 44.99457], [55.97605, 44.99452], [55.97594, 44.99446], [55.97584, 44.99441], [55.97584, 44.99436], [55.97584, 44.99431], [55.97584, 44.99426], [55.97584, 44.99421], [55.97584, 44.99415], [55.97584, 44.99405], [55.97584, 44.994], [55.97584, 44.9939], [55.97584, 44.99384], [55.97584, 44.99374], [55.97584, 44.99369], [55.97584, 44.99359], [55.97584, 44.99353], [55.97584, 44.99348], [55.97584, 44.99343], [55.97584, 44.99338], [55.97584, 44.99328], [55.97584, 44.99322], [56.00314, 41.32584], [57.03423, 41.25435], [57.13796, 41.36625], [57.03359, 41.41777], [56.96218, 41.80383], [57.03633, 41.92043], [57.30275, 42.14076], [57.6296, 42.16519], [57.84932, 42.18555], [57.92897, 42.24047], [57.90975, 42.4374], [57.99214, 42.50021], [58.3492, 42.43335], [58.40688, 42.29535], [58.51674, 42.30348], [58.29427, 42.56497], [58.14321, 42.62159], [58.27504, 42.69632], [58.57991, 42.64988], [58.6266, 42.79314], [58.93422, 42.5407], [59.17317, 42.52248], [59.2955, 42.37064], [59.4341, 42.29738], [59.94633, 42.27655], [60.00539, 42.212], [59.96419, 42.1428], [60.04659, 42.08982], [60.0356, 42.01028], [59.95046, 41.97966], [60.33223, 41.75058], [60.08504, 41.80997], [60.06032, 41.76287], [60.18117, 41.60082], [60.06581, 41.4363], [60.5078, 41.21694], [61.03261, 41.25691], [61.22212, 41.14946], [61.33199, 41.14946], [61.39732, 41.19873], [61.4446, 41.29407], [61.87856, 41.12257], [62.11751, 40.58242], [62.34273, 40.43206], [62.43337, 39.98528], [63.6913, 39.27666], [63.70778, 39.22349], [64.19086, 38.95561], [64.32576, 38.98691], [65.55873, 38.29052], [65.83913, 38.25733], [66.24013, 38.16238], [66.41042, 38.02403], [66.56697, 38.0435], [66.67684, 37.96776], [66.53676, 37.80084], [66.52852, 37.58568], [66.65761, 37.45497], [66.52303, 37.39827], [66.55743, 37.35409], [66.64699, 37.32958], [66.95598, 37.40162], [67.08232, 37.35469], [67.13039, 37.27168], [67.2224, 37.24545], [67.2581, 37.17216], [67.51868, 37.26102], [67.78329, 37.1834], [67.8474, 37.31594], [67.81566, 37.43107], [68.12635, 37.93], [68.27159, 37.91477], [68.40343, 38.19484], [68.13289, 38.40822], [68.06274, 38.39435], [68.11366, 38.47169], [68.05873, 38.56087], [68.0807, 38.64136], [68.05598, 38.71641], [68.12877, 38.73677], [68.06948, 38.82115], [68.19743, 38.85985], [68.09704, 39.02589], [67.68915, 39.00775], [67.67833, 39.14479], [67.33226, 39.23739], [67.36522, 39.31287], [67.45998, 39.315], [67.46822, 39.46146], [67.39681, 39.52505], [67.46547, 39.53564], [67.44899, 39.57799], [67.62889, 39.60234], [67.70992, 39.66156], [68.12053, 39.56317], [68.54166, 39.53929], [68.61972, 39.68905], [68.63071, 39.85265], [68.88889, 39.87163], [68.93695, 39.91167], [68.84906, 40.04952], [68.96579, 40.06949], [69.01935, 40.11466], [69.01523, 40.15771], [68.62796, 40.07789], [68.52771, 40.11676], [68.5332, 40.14826], [68.77902, 40.20492], [68.79276, 40.17555], [68.84357, 40.18604], [68.85832, 40.20885], [69.04544, 40.22904], [69.15659, 40.2162], [69.2074, 40.21488], [69.30448, 40.18774], [69.30104, 40.24502], [69.25229, 40.26362], [69.24817, 40.30357], [69.30808, 40.2821], [69.32833, 40.29794], [69.33794, 40.34819], [69.30774, 40.36102], [69.28525, 40.41894], [69.27066, 40.49274], [69.21063, 40.54469], [69.2643, 40.57506], [69.3455, 40.57988], [69.32834, 40.70233], [69.38327, 40.7918], [69.53021, 40.77621], [69.59441, 40.70181], [69.69434, 40.62615], [70.36655, 40.90296], [70.38028, 41.02014], [70.45251, 41.04438], [70.80009, 40.72825], [70.49871, 40.52503], [70.32626, 40.45174], [70.37511, 40.38605], [70.57149, 40.3442], [70.56394, 40.26421], [70.62342, 40.17396], [70.8607, 40.217], [70.9818, 40.22392], [70.95789, 40.28761], [71.05901, 40.28765], [71.13042, 40.34106], [71.36663, 40.31593], [71.4246, 40.28619], [71.51215, 40.26943], [71.51549, 40.22986], [71.61725, 40.20615], [71.61931, 40.26775], [71.68386, 40.26984], [71.70569, 40.20391], [71.69621, 40.18492], [71.71719, 40.17886], [71.73054, 40.14818], [71.82646, 40.21872], [71.85002, 40.25647], [72.05464, 40.27586], [71.96401, 40.31907], [72.18648, 40.49893], [72.24368, 40.46091], [72.40346, 40.4007], [72.44191, 40.48222], [72.41513, 40.50856], [72.38384, 40.51535], [72.41714, 40.55736], [72.34406, 40.60144], [72.40517, 40.61917], [72.47795, 40.5532], [72.66713, 40.5219], [72.66713, 40.59076], [72.69579, 40.59778], [72.73995, 40.58409], [72.74768, 40.58051], [72.74862, 40.57131], [72.75982, 40.57273], [72.74894, 40.59592], [72.74866, 40.60873], [72.80137, 40.67856], [72.84754, 40.67229], [72.85372, 40.7116], [72.8722, 40.71111], [72.93296, 40.73089], [72.99133, 40.76457], [73.0612, 40.76678], [73.13412, 40.79122], [73.13267, 40.83512], [73.01869, 40.84681], [72.94454, 40.8094], [72.84291, 40.85512], [72.68157, 40.84942], [72.59136, 40.86947], [72.55109, 40.96046], [72.48742, 40.97136], [72.45206, 41.03018], [72.38511, 41.02785], [72.36138, 41.04384], [72.34757, 41.06104], [72.34026, 41.04539], [72.324, 41.03381], [72.18339, 40.99571], [72.17594, 41.02377], [72.21061, 41.05607], [72.1792, 41.10621], [72.14864, 41.13363], [72.17594, 41.15522], [72.16433, 41.16483], [72.10745, 41.15483], [72.07249, 41.11739], [71.85964, 41.19081], [71.91457, 41.2982], [71.83914, 41.3546], [71.76625, 41.4466], [71.71132, 41.43012], [71.73054, 41.54713], [71.65914, 41.49599], [71.6787, 41.42111], [71.57227, 41.29175], [71.46688, 41.31883], [71.43814, 41.19644], [71.46148, 41.13958], [71.40198, 41.09436], [71.34877, 41.16807], [71.27187, 41.11015], [71.25813, 41.18796], [71.11806, 41.15359], [71.02193, 41.19494], [70.9615, 41.16393], [70.86263, 41.23833], [70.77885, 41.24813], [70.78572, 41.36419], [70.67586, 41.47953], [70.48909, 41.40335], [70.17682, 41.5455], [70.69777, 41.92554], [71.28719, 42.18033], [71.13263, 42.28356], [70.94483, 42.26238], [69.49545, 41.545], [69.45751, 41.56863], [69.39485, 41.51518], [69.45081, 41.46246], [69.37468, 41.46555], [69.35554, 41.47211], [69.29778, 41.43673], [69.25059, 41.46693], [69.23332, 41.45847], [69.22671, 41.46298], [69.20439, 41.45391], [69.18528, 41.45175], [69.17701, 41.43769], [69.15137, 41.43078], [69.05006, 41.36183], [69.01308, 41.22804], [68.7217, 41.05025], [68.73945, 40.96989], [68.65662, 40.93861], [68.62221, 41.03019], [68.49983, 40.99669], [68.58444, 40.91447], [68.63, 40.59358], [68.49983, 40.56437], [67.96736, 40.83798], [68.1271, 41.0324], [68.08273, 41.08148], [67.98511, 41.02794], [67.9644, 41.14611], [66.69129, 41.1311], [66.53302, 41.87388], [66.00546, 41.94455], [66.09482, 42.93426], [65.85194, 42.85481]], [[70.68112, 40.90612], [70.6721, 40.90555], [70.57501, 40.98941], [70.54223, 40.98787], [70.56077, 41.00642], [70.6158, 40.97661], [70.68112, 40.90612]]], [[[71.21139, 40.03369], [71.12218, 40.03052], [71.06305, 40.1771], [71.00236, 40.18154], [71.01035, 40.05481], [71.11037, 40.01984], [71.11668, 39.99291], [71.09063, 39.99], [71.10501, 39.95568], [71.04979, 39.89808], [71.10531, 39.91354], [71.16101, 39.88423], [71.23067, 39.93581], [71.1427, 39.95026], [71.21139, 40.03369]]], [[[71.86463, 39.98598], [71.78838, 40.01404], [71.71511, 39.96348], [71.7504, 39.93701], [71.84316, 39.95582], [71.86463, 39.98598]]]] } },
22908 { type: "Feature", properties: { iso1A2: "VA", iso1A3: "VAT", iso1N3: "336", wikidata: "Q237", nameEn: "Vatican City", aliases: ["Holy See"], groups: ["039", "150"], callingCodes: ["379", "39 06"] }, geometry: { type: "MultiPolygon", coordinates: [[[[12.45181, 41.90056], [12.45446, 41.90028], [12.45435, 41.90143], [12.45626, 41.90172], [12.45691, 41.90125], [12.4577, 41.90115], [12.45834, 41.90174], [12.45826, 41.90281], [12.45755, 41.9033], [12.45762, 41.9058], [12.45561, 41.90629], [12.45543, 41.90738], [12.45091, 41.90625], [12.44984, 41.90545], [12.44815, 41.90326], [12.44582, 41.90194], [12.44834, 41.90095], [12.45181, 41.90056]]]] } },
22909 { type: "Feature", properties: { iso1A2: "VC", iso1A3: "VCT", iso1N3: "670", wikidata: "Q757", nameEn: "St. Vincent and the Grenadines", aliases: ["WV"], groups: ["029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", callingCodes: ["1 784"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-62.64026, 12.69984], [-59.94058, 12.34011], [-61.69315, 14.26451], [-62.64026, 12.69984]]]] } },
22910 { type: "Feature", properties: { iso1A2: "VE", iso1A3: "VEN", iso1N3: "862", wikidata: "Q717", nameEn: "Venezuela", aliases: ["YV"], groups: ["005", "419", "019", "UN"], callingCodes: ["58"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-71.22331, 13.01387], [-70.92579, 11.96275], [-71.3275, 11.85], [-71.9675, 11.65536], [-72.24983, 11.14138], [-72.4767, 11.1117], [-72.88002, 10.44309], [-72.98085, 9.85253], [-73.36905, 9.16636], [-73.02119, 9.27584], [-72.94052, 9.10663], [-72.77415, 9.10165], [-72.65474, 8.61428], [-72.4042, 8.36513], [-72.36987, 8.19976], [-72.35163, 8.01163], [-72.39137, 8.03534], [-72.47213, 7.96106], [-72.48801, 7.94329], [-72.48183, 7.92909], [-72.47042, 7.92306], [-72.45806, 7.91141], [-72.46183, 7.90682], [-72.44454, 7.86031], [-72.46763, 7.79518], [-72.47827, 7.65604], [-72.45321, 7.57232], [-72.47415, 7.48928], [-72.43132, 7.40034], [-72.19437, 7.37034], [-72.04895, 7.03837], [-71.82441, 7.04314], [-71.44118, 7.02116], [-71.42212, 7.03854], [-71.37234, 7.01588], [-71.03941, 6.98163], [-70.7596, 7.09799], [-70.10716, 6.96516], [-69.41843, 6.1072], [-67.60654, 6.2891], [-67.4625, 6.20625], [-67.43513, 5.98835], [-67.58558, 5.84537], [-67.63914, 5.64963], [-67.59141, 5.5369], [-67.83341, 5.31104], [-67.85358, 4.53249], [-67.62671, 3.74303], [-67.50067, 3.75812], [-67.30945, 3.38393], [-67.85862, 2.86727], [-67.85862, 2.79173], [-67.65696, 2.81691], [-67.21967, 2.35778], [-66.85795, 1.22998], [-66.28507, 0.74585], [-65.6727, 1.01353], [-65.50158, 0.92086], [-65.57288, 0.62856], [-65.11657, 1.12046], [-64.38932, 1.5125], [-64.34654, 1.35569], [-64.08274, 1.64792], [-64.06135, 1.94722], [-63.39827, 2.16098], [-63.39114, 2.4317], [-64.0257, 2.48156], [-64.02908, 2.79797], [-64.48379, 3.7879], [-64.84028, 4.24665], [-64.72977, 4.28931], [-64.57648, 4.12576], [-64.14512, 4.12932], [-63.99183, 3.90172], [-63.86082, 3.94796], [-63.70218, 3.91417], [-63.67099, 4.01731], [-63.50611, 3.83592], [-63.42233, 3.89995], [-63.4464, 3.9693], [-63.21111, 3.96219], [-62.98296, 3.59935], [-62.7655, 3.73099], [-62.74411, 4.03331], [-62.57656, 4.04754], [-62.44822, 4.18621], [-62.13094, 4.08309], [-61.54629, 4.2822], [-61.48569, 4.43149], [-61.29675, 4.44216], [-61.31457, 4.54167], [-61.15703, 4.49839], [-60.98303, 4.54167], [-60.86539, 4.70512], [-60.5802, 4.94312], [-60.73204, 5.20931], [-61.4041, 5.95304], [-61.15058, 6.19558], [-61.20762, 6.58174], [-61.13632, 6.70922], [-60.54873, 6.8631], [-60.39419, 6.94847], [-60.28074, 7.1162], [-60.44116, 7.20817], [-60.54098, 7.14804], [-60.63367, 7.25061], [-60.59802, 7.33194], [-60.71923, 7.55817], [-60.64793, 7.56877], [-60.51959, 7.83373], [-60.38056, 7.8302], [-60.02407, 8.04557], [-59.97059, 8.20791], [-59.83156, 8.23261], [-59.80661, 8.28906], [-59.85562, 8.35213], [-59.98508, 8.53046], [-59.54058, 8.6862], [-60.89962, 9.81445], [-62.08693, 10.04435], [-61.62505, 11.18974], [-63.73917, 11.92623], [-63.19938, 16.44103], [-67.89186, 12.4116], [-68.01417, 11.77722], [-68.33524, 11.78151], [-68.99639, 11.79035], [-71.22331, 13.01387]]]] } },
22911 { type: "Feature", properties: { iso1A2: "VG", iso1A3: "VGB", iso1N3: "092", wikidata: "Q25305", nameEn: "British Virgin Islands", country: "GB", groups: ["BOTS", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 284"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-64.47127, 17.55688], [-63.88746, 19.15706], [-65.02435, 18.73231], [-64.86027, 18.39056], [-64.64673, 18.36549], [-64.47127, 17.55688]]]] } },
22912 { type: "Feature", properties: { iso1A2: "VI", iso1A3: "VIR", iso1N3: "850", wikidata: "Q11703", nameEn: "United States Virgin Islands", aliases: ["US-VI"], country: "US", groups: ["Q1352230", "029", "003", "419", "019", "UN"], driveSide: "left", roadSpeedUnit: "mph", roadHeightUnit: "ft", callingCodes: ["1 340"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-65.02435, 18.73231], [-65.27974, 17.56928], [-64.47127, 17.55688], [-64.64673, 18.36549], [-64.86027, 18.39056], [-65.02435, 18.73231]]]] } },
22913 { type: "Feature", properties: { iso1A2: "VN", iso1A3: "VNM", iso1N3: "704", wikidata: "Q881", nameEn: "Vietnam", groups: ["035", "142", "UN"], callingCodes: ["84"] }, geometry: { type: "MultiPolygon", coordinates: [[[[108.10003, 21.47338], [108.0569, 21.53604], [108.02926, 21.54997], [107.97932, 21.54503], [107.97383, 21.53961], [107.97074, 21.54072], [107.96774, 21.53601], [107.95232, 21.5388], [107.92652, 21.58906], [107.90006, 21.5905], [107.86114, 21.65128], [107.80355, 21.66141], [107.66967, 21.60787], [107.56537, 21.61945], [107.54047, 21.5934], [107.49065, 21.59774], [107.49532, 21.62958], [107.47197, 21.6672], [107.41593, 21.64839], [107.38636, 21.59774], [107.35989, 21.60063], [107.35834, 21.6672], [107.29296, 21.74674], [107.24625, 21.7077], [107.20734, 21.71493], [107.10771, 21.79879], [107.02615, 21.81981], [107.00964, 21.85948], [107.06101, 21.88982], [107.05634, 21.92303], [106.99252, 21.95191], [106.97228, 21.92592], [106.92714, 21.93459], [106.9178, 21.97357], [106.81038, 21.97934], [106.74345, 22.00965], [106.72551, 21.97923], [106.69276, 21.96013], [106.68274, 21.99811], [106.70142, 22.02409], [106.6983, 22.15102], [106.67495, 22.1885], [106.69986, 22.22309], [106.6516, 22.33977], [106.55976, 22.34841], [106.57221, 22.37], [106.55665, 22.46498], [106.58395, 22.474], [106.61269, 22.60301], [106.65316, 22.5757], [106.71698, 22.58432], [106.72321, 22.63606], [106.76293, 22.73491], [106.82404, 22.7881], [106.83685, 22.8098], [106.81271, 22.8226], [106.78422, 22.81532], [106.71128, 22.85982], [106.71387, 22.88296], [106.6734, 22.89587], [106.6516, 22.86862], [106.60179, 22.92884], [106.55976, 22.92311], [106.51306, 22.94891], [106.49749, 22.91164], [106.34961, 22.86718], [106.27022, 22.87722], [106.19705, 22.98475], [106.00179, 22.99049], [105.99568, 22.94178], [105.90119, 22.94168], [105.8726, 22.92756], [105.72382, 23.06641], [105.57594, 23.075], [105.56037, 23.16806], [105.49966, 23.20669], [105.42805, 23.30824], [105.40782, 23.28107], [105.32376, 23.39684], [105.22569, 23.27249], [105.17276, 23.28679], [105.11672, 23.25247], [105.07002, 23.26248], [104.98712, 23.19176], [104.96532, 23.20463], [104.9486, 23.17235], [104.91435, 23.18666], [104.87992, 23.17141], [104.87382, 23.12854], [104.79478, 23.12934], [104.8334, 23.01484], [104.86765, 22.95178], [104.84942, 22.93631], [104.77114, 22.90017], [104.72755, 22.81984], [104.65283, 22.83419], [104.60457, 22.81841], [104.58122, 22.85571], [104.47225, 22.75813], [104.35593, 22.69353], [104.25683, 22.76534], [104.27084, 22.8457], [104.11384, 22.80363], [104.03734, 22.72945], [104.01088, 22.51823], [103.99247, 22.51958], [103.97384, 22.50634], [103.96783, 22.51173], [103.96352, 22.50584], [103.95191, 22.5134], [103.94513, 22.52553], [103.93286, 22.52703], [103.87904, 22.56683], [103.64506, 22.79979], [103.56255, 22.69499], [103.57812, 22.65764], [103.52675, 22.59155], [103.43646, 22.70648], [103.43179, 22.75816], [103.32282, 22.8127], [103.28079, 22.68063], [103.18895, 22.64471], [103.15782, 22.59873], [103.17961, 22.55705], [103.07843, 22.50097], [103.0722, 22.44775], [102.9321, 22.48659], [102.8636, 22.60735], [102.60675, 22.73376], [102.57095, 22.7036], [102.51802, 22.77969], [102.46665, 22.77108], [102.42618, 22.69212], [102.38415, 22.67919], [102.41061, 22.64184], [102.25339, 22.4607], [102.26428, 22.41321], [102.16621, 22.43336], [102.14099, 22.40092], [102.18712, 22.30403], [102.51734, 22.02676], [102.49092, 21.99002], [102.62301, 21.91447], [102.67145, 21.65894], [102.74189, 21.66713], [102.82115, 21.73667], [102.81894, 21.83888], [102.85637, 21.84501], [102.86077, 21.71213], [102.97965, 21.74076], [102.98846, 21.58936], [102.86297, 21.4255], [102.94223, 21.46034], [102.88939, 21.3107], [102.80794, 21.25736], [102.89825, 21.24707], [102.97745, 21.05821], [103.03469, 21.05821], [103.12055, 20.89994], [103.21497, 20.89832], [103.38032, 20.79501], [103.45737, 20.82382], [103.68633, 20.66324], [103.73478, 20.6669], [103.82282, 20.8732], [103.98024, 20.91531], [104.11121, 20.96779], [104.27412, 20.91433], [104.63957, 20.6653], [104.38199, 20.47155], [104.40621, 20.3849], [104.47886, 20.37459], [104.66158, 20.47774], [104.72102, 20.40554], [104.62195, 20.36633], [104.61315, 20.24452], [104.86852, 20.14121], [104.91695, 20.15567], [104.9874, 20.09573], [104.8465, 19.91783], [104.8355, 19.80395], [104.68359, 19.72729], [104.64837, 19.62365], [104.53169, 19.61743], [104.41281, 19.70035], [104.23229, 19.70242], [104.06498, 19.66926], [104.05617, 19.61743], [104.10832, 19.51575], [104.06058, 19.43484], [103.87125, 19.31854], [104.5361, 18.97747], [104.64617, 18.85668], [105.12829, 18.70453], [105.19654, 18.64196], [105.1327, 18.58355], [105.10408, 18.43533], [105.15942, 18.38691], [105.38366, 18.15315], [105.46292, 18.22008], [105.64784, 17.96687], [105.60381, 17.89356], [105.76612, 17.67147], [105.85744, 17.63221], [106.09019, 17.36399], [106.18991, 17.28227], [106.24444, 17.24714], [106.29287, 17.3018], [106.31929, 17.20509], [106.43597, 17.01362], [106.50862, 16.9673], [106.55045, 17.0031], [106.54824, 16.92729], [106.51963, 16.92097], [106.52183, 16.87884], [106.55265, 16.86831], [106.55485, 16.68704], [106.59013, 16.62259], [106.58267, 16.6012], [106.61477, 16.60713], [106.66052, 16.56892], [106.65832, 16.47816], [106.74418, 16.41904], [106.84104, 16.55415], [106.88727, 16.52671], [106.88067, 16.43594], [106.96638, 16.34938], [106.97385, 16.30204], [107.02597, 16.31132], [107.09091, 16.3092], [107.15035, 16.26271], [107.14595, 16.17816], [107.25822, 16.13587], [107.33968, 16.05549], [107.44975, 16.08511], [107.46296, 16.01106], [107.39471, 15.88829], [107.34188, 15.89464], [107.21419, 15.83747], [107.21859, 15.74638], [107.27143, 15.71459], [107.27583, 15.62769], [107.34408, 15.62345], [107.3815, 15.49832], [107.50699, 15.48771], [107.53341, 15.40496], [107.62367, 15.42193], [107.60605, 15.37524], [107.62587, 15.2266], [107.58844, 15.20111], [107.61926, 15.13949], [107.61486, 15.0566], [107.46516, 15.00982], [107.48277, 14.93751], [107.59285, 14.87795], [107.51579, 14.79282], [107.54361, 14.69092], [107.55371, 14.628], [107.52102, 14.59034], [107.52569, 14.54665], [107.48521, 14.40346], [107.44941, 14.41552], [107.39493, 14.32655], [107.40427, 14.24509], [107.33577, 14.11832], [107.37158, 14.07906], [107.35757, 14.02319], [107.38247, 13.99147], [107.44318, 13.99751], [107.46498, 13.91593], [107.45252, 13.78897], [107.53503, 13.73908], [107.61909, 13.52577], [107.62843, 13.3668], [107.49144, 13.01215], [107.49611, 12.88926], [107.55993, 12.7982], [107.5755, 12.52177], [107.55059, 12.36824], [107.4463, 12.29373], [107.42917, 12.24657], [107.34511, 12.33327], [107.15831, 12.27547], [106.99953, 12.08983], [106.92325, 12.06548], [106.79405, 12.0807], [106.70687, 11.96956], [106.4111, 11.97413], [106.4687, 11.86751], [106.44068, 11.86294], [106.44535, 11.8279], [106.41577, 11.76999], [106.45158, 11.68616], [106.44691, 11.66787], [106.37219, 11.69836], [106.30525, 11.67549], [106.26478, 11.72122], [106.18539, 11.75171], [106.13158, 11.73283], [106.06708, 11.77761], [106.02038, 11.77457], [106.00792, 11.7197], [105.95188, 11.63738], [105.88962, 11.67854], [105.8507, 11.66635], [105.80867, 11.60536], [105.81645, 11.56876], [105.87328, 11.55953], [105.88962, 11.43605], [105.86782, 11.28343], [106.10444, 11.07879], [106.1527, 11.10476], [106.1757, 11.07301], [106.20095, 10.97795], [106.14301, 10.98176], [106.18539, 10.79451], [106.06708, 10.8098], [105.94535, 10.9168], [105.93403, 10.83853], [105.84603, 10.85873], [105.86376, 10.89839], [105.77751, 11.03671], [105.50045, 10.94586], [105.42884, 10.96878], [105.34011, 10.86179], [105.11449, 10.96332], [105.08326, 10.95656], [105.02722, 10.89236], [105.09571, 10.72722], [104.95094, 10.64003], [104.87933, 10.52833], [104.59018, 10.53073], [104.49869, 10.4057], [104.47963, 10.43046], [104.43778, 10.42386], [103.99198, 10.48391], [102.47649, 9.66162], [104.81582, 8.03101], [109.55486, 8.10026], [111.60491, 13.57105], [108.00365, 17.98159], [108.10003, 21.47338]]]] } },
22914 { type: "Feature", properties: { iso1A2: "VU", iso1A3: "VUT", iso1N3: "548", wikidata: "Q686", nameEn: "Vanuatu", groups: ["054", "009", "UN"], callingCodes: ["678"] }, geometry: { type: "MultiPolygon", coordinates: [[[[156.73836, -14.50464], [174.245, -23.1974], [172.71443, -12.01327], [156.73836, -14.50464]]]] } },
22915 { type: "Feature", properties: { iso1A2: "WF", iso1A3: "WLF", iso1N3: "876", wikidata: "Q35555", nameEn: "Wallis and Futuna", country: "FR", groups: ["EU", "Q1451600", "061", "009", "UN"], callingCodes: ["681"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-178.66551, -14.32452], [-176.76826, -14.95183], [-175.59809, -12.61507], [-178.66551, -14.32452]]]] } },
22916 { type: "Feature", properties: { iso1A2: "WS", iso1A3: "WSM", iso1N3: "882", wikidata: "Q683", nameEn: "Samoa", groups: ["061", "009", "UN"], driveSide: "left", callingCodes: ["685"] }, geometry: { type: "MultiPolygon", coordinates: [[[[-173.74402, -14.26669], [-170.99605, -15.1275], [-171.39864, -10.21587], [-173.74402, -14.26669]]]] } },
22917 { type: "Feature", properties: { iso1A2: "XK", iso1A3: "XKX", wikidata: "Q1246", nameEn: "Kosovo", aliases: ["KV"], groups: ["039", "150"], isoStatus: "usrAssn", callingCodes: ["383"] }, geometry: { type: "MultiPolygon", coordinates: [[[[21.39045, 42.74888], [21.44047, 42.87276], [21.36941, 42.87397], [21.32974, 42.90424], [21.2719, 42.8994], [21.23534, 42.95523], [21.23877, 43.00848], [21.2041, 43.02277], [21.16734, 42.99694], [21.14465, 43.11089], [21.08952, 43.13471], [21.05378, 43.10707], [21.00749, 43.13984], [20.96287, 43.12416], [20.83727, 43.17842], [20.88685, 43.21697], [20.82145, 43.26769], [20.73811, 43.25068], [20.68688, 43.21335], [20.59929, 43.20492], [20.69515, 43.09641], [20.64557, 43.00826], [20.59929, 43.01067], [20.48692, 42.93208], [20.53484, 42.8885], [20.43734, 42.83157], [20.40594, 42.84853], [20.35692, 42.8335], [20.27869, 42.81945], [20.2539, 42.76245], [20.04898, 42.77701], [20.02088, 42.74789], [20.02915, 42.71147], [20.0969, 42.65559], [20.07761, 42.55582], [20.17127, 42.50469], [20.21797, 42.41237], [20.24399, 42.32168], [20.34479, 42.32656], [20.3819, 42.3029], [20.48857, 42.25444], [20.56955, 42.12097], [20.55633, 42.08173], [20.59434, 42.03879], [20.63069, 41.94913], [20.57946, 41.91593], [20.59524, 41.8818], [20.68523, 41.85318], [20.76786, 41.91839], [20.75464, 42.05229], [21.11491, 42.20794], [21.16614, 42.19815], [21.22728, 42.08909], [21.31983, 42.10993], [21.29913, 42.13954], [21.30496, 42.1418], [21.38428, 42.24465], [21.43882, 42.23609], [21.43882, 42.2789], [21.50823, 42.27156], [21.52145, 42.24465], [21.58992, 42.25915], [21.56772, 42.30946], [21.5264, 42.33634], [21.53467, 42.36809], [21.57021, 42.3647], [21.59029, 42.38042], [21.62887, 42.37664], [21.64209, 42.41081], [21.62556, 42.45106], [21.7035, 42.51899], [21.70522, 42.54176], [21.7327, 42.55041], [21.75672, 42.62695], [21.79413, 42.65923], [21.75025, 42.70125], [21.6626, 42.67813], [21.58755, 42.70418], [21.59154, 42.72643], [21.47498, 42.74695], [21.39045, 42.74888]]]] } },
22918 { type: "Feature", properties: { iso1A2: "YE", iso1A3: "YEM", iso1N3: "887", wikidata: "Q805", nameEn: "Yemen", groups: ["145", "142", "UN"], callingCodes: ["967"] }, geometry: { type: "MultiPolygon", coordinates: [[[[57.49095, 8.14549], [52.81185, 17.28568], [52.74267, 17.29519], [52.78009, 17.35124], [52.00311, 19.00083], [49.04884, 18.59899], [48.19996, 18.20584], [47.58351, 17.50366], [47.48245, 17.10808], [47.00571, 16.94765], [46.76494, 17.29151], [46.31018, 17.20464], [44.50126, 17.47475], [43.70631, 17.35762], [43.43005, 17.56148], [43.29185, 17.53224], [43.22533, 17.38343], [43.32653, 17.31179], [43.20156, 17.25901], [43.17787, 17.14717], [43.23967, 17.03428], [43.18233, 17.02673], [43.1813, 16.98438], [43.19328, 16.94703], [43.1398, 16.90696], [43.18338, 16.84852], [43.22012, 16.83932], [43.22956, 16.80613], [43.24801, 16.80613], [43.26303, 16.79479], [43.25857, 16.75304], [43.21325, 16.74416], [43.22066, 16.65179], [43.15274, 16.67248], [43.11601, 16.53166], [42.97215, 16.51093], [42.94351, 16.49467], [42.94625, 16.39721], [42.76801, 16.40371], [42.15205, 16.40211], [40.99158, 15.81743], [43.29075, 12.79154], [43.32909, 12.59711], [43.90659, 12.3823], [51.12877, 12.56479], [57.49095, 8.14549]]]] } },
22919 { type: "Feature", properties: { iso1A2: "YT", iso1A3: "MYT", iso1N3: "175", wikidata: "Q17063", nameEn: "Mayotte", country: "FR", groups: ["Q3320166", "EU", "014", "202", "002", "UN"], callingCodes: ["262"] }, geometry: { type: "MultiPolygon", coordinates: [[[[43.28731, -13.97126], [45.54824, -13.22353], [45.4971, -11.75965], [43.28731, -13.97126]]]] } },
22920 { type: "Feature", properties: { iso1A2: "ZA", iso1A3: "ZAF", iso1N3: "710", wikidata: "Q258", nameEn: "South Africa", groups: ["018", "202", "002", "UN"], driveSide: "left", callingCodes: ["27"] }, geometry: { type: "MultiPolygon", coordinates: [[[[31.30611, -22.422], [31.16344, -22.32599], [31.08932, -22.34884], [30.86696, -22.28907], [30.6294, -22.32599], [30.48686, -22.31368], [30.38614, -22.34533], [30.28351, -22.35587], [30.2265, -22.2961], [30.13147, -22.30841], [29.92242, -22.19408], [29.76848, -22.14128], [29.64609, -22.12917], [29.37703, -22.19581], [29.21955, -22.17771], [29.18974, -22.18599], [29.15268, -22.21399], [29.10881, -22.21202], [29.0151, -22.22907], [28.91889, -22.44299], [28.63287, -22.55887], [28.34874, -22.5694], [28.04562, -22.8394], [28.04752, -22.90243], [27.93729, -22.96194], [27.93539, -23.04941], [27.74154, -23.2137], [27.6066, -23.21894], [27.52393, -23.37952], [27.33768, -23.40917], [26.99749, -23.65486], [26.84165, -24.24885], [26.51667, -24.47219], [26.46346, -24.60358], [26.39409, -24.63468], [25.8515, -24.75727], [25.84295, -24.78661], [25.88571, -24.87802], [25.72702, -25.25503], [25.69661, -25.29284], [25.6643, -25.4491], [25.58543, -25.6343], [25.33076, -25.76616], [25.12266, -25.75931], [25.01718, -25.72507], [24.8946, -25.80723], [24.67319, -25.81749], [24.44703, -25.73021], [24.36531, -25.773], [24.18287, -25.62916], [23.9244, -25.64286], [23.47588, -25.29971], [23.03497, -25.29971], [22.86012, -25.50572], [22.70808, -25.99186], [22.56365, -26.19668], [22.41921, -26.23078], [22.21206, -26.3773], [22.06192, -26.61882], [21.90703, -26.66808], [21.83291, -26.65959], [21.77114, -26.69015], [21.7854, -26.79199], [21.69322, -26.86152], [21.37869, -26.82083], [21.13353, -26.86661], [20.87031, -26.80047], [20.68596, -26.9039], [20.63275, -26.78181], [20.61754, -26.4692], [20.86081, -26.14892], [20.64795, -25.47827], [20.29826, -24.94869], [20.03678, -24.81004], [20.02809, -24.78725], [19.99817, -24.76768], [19.99882, -28.42622], [18.99885, -28.89165], [17.4579, -28.68718], [17.15405, -28.08573], [16.90446, -28.057], [16.59922, -28.53246], [16.46592, -28.57126], [16.45332, -28.63117], [12.51595, -32.27486], [38.88176, -48.03306], [34.51034, -26.91792], [32.35222, -26.86027], [32.29584, -26.852], [32.22302, -26.84136], [32.19409, -26.84032], [32.13315, -26.84345], [32.09664, -26.80721], [32.00893, -26.8096], [31.97463, -27.11057], [31.97592, -27.31675], [31.49834, -27.31549], [31.15027, -27.20151], [30.96088, -27.0245], [30.97757, -26.92706], [30.88826, -26.79622], [30.81101, -26.84722], [30.78927, -26.48271], [30.95819, -26.26303], [31.13073, -25.91558], [31.31237, -25.7431], [31.4175, -25.71886], [31.86881, -25.99973], [31.974, -25.95387], [31.92649, -25.84216], [32.00631, -25.65044], [31.97875, -25.46356], [32.01676, -25.38117], [32.03196, -25.10785], [31.9835, -24.29983], [31.90368, -24.18892], [31.87707, -23.95293], [31.77445, -23.90082], [31.70223, -23.72695], [31.67942, -23.60858], [31.56539, -23.47268], [31.55779, -23.176], [31.30611, -22.422]], [[29.33204, -29.45598], [29.28545, -29.58456], [29.12553, -29.76266], [29.16548, -29.91706], [28.9338, -30.05072], [28.80222, -30.10579], [28.68627, -30.12885], [28.399, -30.1592], [28.2319, -30.28476], [28.12073, -30.68072], [27.74814, -30.60635], [27.69467, -30.55862], [27.67819, -30.53437], [27.6521, -30.51707], [27.62137, -30.50509], [27.56781, -30.44562], [27.56901, -30.42504], [27.45452, -30.32239], [27.38108, -30.33456], [27.36649, -30.27246], [27.37293, -30.19401], [27.40778, -30.14577], [27.32555, -30.14785], [27.29603, -30.05473], [27.22719, -30.00718], [27.09489, -29.72796], [27.01016, -29.65439], [27.33464, -29.48161], [27.4358, -29.33465], [27.47254, -29.31968], [27.45125, -29.29708], [27.48679, -29.29349], [27.54258, -29.25575], [27.5158, -29.2261], [27.55974, -29.18954], [27.75458, -28.89839], [27.8907, -28.91612], [27.88933, -28.88156], [27.9392, -28.84864], [27.98675, -28.8787], [28.02503, -28.85991], [28.1317, -28.7293], [28.2348, -28.69471], [28.30518, -28.69531], [28.40612, -28.6215], [28.65091, -28.57025], [28.68043, -28.58744], [29.40524, -29.21246], [29.44883, -29.3772], [29.33204, -29.45598]]]] } },
22921 { type: "Feature", properties: { iso1A2: "ZM", iso1A3: "ZMB", iso1N3: "894", wikidata: "Q953", nameEn: "Zambia", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["260"] }, geometry: { type: "MultiPolygon", coordinates: [[[[32.95389, -9.40138], [32.76233, -9.31963], [32.75611, -9.28583], [32.53661, -9.24281], [32.49147, -9.14754], [32.43543, -9.11988], [32.25486, -9.13371], [32.16146, -9.05993], [32.08206, -9.04609], [31.98866, -9.07069], [31.94196, -9.02303], [31.94663, -8.93846], [31.81587, -8.88618], [31.71158, -8.91386], [31.57147, -8.81388], [31.57147, -8.70619], [31.37533, -8.60769], [31.00796, -8.58615], [30.79243, -8.27382], [28.88917, -8.4831], [28.9711, -8.66935], [28.38526, -9.23393], [28.36562, -9.30091], [28.52636, -9.35379], [28.51627, -9.44726], [28.56208, -9.49122], [28.68532, -9.78], [28.62795, -9.92942], [28.65032, -10.65133], [28.37241, -11.57848], [28.48357, -11.87532], [29.18592, -12.37921], [29.4992, -12.43843], [29.48404, -12.23604], [29.8139, -12.14898], [29.81551, -13.44683], [29.65078, -13.41844], [29.60531, -13.21685], [29.01918, -13.41353], [28.33199, -12.41375], [27.59932, -12.22123], [27.21025, -11.76157], [27.22541, -11.60323], [27.04351, -11.61312], [26.88687, -12.01868], [26.01777, -11.91488], [25.33058, -11.65767], [25.34069, -11.19707], [24.42612, -11.44975], [24.34528, -11.06816], [24.00027, -10.89356], [24.02603, -11.15368], [23.98804, -12.13149], [24.06672, -12.29058], [23.90937, -12.844], [24.03339, -12.99091], [21.97988, -13.00148], [22.00323, -16.18028], [22.17217, -16.50269], [23.20038, -17.47563], [23.47474, -17.62877], [24.23619, -17.47489], [24.32811, -17.49082], [24.38712, -17.46818], [24.5621, -17.52963], [24.70864, -17.49501], [25.00198, -17.58221], [25.26433, -17.79571], [25.51646, -17.86232], [25.6827, -17.81987], [25.85738, -17.91403], [25.85892, -17.97726], [26.08925, -17.98168], [26.0908, -17.93021], [26.21601, -17.88608], [26.55918, -17.99638], [26.68403, -18.07411], [26.74314, -18.0199], [26.89926, -17.98756], [27.14196, -17.81398], [27.30736, -17.60487], [27.61377, -17.34378], [27.62795, -17.24365], [27.83141, -16.96274], [28.73725, -16.5528], [28.76199, -16.51575], [28.81454, -16.48611], [28.8501, -16.04537], [28.9243, -15.93987], [29.01298, -15.93805], [29.21955, -15.76589], [29.4437, -15.68702], [29.8317, -15.6126], [30.35574, -15.6513], [30.41902, -15.62269], [30.22098, -14.99447], [33.24249, -14.00019], [33.16749, -13.93992], [33.07568, -13.98447], [33.02977, -14.05022], [32.99042, -13.95689], [32.88985, -13.82956], [32.79015, -13.80755], [32.76962, -13.77224], [32.84528, -13.71576], [32.7828, -13.64805], [32.68654, -13.64268], [32.66468, -13.60019], [32.68436, -13.55769], [32.73683, -13.57682], [32.84176, -13.52794], [32.86113, -13.47292], [33.0078, -13.19492], [32.98289, -13.12671], [33.02181, -12.88707], [32.96733, -12.88251], [32.94397, -12.76868], [33.05917, -12.59554], [33.18837, -12.61377], [33.28177, -12.54692], [33.37517, -12.54085], [33.54485, -12.35996], [33.47636, -12.32498], [33.3705, -12.34931], [33.25998, -12.14242], [33.33937, -11.91252], [33.32692, -11.59248], [33.24252, -11.59302], [33.23663, -11.40637], [33.29267, -11.43536], [33.29267, -11.3789], [33.39697, -11.15296], [33.25998, -10.88862], [33.28022, -10.84428], [33.47636, -10.78465], [33.70675, -10.56896], [33.54797, -10.36077], [33.53863, -10.20148], [33.31297, -10.05133], [33.37902, -9.9104], [33.36581, -9.81063], [33.31517, -9.82364], [33.2095, -9.61099], [33.12144, -9.58929], [33.10163, -9.66525], [33.05485, -9.61316], [33.00256, -9.63053], [33.00476, -9.5133], [32.95389, -9.40138]]]] } },
22922 { type: "Feature", properties: { iso1A2: "ZW", iso1A3: "ZWE", iso1N3: "716", wikidata: "Q954", nameEn: "Zimbabwe", groups: ["014", "202", "002", "UN"], driveSide: "left", callingCodes: ["263"] }, geometry: { type: "MultiPolygon", coordinates: [[[[30.41902, -15.62269], [30.35574, -15.6513], [29.8317, -15.6126], [29.4437, -15.68702], [29.21955, -15.76589], [29.01298, -15.93805], [28.9243, -15.93987], [28.8501, -16.04537], [28.81454, -16.48611], [28.76199, -16.51575], [28.73725, -16.5528], [27.83141, -16.96274], [27.62795, -17.24365], [27.61377, -17.34378], [27.30736, -17.60487], [27.14196, -17.81398], [26.89926, -17.98756], [26.74314, -18.0199], [26.68403, -18.07411], [26.55918, -17.99638], [26.21601, -17.88608], [26.0908, -17.93021], [26.08925, -17.98168], [25.85892, -17.97726], [25.85738, -17.91403], [25.6827, -17.81987], [25.51646, -17.86232], [25.26433, -17.79571], [25.23909, -17.90832], [25.31799, -18.07091], [25.39972, -18.12691], [25.53465, -18.39041], [25.68859, -18.56165], [25.79217, -18.6355], [25.82353, -18.82808], [25.94326, -18.90362], [25.99837, -19.02943], [25.96226, -19.08152], [26.17227, -19.53709], [26.72246, -19.92707], [27.21278, -20.08244], [27.29831, -20.28935], [27.28865, -20.49873], [27.69361, -20.48531], [27.72972, -20.51735], [27.69171, -21.08409], [27.91407, -21.31621], [28.01669, -21.57624], [28.29416, -21.59037], [28.49942, -21.66634], [28.58114, -21.63455], [29.07763, -21.81877], [29.04023, -21.85864], [29.02191, -21.90647], [29.02191, -21.95665], [29.04108, -22.00563], [29.08495, -22.04867], [29.14501, -22.07275], [29.1974, -22.07472], [29.24648, -22.05967], [29.3533, -22.18363], [29.37703, -22.19581], [29.64609, -22.12917], [29.76848, -22.14128], [29.92242, -22.19408], [30.13147, -22.30841], [30.2265, -22.2961], [30.28351, -22.35587], [30.38614, -22.34533], [30.48686, -22.31368], [30.6294, -22.32599], [30.86696, -22.28907], [31.08932, -22.34884], [31.16344, -22.32599], [31.30611, -22.422], [31.38336, -22.36919], [32.41234, -21.31246], [32.48236, -21.32873], [32.37115, -21.133], [32.51644, -20.91929], [32.48122, -20.63319], [32.55167, -20.56312], [32.66174, -20.56106], [32.85987, -20.27841], [32.85987, -20.16686], [32.93032, -20.03868], [33.01178, -20.02007], [33.06461, -19.77787], [32.95013, -19.67219], [32.84666, -19.68462], [32.84446, -19.48343], [32.78282, -19.47513], [32.77966, -19.36098], [32.85107, -19.29238], [32.87088, -19.09279], [32.84006, -19.0262], [32.72118, -19.02204], [32.69917, -18.94293], [32.73439, -18.92628], [32.70137, -18.84712], [32.82465, -18.77419], [32.9017, -18.7992], [32.95013, -18.69079], [32.88629, -18.58023], [32.88629, -18.51344], [33.02278, -18.4696], [33.03159, -18.35054], [32.94133, -17.99705], [33.0492, -17.60298], [32.98536, -17.55891], [32.96554, -17.48964], [33.0426, -17.3468], [33.00517, -17.30477], [32.96554, -17.11971], [32.84113, -16.92259], [32.91051, -16.89446], [32.97655, -16.70689], [32.78943, -16.70267], [32.69917, -16.66893], [32.71017, -16.59932], [32.42838, -16.4727], [32.28529, -16.43892], [32.02772, -16.43892], [31.91324, -16.41569], [31.90223, -16.34388], [31.67988, -16.19595], [31.42451, -16.15154], [31.30563, -16.01193], [31.13171, -15.98019], [30.97761, -16.05848], [30.91597, -15.99924], [30.42568, -15.9962], [30.41902, -15.62269]]]] } }
22924 var borders = borders_default;
22925 var _whichPolygon = {};
22926 var _featuresByCode = {};
22927 var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
22928 function canonicalID(id2) {
22929 const s2 = id2 || "";
22930 if (s2.charAt(0) === ".") {
22931 return s2.toUpperCase();
22933 return s2.replace(idFilterRegex, "").toUpperCase();
22942 "intermediateRegion",
22950 loadDerivedDataAndCaches(borders);
22951 function loadDerivedDataAndCaches(borders2) {
22952 const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
22953 let geometryFeatures = [];
22954 for (const feature22 of borders2.features) {
22955 const props = feature22.properties;
22956 props.id = props.iso1A2 || props.m49 || props.wikidata;
22957 loadM49(feature22);
22958 loadTLD(feature22);
22959 loadIsoStatus(feature22);
22960 loadLevel(feature22);
22961 loadGroups(feature22);
22962 loadFlag(feature22);
22963 cacheFeatureByIDs(feature22);
22964 if (feature22.geometry) {
22965 geometryFeatures.push(feature22);
22968 for (const feature22 of borders2.features) {
22969 feature22.properties.groups = feature22.properties.groups.map((groupID) => {
22970 return _featuresByCode[groupID].properties.id;
22972 loadMembersForGroupsOf(feature22);
22974 for (const feature22 of borders2.features) {
22975 loadRoadSpeedUnit(feature22);
22976 loadRoadHeightUnit(feature22);
22977 loadDriveSide(feature22);
22978 loadCallingCodes(feature22);
22979 loadGroupGroups(feature22);
22981 for (const feature22 of borders2.features) {
22982 feature22.properties.groups.sort((groupID1, groupID2) => {
22983 return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
22985 if (feature22.properties.members) {
22986 feature22.properties.members.sort((id1, id2) => {
22987 const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
22989 return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
22995 const geometryOnlyCollection = {
22996 type: "FeatureCollection",
22997 features: geometryFeatures
22999 _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
23000 function loadGroups(feature22) {
23001 const props = feature22.properties;
23002 if (!props.groups) {
23005 if (feature22.geometry && props.country) {
23006 props.groups.push(props.country);
23008 if (props.m49 !== "001") {
23009 props.groups.push("001");
23012 function loadM49(feature22) {
23013 const props = feature22.properties;
23014 if (!props.m49 && props.iso1N3) {
23015 props.m49 = props.iso1N3;
23018 function loadTLD(feature22) {
23019 const props = feature22.properties;
23020 if (props.level === "unitedNations")
23022 if (!props.ccTLD && props.iso1A2) {
23023 props.ccTLD = "." + props.iso1A2.toLowerCase();
23026 function loadIsoStatus(feature22) {
23027 const props = feature22.properties;
23028 if (!props.isoStatus && props.iso1A2) {
23029 props.isoStatus = "official";
23032 function loadLevel(feature22) {
23033 const props = feature22.properties;
23036 if (!props.country) {
23037 props.level = "country";
23038 } else if (!props.iso1A2 || props.isoStatus === "official") {
23039 props.level = "territory";
23041 props.level = "subterritory";
23044 function loadGroupGroups(feature22) {
23045 const props = feature22.properties;
23046 if (feature22.geometry || !props.members)
23048 const featureLevelIndex = levels.indexOf(props.level);
23049 let sharedGroups = [];
23050 props.members.forEach((memberID, index) => {
23051 const member = _featuresByCode[memberID];
23052 const memberGroups = member.properties.groups.filter((groupID) => {
23053 return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
23056 sharedGroups = memberGroups;
23058 sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
23061 props.groups = props.groups.concat(
23062 sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
23064 for (const groupID of sharedGroups) {
23065 const groupFeature = _featuresByCode[groupID];
23066 if (groupFeature.properties.members.indexOf(props.id) === -1) {
23067 groupFeature.properties.members.push(props.id);
23071 function loadRoadSpeedUnit(feature22) {
23072 const props = feature22.properties;
23073 if (feature22.geometry) {
23074 if (!props.roadSpeedUnit)
23075 props.roadSpeedUnit = "km/h";
23076 } else if (props.members) {
23077 const vals = Array.from(
23079 props.members.map((id2) => {
23080 const member = _featuresByCode[id2];
23081 if (member.geometry)
23082 return member.properties.roadSpeedUnit || "km/h";
23086 if (vals.length === 1)
23087 props.roadSpeedUnit = vals[0];
23090 function loadRoadHeightUnit(feature22) {
23091 const props = feature22.properties;
23092 if (feature22.geometry) {
23093 if (!props.roadHeightUnit)
23094 props.roadHeightUnit = "m";
23095 } else if (props.members) {
23096 const vals = Array.from(
23098 props.members.map((id2) => {
23099 const member = _featuresByCode[id2];
23100 if (member.geometry)
23101 return member.properties.roadHeightUnit || "m";
23105 if (vals.length === 1)
23106 props.roadHeightUnit = vals[0];
23109 function loadDriveSide(feature22) {
23110 const props = feature22.properties;
23111 if (feature22.geometry) {
23112 if (!props.driveSide)
23113 props.driveSide = "right";
23114 } else if (props.members) {
23115 const vals = Array.from(
23117 props.members.map((id2) => {
23118 const member = _featuresByCode[id2];
23119 if (member.geometry)
23120 return member.properties.driveSide || "right";
23124 if (vals.length === 1)
23125 props.driveSide = vals[0];
23128 function loadCallingCodes(feature22) {
23129 const props = feature22.properties;
23130 if (!feature22.geometry && props.members) {
23131 props.callingCodes = Array.from(
23133 props.members.reduce((array2, id2) => {
23134 const member = _featuresByCode[id2];
23135 if (member.geometry && member.properties.callingCodes) {
23136 return array2.concat(member.properties.callingCodes);
23144 function loadFlag(feature22) {
23145 if (!feature22.properties.iso1A2)
23147 const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
23148 return String.fromCodePoint(char.charCodeAt(0) + 127397);
23150 feature22.properties.emojiFlag = flag;
23152 function loadMembersForGroupsOf(feature22) {
23153 for (const groupID of feature22.properties.groups) {
23154 const groupFeature = _featuresByCode[groupID];
23155 if (!groupFeature.properties.members) {
23156 groupFeature.properties.members = [];
23158 groupFeature.properties.members.push(feature22.properties.id);
23161 function cacheFeatureByIDs(feature22) {
23163 for (const prop of identifierProps) {
23164 const id2 = feature22.properties[prop];
23169 for (const alias of feature22.properties.aliases || []) {
23172 for (const id2 of ids) {
23173 const cid = canonicalID(id2);
23174 _featuresByCode[cid] = feature22;
23178 function locArray(loc) {
23179 if (Array.isArray(loc)) {
23181 } else if (loc.coordinates) {
23182 return loc.coordinates;
23184 return loc.geometry.coordinates;
23186 function smallestFeature(loc) {
23187 const query = locArray(loc);
23188 const featureProperties = _whichPolygon(query);
23189 if (!featureProperties)
23191 return _featuresByCode[featureProperties.id];
23193 function countryFeature(loc) {
23194 const feature22 = smallestFeature(loc);
23197 const countryCode = feature22.properties.country || feature22.properties.iso1A2;
23198 return _featuresByCode[countryCode] || null;
23200 var defaultOpts = {
23205 function featureForLoc(loc, opts) {
23206 const targetLevel = opts.level || "country";
23207 const maxLevel = opts.maxLevel || "world";
23208 const withProp = opts.withProp;
23209 const targetLevelIndex = levels.indexOf(targetLevel);
23210 if (targetLevelIndex === -1)
23212 const maxLevelIndex = levels.indexOf(maxLevel);
23213 if (maxLevelIndex === -1)
23215 if (maxLevelIndex < targetLevelIndex)
23217 if (targetLevel === "country") {
23218 const fastFeature = countryFeature(loc);
23220 if (!withProp || fastFeature.properties[withProp]) {
23221 return fastFeature;
23225 const features = featuresContaining(loc);
23226 const match = features.find((feature22) => {
23227 let levelIndex = levels.indexOf(feature22.properties.level);
23228 if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
23229 levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
23230 if (!withProp || feature22.properties[withProp]) {
23236 return match || null;
23238 function featureForID(id2) {
23240 if (typeof id2 === "number") {
23241 stringID = id2.toString();
23242 if (stringID.length === 1) {
23243 stringID = "00" + stringID;
23244 } else if (stringID.length === 2) {
23245 stringID = "0" + stringID;
23248 stringID = canonicalID(id2);
23250 return _featuresByCode[stringID] || null;
23252 function smallestFeaturesForBbox(bbox2) {
23253 return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
23255 function smallestOrMatchingFeature(query) {
23256 if (typeof query === "object") {
23257 return smallestFeature(query);
23259 return featureForID(query);
23261 function feature(query, opts = defaultOpts) {
23262 if (typeof query === "object") {
23263 return featureForLoc(query, opts);
23265 return featureForID(query);
23267 function iso1A2Code(query, opts = defaultOpts) {
23268 opts.withProp = "iso1A2";
23269 const match = feature(query, opts);
23272 return match.properties.iso1A2 || null;
23274 function propertiesForQuery(query, property) {
23275 const features = featuresContaining(query, false);
23276 return features.map((feature22) => feature22.properties[property]).filter(Boolean);
23278 function iso1A2Codes(query) {
23279 return propertiesForQuery(query, "iso1A2");
23281 function featuresContaining(query, strict) {
23282 let matchingFeatures;
23283 if (Array.isArray(query) && query.length === 4) {
23284 matchingFeatures = smallestFeaturesForBbox(query);
23286 const smallestOrMatching = smallestOrMatchingFeature(query);
23287 matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
23289 if (!matchingFeatures.length)
23291 let returnFeatures;
23292 if (!strict || typeof query === "object") {
23293 returnFeatures = matchingFeatures.slice();
23295 returnFeatures = [];
23297 for (const feature22 of matchingFeatures) {
23298 const properties = feature22.properties;
23299 for (const groupID of properties.groups) {
23300 const groupFeature = _featuresByCode[groupID];
23301 if (returnFeatures.indexOf(groupFeature) === -1) {
23302 returnFeatures.push(groupFeature);
23306 return returnFeatures;
23308 function featuresIn(id2, strict) {
23309 const feature22 = featureForID(id2);
23314 features.push(feature22);
23316 const properties = feature22.properties;
23317 for (const memberID of properties.members || []) {
23318 features.push(_featuresByCode[memberID]);
23322 function aggregateFeature(id2) {
23324 const features = featuresIn(id2, false);
23325 if (features.length === 0)
23327 let aggregateCoordinates = [];
23328 for (const feature22 of features) {
23329 if (((_a2 = feature22.geometry) == null ? void 0 : _a2.type) === "MultiPolygon" && feature22.geometry.coordinates) {
23330 aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
23335 properties: features[0].properties,
23337 type: "MultiPolygon",
23338 coordinates: aggregateCoordinates
23342 function roadSpeedUnit(query) {
23343 const feature22 = smallestOrMatchingFeature(query);
23344 return feature22 && feature22.properties.roadSpeedUnit || null;
23346 function roadHeightUnit(query) {
23347 const feature22 = smallestOrMatchingFeature(query);
23348 return feature22 && feature22.properties.roadHeightUnit || null;
23351 // node_modules/polyclip-ts/dist/constant.js
23352 var constant_default5 = (x2) => {
23358 // node_modules/polyclip-ts/dist/compare.js
23359 var compare_default = (eps) => {
23360 const almostEqual = eps ? (a2, b2) => b2.minus(a2).abs().isLessThanOrEqualTo(eps) : constant_default5(false);
23361 return (a2, b2) => {
23362 if (almostEqual(a2, b2))
23364 return a2.comparedTo(b2);
23368 // node_modules/polyclip-ts/dist/orient.js
23369 function orient_default(eps) {
23370 const almostCollinear = eps ? (area2, ax, ay, cx, cy) => area2.exponentiatedBy(2).isLessThanOrEqualTo(cx.minus(ax).exponentiatedBy(2).plus(cy.minus(ay).exponentiatedBy(2)).times(eps)) : constant_default5(false);
23371 return (a2, b2, c2) => {
23372 const ax = a2.x, ay = a2.y, cx = c2.x, cy = c2.y;
23373 const area2 = ay.minus(cy).times(b2.x.minus(cx)).minus(ax.minus(cx).times(b2.y.minus(cy)));
23374 if (almostCollinear(area2, ax, ay, cx, cy))
23376 return area2.comparedTo(0);
23380 // node_modules/bignumber.js/bignumber.mjs
23381 var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
23382 var mathceil = Math.ceil;
23383 var mathfloor = Math.floor;
23384 var bignumberError = "[BigNumber Error] ";
23385 var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
23388 var MAX_SAFE_INTEGER = 9007199254740991;
23389 var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
23390 var SQRT_BASE = 1e7;
23392 function clone(configObject) {
23393 var div, convertBase, parseNumeric2, P2 = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
23396 secondaryGroupSize: 0,
23397 groupSeparator: ",",
23398 decimalSeparator: ".",
23399 fractionGroupSize: 0,
23400 fractionGroupSeparator: "\xA0",
23401 // non-breaking space
23403 }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
23404 function BigNumber2(v2, b2) {
23405 var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
23406 if (!(x2 instanceof BigNumber2))
23407 return new BigNumber2(v2, b2);
23409 if (v2 && v2._isBigNumber === true) {
23411 if (!v2.c || v2.e > MAX_EXP) {
23412 x2.c = x2.e = null;
23413 } else if (v2.e < MIN_EXP) {
23417 x2.c = v2.c.slice();
23421 if ((isNum = typeof v2 == "number") && v2 * 0 == 0) {
23422 x2.s = 1 / v2 < 0 ? (v2 = -v2, -1) : 1;
23424 for (e3 = 0, i3 = v2; i3 >= 10; i3 /= 10, e3++)
23426 if (e3 > MAX_EXP) {
23427 x2.c = x2.e = null;
23436 if (!isNumeric.test(str = String(v2)))
23437 return parseNumeric2(x2, str, isNum);
23438 x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
23440 if ((e3 = str.indexOf(".")) > -1)
23441 str = str.replace(".", "");
23442 if ((i3 = str.search(/e/i)) > 0) {
23445 e3 += +str.slice(i3 + 1);
23446 str = str.substring(0, i3);
23447 } else if (e3 < 0) {
23451 intCheck(b2, 2, ALPHABET.length, "Base");
23452 if (b2 == 10 && alphabetHasNormalDecimalDigits) {
23453 x2 = new BigNumber2(v2);
23454 return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
23457 if (isNum = typeof v2 == "number") {
23459 return parseNumeric2(x2, str, isNum, b2);
23460 x2.s = 1 / v2 < 0 ? (str = str.slice(1), -1) : 1;
23461 if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
23462 throw Error(tooManyDigits + v2);
23465 x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
23467 alphabet = ALPHABET.slice(0, b2);
23469 for (len = str.length; i3 < len; i3++) {
23470 if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
23476 } else if (!caseChanged) {
23477 if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
23478 caseChanged = true;
23484 return parseNumeric2(x2, String(v2), isNum, b2);
23488 str = convertBase(str, b2, 10, x2.s);
23489 if ((e3 = str.indexOf(".")) > -1)
23490 str = str.replace(".", "");
23494 for (i3 = 0; str.charCodeAt(i3) === 48; i3++)
23496 for (len = str.length; str.charCodeAt(--len) === 48; )
23498 if (str = str.slice(i3, ++len)) {
23500 if (isNum && BigNumber2.DEBUG && len > 15 && (v2 > MAX_SAFE_INTEGER || v2 !== mathfloor(v2))) {
23501 throw Error(tooManyDigits + x2.s * v2);
23503 if ((e3 = e3 - i3 - 1) > MAX_EXP) {
23504 x2.c = x2.e = null;
23505 } else if (e3 < MIN_EXP) {
23510 i3 = (e3 + 1) % LOG_BASE;
23515 x2.c.push(+str.slice(0, i3));
23516 for (len -= LOG_BASE; i3 < len; ) {
23517 x2.c.push(+str.slice(i3, i3 += LOG_BASE));
23519 i3 = LOG_BASE - (str = str.slice(i3)).length;
23523 for (; i3--; str += "0")
23531 BigNumber2.clone = clone;
23532 BigNumber2.ROUND_UP = 0;
23533 BigNumber2.ROUND_DOWN = 1;
23534 BigNumber2.ROUND_CEIL = 2;
23535 BigNumber2.ROUND_FLOOR = 3;
23536 BigNumber2.ROUND_HALF_UP = 4;
23537 BigNumber2.ROUND_HALF_DOWN = 5;
23538 BigNumber2.ROUND_HALF_EVEN = 6;
23539 BigNumber2.ROUND_HALF_CEIL = 7;
23540 BigNumber2.ROUND_HALF_FLOOR = 8;
23541 BigNumber2.EUCLID = 9;
23542 BigNumber2.config = BigNumber2.set = function(obj) {
23545 if (typeof obj == "object") {
23546 if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
23548 intCheck(v2, 0, MAX, p2);
23549 DECIMAL_PLACES = v2;
23551 if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
23553 intCheck(v2, 0, 8, p2);
23554 ROUNDING_MODE = v2;
23556 if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
23558 if (v2 && v2.pop) {
23559 intCheck(v2[0], -MAX, 0, p2);
23560 intCheck(v2[1], 0, MAX, p2);
23561 TO_EXP_NEG = v2[0];
23562 TO_EXP_POS = v2[1];
23564 intCheck(v2, -MAX, MAX, p2);
23565 TO_EXP_NEG = -(TO_EXP_POS = v2 < 0 ? -v2 : v2);
23568 if (obj.hasOwnProperty(p2 = "RANGE")) {
23570 if (v2 && v2.pop) {
23571 intCheck(v2[0], -MAX, -1, p2);
23572 intCheck(v2[1], 1, MAX, p2);
23576 intCheck(v2, -MAX, MAX, p2);
23578 MIN_EXP = -(MAX_EXP = v2 < 0 ? -v2 : v2);
23580 throw Error(bignumberError + p2 + " cannot be zero: " + v2);
23584 if (obj.hasOwnProperty(p2 = "CRYPTO")) {
23588 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
23592 throw Error(bignumberError + "crypto unavailable");
23598 throw Error(bignumberError + p2 + " not true or false: " + v2);
23601 if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
23603 intCheck(v2, 0, 9, p2);
23606 if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
23608 intCheck(v2, 0, MAX, p2);
23609 POW_PRECISION = v2;
23611 if (obj.hasOwnProperty(p2 = "FORMAT")) {
23613 if (typeof v2 == "object")
23616 throw Error(bignumberError + p2 + " not an object: " + v2);
23618 if (obj.hasOwnProperty(p2 = "ALPHABET")) {
23620 if (typeof v2 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v2)) {
23621 alphabetHasNormalDecimalDigits = v2.slice(0, 10) == "0123456789";
23624 throw Error(bignumberError + p2 + " invalid: " + v2);
23628 throw Error(bignumberError + "Object expected: " + obj);
23634 EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
23635 RANGE: [MIN_EXP, MAX_EXP],
23643 BigNumber2.isBigNumber = function(v2) {
23644 if (!v2 || v2._isBigNumber !== true)
23646 if (!BigNumber2.DEBUG)
23648 var i3, n3, c2 = v2.c, e3 = v2.e, s2 = v2.s;
23650 if ({}.toString.call(c2) == "[object Array]") {
23651 if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
23653 if (e3 === 0 && c2.length === 1)
23657 i3 = (e3 + 1) % LOG_BASE;
23660 if (String(c2[0]).length == i3) {
23661 for (i3 = 0; i3 < c2.length; i3++) {
23663 if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3))
23670 } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
23673 throw Error(bignumberError + "Invalid BigNumber: " + v2);
23675 BigNumber2.maximum = BigNumber2.max = function() {
23676 return maxOrMin(arguments, -1);
23678 BigNumber2.minimum = BigNumber2.min = function() {
23679 return maxOrMin(arguments, 1);
23681 BigNumber2.random = function() {
23682 var pow2_53 = 9007199254740992;
23683 var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
23684 return mathfloor(Math.random() * pow2_53);
23686 return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
23688 return function(dp) {
23689 var a2, b2, e3, k2, v2, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
23691 dp = DECIMAL_PLACES;
23693 intCheck(dp, 0, MAX);
23694 k2 = mathceil(dp / LOG_BASE);
23696 if (crypto.getRandomValues) {
23697 a2 = crypto.getRandomValues(new Uint32Array(k2 *= 2));
23698 for (; i3 < k2; ) {
23699 v2 = a2[i3] * 131072 + (a2[i3 + 1] >>> 11);
23701 b2 = crypto.getRandomValues(new Uint32Array(2));
23703 a2[i3 + 1] = b2[1];
23705 c2.push(v2 % 1e14);
23710 } else if (crypto.randomBytes) {
23711 a2 = crypto.randomBytes(k2 *= 7);
23712 for (; i3 < k2; ) {
23713 v2 = (a2[i3] & 31) * 281474976710656 + a2[i3 + 1] * 1099511627776 + a2[i3 + 2] * 4294967296 + a2[i3 + 3] * 16777216 + (a2[i3 + 4] << 16) + (a2[i3 + 5] << 8) + a2[i3 + 6];
23715 crypto.randomBytes(7).copy(a2, i3);
23717 c2.push(v2 % 1e14);
23724 throw Error(bignumberError + "crypto unavailable");
23728 for (; i3 < k2; ) {
23729 v2 = random53bitInt();
23731 c2[i3++] = v2 % 1e14;
23737 v2 = POWS_TEN[LOG_BASE - dp];
23738 c2[i3] = mathfloor(k2 / v2) * v2;
23740 for (; c2[i3] === 0; c2.pop(), i3--)
23745 for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE)
23747 for (i3 = 1, v2 = c2[0]; v2 >= 10; v2 /= 10, i3++)
23750 e3 -= LOG_BASE - i3;
23757 BigNumber2.sum = function() {
23758 var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
23759 for (; i3 < args.length; )
23760 sum = sum.plus(args[i3++]);
23763 convertBase = /* @__PURE__ */ function() {
23764 var decimal = "0123456789";
23765 function toBaseOut(str, baseIn, baseOut, alphabet) {
23766 var j2, arr = [0], arrL, i3 = 0, len = str.length;
23767 for (; i3 < len; ) {
23768 for (arrL = arr.length; arrL--; arr[arrL] *= baseIn)
23770 arr[0] += alphabet.indexOf(str.charAt(i3++));
23771 for (j2 = 0; j2 < arr.length; j2++) {
23772 if (arr[j2] > baseOut - 1) {
23773 if (arr[j2 + 1] == null)
23775 arr[j2 + 1] += arr[j2] / baseOut | 0;
23776 arr[j2] %= baseOut;
23780 return arr.reverse();
23782 return function(str, baseIn, baseOut, sign2, callerIsToString) {
23783 var alphabet, d2, e3, k2, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
23785 k2 = POW_PRECISION;
23787 str = str.replace(".", "");
23788 y2 = new BigNumber2(baseIn);
23789 x2 = y2.pow(str.length - i3);
23790 POW_PRECISION = k2;
23792 toFixedPoint(coeffToString(x2.c), x2.e, "0"),
23797 y2.e = y2.c.length;
23799 xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
23800 e3 = k2 = xc.length;
23801 for (; xc[--k2] == 0; xc.pop())
23804 return alphabet.charAt(0);
23811 x2 = div(x2, y2, dp, rm, baseOut);
23819 r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
23820 r2 = rm < 4 ? (i3 != null || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : i3 > k2 || i3 == k2 && (rm == 4 || r2 || rm == 6 && xc[d2 - 1] & 1 || rm == (x2.s < 0 ? 8 : 7));
23821 if (d2 < 1 || !xc[0]) {
23822 str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
23826 for (--baseOut; ++xc[--d2] > baseOut; ) {
23830 xc = [1].concat(xc);
23834 for (k2 = xc.length; !xc[--k2]; )
23836 for (i3 = 0, str = ""; i3 <= k2; str += alphabet.charAt(xc[i3++]))
23838 str = toFixedPoint(str, e3, alphabet.charAt(0));
23843 div = /* @__PURE__ */ function() {
23844 function multiply(x2, k2, base) {
23845 var m2, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k2 % SQRT_BASE, khi = k2 / SQRT_BASE | 0;
23846 for (x2 = x2.slice(); i3--; ) {
23847 xlo = x2[i3] % SQRT_BASE;
23848 xhi = x2[i3] / SQRT_BASE | 0;
23849 m2 = khi * xlo + xhi * klo;
23850 temp = klo * xlo + m2 % SQRT_BASE * SQRT_BASE + carry;
23851 carry = (temp / base | 0) + (m2 / SQRT_BASE | 0) + khi * xhi;
23852 x2[i3] = temp % base;
23855 x2 = [carry].concat(x2);
23858 function compare2(a2, b2, aL, bL) {
23861 cmp = aL > bL ? 1 : -1;
23863 for (i3 = cmp = 0; i3 < aL; i3++) {
23864 if (a2[i3] != b2[i3]) {
23865 cmp = a2[i3] > b2[i3] ? 1 : -1;
23872 function subtract(a2, b2, aL, base) {
23876 i3 = a2[aL] < b2[aL] ? 1 : 0;
23877 a2[aL] = i3 * base + a2[aL] - b2[aL];
23879 for (; !a2[0] && a2.length > 1; a2.splice(0, 1))
23882 return function(x2, y2, dp, rm, base) {
23883 var cmp, e3, i3, more, n3, prod, prodL, q2, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s2 = x2.s == y2.s ? 1 : -1, xc = x2.c, yc = y2.c;
23884 if (!xc || !xc[0] || !yc || !yc[0]) {
23885 return new BigNumber2(
23886 // Return NaN if either NaN, or both Infinity or 0.
23887 !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
23888 // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
23889 xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
23893 q2 = new BigNumber2(s2);
23899 e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
23900 s2 = s2 / LOG_BASE | 0;
23902 for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++)
23904 if (yc[i3] > (xc[i3] || 0))
23914 n3 = mathfloor(base / (yc[0] + 1));
23916 yc = multiply(yc, n3, base);
23917 xc = multiply(xc, n3, base);
23922 rem = xc.slice(0, yL);
23924 for (; remL < yL; rem[remL++] = 0)
23927 yz = [0].concat(yz);
23929 if (yc[1] >= base / 2)
23933 cmp = compare2(yc, rem, yL, remL);
23937 rem0 = rem0 * base + (rem[1] || 0);
23938 n3 = mathfloor(rem0 / yc0);
23942 prod = multiply(yc, n3, base);
23943 prodL = prod.length;
23945 while (compare2(prod, rem, prodL, remL) == 1) {
23947 subtract(prod, yL < prodL ? yz : yc, prodL, base);
23948 prodL = prod.length;
23956 prodL = prod.length;
23959 prod = [0].concat(prod);
23960 subtract(rem, prod, remL, base);
23963 while (compare2(yc, rem, yL, remL) < 1) {
23965 subtract(rem, yL < remL ? yz : yc, remL, base);
23969 } else if (cmp === 0) {
23975 rem[remL++] = xc[xi] || 0;
23980 } while ((xi++ < xL || rem[0] != null) && s2--);
23981 more = rem[0] != null;
23985 if (base == BASE) {
23986 for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++)
23988 round(q2, dp + (q2.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
23996 function format2(n3, i3, rm, id2) {
23997 var c0, e3, ne2, len, str;
23999 rm = ROUNDING_MODE;
24001 intCheck(rm, 0, 8);
24003 return n3.toString();
24007 str = coeffToString(n3.c);
24008 str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
24010 n3 = round(new BigNumber2(n3), i3, rm);
24012 str = coeffToString(n3.c);
24014 if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
24015 for (; len < i3; str += "0", len++)
24017 str = toExponential(str, e3);
24020 str = toFixedPoint(str, e3, "0");
24021 if (e3 + 1 > len) {
24023 for (str += "."; i3--; str += "0")
24030 for (; i3--; str += "0")
24036 return n3.s < 0 && c0 ? "-" + str : str;
24038 function maxOrMin(args, n3) {
24039 var k2, y2, i3 = 1, x2 = new BigNumber2(args[0]);
24040 for (; i3 < args.length; i3++) {
24041 y2 = new BigNumber2(args[i3]);
24042 if (!y2.s || (k2 = compare(x2, y2)) === n3 || k2 === 0 && x2.s === n3) {
24048 function normalise(n3, c2, e3) {
24049 var i3 = 1, j2 = c2.length;
24050 for (; !c2[--j2]; c2.pop())
24052 for (j2 = c2[0]; j2 >= 10; j2 /= 10, i3++)
24054 if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
24055 n3.c = n3.e = null;
24056 } else if (e3 < MIN_EXP) {
24064 parseNumeric2 = /* @__PURE__ */ function() {
24065 var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
24066 return function(x2, str, isNum, b2) {
24067 var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
24068 if (isInfinityOrNaN.test(s2)) {
24069 x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
24072 s2 = s2.replace(basePrefix, function(m2, p1, p2) {
24073 base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
24074 return !b2 || b2 == base ? p1 : m2;
24078 s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
24081 return new BigNumber2(s2, base);
24083 if (BigNumber2.DEBUG) {
24084 throw Error(bignumberError + "Not a" + (b2 ? " base " + b2 : "") + " number: " + str);
24088 x2.c = x2.e = null;
24091 function round(x2, sd, rm, r2) {
24092 var d2, i3, j2, k2, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
24095 for (d2 = 1, k2 = xc[0]; k2 >= 10; k2 /= 10, d2++)
24102 rd = mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
24104 ni = mathceil((i3 + 1) / LOG_BASE);
24105 if (ni >= xc.length) {
24107 for (; xc.length <= ni; xc.push(0))
24112 j2 = i3 - LOG_BASE + 1;
24118 for (d2 = 1; k2 >= 10; k2 /= 10, d2++)
24121 j2 = i3 - LOG_BASE + d2;
24122 rd = j2 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
24125 r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
24126 // The expression n % pows10[d - j - 1] returns all digits of n to the right
24127 // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
24128 xc[ni + 1] != null || (j2 < 0 ? n3 : n3 % pows10[d2 - j2 - 1]);
24129 r2 = rm < 4 ? (rd || r2) && (rm == 0 || rm == (x2.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r2 || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
24130 (i3 > 0 ? j2 > 0 ? n3 / pows10[d2 - j2] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
24131 if (sd < 1 || !xc[0]) {
24135 xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
24147 xc.length = ni + 1;
24148 k2 = pows10[LOG_BASE - i3];
24149 xc[ni] = j2 > 0 ? mathfloor(n3 / pows10[d2 - j2] % pows10[j2]) * k2 : 0;
24154 for (i3 = 1, j2 = xc[0]; j2 >= 10; j2 /= 10, i3++)
24157 for (k2 = 1; j2 >= 10; j2 /= 10, k2++)
24167 if (xc[ni] != BASE)
24174 for (i3 = xc.length; xc[--i3] === 0; xc.pop())
24177 if (x2.e > MAX_EXP) {
24178 x2.c = x2.e = null;
24179 } else if (x2.e < MIN_EXP) {
24185 function valueOf(n3) {
24186 var str, e3 = n3.e;
24188 return n3.toString();
24189 str = coeffToString(n3.c);
24190 str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
24191 return n3.s < 0 ? "-" + str : str;
24193 P2.absoluteValue = P2.abs = function() {
24194 var x2 = new BigNumber2(this);
24199 P2.comparedTo = function(y2, b2) {
24200 return compare(this, new BigNumber2(y2, b2));
24202 P2.decimalPlaces = P2.dp = function(dp, rm) {
24203 var c2, n3, v2, x2 = this;
24205 intCheck(dp, 0, MAX);
24207 rm = ROUNDING_MODE;
24209 intCheck(rm, 0, 8);
24210 return round(new BigNumber2(x2), dp + x2.e + 1, rm);
24214 n3 = ((v2 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
24216 for (; v2 % 10 == 0; v2 /= 10, n3--)
24222 P2.dividedBy = P2.div = function(y2, b2) {
24223 return div(this, new BigNumber2(y2, b2), DECIMAL_PLACES, ROUNDING_MODE);
24225 P2.dividedToIntegerBy = P2.idiv = function(y2, b2) {
24226 return div(this, new BigNumber2(y2, b2), 0, 1);
24228 P2.exponentiatedBy = P2.pow = function(n3, m2) {
24229 var half, isModExp, i3, k2, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
24230 n3 = new BigNumber2(n3);
24231 if (n3.c && !n3.isInteger()) {
24232 throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
24235 m2 = new BigNumber2(m2);
24236 nIsBig = n3.e > 14;
24237 if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
24238 y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
24239 return m2 ? y2.mod(m2) : y2;
24243 if (m2.c ? !m2.c[0] : !m2.s)
24244 return new BigNumber2(NaN);
24245 isModExp = !nIsNeg && x2.isInteger() && m2.isInteger();
24248 } else if (n3.e > 9 && (x2.e > 0 || x2.e < -1 || (x2.e == 0 ? x2.c[0] > 1 || nIsBig && x2.c[1] >= 24e7 : x2.c[0] < 8e13 || nIsBig && x2.c[0] <= 9999975e7))) {
24249 k2 = x2.s < 0 && isOdd(n3) ? -0 : 0;
24252 return new BigNumber2(nIsNeg ? 1 / k2 : k2);
24253 } else if (POW_PRECISION) {
24254 k2 = mathceil(POW_PRECISION / LOG_BASE + 2);
24257 half = new BigNumber2(0.5);
24260 nIsOdd = isOdd(n3);
24262 i3 = Math.abs(+valueOf(n3));
24265 y2 = new BigNumber2(ONE);
24272 if (y2.c.length > k2)
24274 } else if (isModExp) {
24279 i3 = mathfloor(i3 / 2);
24284 n3 = n3.times(half);
24285 round(n3, n3.e + 1, 1);
24287 nIsOdd = isOdd(n3);
24297 if (x2.c && x2.c.length > k2)
24299 } else if (isModExp) {
24307 return m2 ? y2.mod(m2) : k2 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
24309 P2.integerValue = function(rm) {
24310 var n3 = new BigNumber2(this);
24312 rm = ROUNDING_MODE;
24314 intCheck(rm, 0, 8);
24315 return round(n3, n3.e + 1, rm);
24317 P2.isEqualTo = P2.eq = function(y2, b2) {
24318 return compare(this, new BigNumber2(y2, b2)) === 0;
24320 P2.isFinite = function() {
24323 P2.isGreaterThan = P2.gt = function(y2, b2) {
24324 return compare(this, new BigNumber2(y2, b2)) > 0;
24326 P2.isGreaterThanOrEqualTo = P2.gte = function(y2, b2) {
24327 return (b2 = compare(this, new BigNumber2(y2, b2))) === 1 || b2 === 0;
24329 P2.isInteger = function() {
24330 return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
24332 P2.isLessThan = P2.lt = function(y2, b2) {
24333 return compare(this, new BigNumber2(y2, b2)) < 0;
24335 P2.isLessThanOrEqualTo = P2.lte = function(y2, b2) {
24336 return (b2 = compare(this, new BigNumber2(y2, b2))) === -1 || b2 === 0;
24338 P2.isNaN = function() {
24341 P2.isNegative = function() {
24344 P2.isPositive = function() {
24347 P2.isZero = function() {
24348 return !!this.c && this.c[0] == 0;
24350 P2.minus = function(y2, b2) {
24351 var i3, j2, t2, xLTy, x2 = this, a2 = x2.s;
24352 y2 = new BigNumber2(y2, b2);
24355 return new BigNumber2(NaN);
24358 return x2.plus(y2);
24360 var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24361 if (!xe2 || !ye2) {
24363 return xc ? (y2.s = -b2, y2) : new BigNumber2(yc ? x2 : NaN);
24364 if (!xc[0] || !yc[0]) {
24365 return yc[0] ? (y2.s = -b2, y2) : new BigNumber2(xc[0] ? x2 : (
24366 // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
24367 ROUNDING_MODE == 3 ? -0 : 0
24371 xe2 = bitFloor(xe2);
24372 ye2 = bitFloor(ye2);
24374 if (a2 = xe2 - ye2) {
24375 if (xLTy = a2 < 0) {
24383 for (b2 = a2; b2--; t2.push(0))
24387 j2 = (xLTy = (a2 = xc.length) < (b2 = yc.length)) ? a2 : b2;
24388 for (a2 = b2 = 0; b2 < j2; b2++) {
24389 if (xc[b2] != yc[b2]) {
24390 xLTy = xc[b2] < yc[b2];
24401 b2 = (j2 = yc.length) - (i3 = xc.length);
24403 for (; b2--; xc[i3++] = 0)
24406 for (; j2 > a2; ) {
24407 if (xc[--j2] < yc[j2]) {
24408 for (i3 = j2; i3 && !xc[--i3]; xc[i3] = b2)
24415 for (; xc[0] == 0; xc.splice(0, 1), --ye2)
24418 y2.s = ROUNDING_MODE == 3 ? -1 : 1;
24422 return normalise(y2, xc, ye2);
24424 P2.modulo = P2.mod = function(y2, b2) {
24425 var q2, s2, x2 = this;
24426 y2 = new BigNumber2(y2, b2);
24427 if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
24428 return new BigNumber2(NaN);
24429 } else if (!y2.c || x2.c && !x2.c[0]) {
24430 return new BigNumber2(x2);
24432 if (MODULO_MODE == 9) {
24435 q2 = div(x2, y2, 0, 3);
24439 q2 = div(x2, y2, 0, MODULO_MODE);
24441 y2 = x2.minus(q2.times(y2));
24442 if (!y2.c[0] && MODULO_MODE == 1)
24446 P2.multipliedBy = P2.times = function(y2, b2) {
24447 var c2, e3, i3, j2, k2, m2, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x2 = this, xc = x2.c, yc = (y2 = new BigNumber2(y2, b2)).c;
24448 if (!xc || !yc || !xc[0] || !yc[0]) {
24449 if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
24450 y2.c = y2.e = y2.s = null;
24454 y2.c = y2.e = null;
24462 e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
24474 for (i3 = xcL + ycL, zc = []; i3--; zc.push(0))
24477 sqrtBase = SQRT_BASE;
24478 for (i3 = ycL; --i3 >= 0; ) {
24480 ylo = yc[i3] % sqrtBase;
24481 yhi = yc[i3] / sqrtBase | 0;
24482 for (k2 = xcL, j2 = i3 + k2; j2 > i3; ) {
24483 xlo = xc[--k2] % sqrtBase;
24484 xhi = xc[k2] / sqrtBase | 0;
24485 m2 = yhi * xlo + xhi * ylo;
24486 xlo = ylo * xlo + m2 % sqrtBase * sqrtBase + zc[j2] + c2;
24487 c2 = (xlo / base | 0) + (m2 / sqrtBase | 0) + yhi * xhi;
24488 zc[j2--] = xlo % base;
24497 return normalise(y2, zc, e3);
24499 P2.negated = function() {
24500 var x2 = new BigNumber2(this);
24501 x2.s = -x2.s || null;
24504 P2.plus = function(y2, b2) {
24505 var t2, x2 = this, a2 = x2.s;
24506 y2 = new BigNumber2(y2, b2);
24509 return new BigNumber2(NaN);
24512 return x2.minus(y2);
24514 var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
24515 if (!xe2 || !ye2) {
24517 return new BigNumber2(a2 / 0);
24518 if (!xc[0] || !yc[0])
24519 return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a2 * 0);
24521 xe2 = bitFloor(xe2);
24522 ye2 = bitFloor(ye2);
24524 if (a2 = xe2 - ye2) {
24533 for (; a2--; t2.push(0))
24545 for (a2 = 0; b2; ) {
24546 a2 = (xc[--b2] = xc[b2] + yc[b2] + a2) / BASE | 0;
24547 xc[b2] = BASE === xc[b2] ? 0 : xc[b2] % BASE;
24550 xc = [a2].concat(xc);
24553 return normalise(y2, xc, ye2);
24555 P2.precision = P2.sd = function(sd, rm) {
24556 var c2, n3, v2, x2 = this;
24557 if (sd != null && sd !== !!sd) {
24558 intCheck(sd, 1, MAX);
24560 rm = ROUNDING_MODE;
24562 intCheck(rm, 0, 8);
24563 return round(new BigNumber2(x2), sd, rm);
24567 v2 = c2.length - 1;
24568 n3 = v2 * LOG_BASE + 1;
24570 for (; v2 % 10 == 0; v2 /= 10, n3--)
24572 for (v2 = c2[0]; v2 >= 10; v2 /= 10, n3++)
24575 if (sd && x2.e + 1 > n3)
24579 P2.shiftedBy = function(k2) {
24580 intCheck(k2, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
24581 return this.times("1e" + k2);
24583 P2.squareRoot = P2.sqrt = function() {
24584 var m2, n3, r2, rep, t2, x2 = this, c2 = x2.c, s2 = x2.s, e3 = x2.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
24585 if (s2 !== 1 || !c2 || !c2[0]) {
24586 return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
24588 s2 = Math.sqrt(+valueOf(x2));
24589 if (s2 == 0 || s2 == 1 / 0) {
24590 n3 = coeffToString(c2);
24591 if ((n3.length + e3) % 2 == 0)
24593 s2 = Math.sqrt(+n3);
24594 e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
24598 n3 = s2.toExponential();
24599 n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
24601 r2 = new BigNumber2(n3);
24603 r2 = new BigNumber2(s2 + "");
24612 r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
24613 if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
24616 n3 = n3.slice(s2 - 3, s2 + 1);
24617 if (n3 == "9999" || !rep && n3 == "4999") {
24619 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
24620 if (t2.times(t2).eq(x2)) {
24629 if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
24630 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
24631 m2 = !r2.times(r2).eq(x2);
24638 return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m2);
24640 P2.toExponential = function(dp, rm) {
24642 intCheck(dp, 0, MAX);
24645 return format2(this, dp, rm, 1);
24647 P2.toFixed = function(dp, rm) {
24649 intCheck(dp, 0, MAX);
24650 dp = dp + this.e + 1;
24652 return format2(this, dp, rm);
24654 P2.toFormat = function(dp, rm, format3) {
24655 var str, x2 = this;
24656 if (format3 == null) {
24657 if (dp != null && rm && typeof rm == "object") {
24660 } else if (dp && typeof dp == "object") {
24666 } else if (typeof format3 != "object") {
24667 throw Error(bignumberError + "Argument not an object: " + format3);
24669 str = x2.toFixed(dp, rm);
24671 var i3, arr = str.split("."), g1 = +format3.groupSize, g22 = +format3.secondaryGroupSize, groupSeparator = format3.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x2.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
24678 if (g1 > 0 && len > 0) {
24679 i3 = len % g1 || g1;
24680 intPart = intDigits.substr(0, i3);
24681 for (; i3 < len; i3 += g1)
24682 intPart += groupSeparator + intDigits.substr(i3, g1);
24684 intPart += groupSeparator + intDigits.slice(i3);
24686 intPart = "-" + intPart;
24688 str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
24689 new RegExp("\\d{" + g22 + "}\\B", "g"),
24690 "$&" + (format3.fractionGroupSeparator || "")
24691 ) : fractionPart) : intPart;
24693 return (format3.prefix || "") + str + (format3.suffix || "");
24695 P2.toFraction = function(md) {
24696 var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q2, r2, s2, x2 = this, xc = x2.c;
24698 n3 = new BigNumber2(md);
24699 if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
24700 throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
24704 return new BigNumber2(x2);
24705 d2 = new BigNumber2(ONE);
24706 n1 = d0 = new BigNumber2(ONE);
24707 d1 = n0 = new BigNumber2(ONE);
24708 s2 = coeffToString(xc);
24709 e3 = d2.e = s2.length - x2.e - 1;
24710 d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
24711 md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
24714 n3 = new BigNumber2(s2);
24717 q2 = div(n3, d2, 0, 1);
24718 d22 = d0.plus(q2.times(d1));
24719 if (d22.comparedTo(md) == 1)
24723 n1 = n0.plus(q2.times(d22 = n1));
24725 d2 = n3.minus(q2.times(d22 = d2));
24728 d22 = div(md.minus(d0), d1, 0, 1);
24729 n0 = n0.plus(d22.times(n1));
24730 d0 = d0.plus(d22.times(d1));
24731 n0.s = n1.s = x2.s;
24733 r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
24734 div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
24735 ) < 1 ? [n1, d1] : [n0, d0];
24739 P2.toNumber = function() {
24740 return +valueOf(this);
24742 P2.toPrecision = function(sd, rm) {
24744 intCheck(sd, 1, MAX);
24745 return format2(this, sd, rm, 2);
24747 P2.toString = function(b2) {
24748 var str, n3 = this, s2 = n3.s, e3 = n3.e;
24759 str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
24760 } else if (b2 === 10 && alphabetHasNormalDecimalDigits) {
24761 n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
24762 str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
24764 intCheck(b2, 2, ALPHABET.length, "Base");
24765 str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b2, s2, true);
24767 if (s2 < 0 && n3.c[0])
24772 P2.valueOf = P2.toJSON = function() {
24773 return valueOf(this);
24775 P2._isBigNumber = true;
24776 P2[Symbol.toStringTag] = "BigNumber";
24777 P2[Symbol.for("nodejs.util.inspect.custom")] = P2.valueOf;
24778 if (configObject != null)
24779 BigNumber2.set(configObject);
24782 function bitFloor(n3) {
24784 return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
24786 function coeffToString(a2) {
24787 var s2, z2, i3 = 1, j2 = a2.length, r2 = a2[0] + "";
24788 for (; i3 < j2; ) {
24789 s2 = a2[i3++] + "";
24790 z2 = LOG_BASE - s2.length;
24791 for (; z2--; s2 = "0" + s2)
24795 for (j2 = r2.length; r2.charCodeAt(--j2) === 48; )
24797 return r2.slice(0, j2 + 1 || 1);
24799 function compare(x2, y2) {
24800 var a2, b2, xc = x2.c, yc = y2.c, i3 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
24806 return a2 ? b2 ? 0 : -j2 : i3;
24812 return b2 ? 0 : !xc ^ a2 ? 1 : -1;
24814 return k2 > l2 ^ a2 ? 1 : -1;
24815 j2 = (k2 = xc.length) < (l2 = yc.length) ? k2 : l2;
24816 for (i3 = 0; i3 < j2; i3++)
24817 if (xc[i3] != yc[i3])
24818 return xc[i3] > yc[i3] ^ a2 ? 1 : -1;
24819 return k2 == l2 ? 0 : k2 > l2 ^ a2 ? 1 : -1;
24821 function intCheck(n3, min3, max3, name) {
24822 if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
24823 throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
24826 function isOdd(n3) {
24827 var k2 = n3.c.length - 1;
24828 return bitFloor(n3.e / LOG_BASE) == k2 && n3.c[k2] % 2 != 0;
24830 function toExponential(str, e3) {
24831 return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
24833 function toFixedPoint(str, e3, z2) {
24836 for (zs = z2 + "."; ++e3; zs += z2)
24842 for (zs = z2, e3 -= len; --e3; zs += z2)
24845 } else if (e3 < len) {
24846 str = str.slice(0, e3) + "." + str.slice(e3);
24851 var BigNumber = clone();
24852 var bignumber_default = BigNumber;
24854 // node_modules/splaytree-ts/dist/index.js
24855 var SplayTreeNode = class {
24857 __publicField(this, "key");
24858 __publicField(this, "left", null);
24859 __publicField(this, "right", null);
24863 var SplayTreeSetNode = class extends SplayTreeNode {
24868 var SplayTree = class {
24870 __publicField(this, "size", 0);
24871 __publicField(this, "modificationCount", 0);
24872 __publicField(this, "splayCount", 0);
24875 const root3 = this.root;
24876 if (root3 == null) {
24877 this.compare(key, key);
24881 let newTreeRight = null;
24883 let newTreeLeft = null;
24884 let current = root3;
24885 const compare2 = this.compare;
24888 comp = compare2(current.key, key);
24890 let currentLeft = current.left;
24891 if (currentLeft == null)
24893 comp = compare2(currentLeft.key, key);
24895 current.left = currentLeft.right;
24896 currentLeft.right = current;
24897 current = currentLeft;
24898 currentLeft = current.left;
24899 if (currentLeft == null)
24902 if (right == null) {
24903 newTreeRight = current;
24905 right.left = current;
24908 current = currentLeft;
24909 } else if (comp < 0) {
24910 let currentRight = current.right;
24911 if (currentRight == null)
24913 comp = compare2(currentRight.key, key);
24915 current.right = currentRight.left;
24916 currentRight.left = current;
24917 current = currentRight;
24918 currentRight = current.right;
24919 if (currentRight == null)
24922 if (left == null) {
24923 newTreeLeft = current;
24925 left.right = current;
24928 current = currentRight;
24933 if (left != null) {
24934 left.right = current.left;
24935 current.left = newTreeLeft;
24937 if (right != null) {
24938 right.left = current.right;
24939 current.right = newTreeRight;
24941 if (this.root !== current) {
24942 this.root = current;
24948 let current = node;
24949 let nextLeft = current.left;
24950 while (nextLeft != null) {
24951 const left = nextLeft;
24952 current.left = left.right;
24953 left.right = current;
24955 nextLeft = current.left;
24960 let current = node;
24961 let nextRight = current.right;
24962 while (nextRight != null) {
24963 const right = nextRight;
24964 current.right = right.left;
24965 right.left = current;
24967 nextRight = current.right;
24972 if (this.root == null)
24974 const comp = this.splay(key);
24977 let root3 = this.root;
24978 const result = root3;
24979 const left = root3.left;
24981 if (left == null) {
24982 this.root = root3.right;
24984 const right = root3.right;
24985 root3 = this.splayMax(left);
24986 root3.right = right;
24989 this.modificationCount++;
24992 addNewRoot(node, comp) {
24994 this.modificationCount++;
24995 const root3 = this.root;
24996 if (root3 == null) {
25002 node.right = root3.right;
25003 root3.right = null;
25005 node.right = root3;
25006 node.left = root3.left;
25012 const root3 = this.root;
25015 this.root = this.splayMin(root3);
25019 const root3 = this.root;
25022 this.root = this.splayMax(root3);
25028 this.modificationCount++;
25031 return this.validKey(key) && this.splay(key) == 0;
25034 return (a2, b2) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
25041 setRoot: (root3) => {
25047 getModificationCount: () => {
25048 return this.modificationCount;
25050 getSplayCount: () => {
25051 return this.splayCount;
25053 setSplayCount: (count) => {
25054 this.splayCount = count;
25057 return this.splay(key);
25060 return this.has(key);
25066 var _SplayTreeSet = class _SplayTreeSet extends SplayTree {
25067 constructor(compare2, isValidKey) {
25069 __publicField(this, "root", null);
25070 __publicField(this, "compare");
25071 __publicField(this, "validKey");
25072 __publicField(this, _a, "[object Set]");
25073 this.compare = compare2 != null ? compare2 : this.defaultCompare();
25074 this.validKey = isValidKey != null ? isValidKey : (v2) => v2 != null && v2 != void 0;
25077 if (!this.validKey(element))
25079 return this._delete(element) != null;
25081 deleteAll(elements) {
25082 for (const element of elements) {
25083 this.delete(element);
25087 const nodes = this[Symbol.iterator]();
25089 while (result = nodes.next(), !result.done) {
25090 f2(result.value, result.value, this);
25094 const compare2 = this.splay(element);
25096 this.addNewRoot(new SplayTreeSetNode(element), compare2);
25099 addAndReturn(element) {
25100 const compare2 = this.splay(element);
25102 this.addNewRoot(new SplayTreeSetNode(element), compare2);
25103 return this.root.key;
25106 for (const element of elements) {
25111 return this.root == null;
25114 return this.root != null;
25117 if (this.size == 0)
25118 throw "Bad state: No element";
25120 throw "Bad state: Too many element";
25121 return this.root.key;
25124 if (this.size == 0)
25125 throw "Bad state: No element";
25126 return this._first().key;
25129 if (this.size == 0)
25130 throw "Bad state: No element";
25131 return this._last().key;
25133 lastBefore(element) {
25134 if (element == null)
25135 throw "Invalid arguments(s)";
25136 if (this.root == null)
25138 const comp = this.splay(element);
25140 return this.root.key;
25141 let node = this.root.left;
25144 let nodeRight = node.right;
25145 while (nodeRight != null) {
25147 nodeRight = node.right;
25151 firstAfter(element) {
25152 if (element == null)
25153 throw "Invalid arguments(s)";
25154 if (this.root == null)
25156 const comp = this.splay(element);
25158 return this.root.key;
25159 let node = this.root.right;
25162 let nodeLeft = node.left;
25163 while (nodeLeft != null) {
25165 nodeLeft = node.left;
25169 retainAll(elements) {
25170 const retainSet = new _SplayTreeSet(this.compare, this.validKey);
25171 const modificationCount = this.modificationCount;
25172 for (const object of elements) {
25173 if (modificationCount != this.modificationCount) {
25174 throw "Concurrent modification during iteration.";
25176 if (this.validKey(object) && this.splay(object) == 0) {
25177 retainSet.add(this.root.key);
25180 if (retainSet.size != this.size) {
25181 this.root = retainSet.root;
25182 this.size = retainSet.size;
25183 this.modificationCount++;
25187 if (!this.validKey(object))
25189 const comp = this.splay(object);
25192 return this.root.key;
25194 intersection(other) {
25195 const result = new _SplayTreeSet(this.compare, this.validKey);
25196 for (const element of this) {
25197 if (other.has(element))
25198 result.add(element);
25202 difference(other) {
25203 const result = new _SplayTreeSet(this.compare, this.validKey);
25204 for (const element of this) {
25205 if (!other.has(element))
25206 result.add(element);
25211 const u2 = this.clone();
25216 const set4 = new _SplayTreeSet(this.compare, this.validKey);
25217 set4.size = this.size;
25218 set4.root = this.copyNode(this.root);
25224 function copyChildren(node2, dest) {
25229 right = node2.right;
25230 if (left != null) {
25231 const newLeft = new SplayTreeSetNode(left.key);
25232 dest.left = newLeft;
25233 copyChildren(left, newLeft);
25235 if (right != null) {
25236 const newRight = new SplayTreeSetNode(right.key);
25237 dest.right = newRight;
25241 } while (right != null);
25243 const result = new SplayTreeSetNode(node.key);
25244 copyChildren(node, result);
25248 return this.clone();
25251 return new SplayTreeSetEntryIterableIterator(this.wrap());
25254 return this[Symbol.iterator]();
25257 return this[Symbol.iterator]();
25259 [Symbol.iterator]() {
25260 return new SplayTreeKeyIterableIterator(this.wrap());
25263 _a = Symbol.toStringTag;
25264 var SplayTreeSet = _SplayTreeSet;
25265 var SplayTreeIterableIterator = class {
25266 constructor(tree) {
25267 __publicField(this, "tree");
25268 __publicField(this, "path", new Array());
25269 __publicField(this, "modificationCount", null);
25270 __publicField(this, "splayCount");
25272 this.splayCount = tree.getSplayCount();
25274 [Symbol.iterator]() {
25278 if (this.moveNext())
25279 return { done: false, value: this.current() };
25280 return { done: true, value: null };
25283 if (!this.path.length)
25285 const node = this.path[this.path.length - 1];
25286 return this.getValue(node);
25289 this.path.splice(0, this.path.length);
25290 this.tree.splay(key);
25291 this.path.push(this.tree.getRoot());
25292 this.splayCount = this.tree.getSplayCount();
25294 findLeftMostDescendent(node) {
25295 while (node != null) {
25296 this.path.push(node);
25301 if (this.modificationCount != this.tree.getModificationCount()) {
25302 if (this.modificationCount == null) {
25303 this.modificationCount = this.tree.getModificationCount();
25304 let node2 = this.tree.getRoot();
25305 while (node2 != null) {
25306 this.path.push(node2);
25307 node2 = node2.left;
25309 return this.path.length > 0;
25311 throw "Concurrent modification during iteration.";
25313 if (!this.path.length)
25315 if (this.splayCount != this.tree.getSplayCount()) {
25316 this.rebuildPath(this.path[this.path.length - 1].key);
25318 let node = this.path[this.path.length - 1];
25319 let next = node.right;
25320 if (next != null) {
25321 while (next != null) {
25322 this.path.push(next);
25328 while (this.path.length && this.path[this.path.length - 1].right === node) {
25329 node = this.path.pop();
25331 return this.path.length > 0;
25334 var SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
25339 var SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
25341 return [node.key, node.key];
25345 // node_modules/polyclip-ts/dist/identity.js
25346 var identity_default3 = (x2) => {
25350 // node_modules/polyclip-ts/dist/snap.js
25351 var snap_default = (eps) => {
25353 const xTree = new SplayTreeSet(compare_default(eps));
25354 const yTree = new SplayTreeSet(compare_default(eps));
25355 const snapCoord = (coord2, tree) => {
25356 return tree.addAndReturn(coord2);
25358 const snap = (v2) => {
25360 x: snapCoord(v2.x, xTree),
25361 y: snapCoord(v2.y, yTree)
25364 snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
25367 return identity_default3;
25370 // node_modules/polyclip-ts/dist/precision.js
25371 var set3 = (eps) => {
25374 precision = set3(eps2);
25376 reset: () => set3(eps),
25377 compare: compare_default(eps),
25378 snap: snap_default(eps),
25379 orient: orient_default(eps)
25382 var precision = set3();
25384 // node_modules/polyclip-ts/dist/bbox.js
25385 var isInBbox = (bbox2, point2) => {
25386 return bbox2.ll.x.isLessThanOrEqualTo(point2.x) && point2.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point2.y) && point2.y.isLessThanOrEqualTo(bbox2.ur.y);
25388 var getBboxOverlap = (b1, b2) => {
25389 if (b2.ur.x.isLessThan(b1.ll.x) || b1.ur.x.isLessThan(b2.ll.x) || b2.ur.y.isLessThan(b1.ll.y) || b1.ur.y.isLessThan(b2.ll.y))
25391 const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;
25392 const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;
25393 const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;
25394 const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;
25395 return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
25398 // node_modules/polyclip-ts/dist/vector.js
25399 var crossProduct = (a2, b2) => a2.x.times(b2.y).minus(a2.y.times(b2.x));
25400 var dotProduct = (a2, b2) => a2.x.times(b2.x).plus(a2.y.times(b2.y));
25401 var length = (v2) => dotProduct(v2, v2).sqrt();
25402 var sineOfAngle = (pShared, pBase, pAngle) => {
25403 const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25404 const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25405 return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25407 var cosineOfAngle = (pShared, pBase, pAngle) => {
25408 const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
25409 const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
25410 return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
25412 var horizontalIntersection = (pt2, v2, y2) => {
25415 return { x: pt2.x.plus(v2.x.div(v2.y).times(y2.minus(pt2.y))), y: y2 };
25417 var verticalIntersection = (pt2, v2, x2) => {
25420 return { x: x2, y: pt2.y.plus(v2.y.div(v2.x).times(x2.minus(pt2.x))) };
25422 var intersection = (pt1, v1, pt2, v2) => {
25424 return verticalIntersection(pt2, v2, pt1.x);
25426 return verticalIntersection(pt1, v1, pt2.x);
25428 return horizontalIntersection(pt2, v2, pt1.y);
25430 return horizontalIntersection(pt1, v1, pt2.y);
25431 const kross = crossProduct(v1, v2);
25432 if (kross.isZero())
25434 const ve2 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
25435 const d1 = crossProduct(ve2, v1).div(kross);
25436 const d2 = crossProduct(ve2, v2).div(kross);
25437 const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));
25438 const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));
25439 const x3 = x12.plus(x2).div(2);
25440 const y3 = y12.plus(y2).div(2);
25441 return { x: x3, y: y3 };
25444 // node_modules/polyclip-ts/dist/sweep-event.js
25445 var SweepEvent = class _SweepEvent {
25446 // Warning: 'point' input will be modified and re-used (for performance)
25447 constructor(point2, isLeft) {
25448 __publicField(this, "point");
25449 __publicField(this, "isLeft");
25450 __publicField(this, "segment");
25451 __publicField(this, "otherSE");
25452 __publicField(this, "consumedBy");
25453 if (point2.events === void 0)
25454 point2.events = [this];
25456 point2.events.push(this);
25457 this.point = point2;
25458 this.isLeft = isLeft;
25460 // for ordering sweep events in the sweep event queue
25461 static compare(a2, b2) {
25462 const ptCmp = _SweepEvent.comparePoints(a2.point, b2.point);
25465 if (a2.point !== b2.point)
25467 if (a2.isLeft !== b2.isLeft)
25468 return a2.isLeft ? 1 : -1;
25469 return Segment.compare(a2.segment, b2.segment);
25471 // for ordering points in sweep line order
25472 static comparePoints(aPt, bPt) {
25473 if (aPt.x.isLessThan(bPt.x))
25475 if (aPt.x.isGreaterThan(bPt.x))
25477 if (aPt.y.isLessThan(bPt.y))
25479 if (aPt.y.isGreaterThan(bPt.y))
25484 if (other.point === this.point) {
25485 throw new Error("Tried to link already linked events");
25487 const otherEvents = other.point.events;
25488 for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
25489 const evt = otherEvents[i3];
25490 this.point.events.push(evt);
25491 evt.point = this.point;
25493 this.checkForConsuming();
25495 /* Do a pass over our linked events and check to see if any pair
25496 * of segments match, and should be consumed. */
25497 checkForConsuming() {
25498 const numEvents = this.point.events.length;
25499 for (let i3 = 0; i3 < numEvents; i3++) {
25500 const evt1 = this.point.events[i3];
25501 if (evt1.segment.consumedBy !== void 0)
25503 for (let j2 = i3 + 1; j2 < numEvents; j2++) {
25504 const evt2 = this.point.events[j2];
25505 if (evt2.consumedBy !== void 0)
25507 if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
25509 evt1.segment.consume(evt2.segment);
25513 getAvailableLinkedEvents() {
25515 for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
25516 const evt = this.point.events[i3];
25517 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
25524 * Returns a comparator function for sorting linked events that will
25525 * favor the event that will give us the smallest left-side angle.
25526 * All ring construction starts as low as possible heading to the right,
25527 * so by always turning left as sharp as possible we'll get polygons
25528 * without uncessary loops & holes.
25530 * The comparator function has a compute cache such that it avoids
25531 * re-computing already-computed values.
25533 getLeftmostComparator(baseEvent) {
25534 const cache = /* @__PURE__ */ new Map();
25535 const fillCache = (linkedEvent) => {
25536 const nextEvent = linkedEvent.otherSE;
25537 cache.set(linkedEvent, {
25538 sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
25539 cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
25542 return (a2, b2) => {
25543 if (!cache.has(a2))
25545 if (!cache.has(b2))
25547 const { sine: asine, cosine: acosine } = cache.get(a2);
25548 const { sine: bsine, cosine: bcosine } = cache.get(b2);
25549 if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
25550 if (acosine.isLessThan(bcosine))
25552 if (acosine.isGreaterThan(bcosine))
25556 if (asine.isLessThan(0) && bsine.isLessThan(0)) {
25557 if (acosine.isLessThan(bcosine))
25559 if (acosine.isGreaterThan(bcosine))
25563 if (bsine.isLessThan(asine))
25565 if (bsine.isGreaterThan(asine))
25572 // node_modules/polyclip-ts/dist/segment.js
25574 var Segment = class _Segment {
25575 /* Warning: a reference to ringWindings input will be stored,
25576 * and possibly will be later modified */
25577 constructor(leftSE, rightSE, rings, windings) {
25578 __publicField(this, "id");
25579 __publicField(this, "leftSE");
25580 __publicField(this, "rightSE");
25581 __publicField(this, "rings");
25582 __publicField(this, "windings");
25583 __publicField(this, "ringOut");
25584 __publicField(this, "consumedBy");
25585 __publicField(this, "prev");
25586 __publicField(this, "_prevInResult");
25587 __publicField(this, "_beforeState");
25588 __publicField(this, "_afterState");
25589 __publicField(this, "_isInResult");
25590 this.id = ++segmentId;
25591 this.leftSE = leftSE;
25592 leftSE.segment = this;
25593 leftSE.otherSE = rightSE;
25594 this.rightSE = rightSE;
25595 rightSE.segment = this;
25596 rightSE.otherSE = leftSE;
25597 this.rings = rings;
25598 this.windings = windings;
25600 /* This compare() function is for ordering segments in the sweep
25601 * line tree, and does so according to the following criteria:
25603 * Consider the vertical line that lies an infinestimal step to the
25604 * right of the right-more of the two left endpoints of the input
25605 * segments. Imagine slowly moving a point up from negative infinity
25606 * in the increasing y direction. Which of the two segments will that
25607 * point intersect first? That segment comes 'before' the other one.
25609 * If neither segment would be intersected by such a line, (if one
25610 * or more of the segments are vertical) then the line to be considered
25611 * is directly on the right-more of the two left inputs.
25613 static compare(a2, b2) {
25614 const alx = a2.leftSE.point.x;
25615 const blx = b2.leftSE.point.x;
25616 const arx = a2.rightSE.point.x;
25617 const brx = b2.rightSE.point.x;
25618 if (brx.isLessThan(alx))
25620 if (arx.isLessThan(blx))
25622 const aly = a2.leftSE.point.y;
25623 const bly = b2.leftSE.point.y;
25624 const ary = a2.rightSE.point.y;
25625 const bry = b2.rightSE.point.y;
25626 if (alx.isLessThan(blx)) {
25627 if (bly.isLessThan(aly) && bly.isLessThan(ary))
25629 if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary))
25631 const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
25636 const bCmpARight = b2.comparePoint(a2.rightSE.point);
25637 if (bCmpARight !== 0)
25641 if (alx.isGreaterThan(blx)) {
25642 if (aly.isLessThan(bly) && aly.isLessThan(bry))
25644 if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry))
25646 const bCmpALeft = b2.comparePoint(a2.leftSE.point);
25647 if (bCmpALeft !== 0)
25649 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
25650 if (aCmpBRight < 0)
25652 if (aCmpBRight > 0)
25656 if (aly.isLessThan(bly))
25658 if (aly.isGreaterThan(bly))
25660 if (arx.isLessThan(brx)) {
25661 const bCmpARight = b2.comparePoint(a2.rightSE.point);
25662 if (bCmpARight !== 0)
25665 if (arx.isGreaterThan(brx)) {
25666 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
25667 if (aCmpBRight < 0)
25669 if (aCmpBRight > 0)
25672 if (!arx.eq(brx)) {
25673 const ay = ary.minus(aly);
25674 const ax = arx.minus(alx);
25675 const by = bry.minus(bly);
25676 const bx = brx.minus(blx);
25677 if (ay.isGreaterThan(ax) && by.isLessThan(bx))
25679 if (ay.isLessThan(ax) && by.isGreaterThan(bx))
25682 if (arx.isGreaterThan(brx))
25684 if (arx.isLessThan(brx))
25686 if (ary.isLessThan(bry))
25688 if (ary.isGreaterThan(bry))
25696 static fromRing(pt1, pt2, ring) {
25697 let leftPt, rightPt, winding;
25698 const cmpPts = SweepEvent.comparePoints(pt1, pt2);
25703 } else if (cmpPts > 0) {
25708 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
25709 const leftSE = new SweepEvent(leftPt, true);
25710 const rightSE = new SweepEvent(rightPt, false);
25711 return new _Segment(leftSE, rightSE, [ring], [winding]);
25713 /* When a segment is split, the rightSE is replaced with a new sweep event */
25714 replaceRightSE(newRightSE) {
25715 this.rightSE = newRightSE;
25716 this.rightSE.segment = this;
25717 this.rightSE.otherSE = this.leftSE;
25718 this.leftSE.otherSE = this.rightSE;
25721 const y12 = this.leftSE.point.y;
25722 const y2 = this.rightSE.point.y;
25724 ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
25725 ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
25728 /* A vector from the left point to the right */
25731 x: this.rightSE.point.x.minus(this.leftSE.point.x),
25732 y: this.rightSE.point.y.minus(this.leftSE.point.y)
25735 isAnEndpoint(pt2) {
25736 return pt2.x.eq(this.leftSE.point.x) && pt2.y.eq(this.leftSE.point.y) || pt2.x.eq(this.rightSE.point.x) && pt2.y.eq(this.rightSE.point.y);
25738 /* Compare this segment with a point.
25740 * A point P is considered to be colinear to a segment if there
25741 * exists a distance D such that if we travel along the segment
25742 * from one * endpoint towards the other a distance D, we find
25743 * ourselves at point P.
25745 * Return value indicates:
25747 * 1: point lies above the segment (to the left of vertical)
25748 * 0: point is colinear to segment
25749 * -1: point lies below the segment (to the right of vertical)
25751 comparePoint(point2) {
25752 return precision.orient(this.leftSE.point, point2, this.rightSE.point);
25755 * Given another segment, returns the first non-trivial intersection
25756 * between the two segments (in terms of sweep line ordering), if it exists.
25758 * A 'non-trivial' intersection is one that will cause one or both of the
25759 * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
25761 * * endpoint of segA with endpoint of segB --> trivial
25762 * * endpoint of segA with point along segB --> non-trivial
25763 * * endpoint of segB with point along segA --> non-trivial
25764 * * point along segA with point along segB --> non-trivial
25766 * If no non-trivial intersection exists, return null
25767 * Else, return null.
25769 getIntersection(other) {
25770 const tBbox = this.bbox();
25771 const oBbox = other.bbox();
25772 const bboxOverlap = getBboxOverlap(tBbox, oBbox);
25773 if (bboxOverlap === null)
25775 const tlp = this.leftSE.point;
25776 const trp = this.rightSE.point;
25777 const olp = other.leftSE.point;
25778 const orp = other.rightSE.point;
25779 const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
25780 const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
25781 const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
25782 const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
25783 if (touchesThisLSE && touchesOtherLSE) {
25784 if (touchesThisRSE && !touchesOtherRSE)
25786 if (!touchesThisRSE && touchesOtherRSE)
25790 if (touchesThisLSE) {
25791 if (touchesOtherRSE) {
25792 if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y))
25797 if (touchesOtherLSE) {
25798 if (touchesThisRSE) {
25799 if (trp.x.eq(olp.x) && trp.y.eq(olp.y))
25804 if (touchesThisRSE && touchesOtherRSE)
25806 if (touchesThisRSE)
25808 if (touchesOtherRSE)
25810 const pt2 = intersection(tlp, this.vector(), olp, other.vector());
25813 if (!isInBbox(bboxOverlap, pt2))
25815 return precision.snap(pt2);
25818 * Split the given segment into multiple segments on the given points.
25819 * * Each existing segment will retain its leftSE and a new rightSE will be
25820 * generated for it.
25821 * * A new segment will be generated which will adopt the original segment's
25822 * rightSE, and a new leftSE will be generated for it.
25823 * * If there are more than two points given to split on, new segments
25824 * in the middle will be generated with new leftSE and rightSE's.
25825 * * An array of the newly generated SweepEvents will be returned.
25827 * Warning: input array of points is modified
25830 const newEvents = [];
25831 const alreadyLinked = point2.events !== void 0;
25832 const newLeftSE = new SweepEvent(point2, true);
25833 const newRightSE = new SweepEvent(point2, false);
25834 const oldRightSE = this.rightSE;
25835 this.replaceRightSE(newRightSE);
25836 newEvents.push(newRightSE);
25837 newEvents.push(newLeftSE);
25838 const newSeg = new _Segment(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
25839 if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
25840 newSeg.swapEvents();
25842 if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
25845 if (alreadyLinked) {
25846 newLeftSE.checkForConsuming();
25847 newRightSE.checkForConsuming();
25851 /* Swap which event is left and right */
25853 const tmpEvt = this.rightSE;
25854 this.rightSE = this.leftSE;
25855 this.leftSE = tmpEvt;
25856 this.leftSE.isLeft = true;
25857 this.rightSE.isLeft = false;
25858 for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
25859 this.windings[i3] *= -1;
25862 /* Consume another segment. We take their rings under our wing
25863 * and mark them as consumed. Use for perfectly overlapping segments */
25865 let consumer = this;
25866 let consumee = other;
25867 while (consumer.consumedBy)
25868 consumer = consumer.consumedBy;
25869 while (consumee.consumedBy)
25870 consumee = consumee.consumedBy;
25871 const cmp = _Segment.compare(consumer, consumee);
25875 const tmp = consumer;
25876 consumer = consumee;
25879 if (consumer.prev === consumee) {
25880 const tmp = consumer;
25881 consumer = consumee;
25884 for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
25885 const ring = consumee.rings[i3];
25886 const winding = consumee.windings[i3];
25887 const index = consumer.rings.indexOf(ring);
25888 if (index === -1) {
25889 consumer.rings.push(ring);
25890 consumer.windings.push(winding);
25892 consumer.windings[index] += winding;
25894 consumee.rings = null;
25895 consumee.windings = null;
25896 consumee.consumedBy = consumer;
25897 consumee.leftSE.consumedBy = consumer.leftSE;
25898 consumee.rightSE.consumedBy = consumer.rightSE;
25900 /* The first segment previous segment chain that is in the result */
25902 if (this._prevInResult !== void 0)
25903 return this._prevInResult;
25905 this._prevInResult = null;
25906 else if (this.prev.isInResult())
25907 this._prevInResult = this.prev;
25909 this._prevInResult = this.prev.prevInResult();
25910 return this._prevInResult;
25913 if (this._beforeState !== void 0)
25914 return this._beforeState;
25916 this._beforeState = {
25922 const seg = this.prev.consumedBy || this.prev;
25923 this._beforeState = seg.afterState();
25925 return this._beforeState;
25928 if (this._afterState !== void 0)
25929 return this._afterState;
25930 const beforeState = this.beforeState();
25931 this._afterState = {
25932 rings: beforeState.rings.slice(0),
25933 windings: beforeState.windings.slice(0),
25936 const ringsAfter = this._afterState.rings;
25937 const windingsAfter = this._afterState.windings;
25938 const mpsAfter = this._afterState.multiPolys;
25939 for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
25940 const ring = this.rings[i3];
25941 const winding = this.windings[i3];
25942 const index = ringsAfter.indexOf(ring);
25943 if (index === -1) {
25944 ringsAfter.push(ring);
25945 windingsAfter.push(winding);
25947 windingsAfter[index] += winding;
25949 const polysAfter = [];
25950 const polysExclude = [];
25951 for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
25952 if (windingsAfter[i3] === 0)
25954 const ring = ringsAfter[i3];
25955 const poly = ring.poly;
25956 if (polysExclude.indexOf(poly) !== -1)
25958 if (ring.isExterior)
25959 polysAfter.push(poly);
25961 if (polysExclude.indexOf(poly) === -1)
25962 polysExclude.push(poly);
25963 const index = polysAfter.indexOf(ring.poly);
25965 polysAfter.splice(index, 1);
25968 for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
25969 const mp = polysAfter[i3].multiPoly;
25970 if (mpsAfter.indexOf(mp) === -1)
25973 return this._afterState;
25975 /* Is this segment part of the final result? */
25977 if (this.consumedBy)
25979 if (this._isInResult !== void 0)
25980 return this._isInResult;
25981 const mpsBefore = this.beforeState().multiPolys;
25982 const mpsAfter = this.afterState().multiPolys;
25983 switch (operation_default.type) {
25985 const noBefores = mpsBefore.length === 0;
25986 const noAfters = mpsAfter.length === 0;
25987 this._isInResult = noBefores !== noAfters;
25990 case "intersection": {
25993 if (mpsBefore.length < mpsAfter.length) {
25994 least = mpsBefore.length;
25995 most = mpsAfter.length;
25997 least = mpsAfter.length;
25998 most = mpsBefore.length;
26000 this._isInResult = most === operation_default.numMultiPolys && least < most;
26004 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
26005 this._isInResult = diff % 2 === 1;
26008 case "difference": {
26009 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
26010 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
26014 return this._isInResult;
26018 // node_modules/polyclip-ts/dist/geom-in.js
26019 var RingIn = class {
26020 constructor(geomRing, poly, isExterior) {
26021 __publicField(this, "poly");
26022 __publicField(this, "isExterior");
26023 __publicField(this, "segments");
26024 __publicField(this, "bbox");
26025 if (!Array.isArray(geomRing) || geomRing.length === 0) {
26026 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26029 this.isExterior = isExterior;
26030 this.segments = [];
26031 if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
26032 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26034 const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
26036 ll: { x: firstPoint.x, y: firstPoint.y },
26037 ur: { x: firstPoint.x, y: firstPoint.y }
26039 let prevPoint = firstPoint;
26040 for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
26041 if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
26042 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26044 const point2 = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
26045 if (point2.x.eq(prevPoint.x) && point2.y.eq(prevPoint.y))
26047 this.segments.push(Segment.fromRing(prevPoint, point2, this));
26048 if (point2.x.isLessThan(this.bbox.ll.x))
26049 this.bbox.ll.x = point2.x;
26050 if (point2.y.isLessThan(this.bbox.ll.y))
26051 this.bbox.ll.y = point2.y;
26052 if (point2.x.isGreaterThan(this.bbox.ur.x))
26053 this.bbox.ur.x = point2.x;
26054 if (point2.y.isGreaterThan(this.bbox.ur.y))
26055 this.bbox.ur.y = point2.y;
26056 prevPoint = point2;
26058 if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
26059 this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
26063 const sweepEvents = [];
26064 for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
26065 const segment = this.segments[i3];
26066 sweepEvents.push(segment.leftSE);
26067 sweepEvents.push(segment.rightSE);
26069 return sweepEvents;
26072 var PolyIn = class {
26073 constructor(geomPoly, multiPoly) {
26074 __publicField(this, "multiPoly");
26075 __publicField(this, "exteriorRing");
26076 __publicField(this, "interiorRings");
26077 __publicField(this, "bbox");
26078 if (!Array.isArray(geomPoly)) {
26079 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26081 this.exteriorRing = new RingIn(geomPoly[0], this, true);
26083 ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
26084 ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
26086 this.interiorRings = [];
26087 for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
26088 const ring = new RingIn(geomPoly[i3], this, false);
26089 if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x))
26090 this.bbox.ll.x = ring.bbox.ll.x;
26091 if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y))
26092 this.bbox.ll.y = ring.bbox.ll.y;
26093 if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
26094 this.bbox.ur.x = ring.bbox.ur.x;
26095 if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
26096 this.bbox.ur.y = ring.bbox.ur.y;
26097 this.interiorRings.push(ring);
26099 this.multiPoly = multiPoly;
26102 const sweepEvents = this.exteriorRing.getSweepEvents();
26103 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
26104 const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
26105 for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
26106 sweepEvents.push(ringSweepEvents[j2]);
26109 return sweepEvents;
26112 var MultiPolyIn = class {
26113 constructor(geom, isSubject) {
26114 __publicField(this, "isSubject");
26115 __publicField(this, "polys");
26116 __publicField(this, "bbox");
26117 if (!Array.isArray(geom)) {
26118 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
26121 if (typeof geom[0][0][0] === "number")
26127 ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
26128 ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
26130 for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
26131 const poly = new PolyIn(geom[i3], this);
26132 if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x))
26133 this.bbox.ll.x = poly.bbox.ll.x;
26134 if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y))
26135 this.bbox.ll.y = poly.bbox.ll.y;
26136 if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
26137 this.bbox.ur.x = poly.bbox.ur.x;
26138 if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
26139 this.bbox.ur.y = poly.bbox.ur.y;
26140 this.polys.push(poly);
26142 this.isSubject = isSubject;
26145 const sweepEvents = [];
26146 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26147 const polySweepEvents = this.polys[i3].getSweepEvents();
26148 for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
26149 sweepEvents.push(polySweepEvents[j2]);
26152 return sweepEvents;
26156 // node_modules/polyclip-ts/dist/geom-out.js
26157 var RingOut = class _RingOut {
26158 constructor(events) {
26159 __publicField(this, "events");
26160 __publicField(this, "poly");
26161 __publicField(this, "_isExteriorRing");
26162 __publicField(this, "_enclosingRing");
26163 this.events = events;
26164 for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
26165 events[i3].segment.ringOut = this;
26169 /* Given the segments from the sweep line pass, compute & return a series
26170 * of closed rings from all the segments marked to be part of the result */
26171 static factory(allSegments) {
26172 const ringsOut = [];
26173 for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
26174 const segment = allSegments[i3];
26175 if (!segment.isInResult() || segment.ringOut)
26177 let prevEvent = null;
26178 let event = segment.leftSE;
26179 let nextEvent = segment.rightSE;
26180 const events = [event];
26181 const startingPoint = event.point;
26182 const intersectionLEs = [];
26186 events.push(event);
26187 if (event.point === startingPoint)
26190 const availableLEs = event.getAvailableLinkedEvents();
26191 if (availableLEs.length === 0) {
26192 const firstPt = events[0].point;
26193 const lastPt = events[events.length - 1].point;
26194 throw new Error("Unable to complete output ring starting at [".concat(firstPt.x, ",") + " ".concat(firstPt.y, "]. Last matching segment found ends at") + " [".concat(lastPt.x, ", ").concat(lastPt.y, "]."));
26196 if (availableLEs.length === 1) {
26197 nextEvent = availableLEs[0].otherSE;
26200 let indexLE = null;
26201 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
26202 if (intersectionLEs[j2].point === event.point) {
26207 if (indexLE !== null) {
26208 const intersectionLE = intersectionLEs.splice(indexLE)[0];
26209 const ringEvents = events.splice(intersectionLE.index);
26210 ringEvents.unshift(ringEvents[0].otherSE);
26211 ringsOut.push(new _RingOut(ringEvents.reverse()));
26214 intersectionLEs.push({
26215 index: events.length,
26218 const comparator = event.getLeftmostComparator(prevEvent);
26219 nextEvent = availableLEs.sort(comparator)[0].otherSE;
26223 ringsOut.push(new _RingOut(events));
26228 let prevPt = this.events[0].point;
26229 const points = [prevPt];
26230 for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
26231 const pt3 = this.events[i3].point;
26232 const nextPt2 = this.events[i3 + 1].point;
26233 if (precision.orient(pt3, prevPt, nextPt2) === 0)
26238 if (points.length === 1)
26240 const pt2 = points[0];
26241 const nextPt = points[1];
26242 if (precision.orient(pt2, prevPt, nextPt) === 0)
26244 points.push(points[0]);
26245 const step = this.isExteriorRing() ? 1 : -1;
26246 const iStart = this.isExteriorRing() ? 0 : points.length - 1;
26247 const iEnd = this.isExteriorRing() ? points.length : -1;
26248 const orderedPoints = [];
26249 for (let i3 = iStart; i3 != iEnd; i3 += step)
26250 orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
26251 return orderedPoints;
26254 if (this._isExteriorRing === void 0) {
26255 const enclosing = this.enclosingRing();
26256 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
26258 return this._isExteriorRing;
26261 if (this._enclosingRing === void 0) {
26262 this._enclosingRing = this._calcEnclosingRing();
26264 return this._enclosingRing;
26266 /* Returns the ring that encloses this one, if any */
26267 _calcEnclosingRing() {
26269 let leftMostEvt = this.events[0];
26270 for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
26271 const evt = this.events[i3];
26272 if (SweepEvent.compare(leftMostEvt, evt) > 0)
26275 let prevSeg = leftMostEvt.segment.prevInResult();
26276 let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
26281 return prevSeg.ringOut;
26282 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
26283 if (((_a2 = prevPrevSeg.ringOut) == null ? void 0 : _a2.enclosingRing()) !== prevSeg.ringOut) {
26284 return prevSeg.ringOut;
26286 return (_b = prevSeg.ringOut) == null ? void 0 : _b.enclosingRing();
26288 prevSeg = prevPrevSeg.prevInResult();
26289 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
26293 var PolyOut = class {
26294 constructor(exteriorRing) {
26295 __publicField(this, "exteriorRing");
26296 __publicField(this, "interiorRings");
26297 this.exteriorRing = exteriorRing;
26298 exteriorRing.poly = this;
26299 this.interiorRings = [];
26301 addInterior(ring) {
26302 this.interiorRings.push(ring);
26306 const geom = [this.exteriorRing.getGeom()];
26307 if (geom[0] === null)
26309 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
26310 const ringGeom = this.interiorRings[i3].getGeom();
26311 if (ringGeom === null)
26313 geom.push(ringGeom);
26318 var MultiPolyOut = class {
26319 constructor(rings) {
26320 __publicField(this, "rings");
26321 __publicField(this, "polys");
26322 this.rings = rings;
26323 this.polys = this._composePolys(rings);
26327 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
26328 const polyGeom = this.polys[i3].getGeom();
26329 if (polyGeom === null)
26331 geom.push(polyGeom);
26335 _composePolys(rings) {
26338 for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
26339 const ring = rings[i3];
26342 if (ring.isExteriorRing())
26343 polys.push(new PolyOut(ring));
26345 const enclosingRing = ring.enclosingRing();
26346 if (!(enclosingRing == null ? void 0 : enclosingRing.poly))
26347 polys.push(new PolyOut(enclosingRing));
26348 (_a2 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a2.addInterior(ring);
26355 // node_modules/polyclip-ts/dist/sweep-line.js
26356 var SweepLine = class {
26357 constructor(queue, comparator = Segment.compare) {
26358 __publicField(this, "queue");
26359 __publicField(this, "tree");
26360 __publicField(this, "segments");
26361 this.queue = queue;
26362 this.tree = new SplayTreeSet(comparator);
26363 this.segments = [];
26366 const segment = event.segment;
26367 const newEvents = [];
26368 if (event.consumedBy) {
26370 this.queue.delete(event.otherSE);
26372 this.tree.delete(segment);
26376 this.tree.add(segment);
26377 let prevSeg = segment;
26378 let nextSeg = segment;
26380 prevSeg = this.tree.lastBefore(prevSeg);
26381 } while (prevSeg != null && prevSeg.consumedBy != void 0);
26383 nextSeg = this.tree.firstAfter(nextSeg);
26384 } while (nextSeg != null && nextSeg.consumedBy != void 0);
26385 if (event.isLeft) {
26386 let prevMySplitter = null;
26388 const prevInter = prevSeg.getIntersection(segment);
26389 if (prevInter !== null) {
26390 if (!segment.isAnEndpoint(prevInter))
26391 prevMySplitter = prevInter;
26392 if (!prevSeg.isAnEndpoint(prevInter)) {
26393 const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
26394 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26395 newEvents.push(newEventsFromSplit[i3]);
26400 let nextMySplitter = null;
26402 const nextInter = nextSeg.getIntersection(segment);
26403 if (nextInter !== null) {
26404 if (!segment.isAnEndpoint(nextInter))
26405 nextMySplitter = nextInter;
26406 if (!nextSeg.isAnEndpoint(nextInter)) {
26407 const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
26408 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26409 newEvents.push(newEventsFromSplit[i3]);
26414 if (prevMySplitter !== null || nextMySplitter !== null) {
26415 let mySplitter = null;
26416 if (prevMySplitter === null)
26417 mySplitter = nextMySplitter;
26418 else if (nextMySplitter === null)
26419 mySplitter = prevMySplitter;
26421 const cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
26422 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
26424 this.queue.delete(segment.rightSE);
26425 newEvents.push(segment.rightSE);
26426 const newEventsFromSplit = segment.split(mySplitter);
26427 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26428 newEvents.push(newEventsFromSplit[i3]);
26431 if (newEvents.length > 0) {
26432 this.tree.delete(segment);
26433 newEvents.push(event);
26435 this.segments.push(segment);
26436 segment.prev = prevSeg;
26439 if (prevSeg && nextSeg) {
26440 const inter = prevSeg.getIntersection(nextSeg);
26441 if (inter !== null) {
26442 if (!prevSeg.isAnEndpoint(inter)) {
26443 const newEventsFromSplit = this._splitSafely(prevSeg, inter);
26444 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26445 newEvents.push(newEventsFromSplit[i3]);
26448 if (!nextSeg.isAnEndpoint(inter)) {
26449 const newEventsFromSplit = this._splitSafely(nextSeg, inter);
26450 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
26451 newEvents.push(newEventsFromSplit[i3]);
26456 this.tree.delete(segment);
26460 /* Safely split a segment that is currently in the datastructures
26461 * IE - a segment other than the one that is currently being processed. */
26462 _splitSafely(seg, pt2) {
26463 this.tree.delete(seg);
26464 const rightSE = seg.rightSE;
26465 this.queue.delete(rightSE);
26466 const newEvents = seg.split(pt2);
26467 newEvents.push(rightSE);
26468 if (seg.consumedBy === void 0)
26469 this.tree.add(seg);
26474 // node_modules/polyclip-ts/dist/operation.js
26475 var Operation = class {
26477 __publicField(this, "type");
26478 __publicField(this, "numMultiPolys");
26480 run(type2, geom, moreGeoms) {
26481 operation.type = type2;
26482 const multipolys = [new MultiPolyIn(geom, true)];
26483 for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
26484 multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
26486 operation.numMultiPolys = multipolys.length;
26487 if (operation.type === "difference") {
26488 const subject = multipolys[0];
26490 while (i3 < multipolys.length) {
26491 if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null)
26494 multipolys.splice(i3, 1);
26497 if (operation.type === "intersection") {
26498 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26499 const mpA = multipolys[i3];
26500 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
26501 if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
26506 const queue = new SplayTreeSet(SweepEvent.compare);
26507 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
26508 const sweepEvents = multipolys[i3].getSweepEvents();
26509 for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
26510 queue.add(sweepEvents[j2]);
26513 const sweepLine = new SweepLine(queue);
26515 if (queue.size != 0) {
26516 evt = queue.first();
26520 const newEvents = sweepLine.process(evt);
26521 for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
26522 const evt2 = newEvents[i3];
26523 if (evt2.consumedBy === void 0)
26526 if (queue.size != 0) {
26527 evt = queue.first();
26534 const ringsOut = RingOut.factory(sweepLine.segments);
26535 const result = new MultiPolyOut(ringsOut);
26536 return result.getGeom();
26539 var operation = new Operation();
26540 var operation_default = operation;
26542 // node_modules/polyclip-ts/dist/index.js
26543 var union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
26544 var difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
26545 var setPrecision = precision.set;
26547 // node_modules/@rapideditor/location-conflation/index.mjs
26548 var import_geojson_area = __toESM(require_geojson_area(), 1);
26549 var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
26550 var import_geojson_precision = __toESM(require_geojson_precision(), 1);
26551 var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
26552 var LocationConflation = class {
26555 // `fc` Optional FeatureCollection of known features
26557 // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
26558 // Each feature must have a filename-like `id`, for example: `something.geojson`
26561 // "type": "FeatureCollection"
26564 // "type": "Feature",
26565 // "id": "philly_metro.geojson",
26566 // "properties": { … },
26567 // "geometry": { … }
26573 this.strict = true;
26574 if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
26575 fc.features.forEach((feature3) => {
26576 feature3.properties = feature3.properties || {};
26577 let props = feature3.properties;
26578 let id2 = feature3.id || props.id;
26579 if (!id2 || !/^\S+\.geojson$/i.test(id2))
26581 id2 = id2.toLowerCase();
26585 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
26586 props.area = Number(area.toFixed(2));
26588 this._cache[id2] = feature3;
26591 let world = _cloneDeep(feature("Q2"));
26594 coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
26597 world.properties.id = "Q2";
26598 world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
26599 this._cache.Q2 = world;
26601 // validateLocation
26602 // `location` The location to validate
26604 // Pass a `location` value to validate
26606 // Returns a result like:
26608 // type: 'point', 'geojson', or 'countrycoder'
26609 // location: the queried location
26610 // id: the stable identifier for the feature
26612 // or `null` if the location is invalid
26614 validateLocation(location) {
26615 if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
26616 const lon = location[0];
26617 const lat = location[1];
26618 const radius = location[2];
26619 if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
26620 const id2 = "[" + location.toString() + "]";
26621 return { type: "point", location, id: id2 };
26623 } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
26624 const id2 = location.toLowerCase();
26625 if (this._cache[id2]) {
26626 return { type: "geojson", location, id: id2 };
26628 } else if (typeof location === "string" || typeof location === "number") {
26629 const feature3 = feature(location);
26631 const id2 = feature3.properties.wikidata;
26632 return { type: "countrycoder", location, id: id2 };
26636 throw new Error('validateLocation: Invalid location: "'.concat(location, '".'));
26642 // `location` The location to resolve
26644 // Pass a `location` value to resolve
26646 // Returns a result like:
26648 // type: 'point', 'geojson', or 'countrycoder'
26649 // location: the queried location
26650 // id: a stable identifier for the feature
26651 // feature: the resolved GeoJSON feature
26653 // or `null` if the location is invalid
26655 resolveLocation(location) {
26656 const valid = this.validateLocation(location);
26659 const id2 = valid.id;
26660 if (this._cache[id2]) {
26661 return Object.assign(valid, { feature: this._cache[id2] });
26663 if (valid.type === "point") {
26664 const lon = location[0];
26665 const lat = location[1];
26666 const radius = location[2] || 25;
26668 const PRECISION = 3;
26669 const area = Math.PI * radius * radius;
26670 const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
26673 properties: { id: id2, area: Number(area.toFixed(2)) },
26674 geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
26677 return Object.assign(valid, { feature: feature3 });
26678 } else if (valid.type === "geojson") {
26679 } else if (valid.type === "countrycoder") {
26680 let feature3 = _cloneDeep(feature(id2));
26681 let props = feature3.properties;
26682 if (Array.isArray(props.members)) {
26683 let aggregate = aggregateFeature(id2);
26684 aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
26685 feature3.geometry = aggregate.geometry;
26688 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
26689 props.area = Number(area.toFixed(2));
26693 this._cache[id2] = feature3;
26694 return Object.assign(valid, { feature: feature3 });
26697 throw new Error("resolveLocation: Couldn't resolve location \"".concat(location, '".'));
26702 // validateLocationSet
26703 // `locationSet` the locationSet to validate
26705 // Pass a locationSet Object to validate like:
26707 // include: [ Array of locations ],
26708 // exclude: [ Array of locations ]
26711 // Returns a result like:
26713 // type: 'locationset'
26714 // locationSet: the queried locationSet
26715 // id: the stable identifier for the feature
26717 // or `null` if the locationSet is invalid
26719 validateLocationSet(locationSet) {
26720 locationSet = locationSet || {};
26721 const validator = this.validateLocation.bind(this);
26722 let include = (locationSet.include || []).map(validator).filter(Boolean);
26723 let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
26724 if (!include.length) {
26726 throw new Error("validateLocationSet: LocationSet includes nothing.");
26728 locationSet.include = ["Q2"];
26729 include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
26732 include.sort(_sortLocations);
26733 let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
26734 if (exclude.length) {
26735 exclude.sort(_sortLocations);
26736 id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
26738 return { type: "locationset", locationSet, id: id2 };
26740 // resolveLocationSet
26741 // `locationSet` the locationSet to resolve
26743 // Pass a locationSet Object to validate like:
26745 // include: [ Array of locations ],
26746 // exclude: [ Array of locations ]
26749 // Returns a result like:
26751 // type: 'locationset'
26752 // locationSet: the queried locationSet
26753 // id: the stable identifier for the feature
26754 // feature: the resolved GeoJSON feature
26756 // or `null` if the locationSet is invalid
26758 resolveLocationSet(locationSet) {
26759 locationSet = locationSet || {};
26760 const valid = this.validateLocationSet(locationSet);
26763 const id2 = valid.id;
26764 if (this._cache[id2]) {
26765 return Object.assign(valid, { feature: this._cache[id2] });
26767 const resolver = this.resolveLocation.bind(this);
26768 const includes = (locationSet.include || []).map(resolver).filter(Boolean);
26769 const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
26770 if (includes.length === 1 && excludes.length === 0) {
26771 return Object.assign(valid, { feature: includes[0].feature });
26773 const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
26774 const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
26775 let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
26776 const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
26777 resultGeoJSON.id = id2;
26778 resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
26779 this._cache[id2] = resultGeoJSON;
26780 return Object.assign(valid, { feature: resultGeoJSON });
26783 // convenience method to prettyStringify the given object
26784 stringify(obj, options2) {
26785 return (0, import_json_stringify_pretty_compact.default)(obj, options2);
26788 function _clip(features, which) {
26789 if (!Array.isArray(features) || !features.length)
26791 const fn = { UNION: union, DIFFERENCE: difference }[which];
26792 const args = features.map((feature3) => feature3.geometry.coordinates);
26793 const coords = fn.apply(null, args);
26798 type: whichType(coords),
26799 coordinates: coords
26802 function whichType(coords2) {
26803 const a2 = Array.isArray(coords2);
26804 const b2 = a2 && Array.isArray(coords2[0]);
26805 const c2 = b2 && Array.isArray(coords2[0][0]);
26806 const d2 = c2 && Array.isArray(coords2[0][0][0]);
26807 return d2 ? "MultiPolygon" : "Polygon";
26810 function _cloneDeep(obj) {
26811 return JSON.parse(JSON.stringify(obj));
26813 function _sortLocations(a2, b2) {
26814 const rank = { countrycoder: 1, geojson: 2, point: 3 };
26815 const aRank = rank[a2.type];
26816 const bRank = rank[b2.type];
26817 return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
26820 // modules/core/LocationManager.js
26821 var import_which_polygon2 = __toESM(require_which_polygon());
26822 var import_geojson_area2 = __toESM(require_geojson_area());
26823 var _loco = new LocationConflation();
26824 var LocationManager = class {
26830 this._resolved = /* @__PURE__ */ new Map();
26831 this._knownLocationSets = /* @__PURE__ */ new Map();
26832 this._locationIncludedIn = /* @__PURE__ */ new Map();
26833 this._locationExcludedIn = /* @__PURE__ */ new Map();
26834 const world = { locationSet: { include: ["Q2"] } };
26835 this._resolveLocationSet(world);
26836 this._rebuildIndex();
26839 * _validateLocationSet
26840 * Pass an Object with a `locationSet` property.
26841 * Validates the `locationSet` and sets a `locationSetID` property on the object.
26842 * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
26844 * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
26845 * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
26847 * @param `obj` Object to check, it should have `locationSet` property
26849 _validateLocationSet(obj) {
26850 if (obj.locationSetID)
26853 let locationSet = obj.locationSet;
26854 if (!locationSet) {
26855 throw new Error("object missing locationSet property");
26857 if (!locationSet.include) {
26858 locationSet.include = ["Q2"];
26860 const locationSetID = _loco.validateLocationSet(locationSet).id;
26861 obj.locationSetID = locationSetID;
26862 if (this._knownLocationSets.has(locationSetID))
26865 (locationSet.include || []).forEach((location) => {
26866 const locationID = _loco.validateLocation(location).id;
26867 let geojson = this._resolved.get(locationID);
26869 geojson = _loco.resolveLocation(location).feature;
26870 this._resolved.set(locationID, geojson);
26872 area += geojson.properties.area;
26873 let s2 = this._locationIncludedIn.get(locationID);
26875 s2 = /* @__PURE__ */ new Set();
26876 this._locationIncludedIn.set(locationID, s2);
26878 s2.add(locationSetID);
26880 (locationSet.exclude || []).forEach((location) => {
26881 const locationID = _loco.validateLocation(location).id;
26882 let geojson = this._resolved.get(locationID);
26884 geojson = _loco.resolveLocation(location).feature;
26885 this._resolved.set(locationID, geojson);
26887 area -= geojson.properties.area;
26888 let s2 = this._locationExcludedIn.get(locationID);
26890 s2 = /* @__PURE__ */ new Set();
26891 this._locationExcludedIn.set(locationID, s2);
26893 s2.add(locationSetID);
26895 this._knownLocationSets.set(locationSetID, area);
26897 obj.locationSet = { include: ["Q2"] };
26898 obj.locationSetID = "+[Q2]";
26902 * _resolveLocationSet
26903 * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
26904 * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
26906 * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
26908 * @param `obj` Object to check, it should have `locationSet` property
26910 _resolveLocationSet(obj) {
26911 this._validateLocationSet(obj);
26912 if (this._resolved.has(obj.locationSetID))
26915 const result = _loco.resolveLocationSet(obj.locationSet);
26916 const locationSetID = result.id;
26917 obj.locationSetID = locationSetID;
26918 if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
26919 throw new Error("locationSet ".concat(locationSetID, " resolves to an empty feature."));
26921 let geojson = JSON.parse(JSON.stringify(result.feature));
26922 geojson.id = locationSetID;
26923 geojson.properties.id = locationSetID;
26924 this._resolved.set(locationSetID, geojson);
26926 obj.locationSet = { include: ["Q2"] };
26927 obj.locationSetID = "+[Q2]";
26932 * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
26935 this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
26938 * mergeCustomGeoJSON
26939 * Accepts a FeatureCollection-like object containing custom locations
26940 * Each feature must have a filename-like `id`, for example: `something.geojson`
26942 * "type": "FeatureCollection"
26945 * "type": "Feature",
26946 * "id": "philly_metro.geojson",
26947 * "properties": { … },
26948 * "geometry": { … }
26953 * @param `fc` FeatureCollection-like Object containing custom locations
26955 mergeCustomGeoJSON(fc) {
26956 if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features))
26958 fc.features.forEach((feature3) => {
26959 feature3.properties = feature3.properties || {};
26960 let props = feature3.properties;
26961 let id2 = feature3.id || props.id;
26962 if (!id2 || !/^\S+\.geojson$/i.test(id2))
26964 id2 = id2.toLowerCase();
26968 const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
26969 props.area = Number(area.toFixed(2));
26971 _loco._cache[id2] = feature3;
26975 * mergeLocationSets
26976 * Accepts an Array of Objects containing `locationSet` properties:
26978 * { id: 'preset1', locationSet: {…} },
26979 * { id: 'preset2', locationSet: {…} },
26982 * After validating, the Objects will be decorated with a `locationSetID` property:
26984 * { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
26985 * { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
26989 * @param `objects` Objects to check - they should have `locationSet` property
26990 * @return Promise resolved true (this function used to be slow/async, now it's faster and sync)
26992 mergeLocationSets(objects) {
26993 if (!Array.isArray(objects))
26994 return Promise.reject("nothing to do");
26995 objects.forEach((obj) => this._validateLocationSet(obj));
26996 this._rebuildIndex();
26997 return Promise.resolve(objects);
27001 * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
27002 * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
27004 * @param `locationSet` A locationSet Object, e.g. `{ include: ['us'] }`
27005 * @return String locationSetID, e.g. `+[Q30]`
27007 locationSetID(locationSet) {
27010 locationSetID = _loco.validateLocationSet(locationSet).id;
27012 locationSetID = "+[Q2]";
27014 return locationSetID;
27018 * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
27019 * A GeoJSON feature:
27023 * properties: { id: '+[Q30]', area: 21817019.17, … },
27027 * @param `locationSetID` String identifier, e.g. `+[Q30]`
27028 * @return GeoJSON object (fallback to world)
27030 feature(locationSetID = "+[Q2]") {
27031 const feature3 = this._resolved.get(locationSetID);
27032 return feature3 || this._resolved.get("+[Q2]");
27036 * Find all the locationSets valid at the given location.
27037 * Results include the area (in km²) to facilitate sorting.
27039 * Object of locationSetIDs to areas (in km²)
27041 * "+[Q2]": 511207893.3958111,
27042 * "+[Q30]": 21817019.17,
27043 * "+[new_jersey.geojson]": 22390.77,
27047 * @param `loc` `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
27048 * @return Object of locationSetIDs valid at given location
27050 locationSetsAt(loc) {
27052 const hits = this._wp(loc, true) || [];
27054 hits.forEach((prop) => {
27055 if (prop.id[0] !== "+")
27057 const locationSetID = prop.id;
27058 const area = thiz._knownLocationSets.get(locationSetID);
27060 result[locationSetID] = area;
27063 hits.forEach((prop) => {
27064 if (prop.id[0] === "+")
27066 const locationID = prop.id;
27067 const included = thiz._locationIncludedIn.get(locationID);
27068 (included || []).forEach((locationSetID) => {
27069 const area = thiz._knownLocationSets.get(locationSetID);
27071 result[locationSetID] = area;
27075 hits.forEach((prop) => {
27076 if (prop.id[0] === "+")
27078 const locationID = prop.id;
27079 const excluded = thiz._locationExcludedIn.get(locationID);
27080 (excluded || []).forEach((locationSetID) => {
27081 delete result[locationSetID];
27086 // Direct access to the location-conflation resolver
27091 var _sharedLocationManager = new LocationManager();
27093 // node_modules/lodash-es/_freeGlobal.js
27094 var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
27095 var freeGlobal_default = freeGlobal;
27097 // node_modules/lodash-es/_root.js
27098 var freeSelf = typeof self == "object" && self && self.Object === Object && self;
27099 var root2 = freeGlobal_default || freeSelf || Function("return this")();
27100 var root_default = root2;
27102 // node_modules/lodash-es/_Symbol.js
27103 var Symbol2 = root_default.Symbol;
27104 var Symbol_default = Symbol2;
27106 // node_modules/lodash-es/_getRawTag.js
27107 var objectProto = Object.prototype;
27108 var hasOwnProperty = objectProto.hasOwnProperty;
27109 var nativeObjectToString = objectProto.toString;
27110 var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
27111 function getRawTag(value) {
27112 var isOwn = hasOwnProperty.call(value, symToStringTag), tag2 = value[symToStringTag];
27114 value[symToStringTag] = void 0;
27115 var unmasked = true;
27118 var result = nativeObjectToString.call(value);
27121 value[symToStringTag] = tag2;
27123 delete value[symToStringTag];
27128 var getRawTag_default = getRawTag;
27130 // node_modules/lodash-es/_objectToString.js
27131 var objectProto2 = Object.prototype;
27132 var nativeObjectToString2 = objectProto2.toString;
27133 function objectToString(value) {
27134 return nativeObjectToString2.call(value);
27136 var objectToString_default = objectToString;
27138 // node_modules/lodash-es/_baseGetTag.js
27139 var nullTag = "[object Null]";
27140 var undefinedTag = "[object Undefined]";
27141 var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
27142 function baseGetTag(value) {
27143 if (value == null) {
27144 return value === void 0 ? undefinedTag : nullTag;
27146 return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
27148 var baseGetTag_default = baseGetTag;
27150 // node_modules/lodash-es/isObjectLike.js
27151 function isObjectLike(value) {
27152 return value != null && typeof value == "object";
27154 var isObjectLike_default = isObjectLike;
27156 // node_modules/lodash-es/isSymbol.js
27157 var symbolTag = "[object Symbol]";
27158 function isSymbol(value) {
27159 return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
27161 var isSymbol_default = isSymbol;
27163 // node_modules/lodash-es/_arrayMap.js
27164 function arrayMap(array2, iteratee) {
27165 var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
27166 while (++index < length2) {
27167 result[index] = iteratee(array2[index], index, array2);
27171 var arrayMap_default = arrayMap;
27173 // node_modules/lodash-es/isArray.js
27174 var isArray = Array.isArray;
27175 var isArray_default = isArray;
27177 // node_modules/lodash-es/_baseToString.js
27178 var INFINITY = 1 / 0;
27179 var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
27180 var symbolToString = symbolProto ? symbolProto.toString : void 0;
27181 function baseToString(value) {
27182 if (typeof value == "string") {
27185 if (isArray_default(value)) {
27186 return arrayMap_default(value, baseToString) + "";
27188 if (isSymbol_default(value)) {
27189 return symbolToString ? symbolToString.call(value) : "";
27191 var result = value + "";
27192 return result == "0" && 1 / value == -INFINITY ? "-0" : result;
27194 var baseToString_default = baseToString;
27196 // node_modules/lodash-es/_trimmedEndIndex.js
27197 var reWhitespace = /\s/;
27198 function trimmedEndIndex(string) {
27199 var index = string.length;
27200 while (index-- && reWhitespace.test(string.charAt(index))) {
27204 var trimmedEndIndex_default = trimmedEndIndex;
27206 // node_modules/lodash-es/_baseTrim.js
27207 var reTrimStart = /^\s+/;
27208 function baseTrim(string) {
27209 return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
27211 var baseTrim_default = baseTrim;
27213 // node_modules/lodash-es/isObject.js
27214 function isObject(value) {
27215 var type2 = typeof value;
27216 return value != null && (type2 == "object" || type2 == "function");
27218 var isObject_default = isObject;
27220 // node_modules/lodash-es/toNumber.js
27222 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
27223 var reIsBinary = /^0b[01]+$/i;
27224 var reIsOctal = /^0o[0-7]+$/i;
27225 var freeParseInt = parseInt;
27226 function toNumber(value) {
27227 if (typeof value == "number") {
27230 if (isSymbol_default(value)) {
27233 if (isObject_default(value)) {
27234 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
27235 value = isObject_default(other) ? other + "" : other;
27237 if (typeof value != "string") {
27238 return value === 0 ? value : +value;
27240 value = baseTrim_default(value);
27241 var isBinary = reIsBinary.test(value);
27242 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
27244 var toNumber_default = toNumber;
27246 // node_modules/lodash-es/isFunction.js
27247 var asyncTag = "[object AsyncFunction]";
27248 var funcTag = "[object Function]";
27249 var genTag = "[object GeneratorFunction]";
27250 var proxyTag = "[object Proxy]";
27251 function isFunction(value) {
27252 if (!isObject_default(value)) {
27255 var tag2 = baseGetTag_default(value);
27256 return tag2 == funcTag || tag2 == genTag || tag2 == asyncTag || tag2 == proxyTag;
27258 var isFunction_default = isFunction;
27260 // node_modules/lodash-es/_coreJsData.js
27261 var coreJsData = root_default["__core-js_shared__"];
27262 var coreJsData_default = coreJsData;
27264 // node_modules/lodash-es/_isMasked.js
27265 var maskSrcKey = function() {
27266 var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
27267 return uid ? "Symbol(src)_1." + uid : "";
27269 function isMasked(func) {
27270 return !!maskSrcKey && maskSrcKey in func;
27272 var isMasked_default = isMasked;
27274 // node_modules/lodash-es/_toSource.js
27275 var funcProto = Function.prototype;
27276 var funcToString = funcProto.toString;
27277 function toSource(func) {
27278 if (func != null) {
27280 return funcToString.call(func);
27290 var toSource_default = toSource;
27292 // node_modules/lodash-es/_baseIsNative.js
27293 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
27294 var reIsHostCtor = /^\[object .+?Constructor\]$/;
27295 var funcProto2 = Function.prototype;
27296 var objectProto3 = Object.prototype;
27297 var funcToString2 = funcProto2.toString;
27298 var hasOwnProperty2 = objectProto3.hasOwnProperty;
27299 var reIsNative = RegExp(
27300 "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
27302 function baseIsNative(value) {
27303 if (!isObject_default(value) || isMasked_default(value)) {
27306 var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
27307 return pattern.test(toSource_default(value));
27309 var baseIsNative_default = baseIsNative;
27311 // node_modules/lodash-es/_getValue.js
27312 function getValue(object, key) {
27313 return object == null ? void 0 : object[key];
27315 var getValue_default = getValue;
27317 // node_modules/lodash-es/_getNative.js
27318 function getNative(object, key) {
27319 var value = getValue_default(object, key);
27320 return baseIsNative_default(value) ? value : void 0;
27322 var getNative_default = getNative;
27324 // node_modules/lodash-es/_WeakMap.js
27325 var WeakMap = getNative_default(root_default, "WeakMap");
27326 var WeakMap_default = WeakMap;
27328 // node_modules/lodash-es/_isIndex.js
27329 var MAX_SAFE_INTEGER2 = 9007199254740991;
27330 var reIsUint = /^(?:0|[1-9]\d*)$/;
27331 function isIndex(value, length2) {
27332 var type2 = typeof value;
27333 length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
27334 return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
27336 var isIndex_default = isIndex;
27338 // node_modules/lodash-es/eq.js
27339 function eq(value, other) {
27340 return value === other || value !== value && other !== other;
27342 var eq_default = eq;
27344 // node_modules/lodash-es/isLength.js
27345 var MAX_SAFE_INTEGER3 = 9007199254740991;
27346 function isLength(value) {
27347 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
27349 var isLength_default = isLength;
27351 // node_modules/lodash-es/isArrayLike.js
27352 function isArrayLike(value) {
27353 return value != null && isLength_default(value.length) && !isFunction_default(value);
27355 var isArrayLike_default = isArrayLike;
27357 // node_modules/lodash-es/_isPrototype.js
27358 var objectProto4 = Object.prototype;
27359 function isPrototype(value) {
27360 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
27361 return value === proto;
27363 var isPrototype_default = isPrototype;
27365 // node_modules/lodash-es/_baseTimes.js
27366 function baseTimes(n3, iteratee) {
27367 var index = -1, result = Array(n3);
27368 while (++index < n3) {
27369 result[index] = iteratee(index);
27373 var baseTimes_default = baseTimes;
27375 // node_modules/lodash-es/_baseIsArguments.js
27376 var argsTag = "[object Arguments]";
27377 function baseIsArguments(value) {
27378 return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
27380 var baseIsArguments_default = baseIsArguments;
27382 // node_modules/lodash-es/isArguments.js
27383 var objectProto5 = Object.prototype;
27384 var hasOwnProperty3 = objectProto5.hasOwnProperty;
27385 var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
27386 var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
27388 }()) ? baseIsArguments_default : function(value) {
27389 return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
27391 var isArguments_default = isArguments;
27393 // node_modules/lodash-es/stubFalse.js
27394 function stubFalse() {
27397 var stubFalse_default = stubFalse;
27399 // node_modules/lodash-es/isBuffer.js
27400 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
27401 var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
27402 var moduleExports = freeModule && freeModule.exports === freeExports;
27403 var Buffer2 = moduleExports ? root_default.Buffer : void 0;
27404 var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
27405 var isBuffer = nativeIsBuffer || stubFalse_default;
27406 var isBuffer_default = isBuffer;
27408 // node_modules/lodash-es/_baseIsTypedArray.js
27409 var argsTag2 = "[object Arguments]";
27410 var arrayTag = "[object Array]";
27411 var boolTag = "[object Boolean]";
27412 var dateTag = "[object Date]";
27413 var errorTag = "[object Error]";
27414 var funcTag2 = "[object Function]";
27415 var mapTag = "[object Map]";
27416 var numberTag = "[object Number]";
27417 var objectTag = "[object Object]";
27418 var regexpTag = "[object RegExp]";
27419 var setTag = "[object Set]";
27420 var stringTag = "[object String]";
27421 var weakMapTag = "[object WeakMap]";
27422 var arrayBufferTag = "[object ArrayBuffer]";
27423 var dataViewTag = "[object DataView]";
27424 var float32Tag = "[object Float32Array]";
27425 var float64Tag = "[object Float64Array]";
27426 var int8Tag = "[object Int8Array]";
27427 var int16Tag = "[object Int16Array]";
27428 var int32Tag = "[object Int32Array]";
27429 var uint8Tag = "[object Uint8Array]";
27430 var uint8ClampedTag = "[object Uint8ClampedArray]";
27431 var uint16Tag = "[object Uint16Array]";
27432 var uint32Tag = "[object Uint32Array]";
27433 var typedArrayTags = {};
27434 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
27435 typedArrayTags[argsTag2] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag2] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
27436 function baseIsTypedArray(value) {
27437 return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
27439 var baseIsTypedArray_default = baseIsTypedArray;
27441 // node_modules/lodash-es/_baseUnary.js
27442 function baseUnary(func) {
27443 return function(value) {
27444 return func(value);
27447 var baseUnary_default = baseUnary;
27449 // node_modules/lodash-es/_nodeUtil.js
27450 var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
27451 var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
27452 var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
27453 var freeProcess = moduleExports2 && freeGlobal_default.process;
27454 var nodeUtil = function() {
27456 var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
27460 return freeProcess && freeProcess.binding && freeProcess.binding("util");
27464 var nodeUtil_default = nodeUtil;
27466 // node_modules/lodash-es/isTypedArray.js
27467 var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
27468 var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
27469 var isTypedArray_default = isTypedArray;
27471 // node_modules/lodash-es/_arrayLikeKeys.js
27472 var objectProto6 = Object.prototype;
27473 var hasOwnProperty4 = objectProto6.hasOwnProperty;
27474 function arrayLikeKeys(value, inherited) {
27475 var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length2 = result.length;
27476 for (var key in value) {
27477 if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
27478 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
27479 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
27480 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
27481 isIndex_default(key, length2)))) {
27487 var arrayLikeKeys_default = arrayLikeKeys;
27489 // node_modules/lodash-es/_overArg.js
27490 function overArg(func, transform2) {
27491 return function(arg) {
27492 return func(transform2(arg));
27495 var overArg_default = overArg;
27497 // node_modules/lodash-es/_nativeKeys.js
27498 var nativeKeys = overArg_default(Object.keys, Object);
27499 var nativeKeys_default = nativeKeys;
27501 // node_modules/lodash-es/_baseKeys.js
27502 var objectProto7 = Object.prototype;
27503 var hasOwnProperty5 = objectProto7.hasOwnProperty;
27504 function baseKeys(object) {
27505 if (!isPrototype_default(object)) {
27506 return nativeKeys_default(object);
27509 for (var key in Object(object)) {
27510 if (hasOwnProperty5.call(object, key) && key != "constructor") {
27516 var baseKeys_default = baseKeys;
27518 // node_modules/lodash-es/keys.js
27519 function keys(object) {
27520 return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
27522 var keys_default = keys;
27524 // node_modules/lodash-es/_nativeCreate.js
27525 var nativeCreate = getNative_default(Object, "create");
27526 var nativeCreate_default = nativeCreate;
27528 // node_modules/lodash-es/_hashClear.js
27529 function hashClear() {
27530 this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
27533 var hashClear_default = hashClear;
27535 // node_modules/lodash-es/_hashDelete.js
27536 function hashDelete(key) {
27537 var result = this.has(key) && delete this.__data__[key];
27538 this.size -= result ? 1 : 0;
27541 var hashDelete_default = hashDelete;
27543 // node_modules/lodash-es/_hashGet.js
27544 var HASH_UNDEFINED = "__lodash_hash_undefined__";
27545 var objectProto8 = Object.prototype;
27546 var hasOwnProperty6 = objectProto8.hasOwnProperty;
27547 function hashGet(key) {
27548 var data = this.__data__;
27549 if (nativeCreate_default) {
27550 var result = data[key];
27551 return result === HASH_UNDEFINED ? void 0 : result;
27553 return hasOwnProperty6.call(data, key) ? data[key] : void 0;
27555 var hashGet_default = hashGet;
27557 // node_modules/lodash-es/_hashHas.js
27558 var objectProto9 = Object.prototype;
27559 var hasOwnProperty7 = objectProto9.hasOwnProperty;
27560 function hashHas(key) {
27561 var data = this.__data__;
27562 return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
27564 var hashHas_default = hashHas;
27566 // node_modules/lodash-es/_hashSet.js
27567 var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
27568 function hashSet(key, value) {
27569 var data = this.__data__;
27570 this.size += this.has(key) ? 0 : 1;
27571 data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
27574 var hashSet_default = hashSet;
27576 // node_modules/lodash-es/_Hash.js
27577 function Hash(entries) {
27578 var index = -1, length2 = entries == null ? 0 : entries.length;
27580 while (++index < length2) {
27581 var entry = entries[index];
27582 this.set(entry[0], entry[1]);
27585 Hash.prototype.clear = hashClear_default;
27586 Hash.prototype["delete"] = hashDelete_default;
27587 Hash.prototype.get = hashGet_default;
27588 Hash.prototype.has = hashHas_default;
27589 Hash.prototype.set = hashSet_default;
27590 var Hash_default = Hash;
27592 // node_modules/lodash-es/_listCacheClear.js
27593 function listCacheClear() {
27594 this.__data__ = [];
27597 var listCacheClear_default = listCacheClear;
27599 // node_modules/lodash-es/_assocIndexOf.js
27600 function assocIndexOf(array2, key) {
27601 var length2 = array2.length;
27602 while (length2--) {
27603 if (eq_default(array2[length2][0], key)) {
27609 var assocIndexOf_default = assocIndexOf;
27611 // node_modules/lodash-es/_listCacheDelete.js
27612 var arrayProto = Array.prototype;
27613 var splice = arrayProto.splice;
27614 function listCacheDelete(key) {
27615 var data = this.__data__, index = assocIndexOf_default(data, key);
27619 var lastIndex = data.length - 1;
27620 if (index == lastIndex) {
27623 splice.call(data, index, 1);
27628 var listCacheDelete_default = listCacheDelete;
27630 // node_modules/lodash-es/_listCacheGet.js
27631 function listCacheGet(key) {
27632 var data = this.__data__, index = assocIndexOf_default(data, key);
27633 return index < 0 ? void 0 : data[index][1];
27635 var listCacheGet_default = listCacheGet;
27637 // node_modules/lodash-es/_listCacheHas.js
27638 function listCacheHas(key) {
27639 return assocIndexOf_default(this.__data__, key) > -1;
27641 var listCacheHas_default = listCacheHas;
27643 // node_modules/lodash-es/_listCacheSet.js
27644 function listCacheSet(key, value) {
27645 var data = this.__data__, index = assocIndexOf_default(data, key);
27648 data.push([key, value]);
27650 data[index][1] = value;
27654 var listCacheSet_default = listCacheSet;
27656 // node_modules/lodash-es/_ListCache.js
27657 function ListCache(entries) {
27658 var index = -1, length2 = entries == null ? 0 : entries.length;
27660 while (++index < length2) {
27661 var entry = entries[index];
27662 this.set(entry[0], entry[1]);
27665 ListCache.prototype.clear = listCacheClear_default;
27666 ListCache.prototype["delete"] = listCacheDelete_default;
27667 ListCache.prototype.get = listCacheGet_default;
27668 ListCache.prototype.has = listCacheHas_default;
27669 ListCache.prototype.set = listCacheSet_default;
27670 var ListCache_default = ListCache;
27672 // node_modules/lodash-es/_Map.js
27673 var Map2 = getNative_default(root_default, "Map");
27674 var Map_default = Map2;
27676 // node_modules/lodash-es/_mapCacheClear.js
27677 function mapCacheClear() {
27680 "hash": new Hash_default(),
27681 "map": new (Map_default || ListCache_default)(),
27682 "string": new Hash_default()
27685 var mapCacheClear_default = mapCacheClear;
27687 // node_modules/lodash-es/_isKeyable.js
27688 function isKeyable(value) {
27689 var type2 = typeof value;
27690 return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
27692 var isKeyable_default = isKeyable;
27694 // node_modules/lodash-es/_getMapData.js
27695 function getMapData(map2, key) {
27696 var data = map2.__data__;
27697 return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
27699 var getMapData_default = getMapData;
27701 // node_modules/lodash-es/_mapCacheDelete.js
27702 function mapCacheDelete(key) {
27703 var result = getMapData_default(this, key)["delete"](key);
27704 this.size -= result ? 1 : 0;
27707 var mapCacheDelete_default = mapCacheDelete;
27709 // node_modules/lodash-es/_mapCacheGet.js
27710 function mapCacheGet(key) {
27711 return getMapData_default(this, key).get(key);
27713 var mapCacheGet_default = mapCacheGet;
27715 // node_modules/lodash-es/_mapCacheHas.js
27716 function mapCacheHas(key) {
27717 return getMapData_default(this, key).has(key);
27719 var mapCacheHas_default = mapCacheHas;
27721 // node_modules/lodash-es/_mapCacheSet.js
27722 function mapCacheSet(key, value) {
27723 var data = getMapData_default(this, key), size = data.size;
27724 data.set(key, value);
27725 this.size += data.size == size ? 0 : 1;
27728 var mapCacheSet_default = mapCacheSet;
27730 // node_modules/lodash-es/_MapCache.js
27731 function MapCache(entries) {
27732 var index = -1, length2 = entries == null ? 0 : entries.length;
27734 while (++index < length2) {
27735 var entry = entries[index];
27736 this.set(entry[0], entry[1]);
27739 MapCache.prototype.clear = mapCacheClear_default;
27740 MapCache.prototype["delete"] = mapCacheDelete_default;
27741 MapCache.prototype.get = mapCacheGet_default;
27742 MapCache.prototype.has = mapCacheHas_default;
27743 MapCache.prototype.set = mapCacheSet_default;
27744 var MapCache_default = MapCache;
27746 // node_modules/lodash-es/toString.js
27747 function toString(value) {
27748 return value == null ? "" : baseToString_default(value);
27750 var toString_default = toString;
27752 // node_modules/lodash-es/_arrayPush.js
27753 function arrayPush(array2, values) {
27754 var index = -1, length2 = values.length, offset = array2.length;
27755 while (++index < length2) {
27756 array2[offset + index] = values[index];
27760 var arrayPush_default = arrayPush;
27762 // node_modules/lodash-es/_basePropertyOf.js
27763 function basePropertyOf(object) {
27764 return function(key) {
27765 return object == null ? void 0 : object[key];
27768 var basePropertyOf_default = basePropertyOf;
27770 // node_modules/lodash-es/_stackClear.js
27771 function stackClear() {
27772 this.__data__ = new ListCache_default();
27775 var stackClear_default = stackClear;
27777 // node_modules/lodash-es/_stackDelete.js
27778 function stackDelete(key) {
27779 var data = this.__data__, result = data["delete"](key);
27780 this.size = data.size;
27783 var stackDelete_default = stackDelete;
27785 // node_modules/lodash-es/_stackGet.js
27786 function stackGet(key) {
27787 return this.__data__.get(key);
27789 var stackGet_default = stackGet;
27791 // node_modules/lodash-es/_stackHas.js
27792 function stackHas(key) {
27793 return this.__data__.has(key);
27795 var stackHas_default = stackHas;
27797 // node_modules/lodash-es/_stackSet.js
27798 var LARGE_ARRAY_SIZE = 200;
27799 function stackSet(key, value) {
27800 var data = this.__data__;
27801 if (data instanceof ListCache_default) {
27802 var pairs2 = data.__data__;
27803 if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
27804 pairs2.push([key, value]);
27805 this.size = ++data.size;
27808 data = this.__data__ = new MapCache_default(pairs2);
27810 data.set(key, value);
27811 this.size = data.size;
27814 var stackSet_default = stackSet;
27816 // node_modules/lodash-es/_Stack.js
27817 function Stack(entries) {
27818 var data = this.__data__ = new ListCache_default(entries);
27819 this.size = data.size;
27821 Stack.prototype.clear = stackClear_default;
27822 Stack.prototype["delete"] = stackDelete_default;
27823 Stack.prototype.get = stackGet_default;
27824 Stack.prototype.has = stackHas_default;
27825 Stack.prototype.set = stackSet_default;
27826 var Stack_default = Stack;
27828 // node_modules/lodash-es/_arrayFilter.js
27829 function arrayFilter(array2, predicate) {
27830 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
27831 while (++index < length2) {
27832 var value = array2[index];
27833 if (predicate(value, index, array2)) {
27834 result[resIndex++] = value;
27839 var arrayFilter_default = arrayFilter;
27841 // node_modules/lodash-es/stubArray.js
27842 function stubArray() {
27845 var stubArray_default = stubArray;
27847 // node_modules/lodash-es/_getSymbols.js
27848 var objectProto10 = Object.prototype;
27849 var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
27850 var nativeGetSymbols = Object.getOwnPropertySymbols;
27851 var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
27852 if (object == null) {
27855 object = Object(object);
27856 return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
27857 return propertyIsEnumerable2.call(object, symbol);
27860 var getSymbols_default = getSymbols;
27862 // node_modules/lodash-es/_baseGetAllKeys.js
27863 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
27864 var result = keysFunc(object);
27865 return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
27867 var baseGetAllKeys_default = baseGetAllKeys;
27869 // node_modules/lodash-es/_getAllKeys.js
27870 function getAllKeys(object) {
27871 return baseGetAllKeys_default(object, keys_default, getSymbols_default);
27873 var getAllKeys_default = getAllKeys;
27875 // node_modules/lodash-es/_DataView.js
27876 var DataView2 = getNative_default(root_default, "DataView");
27877 var DataView_default = DataView2;
27879 // node_modules/lodash-es/_Promise.js
27880 var Promise2 = getNative_default(root_default, "Promise");
27881 var Promise_default = Promise2;
27883 // node_modules/lodash-es/_Set.js
27884 var Set2 = getNative_default(root_default, "Set");
27885 var Set_default = Set2;
27887 // node_modules/lodash-es/_getTag.js
27888 var mapTag2 = "[object Map]";
27889 var objectTag2 = "[object Object]";
27890 var promiseTag = "[object Promise]";
27891 var setTag2 = "[object Set]";
27892 var weakMapTag2 = "[object WeakMap]";
27893 var dataViewTag2 = "[object DataView]";
27894 var dataViewCtorString = toSource_default(DataView_default);
27895 var mapCtorString = toSource_default(Map_default);
27896 var promiseCtorString = toSource_default(Promise_default);
27897 var setCtorString = toSource_default(Set_default);
27898 var weakMapCtorString = toSource_default(WeakMap_default);
27899 var getTag = baseGetTag_default;
27900 if (DataView_default && getTag(new DataView_default(new ArrayBuffer(1))) != dataViewTag2 || Map_default && getTag(new Map_default()) != mapTag2 || Promise_default && getTag(Promise_default.resolve()) != promiseTag || Set_default && getTag(new Set_default()) != setTag2 || WeakMap_default && getTag(new WeakMap_default()) != weakMapTag2) {
27901 getTag = function(value) {
27902 var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
27904 switch (ctorString) {
27905 case dataViewCtorString:
27906 return dataViewTag2;
27907 case mapCtorString:
27909 case promiseCtorString:
27911 case setCtorString:
27913 case weakMapCtorString:
27914 return weakMapTag2;
27920 var getTag_default = getTag;
27922 // node_modules/lodash-es/_Uint8Array.js
27923 var Uint8Array2 = root_default.Uint8Array;
27924 var Uint8Array_default = Uint8Array2;
27926 // node_modules/lodash-es/_setCacheAdd.js
27927 var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
27928 function setCacheAdd(value) {
27929 this.__data__.set(value, HASH_UNDEFINED3);
27932 var setCacheAdd_default = setCacheAdd;
27934 // node_modules/lodash-es/_setCacheHas.js
27935 function setCacheHas(value) {
27936 return this.__data__.has(value);
27938 var setCacheHas_default = setCacheHas;
27940 // node_modules/lodash-es/_SetCache.js
27941 function SetCache(values) {
27942 var index = -1, length2 = values == null ? 0 : values.length;
27943 this.__data__ = new MapCache_default();
27944 while (++index < length2) {
27945 this.add(values[index]);
27948 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
27949 SetCache.prototype.has = setCacheHas_default;
27950 var SetCache_default = SetCache;
27952 // node_modules/lodash-es/_arraySome.js
27953 function arraySome(array2, predicate) {
27954 var index = -1, length2 = array2 == null ? 0 : array2.length;
27955 while (++index < length2) {
27956 if (predicate(array2[index], index, array2)) {
27962 var arraySome_default = arraySome;
27964 // node_modules/lodash-es/_cacheHas.js
27965 function cacheHas(cache, key) {
27966 return cache.has(key);
27968 var cacheHas_default = cacheHas;
27970 // node_modules/lodash-es/_equalArrays.js
27971 var COMPARE_PARTIAL_FLAG = 1;
27972 var COMPARE_UNORDERED_FLAG = 2;
27973 function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
27974 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
27975 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
27978 var arrStacked = stack.get(array2);
27979 var othStacked = stack.get(other);
27980 if (arrStacked && othStacked) {
27981 return arrStacked == other && othStacked == array2;
27983 var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
27984 stack.set(array2, other);
27985 stack.set(other, array2);
27986 while (++index < arrLength) {
27987 var arrValue = array2[index], othValue = other[index];
27989 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
27991 if (compared !== void 0) {
27999 if (!arraySome_default(other, function(othValue2, othIndex) {
28000 if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
28001 return seen.push(othIndex);
28007 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
28012 stack["delete"](array2);
28013 stack["delete"](other);
28016 var equalArrays_default = equalArrays;
28018 // node_modules/lodash-es/_mapToArray.js
28019 function mapToArray(map2) {
28020 var index = -1, result = Array(map2.size);
28021 map2.forEach(function(value, key) {
28022 result[++index] = [key, value];
28026 var mapToArray_default = mapToArray;
28028 // node_modules/lodash-es/_setToArray.js
28029 function setToArray(set4) {
28030 var index = -1, result = Array(set4.size);
28031 set4.forEach(function(value) {
28032 result[++index] = value;
28036 var setToArray_default = setToArray;
28038 // node_modules/lodash-es/_equalByTag.js
28039 var COMPARE_PARTIAL_FLAG2 = 1;
28040 var COMPARE_UNORDERED_FLAG2 = 2;
28041 var boolTag2 = "[object Boolean]";
28042 var dateTag2 = "[object Date]";
28043 var errorTag2 = "[object Error]";
28044 var mapTag3 = "[object Map]";
28045 var numberTag2 = "[object Number]";
28046 var regexpTag2 = "[object RegExp]";
28047 var setTag3 = "[object Set]";
28048 var stringTag2 = "[object String]";
28049 var symbolTag2 = "[object Symbol]";
28050 var arrayBufferTag2 = "[object ArrayBuffer]";
28051 var dataViewTag3 = "[object DataView]";
28052 var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
28053 var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
28054 function equalByTag(object, other, tag2, bitmask, customizer, equalFunc, stack) {
28057 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
28060 object = object.buffer;
28061 other = other.buffer;
28062 case arrayBufferTag2:
28063 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
28070 return eq_default(+object, +other);
28072 return object.name == other.name && object.message == other.message;
28075 return object == other + "";
28077 var convert = mapToArray_default;
28079 var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
28080 convert || (convert = setToArray_default);
28081 if (object.size != other.size && !isPartial) {
28084 var stacked = stack.get(object);
28086 return stacked == other;
28088 bitmask |= COMPARE_UNORDERED_FLAG2;
28089 stack.set(object, other);
28090 var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
28091 stack["delete"](object);
28094 if (symbolValueOf) {
28095 return symbolValueOf.call(object) == symbolValueOf.call(other);
28100 var equalByTag_default = equalByTag;
28102 // node_modules/lodash-es/_equalObjects.js
28103 var COMPARE_PARTIAL_FLAG3 = 1;
28104 var objectProto11 = Object.prototype;
28105 var hasOwnProperty8 = objectProto11.hasOwnProperty;
28106 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
28107 var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
28108 if (objLength != othLength && !isPartial) {
28111 var index = objLength;
28113 var key = objProps[index];
28114 if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
28118 var objStacked = stack.get(object);
28119 var othStacked = stack.get(other);
28120 if (objStacked && othStacked) {
28121 return objStacked == other && othStacked == object;
28124 stack.set(object, other);
28125 stack.set(other, object);
28126 var skipCtor = isPartial;
28127 while (++index < objLength) {
28128 key = objProps[index];
28129 var objValue = object[key], othValue = other[key];
28131 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
28133 if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
28137 skipCtor || (skipCtor = key == "constructor");
28139 if (result && !skipCtor) {
28140 var objCtor = object.constructor, othCtor = other.constructor;
28141 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
28145 stack["delete"](object);
28146 stack["delete"](other);
28149 var equalObjects_default = equalObjects;
28151 // node_modules/lodash-es/_baseIsEqualDeep.js
28152 var COMPARE_PARTIAL_FLAG4 = 1;
28153 var argsTag3 = "[object Arguments]";
28154 var arrayTag2 = "[object Array]";
28155 var objectTag3 = "[object Object]";
28156 var objectProto12 = Object.prototype;
28157 var hasOwnProperty9 = objectProto12.hasOwnProperty;
28158 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
28159 var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
28160 objTag = objTag == argsTag3 ? objectTag3 : objTag;
28161 othTag = othTag == argsTag3 ? objectTag3 : othTag;
28162 var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
28163 if (isSameTag && isBuffer_default(object)) {
28164 if (!isBuffer_default(other)) {
28170 if (isSameTag && !objIsObj) {
28171 stack || (stack = new Stack_default());
28172 return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
28174 if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
28175 var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
28176 if (objIsWrapped || othIsWrapped) {
28177 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
28178 stack || (stack = new Stack_default());
28179 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
28185 stack || (stack = new Stack_default());
28186 return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
28188 var baseIsEqualDeep_default = baseIsEqualDeep;
28190 // node_modules/lodash-es/_baseIsEqual.js
28191 function baseIsEqual(value, other, bitmask, customizer, stack) {
28192 if (value === other) {
28195 if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
28196 return value !== value && other !== other;
28198 return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
28200 var baseIsEqual_default = baseIsEqual;
28202 // node_modules/lodash-es/now.js
28203 var now2 = function() {
28204 return root_default.Date.now();
28206 var now_default = now2;
28208 // node_modules/lodash-es/debounce.js
28209 var FUNC_ERROR_TEXT = "Expected a function";
28210 var nativeMax = Math.max;
28211 var nativeMin = Math.min;
28212 function debounce(func, wait, options2) {
28213 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
28214 if (typeof func != "function") {
28215 throw new TypeError(FUNC_ERROR_TEXT);
28217 wait = toNumber_default(wait) || 0;
28218 if (isObject_default(options2)) {
28219 leading = !!options2.leading;
28220 maxing = "maxWait" in options2;
28221 maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
28222 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
28224 function invokeFunc(time) {
28225 var args = lastArgs, thisArg = lastThis;
28226 lastArgs = lastThis = void 0;
28227 lastInvokeTime = time;
28228 result = func.apply(thisArg, args);
28231 function leadingEdge(time) {
28232 lastInvokeTime = time;
28233 timerId = setTimeout(timerExpired, wait);
28234 return leading ? invokeFunc(time) : result;
28236 function remainingWait(time) {
28237 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
28238 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
28240 function shouldInvoke(time) {
28241 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
28242 return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
28244 function timerExpired() {
28245 var time = now_default();
28246 if (shouldInvoke(time)) {
28247 return trailingEdge(time);
28249 timerId = setTimeout(timerExpired, remainingWait(time));
28251 function trailingEdge(time) {
28253 if (trailing && lastArgs) {
28254 return invokeFunc(time);
28256 lastArgs = lastThis = void 0;
28259 function cancel() {
28260 if (timerId !== void 0) {
28261 clearTimeout(timerId);
28263 lastInvokeTime = 0;
28264 lastArgs = lastCallTime = lastThis = timerId = void 0;
28267 return timerId === void 0 ? result : trailingEdge(now_default());
28269 function debounced() {
28270 var time = now_default(), isInvoking = shouldInvoke(time);
28271 lastArgs = arguments;
28273 lastCallTime = time;
28275 if (timerId === void 0) {
28276 return leadingEdge(lastCallTime);
28279 clearTimeout(timerId);
28280 timerId = setTimeout(timerExpired, wait);
28281 return invokeFunc(lastCallTime);
28284 if (timerId === void 0) {
28285 timerId = setTimeout(timerExpired, wait);
28289 debounced.cancel = cancel;
28290 debounced.flush = flush;
28293 var debounce_default = debounce;
28295 // node_modules/lodash-es/_escapeHtmlChar.js
28296 var htmlEscapes = {
28303 var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
28304 var escapeHtmlChar_default = escapeHtmlChar;
28306 // node_modules/lodash-es/escape.js
28307 var reUnescapedHtml = /[&<>"']/g;
28308 var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
28309 function escape2(string) {
28310 string = toString_default(string);
28311 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
28313 var escape_default = escape2;
28315 // node_modules/lodash-es/isEqual.js
28316 function isEqual(value, other) {
28317 return baseIsEqual_default(value, other);
28319 var isEqual_default = isEqual;
28321 // node_modules/lodash-es/isNumber.js
28322 var numberTag3 = "[object Number]";
28323 function isNumber(value) {
28324 return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
28326 var isNumber_default = isNumber;
28328 // node_modules/lodash-es/throttle.js
28329 var FUNC_ERROR_TEXT2 = "Expected a function";
28330 function throttle(func, wait, options2) {
28331 var leading = true, trailing = true;
28332 if (typeof func != "function") {
28333 throw new TypeError(FUNC_ERROR_TEXT2);
28335 if (isObject_default(options2)) {
28336 leading = "leading" in options2 ? !!options2.leading : leading;
28337 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
28339 return debounce_default(func, wait, {
28340 "leading": leading,
28342 "trailing": trailing
28345 var throttle_default = throttle;
28347 // node_modules/lodash-es/_unescapeHtmlChar.js
28348 var htmlUnescapes = {
28355 var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
28356 var unescapeHtmlChar_default = unescapeHtmlChar;
28358 // node_modules/lodash-es/unescape.js
28359 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
28360 var reHasEscapedHtml = RegExp(reEscapedHtml.source);
28361 function unescape(string) {
28362 string = toString_default(string);
28363 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
28365 var unescape_default = unescape;
28367 // modules/util/detect.js
28369 function utilDetect(refresh2) {
28370 if (_detected && !refresh2)
28373 const ua = navigator.userAgent;
28375 m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
28377 _detected.browser = m2[1];
28378 _detected.version = m2[2];
28380 if (!_detected.browser) {
28381 m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
28383 _detected.browser = "msie";
28384 _detected.version = m2[1];
28387 if (!_detected.browser) {
28388 m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
28390 _detected.browser = "Opera";
28391 _detected.version = m2[2];
28394 if (!_detected.browser) {
28395 m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
28397 _detected.browser = m2[1];
28398 _detected.version = m2[2];
28399 m2 = ua.match(/version\/([\.\d]+)/i);
28401 _detected.version = m2[1];
28404 if (!_detected.browser) {
28405 _detected.browser = navigator.appName;
28406 _detected.version = navigator.appVersion;
28408 _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
28409 _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
28410 if (_detected.browser.toLowerCase() === "msie") {
28411 _detected.ie = true;
28412 _detected.browser = "Internet Explorer";
28413 _detected.support = false;
28415 _detected.ie = false;
28416 _detected.support = true;
28418 _detected.filedrop = window.FileReader && "ondrop" in window;
28419 if (/Win/.test(ua)) {
28420 _detected.os = "win";
28421 _detected.platform = "Windows";
28422 } else if (/Mac/.test(ua)) {
28423 _detected.os = "mac";
28424 _detected.platform = "Macintosh";
28425 } else if (/X11/.test(ua) || /Linux/.test(ua)) {
28426 _detected.os = "linux";
28427 _detected.platform = "Linux";
28429 _detected.os = "win";
28430 _detected.platform = "Unknown";
28432 _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
28433 // so assume any "mac" with multitouch is actually iOS
28434 navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
28435 _detected.browserLocales = Array.from(new Set(
28436 // remove duplicates
28437 [navigator.language].concat(navigator.languages || []).concat([
28438 // old property for backwards compatibility
28439 navigator.userLanguage
28442 const loc = window.top.location;
28443 let origin = loc.origin;
28445 origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
28447 _detected.host = origin + loc.pathname;
28451 // modules/util/aes.js
28452 var import_aes_js = __toESM(require_aes_js());
28453 var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
28454 function utilAesEncrypt(text, key) {
28455 key = key || DEFAULT_128;
28456 const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
28457 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
28458 const encryptedBytes = aesCtr.encrypt(textBytes);
28459 const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
28460 return encryptedHex;
28462 function utilAesDecrypt(encryptedHex, key) {
28463 key = key || DEFAULT_128;
28464 const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
28465 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
28466 const decryptedBytes = aesCtr.decrypt(encryptedBytes);
28467 const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
28471 // modules/util/clean_tags.js
28472 function utilCleanTags(tags) {
28474 for (var k2 in tags) {
28478 if (v2 !== void 0) {
28479 out[k2] = cleanValue(k2, v2);
28483 function cleanValue(k3, v3) {
28484 function keepSpaces(k4) {
28485 return /_hours|_times|:conditional$/.test(k4);
28487 function skip(k4) {
28488 return /^(description|note|fixme|inscription)$/.test(k4);
28492 var cleaned = v3.split(";").map(function(s2) {
28494 }).join(keepSpaces(k3) ? "; " : ";");
28495 if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
28496 cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
28502 // modules/util/get_set_value.js
28503 function utilGetSetValue(selection2, value, shouldUpdate) {
28504 function setValue(value2, shouldUpdate2) {
28505 function valueNull() {
28508 function valueConstant() {
28509 if (shouldUpdate2(this.value, value2)) {
28510 this.value = value2;
28513 function valueFunction() {
28514 var x2 = value2.apply(this, arguments);
28515 if (x2 === null || x2 === void 0) {
28517 } else if (shouldUpdate2(this.value, x2)) {
28521 return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
28523 if (arguments.length === 1) {
28524 return selection2.property("value");
28526 if (shouldUpdate === void 0) {
28527 shouldUpdate = (a2, b2) => a2 !== b2;
28529 return selection2.each(setValue(value, shouldUpdate));
28532 // modules/util/keybinding.js
28533 function utilKeybinding(namespace) {
28534 var _keybindings = {};
28535 function testBindings(d3_event, isCapturing) {
28536 var didMatch = false;
28537 var bindings = Object.keys(_keybindings).map(function(id2) {
28538 return _keybindings[id2];
28541 for (i3 = 0; i3 < bindings.length; i3++) {
28542 binding = bindings[i3];
28543 if (!binding.event.modifiers.shiftKey)
28545 if (!!binding.capture !== isCapturing)
28547 if (matches(d3_event, binding, true)) {
28548 binding.callback(d3_event);
28555 for (i3 = 0; i3 < bindings.length; i3++) {
28556 binding = bindings[i3];
28557 if (binding.event.modifiers.shiftKey)
28559 if (!!binding.capture !== isCapturing)
28561 if (matches(d3_event, binding, false)) {
28562 binding.callback(d3_event);
28566 function matches(d3_event2, binding2, testShift) {
28567 var event = d3_event2;
28568 var isMatch = false;
28569 var tryKeyCode = true;
28570 if (event.key !== void 0) {
28571 tryKeyCode = event.key.charCodeAt(0) > 127;
28573 if (binding2.event.key === void 0) {
28575 } else if (Array.isArray(binding2.event.key)) {
28576 if (binding2.event.key.map(function(s2) {
28577 return s2.toLowerCase();
28578 }).indexOf(event.key.toLowerCase()) === -1) {
28582 if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
28587 if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
28588 isMatch = event.keyCode === binding2.event.keyCode;
28592 if (!(event.ctrlKey && event.altKey)) {
28593 if (event.ctrlKey !== binding2.event.modifiers.ctrlKey)
28595 if (event.altKey !== binding2.event.modifiers.altKey)
28598 if (event.metaKey !== binding2.event.modifiers.metaKey)
28600 if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey)
28605 function capture(d3_event) {
28606 testBindings(d3_event, true);
28608 function bubble(d3_event) {
28609 var tagName = select_default2(d3_event.target).node().tagName;
28610 if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
28613 testBindings(d3_event, false);
28615 function keybinding(selection2) {
28616 selection2 = selection2 || select_default2(document);
28617 selection2.on("keydown.capture." + namespace, capture, true);
28618 selection2.on("keydown.bubble." + namespace, bubble, false);
28621 keybinding.unbind = function(selection2) {
28623 selection2 = selection2 || select_default2(document);
28624 selection2.on("keydown.capture." + namespace, null);
28625 selection2.on("keydown.bubble." + namespace, null);
28628 keybinding.clear = function() {
28632 keybinding.off = function(codes, capture2) {
28633 var arr = utilArrayUniq([].concat(codes));
28634 for (var i3 = 0; i3 < arr.length; i3++) {
28635 var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
28636 delete _keybindings[id2];
28640 keybinding.on = function(codes, callback, capture2) {
28641 if (typeof callback !== "function") {
28642 return keybinding.off(codes, capture2);
28644 var arr = utilArrayUniq([].concat(codes));
28645 for (var i3 = 0; i3 < arr.length; i3++) {
28646 var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
28664 if (_keybindings[id2]) {
28665 console.warn('warning: duplicate keybinding for "' + id2 + '"');
28667 _keybindings[id2] = binding;
28668 var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
28669 for (var j2 = 0; j2 < matches.length; j2++) {
28670 if (matches[j2] === "++")
28672 if (matches[j2] in utilKeybinding.modifierCodes) {
28673 var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
28674 binding.event.modifiers[prop] = true;
28676 binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
28677 if (matches[j2] in utilKeybinding.keyCodes) {
28678 binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
28687 utilKeybinding.modifierCodes = {
28691 // CTRL key, on Mac: ⌃
28694 // ALT key, on Mac: ⌥ (Alt)
28698 // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
28705 utilKeybinding.modifierProperties = {
28711 utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
28712 utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
28713 utilKeybinding.keys = {
28714 // Backspace key, on Mac: ⌫ (Backspace)
28715 "\u232B": "Backspace",
28716 backspace: "Backspace",
28717 // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
28730 "pause-break": "Pause",
28731 // Caps Lock key, ⇪
28732 "\u21EA": "CapsLock",
28734 "caps-lock": "CapsLock",
28735 // Escape key, on Mac: ⎋, on Windows: Esc
28736 "\u238B": ["Escape", "Esc"],
28737 escape: ["Escape", "Esc"],
28738 esc: ["Escape", "Esc"],
28740 space: [" ", "Spacebar"],
28741 // Page-Up key, or pgup, on Mac: ↖
28742 "\u2196": "PageUp",
28744 "page-up": "PageUp",
28745 // Page-Down key, or pgdown, on Mac: ↘
28746 "\u2198": "PageDown",
28747 pgdown: "PageDown",
28748 "page-down": "PageDown",
28749 // END key, on Mac: ⇟
28752 // HOME key, on Mac: ⇞
28755 // Insert key, or ins
28758 // Delete key, on Mac: ⌦ (Delete)
28759 "\u2326": ["Delete", "Del"],
28760 del: ["Delete", "Del"],
28761 "delete": ["Delete", "Del"],
28762 // Left Arrow Key, or ←
28763 "\u2190": ["ArrowLeft", "Left"],
28764 left: ["ArrowLeft", "Left"],
28765 "arrow-left": ["ArrowLeft", "Left"],
28766 // Up Arrow Key, or ↑
28767 "\u2191": ["ArrowUp", "Up"],
28768 up: ["ArrowUp", "Up"],
28769 "arrow-up": ["ArrowUp", "Up"],
28770 // Right Arrow Key, or →
28771 "\u2192": ["ArrowRight", "Right"],
28772 right: ["ArrowRight", "Right"],
28773 "arrow-right": ["ArrowRight", "Right"],
28774 // Up Arrow Key, or ↓
28775 "\u2193": ["ArrowDown", "Down"],
28776 down: ["ArrowDown", "Down"],
28777 "arrow-down": ["ArrowDown", "Down"],
28778 // odities, stuff for backward compatibility (browsers and code):
28779 // Num-Multiply, or *
28780 "*": ["*", "Multiply"],
28781 star: ["*", "Multiply"],
28782 asterisk: ["*", "Multiply"],
28783 multiply: ["*", "Multiply"],
28786 "plus": ["+", "Add"],
28787 // Num-Subtract, or -
28788 "-": ["-", "Subtract"],
28789 subtract: ["-", "Subtract"],
28790 "dash": ["-", "Subtract"],
28797 // Period, or ., or full-stop
28800 // Slash, or /, or forward-slash
28802 "forward-slash": "/",
28803 // Tick, or `, or back-quote
28806 // Open bracket, or [
28807 "open-bracket": "[",
28808 // Back slash, or \
28809 "back-slash": "\\",
28810 // Close bracket, or ]
28811 "close-bracket": "]",
28812 // Apostrophe, or Quote, or '
28853 utilKeybinding.keyCodes = {
28854 // Backspace key, on Mac: ⌫ (Backspace)
28857 // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
28871 // Caps Lock key, ⇪
28875 // Escape key, on Mac: ⎋, on Windows: Esc
28881 // Page-Up key, or pgup, on Mac: ↖
28885 // Page-Down key, or pgdown, on Mac: ↘
28889 // END key, on Mac: ⇟
28892 // HOME key, on Mac: ⇞
28895 // Insert key, or ins
28898 // Delete key, on Mac: ⌦ (Delete)
28902 // Left Arrow Key, or ←
28906 // Up Arrow Key, or ↑
28910 // Right Arrow Key, or →
28914 // Up Arrow Key, or ↓
28918 // odities, printing characters that come out wrong:
28921 // Num-Multiply, or *
28929 // Num-Subtract, or -
28932 // Vertical Bar / Pipe
28947 // Dash / Underscore key
28949 // Period, or ., or full-stop
28953 // Slash, or /, or forward-slash
28956 "forward-slash": 191,
28957 // Tick, or `, or back-quote
28961 // Open bracket, or [
28963 "open-bracket": 219,
28964 // Back slash, or \
28967 // Close bracket, or ]
28969 "close-bracket": 221,
28970 // Apostrophe, or Quote, or '
28977 while (++i < 106) {
28978 utilKeybinding.keyCodes["num-" + n] = i;
28984 utilKeybinding.keyCodes[n] = i;
28989 while (++i < 136) {
28990 utilKeybinding.keyCodes["f" + n] = i;
28995 utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
28998 // modules/util/object.js
28999 function utilObjectOmit(obj, omitKeys) {
29000 return Object.keys(obj).reduce(function(result, key) {
29001 if (omitKeys.indexOf(key) === -1) {
29002 result[key] = obj[key];
29008 // modules/util/rebind.js
29009 function utilRebind(target, source) {
29010 var i3 = 1, n3 = arguments.length, method;
29011 while (++i3 < n3) {
29012 target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
29016 function d3_rebind(target, source, method) {
29017 return function() {
29018 var value = method.apply(source, arguments);
29019 return value === source ? target : value;
29023 // modules/util/session_mutex.js
29024 function utilSessionMutex(name) {
29028 var expires = /* @__PURE__ */ new Date();
29029 expires.setSeconds(expires.getSeconds() + 5);
29030 document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
29032 mutex.lock = function() {
29035 var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
29039 intervalID = window.setInterval(renew, 4e3);
29042 mutex.unlock = function() {
29045 document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
29046 clearInterval(intervalID);
29049 mutex.locked = function() {
29050 return !!intervalID;
29055 // modules/util/tiler.js
29056 function utilTiler() {
29057 var _size = [256, 256];
29059 var _tileSize = 256;
29060 var _zoomExtent = [0, 20];
29061 var _translate = [_size[0] / 2, _size[1] / 2];
29063 var _skipNullIsland = false;
29064 function clamp3(num, min3, max3) {
29065 return Math.max(min3, Math.min(num, max3));
29067 function nearNullIsland(tile) {
29072 var center = Math.pow(2, z2 - 1);
29073 var width = Math.pow(2, z2 - 6);
29074 var min3 = center - width / 2;
29075 var max3 = center + width / 2 - 1;
29076 return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
29080 function tiler9() {
29081 var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
29082 var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
29084 var tileMax = Math.pow(2, z0) - 1;
29085 var log2ts = Math.log(_tileSize) * Math.LOG2E;
29086 var k2 = Math.pow(2, z2 - z0 + log2ts);
29088 (_translate[0] - _scale / 2) / k2,
29089 (_translate[1] - _scale / 2) / k2
29092 clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
29093 clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
29096 clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
29097 clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
29100 for (var i3 = 0; i3 < rows.length; i3++) {
29102 for (var j2 = 0; j2 < cols.length; j2++) {
29104 if (i3 >= _margin && i3 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
29105 tiles.unshift([x2, y2, z0]);
29107 tiles.push([x2, y2, z0]);
29111 tiles.translate = origin;
29115 tiler9.getTiles = function(projection2) {
29117 projection2.scale() * Math.PI - projection2.translate()[0],
29118 projection2.scale() * Math.PI - projection2.translate()[1]
29120 this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
29121 var tiles = tiler9();
29122 var ts = tiles.scale;
29123 return tiles.map(function(tile) {
29124 if (_skipNullIsland && nearNullIsland(tile)) {
29127 var x2 = tile[0] * ts - origin[0];
29128 var y2 = tile[1] * ts - origin[1];
29130 id: tile.toString(),
29133 projection2.invert([x2, y2 + ts]),
29134 projection2.invert([x2 + ts, y2])
29137 }).filter(Boolean);
29139 tiler9.getGeoJSON = function(projection2) {
29140 var features = tiler9.getTiles(projection2).map(function(tile) {
29149 coordinates: [tile.extent.polygon()]
29154 type: "FeatureCollection",
29158 tiler9.tileSize = function(val) {
29159 if (!arguments.length)
29164 tiler9.zoomExtent = function(val) {
29165 if (!arguments.length)
29166 return _zoomExtent;
29170 tiler9.size = function(val) {
29171 if (!arguments.length)
29176 tiler9.scale = function(val) {
29177 if (!arguments.length)
29182 tiler9.translate = function(val) {
29183 if (!arguments.length)
29188 tiler9.margin = function(val) {
29189 if (!arguments.length)
29194 tiler9.skipNullIsland = function(val) {
29195 if (!arguments.length)
29196 return _skipNullIsland;
29197 _skipNullIsland = val;
29203 // modules/util/trigger_event.js
29204 function utilTriggerEvent(target, type2, eventProperties) {
29205 target.each(function() {
29206 var evt = document.createEvent("HTMLEvents");
29207 evt.initEvent(type2, true, true);
29208 for (var prop in eventProperties) {
29209 evt[prop] = eventProperties[prop];
29211 this.dispatchEvent(evt);
29215 // modules/util/units.js
29216 var OSM_PRECISION = 7;
29217 function displayLength(m2, isImperial) {
29218 var d2 = m2 * (isImperial ? 3.28084 : 1);
29230 unit2 = "kilometers";
29235 return _t("units." + unit2, {
29236 quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
29237 maximumSignificantDigits: 4
29241 function displayArea(m2, isImperial) {
29242 var locale2 = _mainLocalizer.localeCode();
29243 var d2 = m2 * (isImperial ? 10.7639111056 : 1);
29248 if (d2 >= 6969600) {
29249 d1 = d2 / 27878400;
29250 unit1 = "square_miles";
29253 unit1 = "square_feet";
29255 if (d2 > 4356 && d2 < 4356e4) {
29262 unit1 = "square_kilometers";
29265 unit1 = "square_meters";
29267 if (d2 > 1e3 && d2 < 1e7) {
29269 unit2 = "hectares";
29272 area = _t("units." + unit1, {
29273 quantity: d1.toLocaleString(locale2, {
29274 maximumSignificantDigits: 4
29278 return _t("units.area_pair", {
29280 area2: _t("units." + unit2, {
29281 quantity: d22.toLocaleString(locale2, {
29282 maximumSignificantDigits: 2
29290 function wrap(x2, min3, max3) {
29291 var d2 = max3 - min3;
29292 return ((x2 - min3) % d2 + d2) % d2 + min3;
29294 function clamp(x2, min3, max3) {
29295 return Math.max(min3, Math.min(x2, max3));
29297 function roundToDecimal(target, decimalPlace) {
29298 target = Number(target);
29299 decimalPlace = Number(decimalPlace);
29300 const factor = Math.pow(10, decimalPlace);
29301 return Math.round(target * factor) / factor;
29303 function displayCoordinate(deg, pos, neg) {
29304 var displayCoordinate2;
29305 var locale2 = _mainLocalizer.localeCode();
29306 var degreesFloor = Math.floor(Math.abs(deg));
29307 var min3 = (Math.abs(deg) - degreesFloor) * 60;
29308 var minFloor = Math.floor(min3);
29309 var sec = (min3 - minFloor) * 60;
29310 var fix = roundToDecimal(sec, 8);
29311 var secRounded = roundToDecimal(fix, 0);
29312 if (secRounded === 60) {
29315 if (minFloor === 60) {
29320 displayCoordinate2 = _t("units.arcdegrees", {
29321 quantity: degreesFloor.toLocaleString(locale2)
29322 }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
29323 quantity: minFloor.toLocaleString(locale2)
29324 }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
29325 quantity: secRounded.toLocaleString(locale2)
29328 return displayCoordinate2;
29330 return _t("units.coordinate", {
29331 coordinate: displayCoordinate2,
29332 direction: _t("units." + (deg > 0 ? pos : neg))
29336 function dmsCoordinatePair(coord2) {
29337 return _t("units.coordinate_pair", {
29338 latitude: displayCoordinate(clamp(coord2[1], -90, 90), "north", "south"),
29339 longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
29342 function decimalCoordinatePair(coord2) {
29343 return _t("units.coordinate_pair", {
29344 latitude: clamp(coord2[1], -90, 90).toFixed(OSM_PRECISION),
29345 longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
29348 function dmsMatcher(q2) {
29350 // D M SS , D M SS ex: 35 11 10.1 , 136 49 53.8
29352 condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
29353 parser: function(q3) {
29354 const match = this.condition.exec(q3);
29355 const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
29356 const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
29357 const isNegLat = match[1] === "-" ? -lat : lat;
29358 const isNegLng = match[5] === "-" ? -lng : lng;
29359 const d2 = [isNegLat, isNegLng];
29363 // D MM , D MM ex: 35 11.1683 , 136 49.8966
29365 condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
29366 parser: function(q3) {
29367 const match = this.condition.exec(q3);
29368 const lat = +match[2] + +match[3] / 60;
29369 const lng = +match[5] + +match[6] / 60;
29370 const isNegLat = match[1] === "-" ? -lat : lat;
29371 const isNegLng = match[4] === "-" ? -lng : lng;
29372 const d2 = [isNegLat, isNegLng];
29377 for (const matcher of matchers) {
29378 if (matcher.condition.test(q2)) {
29379 return matcher.parser(q2);
29385 // modules/core/localizer.js
29386 var _mainLocalizer = coreLocalizer();
29387 var _t = _mainLocalizer.t;
29388 function coreLocalizer() {
29389 let localizer = {};
29390 let _dataLanguages = {};
29391 let _dataLocales = {};
29392 let _localeStrings = {};
29393 let _localeCode = "en-US";
29394 let _localeCodes = ["en-US", "en"];
29395 let _languageCode = "en";
29396 let _textDirection = "ltr";
29397 let _usesMetric = false;
29398 let _languageNames = {};
29399 let _scriptNames = {};
29400 localizer.localeCode = () => _localeCode;
29401 localizer.localeCodes = () => _localeCodes;
29402 localizer.languageCode = () => _languageCode;
29403 localizer.textDirection = () => _textDirection;
29404 localizer.usesMetric = () => _usesMetric;
29405 localizer.languageNames = () => _languageNames;
29406 localizer.scriptNames = () => _scriptNames;
29407 let _preferredLocaleCodes = [];
29408 localizer.preferredLocaleCodes = function(codes) {
29409 if (!arguments.length)
29410 return _preferredLocaleCodes;
29411 if (typeof codes === "string") {
29412 _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
29414 _preferredLocaleCodes = codes;
29419 localizer.ensureLoaded = () => {
29421 return _loadPromise;
29422 let filesToFetch = [
29424 // load the list of languages
29426 // load the list of supported locales
29428 const localeDirs = {
29429 general: "locales",
29430 tagging: presetsCdnUrl + "dist/translations"
29432 let fileMap = _mainFileFetcher.fileMap();
29433 for (let scopeId in localeDirs) {
29434 const key = "locales_index_".concat(scopeId);
29435 if (!fileMap[key]) {
29436 fileMap[key] = localeDirs[scopeId] + "/index.min.json";
29438 filesToFetch.push(key);
29440 return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
29441 _dataLanguages = results[0];
29442 _dataLocales = results[1];
29443 let indexes = results.slice(2);
29444 let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
29445 _localeCodes = localesToUseFrom(requestedLocales);
29446 _localeCode = _localeCodes[0];
29447 let loadStringsPromises = [];
29448 indexes.forEach((index, i3) => {
29449 const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
29450 return index[locale2] && index[locale2].pct === 1;
29452 _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
29453 let scopeId = Object.keys(localeDirs)[i3];
29454 let directory = Object.values(localeDirs)[i3];
29456 loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
29459 return Promise.all(loadStringsPromises);
29461 updateForCurrentLocale();
29462 }).catch((err) => console.error(err));
29464 function localesToUseFrom(requestedLocales) {
29465 let supportedLocales = _dataLocales;
29467 for (let i3 in requestedLocales) {
29468 let locale2 = requestedLocales[i3];
29469 if (supportedLocales[locale2])
29470 toUse.push(locale2);
29471 if (locale2.includes("-")) {
29472 let langPart = locale2.split("-")[0];
29473 if (supportedLocales[langPart])
29474 toUse.push(langPart);
29477 return utilArrayUniq(toUse);
29479 function updateForCurrentLocale() {
29482 _languageCode = _localeCode.split("-")[0];
29483 const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
29484 const hash = utilStringQs(window.location.hash);
29485 if (hash.rtl === "true") {
29486 _textDirection = "rtl";
29487 } else if (hash.rtl === "false") {
29488 _textDirection = "ltr";
29490 _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
29492 let locale2 = _localeCode;
29493 if (locale2.toLowerCase() === "en-us")
29495 _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
29496 _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
29497 _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
29499 localizer.loadLocale = (locale2, scopeId, directory) => {
29500 if (locale2.toLowerCase() === "en-us")
29502 if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
29503 return Promise.resolve(locale2);
29505 let fileMap = _mainFileFetcher.fileMap();
29506 const key = "locale_".concat(scopeId, "_").concat(locale2);
29507 if (!fileMap[key]) {
29508 fileMap[key] = "".concat(directory, "/").concat(locale2, ".min.json");
29510 return _mainFileFetcher.get(key).then((d2) => {
29511 if (!_localeStrings[scopeId])
29512 _localeStrings[scopeId] = {};
29513 _localeStrings[scopeId][locale2] = d2[locale2];
29517 localizer.pluralRule = function(number3) {
29518 return pluralRule(number3, _localeCode);
29520 function pluralRule(number3, localeCode) {
29521 const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
29523 return rules.select(number3);
29529 localizer.tInfo = function(origStringId, replacements, locale2) {
29530 let stringId = origStringId.trim();
29531 let scopeId = "general";
29532 if (stringId[0] === "_") {
29533 let split = stringId.split(".");
29534 scopeId = split[0].slice(1);
29535 stringId = split.slice(1).join(".");
29537 locale2 = locale2 || _localeCode;
29538 let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
29539 let stringsKey = locale2;
29540 if (stringsKey.toLowerCase() === "en-us")
29542 let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
29543 while (result !== void 0 && path.length) {
29544 result = result[path.pop()];
29546 if (result !== void 0) {
29547 if (replacements) {
29548 if (typeof result === "object" && Object.keys(result).length) {
29549 const number3 = Object.values(replacements).find(function(value) {
29550 return typeof value === "number";
29552 if (number3 !== void 0) {
29553 const rule = pluralRule(number3, locale2);
29554 if (result[rule]) {
29555 result = result[rule];
29557 result = Object.values(result)[0];
29561 if (typeof result === "string") {
29562 for (let key in replacements) {
29563 let value = replacements[key];
29564 if (typeof value === "number") {
29565 if (value.toLocaleString) {
29566 value = value.toLocaleString(locale2, {
29569 minimumFractionDigits: 0
29572 value = value.toString();
29575 const token = "{".concat(key, "}");
29576 const regex = new RegExp(token, "g");
29577 result = result.replace(regex, value);
29581 if (typeof result === "string") {
29588 let index = _localeCodes.indexOf(locale2);
29589 if (index >= 0 && index < _localeCodes.length - 1) {
29590 let fallback = _localeCodes[index + 1];
29591 return localizer.tInfo(origStringId, replacements, fallback);
29593 if (replacements && "default" in replacements) {
29595 text: replacements.default,
29599 const missing = "Missing ".concat(locale2, " translation: ").concat(origStringId);
29600 if (typeof console !== "undefined")
29601 console.error(missing);
29607 localizer.hasTextForStringId = function(stringId) {
29608 return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
29610 localizer.t = function(stringId, replacements, locale2) {
29611 return localizer.tInfo(stringId, replacements, locale2).text;
29613 localizer.t.html = function(stringId, replacements, locale2) {
29614 replacements = Object.assign({}, replacements);
29615 for (var k2 in replacements) {
29616 if (typeof replacements[k2] === "string") {
29617 replacements[k2] = escape_default(replacements[k2]);
29619 if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
29620 replacements[k2] = replacements[k2].html;
29623 const info = localizer.tInfo(stringId, replacements, locale2);
29625 return '<span class="localized-text" lang="'.concat(info.locale || "und", '">').concat(info.text, "</span>");
29630 localizer.t.append = function(stringId, replacements, locale2) {
29631 const ret = function(selection2) {
29632 const info = localizer.tInfo(stringId, replacements, locale2);
29633 return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
29635 ret.stringId = stringId;
29638 localizer.languageName = (code, options2) => {
29639 if (_languageNames && _languageNames[code]) {
29640 return _languageNames[code];
29642 if (options2 && options2.localOnly)
29644 const langInfo = _dataLanguages[code];
29646 if (langInfo.nativeName) {
29647 return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
29648 } else if (langInfo.base && langInfo.script) {
29649 const base = langInfo.base;
29650 if (_languageNames && _languageNames[base]) {
29651 const scriptCode = langInfo.script;
29652 const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
29653 return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
29654 } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
29655 return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
29661 localizer.floatFormatter = (locale2) => {
29662 if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
29663 return (number3, fractionDigits) => {
29664 return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
29667 return (number3, fractionDigits) => number3.toLocaleString(locale2, {
29668 minimumFractionDigits: fractionDigits,
29669 maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
29673 localizer.floatParser = (locale2) => {
29674 const polyfill = (string) => +string.trim();
29675 if (!("Intl" in window && "NumberFormat" in Intl))
29677 const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
29678 if (!("formatToParts" in format2))
29680 const parts = format2.formatToParts(-12345.6);
29681 const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
29682 const index = new Map(numerals.map((d2, i3) => [d2, i3]));
29683 const literalPart = parts.find((d2) => d2.type === "literal");
29684 const literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
29685 const groupPart = parts.find((d2) => d2.type === "group");
29686 const group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
29687 const decimalPart = parts.find((d2) => d2.type === "decimal");
29688 const decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
29689 const numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
29690 const getIndex = (d2) => index.get(d2);
29691 return (string) => {
29692 string = string.trim();
29694 string = string.replace(literal, "");
29696 string = string.replace(group, "");
29698 string = string.replace(decimal, ".");
29699 string = string.replace(numeral, getIndex);
29700 return string ? +string : NaN;
29703 localizer.decimalPlaceCounter = (locale2) => {
29704 var literal, group, decimal;
29705 if ("Intl" in window && "NumberFormat" in Intl) {
29706 const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
29707 if ("formatToParts" in format2) {
29708 const parts = format2.formatToParts(-12345.6);
29709 const literalPart = parts.find((d2) => d2.type === "literal");
29710 literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
29711 const groupPart = parts.find((d2) => d2.type === "group");
29712 group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
29713 const decimalPart = parts.find((d2) => d2.type === "decimal");
29714 decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
29717 return (string) => {
29718 string = string.trim();
29720 string = string.replace(literal, "");
29722 string = string.replace(group, "");
29723 const parts = string.split(decimal || ".");
29724 return parts && parts[1] && parts[1].length || 0;
29730 // modules/presets/collection.js
29731 function presetCollection(collection) {
29732 const MAXRESULTS = 50;
29735 _this.collection = collection;
29736 _this.item = (id2) => {
29739 const found = _this.collection.find((d2) => d2.id === id2);
29741 _memo[id2] = found;
29744 _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
29745 _this.matchGeometry = (geometry) => {
29746 return presetCollection(
29747 _this.collection.filter((d2) => d2.matchGeometry(geometry))
29750 _this.matchAllGeometry = (geometries) => {
29751 return presetCollection(
29752 _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
29755 _this.matchAnyGeometry = (geometries) => {
29756 return presetCollection(
29757 _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
29760 _this.fallback = (geometry) => {
29761 let id2 = geometry;
29762 if (id2 === "vertex")
29764 return _this.item(id2);
29766 _this.search = (value, geometry, loc) => {
29769 value = value.toLowerCase().trim();
29770 function leading(a2) {
29771 const index = a2.indexOf(value);
29772 return index === 0 || a2[index - 1] === " ";
29774 function leadingStrict(a2) {
29775 const index = a2.indexOf(value);
29776 return index === 0;
29778 function sortPresets(nameProp, aliasesProp) {
29779 return function sortNames(a2, b2) {
29780 let aCompare = a2[nameProp]();
29781 let bCompare = b2[nameProp]();
29783 const findMatchingAlias = (strings) => {
29784 if (strings.some((s2) => s2 === value)) {
29785 return strings.find((s2) => s2 === value);
29787 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
29790 aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
29791 bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
29793 if (value === aCompare)
29795 if (value === bCompare)
29797 let i3 = b2.originalScore - a2.originalScore;
29800 i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
29803 return aCompare.length - bCompare.length;
29806 let pool = _this.collection;
29807 if (Array.isArray(loc)) {
29808 const validHere = _sharedLocationManager.locationSetsAt(loc);
29809 pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
29811 const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
29812 const suggestions = pool.filter((a2) => a2.suggestion === true);
29813 const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
29814 const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
29815 const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
29816 const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
29817 const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
29818 const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
29819 const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
29820 const similarName = searchable.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 3).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
29821 const similarSuggestions = suggestions.map((a2) => ({ preset: a2, dist: utilEditDistance(value, a2.searchName()) })).filter((a2) => a2.dist + Math.min(value.length - a2.preset.searchName().length, 0) < 1).sort((a2, b2) => a2.dist - b2.dist).map((a2) => a2.preset);
29822 const similarTerms = searchable.filter((a2) => {
29823 return (a2.terms() || []).some((b2) => {
29824 return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
29827 let leadingTagKeyValues = [];
29828 if (value.includes("=")) {
29829 leadingTagKeyValues = searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => key + "=" + a2.tags[key] === value)).concat(searchable.filter((a2) => a2.tags && Object.keys(a2.tags).some((key) => leading(key + "=" + a2.tags[key]))));
29831 let results = leadingNames.concat(
29832 leadingSuggestions,
29833 leadingNamesStripped,
29834 leadingSuggestionsStripped,
29836 leadingSuggestionTerms,
29839 similarSuggestions,
29841 leadingTagKeyValues
29842 ).slice(0, MAXRESULTS - 1);
29844 if (typeof geometry === "string") {
29845 results.push(_this.fallback(geometry));
29847 geometry.forEach((geom) => results.push(_this.fallback(geom)));
29850 return presetCollection(utilArrayUniq(results));
29855 // modules/presets/category.js
29856 function presetCategory(categoryID, category, allPresets) {
29857 let _this = Object.assign({}, category);
29859 let _searchNameStripped;
29860 _this.id = categoryID;
29861 _this.members = presetCollection(
29862 (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
29864 _this.geometry = _this.members.collection.reduce((acc, preset) => {
29865 for (let i3 in preset.geometry) {
29866 const geometry = preset.geometry[i3];
29867 if (acc.indexOf(geometry) === -1) {
29868 acc.push(geometry);
29873 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
29874 _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
29875 _this.matchScore = () => -1;
29876 _this.name = () => _t("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
29877 _this.nameLabel = () => _t.append("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
29878 _this.terms = () => [];
29879 _this.searchName = () => {
29880 if (!_searchName) {
29881 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
29883 return _searchName;
29885 _this.searchNameStripped = () => {
29886 if (!_searchNameStripped) {
29887 _searchNameStripped = _this.searchName();
29888 if (_searchNameStripped.normalize)
29889 _searchNameStripped = _searchNameStripped.normalize("NFD");
29890 _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
29892 return _searchNameStripped;
29894 _this.searchAliases = () => [];
29895 _this.searchAliasesStripped = () => [];
29899 // modules/presets/field.js
29900 function presetField(fieldID, field, allFields) {
29901 allFields = allFields || {};
29902 let _this = Object.assign({}, field);
29903 _this.id = fieldID;
29904 _this.safeid = utilSafeClassName(fieldID);
29905 _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
29906 _this.matchAllGeometry = (geometries) => {
29907 return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
29909 _this.t = (scope, options2) => _t("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
29910 _this.t.html = (scope, options2) => _t.html("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
29911 _this.t.append = (scope, options2) => _t.append("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
29912 _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId("_tagging.presets.fields.".concat(fieldID, ".").concat(scope));
29913 _this.resolveReference = (which) => {
29914 const referenceRegex = /^\{(.*)\}$/;
29915 const match = (field[which] || "").match(referenceRegex);
29917 const field2 = allFields[match[1]];
29921 console.error("Unable to resolve referenced field: ".concat(match[1]));
29925 _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
29926 _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
29927 _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
29928 _this.originalTerms = (_this.terms || []).join();
29929 _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
29930 _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
29934 // modules/presets/preset.js
29935 var import_lodash = __toESM(require_lodash());
29936 function presetPreset(presetID, preset, addable, allFields, allPresets) {
29937 allFields = allFields || {};
29938 allPresets = allPresets || {};
29939 let _this = Object.assign({}, preset);
29940 let _addable = addable || false;
29942 let _searchNameStripped;
29943 let _searchAliases;
29944 let _searchAliasesStripped;
29945 const referenceRegex = /^\{(.*)\}$/;
29946 _this.id = presetID;
29947 _this.safeid = utilSafeClassName(presetID);
29948 _this.originalTerms = (_this.terms || []).join();
29949 _this.originalName = _this.name || "";
29950 _this.originalAliases = (_this.aliases || []).join("\n");
29951 _this.originalScore = _this.matchScore || 1;
29952 _this.originalReference = _this.reference || {};
29953 _this.originalFields = _this.fields || [];
29954 _this.originalMoreFields = _this.moreFields || [];
29955 _this.fields = (loc) => resolveFields("fields", loc);
29956 _this.moreFields = (loc) => resolveFields("moreFields", loc);
29957 _this.tags = _this.tags || {};
29958 _this.addTags = _this.addTags || _this.tags;
29959 _this.removeTags = _this.removeTags || _this.addTags;
29960 _this.geometry = _this.geometry || [];
29961 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
29962 _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
29963 _this.matchScore = (entityTags) => {
29964 const tags = _this.tags;
29967 for (let k2 in tags) {
29969 if (entityTags[k2] === tags[k2]) {
29970 score += _this.originalScore;
29971 } else if (tags[k2] === "*" && k2 in entityTags) {
29972 score += _this.originalScore / 2;
29977 const addTags = _this.addTags;
29978 for (let k2 in addTags) {
29979 if (!seen[k2] && entityTags[k2] === addTags[k2]) {
29980 score += _this.originalScore;
29983 if (_this.searchable === false) {
29988 _this.t = (scope, options2) => {
29989 const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
29990 return _t(textID, options2);
29992 _this.t.append = (scope, options2) => {
29993 const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
29994 return _t.append(textID, options2);
29996 function resolveReference(which) {
29997 const match = (_this[which] || "").match(referenceRegex);
29999 const preset2 = allPresets[match[1]];
30003 console.error("Unable to resolve referenced preset: ".concat(match[1]));
30007 _this.name = () => {
30008 return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
30010 _this.nameLabel = () => {
30011 return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
30013 _this.subtitle = () => {
30014 if (_this.suggestion) {
30015 let path = presetID.split("/");
30017 return _t("_tagging.presets.presets." + path.join("/") + ".name");
30021 _this.subtitleLabel = () => {
30022 if (_this.suggestion) {
30023 let path = presetID.split("/");
30025 return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
30029 _this.aliases = () => {
30030 return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
30032 _this.terms = () => {
30033 return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
30035 _this.searchName = () => {
30036 if (!_searchName) {
30037 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
30039 return _searchName;
30041 _this.searchNameStripped = () => {
30042 if (!_searchNameStripped) {
30043 _searchNameStripped = stripDiacritics(_this.searchName());
30045 return _searchNameStripped;
30047 _this.searchAliases = () => {
30048 if (!_searchAliases) {
30049 _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
30051 return _searchAliases;
30053 _this.searchAliasesStripped = () => {
30054 if (!_searchAliasesStripped) {
30055 _searchAliasesStripped = _this.searchAliases();
30056 _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
30058 return _searchAliasesStripped;
30060 _this.isFallback = () => {
30061 const tagCount = Object.keys(_this.tags).length;
30062 return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
30064 _this.addable = function(val) {
30065 if (!arguments.length)
30070 _this.reference = () => {
30071 const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
30075 let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
30076 let value = _this.originalReference.value || _this.tags[key];
30077 if (value === "*") {
30080 return { key, value };
30083 _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
30084 let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
30085 tags = utilObjectOmit(tags, Object.keys(removeTags));
30086 if (geometry && !skipFieldDefaults) {
30087 _this.fields(loc).forEach((field) => {
30088 if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
30089 delete tags[field.key];
30096 _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
30097 const addTags = _this.addTags;
30098 tags = Object.assign({}, tags);
30099 for (let k2 in addTags) {
30100 if (addTags[k2] === "*") {
30101 if (_this.tags[k2] || !tags[k2]) {
30105 tags[k2] = addTags[k2];
30108 if (!addTags.hasOwnProperty("area")) {
30110 if (geometry === "area") {
30111 let needsAreaTag = true;
30112 for (let k2 in addTags) {
30113 if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
30114 needsAreaTag = false;
30118 if (needsAreaTag) {
30123 if (geometry && !skipFieldDefaults) {
30124 _this.fields(loc).forEach((field) => {
30125 if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
30126 tags[field.key] = field.default;
30132 function resolveFields(which, loc) {
30133 const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
30135 fieldIDs.forEach((fieldID) => {
30136 const match = fieldID.match(referenceRegex);
30137 if (match !== null) {
30138 resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
30139 } else if (allFields[fieldID]) {
30140 resolved.push(allFields[fieldID]);
30142 console.log('Cannot resolve "'.concat(fieldID, '" found in ').concat(_this.id, ".").concat(which));
30145 if (!resolved.length) {
30146 const endIndex = _this.id.lastIndexOf("/");
30147 const parentID = endIndex && _this.id.substring(0, endIndex);
30149 let parent = allPresets[parentID];
30151 const validHere = _sharedLocationManager.locationSetsAt(loc);
30152 if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
30153 const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
30154 parent = allPresets[candidateIDs.find((candidateID) => {
30155 const candidate = allPresets[candidateID];
30156 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
30160 resolved = inheritFields(parent, which);
30163 return utilArrayUniq(resolved);
30164 function inheritFields(parent, which2) {
30167 if (which2 === "fields") {
30168 return parent.fields().filter(shouldInherit);
30169 } else if (which2 === "moreFields") {
30170 return parent.moreFields();
30175 function shouldInherit(f2) {
30176 if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
30177 f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check")
30182 function stripDiacritics(s2) {
30184 s2 = s2.normalize("NFD");
30185 s2 = s2.replace(/[\u0300-\u036f]/g, "");
30191 // modules/presets/index.js
30192 var _mainPresetIndex = presetIndex();
30193 function presetIndex() {
30194 const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
30195 const MAXRECENTS = 30;
30196 const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
30197 const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
30198 const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
30199 const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
30200 let _this = presetCollection([POINT, LINE, AREA, RELATION]);
30201 let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
30203 point: presetCollection([POINT]),
30204 vertex: presetCollection([POINT]),
30205 line: presetCollection([LINE]),
30206 area: presetCollection([AREA]),
30207 relation: presetCollection([RELATION])
30210 let _categories = {};
30211 let _universal = [];
30212 let _addablePresetIDs = null;
30215 let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
30217 _this.ensureLoaded = () => {
30219 return _loadPromise;
30220 return _loadPromise = Promise.all([
30221 _mainFileFetcher.get("preset_categories"),
30222 _mainFileFetcher.get("preset_defaults"),
30223 _mainFileFetcher.get("preset_presets"),
30224 _mainFileFetcher.get("preset_fields")
30225 ]).then((vals) => {
30227 categories: vals[0],
30232 osmSetAreaKeys(_this.areaKeys());
30233 osmSetLineTags(_this.lineTags());
30234 osmSetPointTags(_this.pointTags());
30235 osmSetVertexTags(_this.vertexTags());
30238 _this.merge = (d2) => {
30239 let newLocationSets = [];
30241 Object.keys(d2.fields).forEach((fieldID) => {
30242 let f2 = d2.fields[fieldID];
30244 f2 = presetField(fieldID, f2, _fields);
30245 if (f2.locationSet)
30246 newLocationSets.push(f2);
30247 _fields[fieldID] = f2;
30249 delete _fields[fieldID];
30254 Object.keys(d2.presets).forEach((presetID) => {
30255 let p2 = d2.presets[presetID];
30257 const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
30258 p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
30259 if (p2.locationSet)
30260 newLocationSets.push(p2);
30261 _presets[presetID] = p2;
30263 const existing = _presets[presetID];
30264 if (existing && !existing.isFallback()) {
30265 delete _presets[presetID];
30270 if (d2.categories) {
30271 Object.keys(d2.categories).forEach((categoryID) => {
30272 let c2 = d2.categories[categoryID];
30274 c2 = presetCategory(categoryID, c2, _presets);
30275 if (c2.locationSet)
30276 newLocationSets.push(c2);
30277 _categories[categoryID] = c2;
30279 delete _categories[categoryID];
30283 _this.collection = Object.values(_presets).concat(Object.values(_categories));
30285 Object.keys(d2.defaults).forEach((geometry) => {
30286 const def2 = d2.defaults[geometry];
30287 if (Array.isArray(def2)) {
30288 _defaults2[geometry] = presetCollection(
30289 def2.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
30292 delete _defaults2[geometry];
30296 _universal = Object.values(_fields).filter((field) => field.universal);
30297 _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
30298 _this.collection.forEach((preset) => {
30299 (preset.geometry || []).forEach((geometry) => {
30300 let g3 = _geometryIndex[geometry];
30301 for (let key in preset.tags) {
30302 g3[key] = g3[key] || {};
30303 let value = preset.tags[key];
30304 (g3[key][value] = g3[key][value] || []).push(preset);
30308 if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
30309 _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
30311 if (newLocationSets.length) {
30312 _sharedLocationManager.mergeLocationSets(newLocationSets);
30316 _this.match = (entity, resolver) => {
30317 return resolver.transient(entity, "presetMatch", () => {
30318 let geometry = entity.geometry(resolver);
30319 if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
30320 geometry = "point";
30322 const entityExtent = entity.extent(resolver);
30323 return _this.matchTags(entity.tags, geometry, entityExtent.center());
30326 _this.matchTags = (tags, geometry, loc) => {
30327 const keyIndex = _geometryIndex[geometry];
30328 let bestScore = -1;
30330 let matchCandidates = [];
30331 for (let k2 in tags) {
30332 let indexMatches = [];
30333 let valueIndex = keyIndex[k2];
30336 let keyValueMatches = valueIndex[tags[k2]];
30337 if (keyValueMatches)
30338 indexMatches.push(...keyValueMatches);
30339 let keyStarMatches = valueIndex["*"];
30340 if (keyStarMatches)
30341 indexMatches.push(...keyStarMatches);
30342 if (indexMatches.length === 0)
30344 for (let i3 = 0; i3 < indexMatches.length; i3++) {
30345 const candidate = indexMatches[i3];
30346 const score = candidate.matchScore(tags);
30347 if (score === -1) {
30350 matchCandidates.push({ score, candidate });
30351 if (score > bestScore) {
30353 bestMatch = candidate;
30357 if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
30358 const validHere = _sharedLocationManager.locationSetsAt(loc);
30359 if (!validHere[bestMatch.locationSetID]) {
30360 matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
30361 for (let i3 = 0; i3 < matchCandidates.length; i3++) {
30362 const candidateScore = matchCandidates[i3];
30363 if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
30364 bestMatch = candidateScore.candidate;
30365 bestScore = candidateScore.score;
30371 if (!bestMatch || bestMatch.isFallback()) {
30372 for (let k2 in tags) {
30373 if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
30374 bestMatch = keyIndex["addr:*"]["*"][0];
30379 return bestMatch || _this.fallback(geometry);
30381 _this.allowsVertex = (entity, resolver) => {
30382 if (entity.type !== "node")
30384 if (Object.keys(entity.tags).length === 0)
30386 return resolver.transient(entity, "vertexMatch", () => {
30387 if (entity.isOnAddressLine(resolver))
30389 const geometries = osmNodeGeometriesForTags(entity.tags);
30390 if (geometries.vertex)
30392 if (geometries.point)
30397 _this.areaKeys = () => {
30407 const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
30408 presets.forEach((p2) => {
30409 const keys2 = p2.tags && Object.keys(p2.tags);
30410 const key = keys2 && keys2.length && keys2[0];
30415 if (p2.geometry.indexOf("area") !== -1) {
30416 areaKeys[key] = areaKeys[key] || {};
30419 presets.forEach((p2) => {
30421 for (key in p2.addTags) {
30422 const value = p2.addTags[key];
30423 if (key in areaKeys && // probably an area...
30424 p2.geometry.indexOf("line") !== -1 && // but sometimes a line
30426 areaKeys[key][value] = true;
30432 _this.lineTags = () => {
30433 return _this.collection.filter((lineTags, d2) => {
30434 if (d2.suggestion || d2.replacement || d2.searchable === false)
30436 const keys2 = d2.tags && Object.keys(d2.tags);
30437 const key = keys2 && keys2.length && keys2[0];
30440 if (d2.geometry.indexOf("line") !== -1) {
30441 lineTags[key] = lineTags[key] || [];
30442 lineTags[key].push(d2.tags);
30447 _this.pointTags = () => {
30448 return _this.collection.reduce((pointTags, d2) => {
30449 if (d2.suggestion || d2.replacement || d2.searchable === false)
30451 const keys2 = d2.tags && Object.keys(d2.tags);
30452 const key = keys2 && keys2.length && keys2[0];
30455 if (d2.geometry.indexOf("point") !== -1) {
30456 pointTags[key] = pointTags[key] || {};
30457 pointTags[key][d2.tags[key]] = true;
30462 _this.vertexTags = () => {
30463 return _this.collection.reduce((vertexTags, d2) => {
30464 if (d2.suggestion || d2.replacement || d2.searchable === false)
30466 const keys2 = d2.tags && Object.keys(d2.tags);
30467 const key = keys2 && keys2.length && keys2[0];
30470 if (d2.geometry.indexOf("vertex") !== -1) {
30471 vertexTags[key] = vertexTags[key] || {};
30472 vertexTags[key][d2.tags[key]] = true;
30477 _this.field = (id2) => _fields[id2];
30478 _this.universal = () => _universal;
30479 _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
30481 if (startWithRecents) {
30482 recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
30485 if (_addablePresetIDs) {
30486 defaults = Array.from(_addablePresetIDs).map(function(id2) {
30487 var preset = _this.item(id2);
30488 if (preset && preset.matchGeometry(geometry))
30491 }).filter(Boolean);
30493 defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
30495 let result = presetCollection(
30496 utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
30498 if (Array.isArray(loc)) {
30499 const validHere = _sharedLocationManager.locationSetsAt(loc);
30500 result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
30504 _this.addablePresetIDs = function(val) {
30505 if (!arguments.length)
30506 return _addablePresetIDs;
30507 if (Array.isArray(val))
30508 val = new Set(val);
30509 _addablePresetIDs = val;
30510 if (_addablePresetIDs) {
30511 _this.collection.forEach((p2) => {
30513 p2.addable(_addablePresetIDs.has(p2.id));
30516 _this.collection.forEach((p2) => {
30523 _this.recent = () => {
30524 return presetCollection(
30525 utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
30528 function RibbonItem(preset, source) {
30530 item.preset = preset;
30531 item.source = source;
30532 item.isFavorite = () => item.source === "favorite";
30533 item.isRecent = () => item.source === "recent";
30534 item.matches = (preset2) => item.preset.id === preset2.id;
30535 item.minified = () => ({ pID: item.preset.id });
30538 function ribbonItemForMinified(d2, source) {
30539 if (d2 && d2.pID) {
30540 const preset = _this.item(d2.pID);
30543 return RibbonItem(preset, source);
30547 _this.getGenericRibbonItems = () => {
30548 return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
30550 _this.getAddable = () => {
30551 if (!_addablePresetIDs)
30553 return _addablePresetIDs.map((id2) => {
30554 const preset = _this.item(id2);
30556 return RibbonItem(preset, "addable");
30558 }).filter(Boolean);
30560 function setRecents(items) {
30562 const minifiedItems = items.map((d2) => d2.minified());
30563 corePreferences("preset_recents", JSON.stringify(minifiedItems));
30564 dispatch14.call("recentsChange");
30566 _this.getRecents = () => {
30568 _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
30569 let item = ribbonItemForMinified(d2, "recent");
30570 if (item && item.preset.addable())
30577 _this.addRecent = (preset, besidePreset, after) => {
30578 const recents = _this.getRecents();
30579 const beforeItem = _this.recentMatching(besidePreset);
30580 let toIndex = recents.indexOf(beforeItem);
30583 const newItem = RibbonItem(preset, "recent");
30584 recents.splice(toIndex, 0, newItem);
30585 setRecents(recents);
30587 _this.removeRecent = (preset) => {
30588 const item = _this.recentMatching(preset);
30590 let items = _this.getRecents();
30591 items.splice(items.indexOf(item), 1);
30595 _this.recentMatching = (preset) => {
30596 const items = _this.getRecents();
30597 for (let i3 in items) {
30598 if (items[i3].matches(preset)) {
30604 _this.moveItem = (items, fromIndex, toIndex) => {
30605 if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length)
30607 items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
30610 _this.moveRecent = (item, beforeItem) => {
30611 const recents = _this.getRecents();
30612 const fromIndex = recents.indexOf(item);
30613 const toIndex = recents.indexOf(beforeItem);
30614 const items = _this.moveItem(recents, fromIndex, toIndex);
30618 _this.setMostRecent = (preset) => {
30619 if (preset.searchable === false)
30621 let items = _this.getRecents();
30622 let item = _this.recentMatching(preset);
30624 items.splice(items.indexOf(item), 1);
30626 item = RibbonItem(preset, "recent");
30628 while (items.length >= MAXRECENTS) {
30631 items.unshift(item);
30634 function setFavorites(items) {
30635 _favorites = items;
30636 const minifiedItems = items.map((d2) => d2.minified());
30637 corePreferences("preset_favorites", JSON.stringify(minifiedItems));
30638 dispatch14.call("favoritePreset");
30640 _this.addFavorite = (preset, besidePreset, after) => {
30641 const favorites = _this.getFavorites();
30642 const beforeItem = _this.favoriteMatching(besidePreset);
30643 let toIndex = favorites.indexOf(beforeItem);
30646 const newItem = RibbonItem(preset, "favorite");
30647 favorites.splice(toIndex, 0, newItem);
30648 setFavorites(favorites);
30650 _this.toggleFavorite = (preset) => {
30651 const favs = _this.getFavorites();
30652 const favorite = _this.favoriteMatching(preset);
30654 favs.splice(favs.indexOf(favorite), 1);
30656 if (favs.length === 10) {
30659 favs.push(RibbonItem(preset, "favorite"));
30661 setFavorites(favs);
30663 _this.removeFavorite = (preset) => {
30664 const item = _this.favoriteMatching(preset);
30666 const items = _this.getFavorites();
30667 items.splice(items.indexOf(item), 1);
30668 setFavorites(items);
30671 _this.getFavorites = () => {
30673 let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
30674 if (!rawFavorites) {
30676 corePreferences("preset_favorites", JSON.stringify(rawFavorites));
30678 _favorites = rawFavorites.reduce((output, d2) => {
30679 const item = ribbonItemForMinified(d2, "favorite");
30680 if (item && item.preset.addable())
30687 _this.favoriteMatching = (preset) => {
30688 const favs = _this.getFavorites();
30689 for (let index in favs) {
30690 if (favs[index].matches(preset)) {
30691 return favs[index];
30696 return utilRebind(_this, dispatch14, "on");
30699 // modules/util/util.js
30700 function utilTagText(entity) {
30701 var obj = entity && entity.tags || {};
30702 return Object.keys(obj).map(function(k2) {
30703 return k2 + "=" + obj[k2];
30706 function utilTotalExtent(array2, graph) {
30707 var extent = geoExtent();
30709 for (var i3 = 0; i3 < array2.length; i3++) {
30711 entity = typeof val === "string" ? graph.hasEntity(val) : val;
30713 extent._extend(entity.extent(graph));
30718 function utilTagDiff(oldTags, newTags) {
30720 var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
30721 keys2.forEach(function(k2) {
30722 var oldVal = oldTags[k2];
30723 var newVal = newTags[k2];
30724 if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
30730 display: "- " + k2 + "=" + oldVal
30733 if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
30739 display: "+ " + k2 + "=" + newVal
30745 function utilEntitySelector(ids) {
30746 return ids.length ? "." + ids.join(",.") : "nothing";
30748 function utilEntityOrMemberSelector(ids, graph) {
30749 var seen = new Set(ids);
30750 ids.forEach(collectShallowDescendants);
30751 return utilEntitySelector(Array.from(seen));
30752 function collectShallowDescendants(id2) {
30753 var entity = graph.hasEntity(id2);
30754 if (!entity || entity.type !== "relation")
30756 entity.members.map(function(member) {
30758 }).forEach(function(id3) {
30763 function utilEntityOrDeepMemberSelector(ids, graph) {
30764 return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
30766 function utilEntityAndDeepMemberIDs(ids, graph) {
30767 var seen = /* @__PURE__ */ new Set();
30768 ids.forEach(collectDeepDescendants);
30769 return Array.from(seen);
30770 function collectDeepDescendants(id2) {
30774 var entity = graph.hasEntity(id2);
30775 if (!entity || entity.type !== "relation")
30777 entity.members.map(function(member) {
30779 }).forEach(collectDeepDescendants);
30782 function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
30783 var idsSet = new Set(ids);
30784 var seen = /* @__PURE__ */ new Set();
30785 var returners = /* @__PURE__ */ new Set();
30786 ids.forEach(collectDeepDescendants);
30787 return utilEntitySelector(Array.from(returners));
30788 function collectDeepDescendants(id2) {
30792 if (!idsSet.has(id2)) {
30793 returners.add(id2);
30795 var entity = graph.hasEntity(id2);
30796 if (!entity || entity.type !== "relation")
30798 if (skipMultipolgonMembers && entity.isMultipolygon())
30800 entity.members.map(function(member) {
30802 }).forEach(collectDeepDescendants);
30805 function utilHighlightEntities(ids, highlighted, context) {
30806 context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
30808 function utilGetAllNodes(ids, graph) {
30809 var seen = /* @__PURE__ */ new Set();
30810 var nodes = /* @__PURE__ */ new Set();
30811 ids.forEach(collectNodes);
30812 return Array.from(nodes);
30813 function collectNodes(id2) {
30817 var entity = graph.hasEntity(id2);
30820 if (entity.type === "node") {
30822 } else if (entity.type === "way") {
30823 entity.nodes.forEach(collectNodes);
30825 entity.members.map(function(member) {
30827 }).forEach(collectNodes);
30831 function utilDisplayName(entity) {
30832 var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
30833 var name = entity.tags[localizedNameKey] || entity.tags.name || "";
30837 direction: entity.tags.direction,
30838 from: entity.tags.from,
30839 network: entity.tags.cycle_network || entity.tags.network,
30840 ref: entity.tags.ref,
30841 to: entity.tags.to,
30842 via: entity.tags.via
30844 var keyComponents = [];
30845 if (tags.network) {
30846 keyComponents.push("network");
30849 keyComponents.push("ref");
30851 if (entity.tags.route) {
30852 if (tags.direction) {
30853 keyComponents.push("direction");
30854 } else if (tags.from && tags.to) {
30855 keyComponents.push("from");
30856 keyComponents.push("to");
30858 keyComponents.push("via");
30862 if (keyComponents.length) {
30863 name = _t("inspector.display_name." + keyComponents.join("_"), tags);
30867 function utilDisplayNameForPath(entity) {
30868 var name = utilDisplayName(entity);
30869 var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
30870 var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
30871 if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
30872 name = fixRTLTextForSvg(name);
30876 function utilDisplayType(id2) {
30878 n: _t("inspector.node"),
30879 w: _t("inspector.way"),
30880 r: _t("inspector.relation")
30883 function utilDisplayLabel(entity, graphOrGeometry, verbose) {
30885 var displayName = utilDisplayName(entity);
30886 var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
30887 var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
30889 result = [presetName, displayName].filter(Boolean).join(" ");
30891 result = displayName || presetName;
30893 return result || utilDisplayType(entity.id);
30895 function utilEntityRoot(entityType) {
30902 function utilCombinedTags(entityIDs, graph) {
30904 var tagCounts = {};
30905 var allKeys = /* @__PURE__ */ new Set();
30906 var entities = entityIDs.map(function(entityID) {
30907 return graph.hasEntity(entityID);
30908 }).filter(Boolean);
30909 entities.forEach(function(entity) {
30910 var keys2 = Object.keys(entity.tags).filter(Boolean);
30911 keys2.forEach(function(key2) {
30915 entities.forEach(function(entity) {
30916 allKeys.forEach(function(key2) {
30917 var value = entity.tags[key2];
30918 if (!tags.hasOwnProperty(key2)) {
30919 tags[key2] = value;
30921 if (!Array.isArray(tags[key2])) {
30922 if (tags[key2] !== value) {
30923 tags[key2] = [tags[key2], value];
30926 if (tags[key2].indexOf(value) === -1) {
30927 tags[key2].push(value);
30931 var tagHash = key2 + "=" + value;
30932 if (!tagCounts[tagHash])
30933 tagCounts[tagHash] = 0;
30934 tagCounts[tagHash] += 1;
30937 for (var key in tags) {
30938 if (!Array.isArray(tags[key]))
30940 tags[key] = tags[key].sort(function(val12, val2) {
30942 var count2 = tagCounts[key2 + "=" + val2];
30943 var count1 = tagCounts[key2 + "=" + val12];
30944 if (count2 !== count1) {
30945 return count2 - count1;
30947 if (val2 && val12) {
30948 return val12.localeCompare(val2);
30950 return val12 ? 1 : -1;
30955 function utilStringQs(str) {
30957 while (i3 < str.length && (str[i3] === "?" || str[i3] === "#"))
30959 str = str.slice(i3);
30960 return str.split("&").reduce(function(obj, pair3) {
30961 var parts = pair3.split("=");
30962 if (parts.length === 2) {
30963 obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
30968 function utilQsString(obj, noencode) {
30969 function softEncode(s2) {
30970 return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
30972 return Object.keys(obj).sort().map(function(key) {
30973 return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
30976 function utilPrefixDOMProperty(property) {
30977 var prefixes2 = ["webkit", "ms", "moz", "o"];
30979 var n3 = prefixes2.length;
30980 var s2 = document.body;
30981 if (property in s2)
30983 property = property.slice(0, 1).toUpperCase() + property.slice(1);
30984 while (++i3 < n3) {
30985 if (prefixes2[i3] + property in s2) {
30986 return prefixes2[i3] + property;
30991 function utilPrefixCSSProperty(property) {
30992 var prefixes2 = ["webkit", "ms", "Moz", "O"];
30994 var n3 = prefixes2.length;
30995 var s2 = document.body.style;
30996 if (property.toLowerCase() in s2) {
30997 return property.toLowerCase();
30999 while (++i3 < n3) {
31000 if (prefixes2[i3] + property in s2) {
31001 return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
31006 var transformProperty;
31007 function utilSetTransform(el, x2, y2, scale) {
31008 var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
31009 var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
31010 return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
31012 function utilEditDistance(a2, b2) {
31013 a2 = (0, import_diacritics.remove)(a2.toLowerCase());
31014 b2 = (0, import_diacritics.remove)(b2.toLowerCase());
31015 if (a2.length === 0)
31017 if (b2.length === 0)
31021 for (i3 = 0; i3 <= b2.length; i3++) {
31024 for (j2 = 0; j2 <= a2.length; j2++) {
31025 matrix[0][j2] = j2;
31027 for (i3 = 1; i3 <= b2.length; i3++) {
31028 for (j2 = 1; j2 <= a2.length; j2++) {
31029 if (b2.charAt(i3 - 1) === a2.charAt(j2 - 1)) {
31030 matrix[i3][j2] = matrix[i3 - 1][j2 - 1];
31032 matrix[i3][j2] = Math.min(
31033 matrix[i3 - 1][j2 - 1] + 1,
31036 matrix[i3][j2 - 1] + 1,
31038 matrix[i3 - 1][j2] + 1
31044 return matrix[b2.length][a2.length];
31046 function utilFastMouse(container) {
31047 var rect = container.getBoundingClientRect();
31048 var rectLeft = rect.left;
31049 var rectTop = rect.top;
31050 var clientLeft = +container.clientLeft;
31051 var clientTop = +container.clientTop;
31052 return function(e3) {
31054 e3.clientX - rectLeft - clientLeft,
31055 e3.clientY - rectTop - clientTop
31059 function utilAsyncMap(inputs, func, callback) {
31060 var remaining = inputs.length;
31063 inputs.forEach(function(d2, i3) {
31064 func(d2, function done(err, data) {
31066 results[i3] = data;
31069 callback(errors, results);
31073 function utilWrap(index, length2) {
31075 index += Math.ceil(-index / length2) * length2;
31077 return index % length2;
31079 function utilFunctor(value) {
31080 if (typeof value === "function")
31082 return function() {
31086 function utilNoAuto(selection2) {
31087 var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
31088 return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
31090 function utilHashcode(str) {
31092 if (str.length === 0) {
31095 for (var i3 = 0; i3 < str.length; i3++) {
31096 var char = str.charCodeAt(i3);
31097 hash = (hash << 5) - hash + char;
31098 hash = hash & hash;
31102 function utilSafeClassName(str) {
31103 return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
31105 function utilUniqueDomId(val) {
31106 return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
31108 function utilUnicodeCharsCount(str) {
31109 return Array.from(str).length;
31111 function utilUnicodeCharsTruncated(str, limit) {
31112 return Array.from(str).slice(0, limit).join("");
31114 function toNumericID(id2) {
31115 var match = id2.match(/^[cnwr](-?\d+)$/);
31117 return parseInt(match[1], 10);
31121 function compareNumericIDs(left, right) {
31122 if (isNaN(left) && isNaN(right))
31128 if (Math.sign(left) !== Math.sign(right))
31129 return -Math.sign(left);
31130 if (Math.sign(left) < 0)
31131 return Math.sign(right - left);
31132 return Math.sign(left - right);
31134 function utilCompareIDs(left, right) {
31135 return compareNumericIDs(toNumericID(left), toNumericID(right));
31137 function utilOldestID(ids) {
31138 if (ids.length === 0) {
31141 var oldestIDIndex = 0;
31142 var oldestID = toNumericID(ids[0]);
31143 for (var i3 = 1; i3 < ids.length; i3++) {
31144 var num = toNumericID(ids[i3]);
31145 if (compareNumericIDs(oldestID, num) === 1) {
31146 oldestIDIndex = i3;
31150 return ids[oldestIDIndex];
31152 function utilCleanOsmString(val, maxChars) {
31153 if (val === void 0 || val === null) {
31156 val = val.toString();
31160 val = val.normalize("NFC");
31161 return utilUnicodeCharsTruncated(val, maxChars);
31164 // modules/osm/entity.js
31165 function osmEntity(attrs) {
31166 if (this instanceof osmEntity)
31168 if (attrs && attrs.type) {
31169 return osmEntity[attrs.type].apply(this, arguments);
31170 } else if (attrs && attrs.id) {
31171 return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
31173 return new osmEntity().initialize(arguments);
31175 osmEntity.id = function(type2) {
31176 return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
31178 osmEntity.id.next = {
31184 osmEntity.id.fromOSM = function(type2, id2) {
31185 return type2[0] + id2;
31187 osmEntity.id.toOSM = function(id2) {
31188 var match = id2.match(/^[cnwr](-?\d+)$/);
31194 osmEntity.id.type = function(id2) {
31195 return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
31197 osmEntity.key = function(entity) {
31198 return entity.id + "v" + (entity.v || 0);
31200 var _deprecatedTagValuesByKey;
31201 osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
31202 if (!_deprecatedTagValuesByKey) {
31203 _deprecatedTagValuesByKey = {};
31204 dataDeprecated.forEach(function(d2) {
31205 var oldKeys = Object.keys(d2.old);
31206 if (oldKeys.length === 1) {
31207 var oldKey = oldKeys[0];
31208 var oldValue = d2.old[oldKey];
31209 if (oldValue !== "*") {
31210 if (!_deprecatedTagValuesByKey[oldKey]) {
31211 _deprecatedTagValuesByKey[oldKey] = [oldValue];
31213 _deprecatedTagValuesByKey[oldKey].push(oldValue);
31219 return _deprecatedTagValuesByKey;
31221 osmEntity.prototype = {
31223 initialize: function(sources) {
31224 for (var i3 = 0; i3 < sources.length; ++i3) {
31225 var source = sources[i3];
31226 for (var prop in source) {
31227 if (Object.prototype.hasOwnProperty.call(source, prop)) {
31228 if (source[prop] === void 0) {
31231 this[prop] = source[prop];
31236 if (!this.id && this.type) {
31237 this.id = osmEntity.id(this.type);
31239 if (!this.hasOwnProperty("visible")) {
31240 this.visible = true;
31243 Object.freeze(this);
31244 Object.freeze(this.tags);
31246 Object.freeze(this.loc);
31248 Object.freeze(this.nodes);
31250 Object.freeze(this.members);
31254 copy: function(resolver, copies) {
31255 if (copies[this.id])
31256 return copies[this.id];
31257 var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
31258 copies[this.id] = copy2;
31261 osmId: function() {
31262 return osmEntity.id.toOSM(this.id);
31264 isNew: function() {
31265 var osmId = osmEntity.id.toOSM(this.id);
31266 return osmId.length === 0 || osmId[0] === "-";
31268 update: function(attrs) {
31269 return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
31271 mergeTags: function(tags) {
31272 var merged = Object.assign({}, this.tags);
31273 var changed = false;
31274 for (var k2 in tags) {
31275 var t1 = merged[k2];
31280 } else if (t1 !== t2) {
31282 merged[k2] = utilUnicodeCharsTruncated(
31283 utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
31285 // avoid exceeding character limit; see also context.maxCharsForTagValue()
31289 return changed ? this.update({ tags: merged }) : this;
31291 intersects: function(extent, resolver) {
31292 return this.extent(resolver).intersects(extent);
31294 hasNonGeometryTags: function() {
31295 return Object.keys(this.tags).some(function(k2) {
31296 return k2 !== "area";
31299 hasParentRelations: function(resolver) {
31300 return resolver.parentRelations(this).length > 0;
31302 hasInterestingTags: function() {
31303 return Object.keys(this.tags).some(osmIsInterestingTag);
31305 isHighwayIntersection: function() {
31308 isDegenerate: function() {
31311 deprecatedTags: function(dataDeprecated) {
31312 var tags = this.tags;
31313 if (Object.keys(tags).length === 0)
31315 var deprecated = [];
31316 dataDeprecated.forEach(function(d2) {
31317 var oldKeys = Object.keys(d2.old);
31319 var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
31320 if (!tags[replaceKey] || d2.old[replaceKey])
31322 var replaceValue = d2.replace[replaceKey];
31323 if (replaceValue === "*")
31325 if (replaceValue === tags[replaceKey])
31329 if (hasExistingValues)
31332 var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
31335 if (d2.old[oldKey] === "*")
31337 if (d2.old[oldKey] === tags[oldKey])
31339 var vals = tags[oldKey].split(";").filter(Boolean);
31340 if (vals.length === 0) {
31342 } else if (vals.length > 1) {
31343 return vals.indexOf(d2.old[oldKey]) !== -1;
31345 if (tags[oldKey] === d2.old[oldKey]) {
31346 if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
31347 var replaceKeys = Object.keys(d2.replace);
31348 return !replaceKeys.every(function(replaceKey) {
31349 return tags[replaceKey] === d2.replace[replaceKey];
31358 if (matchesDeprecatedTags) {
31359 deprecated.push(d2);
31366 // modules/osm/lanes.js
31367 function osmLanes(entity) {
31368 if (entity.type !== "way")
31370 if (!entity.tags.highway)
31372 var tags = entity.tags;
31373 var isOneWay = entity.isOneWay();
31374 var laneCount = getLaneCount(tags, isOneWay);
31375 var maxspeed = parseMaxspeed(tags);
31376 var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
31377 var forward = laneDirections.forward;
31378 var backward = laneDirections.backward;
31379 var bothways = laneDirections.bothways;
31380 var turnLanes = {};
31381 turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
31382 turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
31383 turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
31384 var maxspeedLanes = {};
31385 maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
31386 maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
31387 maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
31389 psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
31390 psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
31391 psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
31393 busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
31394 busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
31395 busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
31396 var taxiLanes = {};
31397 taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
31398 taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
31399 taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
31401 hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
31402 hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
31403 hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
31405 hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
31406 hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
31407 hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
31408 var bicyclewayLanes = {};
31409 bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
31410 bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
31411 bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
31417 mapToLanesObj(lanesObj, turnLanes, "turnLane");
31418 mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
31419 mapToLanesObj(lanesObj, psvLanes, "psv");
31420 mapToLanesObj(lanesObj, busLanes, "bus");
31421 mapToLanesObj(lanesObj, taxiLanes, "taxi");
31422 mapToLanesObj(lanesObj, hovLanes, "hov");
31423 mapToLanesObj(lanesObj, hgvLanes, "hgv");
31424 mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
31445 function getLaneCount(tags, isOneWay) {
31448 count = parseInt(tags.lanes, 10);
31453 switch (tags.highway) {
31456 count = isOneWay ? 2 : 4;
31459 count = isOneWay ? 1 : 2;
31464 function parseMaxspeed(tags) {
31465 var maxspeed = tags.maxspeed;
31468 var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
31469 if (!maxspeedRegex.test(maxspeed))
31471 return parseInt(maxspeed, 10);
31473 function parseLaneDirections(tags, isOneWay, laneCount) {
31474 var forward = parseInt(tags["lanes:forward"], 10);
31475 var backward = parseInt(tags["lanes:backward"], 10);
31476 var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
31477 if (parseInt(tags.oneway, 10) === -1) {
31480 backward = laneCount;
31481 } else if (isOneWay) {
31482 forward = laneCount;
31485 } else if (isNaN(forward) && isNaN(backward)) {
31486 backward = Math.floor((laneCount - bothways) / 2);
31487 forward = laneCount - bothways - backward;
31488 } else if (isNaN(forward)) {
31489 if (backward > laneCount - bothways) {
31490 backward = laneCount - bothways;
31492 forward = laneCount - bothways - backward;
31493 } else if (isNaN(backward)) {
31494 if (forward > laneCount - bothways) {
31495 forward = laneCount - bothways;
31497 backward = laneCount - bothways - forward;
31505 function parseTurnLanes(tag2) {
31508 var validValues = [
31521 return tag2.split("|").map(function(s2) {
31524 return s2.split(";").map(function(d2) {
31525 return validValues.indexOf(d2) === -1 ? "unknown" : d2;
31529 function parseMaxspeedLanes(tag2, maxspeed) {
31532 return tag2.split("|").map(function(s2) {
31535 var m2 = parseInt(s2, 10);
31536 if (s2 === "" || m2 === maxspeed)
31538 return isNaN(m2) ? "unknown" : m2;
31541 function parseMiscLanes(tag2) {
31544 var validValues = [
31549 return tag2.split("|").map(function(s2) {
31552 return validValues.indexOf(s2) === -1 ? "unknown" : s2;
31555 function parseBicycleWay(tag2) {
31558 var validValues = [
31564 return tag2.split("|").map(function(s2) {
31567 return validValues.indexOf(s2) === -1 ? "unknown" : s2;
31570 function mapToLanesObj(lanesObj, data, key) {
31571 if (data.forward) {
31572 data.forward.forEach(function(l2, i3) {
31573 if (!lanesObj.forward[i3])
31574 lanesObj.forward[i3] = {};
31575 lanesObj.forward[i3][key] = l2;
31578 if (data.backward) {
31579 data.backward.forEach(function(l2, i3) {
31580 if (!lanesObj.backward[i3])
31581 lanesObj.backward[i3] = {};
31582 lanesObj.backward[i3][key] = l2;
31585 if (data.unspecified) {
31586 data.unspecified.forEach(function(l2, i3) {
31587 if (!lanesObj.unspecified[i3])
31588 lanesObj.unspecified[i3] = {};
31589 lanesObj.unspecified[i3][key] = l2;
31594 // modules/osm/way.js
31595 function osmWay() {
31596 if (!(this instanceof osmWay)) {
31597 return new osmWay().initialize(arguments);
31598 } else if (arguments.length) {
31599 this.initialize(arguments);
31602 osmEntity.way = osmWay;
31603 osmWay.prototype = Object.create(osmEntity.prototype);
31604 Object.assign(osmWay.prototype, {
31607 copy: function(resolver, copies) {
31608 if (copies[this.id])
31609 return copies[this.id];
31610 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
31611 var nodes = this.nodes.map(function(id2) {
31612 return resolver.entity(id2).copy(resolver, copies).id;
31614 copy2 = copy2.update({ nodes });
31615 copies[this.id] = copy2;
31618 extent: function(resolver) {
31619 return resolver.transient(this, "extent", function() {
31620 var extent = geoExtent();
31621 for (var i3 = 0; i3 < this.nodes.length; i3++) {
31622 var node = resolver.hasEntity(this.nodes[i3]);
31624 extent._extend(node.extent());
31630 first: function() {
31631 return this.nodes[0];
31634 return this.nodes[this.nodes.length - 1];
31636 contains: function(node) {
31637 return this.nodes.indexOf(node) >= 0;
31639 affix: function(node) {
31640 if (this.nodes[0] === node)
31642 if (this.nodes[this.nodes.length - 1] === node)
31645 layer: function() {
31646 if (isFinite(this.tags.layer)) {
31647 return Math.max(-10, Math.min(+this.tags.layer, 10));
31649 if (this.tags.covered === "yes")
31651 if (this.tags.location === "overground")
31653 if (this.tags.location === "underground")
31655 if (this.tags.location === "underwater")
31657 if (this.tags.power === "line")
31659 if (this.tags.power === "minor_line")
31661 if (this.tags.aerialway)
31663 if (this.tags.bridge)
31665 if (this.tags.cutting)
31667 if (this.tags.tunnel)
31669 if (this.tags.waterway)
31671 if (this.tags.man_made === "pipeline")
31673 if (this.tags.boundary)
31677 // the approximate width of the line based on its tags except its `width` tag
31678 impliedLineWidthMeters: function() {
31679 var averageWidths = {
31681 // width is for single lane
31709 // width includes ties and rail bed, not just track gauge
31731 for (var key in averageWidths) {
31732 if (this.tags[key] && averageWidths[key][this.tags[key]]) {
31733 var width = averageWidths[key][this.tags[key]];
31734 if (key === "highway") {
31735 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
31737 laneCount = this.isOneWay() ? 1 : 2;
31738 return width * laneCount;
31745 isOneWay: function() {
31750 "reversible": true,
31751 "alternating": true,
31755 if (values[this.tags.oneway] !== void 0) {
31756 return values[this.tags.oneway];
31758 for (var key in this.tags) {
31759 if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
31765 // Some identifier for tag that implies that this way is "sided",
31766 // i.e. the right side is the 'inside' (e.g. the right side of a
31767 // natural=cliff is lower).
31768 sidednessIdentifier: function() {
31769 for (const realKey in this.tags) {
31770 const value = this.tags[realKey];
31771 const key = osmRemoveLifecyclePrefix(realKey);
31772 if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
31773 if (osmRightSideIsInsideTags[key][value] === true) {
31776 return osmRightSideIsInsideTags[key][value];
31782 isSided: function() {
31783 if (this.tags.two_sided === "yes") {
31786 return this.sidednessIdentifier() !== null;
31788 lanes: function() {
31789 return osmLanes(this);
31791 isClosed: function() {
31792 return this.nodes.length > 1 && this.first() === this.last();
31794 isConvex: function(resolver) {
31795 if (!this.isClosed() || this.isDegenerate())
31797 var nodes = utilArrayUniq(resolver.childNodes(this));
31798 var coords = nodes.map(function(n3) {
31803 for (var i3 = 0; i3 < coords.length; i3++) {
31804 var o2 = coords[(i3 + 1) % coords.length];
31805 var a2 = coords[i3];
31806 var b2 = coords[(i3 + 2) % coords.length];
31807 var res = geoVecCross(a2, b2, o2);
31808 curr = res > 0 ? 1 : res < 0 ? -1 : 0;
31811 } else if (prev && curr !== prev) {
31818 // returns an object with the tag that implies this is an area, if any
31819 tagSuggestingArea: function() {
31820 return osmTagSuggestingArea(this.tags);
31822 isArea: function() {
31823 if (this.tags.area === "yes")
31825 if (!this.isClosed() || this.tags.area === "no")
31827 return this.tagSuggestingArea() !== null;
31829 isDegenerate: function() {
31830 return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
31832 areAdjacent: function(n1, n22) {
31833 for (var i3 = 0; i3 < this.nodes.length; i3++) {
31834 if (this.nodes[i3] === n1) {
31835 if (this.nodes[i3 - 1] === n22)
31837 if (this.nodes[i3 + 1] === n22)
31843 geometry: function(graph) {
31844 return graph.transient(this, "geometry", function() {
31845 return this.isArea() ? "area" : "line";
31848 // returns an array of objects representing the segments between the nodes in this way
31849 segments: function(graph) {
31850 function segmentExtent(graph2) {
31851 var n1 = graph2.hasEntity(this.nodes[0]);
31852 var n22 = graph2.hasEntity(this.nodes[1]);
31853 return n1 && n22 && geoExtent([
31855 Math.min(n1.loc[0], n22.loc[0]),
31856 Math.min(n1.loc[1], n22.loc[1])
31859 Math.max(n1.loc[0], n22.loc[0]),
31860 Math.max(n1.loc[1], n22.loc[1])
31864 return graph.transient(this, "segments", function() {
31866 for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
31868 id: this.id + "-" + i3,
31871 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
31872 extent: segmentExtent
31878 // If this way is not closed, append the beginning node to the end of the nodelist to close it.
31879 close: function() {
31880 if (this.isClosed() || !this.nodes.length)
31882 var nodes = this.nodes.slice();
31883 nodes = nodes.filter(noRepeatNodes);
31884 nodes.push(nodes[0]);
31885 return this.update({ nodes });
31887 // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
31888 unclose: function() {
31889 if (!this.isClosed())
31891 var nodes = this.nodes.slice();
31892 var connector = this.first();
31893 var i3 = nodes.length - 1;
31894 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
31895 nodes.splice(i3, 1);
31896 i3 = nodes.length - 1;
31898 nodes = nodes.filter(noRepeatNodes);
31899 return this.update({ nodes });
31901 // Adds a node (id) in front of the node which is currently at position index.
31902 // If index is undefined, the node will be added to the end of the way for linear ways,
31903 // or just before the final connecting node for circular ways.
31904 // Consecutive duplicates are eliminated including existing ones.
31905 // Circularity is always preserved when adding a node.
31906 addNode: function(id2, index) {
31907 var nodes = this.nodes.slice();
31908 var isClosed = this.isClosed();
31909 var max3 = isClosed ? nodes.length - 1 : nodes.length;
31910 if (index === void 0) {
31913 if (index < 0 || index > max3) {
31914 throw new RangeError("index " + index + " out of range 0.." + max3);
31917 var connector = this.first();
31919 while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
31920 nodes.splice(i3, 1);
31924 i3 = nodes.length - 1;
31925 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
31926 nodes.splice(i3, 1);
31929 i3 = nodes.length - 1;
31932 nodes.splice(index, 0, id2);
31933 nodes = nodes.filter(noRepeatNodes);
31934 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
31935 nodes.push(nodes[0]);
31937 return this.update({ nodes });
31939 // Replaces the node which is currently at position index with the given node (id).
31940 // Consecutive duplicates are eliminated including existing ones.
31941 // Circularity is preserved when updating a node.
31942 updateNode: function(id2, index) {
31943 var nodes = this.nodes.slice();
31944 var isClosed = this.isClosed();
31945 var max3 = nodes.length - 1;
31946 if (index === void 0 || index < 0 || index > max3) {
31947 throw new RangeError("index " + index + " out of range 0.." + max3);
31950 var connector = this.first();
31952 while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
31953 nodes.splice(i3, 1);
31957 i3 = nodes.length - 1;
31958 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
31959 nodes.splice(i3, 1);
31962 i3 = nodes.length - 1;
31965 nodes.splice(index, 1, id2);
31966 nodes = nodes.filter(noRepeatNodes);
31967 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
31968 nodes.push(nodes[0]);
31970 return this.update({ nodes });
31972 // Replaces each occurrence of node id needle with replacement.
31973 // Consecutive duplicates are eliminated including existing ones.
31974 // Circularity is preserved.
31975 replaceNode: function(needleID, replacementID) {
31976 var nodes = this.nodes.slice();
31977 var isClosed = this.isClosed();
31978 for (var i3 = 0; i3 < nodes.length; i3++) {
31979 if (nodes[i3] === needleID) {
31980 nodes[i3] = replacementID;
31983 nodes = nodes.filter(noRepeatNodes);
31984 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
31985 nodes.push(nodes[0]);
31987 return this.update({ nodes });
31989 // Removes each occurrence of node id.
31990 // Consecutive duplicates are eliminated including existing ones.
31991 // Circularity is preserved.
31992 removeNode: function(id2) {
31993 var nodes = this.nodes.slice();
31994 var isClosed = this.isClosed();
31995 nodes = nodes.filter(function(node) {
31996 return node !== id2;
31997 }).filter(noRepeatNodes);
31998 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
31999 nodes.push(nodes[0]);
32001 return this.update({ nodes });
32003 asJXON: function(changeset_id) {
32006 "@id": this.osmId(),
32007 "@version": this.version || 0,
32008 nd: this.nodes.map(function(id2) {
32009 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
32011 tag: Object.keys(this.tags).map(function(k2) {
32012 return { keyAttributes: { k: k2, v: this.tags[k2] } };
32016 if (changeset_id) {
32017 r2.way["@changeset"] = changeset_id;
32021 asGeoJSON: function(resolver) {
32022 return resolver.transient(this, "GeoJSON", function() {
32023 var coordinates = resolver.childNodes(this).map(function(n3) {
32026 if (this.isArea() && this.isClosed()) {
32029 coordinates: [coordinates]
32033 type: "LineString",
32039 area: function(resolver) {
32040 return resolver.transient(this, "area", function() {
32041 var nodes = resolver.childNodes(this);
32044 coordinates: [nodes.map(function(n3) {
32048 if (!this.isClosed() && nodes.length) {
32049 json.coordinates[0].push(nodes[0].loc);
32051 var area = area_default(json);
32052 if (area > 2 * Math.PI) {
32053 json.coordinates[0] = json.coordinates[0].reverse();
32054 area = area_default(json);
32056 return isNaN(area) ? 0 : area;
32060 function noRepeatNodes(node, i3, arr) {
32061 return i3 === 0 || node !== arr[i3 - 1];
32064 // modules/osm/multipolygon.js
32065 function osmJoinWays(toJoin, graph) {
32066 function resolve(member) {
32067 return graph.childNodes(graph.entity(member.id));
32069 function reverse(item2) {
32070 var action = actionReverse(item2.id, { reverseOneway: true });
32071 sequences.actions.push(action);
32072 return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
32074 toJoin = toJoin.filter(function(member) {
32075 return member.type === "way" && graph.hasEntity(member.id);
32078 var joinAsMembers = true;
32079 for (i3 = 0; i3 < toJoin.length; i3++) {
32080 if (toJoin[i3] instanceof osmWay) {
32081 joinAsMembers = false;
32085 var sequences = [];
32086 sequences.actions = [];
32087 while (toJoin.length) {
32088 var item = toJoin.shift();
32089 var currWays = [item];
32090 var currNodes = resolve(item).slice();
32091 while (toJoin.length) {
32092 var start2 = currNodes[0];
32093 var end = currNodes[currNodes.length - 1];
32096 for (i3 = 0; i3 < toJoin.length; i3++) {
32098 nodes = resolve(item);
32099 if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
32100 currWays[0] = reverse(currWays[0]);
32101 currNodes.reverse();
32102 start2 = currNodes[0];
32103 end = currNodes[currNodes.length - 1];
32105 if (nodes[0] === end) {
32106 fn = currNodes.push;
32107 nodes = nodes.slice(1);
32109 } else if (nodes[nodes.length - 1] === end) {
32110 fn = currNodes.push;
32111 nodes = nodes.slice(0, -1).reverse();
32112 item = reverse(item);
32114 } else if (nodes[nodes.length - 1] === start2) {
32115 fn = currNodes.unshift;
32116 nodes = nodes.slice(0, -1);
32118 } else if (nodes[0] === start2) {
32119 fn = currNodes.unshift;
32120 nodes = nodes.slice(1).reverse();
32121 item = reverse(item);
32130 fn.apply(currWays, [item]);
32131 fn.apply(currNodes, nodes);
32132 toJoin.splice(i3, 1);
32134 currWays.nodes = currNodes;
32135 sequences.push(currWays);
32140 // modules/actions/add_member.js
32141 function actionAddMember(relationId, member, memberIndex) {
32142 return function action(graph) {
32143 var relation = graph.entity(relationId);
32144 var isPTv2 = /stop|platform/.test(member.role);
32145 if (member.type === "way" && !isPTv2) {
32146 graph = addWayMember(relation, graph);
32148 if (isPTv2 && isNaN(memberIndex)) {
32151 graph = graph.replace(relation.addMember(member, memberIndex));
32155 function addWayMember(relation, graph) {
32156 var groups, item, i3, j2, k2;
32157 var PTv2members = [];
32159 for (i3 = 0; i3 < relation.members.length; i3++) {
32160 var m2 = relation.members[i3];
32161 if (/stop|platform/.test(m2.role)) {
32162 PTv2members.push(m2);
32167 relation = relation.update({ members });
32168 groups = utilArrayGroupBy(relation.members, "type");
32169 groups.way = groups.way || [];
32170 groups.way.push(member);
32171 members = withIndex(groups.way);
32172 var joined = osmJoinWays(members, graph);
32173 for (i3 = 0; i3 < joined.length; i3++) {
32174 var segment = joined[i3];
32175 var nodes = segment.nodes.slice();
32176 var startIndex = segment[0].index;
32177 for (j2 = 0; j2 < members.length; j2++) {
32178 if (members[j2].index === startIndex) {
32182 for (k2 = 0; k2 < segment.length; k2++) {
32183 item = segment[k2];
32184 var way = graph.entity(item.id);
32186 if (j2 + k2 >= members.length || item.index !== members[j2 + k2].index) {
32187 moveMember(members, item.index, j2 + k2);
32190 nodes.splice(0, way.nodes.length - 1);
32193 var wayMembers = [];
32194 for (i3 = 0; i3 < members.length; i3++) {
32195 item = members[i3];
32196 if (item.index === -1)
32198 wayMembers.push(utilObjectOmit(item, ["index"]));
32200 var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
32201 return graph.replace(relation.update({ members: newMembers }));
32202 function moveMember(arr, findIndex, toIndex) {
32204 for (i4 = 0; i4 < arr.length; i4++) {
32205 if (arr[i4].index === findIndex) {
32209 var item2 = Object.assign({}, arr[i4]);
32210 arr[i4].index = -1;
32211 delete item2.index;
32212 arr.splice(toIndex, 0, item2);
32214 function withIndex(arr) {
32215 var result = new Array(arr.length);
32216 for (var i4 = 0; i4 < arr.length; i4++) {
32217 result[i4] = Object.assign({}, arr[i4]);
32218 result[i4].index = i4;
32225 // modules/actions/add_midpoint.js
32226 function actionAddMidpoint(midpoint, node) {
32227 return function(graph) {
32228 graph = graph.replace(node.move(midpoint.loc));
32229 var parents = utilArrayIntersection(
32230 graph.parentWays(graph.entity(midpoint.edge[0])),
32231 graph.parentWays(graph.entity(midpoint.edge[1]))
32233 parents.forEach(function(way) {
32234 for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
32235 if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
32236 graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
32245 // modules/actions/add_vertex.js
32246 function actionAddVertex(wayId, nodeId, index) {
32247 return function(graph) {
32248 return graph.replace(graph.entity(wayId).addNode(nodeId, index));
32252 // modules/actions/change_member.js
32253 function actionChangeMember(relationId, member, memberIndex) {
32254 return function(graph) {
32255 return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
32259 // modules/actions/change_preset.js
32260 function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
32261 return function action(graph) {
32262 var entity = graph.entity(entityID);
32263 var geometry = entity.geometry(graph);
32264 var tags = entity.tags;
32265 const loc = entity.extent(graph).center();
32269 if (newPreset.addTags) {
32270 preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
32272 if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
32273 newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
32277 tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
32279 tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
32280 return graph.replace(entity.update({ tags }));
32284 // modules/actions/change_tags.js
32285 function actionChangeTags(entityId, tags) {
32286 return function(graph) {
32287 var entity = graph.entity(entityId);
32288 return graph.replace(entity.update({ tags }));
32292 // modules/osm/node.js
32296 northnortheast: 22,
32304 eastsoutheast: 112,
32308 southsoutheast: 157,
32312 southsouthwest: 202,
32316 westsouthwest: 247,
32320 westnorthwest: 292,
32324 northnorthwest: 337,
32327 function osmNode() {
32328 if (!(this instanceof osmNode)) {
32329 return new osmNode().initialize(arguments);
32330 } else if (arguments.length) {
32331 this.initialize(arguments);
32334 osmEntity.node = osmNode;
32335 osmNode.prototype = Object.create(osmEntity.prototype);
32336 Object.assign(osmNode.prototype, {
32339 extent: function() {
32340 return new geoExtent(this.loc);
32342 geometry: function(graph) {
32343 return graph.transient(this, "geometry", function() {
32344 return graph.isPoi(this) ? "point" : "vertex";
32347 move: function(loc) {
32348 return this.update({ loc });
32350 isDegenerate: function() {
32351 return !(Array.isArray(this.loc) && this.loc.length === 2 && this.loc[0] >= -180 && this.loc[0] <= 180 && this.loc[1] >= -90 && this.loc[1] <= 90);
32353 // Inspect tags and geometry to determine which direction(s) this node/vertex points
32354 directions: function(resolver, projection2) {
32357 if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
32360 val = (this.tags.direction || "").toLowerCase();
32361 var re3 = /:direction$/i;
32362 var keys2 = Object.keys(this.tags);
32363 for (i3 = 0; i3 < keys2.length; i3++) {
32364 if (re3.test(keys2[i3])) {
32365 val = this.tags[keys2[i3]].toLowerCase();
32372 var values = val.split(";");
32374 values.forEach(function(v2) {
32375 if (cardinal[v2] !== void 0) {
32378 if (v2 !== "" && !isNaN(+v2)) {
32382 var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
32383 var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
32384 if (!lookForward && !lookBackward)
32387 resolver.parentWays(this).forEach(function(parent) {
32388 var nodes = parent.nodes;
32389 for (i3 = 0; i3 < nodes.length; i3++) {
32390 if (nodes[i3] === this.id) {
32391 if (lookForward && i3 > 0) {
32392 nodeIds[nodes[i3 - 1]] = true;
32394 if (lookBackward && i3 < nodes.length - 1) {
32395 nodeIds[nodes[i3 + 1]] = true;
32400 Object.keys(nodeIds).forEach(function(nodeId) {
32402 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
32406 return utilArrayUniq(results);
32408 isCrossing: function() {
32409 return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
32411 isEndpoint: function(resolver) {
32412 return resolver.transient(this, "isEndpoint", function() {
32414 return resolver.parentWays(this).filter(function(parent) {
32415 return !parent.isClosed() && !!parent.affix(id2);
32419 isConnected: function(resolver) {
32420 return resolver.transient(this, "isConnected", function() {
32421 var parents = resolver.parentWays(this);
32422 if (parents.length > 1) {
32423 for (var i3 in parents) {
32424 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags())
32427 } else if (parents.length === 1) {
32428 var way = parents[0];
32429 var nodes = way.nodes.slice();
32430 if (way.isClosed()) {
32433 return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
32438 parentIntersectionWays: function(resolver) {
32439 return resolver.transient(this, "parentIntersectionWays", function() {
32440 return resolver.parentWays(this).filter(function(parent) {
32441 return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
32445 isIntersection: function(resolver) {
32446 return this.parentIntersectionWays(resolver).length > 1;
32448 isHighwayIntersection: function(resolver) {
32449 return resolver.transient(this, "isHighwayIntersection", function() {
32450 return resolver.parentWays(this).filter(function(parent) {
32451 return parent.tags.highway && parent.geometry(resolver) === "line";
32455 isOnAddressLine: function(resolver) {
32456 return resolver.transient(this, "isOnAddressLine", function() {
32457 return resolver.parentWays(this).filter(function(parent) {
32458 return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
32462 asJXON: function(changeset_id) {
32465 "@id": this.osmId(),
32466 "@lon": this.loc[0],
32467 "@lat": this.loc[1],
32468 "@version": this.version || 0,
32469 tag: Object.keys(this.tags).map(function(k2) {
32470 return { keyAttributes: { k: k2, v: this.tags[k2] } };
32475 r2.node["@changeset"] = changeset_id;
32478 asGeoJSON: function() {
32481 coordinates: this.loc
32486 // modules/actions/circularize.js
32487 function actionCircularize(wayId, projection2, maxAngle) {
32488 maxAngle = (maxAngle || 20) * Math.PI / 180;
32489 var action = function(graph, t2) {
32490 if (t2 === null || !isFinite(t2))
32492 t2 = Math.min(Math.max(+t2, 0), 1);
32493 var way = graph.entity(wayId);
32494 var origNodes = {};
32495 graph.childNodes(way).forEach(function(node2) {
32496 if (!origNodes[node2.id])
32497 origNodes[node2.id] = node2;
32499 if (!way.isConvex(graph)) {
32500 graph = action.makeConvex(graph);
32502 var nodes = utilArrayUniq(graph.childNodes(way));
32503 var keyNodes = nodes.filter(function(n3) {
32504 return graph.parentWays(n3).length !== 1;
32506 var points = nodes.map(function(n3) {
32507 return projection2(n3.loc);
32509 var keyPoints = keyNodes.map(function(n3) {
32510 return projection2(n3.loc);
32512 var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
32513 var radius = median(points, function(p2) {
32514 return geoVecLength(centroid, p2);
32516 var sign2 = area_default3(points) > 0 ? 1 : -1;
32517 var ids, i3, j2, k2;
32518 if (!keyNodes.length) {
32519 keyNodes = [nodes[0]];
32520 keyPoints = [points[0]];
32522 if (keyNodes.length === 1) {
32523 var index = nodes.indexOf(keyNodes[0]);
32524 var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
32525 keyNodes.push(nodes[oppositeIndex]);
32526 keyPoints.push(points[oppositeIndex]);
32528 for (i3 = 0; i3 < keyPoints.length; i3++) {
32529 var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
32530 var startNode = keyNodes[i3];
32531 var endNode = keyNodes[nextKeyNodeIndex];
32532 var startNodeIndex = nodes.indexOf(startNode);
32533 var endNodeIndex = nodes.indexOf(endNode);
32534 var numberNewPoints = -1;
32535 var indexRange = endNodeIndex - startNodeIndex;
32536 var nearNodes = {};
32537 var inBetweenNodes = [];
32538 var startAngle, endAngle, totalAngle, eachAngle;
32539 var angle2, loc, node, origNode;
32540 if (indexRange < 0) {
32541 indexRange += nodes.length;
32543 var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
32545 centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
32546 centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
32548 loc = projection2.invert(keyPoints[i3]);
32549 node = keyNodes[i3];
32550 origNode = origNodes[node.id];
32551 node = node.move(geoVecInterp(origNode.loc, loc, t2));
32552 graph = graph.replace(node);
32553 startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
32554 endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
32555 totalAngle = endAngle - startAngle;
32556 if (totalAngle * sign2 > 0) {
32557 totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
32561 eachAngle = totalAngle / (indexRange + numberNewPoints);
32562 } while (Math.abs(eachAngle) > maxAngle);
32563 for (j2 = 1; j2 < indexRange; j2++) {
32564 angle2 = startAngle + j2 * eachAngle;
32565 loc = projection2.invert([
32566 centroid[0] + Math.cos(angle2) * radius,
32567 centroid[1] + Math.sin(angle2) * radius
32569 node = nodes[(j2 + startNodeIndex) % nodes.length];
32570 origNode = origNodes[node.id];
32571 nearNodes[node.id] = angle2;
32572 node = node.move(geoVecInterp(origNode.loc, loc, t2));
32573 graph = graph.replace(node);
32575 for (j2 = 0; j2 < numberNewPoints; j2++) {
32576 angle2 = startAngle + (indexRange + j2) * eachAngle;
32577 loc = projection2.invert([
32578 centroid[0] + Math.cos(angle2) * radius,
32579 centroid[1] + Math.sin(angle2) * radius
32581 var min3 = Infinity;
32582 for (var nodeId in nearNodes) {
32583 var nearAngle = nearNodes[nodeId];
32584 var dist = Math.abs(nearAngle - angle2);
32587 origNode = origNodes[nodeId];
32590 node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
32591 graph = graph.replace(node);
32592 nodes.splice(endNodeIndex + j2, 0, node);
32593 inBetweenNodes.push(node.id);
32595 if (indexRange === 1 && inBetweenNodes.length) {
32596 var startIndex1 = way.nodes.lastIndexOf(startNode.id);
32597 var endIndex1 = way.nodes.lastIndexOf(endNode.id);
32598 var wayDirection1 = endIndex1 - startIndex1;
32599 if (wayDirection1 < -1) {
32602 var parentWays = graph.parentWays(keyNodes[i3]);
32603 for (j2 = 0; j2 < parentWays.length; j2++) {
32604 var sharedWay = parentWays[j2];
32605 if (sharedWay === way)
32607 if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
32608 var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
32609 var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
32610 var wayDirection2 = endIndex2 - startIndex2;
32611 var insertAt = endIndex2;
32612 if (wayDirection2 < -1) {
32615 if (wayDirection1 !== wayDirection2) {
32616 inBetweenNodes.reverse();
32617 insertAt = startIndex2;
32619 for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
32620 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
32622 graph = graph.replace(sharedWay);
32627 ids = nodes.map(function(n3) {
32631 way = way.update({ nodes: ids });
32632 graph = graph.replace(way);
32635 action.makeConvex = function(graph) {
32636 var way = graph.entity(wayId);
32637 var nodes = utilArrayUniq(graph.childNodes(way));
32638 var points = nodes.map(function(n3) {
32639 return projection2(n3.loc);
32641 var sign2 = area_default3(points) > 0 ? 1 : -1;
32642 var hull = hull_default(points);
32644 if (sign2 === -1) {
32648 for (i3 = 0; i3 < hull.length - 1; i3++) {
32649 var startIndex = points.indexOf(hull[i3]);
32650 var endIndex = points.indexOf(hull[i3 + 1]);
32651 var indexRange = endIndex - startIndex;
32652 if (indexRange < 0) {
32653 indexRange += nodes.length;
32655 for (j2 = 1; j2 < indexRange; j2++) {
32656 var point2 = geoVecInterp(hull[i3], hull[i3 + 1], j2 / indexRange);
32657 var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point2));
32658 graph = graph.replace(node);
32663 action.disabled = function(graph) {
32664 if (!graph.entity(wayId).isClosed()) {
32665 return "not_closed";
32667 var way = graph.entity(wayId);
32668 var nodes = utilArrayUniq(graph.childNodes(way));
32669 var points = nodes.map(function(n3) {
32670 return projection2(n3.loc);
32672 var hull = hull_default(points);
32673 var epsilonAngle = Math.PI / 180;
32674 if (hull.length !== points.length || hull.length < 3) {
32677 var centroid = centroid_default2(points);
32678 var radius = geoVecLengthSquare(centroid, points[0]);
32679 var i3, actualPoint;
32680 for (i3 = 0; i3 < hull.length; i3++) {
32681 actualPoint = hull[i3];
32682 var actualDist = geoVecLengthSquare(actualPoint, centroid);
32683 var diff = Math.abs(actualDist - radius);
32684 if (diff > 0.05 * radius) {
32688 for (i3 = 0; i3 < hull.length; i3++) {
32689 actualPoint = hull[i3];
32690 var nextPoint = hull[(i3 + 1) % hull.length];
32691 var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
32692 var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
32693 var angle2 = endAngle - startAngle;
32697 if (angle2 > Math.PI) {
32698 angle2 = 2 * Math.PI - angle2;
32700 if (angle2 > maxAngle + epsilonAngle) {
32704 return "already_circular";
32706 action.transitionable = true;
32710 // modules/actions/delete_way.js
32711 function actionDeleteWay(wayID) {
32712 function canDeleteNode(node, graph) {
32713 if (graph.parentWays(node).length || graph.parentRelations(node).length)
32715 var geometries = osmNodeGeometriesForTags(node.tags);
32716 if (geometries.point)
32718 if (geometries.vertex)
32720 return !node.hasInterestingTags();
32722 var action = function(graph) {
32723 var way = graph.entity(wayID);
32724 graph.parentRelations(way).forEach(function(parent) {
32725 parent = parent.removeMembersWithID(wayID);
32726 graph = graph.replace(parent);
32727 if (parent.isDegenerate()) {
32728 graph = actionDeleteRelation(parent.id)(graph);
32731 new Set(way.nodes).forEach(function(nodeID) {
32732 graph = graph.replace(way.removeNode(nodeID));
32733 var node = graph.entity(nodeID);
32734 if (canDeleteNode(node, graph)) {
32735 graph = graph.remove(node);
32738 return graph.remove(way);
32743 // modules/actions/delete_multiple.js
32744 function actionDeleteMultiple(ids) {
32746 way: actionDeleteWay,
32747 node: actionDeleteNode,
32748 relation: actionDeleteRelation
32750 var action = function(graph) {
32751 ids.forEach(function(id2) {
32752 if (graph.hasEntity(id2)) {
32753 graph = actions[graph.entity(id2).type](id2)(graph);
32761 // modules/actions/delete_relation.js
32762 function actionDeleteRelation(relationID, allowUntaggedMembers) {
32763 function canDeleteEntity(entity, graph) {
32764 return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
32766 var action = function(graph) {
32767 var relation = graph.entity(relationID);
32768 graph.parentRelations(relation).forEach(function(parent) {
32769 parent = parent.removeMembersWithID(relationID);
32770 graph = graph.replace(parent);
32771 if (parent.isDegenerate()) {
32772 graph = actionDeleteRelation(parent.id)(graph);
32775 var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
32778 memberIDs.forEach(function(memberID) {
32779 graph = graph.replace(relation.removeMembersWithID(memberID));
32780 var entity = graph.entity(memberID);
32781 if (canDeleteEntity(entity, graph)) {
32782 graph = actionDeleteMultiple([memberID])(graph);
32785 return graph.remove(relation);
32790 // modules/actions/delete_node.js
32791 function actionDeleteNode(nodeId) {
32792 var action = function(graph) {
32793 var node = graph.entity(nodeId);
32794 graph.parentWays(node).forEach(function(parent) {
32795 parent = parent.removeNode(nodeId);
32796 graph = graph.replace(parent);
32797 if (parent.isDegenerate()) {
32798 graph = actionDeleteWay(parent.id)(graph);
32801 graph.parentRelations(node).forEach(function(parent) {
32802 parent = parent.removeMembersWithID(nodeId);
32803 graph = graph.replace(parent);
32804 if (parent.isDegenerate()) {
32805 graph = actionDeleteRelation(parent.id)(graph);
32808 return graph.remove(node);
32813 // modules/actions/connect.js
32814 function actionConnect(nodeIDs) {
32815 var action = function(graph) {
32821 var interestingIDs = [];
32822 for (i3 = 0; i3 < nodeIDs.length; i3++) {
32823 node = graph.entity(nodeIDs[i3]);
32824 if (node.hasInterestingTags()) {
32825 if (!node.isNew()) {
32826 interestingIDs.push(node.id);
32830 survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
32831 for (i3 = 0; i3 < nodeIDs.length; i3++) {
32832 node = graph.entity(nodeIDs[i3]);
32833 if (node.id === survivor.id)
32835 parents = graph.parentWays(node);
32836 for (j2 = 0; j2 < parents.length; j2++) {
32837 graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
32839 parents = graph.parentRelations(node);
32840 for (j2 = 0; j2 < parents.length; j2++) {
32841 graph = graph.replace(parents[j2].replaceMember(node, survivor));
32843 survivor = survivor.mergeTags(node.tags);
32844 graph = actionDeleteNode(node.id)(graph);
32846 graph = graph.replace(survivor);
32847 parents = graph.parentWays(survivor);
32848 for (i3 = 0; i3 < parents.length; i3++) {
32849 if (parents[i3].isDegenerate()) {
32850 graph = actionDeleteWay(parents[i3].id)(graph);
32855 action.disabled = function(graph) {
32857 var restrictionIDs = [];
32860 var relations, relation, role;
32862 survivor = graph.entity(utilOldestID(nodeIDs));
32863 for (i3 = 0; i3 < nodeIDs.length; i3++) {
32864 node = graph.entity(nodeIDs[i3]);
32865 relations = graph.parentRelations(node);
32866 for (j2 = 0; j2 < relations.length; j2++) {
32867 relation = relations[j2];
32868 role = relation.memberById(node.id).role || "";
32869 if (relation.hasFromViaTo()) {
32870 restrictionIDs.push(relation.id);
32872 if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
32875 seen[relation.id] = role;
32879 for (i3 = 0; i3 < nodeIDs.length; i3++) {
32880 node = graph.entity(nodeIDs[i3]);
32881 var parents = graph.parentWays(node);
32882 for (j2 = 0; j2 < parents.length; j2++) {
32883 var parent = parents[j2];
32884 relations = graph.parentRelations(parent);
32885 for (k2 = 0; k2 < relations.length; k2++) {
32886 relation = relations[k2];
32887 if (relation.hasFromViaTo()) {
32888 restrictionIDs.push(relation.id);
32893 restrictionIDs = utilArrayUniq(restrictionIDs);
32894 for (i3 = 0; i3 < restrictionIDs.length; i3++) {
32895 relation = graph.entity(restrictionIDs[i3]);
32896 if (!relation.isComplete(graph))
32898 var memberWays = relation.members.filter(function(m2) {
32899 return m2.type === "way";
32900 }).map(function(m2) {
32901 return graph.entity(m2.id);
32903 memberWays = utilArrayUniq(memberWays);
32904 var f2 = relation.memberByRole("from");
32905 var t2 = relation.memberByRole("to");
32906 var isUturn = f2.id === t2.id;
32907 var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
32908 for (j2 = 0; j2 < relation.members.length; j2++) {
32909 collectNodes(relation.members[j2], nodes);
32911 nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
32912 nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
32913 var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
32914 nodes.from = nodes.from.filter(filter2);
32915 nodes.via = nodes.via.filter(filter2);
32916 nodes.to = nodes.to.filter(filter2);
32917 var connectFrom = false;
32918 var connectVia = false;
32919 var connectTo = false;
32920 var connectKeyFrom = false;
32921 var connectKeyTo = false;
32922 for (j2 = 0; j2 < nodeIDs.length; j2++) {
32923 var n3 = nodeIDs[j2];
32924 if (nodes.from.indexOf(n3) !== -1) {
32925 connectFrom = true;
32927 if (nodes.via.indexOf(n3) !== -1) {
32930 if (nodes.to.indexOf(n3) !== -1) {
32933 if (nodes.keyfrom.indexOf(n3) !== -1) {
32934 connectKeyFrom = true;
32936 if (nodes.keyto.indexOf(n3) !== -1) {
32937 connectKeyTo = true;
32940 if (connectFrom && connectTo && !isUturn) {
32941 return "restriction";
32943 if (connectFrom && connectVia) {
32944 return "restriction";
32946 if (connectTo && connectVia) {
32947 return "restriction";
32949 if (connectKeyFrom || connectKeyTo) {
32950 if (nodeIDs.length !== 2) {
32951 return "restriction";
32955 for (j2 = 0; j2 < memberWays.length; j2++) {
32956 way = memberWays[j2];
32957 if (way.contains(nodeIDs[0])) {
32960 if (way.contains(nodeIDs[1])) {
32966 for (j2 = 0; j2 < memberWays.length; j2++) {
32967 way = memberWays[j2];
32968 if (way.areAdjacent(n0, n1)) {
32974 return "restriction";
32978 for (j2 = 0; j2 < memberWays.length; j2++) {
32979 way = memberWays[j2].update({});
32980 for (k2 = 0; k2 < nodeIDs.length; k2++) {
32981 if (nodeIDs[k2] === survivor.id)
32983 if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
32984 way = way.removeNode(nodeIDs[k2]);
32986 way = way.replaceNode(nodeIDs[k2], survivor.id);
32989 if (way.isDegenerate()) {
32990 return "restriction";
32995 function hasDuplicates(n4, i4, arr) {
32996 return arr.indexOf(n4) !== arr.lastIndexOf(n4);
32998 function keyNodeFilter(froms, tos) {
32999 return function(n4) {
33000 return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
33003 function collectNodes(member, collection) {
33004 var entity = graph.hasEntity(member.id);
33007 var role2 = member.role || "";
33008 if (!collection[role2]) {
33009 collection[role2] = [];
33011 if (member.type === "node") {
33012 collection[role2].push(member.id);
33013 if (role2 === "via") {
33014 collection.keyfrom.push(member.id);
33015 collection.keyto.push(member.id);
33017 } else if (member.type === "way") {
33018 collection[role2].push.apply(collection[role2], entity.nodes);
33019 if (role2 === "from" || role2 === "via") {
33020 collection.keyfrom.push(entity.first());
33021 collection.keyfrom.push(entity.last());
33023 if (role2 === "to" || role2 === "via") {
33024 collection.keyto.push(entity.first());
33025 collection.keyto.push(entity.last());
33033 // modules/actions/copy_entities.js
33034 function actionCopyEntities(ids, fromGraph) {
33036 var action = function(graph) {
33037 ids.forEach(function(id3) {
33038 fromGraph.entity(id3).copy(fromGraph, _copies);
33040 for (var id2 in _copies) {
33041 graph = graph.replace(_copies[id2]);
33045 action.copies = function() {
33051 // modules/actions/delete_member.js
33052 function actionDeleteMember(relationId, memberIndex) {
33053 return function(graph) {
33054 var relation = graph.entity(relationId).removeMember(memberIndex);
33055 graph = graph.replace(relation);
33056 if (relation.isDegenerate()) {
33057 graph = actionDeleteRelation(relation.id)(graph);
33063 // modules/actions/discard_tags.js
33064 function actionDiscardTags(difference2, discardTags) {
33065 discardTags = discardTags || {};
33066 return (graph) => {
33067 difference2.modified().forEach(checkTags);
33068 difference2.created().forEach(checkTags);
33070 function checkTags(entity) {
33071 const keys2 = Object.keys(entity.tags);
33072 let didDiscard = false;
33074 for (let i3 = 0; i3 < keys2.length; i3++) {
33075 const k2 = keys2[i3];
33076 if (discardTags[k2] || !entity.tags[k2]) {
33079 tags[k2] = entity.tags[k2];
33083 graph = graph.replace(entity.update({ tags }));
33089 // modules/actions/disconnect.js
33090 function actionDisconnect(nodeId, newNodeId) {
33092 var disconnectableRelationTypes = {
33093 "associatedStreet": true,
33094 "enforcement": true,
33097 var action = function(graph) {
33098 var node = graph.entity(nodeId);
33099 var connections = action.connections(graph);
33100 connections.forEach(function(connection) {
33101 var way = graph.entity(connection.wayID);
33102 var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
33103 graph = graph.replace(newNode);
33104 if (connection.index === 0 && way.isArea()) {
33105 graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
33106 } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
33107 graph = graph.replace(way.unclose().addNode(newNode.id));
33109 graph = graph.replace(way.updateNode(newNode.id, connection.index));
33114 action.connections = function(graph) {
33115 var candidates = [];
33116 var keeping = false;
33117 var parentWays = graph.parentWays(graph.entity(nodeId));
33119 for (var i3 = 0; i3 < parentWays.length; i3++) {
33120 way = parentWays[i3];
33121 if (wayIds && wayIds.indexOf(way.id) === -1) {
33125 if (way.isArea() && way.nodes[0] === nodeId) {
33126 candidates.push({ wayID: way.id, index: 0 });
33128 for (var j2 = 0; j2 < way.nodes.length; j2++) {
33129 waynode = way.nodes[j2];
33130 if (waynode === nodeId) {
33131 if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
33134 candidates.push({ wayID: way.id, index: j2 });
33139 return keeping ? candidates : candidates.slice(1);
33141 action.disabled = function(graph) {
33142 var connections = action.connections(graph);
33143 if (connections.length === 0)
33144 return "not_connected";
33145 var parentWays = graph.parentWays(graph.entity(nodeId));
33146 var seenRelationIds = {};
33147 var sharedRelation;
33148 parentWays.forEach(function(way) {
33149 var relations = graph.parentRelations(way);
33150 relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
33151 if (relation.id in seenRelationIds) {
33153 if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
33154 sharedRelation = relation;
33157 sharedRelation = relation;
33160 seenRelationIds[relation.id] = way.id;
33164 if (sharedRelation)
33167 action.limitWays = function(val) {
33168 if (!arguments.length)
33176 // modules/actions/extract.js
33177 function actionExtract(entityID, projection2) {
33178 var extractedNodeID;
33179 var action = function(graph) {
33180 var entity = graph.entity(entityID);
33181 if (entity.type === "node") {
33182 return extractFromNode(entity, graph);
33184 return extractFromWayOrRelation(entity, graph);
33186 function extractFromNode(node, graph) {
33187 extractedNodeID = node.id;
33188 var replacement = osmNode({ loc: node.loc });
33189 graph = graph.replace(replacement);
33190 graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
33191 return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
33193 return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
33194 return accGraph.replace(parentRel.replaceMember(node, replacement));
33197 function extractFromWayOrRelation(entity, graph) {
33198 var fromGeometry = entity.geometry(graph);
33199 var keysToCopyAndRetain = ["source", "wheelchair"];
33200 var keysToRetain = ["area"];
33201 var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
33202 var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
33203 extractedLoc = extractedLoc && projection2.invert(extractedLoc);
33204 if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
33205 extractedLoc = entity.extent(graph).center();
33207 var indoorAreaValues = {
33214 var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
33215 var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
33216 var entityTags = Object.assign({}, entity.tags);
33217 var pointTags = {};
33218 for (var key in entityTags) {
33219 if (entity.type === "relation" && key === "type") {
33222 if (keysToRetain.indexOf(key) !== -1) {
33226 if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
33229 if (isIndoorArea && key === "indoor") {
33232 pointTags[key] = entityTags[key];
33233 if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
33235 } else if (isIndoorArea && key === "level") {
33238 delete entityTags[key];
33240 if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
33241 entityTags.area = "yes";
33243 var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
33244 graph = graph.replace(replacement);
33245 extractedNodeID = replacement.id;
33246 return graph.replace(entity.update({ tags: entityTags }));
33248 action.getExtractedNodeID = function() {
33249 return extractedNodeID;
33254 // modules/actions/join.js
33255 function actionJoin(ids) {
33256 function groupEntitiesByGeometry(graph) {
33257 var entities = ids.map(function(id2) {
33258 return graph.entity(id2);
33260 return Object.assign(
33262 utilArrayGroupBy(entities, function(entity) {
33263 return entity.geometry(graph);
33267 var action = function(graph) {
33268 var ways = ids.map(graph.entity, graph);
33269 var survivorID = utilOldestID(ways.map((way) => way.id));
33270 ways.sort(function(a2, b2) {
33271 var aSided = a2.isSided();
33272 var bSided = b2.isSided();
33273 return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
33275 var sequences = osmJoinWays(ways, graph);
33276 var joined = sequences[0];
33277 graph = sequences.actions.reduce(function(g3, action2) {
33278 return action2(g3);
33280 var survivor = graph.entity(survivorID);
33281 survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
33284 graph = graph.replace(survivor);
33285 joined.forEach(function(way) {
33286 if (way.id === survivorID)
33288 graph.parentRelations(way).forEach(function(parent) {
33289 graph = graph.replace(parent.replaceMember(way, survivor));
33291 survivor = survivor.mergeTags(way.tags);
33292 graph = graph.replace(survivor);
33293 graph = actionDeleteWay(way.id)(graph);
33295 function checkForSimpleMultipolygon() {
33296 if (!survivor.isClosed())
33298 var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
33299 return multipolygon2.members.length === 1;
33301 if (multipolygons.length !== 1)
33303 var multipolygon = multipolygons[0];
33304 for (var key in survivor.tags) {
33305 if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
33306 multipolygon.tags[key] !== survivor.tags[key])
33309 survivor = survivor.mergeTags(multipolygon.tags);
33310 graph = graph.replace(survivor);
33311 graph = actionDeleteRelation(
33314 /* allow untagged members */
33316 var tags = Object.assign({}, survivor.tags);
33317 if (survivor.geometry(graph) !== "area") {
33321 survivor = survivor.update({ tags });
33322 graph = graph.replace(survivor);
33324 checkForSimpleMultipolygon();
33327 action.resultingWayNodesLength = function(graph) {
33328 return ids.reduce(function(count, id2) {
33329 return count + graph.entity(id2).nodes.length;
33330 }, 0) - ids.length - 1;
33332 action.disabled = function(graph) {
33333 var geometries = groupEntitiesByGeometry(graph);
33334 if (ids.length < 2 || ids.length !== geometries.line.length) {
33335 return "not_eligible";
33337 var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
33338 if (joined.length > 1) {
33339 return "not_adjacent";
33342 var sortedParentRelations = function(id2) {
33343 return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
33345 var relsA = sortedParentRelations(ids[0]);
33346 for (i3 = 1; i3 < ids.length; i3++) {
33347 var relsB = sortedParentRelations(ids[i3]);
33348 if (!utilArrayIdentical(relsA, relsB)) {
33349 return "conflicting_relations";
33352 for (i3 = 0; i3 < ids.length - 1; i3++) {
33353 for (var j2 = i3 + 1; j2 < ids.length; j2++) {
33354 var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
33357 var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e3) {
33360 var intersections = geoPathIntersections(path1, path2);
33361 var common = utilArrayIntersection(
33362 joined[0].nodes.map(function(n3) {
33363 return n3.loc.toString();
33365 intersections.map(function(n3) {
33366 return n3.toString();
33369 if (common.length !== intersections.length) {
33370 return "paths_intersect";
33374 var nodeIds = joined[0].nodes.map(function(n3) {
33379 var conflicting = false;
33380 joined[0].forEach(function(way) {
33381 var parents = graph.parentRelations(way);
33382 parents.forEach(function(parent) {
33383 if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
33384 return nodeIds.indexOf(m2.id) >= 0;
33389 for (var k2 in way.tags) {
33390 if (!(k2 in tags)) {
33391 tags[k2] = way.tags[k2];
33392 } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
33393 conflicting = true;
33398 return relation.isRestriction() ? "restriction" : "connectivity";
33401 return "conflicting_tags";
33407 // modules/actions/merge.js
33408 function actionMerge(ids) {
33409 function groupEntitiesByGeometry(graph) {
33410 var entities = ids.map(function(id2) {
33411 return graph.entity(id2);
33413 return Object.assign(
33414 { point: [], area: [], line: [], relation: [] },
33415 utilArrayGroupBy(entities, function(entity) {
33416 return entity.geometry(graph);
33420 var action = function(graph) {
33421 var geometries = groupEntitiesByGeometry(graph);
33422 var target = geometries.area[0] || geometries.line[0];
33423 var points = geometries.point;
33424 points.forEach(function(point2) {
33425 target = target.mergeTags(point2.tags);
33426 graph = graph.replace(target);
33427 graph.parentRelations(point2).forEach(function(parent) {
33428 graph = graph.replace(parent.replaceMember(point2, target));
33430 var nodes = utilArrayUniq(graph.childNodes(target));
33431 var removeNode = point2;
33432 if (!point2.isNew()) {
33433 var inserted = false;
33434 var canBeReplaced = function(node2) {
33435 return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
33437 var replaceNode = function(node2) {
33438 graph = graph.replace(point2.update({ tags: node2.tags, loc: node2.loc }));
33439 target = target.replaceNode(node2.id, point2.id);
33440 graph = graph.replace(target);
33441 removeNode = node2;
33446 for (i3 = 0; i3 < nodes.length; i3++) {
33448 if (canBeReplaced(node) && node.isNew()) {
33453 if (!inserted && point2.hasInterestingTags()) {
33454 for (i3 = 0; i3 < nodes.length; i3++) {
33456 if (canBeReplaced(node) && !node.hasInterestingTags()) {
33462 for (i3 = 0; i3 < nodes.length; i3++) {
33464 if (canBeReplaced(node) && utilCompareIDs(point2.id, node.id) < 0) {
33472 graph = graph.remove(removeNode);
33474 if (target.tags.area === "yes") {
33475 var tags = Object.assign({}, target.tags);
33477 if (osmTagSuggestingArea(tags)) {
33478 target = target.update({ tags });
33479 graph = graph.replace(target);
33484 action.disabled = function(graph) {
33485 var geometries = groupEntitiesByGeometry(graph);
33486 if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
33487 return "not_eligible";
33493 // modules/actions/merge_nodes.js
33494 function actionMergeNodes(nodeIDs, loc) {
33495 function chooseLoc(graph) {
33496 if (!nodeIDs.length)
33499 var interestingCount = 0;
33500 var interestingLoc;
33501 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
33502 var node = graph.entity(nodeIDs[i3]);
33503 if (node.hasInterestingTags()) {
33504 interestingLoc = ++interestingCount === 1 ? node.loc : null;
33506 sum = geoVecAdd(sum, node.loc);
33508 return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
33510 var action = function(graph) {
33511 if (nodeIDs.length < 2)
33515 toLoc = chooseLoc(graph);
33517 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
33518 var node = graph.entity(nodeIDs[i3]);
33519 if (node.loc !== toLoc) {
33520 graph = graph.replace(node.move(toLoc));
33523 return actionConnect(nodeIDs)(graph);
33525 action.disabled = function(graph) {
33526 if (nodeIDs.length < 2)
33527 return "not_eligible";
33528 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
33529 var entity = graph.entity(nodeIDs[i3]);
33530 if (entity.type !== "node")
33531 return "not_eligible";
33533 return actionConnect(nodeIDs).disabled(graph);
33538 // modules/osm/changeset.js
33539 function osmChangeset() {
33540 if (!(this instanceof osmChangeset)) {
33541 return new osmChangeset().initialize(arguments);
33542 } else if (arguments.length) {
33543 this.initialize(arguments);
33546 osmEntity.changeset = osmChangeset;
33547 osmChangeset.prototype = Object.create(osmEntity.prototype);
33548 Object.assign(osmChangeset.prototype, {
33550 extent: function() {
33551 return new geoExtent();
33553 geometry: function() {
33554 return "changeset";
33556 asJXON: function() {
33560 tag: Object.keys(this.tags).map(function(k2) {
33561 return { "@k": k2, "@v": this.tags[k2] };
33569 // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
33570 // XML. Returns a string.
33571 osmChangeJXON: function(changes) {
33572 var changeset_id = this.id;
33573 function nest(x2, order) {
33575 for (var i3 = 0; i3 < x2.length; i3++) {
33576 var tagName = Object.keys(x2[i3])[0];
33577 if (!groups[tagName])
33578 groups[tagName] = [];
33579 groups[tagName].push(x2[i3][tagName]);
33582 order.forEach(function(o2) {
33584 ordered[o2] = groups[o2];
33588 function sort(changes2) {
33589 function resolve(item) {
33590 return relations.find(function(relation2) {
33591 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
33594 function isNew(item) {
33595 return !sorted[item["@id"]] && !processing.find(function(proc) {
33596 return proc["@id"] === item["@id"];
33599 var processing = [];
33601 var relations = changes2.relation;
33604 for (var i3 = 0; i3 < relations.length; i3++) {
33605 var relation = relations[i3];
33606 if (!sorted[relation["@id"]]) {
33607 processing.push(relation);
33609 while (processing.length > 0) {
33610 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
33611 if (deps.length === 0) {
33612 sorted[next["@id"]] = next;
33613 processing.shift();
33615 processing = deps.concat(processing);
33619 changes2.relation = Object.values(sorted);
33622 function rep(entity) {
33623 return entity.asJXON(changeset_id);
33628 "@generator": "iD",
33629 "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
33630 "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
33631 "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
33635 asGeoJSON: function() {
33640 // modules/osm/note.js
33641 function osmNote() {
33642 if (!(this instanceof osmNote)) {
33643 return new osmNote().initialize(arguments);
33644 } else if (arguments.length) {
33645 this.initialize(arguments);
33648 osmNote.id = function() {
33649 return osmNote.id.next--;
33651 osmNote.id.next = -1;
33652 Object.assign(osmNote.prototype, {
33654 initialize: function(sources) {
33655 for (var i3 = 0; i3 < sources.length; ++i3) {
33656 var source = sources[i3];
33657 for (var prop in source) {
33658 if (Object.prototype.hasOwnProperty.call(source, prop)) {
33659 if (source[prop] === void 0) {
33662 this[prop] = source[prop];
33668 this.id = osmNote.id().toString();
33672 extent: function() {
33673 return new geoExtent(this.loc);
33675 update: function(attrs) {
33676 return osmNote(this, attrs);
33678 isNew: function() {
33679 return this.id < 0;
33681 move: function(loc) {
33682 return this.update({ loc });
33686 // modules/osm/relation.js
33687 function osmRelation() {
33688 if (!(this instanceof osmRelation)) {
33689 return new osmRelation().initialize(arguments);
33690 } else if (arguments.length) {
33691 this.initialize(arguments);
33694 osmEntity.relation = osmRelation;
33695 osmRelation.prototype = Object.create(osmEntity.prototype);
33696 osmRelation.creationOrder = function(a2, b2) {
33697 var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
33698 var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
33699 if (aId < 0 || bId < 0)
33703 Object.assign(osmRelation.prototype, {
33706 copy: function(resolver, copies) {
33707 if (copies[this.id])
33708 return copies[this.id];
33709 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
33710 var members = this.members.map(function(member) {
33711 return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
33713 copy2 = copy2.update({ members });
33714 copies[this.id] = copy2;
33717 extent: function(resolver, memo) {
33718 return resolver.transient(this, "extent", function() {
33719 if (memo && memo[this.id])
33720 return geoExtent();
33722 memo[this.id] = true;
33723 var extent = geoExtent();
33724 for (var i3 = 0; i3 < this.members.length; i3++) {
33725 var member = resolver.hasEntity(this.members[i3].id);
33727 extent._extend(member.extent(resolver, memo));
33733 geometry: function(graph) {
33734 return graph.transient(this, "geometry", function() {
33735 return this.isMultipolygon() ? "area" : "relation";
33738 isDegenerate: function() {
33739 return this.members.length === 0;
33741 // Return an array of members, each extended with an 'index' property whose value
33742 // is the member index.
33743 indexedMembers: function() {
33744 var result = new Array(this.members.length);
33745 for (var i3 = 0; i3 < this.members.length; i3++) {
33746 result[i3] = Object.assign({}, this.members[i3], { index: i3 });
33750 // Return the first member with the given role. A copy of the member object
33751 // is returned, extended with an 'index' property whose value is the member index.
33752 memberByRole: function(role) {
33753 for (var i3 = 0; i3 < this.members.length; i3++) {
33754 if (this.members[i3].role === role) {
33755 return Object.assign({}, this.members[i3], { index: i3 });
33759 // Same as memberByRole, but returns all members with the given role
33760 membersByRole: function(role) {
33762 for (var i3 = 0; i3 < this.members.length; i3++) {
33763 if (this.members[i3].role === role) {
33764 result.push(Object.assign({}, this.members[i3], { index: i3 }));
33769 // Return the first member with the given id. A copy of the member object
33770 // is returned, extended with an 'index' property whose value is the member index.
33771 memberById: function(id2) {
33772 for (var i3 = 0; i3 < this.members.length; i3++) {
33773 if (this.members[i3].id === id2) {
33774 return Object.assign({}, this.members[i3], { index: i3 });
33778 // Return the first member with the given id and role. A copy of the member object
33779 // is returned, extended with an 'index' property whose value is the member index.
33780 memberByIdAndRole: function(id2, role) {
33781 for (var i3 = 0; i3 < this.members.length; i3++) {
33782 if (this.members[i3].id === id2 && this.members[i3].role === role) {
33783 return Object.assign({}, this.members[i3], { index: i3 });
33787 addMember: function(member, index) {
33788 var members = this.members.slice();
33789 members.splice(index === void 0 ? members.length : index, 0, member);
33790 return this.update({ members });
33792 updateMember: function(member, index) {
33793 var members = this.members.slice();
33794 members.splice(index, 1, Object.assign({}, members[index], member));
33795 return this.update({ members });
33797 removeMember: function(index) {
33798 var members = this.members.slice();
33799 members.splice(index, 1);
33800 return this.update({ members });
33802 removeMembersWithID: function(id2) {
33803 var members = this.members.filter(function(m2) {
33804 return m2.id !== id2;
33806 return this.update({ members });
33808 moveMember: function(fromIndex, toIndex) {
33809 var members = this.members.slice();
33810 members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
33811 return this.update({ members });
33813 // Wherever a member appears with id `needle.id`, replace it with a member
33814 // with id `replacement.id`, type `replacement.type`, and the original role,
33815 // By default, adding a duplicate member (by id and role) is prevented.
33816 // Return an updated relation.
33817 replaceMember: function(needle, replacement, keepDuplicates) {
33818 if (!this.memberById(needle.id))
33821 for (var i3 = 0; i3 < this.members.length; i3++) {
33822 var member = this.members[i3];
33823 if (member.id !== needle.id) {
33824 members.push(member);
33825 } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
33826 members.push({ id: replacement.id, type: replacement.type, role: member.role });
33829 return this.update({ members });
33831 asJXON: function(changeset_id) {
33834 "@id": this.osmId(),
33835 "@version": this.version || 0,
33836 member: this.members.map(function(member) {
33841 ref: osmEntity.id.toOSM(member.id)
33845 tag: Object.keys(this.tags).map(function(k2) {
33846 return { keyAttributes: { k: k2, v: this.tags[k2] } };
33850 if (changeset_id) {
33851 r2.relation["@changeset"] = changeset_id;
33855 asGeoJSON: function(resolver) {
33856 return resolver.transient(this, "GeoJSON", function() {
33857 if (this.isMultipolygon()) {
33859 type: "MultiPolygon",
33860 coordinates: this.multipolygon(resolver)
33864 type: "FeatureCollection",
33865 properties: this.tags,
33866 features: this.members.map(function(member) {
33867 return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
33873 area: function(resolver) {
33874 return resolver.transient(this, "area", function() {
33875 return area_default(this.asGeoJSON(resolver));
33878 isMultipolygon: function() {
33879 return this.tags.type === "multipolygon";
33881 isComplete: function(resolver) {
33882 for (var i3 = 0; i3 < this.members.length; i3++) {
33883 if (!resolver.hasEntity(this.members[i3].id)) {
33889 hasFromViaTo: function() {
33890 return this.members.some(function(m2) {
33891 return m2.role === "from";
33892 }) && this.members.some(function(m2) {
33893 return m2.role === "via";
33894 }) && this.members.some(function(m2) {
33895 return m2.role === "to";
33898 isRestriction: function() {
33899 return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
33901 isValidRestriction: function() {
33902 if (!this.isRestriction())
33904 var froms = this.members.filter(function(m2) {
33905 return m2.role === "from";
33907 var vias = this.members.filter(function(m2) {
33908 return m2.role === "via";
33910 var tos = this.members.filter(function(m2) {
33911 return m2.role === "to";
33913 if (froms.length !== 1 && this.tags.restriction !== "no_entry")
33915 if (froms.some(function(m2) {
33916 return m2.type !== "way";
33919 if (tos.length !== 1 && this.tags.restriction !== "no_exit")
33921 if (tos.some(function(m2) {
33922 return m2.type !== "way";
33925 if (vias.length === 0)
33927 if (vias.length > 1 && vias.some(function(m2) {
33928 return m2.type !== "way";
33933 isConnectivity: function() {
33934 return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
33936 // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
33937 // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
33939 // This corresponds to the structure needed for rendering a multipolygon path using a
33940 // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
33942 // In the case of invalid geometries, this function will still return a result which
33943 // includes the nodes of all way members, but some Nds may be unclosed and some inner
33944 // rings not matched with the intended outer ring.
33946 multipolygon: function(resolver) {
33947 var outers = this.members.filter(function(m2) {
33948 return "outer" === (m2.role || "outer");
33950 var inners = this.members.filter(function(m2) {
33951 return "inner" === m2.role;
33953 outers = osmJoinWays(outers, resolver);
33954 inners = osmJoinWays(inners, resolver);
33955 var sequenceToLineString = function(sequence) {
33956 if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
33957 sequence.nodes.push(sequence.nodes[0]);
33959 return sequence.nodes.map(function(node) {
33963 outers = outers.map(sequenceToLineString);
33964 inners = inners.map(sequenceToLineString);
33965 var result = outers.map(function(o3) {
33966 return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
33968 function findOuter(inner2) {
33970 for (o3 = 0; o3 < outers.length; o3++) {
33971 outer = outers[o3];
33972 if (geoPolygonContainsPolygon(outer, inner2)) {
33976 for (o3 = 0; o3 < outers.length; o3++) {
33977 outer = outers[o3];
33978 if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
33983 for (var i3 = 0; i3 < inners.length; i3++) {
33984 var inner = inners[i3];
33985 if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
33986 inner = inner.reverse();
33988 var o2 = findOuter(inners[i3]);
33989 if (o2 !== void 0) {
33990 result[o2].push(inners[i3]);
33992 result.push([inners[i3]]);
33999 // modules/osm/qa_item.js
34000 var QAItem = class _QAItem {
34001 constructor(loc, service, itemType, id2, props) {
34003 this.service = service.title;
34004 this.itemType = itemType;
34005 this.id = id2 ? id2 : "".concat(_QAItem.id());
34006 this.update(props);
34007 if (service && typeof service.getIcon === "function") {
34008 this.icon = service.getIcon(itemType);
34012 const { loc, service, itemType, id: id2 } = this;
34013 Object.keys(props).forEach((prop) => this[prop] = props[prop]);
34015 this.service = service;
34016 this.itemType = itemType;
34020 // Generic handling for newly created QAItems
34022 return this.nextId--;
34025 QAItem.nextId = -1;
34027 // modules/actions/split.js
34028 function actionSplit(nodeIds, newWayIds) {
34029 if (typeof nodeIds === "string")
34030 nodeIds = [nodeIds];
34032 var _keepHistoryOn = "longest";
34033 const circularJunctions = ["roundabout", "circular"];
34034 var _createdWayIDs = [];
34035 function dist(graph, nA, nB) {
34036 var locA = graph.entity(nA).loc;
34037 var locB = graph.entity(nB).loc;
34038 var epsilon3 = 1e-6;
34039 return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
34041 function splitArea(nodes, idxA, graph) {
34042 var lengths = new Array(nodes.length);
34047 function wrap2(index) {
34048 return utilWrap(index, nodes.length);
34051 for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
34052 length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
34053 lengths[i3] = length2;
34056 for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
34057 length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
34058 if (length2 < lengths[i3]) {
34059 lengths[i3] = length2;
34062 for (i3 = 0; i3 < nodes.length; i3++) {
34063 var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
34071 function totalLengthBetweenNodes(graph, nodes) {
34072 var totalLength = 0;
34073 for (var i3 = 0; i3 < nodes.length - 1; i3++) {
34074 totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
34076 return totalLength;
34078 function split(graph, nodeId, wayA, newWayId) {
34079 var wayB = osmWay({ id: newWayId, tags: wayA.tags });
34082 var isArea = wayA.isArea();
34083 if (wayA.isClosed()) {
34084 var nodes = wayA.nodes.slice(0, -1);
34085 var idxA = nodes.indexOf(nodeId);
34086 var idxB = splitArea(nodes, idxA, graph);
34088 nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
34089 nodesB = nodes.slice(idxB, idxA + 1);
34091 nodesA = nodes.slice(idxA, idxB + 1);
34092 nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
34095 var idx = wayA.nodes.indexOf(nodeId, 1);
34096 nodesA = wayA.nodes.slice(0, idx + 1);
34097 nodesB = wayA.nodes.slice(idx);
34099 var lengthA = totalLengthBetweenNodes(graph, nodesA);
34100 var lengthB = totalLengthBetweenNodes(graph, nodesB);
34101 if (_keepHistoryOn === "longest" && lengthB > lengthA) {
34102 wayA = wayA.update({ nodes: nodesB });
34103 wayB = wayB.update({ nodes: nodesA });
34104 var temp = lengthA;
34108 wayA = wayA.update({ nodes: nodesA });
34109 wayB = wayB.update({ nodes: nodesB });
34111 if (wayA.tags.step_count) {
34112 var stepCount = Number(wayA.tags.step_count);
34113 if (stepCount && // ensure a number
34114 isFinite(stepCount) && // ensure positive
34115 stepCount > 0 && // ensure integer
34116 Math.round(stepCount) === stepCount) {
34117 var tagsA = Object.assign({}, wayA.tags);
34118 var tagsB = Object.assign({}, wayB.tags);
34119 var ratioA = lengthA / (lengthA + lengthB);
34120 var countA = Math.round(stepCount * ratioA);
34121 tagsA.step_count = countA.toString();
34122 tagsB.step_count = (stepCount - countA).toString();
34123 wayA = wayA.update({ tags: tagsA });
34124 wayB = wayB.update({ tags: tagsB });
34127 graph = graph.replace(wayA);
34128 graph = graph.replace(wayB);
34129 graph.parentRelations(wayA).forEach(function(relation) {
34130 if (relation.hasFromViaTo()) {
34131 var f2 = relation.memberByRole("from");
34132 var v2 = relation.membersByRole("via");
34133 var t2 = relation.memberByRole("to");
34135 if (f2.id === wayA.id || t2.id === wayA.id) {
34137 if (v2.length === 1 && v2[0].type === "node") {
34138 keepB = wayB.contains(v2[0].id);
34140 for (i3 = 0; i3 < v2.length; i3++) {
34141 if (v2[i3].type === "way") {
34142 var wayVia = graph.hasEntity(v2[i3].id);
34143 if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
34151 relation = relation.replaceMember(wayA, wayB);
34152 graph = graph.replace(relation);
34155 for (i3 = 0; i3 < v2.length; i3++) {
34156 if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
34157 graph = splitWayMember(graph, relation.id, wayA, wayB);
34162 graph = splitWayMember(graph, relation.id, wayA, wayB);
34166 var multipolygon = osmRelation({
34167 tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
34169 { id: wayA.id, role: "outer", type: "way" },
34170 { id: wayB.id, role: "outer", type: "way" }
34173 graph = graph.replace(multipolygon);
34174 graph = graph.replace(wayA.update({ tags: {} }));
34175 graph = graph.replace(wayB.update({ tags: {} }));
34177 _createdWayIDs.push(wayB.id);
34180 function splitWayMember(graph, relationId, wayA, wayB) {
34181 function connects(way1, way2) {
34182 if (way1.nodes.length < 2 || way2.nodes.length < 2)
34184 if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
34185 return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
34186 } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
34187 return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
34189 if (way1.nodes[0] === way2.nodes[0])
34191 if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1])
34193 if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1])
34195 if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0])
34199 let relation = graph.entity(relationId);
34200 const insertMembers = [];
34201 const members = relation.members;
34202 for (let i3 = 0; i3 < members.length; i3++) {
34203 const member = members[i3];
34204 if (member.id === wayA.id) {
34205 let wayAconnectsPrev = false;
34206 let wayAconnectsNext = false;
34207 let wayBconnectsPrev = false;
34208 let wayBconnectsNext = false;
34209 if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
34210 const prevEntity = graph.entity(members[i3 - 1].id);
34211 if (prevEntity.type === "way") {
34212 wayAconnectsPrev = connects(prevEntity, wayA);
34213 wayBconnectsPrev = connects(prevEntity, wayB);
34216 if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
34217 const nextEntity = graph.entity(members[i3 + 1].id);
34218 if (nextEntity.type === "way") {
34219 wayAconnectsNext = connects(nextEntity, wayA);
34220 wayBconnectsNext = connects(nextEntity, wayB);
34223 if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
34224 insertMembers.push({ at: i3 + 1, role: member.role });
34227 if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
34228 insertMembers.push({ at: i3, role: member.role });
34231 if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
34232 if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
34233 const prev2Entity = graph.entity(members[i3 - 2].id);
34234 if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
34235 insertMembers.push({ at: i3, role: member.role });
34238 if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
34239 insertMembers.push({ at: i3 + 1, role: member.role });
34243 if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
34244 const next2Entity = graph.entity(members[i3 + 2].id);
34245 if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
34246 insertMembers.push({ at: i3 + 1, role: member.role });
34249 if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
34250 insertMembers.push({ at: i3, role: member.role });
34255 if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
34256 insertMembers.push({ at: i3 + 1, role: member.role });
34258 insertMembers.push({ at: i3, role: member.role });
34262 insertMembers.reverse().forEach((item) => {
34263 graph = graph.replace(relation.addMember({
34268 relation = graph.entity(relation.id);
34272 var action = function(graph) {
34273 _createdWayIDs = [];
34274 var newWayIndex = 0;
34275 for (var i3 = 0; i3 < nodeIds.length; i3++) {
34276 var nodeId = nodeIds[i3];
34277 var candidates = action.waysForNode(nodeId, graph);
34278 for (var j2 = 0; j2 < candidates.length; j2++) {
34279 graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
34285 action.getCreatedWayIDs = function() {
34286 return _createdWayIDs;
34288 action.waysForNode = function(nodeId, graph) {
34289 var node = graph.entity(nodeId);
34290 var splittableParents = graph.parentWays(node).filter(isSplittable);
34292 var hasLine = splittableParents.some(function(parent) {
34293 return parent.geometry(graph) === "line";
34296 return splittableParents.filter(function(parent) {
34297 return parent.geometry(graph) === "line";
34301 return splittableParents;
34302 function isSplittable(parent) {
34303 if (_wayIDs && _wayIDs.indexOf(parent.id) === -1)
34305 if (parent.isClosed())
34307 for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
34308 if (parent.nodes[i3] === nodeId)
34314 action.ways = function(graph) {
34315 return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
34316 return action.waysForNode(nodeId, graph);
34319 action.disabled = function(graph) {
34320 for (const nodeId of nodeIds) {
34321 const candidates = action.waysForNode(nodeId, graph);
34322 if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
34323 return "not_eligible";
34325 for (const way of candidates) {
34326 const parentRelations = graph.parentRelations(way);
34327 for (const parentRelation of parentRelations) {
34328 if (parentRelation.hasFromViaTo()) {
34329 const vias = parentRelation.membersByRole("via");
34330 if (!vias.every((via) => graph.hasEntity(via.id))) {
34331 return "parent_incomplete";
34334 for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
34335 if (parentRelation.members[i3].id === way.id) {
34336 const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
34337 const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
34338 if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
34339 return "parent_incomplete";
34344 const relTypesExceptions = ["junction", "enforcement"];
34345 if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
34346 return "simple_roundabout";
34352 action.limitWays = function(val) {
34353 if (!arguments.length)
34358 action.keepHistoryOn = function(val) {
34359 if (!arguments.length)
34360 return _keepHistoryOn;
34361 _keepHistoryOn = val;
34367 // modules/core/graph.js
34368 function coreGraph(other, mutable) {
34369 if (!(this instanceof coreGraph))
34370 return new coreGraph(other, mutable);
34371 if (other instanceof coreGraph) {
34372 var base = other.base();
34373 this.entities = Object.assign(Object.create(base.entities), other.entities);
34374 this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
34375 this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
34377 this.entities = /* @__PURE__ */ Object.create({});
34378 this._parentWays = /* @__PURE__ */ Object.create({});
34379 this._parentRels = /* @__PURE__ */ Object.create({});
34380 this.rebase(other || [], [this]);
34382 this.transients = {};
34383 this._childNodes = {};
34384 this.frozen = !mutable;
34386 coreGraph.prototype = {
34387 hasEntity: function(id2) {
34388 return this.entities[id2];
34390 entity: function(id2) {
34391 var entity = this.entities[id2];
34393 entity = this.entities.__proto__[id2];
34396 throw new Error("entity " + id2 + " not found");
34400 geometry: function(id2) {
34401 return this.entity(id2).geometry(this);
34403 transient: function(entity, key, fn) {
34404 var id2 = entity.id;
34405 var transients = this.transients[id2] || (this.transients[id2] = {});
34406 if (transients[key] !== void 0) {
34407 return transients[key];
34409 transients[key] = fn.call(entity);
34410 return transients[key];
34412 parentWays: function(entity) {
34413 var parents = this._parentWays[entity.id];
34416 parents.forEach(function(id2) {
34417 result.push(this.entity(id2));
34422 isPoi: function(entity) {
34423 var parents = this._parentWays[entity.id];
34424 return !parents || parents.size === 0;
34426 isShared: function(entity) {
34427 var parents = this._parentWays[entity.id];
34428 return parents && parents.size > 1;
34430 parentRelations: function(entity) {
34431 var parents = this._parentRels[entity.id];
34434 parents.forEach(function(id2) {
34435 result.push(this.entity(id2));
34440 parentMultipolygons: function(entity) {
34441 return this.parentRelations(entity).filter(function(relation) {
34442 return relation.isMultipolygon();
34445 childNodes: function(entity) {
34446 if (this._childNodes[entity.id])
34447 return this._childNodes[entity.id];
34451 for (var i3 = 0; i3 < entity.nodes.length; i3++) {
34452 nodes[i3] = this.entity(entity.nodes[i3]);
34455 Object.freeze(nodes);
34456 this._childNodes[entity.id] = nodes;
34457 return this._childNodes[entity.id];
34461 "entities": Object.getPrototypeOf(this.entities),
34462 "parentWays": Object.getPrototypeOf(this._parentWays),
34463 "parentRels": Object.getPrototypeOf(this._parentRels)
34466 // Unlike other graph methods, rebase mutates in place. This is because it
34467 // is used only during the history operation that merges newly downloaded
34468 // data into each state. To external consumers, it should appear as if the
34469 // graph always contained the newly downloaded data.
34470 rebase: function(entities, stack, force) {
34471 var base = this.base();
34472 var i3, j2, k2, id2;
34473 for (i3 = 0; i3 < entities.length; i3++) {
34474 var entity = entities[i3];
34475 if (!entity.visible || !force && base.entities[entity.id])
34477 base.entities[entity.id] = entity;
34478 this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
34479 if (entity.type === "way") {
34480 for (j2 = 0; j2 < entity.nodes.length; j2++) {
34481 id2 = entity.nodes[j2];
34482 for (k2 = 1; k2 < stack.length; k2++) {
34483 var ents = stack[k2].entities;
34484 if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
34491 for (i3 = 0; i3 < stack.length; i3++) {
34492 stack[i3]._updateRebased();
34495 _updateRebased: function() {
34496 var base = this.base();
34497 Object.keys(this._parentWays).forEach(function(child) {
34498 if (base.parentWays[child]) {
34499 base.parentWays[child].forEach(function(id2) {
34500 if (!this.entities.hasOwnProperty(id2)) {
34501 this._parentWays[child].add(id2);
34506 Object.keys(this._parentRels).forEach(function(child) {
34507 if (base.parentRels[child]) {
34508 base.parentRels[child].forEach(function(id2) {
34509 if (!this.entities.hasOwnProperty(id2)) {
34510 this._parentRels[child].add(id2);
34515 this.transients = {};
34517 // Updates calculated properties (parentWays, parentRels) for the specified change
34518 _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
34519 parentWays = parentWays || this._parentWays;
34520 parentRels = parentRels || this._parentRels;
34521 var type2 = entity && entity.type || oldentity && oldentity.type;
34522 var removed, added, i3;
34523 if (type2 === "way") {
34524 if (oldentity && entity) {
34525 removed = utilArrayDifference(oldentity.nodes, entity.nodes);
34526 added = utilArrayDifference(entity.nodes, oldentity.nodes);
34527 } else if (oldentity) {
34528 removed = oldentity.nodes;
34530 } else if (entity) {
34532 added = entity.nodes;
34534 for (i3 = 0; i3 < removed.length; i3++) {
34535 parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
34536 parentWays[removed[i3]].delete(oldentity.id);
34538 for (i3 = 0; i3 < added.length; i3++) {
34539 parentWays[added[i3]] = new Set(parentWays[added[i3]]);
34540 parentWays[added[i3]].add(entity.id);
34542 } else if (type2 === "relation") {
34543 var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
34546 var entityMemberIDs = entity ? entity.members.map(function(m2) {
34549 if (oldentity && entity) {
34550 removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
34551 added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
34552 } else if (oldentity) {
34553 removed = oldentityMemberIDs;
34555 } else if (entity) {
34557 added = entityMemberIDs;
34559 for (i3 = 0; i3 < removed.length; i3++) {
34560 parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
34561 parentRels[removed[i3]].delete(oldentity.id);
34563 for (i3 = 0; i3 < added.length; i3++) {
34564 parentRels[added[i3]] = new Set(parentRels[added[i3]]);
34565 parentRels[added[i3]].add(entity.id);
34569 replace: function(entity) {
34570 if (this.entities[entity.id] === entity)
34572 return this.update(function() {
34573 this._updateCalculated(this.entities[entity.id], entity);
34574 this.entities[entity.id] = entity;
34577 remove: function(entity) {
34578 return this.update(function() {
34579 this._updateCalculated(entity, void 0);
34580 this.entities[entity.id] = void 0;
34583 revert: function(id2) {
34584 var baseEntity = this.base().entities[id2];
34585 var headEntity = this.entities[id2];
34586 if (headEntity === baseEntity)
34588 return this.update(function() {
34589 this._updateCalculated(headEntity, baseEntity);
34590 delete this.entities[id2];
34593 update: function() {
34594 var graph = this.frozen ? coreGraph(this, true) : this;
34595 for (var i3 = 0; i3 < arguments.length; i3++) {
34596 arguments[i3].call(graph, graph);
34599 graph.frozen = true;
34602 // Obliterates any existing entities
34603 load: function(entities) {
34604 var base = this.base();
34605 this.entities = Object.create(base.entities);
34606 for (var i3 in entities) {
34607 this.entities[i3] = entities[i3];
34608 this._updateCalculated(base.entities[i3], this.entities[i3]);
34614 // modules/osm/intersection.js
34615 function osmTurn(turn) {
34616 if (!(this instanceof osmTurn)) {
34617 return new osmTurn(turn);
34619 Object.assign(this, turn);
34621 function osmIntersection(graph, startVertexId, maxDistance) {
34622 maxDistance = maxDistance || 30;
34623 var vgraph = coreGraph();
34625 function memberOfRestriction(entity) {
34626 return graph.parentRelations(entity).some(function(r2) {
34627 return r2.isRestriction();
34630 function isRoad(way2) {
34631 if (way2.isArea() || way2.isDegenerate())
34635 "motorway_link": true,
34637 "trunk_link": true,
34639 "primary_link": true,
34641 "secondary_link": true,
34643 "tertiary_link": true,
34644 "residential": true,
34645 "unclassified": true,
34646 "living_street": true,
34652 return roads[way2.tags.highway];
34654 var startNode = graph.entity(startVertexId);
34655 var checkVertices = [startNode];
34658 var vertexIds = [];
34668 while (checkVertices.length) {
34669 vertex = checkVertices.pop();
34670 checkWays = graph.parentWays(vertex);
34671 var hasWays = false;
34672 for (i3 = 0; i3 < checkWays.length; i3++) {
34673 way = checkWays[i3];
34674 if (!isRoad(way) && !memberOfRestriction(way))
34678 nodes = utilArrayUniq(graph.childNodes(way));
34679 for (j2 = 0; j2 < nodes.length; j2++) {
34681 if (node === vertex)
34683 if (vertices.indexOf(node) !== -1)
34685 if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance)
34687 var hasParents = false;
34688 parents = graph.parentWays(node);
34689 for (k2 = 0; k2 < parents.length; k2++) {
34690 parent = parents[k2];
34691 if (parent === way)
34693 if (ways.indexOf(parent) !== -1)
34695 if (!isRoad(parent))
34701 checkVertices.push(node);
34706 vertices.push(vertex);
34709 vertices = utilArrayUniq(vertices);
34710 ways = utilArrayUniq(ways);
34711 ways.forEach(function(way2) {
34712 graph.childNodes(way2).forEach(function(node2) {
34713 vgraph = vgraph.replace(node2);
34715 vgraph = vgraph.replace(way2);
34716 graph.parentRelations(way2).forEach(function(relation) {
34717 if (relation.isRestriction()) {
34718 if (relation.isValidRestriction(graph)) {
34719 vgraph = vgraph.replace(relation);
34720 } else if (relation.isComplete(graph)) {
34721 actions.push(actionDeleteRelation(relation.id));
34726 ways.forEach(function(w2) {
34727 var way2 = vgraph.entity(w2.id);
34728 if (way2.tags.oneway === "-1") {
34729 var action = actionReverse(way2.id, { reverseOneway: true });
34730 actions.push(action);
34731 vgraph = action(vgraph);
34734 var origCount = osmEntity.id.next.way;
34735 vertices.forEach(function(v2) {
34736 var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
34737 if (!splitAll.disabled(vgraph)) {
34738 splitAll.ways(vgraph).forEach(function(way2) {
34739 var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
34740 actions.push(splitOne);
34741 vgraph = splitOne(vgraph);
34745 osmEntity.id.next.way = origCount;
34746 vertexIds = vertices.map(function(v2) {
34751 vertexIds.forEach(function(id2) {
34752 var vertex2 = vgraph.entity(id2);
34753 var parents2 = vgraph.parentWays(vertex2);
34754 vertices.push(vertex2);
34755 ways = ways.concat(parents2);
34757 vertices = utilArrayUniq(vertices);
34758 ways = utilArrayUniq(ways);
34759 vertexIds = vertices.map(function(v2) {
34762 wayIds = ways.map(function(w2) {
34765 function withMetadata(way2, vertexIds2) {
34766 var __oneWay = way2.isOneWay();
34767 var __first = vertexIds2.indexOf(way2.first()) !== -1;
34768 var __last = vertexIds2.indexOf(way2.last()) !== -1;
34769 var __via = __first && __last;
34770 var __from = __first && !__oneWay || __last;
34771 var __to = __first || __last && !__oneWay;
34772 return way2.update({
34782 wayIds.forEach(function(id2) {
34783 var way2 = withMetadata(vgraph.entity(id2), vertexIds);
34784 vgraph = vgraph.replace(way2);
34788 var removeWayIds = [];
34789 var removeVertexIds = [];
34792 checkVertices = vertexIds.slice();
34793 for (i3 = 0; i3 < checkVertices.length; i3++) {
34794 var vertexId = checkVertices[i3];
34795 vertex = vgraph.hasEntity(vertexId);
34797 if (vertexIds.indexOf(vertexId) !== -1) {
34798 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
34800 removeVertexIds.push(vertexId);
34803 parents = vgraph.parentWays(vertex);
34804 if (parents.length < 3) {
34805 if (vertexIds.indexOf(vertexId) !== -1) {
34806 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
34809 if (parents.length === 2) {
34810 var a2 = parents[0];
34811 var b2 = parents[1];
34812 var aIsLeaf = a2 && !a2.__via;
34813 var bIsLeaf = b2 && !b2.__via;
34814 var leaf, survivor;
34815 if (aIsLeaf && !bIsLeaf) {
34818 } else if (!aIsLeaf && bIsLeaf) {
34822 if (leaf && survivor) {
34823 survivor = withMetadata(survivor, vertexIds);
34824 vgraph = vgraph.replace(survivor).remove(leaf);
34825 removeWayIds.push(leaf.id);
34829 parents = vgraph.parentWays(vertex);
34830 if (parents.length < 2) {
34831 if (vertexIds.indexOf(vertexId) !== -1) {
34832 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
34834 removeVertexIds.push(vertexId);
34837 if (parents.length < 1) {
34838 vgraph = vgraph.remove(vertex);
34841 } while (keepGoing);
34842 vertices = vertices.filter(function(vertex2) {
34843 return removeVertexIds.indexOf(vertex2.id) === -1;
34844 }).map(function(vertex2) {
34845 return vgraph.entity(vertex2.id);
34847 ways = ways.filter(function(way2) {
34848 return removeWayIds.indexOf(way2.id) === -1;
34849 }).map(function(way2) {
34850 return vgraph.entity(way2.id);
34852 var intersection2 = {
34858 intersection2.turns = function(fromWayId, maxViaWay) {
34863 var vgraph2 = intersection2.graph;
34864 var keyVertexIds = intersection2.vertices.map(function(v2) {
34867 var start2 = vgraph2.entity(fromWayId);
34868 if (!start2 || !(start2.__from || start2.__via))
34870 var maxPathLength = maxViaWay * 2 + 3;
34874 function step(entity, currPath, currRestrictions, matchedRestriction) {
34875 currPath = (currPath || []).slice();
34876 if (currPath.length >= maxPathLength)
34878 currPath.push(entity.id);
34879 currRestrictions = (currRestrictions || []).slice();
34880 if (entity.type === "node") {
34881 stepNode(entity, currPath, currRestrictions);
34883 stepWay(entity, currPath, currRestrictions, matchedRestriction);
34886 function stepNode(entity, currPath, currRestrictions) {
34888 var parents2 = vgraph2.parentWays(entity);
34890 for (i4 = 0; i4 < parents2.length; i4++) {
34891 var way2 = parents2[i4];
34892 if (way2.__oneWay && way2.nodes[0] !== entity.id)
34894 if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3)
34896 var restrict = null;
34897 for (j3 = 0; j3 < currRestrictions.length; j3++) {
34898 var restriction = currRestrictions[j3];
34899 var f2 = restriction.memberByRole("from");
34900 var v2 = restriction.membersByRole("via");
34901 var t2 = restriction.memberByRole("to");
34902 var isNo = /^no_/.test(restriction.tags.restriction);
34903 var isOnly = /^only_/.test(restriction.tags.restriction);
34904 if (!(isNo || isOnly)) {
34907 var matchesFrom = f2.id === fromWayId;
34908 var matchesViaTo = false;
34909 var isAlongOnlyPath = false;
34910 if (t2.id === way2.id) {
34911 if (v2.length === 1 && v2[0].type === "node") {
34912 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
34915 for (k2 = 2; k2 < currPath.length; k2 += 2) {
34916 pathVias.push(currPath[k2]);
34918 var restrictionVias = [];
34919 for (k2 = 0; k2 < v2.length; k2++) {
34920 if (v2[k2].type === "way") {
34921 restrictionVias.push(v2[k2].id);
34924 var diff = utilArrayDifference(pathVias, restrictionVias);
34925 matchesViaTo = !diff.length;
34927 } else if (isOnly) {
34928 for (k2 = 0; k2 < v2.length; k2++) {
34929 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
34930 isAlongOnlyPath = true;
34935 if (matchesViaTo) {
34937 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
34939 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
34942 if (isAlongOnlyPath) {
34943 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
34944 } else if (isOnly) {
34945 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
34948 if (restrict && restrict.direct)
34951 nextWays.push({ way: way2, restrict });
34953 nextWays.forEach(function(nextWay) {
34954 step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
34957 function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
34959 if (currPath.length >= 3) {
34960 var turnPath = currPath.slice();
34961 if (matchedRestriction && matchedRestriction.direct === false) {
34962 for (i4 = 0; i4 < turnPath.length; i4++) {
34963 if (turnPath[i4] === matchedRestriction.from) {
34964 turnPath = turnPath.slice(i4);
34969 var turn = pathToTurn(turnPath);
34971 if (matchedRestriction) {
34972 turn.restrictionID = matchedRestriction.id;
34973 turn.no = matchedRestriction.no;
34974 turn.only = matchedRestriction.only;
34975 turn.direct = matchedRestriction.direct;
34977 turns.push(osmTurn(turn));
34979 if (currPath[0] === currPath[2])
34982 if (matchedRestriction && matchedRestriction.end)
34984 var n1 = vgraph2.entity(entity.first());
34985 var n22 = vgraph2.entity(entity.last());
34986 var dist = geoSphericalDistance(n1.loc, n22.loc);
34987 var nextNodes = [];
34988 if (currPath.length > 1) {
34989 if (dist > maxDistance)
34994 if (!entity.__oneWay && // bidirectional..
34995 keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
34996 currPath.indexOf(n1.id) === -1) {
34997 nextNodes.push(n1);
34999 if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
35000 currPath.indexOf(n22.id) === -1) {
35001 nextNodes.push(n22);
35003 nextNodes.forEach(function(nextNode) {
35004 var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
35005 if (!r2.isRestriction())
35007 var f2 = r2.memberByRole("from");
35008 if (!f2 || f2.id !== entity.id)
35010 var isOnly = /^only_/.test(r2.tags.restriction);
35013 var isOnlyVia = false;
35014 var v2 = r2.membersByRole("via");
35015 if (v2.length === 1 && v2[0].type === "node") {
35016 isOnlyVia = v2[0].id === nextNode.id;
35018 for (var i5 = 0; i5 < v2.length; i5++) {
35019 if (v2[i5].type !== "way")
35021 var viaWay = vgraph2.entity(v2[i5].id);
35022 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
35030 step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
35033 function pathToTurn(path) {
35034 if (path.length < 3)
35036 var fromWayId2, fromNodeId, fromVertexId;
35037 var toWayId, toNodeId, toVertexId;
35038 var viaWayIds, viaNodeId, isUturn;
35039 fromWayId2 = path[0];
35040 toWayId = path[path.length - 1];
35041 if (path.length === 3 && fromWayId2 === toWayId) {
35042 var way2 = vgraph2.entity(fromWayId2);
35046 viaNodeId = fromVertexId = toVertexId = path[1];
35047 fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
35050 fromVertexId = path[1];
35051 fromNodeId = adjacentNode(fromWayId2, fromVertexId);
35052 toVertexId = path[path.length - 2];
35053 toNodeId = adjacentNode(toWayId, toVertexId);
35054 if (path.length === 3) {
35055 viaNodeId = path[1];
35057 viaWayIds = path.filter(function(entityId) {
35058 return entityId[0] === "w";
35060 viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
35064 key: path.join("_"),
35066 from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
35067 via: { node: viaNodeId, ways: viaWayIds },
35068 to: { node: toNodeId, way: toWayId, vertex: toVertexId },
35071 function adjacentNode(wayId, affixId) {
35072 var nodes2 = vgraph2.entity(wayId).nodes;
35073 return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
35077 return intersection2;
35079 function osmInferRestriction(graph, turn, projection2) {
35080 var fromWay = graph.entity(turn.from.way);
35081 var fromNode = graph.entity(turn.from.node);
35082 var fromVertex = graph.entity(turn.from.vertex);
35083 var toWay = graph.entity(turn.to.way);
35084 var toNode = graph.entity(turn.to.node);
35085 var toVertex = graph.entity(turn.to.vertex);
35086 var fromOneWay = fromWay.tags.oneway === "yes";
35087 var toOneWay = toWay.tags.oneway === "yes";
35088 var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
35089 while (angle2 < 0) {
35092 if (fromNode === toNode) {
35093 return "no_u_turn";
35095 if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
35096 return "no_u_turn";
35098 if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
35099 return "no_u_turn";
35101 if (angle2 < 158) {
35102 return "no_right_turn";
35104 if (angle2 > 202) {
35105 return "no_left_turn";
35107 return "no_straight_on";
35110 // modules/actions/merge_polygon.js
35111 function actionMergePolygon(ids, newRelationId) {
35112 function groupEntities(graph) {
35113 var entities = ids.map(function(id2) {
35114 return graph.entity(id2);
35116 var geometryGroups = utilArrayGroupBy(entities, function(entity) {
35117 if (entity.type === "way" && entity.isClosed()) {
35118 return "closedWay";
35119 } else if (entity.type === "relation" && entity.isMultipolygon()) {
35120 return "multipolygon";
35125 return Object.assign(
35126 { closedWay: [], multipolygon: [], other: [] },
35130 var action = function(graph) {
35131 var entities = groupEntities(graph);
35132 var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
35133 return polygons2.concat(osmJoinWays(m2.members, graph));
35134 }, []).concat(entities.closedWay.map(function(d2) {
35135 var member = [{ id: d2.id }];
35136 member.nodes = graph.childNodes(d2);
35139 var contained = polygons.map(function(w2, i3) {
35140 return polygons.map(function(d2, n3) {
35143 return geoPolygonContainsPolygon(
35144 d2.nodes.map(function(n4) {
35147 w2.nodes.map(function(n4) {
35155 while (polygons.length) {
35156 extractUncontained(polygons);
35157 polygons = polygons.filter(isContained);
35158 contained = contained.filter(isContained).map(filterContained);
35160 function isContained(d2, i3) {
35161 return contained[i3].some(function(val) {
35165 function filterContained(d2) {
35166 return d2.filter(isContained);
35168 function extractUncontained(polygons2) {
35169 polygons2.forEach(function(d2, i3) {
35170 if (!isContained(d2, i3)) {
35171 d2.forEach(function(member) {
35175 role: outer ? "outer" : "inner"
35183 if (entities.multipolygon.length > 0) {
35184 var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
35185 relation = entities.multipolygon.find((entity) => entity.id === oldestID);
35187 relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
35189 entities.multipolygon.forEach(function(m2) {
35190 if (m2.id !== relation.id) {
35191 relation = relation.mergeTags(m2.tags);
35192 graph = graph.remove(m2);
35195 entities.closedWay.forEach(function(way) {
35196 function isThisOuter(m2) {
35197 return m2.id === way.id && m2.role !== "inner";
35199 if (members.some(isThisOuter)) {
35200 relation = relation.mergeTags(way.tags);
35201 graph = graph.replace(way.update({ tags: {} }));
35204 return graph.replace(relation.update({
35206 tags: utilObjectOmit(relation.tags, ["area"])
35209 action.disabled = function(graph) {
35210 var entities = groupEntities(graph);
35211 if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
35212 return "not_eligible";
35214 if (!entities.multipolygon.every(function(r2) {
35215 return r2.isComplete(graph);
35217 return "incomplete_relation";
35219 if (!entities.multipolygon.length) {
35220 var sharedMultipolygons = [];
35221 entities.closedWay.forEach(function(way, i3) {
35223 sharedMultipolygons = graph.parentMultipolygons(way);
35225 sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
35228 sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
35229 return relation.members.length === entities.closedWay.length;
35231 if (sharedMultipolygons.length) {
35232 return "not_eligible";
35234 } else if (entities.closedWay.some(function(way) {
35235 return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
35237 return "not_eligible";
35243 // modules/actions/merge_remote_changes.js
35244 var import_fast_deep_equal = __toESM(require_fast_deep_equal());
35246 // node_modules/node-diff3/index.mjs
35247 function LCS(buffer1, buffer2) {
35248 let equivalenceClasses = {};
35249 for (let j2 = 0; j2 < buffer2.length; j2++) {
35250 const item = buffer2[j2];
35251 if (equivalenceClasses[item]) {
35252 equivalenceClasses[item].push(j2);
35254 equivalenceClasses[item] = [j2];
35257 const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
35258 let candidates = [NULLRESULT];
35259 for (let i3 = 0; i3 < buffer1.length; i3++) {
35260 const item = buffer1[i3];
35261 const buffer2indices = equivalenceClasses[item] || [];
35263 let c2 = candidates[0];
35264 for (let jx = 0; jx < buffer2indices.length; jx++) {
35265 const j2 = buffer2indices[jx];
35267 for (s2 = r2; s2 < candidates.length; s2++) {
35268 if (candidates[s2].buffer2index < j2 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j2)) {
35272 if (s2 < candidates.length) {
35273 const newCandidate = { buffer1index: i3, buffer2index: j2, chain: candidates[s2] };
35274 if (r2 === candidates.length) {
35275 candidates.push(c2);
35277 candidates[r2] = c2;
35281 if (r2 === candidates.length) {
35286 candidates[r2] = c2;
35288 return candidates[candidates.length - 1];
35290 function diffIndices(buffer1, buffer2) {
35291 const lcs = LCS(buffer1, buffer2);
35293 let tail1 = buffer1.length;
35294 let tail2 = buffer2.length;
35295 for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
35296 const mismatchLength1 = tail1 - candidate.buffer1index - 1;
35297 const mismatchLength2 = tail2 - candidate.buffer2index - 1;
35298 tail1 = candidate.buffer1index;
35299 tail2 = candidate.buffer2index;
35300 if (mismatchLength1 || mismatchLength2) {
35302 buffer1: [tail1 + 1, mismatchLength1],
35303 buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
35304 buffer2: [tail2 + 1, mismatchLength2],
35305 buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
35312 function diff3MergeRegions(a2, o2, b2) {
35314 function addHunk(h2, ab) {
35317 oStart: h2.buffer1[0],
35318 oLength: h2.buffer1[1],
35319 // length of o to remove
35320 abStart: h2.buffer2[0],
35321 abLength: h2.buffer2[1]
35322 // length of a/b to insert
35323 // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
35326 diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
35327 diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
35328 hunks.sort((x2, y2) => x2.oStart - y2.oStart);
35330 let currOffset = 0;
35331 function advanceTo(endOffset) {
35332 if (endOffset > currOffset) {
35336 bufferStart: currOffset,
35337 bufferLength: endOffset - currOffset,
35338 bufferContent: o2.slice(currOffset, endOffset)
35340 currOffset = endOffset;
35343 while (hunks.length) {
35344 let hunk = hunks.shift();
35345 let regionStart = hunk.oStart;
35346 let regionEnd = hunk.oStart + hunk.oLength;
35347 let regionHunks = [hunk];
35348 advanceTo(regionStart);
35349 while (hunks.length) {
35350 const nextHunk = hunks[0];
35351 const nextHunkStart = nextHunk.oStart;
35352 if (nextHunkStart > regionEnd)
35354 regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
35355 regionHunks.push(hunks.shift());
35357 if (regionHunks.length === 1) {
35358 if (hunk.abLength > 0) {
35359 const buffer = hunk.ab === "a" ? a2 : b2;
35363 bufferStart: hunk.abStart,
35364 bufferLength: hunk.abLength,
35365 bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
35370 a: [a2.length, -1, o2.length, -1],
35371 b: [b2.length, -1, o2.length, -1]
35373 while (regionHunks.length) {
35374 hunk = regionHunks.shift();
35375 const oStart = hunk.oStart;
35376 const oEnd = oStart + hunk.oLength;
35377 const abStart = hunk.abStart;
35378 const abEnd = abStart + hunk.abLength;
35379 let b3 = bounds[hunk.ab];
35380 b3[0] = Math.min(abStart, b3[0]);
35381 b3[1] = Math.max(abEnd, b3[1]);
35382 b3[2] = Math.min(oStart, b3[2]);
35383 b3[3] = Math.max(oEnd, b3[3]);
35385 const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
35386 const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
35387 const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
35388 const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
35392 aLength: aEnd - aStart,
35393 aContent: a2.slice(aStart, aEnd),
35394 oStart: regionStart,
35395 oLength: regionEnd - regionStart,
35396 oContent: o2.slice(regionStart, regionEnd),
35398 bLength: bEnd - bStart,
35399 bContent: b2.slice(bStart, bEnd)
35401 results.push(result);
35403 currOffset = regionEnd;
35405 advanceTo(o2.length);
35408 function diff3Merge(a2, o2, b2, options2) {
35410 excludeFalseConflicts: true,
35411 stringSeparator: /\s+/
35413 options2 = Object.assign(defaults, options2);
35414 if (typeof a2 === "string")
35415 a2 = a2.split(options2.stringSeparator);
35416 if (typeof o2 === "string")
35417 o2 = o2.split(options2.stringSeparator);
35418 if (typeof b2 === "string")
35419 b2 = b2.split(options2.stringSeparator);
35421 const regions = diff3MergeRegions(a2, o2, b2);
35423 function flushOk() {
35424 if (okBuffer.length) {
35425 results.push({ ok: okBuffer });
35429 function isFalseConflict(a3, b3) {
35430 if (a3.length !== b3.length)
35432 for (let i3 = 0; i3 < a3.length; i3++) {
35433 if (a3[i3] !== b3[i3])
35438 regions.forEach((region) => {
35439 if (region.stable) {
35440 okBuffer.push(...region.bufferContent);
35442 if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
35443 okBuffer.push(...region.aContent);
35448 a: region.aContent,
35449 aIndex: region.aStart,
35450 o: region.oContent,
35451 oIndex: region.oStart,
35452 b: region.bContent,
35453 bIndex: region.bStart
35463 // modules/actions/merge_remote_changes.js
35464 var import_lodash2 = __toESM(require_lodash());
35465 function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
35466 discardTags = discardTags || {};
35467 var _option = "safe";
35468 var _conflicts = [];
35469 function user(d2) {
35470 return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
35472 function mergeLocation(remote, target) {
35473 function pointEqual(a2, b2) {
35474 var epsilon3 = 1e-6;
35475 return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
35477 if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
35480 if (_option === "force_remote") {
35481 return target.update({ loc: remote.loc });
35483 _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
35486 function mergeNodes(base, remote, target) {
35487 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
35490 if (_option === "force_remote") {
35491 return target.update({ nodes: remote.nodes });
35493 var ccount = _conflicts.length;
35494 var o2 = base.nodes || [];
35495 var a2 = target.nodes || [];
35496 var b2 = remote.nodes || [];
35498 var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
35499 for (var i3 = 0; i3 < hunks.length; i3++) {
35500 var hunk = hunks[i3];
35502 nodes.push.apply(nodes, hunk.ok);
35504 var c2 = hunk.conflict;
35505 if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
35506 nodes.push.apply(nodes, c2.b);
35507 } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
35508 nodes.push.apply(nodes, c2.a);
35510 _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
35515 return _conflicts.length === ccount ? target.update({ nodes }) : target;
35517 function mergeChildren(targetWay, children2, updates, graph) {
35518 function isUsed(node2, targetWay2) {
35519 var hasInterestingParent = graph.parentWays(node2).some(function(way) {
35520 return way.id !== targetWay2.id;
35522 return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
35524 var ccount = _conflicts.length;
35525 for (var i3 = 0; i3 < children2.length; i3++) {
35526 var id3 = children2[i3];
35527 var node = graph.hasEntity(id3);
35528 if (targetWay.nodes.indexOf(id3) === -1) {
35529 if (node && !isUsed(node, targetWay)) {
35530 updates.removeIds.push(id3);
35534 var local = localGraph.hasEntity(id3);
35535 var remote = remoteGraph.hasEntity(id3);
35537 if (_option === "force_remote" && remote && remote.visible) {
35538 updates.replacements.push(remote);
35539 } else if (_option === "force_local" && local) {
35540 target = osmEntity(local);
35542 target = target.update({ version: remote.version });
35544 updates.replacements.push(target);
35545 } else if (_option === "safe" && local && remote && local.version !== remote.version) {
35546 target = osmEntity(local, { version: remote.version });
35547 if (remote.visible) {
35548 target = mergeLocation(remote, target);
35550 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
35552 if (_conflicts.length !== ccount)
35554 updates.replacements.push(target);
35559 function updateChildren(updates, graph) {
35560 for (var i3 = 0; i3 < updates.replacements.length; i3++) {
35561 graph = graph.replace(updates.replacements[i3]);
35563 if (updates.removeIds.length) {
35564 graph = actionDeleteMultiple(updates.removeIds)(graph);
35568 function mergeMembers(remote, target) {
35569 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
35572 if (_option === "force_remote") {
35573 return target.update({ members: remote.members });
35575 _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
35578 function mergeTags(base, remote, target) {
35579 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
35582 if (_option === "force_remote") {
35583 return target.update({ tags: remote.tags });
35585 var ccount = _conflicts.length;
35586 var o2 = base.tags || {};
35587 var a2 = target.tags || {};
35588 var b2 = remote.tags || {};
35589 var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
35590 return !discardTags[k3];
35592 var tags = Object.assign({}, a2);
35593 var changed = false;
35594 for (var i3 = 0; i3 < keys2.length; i3++) {
35595 var k2 = keys2[i3];
35596 if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
35597 if (o2[k2] !== a2[k2]) {
35598 _conflicts.push(_t.html(
35599 "merge_remote_changes.conflict.tags",
35600 { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
35603 if (b2.hasOwnProperty(k2)) {
35612 return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
35614 var action = function(graph) {
35615 var updates = { replacements: [], removeIds: [] };
35616 var base = graph.base().entities[id2];
35617 var local = localGraph.entity(id2);
35618 var remote = remoteGraph.entity(id2);
35619 var target = osmEntity(local, { version: remote.version });
35620 if (!remote.visible) {
35621 if (_option === "force_remote") {
35622 return actionDeleteMultiple([id2])(graph);
35623 } else if (_option === "force_local") {
35624 if (target.type === "way") {
35625 target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
35626 graph = updateChildren(updates, graph);
35628 return graph.replace(target);
35630 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
35634 if (target.type === "node") {
35635 target = mergeLocation(remote, target);
35636 } else if (target.type === "way") {
35637 graph.rebase(remoteGraph.childNodes(remote), [graph], false);
35638 target = mergeNodes(base, remote, target);
35639 target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
35640 } else if (target.type === "relation") {
35641 target = mergeMembers(remote, target);
35643 target = mergeTags(base, remote, target);
35644 if (!_conflicts.length) {
35645 graph = updateChildren(updates, graph).replace(target);
35649 action.withOption = function(opt) {
35653 action.conflicts = function() {
35659 // modules/actions/move.js
35660 function actionMove(moveIDs, tryDelta, projection2, cache) {
35661 var _delta = tryDelta;
35662 function setupCache(graph) {
35663 function canMove(nodeID) {
35664 if (moveIDs.indexOf(nodeID) !== -1)
35666 var parents = graph.parentWays(graph.entity(nodeID));
35667 if (parents.length < 3)
35669 var parentsMoving = parents.every(function(way) {
35670 return cache.moving[way.id];
35672 if (!parentsMoving)
35673 delete cache.moving[nodeID];
35674 return parentsMoving;
35676 function cacheEntities(ids) {
35677 for (var i3 = 0; i3 < ids.length; i3++) {
35679 if (cache.moving[id2])
35681 cache.moving[id2] = true;
35682 var entity = graph.hasEntity(id2);
35685 if (entity.type === "node") {
35686 cache.nodes.push(id2);
35687 cache.startLoc[id2] = entity.loc;
35688 } else if (entity.type === "way") {
35689 cache.ways.push(id2);
35690 cacheEntities(entity.nodes);
35692 cacheEntities(entity.members.map(function(member) {
35698 function cacheIntersections(ids) {
35699 function isEndpoint(way2, id3) {
35700 return !way2.isClosed() && !!way2.affix(id3);
35702 for (var i3 = 0; i3 < ids.length; i3++) {
35704 var childNodes = graph.childNodes(graph.entity(id2));
35705 for (var j2 = 0; j2 < childNodes.length; j2++) {
35706 var node = childNodes[j2];
35707 var parents = graph.parentWays(node);
35708 if (parents.length !== 2)
35710 var moved = graph.entity(id2);
35711 var unmoved = null;
35712 for (var k2 = 0; k2 < parents.length; k2++) {
35713 var way = parents[k2];
35714 if (!cache.moving[way.id]) {
35721 if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2)
35723 if (moved.isArea() || unmoved.isArea())
35725 cache.intersections.push({
35728 unmovedId: unmoved.id,
35729 movedIsEP: isEndpoint(moved, node.id),
35730 unmovedIsEP: isEndpoint(unmoved, node.id)
35740 cache.intersections = [];
35741 cache.replacedVertex = {};
35742 cache.startLoc = {};
35745 cacheEntities(moveIDs);
35746 cacheIntersections(cache.ways);
35747 cache.nodes = cache.nodes.filter(canMove);
35751 function replaceMovedVertex(nodeId, wayId, graph, delta) {
35752 var way = graph.entity(wayId);
35753 var moved = graph.entity(nodeId);
35754 var movedIndex = way.nodes.indexOf(nodeId);
35755 var len, prevIndex, nextIndex;
35756 if (way.isClosed()) {
35757 len = way.nodes.length - 1;
35758 prevIndex = (movedIndex + len - 1) % len;
35759 nextIndex = (movedIndex + len + 1) % len;
35761 len = way.nodes.length;
35762 prevIndex = movedIndex - 1;
35763 nextIndex = movedIndex + 1;
35765 var prev = graph.hasEntity(way.nodes[prevIndex]);
35766 var next = graph.hasEntity(way.nodes[nextIndex]);
35767 if (!prev || !next)
35769 var key = wayId + "_" + nodeId;
35770 var orig = cache.replacedVertex[key];
35773 cache.replacedVertex[key] = orig;
35774 cache.startLoc[orig.id] = cache.startLoc[nodeId];
35778 start2 = projection2(cache.startLoc[nodeId]);
35779 end = projection2.invert(geoVecAdd(start2, delta));
35781 end = cache.startLoc[nodeId];
35783 orig = orig.move(end);
35784 var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
35785 if (angle2 > 175 && angle2 < 185)
35787 var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
35788 var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
35789 var d1 = geoPathLength(p1);
35790 var d2 = geoPathLength(p2);
35791 var insertAt = d1 <= d2 ? movedIndex : nextIndex;
35792 if (way.isClosed() && insertAt === 0)
35794 way = way.addNode(orig.id, insertAt);
35795 return graph.replace(orig).replace(way);
35797 function removeDuplicateVertices(wayId, graph) {
35798 var way = graph.entity(wayId);
35799 var epsilon3 = 1e-6;
35801 function isInteresting(node, graph2) {
35802 return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
35804 for (var i3 = 0; i3 < way.nodes.length; i3++) {
35805 curr = graph.entity(way.nodes[i3]);
35806 if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
35807 if (!isInteresting(prev, graph)) {
35808 way = way.removeNode(prev.id);
35809 graph = graph.replace(way).remove(prev);
35810 } else if (!isInteresting(curr, graph)) {
35811 way = way.removeNode(curr.id);
35812 graph = graph.replace(way).remove(curr);
35819 function unZorroIntersection(intersection2, graph) {
35820 var vertex = graph.entity(intersection2.nodeId);
35821 var way1 = graph.entity(intersection2.movedId);
35822 var way2 = graph.entity(intersection2.unmovedId);
35823 var isEP1 = intersection2.movedIsEP;
35824 var isEP2 = intersection2.unmovedIsEP;
35825 if (isEP1 && isEP2)
35827 var nodes1 = graph.childNodes(way1).filter(function(n3) {
35828 return n3 !== vertex;
35830 var nodes2 = graph.childNodes(way2).filter(function(n3) {
35831 return n3 !== vertex;
35833 if (way1.isClosed() && way1.first() === vertex.id)
35834 nodes1.push(nodes1[0]);
35835 if (way2.isClosed() && way2.first() === vertex.id)
35836 nodes2.push(nodes2[0]);
35837 var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
35838 var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
35840 if (!isEP1 && !isEP2) {
35841 var epsilon3 = 1e-6, maxIter = 10;
35842 for (var i3 = 0; i3 < maxIter; i3++) {
35843 loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
35844 edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
35845 edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
35846 if (Math.abs(edge1.distance - edge2.distance) < epsilon3)
35849 } else if (!isEP1) {
35854 graph = graph.replace(vertex.move(loc));
35855 if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
35856 way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
35857 graph = graph.replace(way1);
35859 if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
35860 way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
35861 graph = graph.replace(way2);
35865 function cleanupIntersections(graph) {
35866 for (var i3 = 0; i3 < cache.intersections.length; i3++) {
35867 var obj = cache.intersections[i3];
35868 graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
35869 graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
35870 graph = unZorroIntersection(obj, graph);
35871 graph = removeDuplicateVertices(obj.movedId, graph);
35872 graph = removeDuplicateVertices(obj.unmovedId, graph);
35876 function limitDelta(graph) {
35877 function moveNode(loc) {
35878 return geoVecAdd(projection2(loc), _delta);
35880 for (var i3 = 0; i3 < cache.intersections.length; i3++) {
35881 var obj = cache.intersections[i3];
35882 if (obj.movedIsEP && obj.unmovedIsEP)
35884 if (!obj.movedIsEP)
35886 var node = graph.entity(obj.nodeId);
35887 var start2 = projection2(node.loc);
35888 var end = geoVecAdd(start2, _delta);
35889 var movedNodes = graph.childNodes(graph.entity(obj.movedId));
35890 var movedPath = movedNodes.map(function(n3) {
35891 return moveNode(n3.loc);
35893 var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
35894 var unmovedPath = unmovedNodes.map(function(n3) {
35895 return projection2(n3.loc);
35897 var hits = geoPathIntersections(movedPath, unmovedPath);
35898 for (var j2 = 0; i3 < hits.length; i3++) {
35899 if (geoVecEqual(hits[j2], end))
35901 var edge = geoChooseEdge(unmovedNodes, end, projection2);
35902 _delta = geoVecSubtract(projection2(edge.loc), start2);
35906 var action = function(graph) {
35907 if (_delta[0] === 0 && _delta[1] === 0)
35910 if (cache.intersections.length) {
35913 for (var i3 = 0; i3 < cache.nodes.length; i3++) {
35914 var node = graph.entity(cache.nodes[i3]);
35915 var start2 = projection2(node.loc);
35916 var end = geoVecAdd(start2, _delta);
35917 graph = graph.replace(node.move(projection2.invert(end)));
35919 if (cache.intersections.length) {
35920 graph = cleanupIntersections(graph);
35924 action.delta = function() {
35930 // modules/actions/move_member.js
35931 function actionMoveMember(relationId, fromIndex, toIndex) {
35932 return function(graph) {
35933 return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
35937 // modules/actions/move_node.js
35938 function actionMoveNode(nodeID, toLoc) {
35939 var action = function(graph, t2) {
35940 if (t2 === null || !isFinite(t2))
35942 t2 = Math.min(Math.max(+t2, 0), 1);
35943 var node = graph.entity(nodeID);
35944 return graph.replace(
35945 node.move(geoVecInterp(node.loc, toLoc, t2))
35948 action.transitionable = true;
35952 // modules/actions/noop.js
35953 function actionNoop() {
35954 return function(graph) {
35959 // modules/actions/orthogonalize.js
35960 function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
35961 var epsilon3 = ep || 1e-4;
35962 var threshold = degThresh || 13;
35963 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
35964 var upperThreshold = Math.cos(threshold * Math.PI / 180);
35965 var action = function(graph, t2) {
35966 if (t2 === null || !isFinite(t2))
35968 t2 = Math.min(Math.max(+t2, 0), 1);
35969 var way = graph.entity(wayID);
35970 way = way.removeNode("");
35971 if (way.tags.nonsquare) {
35972 var tags = Object.assign({}, way.tags);
35973 delete tags.nonsquare;
35974 way = way.update({ tags });
35976 graph = graph.replace(way);
35977 var isClosed = way.isClosed();
35978 var nodes = graph.childNodes(way).slice();
35981 if (vertexID !== void 0) {
35982 nodes = nodeSubset(nodes, vertexID, isClosed);
35983 if (nodes.length !== 3)
35986 var nodeCount = {};
35988 var corner = { i: 0, dotp: 1 };
35989 var node, point2, loc, score, motions, i3, j2;
35990 for (i3 = 0; i3 < nodes.length; i3++) {
35992 nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
35993 points.push({ id: node.id, coord: projection2(node.loc) });
35995 if (points.length === 3) {
35996 for (i3 = 0; i3 < 1e3; i3++) {
35997 motions = points.map(calcMotion);
35998 points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
35999 score = corner.dotp;
36000 if (score < epsilon3) {
36004 node = graph.entity(nodes[corner.i].id);
36005 loc = projection2.invert(points[corner.i].coord);
36006 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
36008 var straights = [];
36009 var simplified = [];
36010 for (i3 = 0; i3 < points.length; i3++) {
36011 point2 = points[i3];
36013 if (isClosed || i3 > 0 && i3 < points.length - 1) {
36014 var a2 = points[(i3 - 1 + points.length) % points.length];
36015 var b2 = points[(i3 + 1) % points.length];
36016 dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point2.coord));
36018 if (dotp > upperThreshold) {
36019 straights.push(point2);
36021 simplified.push(point2);
36024 var bestPoints = clonePoints(simplified);
36025 var originalPoints = clonePoints(simplified);
36027 for (i3 = 0; i3 < 1e3; i3++) {
36028 motions = simplified.map(calcMotion);
36029 for (j2 = 0; j2 < motions.length; j2++) {
36030 simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
36032 var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
36033 if (newScore < score) {
36034 bestPoints = clonePoints(simplified);
36037 if (score < epsilon3) {
36041 var bestCoords = bestPoints.map(function(p2) {
36045 bestCoords.push(bestCoords[0]);
36046 for (i3 = 0; i3 < bestPoints.length; i3++) {
36047 point2 = bestPoints[i3];
36048 if (!geoVecEqual(originalPoints[i3].coord, point2.coord)) {
36049 node = graph.entity(point2.id);
36050 loc = projection2.invert(point2.coord);
36051 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
36054 for (i3 = 0; i3 < straights.length; i3++) {
36055 point2 = straights[i3];
36056 if (nodeCount[point2.id] > 1)
36058 node = graph.entity(point2.id);
36059 if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
36060 graph = actionDeleteNode(node.id)(graph);
36062 var choice = geoVecProject(point2.coord, bestCoords);
36064 loc = projection2.invert(choice.target);
36065 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
36071 function clonePoints(array2) {
36072 return array2.map(function(p2) {
36073 return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
36076 function calcMotion(point3, i4, array2) {
36077 if (!isClosed && (i4 === 0 || i4 === array2.length - 1))
36079 if (nodeCount[array2[i4].id] > 1)
36081 var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
36082 var origin = point3.coord;
36083 var b3 = array2[(i4 + 1) % array2.length].coord;
36084 var p2 = geoVecSubtract(a3, origin);
36085 var q2 = geoVecSubtract(b3, origin);
36086 var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
36087 p2 = geoVecNormalize(p2);
36088 q2 = geoVecNormalize(q2);
36089 var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
36090 var val = Math.abs(dotp2);
36091 if (val < lowerThreshold) {
36094 var vec = geoVecNormalize(geoVecAdd(p2, q2));
36095 return geoVecScale(vec, 0.1 * dotp2 * scale);
36100 function nodeSubset(nodes, vertexID2, isClosed) {
36101 var first = isClosed ? 0 : 1;
36102 var last = isClosed ? nodes.length : nodes.length - 1;
36103 for (var i3 = first; i3 < last; i3++) {
36104 if (nodes[i3].id === vertexID2) {
36106 nodes[(i3 - 1 + nodes.length) % nodes.length],
36108 nodes[(i3 + 1) % nodes.length]
36114 action.disabled = function(graph) {
36115 var way = graph.entity(wayID);
36116 way = way.removeNode("");
36117 graph = graph.replace(way);
36118 var isClosed = way.isClosed();
36119 var nodes = graph.childNodes(way).slice();
36122 var allowStraightAngles = false;
36123 if (vertexID !== void 0) {
36124 allowStraightAngles = true;
36125 nodes = nodeSubset(nodes, vertexID, isClosed);
36126 if (nodes.length !== 3)
36127 return "end_vertex";
36129 var coords = nodes.map(function(n3) {
36130 return projection2(n3.loc);
36132 var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
36133 if (score === null) {
36134 return "not_squarish";
36135 } else if (score === 0) {
36136 return "square_enough";
36141 action.transitionable = true;
36145 // modules/actions/restrict_turn.js
36146 function actionRestrictTurn(turn, restrictionType, restrictionID) {
36147 return function(graph) {
36148 var fromWay = graph.entity(turn.from.way);
36149 var toWay = graph.entity(turn.to.way);
36150 var viaNode = turn.via.node && graph.entity(turn.via.node);
36151 var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
36152 return graph.entity(id2);
36155 members.push({ id: fromWay.id, type: "way", role: "from" });
36157 members.push({ id: viaNode.id, type: "node", role: "via" });
36158 } else if (viaWays) {
36159 viaWays.forEach(function(viaWay) {
36160 members.push({ id: viaWay.id, type: "way", role: "via" });
36163 members.push({ id: toWay.id, type: "way", role: "to" });
36164 return graph.replace(osmRelation({
36167 type: "restriction",
36168 restriction: restrictionType
36175 // modules/actions/revert.js
36176 function actionRevert(id2) {
36177 var action = function(graph) {
36178 var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
36179 if (entity && !base) {
36180 if (entity.type === "node") {
36181 graph.parentWays(entity).forEach(function(parent) {
36182 parent = parent.removeNode(id2);
36183 graph = graph.replace(parent);
36184 if (parent.isDegenerate()) {
36185 graph = actionDeleteWay(parent.id)(graph);
36189 graph.parentRelations(entity).forEach(function(parent) {
36190 parent = parent.removeMembersWithID(id2);
36191 graph = graph.replace(parent);
36192 if (parent.isDegenerate()) {
36193 graph = actionDeleteRelation(parent.id)(graph);
36197 return graph.revert(id2);
36202 // modules/actions/rotate.js
36203 function actionRotate(rotateIds, pivot, angle2, projection2) {
36204 var action = function(graph) {
36205 return graph.update(function(graph2) {
36206 utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
36207 var point2 = geoRotate([projection2(node.loc)], angle2, pivot)[0];
36208 graph2 = graph2.replace(node.move(projection2.invert(point2)));
36215 // modules/actions/scale.js
36216 function actionScale(ids, pivotLoc, scaleFactor, projection2) {
36217 return function(graph) {
36218 return graph.update(function(graph2) {
36219 let point2, radial;
36220 utilGetAllNodes(ids, graph2).forEach(function(node) {
36221 point2 = projection2(node.loc);
36223 point2[0] - pivotLoc[0],
36224 point2[1] - pivotLoc[1]
36227 pivotLoc[0] + scaleFactor * radial[0],
36228 pivotLoc[1] + scaleFactor * radial[1]
36230 graph2 = graph2.replace(node.move(projection2.invert(point2)));
36236 // modules/actions/straighten_nodes.js
36237 function actionStraightenNodes(nodeIDs, projection2) {
36238 function positionAlongWay(a2, o2, b2) {
36239 return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
36241 function getEndpoints(points) {
36242 var ssr = geoGetSmallestSurroundingRectangle(points);
36243 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
36244 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
36245 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
36246 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
36247 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
36253 var action = function(graph, t2) {
36254 if (t2 === null || !isFinite(t2))
36256 t2 = Math.min(Math.max(+t2, 0), 1);
36257 var nodes = nodeIDs.map(function(id2) {
36258 return graph.entity(id2);
36260 var points = nodes.map(function(n3) {
36261 return projection2(n3.loc);
36263 var endpoints = getEndpoints(points);
36264 var startPoint = endpoints[0];
36265 var endPoint = endpoints[1];
36266 for (var i3 = 0; i3 < points.length; i3++) {
36267 var node = nodes[i3];
36268 var point2 = points[i3];
36269 var u2 = positionAlongWay(point2, startPoint, endPoint);
36270 var point22 = geoVecInterp(startPoint, endPoint, u2);
36271 var loc2 = projection2.invert(point22);
36272 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
36276 action.disabled = function(graph) {
36277 var nodes = nodeIDs.map(function(id2) {
36278 return graph.entity(id2);
36280 var points = nodes.map(function(n3) {
36281 return projection2(n3.loc);
36283 var endpoints = getEndpoints(points);
36284 var startPoint = endpoints[0];
36285 var endPoint = endpoints[1];
36286 var maxDistance = 0;
36287 for (var i3 = 0; i3 < points.length; i3++) {
36288 var point2 = points[i3];
36289 var u2 = positionAlongWay(point2, startPoint, endPoint);
36290 var p2 = geoVecInterp(startPoint, endPoint, u2);
36291 var dist = geoVecLength(p2, point2);
36292 if (!isNaN(dist) && dist > maxDistance) {
36293 maxDistance = dist;
36296 if (maxDistance < 1e-4) {
36297 return "straight_enough";
36300 action.transitionable = true;
36304 // modules/actions/straighten_way.js
36305 function actionStraightenWay(selectedIDs, projection2) {
36306 function positionAlongWay(a2, o2, b2) {
36307 return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
36309 function allNodes(graph) {
36311 var startNodes = [];
36313 var remainingWays = [];
36314 var selectedWays = selectedIDs.filter(function(w2) {
36315 return graph.entity(w2).type === "way";
36317 var selectedNodes = selectedIDs.filter(function(n3) {
36318 return graph.entity(n3).type === "node";
36320 for (var i3 = 0; i3 < selectedWays.length; i3++) {
36321 var way = graph.entity(selectedWays[i3]);
36322 nodes = way.nodes.slice(0);
36323 remainingWays.push(nodes);
36324 startNodes.push(nodes[0]);
36325 endNodes.push(nodes[nodes.length - 1]);
36327 startNodes = startNodes.filter(function(n3) {
36328 return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
36330 endNodes = endNodes.filter(function(n3) {
36331 return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
36333 var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
36336 var getNextWay = function(currNode2, remainingWays2) {
36337 return remainingWays2.filter(function(way2) {
36338 return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
36341 while (remainingWays.length) {
36342 nextWay = getNextWay(currNode, remainingWays);
36343 remainingWays = utilArrayDifference(remainingWays, [nextWay]);
36344 if (nextWay[0] !== currNode) {
36347 nodes = nodes.concat(nextWay);
36348 currNode = nodes[nodes.length - 1];
36350 if (selectedNodes.length === 2) {
36351 var startNodeIdx = nodes.indexOf(selectedNodes[0]);
36352 var endNodeIdx = nodes.indexOf(selectedNodes[1]);
36353 var sortedStartEnd = [startNodeIdx, endNodeIdx];
36354 sortedStartEnd.sort(function(a2, b2) {
36357 nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
36359 return nodes.map(function(n3) {
36360 return graph.entity(n3);
36363 function shouldKeepNode(node, graph) {
36364 return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
36366 var action = function(graph, t2) {
36367 if (t2 === null || !isFinite(t2))
36369 t2 = Math.min(Math.max(+t2, 0), 1);
36370 var nodes = allNodes(graph);
36371 var points = nodes.map(function(n3) {
36372 return projection2(n3.loc);
36374 var startPoint = points[0];
36375 var endPoint = points[points.length - 1];
36378 for (i3 = 1; i3 < points.length - 1; i3++) {
36379 var node = nodes[i3];
36380 var point2 = points[i3];
36381 if (t2 < 1 || shouldKeepNode(node, graph)) {
36382 var u2 = positionAlongWay(point2, startPoint, endPoint);
36383 var p2 = geoVecInterp(startPoint, endPoint, u2);
36384 var loc2 = projection2.invert(p2);
36385 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
36387 if (toDelete.indexOf(node) === -1) {
36388 toDelete.push(node);
36392 for (i3 = 0; i3 < toDelete.length; i3++) {
36393 graph = actionDeleteNode(toDelete[i3].id)(graph);
36397 action.disabled = function(graph) {
36398 var nodes = allNodes(graph);
36399 var points = nodes.map(function(n3) {
36400 return projection2(n3.loc);
36402 var startPoint = points[0];
36403 var endPoint = points[points.length - 1];
36404 var threshold = 0.2 * geoVecLength(startPoint, endPoint);
36406 if (threshold === 0) {
36407 return "too_bendy";
36409 var maxDistance = 0;
36410 for (i3 = 1; i3 < points.length - 1; i3++) {
36411 var point2 = points[i3];
36412 var u2 = positionAlongWay(point2, startPoint, endPoint);
36413 var p2 = geoVecInterp(startPoint, endPoint, u2);
36414 var dist = geoVecLength(p2, point2);
36415 if (isNaN(dist) || dist > threshold) {
36416 return "too_bendy";
36417 } else if (dist > maxDistance) {
36418 maxDistance = dist;
36421 var keepingAllNodes = nodes.every(function(node, i4) {
36422 return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
36424 if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
36426 return "straight_enough";
36429 action.transitionable = true;
36433 // modules/actions/unrestrict_turn.js
36434 function actionUnrestrictTurn(turn) {
36435 return function(graph) {
36436 return actionDeleteRelation(turn.restrictionID)(graph);
36440 // modules/actions/reflect.js
36441 function actionReflect(reflectIds, projection2) {
36442 var _useLongAxis = true;
36443 var action = function(graph, t2) {
36444 if (t2 === null || !isFinite(t2))
36446 t2 = Math.min(Math.max(+t2, 0), 1);
36447 var nodes = utilGetAllNodes(reflectIds, graph);
36448 var points = nodes.map(function(n3) {
36449 return projection2(n3.loc);
36451 var ssr = geoGetSmallestSurroundingRectangle(points);
36452 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
36453 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
36454 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
36455 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
36457 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
36458 if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
36465 var dx = q3[0] - p3[0];
36466 var dy = q3[1] - p3[1];
36467 var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
36468 var b2 = 2 * dx * dy / (dx * dx + dy * dy);
36469 for (var i3 = 0; i3 < nodes.length; i3++) {
36470 var node = nodes[i3];
36471 var c2 = projection2(node.loc);
36473 a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
36474 b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
36476 var loc2 = projection2.invert(c22);
36477 node = node.move(geoVecInterp(node.loc, loc2, t2));
36478 graph = graph.replace(node);
36482 action.useLongAxis = function(val) {
36483 if (!arguments.length)
36484 return _useLongAxis;
36485 _useLongAxis = val;
36488 action.transitionable = true;
36492 // modules/actions/upgrade_tags.js
36493 function actionUpgradeTags(entityId, oldTags, replaceTags) {
36494 return function(graph) {
36495 var entity = graph.entity(entityId);
36496 var tags = Object.assign({}, entity.tags);
36499 for (var oldTagKey in oldTags) {
36500 if (!(oldTagKey in tags))
36502 if (oldTags[oldTagKey] === "*") {
36503 transferValue = tags[oldTagKey];
36504 delete tags[oldTagKey];
36505 } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
36506 delete tags[oldTagKey];
36508 var vals = tags[oldTagKey].split(";").filter(Boolean);
36509 var oldIndex = vals.indexOf(oldTags[oldTagKey]);
36510 if (vals.length === 1 || oldIndex === -1) {
36511 delete tags[oldTagKey];
36513 if (replaceTags && replaceTags[oldTagKey]) {
36514 semiIndex = oldIndex;
36516 vals.splice(oldIndex, 1);
36517 tags[oldTagKey] = vals.join(";");
36522 for (var replaceKey in replaceTags) {
36523 var replaceValue = replaceTags[replaceKey];
36524 if (replaceValue === "*") {
36525 if (tags[replaceKey] && tags[replaceKey] !== "no") {
36528 tags[replaceKey] = "yes";
36530 } else if (replaceValue === "$1") {
36531 tags[replaceKey] = transferValue;
36533 if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
36534 var existingVals = tags[replaceKey].split(";").filter(Boolean);
36535 if (existingVals.indexOf(replaceValue) === -1) {
36536 existingVals.splice(semiIndex, 0, replaceValue);
36537 tags[replaceKey] = existingVals.join(";");
36540 tags[replaceKey] = replaceValue;
36545 return graph.replace(entity.update({ tags }));
36549 // modules/behavior/edit.js
36550 function behaviorEdit(context) {
36551 function behavior() {
36552 context.map().minzoom(context.minEditableZoom());
36554 behavior.off = function() {
36555 context.map().minzoom(0);
36560 // modules/behavior/hover.js
36561 function behaviorHover(context) {
36562 var dispatch14 = dispatch_default("hover");
36563 var _selection = select_default2(null);
36564 var _newNodeId = null;
36565 var _initialNodeID = null;
36569 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36570 function keydown(d3_event) {
36571 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36572 _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
36573 _selection.classed("hover-disabled", true);
36574 dispatch14.call("hover", this, null);
36577 function keyup(d3_event) {
36578 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36579 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
36580 _selection.classed("hover-disabled", false);
36581 dispatch14.call("hover", this, _targets);
36584 function behavior(selection2) {
36585 _selection = selection2;
36587 if (_initialNodeID) {
36588 _newNodeId = _initialNodeID;
36589 _initialNodeID = null;
36593 _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
36594 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
36595 function eventTarget(d3_event) {
36596 var datum2 = d3_event.target && d3_event.target.__data__;
36597 if (typeof datum2 !== "object")
36599 if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
36600 return datum2.properties.entity;
36604 function pointerover(d3_event) {
36605 if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons)
36607 var target = eventTarget(d3_event);
36608 if (target && _targets.indexOf(target) === -1) {
36609 _targets.push(target);
36610 updateHover(d3_event, _targets);
36613 function pointerout(d3_event) {
36614 var target = eventTarget(d3_event);
36615 var index = _targets.indexOf(target);
36616 if (index !== -1) {
36617 _targets.splice(index);
36618 updateHover(d3_event, _targets);
36621 function allowsVertex(d2) {
36622 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
36624 function modeAllowsHover(target) {
36625 var mode = context.mode();
36626 if (mode.id === "add-point") {
36627 return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
36631 function updateHover(d3_event, targets) {
36632 _selection.selectAll(".hover").classed("hover", false);
36633 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
36634 var mode = context.mode();
36635 if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
36636 var node = targets.find(function(target) {
36637 return target instanceof osmEntity && target.type === "node";
36639 _newNodeId = node && node.id;
36641 targets = targets.filter(function(datum3) {
36642 if (datum3 instanceof osmEntity) {
36643 return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
36648 for (var i3 in targets) {
36649 var datum2 = targets[i3];
36650 if (datum2.__featurehash__) {
36651 selector += ", .data" + datum2.__featurehash__;
36652 } else if (datum2 instanceof QAItem) {
36653 selector += ", ." + datum2.service + ".itemId-" + datum2.id;
36654 } else if (datum2 instanceof osmNote) {
36655 selector += ", .note-" + datum2.id;
36656 } else if (datum2 instanceof osmEntity) {
36657 selector += ", ." + datum2.id;
36658 if (datum2.type === "relation") {
36659 for (var j2 in datum2.members) {
36660 selector += ", ." + datum2.members[j2].id;
36665 var suppressed = _altDisables && d3_event && d3_event.altKey;
36666 if (selector.trim().length) {
36667 selector = selector.slice(1);
36668 _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
36670 dispatch14.call("hover", this, !suppressed && targets);
36673 behavior.off = function(selection2) {
36674 selection2.selectAll(".hover").classed("hover", false);
36675 selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
36676 selection2.classed("hover-disabled", false);
36677 selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
36678 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
36680 behavior.altDisables = function(val) {
36681 if (!arguments.length)
36682 return _altDisables;
36683 _altDisables = val;
36686 behavior.ignoreVertex = function(val) {
36687 if (!arguments.length)
36688 return _ignoreVertex;
36689 _ignoreVertex = val;
36692 behavior.initialNodeID = function(nodeId) {
36693 _initialNodeID = nodeId;
36696 return utilRebind(behavior, dispatch14, "on");
36699 // modules/behavior/draw.js
36700 var _disableSpace = false;
36701 var _lastSpace = null;
36702 function behaviorDraw(context) {
36703 var dispatch14 = dispatch_default(
36714 var keybinding = utilKeybinding("draw");
36715 var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
36716 var _edit = behaviorEdit(context);
36717 var _closeTolerance = 4;
36718 var _tolerance = 12;
36719 var _mouseLeave = false;
36720 var _lastMouse = null;
36721 var _lastPointerUpEvent;
36723 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
36724 function datum2(d3_event) {
36725 var mode = context.mode();
36726 var isNote = mode && mode.id.indexOf("note") !== -1;
36727 if (d3_event.altKey || isNote)
36730 if (d3_event.type === "keydown") {
36731 element = _lastMouse && _lastMouse.target;
36733 element = d3_event.target;
36735 var d2 = element.__data__;
36736 return d2 && d2.properties && d2.properties.target ? d2 : {};
36738 function pointerdown(d3_event) {
36741 var pointerLocGetter = utilFastMouse(this);
36743 id: d3_event.pointerId || "mouse",
36745 downTime: +/* @__PURE__ */ new Date(),
36746 downLoc: pointerLocGetter(d3_event)
36748 dispatch14.call("down", this, d3_event, datum2(d3_event));
36750 function pointerup(d3_event) {
36751 if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse"))
36753 var downPointer = _downPointer;
36754 _downPointer = null;
36755 _lastPointerUpEvent = d3_event;
36756 if (downPointer.isCancelled)
36758 var t2 = +/* @__PURE__ */ new Date();
36759 var p2 = downPointer.pointerLocGetter(d3_event);
36760 var dist = geoVecLength(downPointer.downLoc, p2);
36761 if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
36762 select_default2(window).on("click.draw-block", function() {
36763 d3_event.stopPropagation();
36765 context.map().dblclickZoomEnable(false);
36766 window.setTimeout(function() {
36767 context.map().dblclickZoomEnable(true);
36768 select_default2(window).on("click.draw-block", null);
36770 click(d3_event, p2);
36773 function pointermove(d3_event) {
36774 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
36775 var p2 = _downPointer.pointerLocGetter(d3_event);
36776 var dist = geoVecLength(_downPointer.downLoc, p2);
36777 if (dist >= _closeTolerance) {
36778 _downPointer.isCancelled = true;
36779 dispatch14.call("downcancel", this);
36782 if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer)
36784 if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100)
36786 _lastMouse = d3_event;
36787 dispatch14.call("move", this, d3_event, datum2(d3_event));
36789 function pointercancel(d3_event) {
36790 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
36791 if (!_downPointer.isCancelled) {
36792 dispatch14.call("downcancel", this);
36794 _downPointer = null;
36797 function mouseenter() {
36798 _mouseLeave = false;
36800 function mouseleave() {
36801 _mouseLeave = true;
36803 function allowsVertex(d2) {
36804 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
36806 function click(d3_event, loc) {
36807 var d2 = datum2(d3_event);
36808 var target = d2 && d2.properties && d2.properties.entity;
36809 var mode = context.mode();
36810 if (target && target.type === "node" && allowsVertex(target)) {
36811 dispatch14.call("clickNode", this, target, d2);
36813 } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
36814 var choice = geoChooseEdge(
36815 context.graph().childNodes(target),
36817 context.projection,
36821 var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
36822 dispatch14.call("clickWay", this, choice.loc, edge, d2);
36825 } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
36826 var locLatLng = context.projection.invert(loc);
36827 dispatch14.call("click", this, locLatLng, d2);
36830 function space(d3_event) {
36831 d3_event.preventDefault();
36832 d3_event.stopPropagation();
36833 var currSpace = context.map().mouse();
36834 if (_disableSpace && _lastSpace) {
36835 var dist = geoVecLength(_lastSpace, currSpace);
36836 if (dist > _tolerance) {
36837 _disableSpace = false;
36840 if (_disableSpace || _mouseLeave || !_lastMouse)
36842 _lastSpace = currSpace;
36843 _disableSpace = true;
36844 select_default2(window).on("keyup.space-block", function() {
36845 d3_event.preventDefault();
36846 d3_event.stopPropagation();
36847 _disableSpace = false;
36848 select_default2(window).on("keyup.space-block", null);
36850 var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
36851 context.projection(context.map().center());
36852 click(d3_event, loc);
36854 function backspace(d3_event) {
36855 d3_event.preventDefault();
36856 dispatch14.call("undo");
36858 function del(d3_event) {
36859 d3_event.preventDefault();
36860 dispatch14.call("cancel");
36862 function ret(d3_event) {
36863 d3_event.preventDefault();
36864 dispatch14.call("finish");
36866 function behavior(selection2) {
36867 context.install(_hover);
36868 context.install(_edit);
36869 _downPointer = null;
36870 keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
36871 selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
36872 select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
36873 select_default2(document).call(keybinding);
36876 behavior.off = function(selection2) {
36877 context.ui().sidebar.hover.cancel();
36878 context.uninstall(_hover);
36879 context.uninstall(_edit);
36880 selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
36881 select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
36882 select_default2(document).call(keybinding.unbind);
36884 behavior.hover = function() {
36887 return utilRebind(behavior, dispatch14, "on");
36890 // modules/behavior/breathe.js
36891 var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
36893 // node_modules/d3-scale/src/init.js
36894 function initRange(domain, range3) {
36895 switch (arguments.length) {
36899 this.range(domain);
36902 this.range(range3).domain(domain);
36908 // node_modules/d3-scale/src/constant.js
36909 function constants(x2) {
36910 return function() {
36915 // node_modules/d3-scale/src/number.js
36916 function number2(x2) {
36920 // node_modules/d3-scale/src/continuous.js
36922 function identity3(x2) {
36925 function normalize(a2, b2) {
36926 return (b2 -= a2 = +a2) ? function(x2) {
36927 return (x2 - a2) / b2;
36928 } : constants(isNaN(b2) ? NaN : 0.5);
36930 function clamper(a2, b2) {
36933 t2 = a2, a2 = b2, b2 = t2;
36934 return function(x2) {
36935 return Math.max(a2, Math.min(b2, x2));
36938 function bimap(domain, range3, interpolate) {
36939 var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
36941 d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
36943 d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
36944 return function(x2) {
36948 function polymap(domain, range3, interpolate) {
36949 var j2 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j2), r2 = new Array(j2), i3 = -1;
36950 if (domain[j2] < domain[0]) {
36951 domain = domain.slice().reverse();
36952 range3 = range3.slice().reverse();
36954 while (++i3 < j2) {
36955 d2[i3] = normalize(domain[i3], domain[i3 + 1]);
36956 r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
36958 return function(x2) {
36959 var i4 = bisect_default(domain, x2, 1, j2) - 1;
36960 return r2[i4](d2[i4](x2));
36963 function copy(source, target) {
36964 return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
36966 function transformer2() {
36967 var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
36968 function rescale() {
36969 var n3 = Math.min(domain.length, range3.length);
36970 if (clamp3 !== identity3)
36971 clamp3 = clamper(domain[0], domain[n3 - 1]);
36972 piecewise = n3 > 2 ? polymap : bimap;
36973 output = input = null;
36976 function scale(x2) {
36977 return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
36979 scale.invert = function(y2) {
36980 return clamp3(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
36982 scale.domain = function(_2) {
36983 return arguments.length ? (domain = Array.from(_2, number2), rescale()) : domain.slice();
36985 scale.range = function(_2) {
36986 return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
36988 scale.rangeRound = function(_2) {
36989 return range3 = Array.from(_2), interpolate = round_default, rescale();
36991 scale.clamp = function(_2) {
36992 return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
36994 scale.interpolate = function(_2) {
36995 return arguments.length ? (interpolate = _2, rescale()) : interpolate;
36997 scale.unknown = function(_2) {
36998 return arguments.length ? (unknown = _2, scale) : unknown;
37000 return function(t2, u2) {
37001 transform2 = t2, untransform = u2;
37005 function continuous() {
37006 return transformer2()(identity3, identity3);
37009 // node_modules/d3-format/src/formatDecimal.js
37010 function formatDecimal_default(x2) {
37011 return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
37013 function formatDecimalParts(x2, p2) {
37014 if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0)
37016 var i3, coefficient = x2.slice(0, i3);
37018 coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
37023 // node_modules/d3-format/src/exponent.js
37024 function exponent_default(x2) {
37025 return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
37028 // node_modules/d3-format/src/formatGroup.js
37029 function formatGroup_default(grouping, thousands) {
37030 return function(value, width) {
37031 var i3 = value.length, t2 = [], j2 = 0, g3 = grouping[0], length2 = 0;
37032 while (i3 > 0 && g3 > 0) {
37033 if (length2 + g3 + 1 > width)
37034 g3 = Math.max(1, width - length2);
37035 t2.push(value.substring(i3 -= g3, i3 + g3));
37036 if ((length2 += g3 + 1) > width)
37038 g3 = grouping[j2 = (j2 + 1) % grouping.length];
37040 return t2.reverse().join(thousands);
37044 // node_modules/d3-format/src/formatNumerals.js
37045 function formatNumerals_default(numerals) {
37046 return function(value) {
37047 return value.replace(/[0-9]/g, function(i3) {
37048 return numerals[+i3];
37053 // node_modules/d3-format/src/formatSpecifier.js
37054 var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
37055 function formatSpecifier(specifier) {
37056 if (!(match = re.exec(specifier)))
37057 throw new Error("invalid format: " + specifier);
37059 return new FormatSpecifier({
37067 precision: match[8] && match[8].slice(1),
37072 formatSpecifier.prototype = FormatSpecifier.prototype;
37073 function FormatSpecifier(specifier) {
37074 this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
37075 this.align = specifier.align === void 0 ? ">" : specifier.align + "";
37076 this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
37077 this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
37078 this.zero = !!specifier.zero;
37079 this.width = specifier.width === void 0 ? void 0 : +specifier.width;
37080 this.comma = !!specifier.comma;
37081 this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
37082 this.trim = !!specifier.trim;
37083 this.type = specifier.type === void 0 ? "" : specifier.type + "";
37085 FormatSpecifier.prototype.toString = function() {
37086 return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
37089 // node_modules/d3-format/src/formatTrim.js
37090 function formatTrim_default(s2) {
37092 for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
37110 return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
37113 // node_modules/d3-format/src/formatPrefixAuto.js
37114 var prefixExponent;
37115 function formatPrefixAuto_default(x2, p2) {
37116 var d2 = formatDecimalParts(x2, p2);
37119 var coefficient = d2[0], exponent = d2[1], i3 = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n3 = coefficient.length;
37120 return i3 === n3 ? coefficient : i3 > n3 ? coefficient + new Array(i3 - n3 + 1).join("0") : i3 > 0 ? coefficient.slice(0, i3) + "." + coefficient.slice(i3) : "0." + new Array(1 - i3).join("0") + formatDecimalParts(x2, Math.max(0, p2 + i3 - 1))[0];
37123 // node_modules/d3-format/src/formatRounded.js
37124 function formatRounded_default(x2, p2) {
37125 var d2 = formatDecimalParts(x2, p2);
37128 var coefficient = d2[0], exponent = d2[1];
37129 return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
37132 // node_modules/d3-format/src/formatTypes.js
37133 var formatTypes_default = {
37134 "%": (x2, p2) => (x2 * 100).toFixed(p2),
37135 "b": (x2) => Math.round(x2).toString(2),
37136 "c": (x2) => x2 + "",
37137 "d": formatDecimal_default,
37138 "e": (x2, p2) => x2.toExponential(p2),
37139 "f": (x2, p2) => x2.toFixed(p2),
37140 "g": (x2, p2) => x2.toPrecision(p2),
37141 "o": (x2) => Math.round(x2).toString(8),
37142 "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
37143 "r": formatRounded_default,
37144 "s": formatPrefixAuto_default,
37145 "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
37146 "x": (x2) => Math.round(x2).toString(16)
37149 // node_modules/d3-format/src/identity.js
37150 function identity_default4(x2) {
37154 // node_modules/d3-format/src/locale.js
37155 var map = Array.prototype.map;
37156 var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
37157 function locale_default(locale2) {
37158 var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity_default4 : formatGroup_default(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity_default4 : formatNumerals_default(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
37159 function newFormat(specifier) {
37160 specifier = formatSpecifier(specifier);
37161 var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero3 = specifier.zero, width = specifier.width, comma = specifier.comma, precision3 = specifier.precision, trim = specifier.trim, type2 = specifier.type;
37163 comma = true, type2 = "g";
37164 else if (!formatTypes_default[type2])
37165 precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
37166 if (zero3 || fill === "0" && align === "=")
37167 zero3 = true, fill = "0", align = "=";
37168 var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
37169 var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
37170 precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
37171 function format2(value) {
37172 var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
37173 if (type2 === "c") {
37174 valueSuffix = formatType(value) + valueSuffix;
37178 var valueNegative = value < 0 || 1 / value < 0;
37179 value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
37181 value = formatTrim_default(value);
37182 if (valueNegative && +value === 0 && sign2 !== "+")
37183 valueNegative = false;
37184 valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
37185 valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
37187 i3 = -1, n3 = value.length;
37188 while (++i3 < n3) {
37189 if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
37190 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
37191 value = value.slice(0, i3);
37197 if (comma && !zero3)
37198 value = group(value, Infinity);
37199 var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
37200 if (comma && zero3)
37201 value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
37204 value = valuePrefix + value + valueSuffix + padding;
37207 value = valuePrefix + padding + value + valueSuffix;
37210 value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
37213 value = padding + valuePrefix + value + valueSuffix;
37216 return numerals(value);
37218 format2.toString = function() {
37219 return specifier + "";
37223 function formatPrefix2(specifier, value) {
37224 var f2 = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e3 = Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3, k2 = Math.pow(10, -e3), prefix = prefixes[8 + e3 / 3];
37225 return function(value2) {
37226 return f2(k2 * value2) + prefix;
37231 formatPrefix: formatPrefix2
37235 // node_modules/d3-format/src/defaultLocale.js
37242 currency: ["$", ""]
37244 function defaultLocale(definition) {
37245 locale = locale_default(definition);
37246 format = locale.format;
37247 formatPrefix = locale.formatPrefix;
37251 // node_modules/d3-format/src/precisionFixed.js
37252 function precisionFixed_default(step) {
37253 return Math.max(0, -exponent_default(Math.abs(step)));
37256 // node_modules/d3-format/src/precisionPrefix.js
37257 function precisionPrefix_default(step, value) {
37258 return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
37261 // node_modules/d3-format/src/precisionRound.js
37262 function precisionRound_default(step, max3) {
37263 step = Math.abs(step), max3 = Math.abs(max3) - step;
37264 return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
37267 // node_modules/d3-scale/src/tickFormat.js
37268 function tickFormat(start2, stop, count, specifier) {
37269 var step = tickStep(start2, stop, count), precision3;
37270 specifier = formatSpecifier(specifier == null ? ",f" : specifier);
37271 switch (specifier.type) {
37273 var value = Math.max(Math.abs(start2), Math.abs(stop));
37274 if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value)))
37275 specifier.precision = precision3;
37276 return formatPrefix(specifier, value);
37283 if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop)))))
37284 specifier.precision = precision3 - (specifier.type === "e");
37289 if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step)))
37290 specifier.precision = precision3 - (specifier.type === "%") * 2;
37294 return format(specifier);
37297 // node_modules/d3-scale/src/linear.js
37298 function linearish(scale) {
37299 var domain = scale.domain;
37300 scale.ticks = function(count) {
37302 return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
37304 scale.tickFormat = function(count, specifier) {
37306 return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
37308 scale.nice = function(count) {
37313 var i1 = d2.length - 1;
37314 var start2 = d2[i0];
37319 if (stop < start2) {
37320 step = start2, start2 = stop, stop = step;
37321 step = i0, i0 = i1, i1 = step;
37323 while (maxIter-- > 0) {
37324 step = tickIncrement(start2, stop, count);
37325 if (step === prestep) {
37329 } else if (step > 0) {
37330 start2 = Math.floor(start2 / step) * step;
37331 stop = Math.ceil(stop / step) * step;
37332 } else if (step < 0) {
37333 start2 = Math.ceil(start2 * step) / step;
37334 stop = Math.floor(stop * step) / step;
37344 function linear3() {
37345 var scale = continuous();
37346 scale.copy = function() {
37347 return copy(scale, linear3());
37349 initRange.apply(scale, arguments);
37350 return linearish(scale);
37353 // node_modules/d3-scale/src/quantize.js
37354 function quantize() {
37355 var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
37356 function scale(x2) {
37357 return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
37359 function rescale() {
37361 domain = new Array(n3);
37363 domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
37366 scale.domain = function(_2) {
37367 return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
37369 scale.range = function(_2) {
37370 return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
37372 scale.invertExtent = function(y2) {
37373 var i3 = range3.indexOf(y2);
37374 return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
37376 scale.unknown = function(_2) {
37377 return arguments.length ? (unknown = _2, scale) : scale;
37379 scale.thresholds = function() {
37380 return domain.slice();
37382 scale.copy = function() {
37383 return quantize().domain([x05, x12]).range(range3).unknown(unknown);
37385 return initRange.apply(linearish(scale), arguments);
37388 // modules/behavior/breathe.js
37389 function behaviorBreathe() {
37390 var duration = 800;
37392 var selector = ".selected.shadow, .selected .shadow";
37393 var _selected = select_default2(null);
37398 function ratchetyInterpolator(a2, b2, steps2, units) {
37401 var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
37402 return function(t2) {
37403 return String(sample(t2)) + (units || "");
37406 function reset(selection2) {
37407 selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
37409 function setAnimationParams(transition2, fromTo) {
37410 var toFrom = fromTo === "from" ? "to" : "from";
37411 transition2.styleTween("stroke-opacity", function(d2) {
37412 return ratchetyInterpolator(
37413 _params[d2.id][toFrom].opacity,
37414 _params[d2.id][fromTo].opacity,
37417 }).styleTween("stroke-width", function(d2) {
37418 return ratchetyInterpolator(
37419 _params[d2.id][toFrom].width,
37420 _params[d2.id][fromTo].width,
37424 }).styleTween("fill-opacity", function(d2) {
37425 return ratchetyInterpolator(
37426 _params[d2.id][toFrom].opacity,
37427 _params[d2.id][fromTo].opacity,
37430 }).styleTween("r", function(d2) {
37431 return ratchetyInterpolator(
37432 _params[d2.id][toFrom].width,
37433 _params[d2.id][fromTo].width,
37439 function calcAnimationParams(selection2) {
37440 selection2.call(reset).each(function(d2) {
37441 var s2 = select_default2(this);
37442 var tag2 = s2.node().tagName;
37443 var p2 = { "from": {}, "to": {} };
37446 if (tag2 === "circle") {
37447 opacity = Number(s2.style("fill-opacity") || 0.5);
37448 width = Number(s2.style("r") || 15.5);
37450 opacity = Number(s2.style("stroke-opacity") || 0.7);
37451 width = Number(s2.style("stroke-width") || 10);
37454 p2.from.opacity = opacity * 0.6;
37455 p2.to.opacity = opacity * 1.25;
37456 p2.from.width = width * 0.7;
37457 p2.to.width = width * (tag2 === "circle" ? 1.5 : 1);
37458 _params[d2.id] = p2;
37461 function run(surface, fromTo) {
37462 var toFrom = fromTo === "from" ? "to" : "from";
37463 var currSelected = surface.selectAll(selector);
37464 var currClassed = surface.attr("class");
37465 if (_done || currSelected.empty()) {
37466 _selected.call(reset);
37467 _selected = select_default2(null);
37470 if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
37471 _selected.call(reset);
37472 _classed = currClassed;
37473 _selected = currSelected.call(calcAnimationParams);
37475 var didCallNextRun = false;
37476 _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
37477 if (!didCallNextRun) {
37478 surface.call(run, toFrom);
37479 didCallNextRun = true;
37481 if (!select_default2(this).classed("selected")) {
37482 reset(select_default2(this));
37486 function behavior(surface) {
37488 _timer = timer(function() {
37489 if (surface.selectAll(selector).empty()) {
37492 surface.call(run, "from");
37497 behavior.restartIfNeeded = function(surface) {
37498 if (_selected.empty()) {
37499 surface.call(run, "from");
37505 behavior.off = function() {
37510 _selected.interrupt().call(reset);
37515 // modules/behavior/operation.js
37516 function behaviorOperation(context) {
37518 function keypress(d3_event) {
37519 if (!context.map().withinEditableZoom())
37521 if (_operation.availableForKeypress && !_operation.availableForKeypress())
37523 d3_event.preventDefault();
37524 var disabled = _operation.disabled();
37526 context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
37528 context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
37529 if (_operation.point)
37530 _operation.point(null);
37534 function behavior() {
37535 if (_operation && _operation.available()) {
37536 context.keybinding().on(_operation.keys, keypress);
37540 behavior.off = function() {
37541 context.keybinding().off(_operation.keys);
37543 behavior.which = function(_2) {
37544 if (!arguments.length)
37552 // modules/operations/circularize.js
37553 function operationCircularize(context, selectedIDs) {
37555 var _actions = selectedIDs.map(getAction).filter(Boolean);
37556 var _amount = _actions.length === 1 ? "single" : "multiple";
37557 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
37560 function getAction(entityID) {
37561 var entity = context.entity(entityID);
37562 if (entity.type !== "way" || new Set(entity.nodes).size <= 1)
37565 _extent = entity.extent(context.graph());
37567 _extent = _extent.extend(entity.extent(context.graph()));
37569 return actionCircularize(entityID, context.projection);
37571 var operation2 = function() {
37572 if (!_actions.length)
37574 var combinedAction = function(graph, t2) {
37575 _actions.forEach(function(action) {
37576 if (!action.disabled(graph)) {
37577 graph = action(graph, t2);
37582 combinedAction.transitionable = true;
37583 context.perform(combinedAction, operation2.annotation());
37584 window.setTimeout(function() {
37585 context.validator().validate();
37588 operation2.available = function() {
37589 return _actions.length && selectedIDs.length === _actions.length;
37591 operation2.disabled = function() {
37592 if (!_actions.length)
37594 var actionDisableds = _actions.map(function(action) {
37595 return action.disabled(context.graph());
37596 }).filter(Boolean);
37597 if (actionDisableds.length === _actions.length) {
37598 if (new Set(actionDisableds).size > 1) {
37599 return "multiple_blockers";
37601 return actionDisableds[0];
37602 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
37603 return "too_large";
37604 } else if (someMissing()) {
37605 return "not_downloaded";
37606 } else if (selectedIDs.some(context.hasHiddenConnections)) {
37607 return "connected_to_hidden";
37610 function someMissing() {
37611 if (context.inIntro())
37613 var osm = context.connection();
37615 var missing = _coords.filter(function(loc) {
37616 return !osm.isDataLoaded(loc);
37618 if (missing.length) {
37619 missing.forEach(function(loc) {
37620 context.loadTileAtLoc(loc);
37628 operation2.tooltip = function() {
37629 var disable = operation2.disabled();
37630 return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
37632 operation2.annotation = function() {
37633 return _t("operations.circularize.annotation.feature", { n: _actions.length });
37635 operation2.id = "circularize";
37636 operation2.keys = [_t("operations.circularize.key")];
37637 operation2.title = _t.append("operations.circularize.title");
37638 operation2.behavior = behaviorOperation(context).which(operation2);
37642 // modules/ui/cmd.js
37643 var uiCmd = function(code) {
37644 var detected = utilDetect();
37645 if (detected.os === "mac") {
37648 if (detected.os === "win") {
37649 if (code === "\u2318\u21E7Z")
37652 var result = "", replacements = {
37656 "\u232B": "Backspace",
37659 for (var i3 = 0; i3 < code.length; i3++) {
37660 if (code[i3] in replacements) {
37661 result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
37663 result += code[i3];
37668 uiCmd.display = function(code) {
37669 if (code.length !== 1)
37671 var detected = utilDetect();
37672 var mac = detected.os === "mac";
37673 var replacements = {
37674 "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
37675 "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
37676 "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
37677 "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
37678 "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
37679 "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
37680 "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
37681 "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
37682 "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
37683 "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
37684 "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
37685 "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
37686 "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
37688 return replacements[code] || code;
37691 // modules/operations/delete.js
37692 function operationDelete(context, selectedIDs) {
37693 var multi = selectedIDs.length === 1 ? "single" : "multiple";
37694 var action = actionDeleteMultiple(selectedIDs);
37695 var nodes = utilGetAllNodes(selectedIDs, context.graph());
37696 var coords = nodes.map(function(n3) {
37699 var extent = utilTotalExtent(selectedIDs, context.graph());
37700 var operation2 = function() {
37701 var nextSelectedID;
37702 var nextSelectedLoc;
37703 if (selectedIDs.length === 1) {
37704 var id2 = selectedIDs[0];
37705 var entity = context.entity(id2);
37706 var geometry = entity.geometry(context.graph());
37707 var parents = context.graph().parentWays(entity);
37708 var parent = parents[0];
37709 if (geometry === "vertex") {
37710 var nodes2 = parent.nodes;
37711 var i3 = nodes2.indexOf(id2);
37714 } else if (i3 === nodes2.length - 1) {
37717 var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
37718 var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
37719 i3 = a2 < b2 ? i3 - 1 : i3 + 1;
37721 nextSelectedID = nodes2[i3];
37722 nextSelectedLoc = context.entity(nextSelectedID).loc;
37725 context.perform(action, operation2.annotation());
37726 context.validator().validate();
37727 if (nextSelectedID && nextSelectedLoc) {
37728 if (context.hasEntity(nextSelectedID)) {
37729 context.enter(modeSelect(context, [nextSelectedID]).follow(true));
37731 context.map().centerEase(nextSelectedLoc);
37732 context.enter(modeBrowse(context));
37735 context.enter(modeBrowse(context));
37738 operation2.available = function() {
37741 operation2.disabled = function() {
37742 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
37743 return "too_large";
37744 } else if (someMissing()) {
37745 return "not_downloaded";
37746 } else if (selectedIDs.some(context.hasHiddenConnections)) {
37747 return "connected_to_hidden";
37748 } else if (selectedIDs.some(protectedMember)) {
37749 return "part_of_relation";
37750 } else if (selectedIDs.some(incompleteRelation)) {
37751 return "incomplete_relation";
37752 } else if (selectedIDs.some(hasWikidataTag)) {
37753 return "has_wikidata_tag";
37756 function someMissing() {
37757 if (context.inIntro())
37759 var osm = context.connection();
37761 var missing = coords.filter(function(loc) {
37762 return !osm.isDataLoaded(loc);
37764 if (missing.length) {
37765 missing.forEach(function(loc) {
37766 context.loadTileAtLoc(loc);
37773 function hasWikidataTag(id2) {
37774 var entity = context.entity(id2);
37775 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
37777 function incompleteRelation(id2) {
37778 var entity = context.entity(id2);
37779 return entity.type === "relation" && !entity.isComplete(context.graph());
37781 function protectedMember(id2) {
37782 var entity = context.entity(id2);
37783 if (entity.type !== "way")
37785 var parents = context.graph().parentRelations(entity);
37786 for (var i3 = 0; i3 < parents.length; i3++) {
37787 var parent = parents[i3];
37788 var type2 = parent.tags.type;
37789 var role = parent.memberById(id2).role || "outer";
37790 if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
37797 operation2.tooltip = function() {
37798 var disable = operation2.disabled();
37799 return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
37801 operation2.annotation = function() {
37802 return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
37804 operation2.id = "delete";
37805 operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
37806 operation2.title = _t.append("operations.delete.title");
37807 operation2.behavior = behaviorOperation(context).which(operation2);
37811 // modules/operations/orthogonalize.js
37812 function operationOrthogonalize(context, selectedIDs) {
37815 var _actions = selectedIDs.map(chooseAction).filter(Boolean);
37816 var _amount = _actions.length === 1 ? "single" : "multiple";
37817 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
37820 function chooseAction(entityID) {
37821 var entity = context.entity(entityID);
37822 var geometry = entity.geometry(context.graph());
37824 _extent = entity.extent(context.graph());
37826 _extent = _extent.extend(entity.extent(context.graph()));
37828 if (entity.type === "way" && new Set(entity.nodes).size > 2) {
37829 if (_type && _type !== "feature")
37832 return actionOrthogonalize(entityID, context.projection);
37833 } else if (geometry === "vertex") {
37834 if (_type && _type !== "corner")
37837 var graph = context.graph();
37838 var parents = graph.parentWays(entity);
37839 if (parents.length === 1) {
37840 var way = parents[0];
37841 if (way.nodes.indexOf(entityID) !== -1) {
37842 return actionOrthogonalize(way.id, context.projection, entityID);
37848 var operation2 = function() {
37849 if (!_actions.length)
37851 var combinedAction = function(graph, t2) {
37852 _actions.forEach(function(action) {
37853 if (!action.disabled(graph)) {
37854 graph = action(graph, t2);
37859 combinedAction.transitionable = true;
37860 context.perform(combinedAction, operation2.annotation());
37861 window.setTimeout(function() {
37862 context.validator().validate();
37865 operation2.available = function() {
37866 return _actions.length && selectedIDs.length === _actions.length;
37868 operation2.disabled = function() {
37869 if (!_actions.length)
37871 var actionDisableds = _actions.map(function(action) {
37872 return action.disabled(context.graph());
37873 }).filter(Boolean);
37874 if (actionDisableds.length === _actions.length) {
37875 if (new Set(actionDisableds).size > 1) {
37876 return "multiple_blockers";
37878 return actionDisableds[0];
37879 } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
37880 return "too_large";
37881 } else if (someMissing()) {
37882 return "not_downloaded";
37883 } else if (selectedIDs.some(context.hasHiddenConnections)) {
37884 return "connected_to_hidden";
37887 function someMissing() {
37888 if (context.inIntro())
37890 var osm = context.connection();
37892 var missing = _coords.filter(function(loc) {
37893 return !osm.isDataLoaded(loc);
37895 if (missing.length) {
37896 missing.forEach(function(loc) {
37897 context.loadTileAtLoc(loc);
37905 operation2.tooltip = function() {
37906 var disable = operation2.disabled();
37907 return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
37909 operation2.annotation = function() {
37910 return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
37912 operation2.id = "orthogonalize";
37913 operation2.keys = [_t("operations.orthogonalize.key")];
37914 operation2.title = _t.append("operations.orthogonalize.title");
37915 operation2.behavior = behaviorOperation(context).which(operation2);
37919 // modules/operations/reflect.js
37920 function operationReflectShort(context, selectedIDs) {
37921 return operationReflect(context, selectedIDs, "short");
37923 function operationReflectLong(context, selectedIDs) {
37924 return operationReflect(context, selectedIDs, "long");
37926 function operationReflect(context, selectedIDs, axis) {
37927 axis = axis || "long";
37928 var multi = selectedIDs.length === 1 ? "single" : "multiple";
37929 var nodes = utilGetAllNodes(selectedIDs, context.graph());
37930 var coords = nodes.map(function(n3) {
37933 var extent = utilTotalExtent(selectedIDs, context.graph());
37934 var operation2 = function() {
37935 var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
37936 context.perform(action, operation2.annotation());
37937 window.setTimeout(function() {
37938 context.validator().validate();
37941 operation2.available = function() {
37942 return nodes.length >= 3;
37944 operation2.disabled = function() {
37945 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
37946 return "too_large";
37947 } else if (someMissing()) {
37948 return "not_downloaded";
37949 } else if (selectedIDs.some(context.hasHiddenConnections)) {
37950 return "connected_to_hidden";
37951 } else if (selectedIDs.some(incompleteRelation)) {
37952 return "incomplete_relation";
37955 function someMissing() {
37956 if (context.inIntro())
37958 var osm = context.connection();
37960 var missing = coords.filter(function(loc) {
37961 return !osm.isDataLoaded(loc);
37963 if (missing.length) {
37964 missing.forEach(function(loc) {
37965 context.loadTileAtLoc(loc);
37972 function incompleteRelation(id2) {
37973 var entity = context.entity(id2);
37974 return entity.type === "relation" && !entity.isComplete(context.graph());
37977 operation2.tooltip = function() {
37978 var disable = operation2.disabled();
37979 return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
37981 operation2.annotation = function() {
37982 return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
37984 operation2.id = "reflect-" + axis;
37985 operation2.keys = [_t("operations.reflect.key." + axis)];
37986 operation2.title = _t.append("operations.reflect.title." + axis);
37987 operation2.behavior = behaviorOperation(context).which(operation2);
37991 // modules/operations/move.js
37992 function operationMove(context, selectedIDs) {
37993 var multi = selectedIDs.length === 1 ? "single" : "multiple";
37994 var nodes = utilGetAllNodes(selectedIDs, context.graph());
37995 var coords = nodes.map(function(n3) {
37998 var extent = utilTotalExtent(selectedIDs, context.graph());
37999 var operation2 = function() {
38000 context.enter(modeMove(context, selectedIDs));
38002 operation2.available = function() {
38003 return selectedIDs.length > 0;
38005 operation2.disabled = function() {
38006 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
38007 return "too_large";
38008 } else if (someMissing()) {
38009 return "not_downloaded";
38010 } else if (selectedIDs.some(context.hasHiddenConnections)) {
38011 return "connected_to_hidden";
38012 } else if (selectedIDs.some(incompleteRelation)) {
38013 return "incomplete_relation";
38016 function someMissing() {
38017 if (context.inIntro())
38019 var osm = context.connection();
38021 var missing = coords.filter(function(loc) {
38022 return !osm.isDataLoaded(loc);
38024 if (missing.length) {
38025 missing.forEach(function(loc) {
38026 context.loadTileAtLoc(loc);
38033 function incompleteRelation(id2) {
38034 var entity = context.entity(id2);
38035 return entity.type === "relation" && !entity.isComplete(context.graph());
38038 operation2.tooltip = function() {
38039 var disable = operation2.disabled();
38040 return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
38042 operation2.annotation = function() {
38043 return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
38045 operation2.id = "move";
38046 operation2.keys = [_t("operations.move.key")];
38047 operation2.title = _t.append("operations.move.title");
38048 operation2.behavior = behaviorOperation(context).which(operation2);
38049 operation2.mouseOnly = true;
38053 // modules/modes/rotate.js
38054 function modeRotate(context, entityIDs) {
38055 var _tolerancePx = 4;
38060 var keybinding = utilKeybinding("rotate");
38062 behaviorEdit(context),
38063 operationCircularize(context, entityIDs).behavior,
38064 operationDelete(context, entityIDs).behavior,
38065 operationMove(context, entityIDs).behavior,
38066 operationOrthogonalize(context, entityIDs).behavior,
38067 operationReflectLong(context, entityIDs).behavior,
38068 operationReflectShort(context, entityIDs).behavior
38070 var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
38073 var _prevTransform;
38075 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
38076 function doRotate(d3_event) {
38078 if (context.graph() !== _prevGraph) {
38079 fn = context.perform;
38081 fn = context.replace;
38083 var projection2 = context.projection;
38084 var currTransform = projection2.transform();
38085 if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
38086 var nodes = utilGetAllNodes(entityIDs, context.graph());
38087 var points = nodes.map(function(n3) {
38088 return projection2(n3.loc);
38090 _pivot = getPivot(points);
38091 _prevAngle = void 0;
38093 var currMouse = context.map().mouse(d3_event);
38094 var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
38095 if (typeof _prevAngle === "undefined")
38096 _prevAngle = currAngle;
38097 var delta = currAngle - _prevAngle;
38098 fn(actionRotate(entityIDs, _pivot, delta, projection2));
38099 _prevTransform = currTransform;
38100 _prevAngle = currAngle;
38101 _prevGraph = context.graph();
38103 function getPivot(points) {
38105 if (points.length === 1) {
38106 _pivot2 = points[0];
38107 } else if (points.length === 2) {
38108 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
38110 var polygonHull = hull_default(points);
38111 if (polygonHull.length === 2) {
38112 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
38114 _pivot2 = centroid_default2(hull_default(points));
38119 function finish(d3_event) {
38120 d3_event.stopPropagation();
38121 context.replace(actionNoop(), annotation);
38122 context.enter(modeSelect(context, entityIDs));
38124 function cancel() {
38127 context.enter(modeSelect(context, entityIDs));
38129 function undone() {
38130 context.enter(modeBrowse(context));
38132 mode.enter = function() {
38134 context.features().forceVisible(entityIDs);
38135 behaviors.forEach(context.install);
38137 context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
38138 downEvent = d3_event;
38140 select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
38143 var mapNode = context.container().select(".main-map").node();
38144 var pointGetter = utilFastMouse(mapNode);
38145 var p1 = pointGetter(downEvent);
38146 var p2 = pointGetter(d3_event);
38147 var dist = geoVecLength(p1, p2);
38148 if (dist <= _tolerancePx)
38152 context.history().on("undone.modeRotate", undone);
38153 keybinding.on("\u238B", cancel).on("\u21A9", finish);
38154 select_default2(document).call(keybinding);
38156 mode.exit = function() {
38157 behaviors.forEach(context.uninstall);
38158 context.surface().on(_pointerPrefix + "down.modeRotate", null);
38159 select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
38160 context.history().on("undone.modeRotate", null);
38161 select_default2(document).call(keybinding.unbind);
38162 context.features().forceVisible([]);
38164 mode.selectedIDs = function() {
38165 if (!arguments.length)
38172 // modules/operations/rotate.js
38173 function operationRotate(context, selectedIDs) {
38174 var multi = selectedIDs.length === 1 ? "single" : "multiple";
38175 var nodes = utilGetAllNodes(selectedIDs, context.graph());
38176 var coords = nodes.map(function(n3) {
38179 var extent = utilTotalExtent(selectedIDs, context.graph());
38180 var operation2 = function() {
38181 context.enter(modeRotate(context, selectedIDs));
38183 operation2.available = function() {
38184 return nodes.length >= 2;
38186 operation2.disabled = function() {
38187 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
38188 return "too_large";
38189 } else if (someMissing()) {
38190 return "not_downloaded";
38191 } else if (selectedIDs.some(context.hasHiddenConnections)) {
38192 return "connected_to_hidden";
38193 } else if (selectedIDs.some(incompleteRelation)) {
38194 return "incomplete_relation";
38197 function someMissing() {
38198 if (context.inIntro())
38200 var osm = context.connection();
38202 var missing = coords.filter(function(loc) {
38203 return !osm.isDataLoaded(loc);
38205 if (missing.length) {
38206 missing.forEach(function(loc) {
38207 context.loadTileAtLoc(loc);
38214 function incompleteRelation(id2) {
38215 var entity = context.entity(id2);
38216 return entity.type === "relation" && !entity.isComplete(context.graph());
38219 operation2.tooltip = function() {
38220 var disable = operation2.disabled();
38221 return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
38223 operation2.annotation = function() {
38224 return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
38226 operation2.id = "rotate";
38227 operation2.keys = [_t("operations.rotate.key")];
38228 operation2.title = _t.append("operations.rotate.title");
38229 operation2.behavior = behaviorOperation(context).which(operation2);
38230 operation2.mouseOnly = true;
38234 // modules/modes/move.js
38235 function modeMove(context, entityIDs, baseGraph) {
38236 var _tolerancePx = 4;
38241 var keybinding = utilKeybinding("move");
38243 behaviorEdit(context),
38244 operationCircularize(context, entityIDs).behavior,
38245 operationDelete(context, entityIDs).behavior,
38246 operationOrthogonalize(context, entityIDs).behavior,
38247 operationReflectLong(context, entityIDs).behavior,
38248 operationReflectShort(context, entityIDs).behavior,
38249 operationRotate(context, entityIDs).behavior
38251 var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
38255 var _nudgeInterval;
38256 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
38257 function doMove(nudge) {
38258 nudge = nudge || [0, 0];
38260 if (_prevGraph !== context.graph()) {
38262 _origin = context.map().mouseCoordinates();
38263 fn = context.perform;
38265 fn = context.overwrite;
38267 var currMouse = context.map().mouse();
38268 var origMouse = context.projection(_origin);
38269 var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
38270 fn(actionMove(entityIDs, delta, context.projection, _cache5));
38271 _prevGraph = context.graph();
38273 function startNudge(nudge) {
38274 if (_nudgeInterval)
38275 window.clearInterval(_nudgeInterval);
38276 _nudgeInterval = window.setInterval(function() {
38277 context.map().pan(nudge);
38281 function stopNudge() {
38282 if (_nudgeInterval) {
38283 window.clearInterval(_nudgeInterval);
38284 _nudgeInterval = null;
38289 var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
38296 function finish(d3_event) {
38297 d3_event.stopPropagation();
38298 context.replace(actionNoop(), annotation);
38299 context.enter(modeSelect(context, entityIDs));
38302 function cancel() {
38304 while (context.graph() !== baseGraph)
38306 context.enter(modeBrowse(context));
38310 context.enter(modeSelect(context, entityIDs));
38314 function undone() {
38315 context.enter(modeBrowse(context));
38317 mode.enter = function() {
38318 _origin = context.map().mouseCoordinates();
38321 context.features().forceVisible(entityIDs);
38322 behaviors.forEach(context.install);
38324 context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
38325 downEvent = d3_event;
38327 select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
38330 var mapNode = context.container().select(".main-map").node();
38331 var pointGetter = utilFastMouse(mapNode);
38332 var p1 = pointGetter(downEvent);
38333 var p2 = pointGetter(d3_event);
38334 var dist = geoVecLength(p1, p2);
38335 if (dist <= _tolerancePx)
38339 context.history().on("undone.modeMove", undone);
38340 keybinding.on("\u238B", cancel).on("\u21A9", finish);
38341 select_default2(document).call(keybinding);
38343 mode.exit = function() {
38345 behaviors.forEach(function(behavior) {
38346 context.uninstall(behavior);
38348 context.surface().on(_pointerPrefix + "down.modeMove", null);
38349 select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
38350 context.history().on("undone.modeMove", null);
38351 select_default2(document).call(keybinding.unbind);
38352 context.features().forceVisible([]);
38354 mode.selectedIDs = function() {
38355 if (!arguments.length)
38362 // modules/behavior/paste.js
38363 function behaviorPaste(context) {
38364 function doPaste(d3_event) {
38365 if (!context.map().withinEditableZoom())
38367 d3_event.preventDefault();
38368 var baseGraph = context.graph();
38369 var mouse = context.map().mouse();
38370 var projection2 = context.projection;
38371 var viewport = geoExtent(projection2.clipExtent()).polygon();
38372 if (!geoPointInPolygon(mouse, viewport))
38374 var oldIDs = context.copyIDs();
38375 if (!oldIDs.length)
38377 var extent = geoExtent();
38378 var oldGraph = context.copyGraph();
38380 var action = actionCopyEntities(oldIDs, oldGraph);
38381 context.perform(action);
38382 var copies = action.copies();
38383 var originals = /* @__PURE__ */ new Set();
38384 Object.values(copies).forEach(function(entity) {
38385 originals.add(entity.id);
38387 for (var id2 in copies) {
38388 var oldEntity = oldGraph.entity(id2);
38389 var newEntity = copies[id2];
38390 extent._extend(oldEntity.extent(oldGraph));
38391 var parents = context.graph().parentWays(newEntity);
38392 var parentCopied = parents.some(function(parent) {
38393 return originals.has(parent.id);
38395 if (!parentCopied) {
38396 newIDs.push(newEntity.id);
38399 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
38400 var delta = geoVecSubtract(mouse, copyPoint);
38401 context.perform(actionMove(newIDs, delta, projection2));
38402 context.enter(modeMove(context, newIDs, baseGraph));
38404 function behavior() {
38405 context.keybinding().on(uiCmd("\u2318V"), doPaste);
38408 behavior.off = function() {
38409 context.keybinding().off(uiCmd("\u2318V"));
38414 // modules/behavior/drag.js
38415 function behaviorDrag() {
38416 var dispatch14 = dispatch_default("start", "move", "end");
38417 var _tolerancePx = 1;
38418 var _penTolerancePx = 4;
38419 var _origin = null;
38420 var _selector = "";
38425 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
38426 var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
38427 var d3_event_userSelectSuppress = function() {
38428 var selection2 = selection_default();
38429 var select = selection2.style(d3_event_userSelectProperty);
38430 selection2.style(d3_event_userSelectProperty, "none");
38431 return function() {
38432 selection2.style(d3_event_userSelectProperty, select);
38435 function pointerdown(d3_event) {
38438 _pointerId = d3_event.pointerId || "mouse";
38439 _targetNode = this;
38440 var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
38442 var startOrigin = pointerLocGetter(d3_event);
38443 var started = false;
38444 var selectEnable = d3_event_userSelectSuppress();
38445 select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
38447 offset = _origin.call(_targetNode, _targetEntity);
38448 offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
38452 d3_event.stopPropagation();
38453 function pointermove(d3_event2) {
38454 if (_pointerId !== (d3_event2.pointerId || "mouse"))
38456 var p2 = pointerLocGetter(d3_event2);
38458 var dist = geoVecLength(startOrigin, p2);
38459 var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
38460 if (dist < tolerance)
38463 dispatch14.call("start", this, d3_event2, _targetEntity);
38466 d3_event2.stopPropagation();
38467 d3_event2.preventDefault();
38468 var dx = p2[0] - startOrigin[0];
38469 var dy = p2[1] - startOrigin[1];
38470 dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
38473 function pointerup(d3_event2) {
38474 if (_pointerId !== (d3_event2.pointerId || "mouse"))
38478 dispatch14.call("end", this, d3_event2, _targetEntity);
38479 d3_event2.preventDefault();
38481 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
38485 function behavior(selection2) {
38486 var matchesSelector = utilPrefixDOMProperty("matchesSelector");
38487 var delegate = pointerdown;
38489 delegate = function(d3_event) {
38491 var target = d3_event.target;
38492 for (; target && target !== root3; target = target.parentNode) {
38493 var datum2 = target.__data__;
38494 _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
38495 if (_targetEntity && target[matchesSelector](_selector)) {
38496 return pointerdown.call(target, d3_event);
38501 selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
38503 behavior.off = function(selection2) {
38504 selection2.on(_pointerPrefix + "down.drag" + _selector, null);
38506 behavior.selector = function(_2) {
38507 if (!arguments.length)
38512 behavior.origin = function(_2) {
38513 if (!arguments.length)
38518 behavior.cancel = function() {
38519 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
38522 behavior.targetNode = function(_2) {
38523 if (!arguments.length)
38524 return _targetNode;
38528 behavior.targetEntity = function(_2) {
38529 if (!arguments.length)
38530 return _targetEntity;
38531 _targetEntity = _2;
38534 behavior.surface = function(_2) {
38535 if (!arguments.length)
38540 return utilRebind(behavior, dispatch14, "on");
38543 // modules/modes/drag_node.js
38544 function modeDragNode(context) {
38549 var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
38550 var edit2 = behaviorEdit(context);
38551 var _nudgeInterval;
38552 var _restoreSelectedIDs = [];
38553 var _wasMidpoint = false;
38554 var _isCancelled = false;
38558 function startNudge(d3_event, entity, nudge) {
38559 if (_nudgeInterval)
38560 window.clearInterval(_nudgeInterval);
38561 _nudgeInterval = window.setInterval(function() {
38562 context.map().pan(nudge);
38563 doMove(d3_event, entity, nudge);
38566 function stopNudge() {
38567 if (_nudgeInterval) {
38568 window.clearInterval(_nudgeInterval);
38569 _nudgeInterval = null;
38572 function moveAnnotation(entity) {
38573 return _t("operations.move.annotation." + entity.geometry(context.graph()));
38575 function connectAnnotation(nodeEntity, targetEntity) {
38576 var nodeGeometry = nodeEntity.geometry(context.graph());
38577 var targetGeometry = targetEntity.geometry(context.graph());
38578 if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
38579 var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
38580 var targetParentWayIDs = context.graph().parentWays(targetEntity);
38581 var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
38582 if (sharedParentWays.length !== 0) {
38583 if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
38584 return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
38586 return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
38589 return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
38591 function shouldSnapToNode(target) {
38592 if (!_activeEntity)
38594 return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
38596 function origin(entity) {
38597 return context.projection(entity.loc);
38599 function keydown(d3_event) {
38600 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
38601 if (context.surface().classed("nope")) {
38602 context.surface().classed("nope-suppressed", true);
38604 context.surface().classed("nope", false).classed("nope-disabled", true);
38607 function keyup(d3_event) {
38608 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
38609 if (context.surface().classed("nope-suppressed")) {
38610 context.surface().classed("nope", true);
38612 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
38615 function start2(d3_event, entity) {
38616 _wasMidpoint = entity.type === "midpoint";
38617 var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
38618 _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
38619 if (_isCancelled) {
38621 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
38623 return drag.cancel();
38625 if (_wasMidpoint) {
38626 var midpoint = entity;
38627 entity = osmNode();
38628 context.perform(actionAddMidpoint(midpoint, entity));
38629 entity = context.entity(entity.id);
38630 var vertex = context.surface().selectAll("." + entity.id);
38631 drag.targetNode(vertex.node()).targetEntity(entity);
38633 context.perform(actionNoop());
38635 _activeEntity = entity;
38636 _startLoc = entity.loc;
38637 hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
38638 context.surface().selectAll("." + _activeEntity.id).classed("active", true);
38639 context.enter(mode);
38641 function datum2(d3_event) {
38642 if (!d3_event || d3_event.altKey) {
38645 var d2 = d3_event.target.__data__;
38646 return d2 && d2.properties && d2.properties.target ? d2 : {};
38649 function doMove(d3_event, entity, nudge) {
38650 nudge = nudge || [0, 0];
38651 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
38652 var currMouse = geoVecSubtract(currPoint, nudge);
38653 var loc = context.projection.invert(currMouse);
38655 if (!_nudgeInterval) {
38656 var d2 = datum2(d3_event);
38657 target = d2 && d2.properties && d2.properties.entity;
38658 var targetLoc = target && target.loc;
38659 var targetNodes = d2 && d2.properties && d2.properties.nodes;
38661 if (shouldSnapToNode(target)) {
38664 } else if (targetNodes) {
38665 edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
38672 actionMoveNode(entity.id, loc)
38674 var isInvalid = false;
38676 isInvalid = hasRelationConflict(entity, target, edge, context.graph());
38679 isInvalid = hasInvalidGeometry(entity, context.graph());
38681 var nope = context.surface().classed("nope");
38682 if (isInvalid === "relation" || isInvalid === "restriction") {
38684 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
38685 "operations.connect." + isInvalid,
38686 { relation: _mainPresetIndex.item("type/restriction").name() }
38689 } else if (isInvalid) {
38690 var errorID = isInvalid === "line" ? "lines" : "areas";
38691 context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
38694 context.ui().flash.duration(1).label("")();
38697 var nopeDisabled = context.surface().classed("nope-disabled");
38698 if (nopeDisabled) {
38699 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
38701 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
38705 function hasRelationConflict(entity, target, edge, graph) {
38706 var testGraph = graph.update();
38708 var midpoint = osmNode();
38709 var action = actionAddMidpoint({
38711 edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
38713 testGraph = action(testGraph);
38716 var ids = [entity.id, target.id];
38717 return actionConnect(ids).disabled(testGraph);
38719 function hasInvalidGeometry(entity, graph) {
38720 var parents = graph.parentWays(entity);
38722 for (i3 = 0; i3 < parents.length; i3++) {
38723 var parent = parents[i3];
38725 var activeIndex = null;
38726 var relations = graph.parentRelations(parent);
38727 for (j2 = 0; j2 < relations.length; j2++) {
38728 if (!relations[j2].isMultipolygon())
38730 var rings = osmJoinWays(relations[j2].members, graph);
38731 for (k2 = 0; k2 < rings.length; k2++) {
38732 nodes = rings[k2].nodes;
38733 if (nodes.find(function(n3) {
38734 return n3.id === entity.id;
38737 if (geoHasSelfIntersections(nodes, entity.id)) {
38738 return "multipolygonMember";
38741 rings[k2].coords = nodes.map(function(n3) {
38745 for (k2 = 0; k2 < rings.length; k2++) {
38746 if (k2 === activeIndex)
38748 if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
38749 return "multipolygonRing";
38753 if (activeIndex === null) {
38754 nodes = parent.nodes.map(function(nodeID) {
38755 return graph.entity(nodeID);
38757 if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
38758 return parent.geometry(graph);
38764 function move(d3_event, entity, point2) {
38767 d3_event.stopPropagation();
38768 context.surface().classed("nope-disabled", d3_event.altKey);
38769 _lastLoc = context.projection.invert(point2);
38770 doMove(d3_event, entity);
38771 var nudge = geoViewportEdge(point2, context.map().dimensions());
38773 startNudge(d3_event, entity, nudge);
38778 function end(d3_event, entity) {
38781 var wasPoint = entity.geometry(context.graph()) === "point";
38782 var d2 = datum2(d3_event);
38783 var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
38784 var target = d2 && d2.properties && d2.properties.entity;
38787 _actionBounceBack(entity.id, _startLoc)
38789 } else if (target && target.type === "way") {
38790 var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
38792 actionAddMidpoint({
38794 edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
38796 connectAnnotation(entity, target)
38798 } else if (target && target.type === "node" && shouldSnapToNode(target)) {
38800 actionConnect([target.id, entity.id]),
38801 connectAnnotation(entity, target)
38803 } else if (_wasMidpoint) {
38806 _t("operations.add.annotation.vertex")
38811 moveAnnotation(entity)
38815 context.enter(modeSelect(context, [entity.id]));
38817 var reselection = _restoreSelectedIDs.filter(function(id2) {
38818 return context.graph().hasEntity(id2);
38820 if (reselection.length) {
38821 context.enter(modeSelect(context, reselection));
38823 context.enter(modeBrowse(context));
38827 function _actionBounceBack(nodeID, toLoc) {
38828 var moveNode = actionMoveNode(nodeID, toLoc);
38829 var action = function(graph, t2) {
38832 return moveNode(graph, t2);
38834 action.transitionable = true;
38837 function cancel() {
38839 context.enter(modeBrowse(context));
38841 var drag = behaviorDrag().selector(".layer-touch.points .target").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
38842 mode.enter = function() {
38843 context.install(hover);
38844 context.install(edit2);
38845 select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
38846 context.history().on("undone.drag-node", cancel);
38848 mode.exit = function() {
38849 context.ui().sidebar.hover.cancel();
38850 context.uninstall(hover);
38851 context.uninstall(edit2);
38852 select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
38853 context.history().on("undone.drag-node", null);
38854 _activeEntity = null;
38855 context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
38858 mode.selectedIDs = function() {
38859 if (!arguments.length)
38860 return _activeEntity ? [_activeEntity.id] : [];
38863 mode.activeID = function() {
38864 if (!arguments.length)
38865 return _activeEntity && _activeEntity.id;
38868 mode.restoreSelectedIDs = function(_2) {
38869 if (!arguments.length)
38870 return _restoreSelectedIDs;
38871 _restoreSelectedIDs = _2;
38874 mode.behavior = drag;
38878 // modules/services/keepRight.js
38879 var import_rbush = __toESM(require_rbush_min());
38881 // node_modules/d3-fetch/src/text.js
38882 function responseText(response) {
38884 throw new Error(response.status + " " + response.statusText);
38885 return response.text();
38887 function text_default3(input, init2) {
38888 return fetch(input, init2).then(responseText);
38891 // node_modules/d3-fetch/src/json.js
38892 function responseJson(response) {
38894 throw new Error(response.status + " " + response.statusText);
38895 if (response.status === 204 || response.status === 205)
38897 return response.json();
38899 function json_default(input, init2) {
38900 return fetch(input, init2).then(responseJson);
38903 // node_modules/d3-fetch/src/xml.js
38904 function parser(type2) {
38905 return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
38907 var xml_default = parser("application/xml");
38908 var html = parser("text/html");
38909 var svg = parser("image/svg+xml");
38911 // modules/services/keepRight.js
38912 var tiler = utilTiler();
38913 var dispatch2 = dispatch_default("loaded");
38914 var _tileZoom = 14;
38915 var _krUrlRoot = "https://www.keepright.at";
38916 var _krData = { errorTypes: {}, localizeStrings: {} };
38919 // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
38992 function abortRequest(controller) {
38994 controller.abort();
38997 function abortUnwantedRequests(cache, tiles) {
38998 Object.keys(cache.inflightTile).forEach((k2) => {
38999 const wanted = tiles.find((tile) => k2 === tile.id);
39001 abortRequest(cache.inflightTile[k2]);
39002 delete cache.inflightTile[k2];
39006 function encodeIssueRtree(d2) {
39007 return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39009 function updateRtree(item, replace) {
39010 _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39012 _cache.rtree.insert(item);
39015 function tokenReplacements(d2) {
39016 if (!(d2 instanceof QAItem))
39018 const replacements = {};
39019 const issueTemplate = _krData.errorTypes[d2.whichType];
39020 if (!issueTemplate) {
39021 console.log("No Template: ", d2.whichType);
39022 console.log(" ", d2.description);
39025 if (!issueTemplate.regex)
39027 const errorRegex = new RegExp(issueTemplate.regex, "i");
39028 const errorMatch = errorRegex.exec(d2.description);
39030 console.log("Unmatched: ", d2.whichType);
39031 console.log(" ", d2.description);
39032 console.log(" ", errorRegex);
39035 for (let i3 = 1; i3 < errorMatch.length; i3++) {
39036 let capture = errorMatch[i3];
39038 idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
39039 if (idType && capture) {
39040 capture = parseError(capture, idType);
39042 const compare2 = capture.toLowerCase();
39043 if (_krData.localizeStrings[compare2]) {
39044 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
39046 capture = unescape_default(capture);
39049 replacements["var" + i3] = capture;
39051 return replacements;
39053 function parseError(capture, idType) {
39054 const compare2 = capture.toLowerCase();
39055 if (_krData.localizeStrings[compare2]) {
39056 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
39060 capture = linkErrorObject2(capture);
39063 capture = linkURL(capture);
39068 capture = linkEntity2(idType + capture);
39071 capture = parse20(capture);
39074 capture = parse211(capture);
39077 capture = parse231(capture);
39080 capture = parse294(capture);
39083 capture = parse370(capture);
39087 function linkErrorObject2(d2) {
39088 return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
39090 function linkEntity2(d2) {
39091 return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
39093 function linkURL(d2) {
39094 return { html: '<a class="kr_external_link" target="_blank" href="'.concat(d2, '">').concat(d2, "</a>") };
39096 function parse211(capture2) {
39098 const items = capture2.split(", ");
39099 items.forEach((item) => {
39100 let id2 = linkEntity2("n" + item.slice(1));
39103 return newList.join(", ");
39105 function parse231(capture2) {
39107 const items = capture2.split("),");
39108 items.forEach((item) => {
39109 const match = item.match(/\#(\d+)\((.+)\)?/);
39110 if (match !== null && match.length > 2) {
39112 linkEntity2("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
39116 return newList.join(", ");
39118 function parse294(capture2) {
39120 const items = capture2.split(",");
39121 items.forEach((item) => {
39122 item = item.split(" ");
39123 const role = '"'.concat(item[0], '"');
39124 const idType2 = item[1].slice(0, 1);
39125 let id2 = item[2].slice(1);
39126 id2 = linkEntity2(idType2 + id2);
39127 newList.push("".concat(role, " ").concat(item[1], " ").concat(id2));
39129 return newList.join(", ");
39131 function parse370(capture2) {
39134 const match = capture2.match(/\(including the name (\'.+\')\)/);
39135 if (match && match.length) {
39136 return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
39140 function parse20(capture2) {
39142 const items = capture2.split(",");
39143 items.forEach((item) => {
39144 const id2 = linkEntity2("n" + item.slice(1));
39147 return newList.join(", ");
39150 var keepRight_default = {
39151 title: "keepRight",
39153 _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
39157 this.event = utilRebind(this, dispatch2, "on");
39161 Object.values(_cache.inflightTile).forEach(abortRequest);
39169 rtree: new import_rbush.default()
39172 // KeepRight API: http://osm.mueschelsoft.de/keepright/interfacing.php
39173 loadIssues(projection2) {
39178 const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
39179 abortUnwantedRequests(_cache, tiles);
39180 tiles.forEach((tile) => {
39181 if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id])
39183 const [left, top, right, bottom] = tile.extent.rectangle();
39184 const params = Object.assign({}, options2, { left, bottom, right, top });
39185 const url = "".concat(_krUrlRoot, "/export.php?") + utilQsString(params);
39186 const controller = new AbortController();
39187 _cache.inflightTile[tile.id] = controller;
39188 json_default(url, { signal: controller.signal }).then((data) => {
39189 delete _cache.inflightTile[tile.id];
39190 _cache.loadedTile[tile.id] = true;
39191 if (!data || !data.features || !data.features.length) {
39192 throw new Error("No Data");
39194 data.features.forEach((feature3) => {
39197 error_type: itemType,
39200 object_id: objectId,
39201 object_type: objectType,
39207 geometry: { coordinates: loc },
39208 properties: { description = "" }
39210 const issueTemplate = _krData.errorTypes[itemType];
39211 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
39212 const whichType = issueTemplate ? itemType : parentIssueType;
39213 const whichTemplate = _krData.errorTypes[whichType];
39214 switch (whichType) {
39216 description = "This feature has a FIXME tag: ".concat(description);
39220 description = description.replace("A turn-", "This turn-");
39227 description = "This turn-restriction~".concat(description);
39230 description = "This highway is missing a maxspeed tag";
39235 description = "This feature~".concat(description);
39238 let coincident = false;
39240 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39241 loc = geoVecAdd(loc, delta);
39242 let bbox2 = geoExtent(loc).bbox();
39243 coincident = _cache.rtree.search(bbox2).length;
39244 } while (coincident);
39245 let d2 = new QAItem(loc, this, itemType, id2, {
39250 severity: whichTemplate.severity || "error",
39256 d2.replacements = tokenReplacements(d2);
39257 _cache.data[id2] = d2;
39258 _cache.rtree.insert(encodeIssueRtree(d2));
39260 dispatch2.call("loaded");
39262 delete _cache.inflightTile[tile.id];
39263 _cache.loadedTile[tile.id] = true;
39267 postUpdate(d2, callback) {
39268 if (_cache.inflightPost[d2.id]) {
39269 return callback({ message: "Error update already inflight", status: -2 }, d2);
39271 const params = { schema: d2.schema, id: d2.id };
39272 if (d2.newStatus) {
39273 params.st = d2.newStatus;
39275 if (d2.newComment !== void 0) {
39276 params.co = d2.newComment;
39278 const url = "".concat(_krUrlRoot, "/comment.php?") + utilQsString(params);
39279 const controller = new AbortController();
39280 _cache.inflightPost[d2.id] = controller;
39281 json_default(url, { signal: controller.signal }).finally(() => {
39282 delete _cache.inflightPost[d2.id];
39283 if (d2.newStatus === "ignore") {
39284 this.removeItem(d2);
39285 } else if (d2.newStatus === "ignore_t") {
39286 this.removeItem(d2);
39287 _cache.closed["".concat(d2.schema, ":").concat(d2.id)] = true;
39289 d2 = this.replaceItem(d2.update({
39290 comment: d2.newComment,
39291 newComment: void 0,
39296 callback(null, d2);
39299 // Get all cached QAItems covering the viewport
39300 getItems(projection2) {
39301 const viewport = projection2.clipExtent();
39302 const min3 = [viewport[0][0], viewport[1][1]];
39303 const max3 = [viewport[1][0], viewport[0][1]];
39304 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39305 return _cache.rtree.search(bbox2).map((d2) => d2.data);
39307 // Get a QAItem from cache
39308 // NOTE: Don't change method name until UI v3 is merged
39310 return _cache.data[id2];
39312 // Replace a single QAItem in the cache
39313 replaceItem(item) {
39314 if (!(item instanceof QAItem) || !item.id)
39316 _cache.data[item.id] = item;
39317 updateRtree(encodeIssueRtree(item), true);
39320 // Remove a single QAItem from the cache
39322 if (!(item instanceof QAItem) || !item.id)
39324 delete _cache.data[item.id];
39325 updateRtree(encodeIssueRtree(item), false);
39328 return "".concat(_krUrlRoot, "/report_map.php?schema=").concat(item.schema, "&error=").concat(item.id);
39330 // Get an array of issues closed during this session.
39331 // Used to populate `closed:keepright` changeset tag
39333 return Object.keys(_cache.closed).sort();
39337 // modules/services/improveOSM.js
39338 var import_rbush2 = __toESM(require_rbush_min());
39339 var tiler2 = utilTiler();
39340 var dispatch3 = dispatch_default("loaded");
39341 var _tileZoom2 = 14;
39342 var _impOsmUrls = {
39343 ow: "https://grab.community.improve-osm.org/directionOfFlowService",
39344 mr: "https://grab.community.improve-osm.org/missingGeoService",
39345 tr: "https://grab.community.improve-osm.org/turnRestrictionService"
39347 var _impOsmData = { icons: {} };
39349 function abortRequest2(i3) {
39350 Object.values(i3).forEach((controller) => {
39352 controller.abort();
39356 function abortUnwantedRequests2(cache, tiles) {
39357 Object.keys(cache.inflightTile).forEach((k2) => {
39358 const wanted = tiles.find((tile) => k2 === tile.id);
39360 abortRequest2(cache.inflightTile[k2]);
39361 delete cache.inflightTile[k2];
39365 function encodeIssueRtree2(d2) {
39366 return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39368 function updateRtree2(item, replace) {
39369 _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39371 _cache2.rtree.insert(item);
39374 function linkErrorObject(d2) {
39375 return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
39377 function linkEntity(d2) {
39378 return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
39380 function pointAverage(points) {
39381 if (points.length) {
39382 const sum = points.reduce(
39383 (acc, point2) => geoVecAdd(acc, [point2.lon, point2.lat]),
39386 return geoVecScale(sum, 1 / points.length);
39391 function relativeBearing(p1, p2) {
39392 let angle2 = Math.atan2(p2.lon - p1.lon, p2.lat - p1.lat);
39394 angle2 += 2 * Math.PI;
39396 return angle2 * 180 / Math.PI;
39398 function cardinalDirection(bearing) {
39399 const dir = 45 * Math.round(bearing / 45);
39411 return _t("QA.improveOSM.directions.".concat(compass[dir]));
39413 function preventCoincident(loc, bumpUp) {
39414 let coincident = false;
39416 let delta = coincident ? [1e-5, 0] : bumpUp ? [0, 1e-5] : [0, 0];
39417 loc = geoVecAdd(loc, delta);
39418 let bbox2 = geoExtent(loc).bbox();
39419 coincident = _cache2.rtree.search(bbox2).length;
39420 } while (coincident);
39423 var improveOSM_default = {
39424 title: "improveOSM",
39426 _mainFileFetcher.get("qa_data").then((d2) => _impOsmData = d2.improveOSM);
39430 this.event = utilRebind(this, dispatch3, "on");
39434 Object.values(_cache2.inflightTile).forEach(abortRequest2);
39442 rtree: new import_rbush2.default()
39445 loadIssues(projection2) {
39450 // Use a high zoom so that clusters aren't returned
39452 const tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
39453 abortUnwantedRequests2(_cache2, tiles);
39454 tiles.forEach((tile) => {
39455 if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id])
39457 const [east, north, west, south] = tile.extent.rectangle();
39458 const params = Object.assign({}, options2, { east, south, west, north });
39459 const requests = {};
39460 Object.keys(_impOsmUrls).forEach((k2) => {
39461 const kParams = Object.assign(
39464 k2 === "mr" ? { type: "PARKING,ROAD,BOTH,PATH" } : { confidenceLevel: "C1" }
39466 const url = "".concat(_impOsmUrls[k2], "/search?") + utilQsString(kParams);
39467 const controller = new AbortController();
39468 requests[k2] = controller;
39469 json_default(url, { signal: controller.signal }).then((data) => {
39470 delete _cache2.inflightTile[tile.id][k2];
39471 if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
39472 delete _cache2.inflightTile[tile.id];
39473 _cache2.loadedTile[tile.id] = true;
39475 if (data.roadSegments) {
39476 data.roadSegments.forEach((feature3) => {
39477 const { points, wayId, fromNodeId, toNodeId } = feature3;
39478 const itemId = "".concat(wayId).concat(fromNodeId).concat(toNodeId);
39479 let mid = points.length / 2;
39481 if (mid % 1 === 0) {
39482 loc = pointAverage([points[mid - 1], points[mid]]);
39484 mid = points[Math.floor(mid)];
39485 loc = [mid.lon, mid.lat];
39487 loc = preventCoincident(loc, false);
39488 let d2 = new QAItem(loc, this, k2, itemId, {
39490 // used as a category
39492 // used to post changes
39500 d2.replacements = {
39501 percentage: feature3.percentOfTrips,
39502 num_trips: feature3.numberOfTrips,
39503 highway: linkErrorObject(_t("QA.keepRight.error_parts.highway")),
39504 from_node: linkEntity("n" + feature3.fromNodeId),
39505 to_node: linkEntity("n" + feature3.toNodeId)
39507 _cache2.data[d2.id] = d2;
39508 _cache2.rtree.insert(encodeIssueRtree2(d2));
39512 data.tiles.forEach((feature3) => {
39513 const { type: type2, x: x2, y: y2, numberOfTrips } = feature3;
39514 const geoType = type2.toLowerCase();
39515 const itemId = "".concat(geoType).concat(x2).concat(y2).concat(numberOfTrips);
39516 let loc = pointAverage(feature3.points);
39517 loc = preventCoincident(loc, false);
39518 let d2 = new QAItem(loc, this, "".concat(k2, "-").concat(geoType), itemId, {
39520 identifier: { x: x2, y: y2 }
39522 d2.replacements = {
39523 num_trips: numberOfTrips,
39524 geometry_type: _t("QA.improveOSM.geometry_types.".concat(geoType))
39526 if (numberOfTrips === -1) {
39527 d2.desc = _t("QA.improveOSM.error_types.mr.description_alt", d2.replacements);
39529 _cache2.data[d2.id] = d2;
39530 _cache2.rtree.insert(encodeIssueRtree2(d2));
39533 if (data.entities) {
39534 data.entities.forEach((feature3) => {
39535 const { point: point2, id: id2, segments, numberOfPasses, turnType } = feature3;
39536 const itemId = "".concat(id2.replace(/[,:+#]/g, "_"));
39537 const loc = preventCoincident([point2.lon, point2.lat], true);
39538 const ids = id2.split(",");
39539 const from_way = ids[0];
39540 const via_node = ids[3];
39541 const to_way = ids[2].split(":")[1];
39542 let d2 = new QAItem(loc, this, k2, itemId, {
39545 objectId: via_node,
39548 const [p1, p2] = segments[0].points;
39549 const dir_of_travel = cardinalDirection(relativeBearing(p1, p2));
39550 d2.replacements = {
39551 num_passed: numberOfPasses,
39552 num_trips: segments[0].numberOfTrips,
39553 turn_restriction: turnType.toLowerCase(),
39554 from_way: linkEntity("w" + from_way),
39555 to_way: linkEntity("w" + to_way),
39556 travel_direction: dir_of_travel,
39557 junction: linkErrorObject(_t("QA.keepRight.error_parts.this_node"))
39559 _cache2.data[d2.id] = d2;
39560 _cache2.rtree.insert(encodeIssueRtree2(d2));
39561 dispatch3.call("loaded");
39565 delete _cache2.inflightTile[tile.id][k2];
39566 if (!Object.keys(_cache2.inflightTile[tile.id]).length) {
39567 delete _cache2.inflightTile[tile.id];
39568 _cache2.loadedTile[tile.id] = true;
39572 _cache2.inflightTile[tile.id] = requests;
39575 getComments(item) {
39576 if (item.comments) {
39577 return Promise.resolve(item);
39579 const key = item.issueKey;
39581 if (key === "ow") {
39582 qParams = item.identifier;
39583 } else if (key === "mr") {
39584 qParams.tileX = item.identifier.x;
39585 qParams.tileY = item.identifier.y;
39586 } else if (key === "tr") {
39587 qParams.targetId = item.identifier;
39589 const url = "".concat(_impOsmUrls[key], "/retrieveComments?") + utilQsString(qParams);
39590 const cacheComments = (data) => {
39591 item.comments = data.comments ? data.comments.reverse() : [];
39592 this.replaceItem(item);
39594 return json_default(url).then(cacheComments).then(() => item);
39596 postUpdate(d2, callback) {
39597 if (!osm_default.authenticated()) {
39598 return callback({ message: "Not Authenticated", status: -3 }, d2);
39600 if (_cache2.inflightPost[d2.id]) {
39601 return callback({ message: "Error update already inflight", status: -2 }, d2);
39603 osm_default.userDetails(sendPayload.bind(this));
39604 function sendPayload(err, user) {
39606 return callback(err, d2);
39608 const key = d2.issueKey;
39609 const url = "".concat(_impOsmUrls[key], "/comment");
39611 username: user.display_name,
39612 targetIds: [d2.identifier]
39614 if (d2.newStatus) {
39615 payload.status = d2.newStatus;
39616 payload.text = "status changed";
39618 if (d2.newComment) {
39619 payload.text = d2.newComment;
39621 const controller = new AbortController();
39622 _cache2.inflightPost[d2.id] = controller;
39625 signal: controller.signal,
39626 body: JSON.stringify(payload)
39628 json_default(url, options2).then(() => {
39629 delete _cache2.inflightPost[d2.id];
39630 if (!d2.newStatus) {
39631 const now3 = /* @__PURE__ */ new Date();
39632 let comments = d2.comments ? d2.comments : [];
39634 username: payload.username,
39635 text: payload.text,
39636 timestamp: now3.getTime() / 1e3
39638 this.replaceItem(d2.update({
39643 this.removeItem(d2);
39644 if (d2.newStatus === "SOLVED") {
39645 if (!(d2.issueKey in _cache2.closed)) {
39646 _cache2.closed[d2.issueKey] = 0;
39648 _cache2.closed[d2.issueKey] += 1;
39652 callback(null, d2);
39653 }).catch((err2) => {
39654 delete _cache2.inflightPost[d2.id];
39656 callback(err2.message);
39660 // Get all cached QAItems covering the viewport
39661 getItems(projection2) {
39662 const viewport = projection2.clipExtent();
39663 const min3 = [viewport[0][0], viewport[1][1]];
39664 const max3 = [viewport[1][0], viewport[0][1]];
39665 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39666 return _cache2.rtree.search(bbox2).map((d2) => d2.data);
39668 // Get a QAItem from cache
39669 // NOTE: Don't change method name until UI v3 is merged
39671 return _cache2.data[id2];
39673 // get the name of the icon to display for this item
39674 getIcon(itemType) {
39675 return _impOsmData.icons[itemType];
39677 // Replace a single QAItem in the cache
39678 replaceItem(issue) {
39679 if (!(issue instanceof QAItem) || !issue.id)
39681 _cache2.data[issue.id] = issue;
39682 updateRtree2(encodeIssueRtree2(issue), true);
39685 // Remove a single QAItem from the cache
39686 removeItem(issue) {
39687 if (!(issue instanceof QAItem) || !issue.id)
39689 delete _cache2.data[issue.id];
39690 updateRtree2(encodeIssueRtree2(issue), false);
39692 // Used to populate `closed:improveosm:*` changeset tags
39693 getClosedCounts() {
39694 return _cache2.closed;
39698 // modules/services/osmose.js
39699 var import_rbush3 = __toESM(require_rbush_min());
39701 // node_modules/marked/lib/marked.esm.js
39702 function _getDefaults() {
39716 var _defaults = _getDefaults();
39717 function changeDefaults(newDefaults) {
39718 _defaults = newDefaults;
39720 var escapeTest = /[&<>"']/;
39721 var escapeReplace = new RegExp(escapeTest.source, "g");
39722 var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
39723 var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
39724 var escapeReplacements = {
39731 var getEscapeReplacement = (ch) => escapeReplacements[ch];
39732 function escape$1(html3, encode) {
39734 if (escapeTest.test(html3)) {
39735 return html3.replace(escapeReplace, getEscapeReplacement);
39738 if (escapeTestNoEncode.test(html3)) {
39739 return html3.replace(escapeReplaceNoEncode, getEscapeReplacement);
39744 var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
39745 function unescape2(html3) {
39746 return html3.replace(unescapeTest, (_2, n3) => {
39747 n3 = n3.toLowerCase();
39748 if (n3 === "colon")
39750 if (n3.charAt(0) === "#") {
39751 return n3.charAt(1) === "x" ? String.fromCharCode(parseInt(n3.substring(2), 16)) : String.fromCharCode(+n3.substring(1));
39756 var caret = /(^|[^\[])\^/g;
39757 function edit(regex, opt) {
39758 let source = typeof regex === "string" ? regex : regex.source;
39761 replace: (name, val) => {
39762 let valSource = typeof val === "string" ? val : val.source;
39763 valSource = valSource.replace(caret, "$1");
39764 source = source.replace(name, valSource);
39768 return new RegExp(source, opt);
39773 function cleanUrl(href) {
39775 href = encodeURI(href).replace(/%25/g, "%");
39781 var noopTest = { exec: () => null };
39782 function splitCells(tableRow, count) {
39783 const row = tableRow.replace(/\|/g, (match, offset, str) => {
39784 let escaped = false;
39786 while (--curr >= 0 && str[curr] === "\\")
39787 escaped = !escaped;
39793 }), cells = row.split(/ \|/);
39795 if (!cells[0].trim()) {
39798 if (cells.length > 0 && !cells[cells.length - 1].trim()) {
39802 if (cells.length > count) {
39803 cells.splice(count);
39805 while (cells.length < count)
39809 for (; i3 < cells.length; i3++) {
39810 cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
39814 function rtrim(str, c2, invert) {
39815 const l2 = str.length;
39820 while (suffLen < l2) {
39821 const currChar = str.charAt(l2 - suffLen - 1);
39822 if (currChar === c2 && !invert) {
39824 } else if (currChar !== c2 && invert) {
39830 return str.slice(0, l2 - suffLen);
39832 function findClosingBracket(str, b2) {
39833 if (str.indexOf(b2[1]) === -1) {
39837 for (let i3 = 0; i3 < str.length; i3++) {
39838 if (str[i3] === "\\") {
39840 } else if (str[i3] === b2[0]) {
39842 } else if (str[i3] === b2[1]) {
39851 function outputLink(cap, link3, raw, lexer2) {
39852 const href = link3.href;
39853 const title = link3.title ? escape$1(link3.title) : null;
39854 const text = cap[1].replace(/\\([\[\]])/g, "$1");
39855 if (cap[0].charAt(0) !== "!") {
39856 lexer2.state.inLink = true;
39863 tokens: lexer2.inlineTokens(text)
39865 lexer2.state.inLink = false;
39873 text: escape$1(text)
39876 function indentCodeCompensation(raw, text) {
39877 const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
39878 if (matchIndentToCode === null) {
39881 const indentToCode = matchIndentToCode[1];
39882 return text.split("\n").map((node) => {
39883 const matchIndentInNode = node.match(/^\s+/);
39884 if (matchIndentInNode === null) {
39887 const [indentInNode] = matchIndentInNode;
39888 if (indentInNode.length >= indentToCode.length) {
39889 return node.slice(indentToCode.length);
39894 var _Tokenizer = class {
39895 // set by the lexer
39896 constructor(options2) {
39897 __publicField(this, "options");
39898 __publicField(this, "rules");
39899 // set by the lexer
39900 __publicField(this, "lexer");
39901 this.options = options2 || _defaults;
39904 const cap = this.rules.block.newline.exec(src);
39905 if (cap && cap[0].length > 0) {
39913 const cap = this.rules.block.code.exec(src);
39915 const text = cap[0].replace(/^ {1,4}/gm, "");
39919 codeBlockStyle: "indented",
39920 text: !this.options.pedantic ? rtrim(text, "\n") : text
39925 const cap = this.rules.block.fences.exec(src);
39927 const raw = cap[0];
39928 const text = indentCodeCompensation(raw, cap[3] || "");
39932 lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
39938 const cap = this.rules.block.heading.exec(src);
39940 let text = cap[2].trim();
39941 if (/#$/.test(text)) {
39942 const trimmed = rtrim(text, "#");
39943 if (this.options.pedantic) {
39944 text = trimmed.trim();
39945 } else if (!trimmed || / $/.test(trimmed)) {
39946 text = trimmed.trim();
39952 depth: cap[1].length,
39954 tokens: this.lexer.inline(text)
39959 const cap = this.rules.block.hr.exec(src);
39968 const cap = this.rules.block.blockquote.exec(src);
39970 let text = cap[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n $1");
39971 text = rtrim(text.replace(/^ *>[ \t]?/gm, ""), "\n");
39972 const top = this.lexer.state.top;
39973 this.lexer.state.top = true;
39974 const tokens = this.lexer.blockTokens(text);
39975 this.lexer.state.top = top;
39977 type: "blockquote",
39985 let cap = this.rules.block.list.exec(src);
39987 let bull = cap[1].trim();
39988 const isordered = bull.length > 1;
39992 ordered: isordered,
39993 start: isordered ? +bull.slice(0, -1) : "",
39997 bull = isordered ? "\\d{1,9}\\".concat(bull.slice(-1)) : "\\".concat(bull);
39998 if (this.options.pedantic) {
39999 bull = isordered ? bull : "[*+-]";
40001 const itemRegex = new RegExp("^( {0,3}".concat(bull, ")((?:[ ][^\\n]*)?(?:\\n|$))"));
40003 let itemContents = "";
40004 let endsWithBlankLine = false;
40006 let endEarly = false;
40007 if (!(cap = itemRegex.exec(src))) {
40010 if (this.rules.block.hr.test(src)) {
40014 src = src.substring(raw.length);
40015 let line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
40016 let nextLine = src.split("\n", 1)[0];
40018 if (this.options.pedantic) {
40020 itemContents = line.trimStart();
40022 indent = cap[2].search(/[^ ]/);
40023 indent = indent > 4 ? 1 : indent;
40024 itemContents = line.slice(indent);
40025 indent += cap[1].length;
40027 let blankLine = false;
40028 if (!line && /^ *$/.test(nextLine)) {
40029 raw += nextLine + "\n";
40030 src = src.substring(nextLine.length + 1);
40034 const nextBulletRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"));
40035 const hrRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"));
40036 const fencesBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:```|~~~)"));
40037 const headingBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}#"));
40039 const rawLine = src.split("\n", 1)[0];
40040 nextLine = rawLine;
40041 if (this.options.pedantic) {
40042 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
40044 if (fencesBeginRegex.test(nextLine)) {
40047 if (headingBeginRegex.test(nextLine)) {
40050 if (nextBulletRegex.test(nextLine)) {
40053 if (hrRegex.test(src)) {
40056 if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
40057 itemContents += "\n" + nextLine.slice(indent);
40062 if (line.search(/[^ ]/) >= 4) {
40065 if (fencesBeginRegex.test(line)) {
40068 if (headingBeginRegex.test(line)) {
40071 if (hrRegex.test(line)) {
40074 itemContents += "\n" + nextLine;
40076 if (!blankLine && !nextLine.trim()) {
40079 raw += rawLine + "\n";
40080 src = src.substring(rawLine.length + 1);
40081 line = nextLine.slice(indent);
40084 if (!list2.loose) {
40085 if (endsWithBlankLine) {
40086 list2.loose = true;
40087 } else if (/\n *\n *$/.test(raw)) {
40088 endsWithBlankLine = true;
40093 if (this.options.gfm) {
40094 istask = /^\[[ xX]\] /.exec(itemContents);
40096 ischecked = istask[0] !== "[ ] ";
40097 itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
40104 checked: ischecked,
40106 text: itemContents,
40111 list2.items[list2.items.length - 1].raw = raw.trimEnd();
40112 list2.items[list2.items.length - 1].text = itemContents.trimEnd();
40113 list2.raw = list2.raw.trimEnd();
40114 for (let i3 = 0; i3 < list2.items.length; i3++) {
40115 this.lexer.state.top = false;
40116 list2.items[i3].tokens = this.lexer.blockTokens(list2.items[i3].text, []);
40117 if (!list2.loose) {
40118 const spacers = list2.items[i3].tokens.filter((t2) => t2.type === "space");
40119 const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
40120 list2.loose = hasMultipleLineBreaks;
40124 for (let i3 = 0; i3 < list2.items.length; i3++) {
40125 list2.items[i3].loose = true;
40132 const cap = this.rules.block.html.exec(src);
40138 pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
40145 const cap = this.rules.block.def.exec(src);
40147 const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
40148 const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
40149 const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
40160 const cap = this.rules.block.table.exec(src);
40164 if (!/[:|]/.test(cap[2])) {
40167 const headers = splitCells(cap[1]);
40168 const aligns = cap[2].replace(/^\||\| *$/g, "").split("|");
40169 const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [];
40177 if (headers.length !== aligns.length) {
40180 for (const align of aligns) {
40181 if (/^ *-+: *$/.test(align)) {
40182 item.align.push("right");
40183 } else if (/^ *:-+: *$/.test(align)) {
40184 item.align.push("center");
40185 } else if (/^ *:-+ *$/.test(align)) {
40186 item.align.push("left");
40188 item.align.push(null);
40191 for (const header of headers) {
40194 tokens: this.lexer.inline(header)
40197 for (const row of rows) {
40198 item.rows.push(splitCells(row, item.header.length).map((cell) => {
40201 tokens: this.lexer.inline(cell)
40208 const cap = this.rules.block.lheading.exec(src);
40213 depth: cap[2].charAt(0) === "=" ? 1 : 2,
40215 tokens: this.lexer.inline(cap[1])
40220 const cap = this.rules.block.paragraph.exec(src);
40222 const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
40227 tokens: this.lexer.inline(text)
40232 const cap = this.rules.block.text.exec(src);
40238 tokens: this.lexer.inline(cap[0])
40243 const cap = this.rules.inline.escape.exec(src);
40248 text: escape$1(cap[1])
40253 const cap = this.rules.inline.tag.exec(src);
40255 if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
40256 this.lexer.state.inLink = true;
40257 } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
40258 this.lexer.state.inLink = false;
40260 if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
40261 this.lexer.state.inRawBlock = true;
40262 } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
40263 this.lexer.state.inRawBlock = false;
40268 inLink: this.lexer.state.inLink,
40269 inRawBlock: this.lexer.state.inRawBlock,
40276 const cap = this.rules.inline.link.exec(src);
40278 const trimmedUrl = cap[2].trim();
40279 if (!this.options.pedantic && /^</.test(trimmedUrl)) {
40280 if (!/>$/.test(trimmedUrl)) {
40283 const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
40284 if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
40288 const lastParenIndex = findClosingBracket(cap[2], "()");
40289 if (lastParenIndex > -1) {
40290 const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
40291 const linkLen = start2 + cap[1].length + lastParenIndex;
40292 cap[2] = cap[2].substring(0, lastParenIndex);
40293 cap[0] = cap[0].substring(0, linkLen).trim();
40299 if (this.options.pedantic) {
40300 const link3 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
40306 title = cap[3] ? cap[3].slice(1, -1) : "";
40308 href = href.trim();
40309 if (/^</.test(href)) {
40310 if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
40311 href = href.slice(1);
40313 href = href.slice(1, -1);
40316 return outputLink(cap, {
40317 href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
40318 title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
40319 }, cap[0], this.lexer);
40322 reflink(src, links) {
40324 if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
40325 const linkString = (cap[2] || cap[1]).replace(/\s+/g, " ");
40326 const link3 = links[linkString.toLowerCase()];
40328 const text = cap[0].charAt(0);
40335 return outputLink(cap, link3, cap[0], this.lexer);
40338 emStrong(src, maskedSrc, prevChar = "") {
40339 let match = this.rules.inline.emStrongLDelim.exec(src);
40342 if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
40344 const nextChar = match[1] || match[2] || "";
40345 if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
40346 const lLength = [...match[0]].length - 1;
40347 let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
40348 const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
40349 endReg.lastIndex = 0;
40350 maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
40351 while ((match = endReg.exec(maskedSrc)) != null) {
40352 rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
40355 rLength = [...rDelim].length;
40356 if (match[3] || match[4]) {
40357 delimTotal += rLength;
40359 } else if (match[5] || match[6]) {
40360 if (lLength % 3 && !((lLength + rLength) % 3)) {
40361 midDelimTotal += rLength;
40365 delimTotal -= rLength;
40366 if (delimTotal > 0)
40368 rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
40369 const lastCharLength = [...match[0]][0].length;
40370 const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
40371 if (Math.min(lLength, rLength) % 2) {
40372 const text2 = raw.slice(1, -1);
40377 tokens: this.lexer.inlineTokens(text2)
40380 const text = raw.slice(2, -2);
40385 tokens: this.lexer.inlineTokens(text)
40391 const cap = this.rules.inline.code.exec(src);
40393 let text = cap[2].replace(/\n/g, " ");
40394 const hasNonSpaceChars = /[^ ]/.test(text);
40395 const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
40396 if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
40397 text = text.substring(1, text.length - 1);
40399 text = escape$1(text, true);
40408 const cap = this.rules.inline.br.exec(src);
40417 const cap = this.rules.inline.del.exec(src);
40423 tokens: this.lexer.inlineTokens(cap[2])
40428 const cap = this.rules.inline.autolink.exec(src);
40431 if (cap[2] === "@") {
40432 text = escape$1(cap[1]);
40433 href = "mailto:" + text;
40435 text = escape$1(cap[1]);
40456 if (cap = this.rules.inline.url.exec(src)) {
40458 if (cap[2] === "@") {
40459 text = escape$1(cap[0]);
40460 href = "mailto:" + text;
40464 prevCapZero = cap[0];
40465 cap[0] = (_b = (_a2 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a2[0]) != null ? _b : "";
40466 } while (prevCapZero !== cap[0]);
40467 text = escape$1(cap[0]);
40468 if (cap[1] === "www.") {
40469 href = "http://" + cap[0];
40490 const cap = this.rules.inline.text.exec(src);
40493 if (this.lexer.state.inRawBlock) {
40496 text = escape$1(cap[0]);
40506 var newline = /^(?: *(?:\n|$))+/;
40507 var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
40508 var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
40509 var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
40510 var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
40511 var bullet = /(?:[*+-]|\d{1,9}[.)])/;
40512 var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
40513 var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
40514 var blockText = /^[^\n]+/;
40515 var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
40516 var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
40517 var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
40518 var _tag = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
40519 var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
40520 var html2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
40521 var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
40522 var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
40523 var blockNormal = {
40538 var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
40542 paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
40544 var blockPedantic = {
40546 html: edit("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", _comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
40547 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
40548 heading: /^(#{1,6})(.*)(?:\n+|$)/,
40550 // fences not supported
40551 lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
40552 paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
40554 var escape4 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
40555 var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
40556 var br = /^( {2,}|\\)\n(?!\s*$)/;
40557 var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
40558 var _punctuation = "\\p{P}\\p{S}";
40559 var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
40560 var blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
40561 var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
40562 var emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
40563 var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
40564 var anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
40565 var autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
40566 var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
40567 var tag = edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
40568 var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
40569 var link2 = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
40570 var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
40571 var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
40572 var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
40573 var inlineNormal = {
40574 _backpedal: noopTest,
40575 // only used for GFM url
40595 var inlinePedantic = {
40597 link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
40598 reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
40602 escape: edit(escape4).replace("])", "~|])").getRegex(),
40603 url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
40604 _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
40605 del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
40606 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
40608 var inlineBreaks = {
40610 br: edit(br).replace("{2,}", "*").getRegex(),
40611 text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
40614 normal: blockNormal,
40616 pedantic: blockPedantic
40619 normal: inlineNormal,
40621 breaks: inlineBreaks,
40622 pedantic: inlinePedantic
40624 var _Lexer = class __Lexer {
40625 constructor(options2) {
40626 __publicField(this, "tokens");
40627 __publicField(this, "options");
40628 __publicField(this, "state");
40629 __publicField(this, "tokenizer");
40630 __publicField(this, "inlineQueue");
40632 this.tokens.links = /* @__PURE__ */ Object.create(null);
40633 this.options = options2 || _defaults;
40634 this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
40635 this.tokenizer = this.options.tokenizer;
40636 this.tokenizer.options = this.options;
40637 this.tokenizer.lexer = this;
40638 this.inlineQueue = [];
40645 block: block.normal,
40646 inline: inline.normal
40648 if (this.options.pedantic) {
40649 rules.block = block.pedantic;
40650 rules.inline = inline.pedantic;
40651 } else if (this.options.gfm) {
40652 rules.block = block.gfm;
40653 if (this.options.breaks) {
40654 rules.inline = inline.breaks;
40656 rules.inline = inline.gfm;
40659 this.tokenizer.rules = rules;
40664 static get rules() {
40671 * Static Lex Method
40673 static lex(src, options2) {
40674 const lexer2 = new __Lexer(options2);
40675 return lexer2.lex(src);
40678 * Static Lex Inline Method
40680 static lexInline(src, options2) {
40681 const lexer2 = new __Lexer(options2);
40682 return lexer2.inlineTokens(src);
40688 src = src.replace(/\r\n|\r/g, "\n");
40689 this.blockTokens(src, this.tokens);
40690 for (let i3 = 0; i3 < this.inlineQueue.length; i3++) {
40691 const next = this.inlineQueue[i3];
40692 this.inlineTokens(next.src, next.tokens);
40694 this.inlineQueue = [];
40695 return this.tokens;
40697 blockTokens(src, tokens = []) {
40698 if (this.options.pedantic) {
40699 src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
40701 src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
40702 return leading + " ".repeat(tabs.length);
40708 let lastParagraphClipped;
40710 if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
40711 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
40712 src = src.substring(token.raw.length);
40713 tokens.push(token);
40720 if (token = this.tokenizer.space(src)) {
40721 src = src.substring(token.raw.length);
40722 if (token.raw.length === 1 && tokens.length > 0) {
40723 tokens[tokens.length - 1].raw += "\n";
40725 tokens.push(token);
40729 if (token = this.tokenizer.code(src)) {
40730 src = src.substring(token.raw.length);
40731 lastToken = tokens[tokens.length - 1];
40732 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
40733 lastToken.raw += "\n" + token.raw;
40734 lastToken.text += "\n" + token.text;
40735 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
40737 tokens.push(token);
40741 if (token = this.tokenizer.fences(src)) {
40742 src = src.substring(token.raw.length);
40743 tokens.push(token);
40746 if (token = this.tokenizer.heading(src)) {
40747 src = src.substring(token.raw.length);
40748 tokens.push(token);
40751 if (token = this.tokenizer.hr(src)) {
40752 src = src.substring(token.raw.length);
40753 tokens.push(token);
40756 if (token = this.tokenizer.blockquote(src)) {
40757 src = src.substring(token.raw.length);
40758 tokens.push(token);
40761 if (token = this.tokenizer.list(src)) {
40762 src = src.substring(token.raw.length);
40763 tokens.push(token);
40766 if (token = this.tokenizer.html(src)) {
40767 src = src.substring(token.raw.length);
40768 tokens.push(token);
40771 if (token = this.tokenizer.def(src)) {
40772 src = src.substring(token.raw.length);
40773 lastToken = tokens[tokens.length - 1];
40774 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
40775 lastToken.raw += "\n" + token.raw;
40776 lastToken.text += "\n" + token.raw;
40777 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
40778 } else if (!this.tokens.links[token.tag]) {
40779 this.tokens.links[token.tag] = {
40786 if (token = this.tokenizer.table(src)) {
40787 src = src.substring(token.raw.length);
40788 tokens.push(token);
40791 if (token = this.tokenizer.lheading(src)) {
40792 src = src.substring(token.raw.length);
40793 tokens.push(token);
40797 if (this.options.extensions && this.options.extensions.startBlock) {
40798 let startIndex = Infinity;
40799 const tempSrc = src.slice(1);
40801 this.options.extensions.startBlock.forEach((getStartIndex) => {
40802 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
40803 if (typeof tempStart === "number" && tempStart >= 0) {
40804 startIndex = Math.min(startIndex, tempStart);
40807 if (startIndex < Infinity && startIndex >= 0) {
40808 cutSrc = src.substring(0, startIndex + 1);
40811 if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
40812 lastToken = tokens[tokens.length - 1];
40813 if (lastParagraphClipped && lastToken.type === "paragraph") {
40814 lastToken.raw += "\n" + token.raw;
40815 lastToken.text += "\n" + token.text;
40816 this.inlineQueue.pop();
40817 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
40819 tokens.push(token);
40821 lastParagraphClipped = cutSrc.length !== src.length;
40822 src = src.substring(token.raw.length);
40825 if (token = this.tokenizer.text(src)) {
40826 src = src.substring(token.raw.length);
40827 lastToken = tokens[tokens.length - 1];
40828 if (lastToken && lastToken.type === "text") {
40829 lastToken.raw += "\n" + token.raw;
40830 lastToken.text += "\n" + token.text;
40831 this.inlineQueue.pop();
40832 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
40834 tokens.push(token);
40839 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
40840 if (this.options.silent) {
40841 console.error(errMsg);
40844 throw new Error(errMsg);
40848 this.state.top = true;
40851 inline(src, tokens = []) {
40852 this.inlineQueue.push({ src, tokens });
40858 inlineTokens(src, tokens = []) {
40859 let token, lastToken, cutSrc;
40860 let maskedSrc = src;
40862 let keepPrevChar, prevChar;
40863 if (this.tokens.links) {
40864 const links = Object.keys(this.tokens.links);
40865 if (links.length > 0) {
40866 while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
40867 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
40868 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
40873 while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
40874 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
40876 while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
40877 maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
40880 if (!keepPrevChar) {
40883 keepPrevChar = false;
40884 if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
40885 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
40886 src = src.substring(token.raw.length);
40887 tokens.push(token);
40894 if (token = this.tokenizer.escape(src)) {
40895 src = src.substring(token.raw.length);
40896 tokens.push(token);
40899 if (token = this.tokenizer.tag(src)) {
40900 src = src.substring(token.raw.length);
40901 lastToken = tokens[tokens.length - 1];
40902 if (lastToken && token.type === "text" && lastToken.type === "text") {
40903 lastToken.raw += token.raw;
40904 lastToken.text += token.text;
40906 tokens.push(token);
40910 if (token = this.tokenizer.link(src)) {
40911 src = src.substring(token.raw.length);
40912 tokens.push(token);
40915 if (token = this.tokenizer.reflink(src, this.tokens.links)) {
40916 src = src.substring(token.raw.length);
40917 lastToken = tokens[tokens.length - 1];
40918 if (lastToken && token.type === "text" && lastToken.type === "text") {
40919 lastToken.raw += token.raw;
40920 lastToken.text += token.text;
40922 tokens.push(token);
40926 if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
40927 src = src.substring(token.raw.length);
40928 tokens.push(token);
40931 if (token = this.tokenizer.codespan(src)) {
40932 src = src.substring(token.raw.length);
40933 tokens.push(token);
40936 if (token = this.tokenizer.br(src)) {
40937 src = src.substring(token.raw.length);
40938 tokens.push(token);
40941 if (token = this.tokenizer.del(src)) {
40942 src = src.substring(token.raw.length);
40943 tokens.push(token);
40946 if (token = this.tokenizer.autolink(src)) {
40947 src = src.substring(token.raw.length);
40948 tokens.push(token);
40951 if (!this.state.inLink && (token = this.tokenizer.url(src))) {
40952 src = src.substring(token.raw.length);
40953 tokens.push(token);
40957 if (this.options.extensions && this.options.extensions.startInline) {
40958 let startIndex = Infinity;
40959 const tempSrc = src.slice(1);
40961 this.options.extensions.startInline.forEach((getStartIndex) => {
40962 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
40963 if (typeof tempStart === "number" && tempStart >= 0) {
40964 startIndex = Math.min(startIndex, tempStart);
40967 if (startIndex < Infinity && startIndex >= 0) {
40968 cutSrc = src.substring(0, startIndex + 1);
40971 if (token = this.tokenizer.inlineText(cutSrc)) {
40972 src = src.substring(token.raw.length);
40973 if (token.raw.slice(-1) !== "_") {
40974 prevChar = token.raw.slice(-1);
40976 keepPrevChar = true;
40977 lastToken = tokens[tokens.length - 1];
40978 if (lastToken && lastToken.type === "text") {
40979 lastToken.raw += token.raw;
40980 lastToken.text += token.text;
40982 tokens.push(token);
40987 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
40988 if (this.options.silent) {
40989 console.error(errMsg);
40992 throw new Error(errMsg);
40999 var _Renderer = class {
41000 constructor(options2) {
41001 __publicField(this, "options");
41002 this.options = options2 || _defaults;
41004 code(code, infostring, escaped) {
41006 const lang = (_a2 = (infostring || "").match(/^\S*/)) == null ? void 0 : _a2[0];
41007 code = code.replace(/\n$/, "") + "\n";
41009 return "<pre><code>" + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
41011 return '<pre><code class="language-' + escape$1(lang) + '">' + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
41013 blockquote(quote) {
41014 return "<blockquote>\n".concat(quote, "</blockquote>\n");
41016 html(html3, block2) {
41019 heading(text, level, raw) {
41020 return "<h".concat(level, ">").concat(text, "</h").concat(level, ">\n");
41025 list(body, ordered, start2) {
41026 const type2 = ordered ? "ol" : "ul";
41027 const startatt = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
41028 return "<" + type2 + startatt + ">\n" + body + "</" + type2 + ">\n";
41030 listitem(text, task, checked) {
41031 return "<li>".concat(text, "</li>\n");
41033 checkbox(checked) {
41034 return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
41037 return "<p>".concat(text, "</p>\n");
41039 table(header, body) {
41041 body = "<tbody>".concat(body, "</tbody>");
41042 return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
41044 tablerow(content) {
41045 return "<tr>\n".concat(content, "</tr>\n");
41047 tablecell(content, flags) {
41048 const type2 = flags.header ? "th" : "td";
41049 const tag2 = flags.align ? "<".concat(type2, ' align="').concat(flags.align, '">') : "<".concat(type2, ">");
41050 return tag2 + content + "</".concat(type2, ">\n");
41053 * span level renderer
41056 return "<strong>".concat(text, "</strong>");
41059 return "<em>".concat(text, "</em>");
41062 return "<code>".concat(text, "</code>");
41068 return "<del>".concat(text, "</del>");
41070 link(href, title, text) {
41071 const cleanHref = cleanUrl(href);
41072 if (cleanHref === null) {
41076 let out = '<a href="' + href + '"';
41078 out += ' title="' + title + '"';
41080 out += ">" + text + "</a>";
41083 image(href, title, text) {
41084 const cleanHref = cleanUrl(href);
41085 if (cleanHref === null) {
41089 let out = '<img src="'.concat(href, '" alt="').concat(text, '"');
41091 out += ' title="'.concat(title, '"');
41100 var _TextRenderer = class {
41101 // no need for block level renderers
41120 link(href, title, text) {
41123 image(href, title, text) {
41130 var _Parser = class __Parser {
41131 constructor(options2) {
41132 __publicField(this, "options");
41133 __publicField(this, "renderer");
41134 __publicField(this, "textRenderer");
41135 this.options = options2 || _defaults;
41136 this.options.renderer = this.options.renderer || new _Renderer();
41137 this.renderer = this.options.renderer;
41138 this.renderer.options = this.options;
41139 this.textRenderer = new _TextRenderer();
41142 * Static Parse Method
41144 static parse(tokens, options2) {
41145 const parser3 = new __Parser(options2);
41146 return parser3.parse(tokens);
41149 * Static Parse Inline Method
41151 static parseInline(tokens, options2) {
41152 const parser3 = new __Parser(options2);
41153 return parser3.parseInline(tokens);
41158 parse(tokens, top = true) {
41160 for (let i3 = 0; i3 < tokens.length; i3++) {
41161 const token = tokens[i3];
41162 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
41163 const genericToken = token;
41164 const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
41165 if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
41170 switch (token.type) {
41175 out += this.renderer.hr();
41179 const headingToken = token;
41180 out += this.renderer.heading(this.parseInline(headingToken.tokens), headingToken.depth, unescape2(this.parseInline(headingToken.tokens, this.textRenderer)));
41184 const codeToken = token;
41185 out += this.renderer.code(codeToken.text, codeToken.lang, !!codeToken.escaped);
41189 const tableToken = token;
41192 for (let j2 = 0; j2 < tableToken.header.length; j2++) {
41193 cell += this.renderer.tablecell(this.parseInline(tableToken.header[j2].tokens), { header: true, align: tableToken.align[j2] });
41195 header += this.renderer.tablerow(cell);
41197 for (let j2 = 0; j2 < tableToken.rows.length; j2++) {
41198 const row = tableToken.rows[j2];
41200 for (let k2 = 0; k2 < row.length; k2++) {
41201 cell += this.renderer.tablecell(this.parseInline(row[k2].tokens), { header: false, align: tableToken.align[k2] });
41203 body += this.renderer.tablerow(cell);
41205 out += this.renderer.table(header, body);
41208 case "blockquote": {
41209 const blockquoteToken = token;
41210 const body = this.parse(blockquoteToken.tokens);
41211 out += this.renderer.blockquote(body);
41215 const listToken = token;
41216 const ordered = listToken.ordered;
41217 const start2 = listToken.start;
41218 const loose = listToken.loose;
41220 for (let j2 = 0; j2 < listToken.items.length; j2++) {
41221 const item = listToken.items[j2];
41222 const checked = item.checked;
41223 const task = item.task;
41226 const checkbox = this.renderer.checkbox(!!checked);
41228 if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
41229 item.tokens[0].text = checkbox + " " + item.tokens[0].text;
41230 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
41231 item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
41234 item.tokens.unshift({
41236 text: checkbox + " "
41240 itemBody += checkbox + " ";
41243 itemBody += this.parse(item.tokens, loose);
41244 body += this.renderer.listitem(itemBody, task, !!checked);
41246 out += this.renderer.list(body, ordered, start2);
41250 const htmlToken = token;
41251 out += this.renderer.html(htmlToken.text, htmlToken.block);
41254 case "paragraph": {
41255 const paragraphToken = token;
41256 out += this.renderer.paragraph(this.parseInline(paragraphToken.tokens));
41260 let textToken = token;
41261 let body = textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text;
41262 while (i3 + 1 < tokens.length && tokens[i3 + 1].type === "text") {
41263 textToken = tokens[++i3];
41264 body += "\n" + (textToken.tokens ? this.parseInline(textToken.tokens) : textToken.text);
41266 out += top ? this.renderer.paragraph(body) : body;
41270 const errMsg = 'Token with "' + token.type + '" type was not found.';
41271 if (this.options.silent) {
41272 console.error(errMsg);
41275 throw new Error(errMsg);
41283 * Parse Inline Tokens
41285 parseInline(tokens, renderer) {
41286 renderer = renderer || this.renderer;
41288 for (let i3 = 0; i3 < tokens.length; i3++) {
41289 const token = tokens[i3];
41290 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
41291 const ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
41292 if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(token.type)) {
41297 switch (token.type) {
41299 const escapeToken = token;
41300 out += renderer.text(escapeToken.text);
41304 const tagToken = token;
41305 out += renderer.html(tagToken.text);
41309 const linkToken = token;
41310 out += renderer.link(linkToken.href, linkToken.title, this.parseInline(linkToken.tokens, renderer));
41314 const imageToken = token;
41315 out += renderer.image(imageToken.href, imageToken.title, imageToken.text);
41319 const strongToken = token;
41320 out += renderer.strong(this.parseInline(strongToken.tokens, renderer));
41324 const emToken = token;
41325 out += renderer.em(this.parseInline(emToken.tokens, renderer));
41329 const codespanToken = token;
41330 out += renderer.codespan(codespanToken.text);
41334 out += renderer.br();
41338 const delToken = token;
41339 out += renderer.del(this.parseInline(delToken.tokens, renderer));
41343 const textToken = token;
41344 out += renderer.text(textToken.text);
41348 const errMsg = 'Token with "' + token.type + '" type was not found.';
41349 if (this.options.silent) {
41350 console.error(errMsg);
41353 throw new Error(errMsg);
41361 var _Hooks = class {
41362 constructor(options2) {
41363 __publicField(this, "options");
41364 this.options = options2 || _defaults;
41367 * Process markdown before marked
41369 preprocess(markdown) {
41373 * Process HTML after marked is finished
41375 postprocess(html3) {
41379 * Process all tokens before walk tokens
41381 processAllTokens(tokens) {
41385 __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
41390 var _parseMarkdown, parseMarkdown_fn, _onError, onError_fn;
41391 var Marked = class {
41392 constructor(...args) {
41393 __privateAdd(this, _parseMarkdown);
41394 __privateAdd(this, _onError);
41395 __publicField(this, "defaults", _getDefaults());
41396 __publicField(this, "options", this.setOptions);
41397 __publicField(this, "parse", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lex, _Parser.parse));
41398 __publicField(this, "parseInline", __privateMethod(this, _parseMarkdown, parseMarkdown_fn).call(this, _Lexer.lexInline, _Parser.parseInline));
41399 __publicField(this, "Parser", _Parser);
41400 __publicField(this, "Renderer", _Renderer);
41401 __publicField(this, "TextRenderer", _TextRenderer);
41402 __publicField(this, "Lexer", _Lexer);
41403 __publicField(this, "Tokenizer", _Tokenizer);
41404 __publicField(this, "Hooks", _Hooks);
41408 * Run callback for every token
41410 walkTokens(tokens, callback) {
41413 for (const token of tokens) {
41414 values = values.concat(callback.call(this, token));
41415 switch (token.type) {
41417 const tableToken = token;
41418 for (const cell of tableToken.header) {
41419 values = values.concat(this.walkTokens(cell.tokens, callback));
41421 for (const row of tableToken.rows) {
41422 for (const cell of row) {
41423 values = values.concat(this.walkTokens(cell.tokens, callback));
41429 const listToken = token;
41430 values = values.concat(this.walkTokens(listToken.items, callback));
41434 const genericToken = token;
41435 if ((_b = (_a2 = this.defaults.extensions) == null ? void 0 : _a2.childTokens) == null ? void 0 : _b[genericToken.type]) {
41436 this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
41437 const tokens2 = genericToken[childTokens].flat(Infinity);
41438 values = values.concat(this.walkTokens(tokens2, callback));
41440 } else if (genericToken.tokens) {
41441 values = values.concat(this.walkTokens(genericToken.tokens, callback));
41449 const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
41450 args.forEach((pack) => {
41451 const opts = { ...pack };
41452 opts.async = this.defaults.async || opts.async || false;
41453 if (pack.extensions) {
41454 pack.extensions.forEach((ext) => {
41456 throw new Error("extension name required");
41458 if ("renderer" in ext) {
41459 const prevRenderer = extensions.renderers[ext.name];
41460 if (prevRenderer) {
41461 extensions.renderers[ext.name] = function(...args2) {
41462 let ret = ext.renderer.apply(this, args2);
41463 if (ret === false) {
41464 ret = prevRenderer.apply(this, args2);
41469 extensions.renderers[ext.name] = ext.renderer;
41472 if ("tokenizer" in ext) {
41473 if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
41474 throw new Error("extension level must be 'block' or 'inline'");
41476 const extLevel = extensions[ext.level];
41478 extLevel.unshift(ext.tokenizer);
41480 extensions[ext.level] = [ext.tokenizer];
41483 if (ext.level === "block") {
41484 if (extensions.startBlock) {
41485 extensions.startBlock.push(ext.start);
41487 extensions.startBlock = [ext.start];
41489 } else if (ext.level === "inline") {
41490 if (extensions.startInline) {
41491 extensions.startInline.push(ext.start);
41493 extensions.startInline = [ext.start];
41498 if ("childTokens" in ext && ext.childTokens) {
41499 extensions.childTokens[ext.name] = ext.childTokens;
41502 opts.extensions = extensions;
41504 if (pack.renderer) {
41505 const renderer = this.defaults.renderer || new _Renderer(this.defaults);
41506 for (const prop in pack.renderer) {
41507 if (!(prop in renderer)) {
41508 throw new Error("renderer '".concat(prop, "' does not exist"));
41510 if (prop === "options") {
41513 const rendererProp = prop;
41514 const rendererFunc = pack.renderer[rendererProp];
41515 const prevRenderer = renderer[rendererProp];
41516 renderer[rendererProp] = (...args2) => {
41517 let ret = rendererFunc.apply(renderer, args2);
41518 if (ret === false) {
41519 ret = prevRenderer.apply(renderer, args2);
41524 opts.renderer = renderer;
41526 if (pack.tokenizer) {
41527 const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
41528 for (const prop in pack.tokenizer) {
41529 if (!(prop in tokenizer)) {
41530 throw new Error("tokenizer '".concat(prop, "' does not exist"));
41532 if (["options", "rules", "lexer"].includes(prop)) {
41535 const tokenizerProp = prop;
41536 const tokenizerFunc = pack.tokenizer[tokenizerProp];
41537 const prevTokenizer = tokenizer[tokenizerProp];
41538 tokenizer[tokenizerProp] = (...args2) => {
41539 let ret = tokenizerFunc.apply(tokenizer, args2);
41540 if (ret === false) {
41541 ret = prevTokenizer.apply(tokenizer, args2);
41546 opts.tokenizer = tokenizer;
41549 const hooks = this.defaults.hooks || new _Hooks();
41550 for (const prop in pack.hooks) {
41551 if (!(prop in hooks)) {
41552 throw new Error("hook '".concat(prop, "' does not exist"));
41554 if (prop === "options") {
41557 const hooksProp = prop;
41558 const hooksFunc = pack.hooks[hooksProp];
41559 const prevHook = hooks[hooksProp];
41560 if (_Hooks.passThroughHooks.has(prop)) {
41561 hooks[hooksProp] = (arg) => {
41562 if (this.defaults.async) {
41563 return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
41564 return prevHook.call(hooks, ret2);
41567 const ret = hooksFunc.call(hooks, arg);
41568 return prevHook.call(hooks, ret);
41571 hooks[hooksProp] = (...args2) => {
41572 let ret = hooksFunc.apply(hooks, args2);
41573 if (ret === false) {
41574 ret = prevHook.apply(hooks, args2);
41580 opts.hooks = hooks;
41582 if (pack.walkTokens) {
41583 const walkTokens2 = this.defaults.walkTokens;
41584 const packWalktokens = pack.walkTokens;
41585 opts.walkTokens = function(token) {
41587 values.push(packWalktokens.call(this, token));
41589 values = values.concat(walkTokens2.call(this, token));
41594 this.defaults = { ...this.defaults, ...opts };
41599 this.defaults = { ...this.defaults, ...opt };
41602 lexer(src, options2) {
41603 return _Lexer.lex(src, options2 != null ? options2 : this.defaults);
41605 parser(tokens, options2) {
41606 return _Parser.parse(tokens, options2 != null ? options2 : this.defaults);
41609 _parseMarkdown = new WeakSet();
41610 parseMarkdown_fn = function(lexer2, parser3) {
41611 return (src, options2) => {
41612 const origOpt = { ...options2 };
41613 const opt = { ...this.defaults, ...origOpt };
41614 if (this.defaults.async === true && origOpt.async === false) {
41616 console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.");
41620 const throwError = __privateMethod(this, _onError, onError_fn).call(this, !!opt.silent, !!opt.async);
41621 if (typeof src === "undefined" || src === null) {
41622 return throwError(new Error("marked(): input parameter is undefined or null"));
41624 if (typeof src !== "string") {
41625 return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
41628 opt.hooks.options = opt;
41631 return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser3(tokens, opt)).then((html3) => opt.hooks ? opt.hooks.postprocess(html3) : html3).catch(throwError);
41635 src = opt.hooks.preprocess(src);
41637 let tokens = lexer2(src, opt);
41639 tokens = opt.hooks.processAllTokens(tokens);
41641 if (opt.walkTokens) {
41642 this.walkTokens(tokens, opt.walkTokens);
41644 let html3 = parser3(tokens, opt);
41646 html3 = opt.hooks.postprocess(html3);
41650 return throwError(e3);
41654 _onError = new WeakSet();
41655 onError_fn = function(silent, async) {
41657 e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
41659 const msg = "<p>An error occurred:</p><pre>" + escape$1(e3.message + "", true) + "</pre>";
41661 return Promise.resolve(msg);
41666 return Promise.reject(e3);
41671 var markedInstance = new Marked();
41672 function marked(src, opt) {
41673 return markedInstance.parse(src, opt);
41675 marked.options = marked.setOptions = function(options2) {
41676 markedInstance.setOptions(options2);
41677 marked.defaults = markedInstance.defaults;
41678 changeDefaults(marked.defaults);
41681 marked.getDefaults = _getDefaults;
41682 marked.defaults = _defaults;
41683 marked.use = function(...args) {
41684 markedInstance.use(...args);
41685 marked.defaults = markedInstance.defaults;
41686 changeDefaults(marked.defaults);
41689 marked.walkTokens = function(tokens, callback) {
41690 return markedInstance.walkTokens(tokens, callback);
41692 marked.parseInline = markedInstance.parseInline;
41693 marked.Parser = _Parser;
41694 marked.parser = _Parser.parse;
41695 marked.Renderer = _Renderer;
41696 marked.TextRenderer = _TextRenderer;
41697 marked.Lexer = _Lexer;
41698 marked.lexer = _Lexer.lex;
41699 marked.Tokenizer = _Tokenizer;
41700 marked.Hooks = _Hooks;
41701 marked.parse = marked;
41702 var options = marked.options;
41703 var setOptions = marked.setOptions;
41704 var use = marked.use;
41705 var walkTokens = marked.walkTokens;
41706 var parseInline = marked.parseInline;
41707 var parser2 = _Parser.parse;
41708 var lexer = _Lexer.lex;
41710 // modules/services/osmose.js
41711 var tiler3 = utilTiler();
41712 var dispatch4 = dispatch_default("loaded");
41713 var _tileZoom3 = 14;
41714 var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
41715 var _osmoseData = { icons: {}, items: [] };
41717 function abortRequest3(controller) {
41719 controller.abort();
41722 function abortUnwantedRequests3(cache, tiles) {
41723 Object.keys(cache.inflightTile).forEach((k2) => {
41724 let wanted = tiles.find((tile) => k2 === tile.id);
41726 abortRequest3(cache.inflightTile[k2]);
41727 delete cache.inflightTile[k2];
41731 function encodeIssueRtree3(d2) {
41732 return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
41734 function updateRtree3(item, replace) {
41735 _cache3.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
41737 _cache3.rtree.insert(item);
41740 function preventCoincident2(loc) {
41741 let coincident = false;
41743 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
41744 loc = geoVecAdd(loc, delta);
41745 let bbox2 = geoExtent(loc).bbox();
41746 coincident = _cache3.rtree.search(bbox2).length;
41747 } while (coincident);
41750 var osmose_default = {
41753 _mainFileFetcher.get("qa_data").then((d2) => {
41754 _osmoseData = d2.osmose;
41755 _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
41760 this.event = utilRebind(this, dispatch4, "on");
41766 Object.values(_cache3.inflightTile).forEach(abortRequest3);
41767 _strings = _cache3.strings;
41768 _colors = _cache3.colors;
41776 rtree: new import_rbush3.default(),
41781 loadIssues(projection2) {
41783 // Tiles return a maximum # of issues
41784 // So we want to filter our request for only types iD supports
41785 item: _osmoseData.items
41787 let tiles = tiler3.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
41788 abortUnwantedRequests3(_cache3, tiles);
41789 tiles.forEach((tile) => {
41790 if (_cache3.loadedTile[tile.id] || _cache3.inflightTile[tile.id])
41792 let [x2, y2, z2] = tile.xyz;
41793 let url = "".concat(_osmoseUrlRoot, "/issues/").concat(z2, "/").concat(x2, "/").concat(y2, ".geojson?") + utilQsString(params);
41794 let controller = new AbortController();
41795 _cache3.inflightTile[tile.id] = controller;
41796 json_default(url, { signal: controller.signal }).then((data) => {
41797 delete _cache3.inflightTile[tile.id];
41798 _cache3.loadedTile[tile.id] = true;
41799 if (data.features) {
41800 data.features.forEach((issue) => {
41801 const { item, class: cl, uuid: id2 } = issue.properties;
41802 const itemType = "".concat(item, "-").concat(cl);
41803 if (itemType in _osmoseData.icons) {
41804 let loc = issue.geometry.coordinates;
41805 loc = preventCoincident2(loc);
41806 let d2 = new QAItem(loc, this, itemType, id2, { item });
41807 if (item === 8300 || item === 8360) {
41810 _cache3.data[d2.id] = d2;
41811 _cache3.rtree.insert(encodeIssueRtree3(d2));
41815 dispatch4.call("loaded");
41817 delete _cache3.inflightTile[tile.id];
41818 _cache3.loadedTile[tile.id] = true;
41822 loadIssueDetail(issue) {
41823 if (issue.elems !== void 0) {
41824 return Promise.resolve(issue);
41826 const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "?langs=").concat(_mainLocalizer.localeCode());
41827 const cacheDetails = (data) => {
41828 issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
41829 issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
41830 this.replaceItem(issue);
41832 return json_default(url).then(cacheDetails).then(() => issue);
41834 loadStrings(locale2 = _mainLocalizer.localeCode()) {
41835 const items = Object.keys(_osmoseData.icons);
41836 if (locale2 in _cache3.strings && Object.keys(_cache3.strings[locale2]).length === items.length) {
41837 return Promise.resolve(_cache3.strings[locale2]);
41839 if (!(locale2 in _cache3.strings)) {
41840 _cache3.strings[locale2] = {};
41842 const allRequests = items.map((itemType) => {
41843 if (itemType in _cache3.strings[locale2])
41845 const cacheData = (data) => {
41846 const [cat = { items: [] }] = data.categories;
41847 const [item2 = { class: [] }] = cat.items;
41848 const [cl2 = null] = item2.class;
41850 console.log("Osmose strings request (".concat(itemType, ") had unexpected data"));
41853 const { item: itemInt, color: color2 } = item2;
41854 if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
41855 _cache3.colors[itemInt] = color2;
41857 const { title, detail, fix, trap } = cl2;
41858 let issueStrings = {};
41860 issueStrings.title = title.auto;
41862 issueStrings.detail = marked(detail.auto);
41864 issueStrings.trap = marked(trap.auto);
41866 issueStrings.fix = marked(fix.auto);
41867 _cache3.strings[locale2][itemType] = issueStrings;
41869 const [item, cl] = itemType.split("-");
41870 const url = "".concat(_osmoseUrlRoot, "/items/").concat(item, "/class/").concat(cl, "?langs=").concat(locale2);
41871 return json_default(url).then(cacheData);
41872 }).filter(Boolean);
41873 return Promise.all(allRequests).then(() => _cache3.strings[locale2]);
41875 getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
41876 return locale2 in _cache3.strings ? _cache3.strings[locale2][itemType] : {};
41878 getColor(itemType) {
41879 return itemType in _cache3.colors ? _cache3.colors[itemType] : "#FFFFFF";
41881 postUpdate(issue, callback) {
41882 if (_cache3.inflightPost[issue.id]) {
41883 return callback({ message: "Issue update already inflight", status: -2 }, issue);
41885 const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "/").concat(issue.newStatus);
41886 const controller = new AbortController();
41887 const after = () => {
41888 delete _cache3.inflightPost[issue.id];
41889 this.removeItem(issue);
41890 if (issue.newStatus === "done") {
41891 if (!(issue.item in _cache3.closed)) {
41892 _cache3.closed[issue.item] = 0;
41894 _cache3.closed[issue.item] += 1;
41897 callback(null, issue);
41899 _cache3.inflightPost[issue.id] = controller;
41900 fetch(url, { signal: controller.signal }).then(after).catch((err) => {
41901 delete _cache3.inflightPost[issue.id];
41903 callback(err.message);
41906 // Get all cached QAItems covering the viewport
41907 getItems(projection2) {
41908 const viewport = projection2.clipExtent();
41909 const min3 = [viewport[0][0], viewport[1][1]];
41910 const max3 = [viewport[1][0], viewport[0][1]];
41911 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41912 return _cache3.rtree.search(bbox2).map((d2) => d2.data);
41914 // Get a QAItem from cache
41915 // NOTE: Don't change method name until UI v3 is merged
41917 return _cache3.data[id2];
41919 // get the name of the icon to display for this item
41920 getIcon(itemType) {
41921 return _osmoseData.icons[itemType];
41923 // Replace a single QAItem in the cache
41924 replaceItem(item) {
41925 if (!(item instanceof QAItem) || !item.id)
41927 _cache3.data[item.id] = item;
41928 updateRtree3(encodeIssueRtree3(item), true);
41931 // Remove a single QAItem from the cache
41933 if (!(item instanceof QAItem) || !item.id)
41935 delete _cache3.data[item.id];
41936 updateRtree3(encodeIssueRtree3(item), false);
41938 // Used to populate `closed:osmose:*` changeset tags
41939 getClosedCounts() {
41940 return _cache3.closed;
41943 return "https://osmose.openstreetmap.fr/en/error/".concat(item.id);
41947 // modules/services/mapillary.js
41948 var import_pbf = __toESM(require_pbf());
41949 var import_rbush4 = __toESM(require_rbush_min());
41950 var import_vector_tile = __toESM(require_vector_tile());
41951 var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
41952 var apiUrl = "https://graph.mapillary.com/";
41953 var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
41954 var mapFeatureTileUrl = "".concat(baseTileUrl, "/mly_map_feature_point/2/{z}/{x}/{y}?access_token=").concat(accessToken);
41955 var tileUrl = "".concat(baseTileUrl, "/mly1_public/2/{z}/{x}/{y}?access_token=").concat(accessToken);
41956 var trafficSignTileUrl = "".concat(baseTileUrl, "/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=").concat(accessToken);
41957 var viewercss = "mapillary-js/mapillary.css";
41958 var viewerjs = "mapillary-js/mapillary.js";
41960 var dispatch5 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
41961 var _loadViewerPromise;
41962 var _mlyActiveImage;
41964 var _mlyFallback = false;
41965 var _mlyHighlightedDetection;
41966 var _mlyShowFeatureDetections = false;
41967 var _mlyShowSignDetections = false;
41969 var _mlyViewerFilter = ["all"];
41970 function loadTiles(which, url, maxZoom2, projection2) {
41971 const tiler9 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
41972 const tiles = tiler9.getTiles(projection2);
41973 tiles.forEach(function(tile) {
41974 loadTile(which, url, tile);
41977 function loadTile(which, url, tile) {
41978 const cache = _mlyCache.requests;
41979 const tileId = "".concat(tile.id, "-").concat(which);
41980 if (cache.loaded[tileId] || cache.inflight[tileId])
41982 const controller = new AbortController();
41983 cache.inflight[tileId] = controller;
41984 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
41985 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
41986 if (!response.ok) {
41987 throw new Error(response.status + " " + response.statusText);
41989 cache.loaded[tileId] = true;
41990 delete cache.inflight[tileId];
41991 return response.arrayBuffer();
41992 }).then(function(data) {
41994 throw new Error("No Data");
41996 loadTileDataToCache(data, tile, which);
41997 if (which === "images") {
41998 dispatch5.call("loadedImages");
41999 } else if (which === "signs") {
42000 dispatch5.call("loadedSigns");
42001 } else if (which === "points") {
42002 dispatch5.call("loadedMapFeatures");
42004 }).catch(function() {
42005 cache.loaded[tileId] = true;
42006 delete cache.inflight[tileId];
42009 function loadTileDataToCache(data, tile, which) {
42010 const vectorTile = new import_vector_tile.VectorTile(new import_pbf.default(data));
42011 let features, cache, layer, i3, feature3, loc, d2;
42012 if (vectorTile.layers.hasOwnProperty("image")) {
42014 cache = _mlyCache.images;
42015 layer = vectorTile.layers.image;
42016 for (i3 = 0; i3 < layer.length; i3++) {
42017 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
42018 loc = feature3.geometry.coordinates;
42021 captured_at: feature3.properties.captured_at,
42022 ca: feature3.properties.compass_angle,
42023 id: feature3.properties.id,
42024 is_pano: feature3.properties.is_pano,
42025 sequence_id: feature3.properties.sequence_id
42027 cache.forImageId[d2.id] = d2;
42037 cache.rtree.load(features);
42040 if (vectorTile.layers.hasOwnProperty("sequence")) {
42042 cache = _mlyCache.sequences;
42043 layer = vectorTile.layers.sequence;
42044 for (i3 = 0; i3 < layer.length; i3++) {
42045 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
42046 if (cache.lineString[feature3.properties.id]) {
42047 cache.lineString[feature3.properties.id].push(feature3);
42049 cache.lineString[feature3.properties.id] = [feature3];
42053 if (vectorTile.layers.hasOwnProperty("point")) {
42055 cache = _mlyCache[which];
42056 layer = vectorTile.layers.point;
42057 for (i3 = 0; i3 < layer.length; i3++) {
42058 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
42059 loc = feature3.geometry.coordinates;
42062 id: feature3.properties.id,
42063 first_seen_at: feature3.properties.first_seen_at,
42064 last_seen_at: feature3.properties.last_seen_at,
42065 value: feature3.properties.value
42076 cache.rtree.load(features);
42079 if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
42081 cache = _mlyCache[which];
42082 layer = vectorTile.layers.traffic_sign;
42083 for (i3 = 0; i3 < layer.length; i3++) {
42084 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
42085 loc = feature3.geometry.coordinates;
42088 id: feature3.properties.id,
42089 first_seen_at: feature3.properties.first_seen_at,
42090 last_seen_at: feature3.properties.last_seen_at,
42091 value: feature3.properties.value
42102 cache.rtree.load(features);
42106 function loadData(url) {
42107 return fetch(url).then(function(response) {
42108 if (!response.ok) {
42109 throw new Error(response.status + " " + response.statusText);
42111 return response.json();
42112 }).then(function(result) {
42116 return result.data || [];
42119 function partitionViewport(projection2) {
42120 const z2 = geoScaleToZoom(projection2.scale());
42121 const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
42122 const tiler9 = utilTiler().zoomExtent([z22, z22]);
42123 return tiler9.getTiles(projection2).map(function(tile) {
42124 return tile.extent;
42127 function searchLimited(limit, projection2, rtree) {
42128 limit = limit || 5;
42129 return partitionViewport(projection2).reduce(function(result, extent) {
42130 const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
42133 return found.length ? result.concat(found) : result;
42136 var mapillary_default = {
42137 // Initialize Mapillary
42142 this.event = utilRebind(this, dispatch5, "on");
42144 // Reset cache and state
42145 reset: function() {
42147 Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
42152 images: { rtree: new import_rbush4.default(), forImageId: {} },
42153 image_detections: { forImageId: {} },
42154 signs: { rtree: new import_rbush4.default() },
42155 points: { rtree: new import_rbush4.default() },
42156 sequences: { rtree: new import_rbush4.default(), lineString: {} },
42157 requests: { loaded: {}, inflight: {} }
42159 _mlyActiveImage = null;
42161 // Get visible images
42162 images: function(projection2) {
42164 return searchLimited(limit, projection2, _mlyCache.images.rtree);
42166 // Get visible traffic signs
42167 signs: function(projection2) {
42169 return searchLimited(limit, projection2, _mlyCache.signs.rtree);
42171 // Get visible map (point) features
42172 mapFeatures: function(projection2) {
42174 return searchLimited(limit, projection2, _mlyCache.points.rtree);
42176 // Get cached image by id
42177 cachedImage: function(imageId) {
42178 return _mlyCache.images.forImageId[imageId];
42180 // Get visible sequences
42181 sequences: function(projection2) {
42182 const viewport = projection2.clipExtent();
42183 const min3 = [viewport[0][0], viewport[1][1]];
42184 const max3 = [viewport[1][0], viewport[0][1]];
42185 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
42186 const sequenceIds = {};
42187 let lineStrings = [];
42188 _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
42189 if (d2.data.sequence_id) {
42190 sequenceIds[d2.data.sequence_id] = true;
42193 Object.keys(sequenceIds).forEach(function(sequenceId) {
42194 if (_mlyCache.sequences.lineString[sequenceId]) {
42195 lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
42198 return lineStrings;
42200 // Load images in the visible area
42201 loadImages: function(projection2) {
42202 loadTiles("images", tileUrl, 14, projection2);
42204 // Load traffic signs in the visible area
42205 loadSigns: function(projection2) {
42206 loadTiles("signs", trafficSignTileUrl, 14, projection2);
42208 // Load map (point) features in the visible area
42209 loadMapFeatures: function(projection2) {
42210 loadTiles("points", mapFeatureTileUrl, 14, projection2);
42212 // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
42213 ensureViewerLoaded: function(context) {
42214 if (_loadViewerPromise)
42215 return _loadViewerPromise;
42216 const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
42217 wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
42219 _loadViewerPromise = new Promise((resolve, reject) => {
42220 let loadedCount = 0;
42221 function loaded() {
42223 if (loadedCount === 2)
42226 const head = select_default2("head");
42227 head.selectAll("#ideditor-mapillary-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapillary-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(viewercss)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
42230 head.selectAll("#ideditor-mapillary-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapillary-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(viewerjs)).on("load.serviceMapillary", loaded).on("error.serviceMapillary", function() {
42233 }).catch(function() {
42234 _loadViewerPromise = null;
42235 }).then(function() {
42236 that.initViewer(context);
42238 return _loadViewerPromise;
42240 // Load traffic sign image sprites
42241 loadSignResources: function(context) {
42242 context.ui().svgDefs.addSprites(
42243 ["mapillary-sprite"],
42245 /* don't override colors */
42249 // Load map (point) feature image sprites
42250 loadObjectResources: function(context) {
42251 context.ui().svgDefs.addSprites(
42252 ["mapillary-object-sprite"],
42254 /* don't override colors */
42258 // Remove previous detections in image viewer
42259 resetTags: function() {
42260 if (_mlyViewer && !_mlyFallback) {
42261 _mlyViewer.getComponent("tag").removeAll();
42264 // Show map feature detections in image viewer
42265 showFeatureDetections: function(value) {
42266 _mlyShowFeatureDetections = value;
42267 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
42271 // Show traffic sign detections in image viewer
42272 showSignDetections: function(value) {
42273 _mlyShowSignDetections = value;
42274 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
42278 // Apply filter to image viewer
42279 filterViewer: function(context) {
42280 const showsPano = context.photos().showsPanoramic();
42281 const showsFlat = context.photos().showsFlat();
42282 const fromDate = context.photos().fromDate();
42283 const toDate = context.photos().toDate();
42284 const filter2 = ["all"];
42286 filter2.push(["!=", "cameraType", "spherical"]);
42287 if (!showsFlat && showsPano)
42288 filter2.push(["==", "pano", true]);
42290 filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
42293 filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
42296 _mlyViewer.setFilter(filter2);
42298 _mlyViewerFilter = filter2;
42301 // Make the image viewer visible
42302 showViewer: function(context) {
42303 const wrap2 = context.container().select(".photoviewer").classed("hide", false);
42304 const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
42305 if (isHidden && _mlyViewer) {
42306 wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
42307 wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
42308 _mlyViewer.resize();
42312 // Hide the image viewer and resets map markers
42313 hideViewer: function(context) {
42314 _mlyActiveImage = null;
42315 if (!_mlyFallback && _mlyViewer) {
42316 _mlyViewer.getComponent("sequence").stop();
42318 const viewer = context.container().select(".photoviewer");
42319 if (!viewer.empty())
42320 viewer.datum(null);
42321 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
42322 this.updateUrlImage(null);
42323 dispatch5.call("imageChanged");
42324 dispatch5.call("loadedMapFeatures");
42325 dispatch5.call("loadedSigns");
42326 return this.setStyles(context, null);
42328 // Update the URL with current image id
42329 updateUrlImage: function(imageId) {
42330 if (!window.mocha) {
42331 const hash = utilStringQs(window.location.hash);
42333 hash.photo = "mapillary/" + imageId;
42337 window.location.replace("#" + utilQsString(hash, true));
42340 // Highlight the detection in the viewer that is related to the clicked map feature
42341 highlightDetection: function(detection) {
42343 _mlyHighlightedDetection = detection.id;
42347 // Initialize image viewer (Mapillar JS)
42348 initViewer: function(context) {
42350 if (!window.mapillary)
42359 container: "ideditor-mly"
42361 if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
42362 _mlyFallback = true;
42377 _mlyViewer = new mapillary.Viewer(opts);
42378 _mlyViewer.on("image", imageChanged);
42379 _mlyViewer.on("bearing", bearingChanged);
42380 if (_mlyViewerFilter) {
42381 _mlyViewer.setFilter(_mlyViewerFilter);
42383 context.ui().photoviewer.on("resize.mapillary", function() {
42385 _mlyViewer.resize();
42387 function imageChanged(node) {
42389 const image = node.image;
42390 that.setActiveImage(image);
42391 that.setStyles(context, null);
42392 const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
42393 context.map().centerEase(loc);
42394 that.updateUrlImage(image.id);
42395 if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
42396 that.updateDetections(image.id, "".concat(apiUrl, "/").concat(image.id, "/detections?access_token=").concat(accessToken, "&fields=id,image,geometry,value"));
42398 dispatch5.call("imageChanged");
42400 function bearingChanged(e3) {
42401 dispatch5.call("bearingChanged", void 0, e3);
42404 // Move to an image
42405 selectImage: function(context, imageId) {
42406 if (_mlyViewer && imageId) {
42407 _mlyViewer.moveTo(imageId).catch(function(e3) {
42408 console.error("mly3", e3);
42413 // Return the currently displayed image
42414 getActiveImage: function() {
42415 return _mlyActiveImage;
42417 // Return a list of detection objects for the given id
42418 getDetections: function(id2) {
42419 return loadData("".concat(apiUrl, "/").concat(id2, "/detections?access_token=").concat(accessToken, "&fields=id,value,image"));
42421 // Set the currently visible image
42422 setActiveImage: function(image) {
42424 _mlyActiveImage = {
42425 ca: image.originalCompassAngle,
42427 loc: [image.originalLngLat.lng, image.originalLngLat.lat],
42428 is_pano: image.cameraType === "spherical",
42429 sequence_id: image.sequenceId
42432 _mlyActiveImage = null;
42435 // Update the currently highlighted sequence and selected bubble.
42436 setStyles: function(context, hovered) {
42437 const hoveredImageId = hovered && hovered.id;
42438 const hoveredSequenceId = hovered && hovered.sequence_id;
42439 const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
42440 context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
42441 return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
42442 }).classed("hovered", function(d2) {
42443 return d2.id === hoveredImageId;
42445 context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
42446 return d2.properties.id === hoveredSequenceId;
42447 }).classed("currentView", function(d2) {
42448 return d2.properties.id === selectedSequenceId;
42452 // Get detections for the current image and shows them in the image viewer
42453 updateDetections: function(imageId, url) {
42454 if (!_mlyViewer || _mlyFallback)
42458 const cache = _mlyCache.image_detections;
42459 if (cache.forImageId[imageId]) {
42460 showDetections(_mlyCache.image_detections.forImageId[imageId]);
42462 loadData(url).then((detections) => {
42463 detections.forEach(function(detection) {
42464 if (!cache.forImageId[imageId]) {
42465 cache.forImageId[imageId] = [];
42467 cache.forImageId[imageId].push({
42468 geometry: detection.geometry,
42471 value: detection.value
42474 showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
42477 function showDetections(detections) {
42478 const tagComponent = _mlyViewer.getComponent("tag");
42479 detections.forEach(function(data) {
42480 const tag2 = makeTag(data);
42482 tagComponent.add([tag2]);
42486 function makeTag(data) {
42487 const valueParts = data.value.split("--");
42488 if (!valueParts.length)
42492 let color2 = 16777215;
42493 if (_mlyHighlightedDetection === data.id) {
42495 text = valueParts[1];
42496 if (text === "flat" || text === "discrete" || text === "sign") {
42497 text = valueParts[2];
42499 text = text.replace(/-/g, " ");
42500 text = text.charAt(0).toUpperCase() + text.slice(1);
42501 _mlyHighlightedDetection = null;
42503 var decodedGeometry = window.atob(data.geometry);
42504 var uintArray = new Uint8Array(decodedGeometry.length);
42505 for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
42506 uintArray[i3] = decodedGeometry.charCodeAt(i3);
42508 const tile = new import_vector_tile.VectorTile(new import_pbf.default(uintArray.buffer));
42509 const layer = tile.layers["mpy-or"];
42510 const geometries = layer.feature(0).loadGeometry();
42511 const polygon2 = geometries.map((ring) => ring.map((point2) => [point2.x / layer.extent, point2.y / layer.extent]));
42512 tag2 = new mapillary.OutlineTag(
42514 new mapillary.PolygonGeometry(polygon2[0]),
42527 // Return the current cache
42528 cache: function() {
42533 // modules/core/validation/models.js
42534 function validationIssue(attrs) {
42535 this.type = attrs.type;
42536 this.subtype = attrs.subtype;
42537 this.severity = attrs.severity;
42538 this.message = attrs.message;
42539 this.reference = attrs.reference;
42540 this.entityIds = attrs.entityIds;
42541 this.loc = attrs.loc;
42542 this.data = attrs.data;
42543 this.dynamicFixes = attrs.dynamicFixes;
42544 this.hash = attrs.hash;
42545 this.id = generateID.apply(this);
42546 this.key = generateKey.apply(this);
42547 this.autoFix = null;
42548 function generateID() {
42549 var parts = [this.type];
42551 parts.push(this.hash);
42553 if (this.subtype) {
42554 parts.push(this.subtype);
42556 if (this.entityIds) {
42557 var entityKeys = this.entityIds.slice().sort();
42558 parts.push.apply(parts, entityKeys);
42560 return parts.join(":");
42562 function generateKey() {
42563 return this.id + ":" + Date.now().toString();
42565 this.extent = function(resolver) {
42567 return geoExtent(this.loc);
42569 if (this.entityIds && this.entityIds.length) {
42570 return this.entityIds.reduce(function(extent, entityId) {
42571 return extent.extend(resolver.entity(entityId).extent(resolver));
42576 this.fixes = function(context) {
42577 var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
42579 if (issue.severity === "warning") {
42580 fixes.push(new validationIssueFix({
42581 title: _t.append("issues.fix.ignore_issue.title"),
42582 icon: "iD-icon-close",
42583 onClick: function() {
42584 context.validator().ignoreIssue(this.issue.id);
42588 fixes.forEach(function(fix) {
42589 fix.id = fix.title.stringId;
42591 if (fix.autoArgs) {
42592 issue.autoFix = fix;
42598 function validationIssueFix(attrs) {
42599 this.title = attrs.title;
42600 this.onClick = attrs.onClick;
42601 this.disabledReason = attrs.disabledReason;
42602 this.icon = attrs.icon;
42603 this.entityIds = attrs.entityIds || [];
42604 this.autoArgs = attrs.autoArgs;
42608 // modules/services/maprules.js
42609 var buildRuleChecks = function() {
42611 equals: function(equals) {
42612 return function(tags) {
42613 return Object.keys(equals).every(function(k2) {
42614 return equals[k2] === tags[k2];
42618 notEquals: function(notEquals) {
42619 return function(tags) {
42620 return Object.keys(notEquals).some(function(k2) {
42621 return notEquals[k2] !== tags[k2];
42625 absence: function(absence) {
42626 return function(tags) {
42627 return Object.keys(tags).indexOf(absence) === -1;
42630 presence: function(presence) {
42631 return function(tags) {
42632 return Object.keys(tags).indexOf(presence) > -1;
42635 greaterThan: function(greaterThan) {
42636 var key = Object.keys(greaterThan)[0];
42637 var value = greaterThan[key];
42638 return function(tags) {
42639 return tags[key] > value;
42642 greaterThanEqual: function(greaterThanEqual) {
42643 var key = Object.keys(greaterThanEqual)[0];
42644 var value = greaterThanEqual[key];
42645 return function(tags) {
42646 return tags[key] >= value;
42649 lessThan: function(lessThan) {
42650 var key = Object.keys(lessThan)[0];
42651 var value = lessThan[key];
42652 return function(tags) {
42653 return tags[key] < value;
42656 lessThanEqual: function(lessThanEqual) {
42657 var key = Object.keys(lessThanEqual)[0];
42658 var value = lessThanEqual[key];
42659 return function(tags) {
42660 return tags[key] <= value;
42663 positiveRegex: function(positiveRegex) {
42664 var tagKey = Object.keys(positiveRegex)[0];
42665 var expression = positiveRegex[tagKey].join("|");
42666 var regex = new RegExp(expression);
42667 return function(tags) {
42668 return regex.test(tags[tagKey]);
42671 negativeRegex: function(negativeRegex) {
42672 var tagKey = Object.keys(negativeRegex)[0];
42673 var expression = negativeRegex[tagKey].join("|");
42674 var regex = new RegExp(expression);
42675 return function(tags) {
42676 return !regex.test(tags[tagKey]);
42681 var buildLineKeys = function() {
42696 var maprules_default = {
42698 this._ruleChecks = buildRuleChecks();
42699 this._validationRules = [];
42700 this._areaKeys = osmAreaKeys;
42701 this._lineKeys = buildLineKeys();
42703 // list of rules only relevant to tag checks...
42704 filterRuleChecks: function(selector) {
42705 var _ruleChecks = this._ruleChecks;
42706 return Object.keys(selector).reduce(function(rules, key) {
42707 if (["geometry", "error", "warning"].indexOf(key) === -1) {
42708 rules.push(_ruleChecks[key](selector[key]));
42713 // builds tagMap from mapcss-parse selector object...
42714 buildTagMap: function(selector) {
42715 var getRegexValues = function(regexes) {
42716 return regexes.map(function(regex) {
42717 return regex.replace(/\$|\^/g, "");
42720 var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
42722 var isRegex = /regex/gi.test(key);
42723 var isEqual4 = /equals/gi.test(key);
42724 if (isRegex || isEqual4) {
42725 Object.keys(selector[key]).forEach(function(selectorKey) {
42726 values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
42727 if (expectedTags.hasOwnProperty(selectorKey)) {
42728 values = values.concat(expectedTags[selectorKey]);
42730 expectedTags[selectorKey] = values;
42732 } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
42733 var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
42734 values = [selector[key][tagKey]];
42735 if (expectedTags.hasOwnProperty(tagKey)) {
42736 values = values.concat(expectedTags[tagKey]);
42738 expectedTags[tagKey] = values;
42740 return expectedTags;
42744 // inspired by osmWay#isArea()
42745 inferGeometry: function(tagMap) {
42746 var _lineKeys = this._lineKeys;
42747 var _areaKeys = this._areaKeys;
42748 var keyValueDoesNotImplyArea = function(key2) {
42749 return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
42751 var keyValueImpliesLine = function(key2) {
42752 return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
42754 if (tagMap.hasOwnProperty("area")) {
42755 if (tagMap.area.indexOf("yes") > -1) {
42758 if (tagMap.area.indexOf("no") > -1) {
42762 for (var key in tagMap) {
42763 if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
42766 if (key in _lineKeys && keyValueImpliesLine(key)) {
42772 // adds from mapcss-parse selector check...
42773 addRule: function(selector) {
42775 // checks relevant to mapcss-selector
42776 checks: this.filterRuleChecks(selector),
42777 // true if all conditions for a tag error are true..
42778 matches: function(entity) {
42779 return this.checks.every(function(check) {
42780 return check(entity.tags);
42783 // borrowed from Way#isArea()
42784 inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
42785 geometryMatches: function(entity, graph) {
42786 if (entity.type === "node" || entity.type === "relation") {
42787 return selector.geometry === entity.type;
42788 } else if (entity.type === "way") {
42789 return this.inferredGeometry === entity.geometry(graph);
42792 // when geometries match and tag matches are present, return a warning...
42793 findIssues: function(entity, graph, issues) {
42794 if (this.geometryMatches(entity, graph) && this.matches(entity)) {
42795 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
42796 var message = selector[severity];
42797 issues.push(new validationIssue({
42800 message: function() {
42803 entityIds: [entity.id]
42808 this._validationRules.push(rule);
42810 clearRules: function() {
42811 this._validationRules = [];
42813 // returns validationRules...
42814 validationRules: function() {
42815 return this._validationRules;
42817 // returns ruleChecks
42818 ruleChecks: function() {
42819 return this._ruleChecks;
42823 // modules/services/nominatim.js
42824 var import_rbush7 = __toESM(require_rbush_min());
42826 // modules/core/difference.js
42827 var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
42828 function coreDifference(base, head) {
42830 var _didChange = {};
42832 function checkEntityID(id2) {
42833 var h2 = head.entities[id2];
42834 var b2 = base.entities[id2];
42840 _changes[id2] = { base: b2, head: h2 };
42841 _didChange.deletion = true;
42845 _changes[id2] = { base: b2, head: h2 };
42846 _didChange.addition = true;
42850 if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
42851 _changes[id2] = { base: b2, head: h2 };
42852 _didChange.geometry = true;
42853 _didChange.properties = true;
42856 if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
42857 _changes[id2] = { base: b2, head: h2 };
42858 _didChange.geometry = true;
42860 if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
42861 _changes[id2] = { base: b2, head: h2 };
42862 _didChange.geometry = true;
42864 if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
42865 _changes[id2] = { base: b2, head: h2 };
42866 _didChange.properties = true;
42871 var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
42872 for (var i3 = 0; i3 < ids.length; i3++) {
42873 checkEntityID(ids[i3]);
42877 _diff.length = function length2() {
42878 return Object.keys(_changes).length;
42880 _diff.changes = function changes() {
42883 _diff.didChange = _didChange;
42884 _diff.extantIDs = function extantIDs(includeRelMembers) {
42885 var result = /* @__PURE__ */ new Set();
42886 Object.keys(_changes).forEach(function(id2) {
42887 if (_changes[id2].head) {
42890 var h2 = _changes[id2].head;
42891 var b2 = _changes[id2].base;
42892 var entity = h2 || b2;
42893 if (includeRelMembers && entity.type === "relation") {
42894 var mh = h2 ? h2.members.map(function(m2) {
42897 var mb = b2 ? b2.members.map(function(m2) {
42900 utilArrayUnion(mh, mb).forEach(function(memberID) {
42901 if (head.hasEntity(memberID)) {
42902 result.add(memberID);
42907 return Array.from(result);
42909 _diff.modified = function modified() {
42911 Object.values(_changes).forEach(function(change) {
42912 if (change.base && change.head) {
42913 result.push(change.head);
42918 _diff.created = function created() {
42920 Object.values(_changes).forEach(function(change) {
42921 if (!change.base && change.head) {
42922 result.push(change.head);
42927 _diff.deleted = function deleted() {
42929 Object.values(_changes).forEach(function(change) {
42930 if (change.base && !change.head) {
42931 result.push(change.base);
42936 _diff.summary = function summary() {
42938 var keys2 = Object.keys(_changes);
42939 for (var i3 = 0; i3 < keys2.length; i3++) {
42940 var change = _changes[keys2[i3]];
42941 if (change.head && change.head.geometry(head) !== "vertex") {
42942 addEntity(change.head, head, change.base ? "modified" : "created");
42943 } else if (change.base && change.base.geometry(base) !== "vertex") {
42944 addEntity(change.base, base, "deleted");
42945 } else if (change.base && change.head) {
42946 var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
42947 var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
42949 addParents(change.head);
42951 if (retagged || moved && change.head.hasInterestingTags()) {
42952 addEntity(change.head, head, "modified");
42954 } else if (change.head && change.head.hasInterestingTags()) {
42955 addEntity(change.head, head, "created");
42956 } else if (change.base && change.base.hasInterestingTags()) {
42957 addEntity(change.base, base, "deleted");
42960 return Object.values(relevant);
42961 function addEntity(entity, graph, changeType) {
42962 relevant[entity.id] = {
42968 function addParents(entity) {
42969 var parents = head.parentWays(entity);
42970 for (var j2 = parents.length - 1; j2 >= 0; j2--) {
42971 var parent = parents[j2];
42972 if (!(parent.id in relevant)) {
42973 addEntity(parent, head, "modified");
42978 _diff.complete = function complete(extent) {
42981 for (id2 in _changes) {
42982 change = _changes[id2];
42983 var h2 = change.head;
42984 var b2 = change.base;
42985 var entity = h2 || b2;
42987 if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
42991 if (entity.type === "way") {
42992 var nh = h2 ? h2.nodes : [];
42993 var nb = b2 ? b2.nodes : [];
42995 diff = utilArrayDifference(nh, nb);
42996 for (i3 = 0; i3 < diff.length; i3++) {
42997 result[diff[i3]] = head.hasEntity(diff[i3]);
42999 diff = utilArrayDifference(nb, nh);
43000 for (i3 = 0; i3 < diff.length; i3++) {
43001 result[diff[i3]] = head.hasEntity(diff[i3]);
43004 if (entity.type === "relation" && entity.isMultipolygon()) {
43005 var mh = h2 ? h2.members.map(function(m2) {
43008 var mb = b2 ? b2.members.map(function(m2) {
43011 var ids = utilArrayUnion(mh, mb);
43012 for (i3 = 0; i3 < ids.length; i3++) {
43013 var member = head.hasEntity(ids[i3]);
43016 if (extent && !member.intersects(extent, head))
43018 result[ids[i3]] = member;
43021 addParents(head.parentWays(entity), result);
43022 addParents(head.parentRelations(entity), result);
43025 function addParents(parents, result2) {
43026 for (var i4 = 0; i4 < parents.length; i4++) {
43027 var parent = parents[i4];
43028 if (parent.id in result2)
43030 result2[parent.id] = parent;
43031 addParents(head.parentRelations(parent), result2);
43038 // modules/core/tree.js
43039 var import_rbush5 = __toESM(require_rbush_min());
43040 function coreTree(head) {
43041 var _rtree = new import_rbush5.default();
43043 var _segmentsRTree = new import_rbush5.default();
43044 var _segmentsBBoxes = {};
43045 var _segmentsByWayId = {};
43047 function entityBBox(entity) {
43048 var bbox2 = entity.extent(head).bbox();
43049 bbox2.id = entity.id;
43050 _bboxes[entity.id] = bbox2;
43053 function segmentBBox(segment) {
43054 var extent = segment.extent(head);
43057 var bbox2 = extent.bbox();
43058 bbox2.segment = segment;
43059 _segmentsBBoxes[segment.id] = bbox2;
43062 function removeEntity(entity) {
43063 _rtree.remove(_bboxes[entity.id]);
43064 delete _bboxes[entity.id];
43065 if (_segmentsByWayId[entity.id]) {
43066 _segmentsByWayId[entity.id].forEach(function(segment) {
43067 _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
43068 delete _segmentsBBoxes[segment.id];
43070 delete _segmentsByWayId[entity.id];
43073 function loadEntities(entities) {
43074 _rtree.load(entities.map(entityBBox));
43076 entities.forEach(function(entity) {
43077 if (entity.segments) {
43078 var entitySegments = entity.segments(head);
43079 _segmentsByWayId[entity.id] = entitySegments;
43080 segments = segments.concat(entitySegments);
43083 if (segments.length)
43084 _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
43086 function updateParents(entity, insertions, memo) {
43087 head.parentWays(entity).forEach(function(way) {
43088 if (_bboxes[way.id]) {
43090 insertions[way.id] = way;
43092 updateParents(way, insertions, memo);
43094 head.parentRelations(entity).forEach(function(relation) {
43095 if (memo[entity.id])
43097 memo[entity.id] = true;
43098 if (_bboxes[relation.id]) {
43099 removeEntity(relation);
43100 insertions[relation.id] = relation;
43102 updateParents(relation, insertions, memo);
43105 tree.rebase = function(entities, force) {
43106 var insertions = {};
43107 for (var i3 = 0; i3 < entities.length; i3++) {
43108 var entity = entities[i3];
43109 if (!entity.visible)
43111 if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
43114 } else if (_bboxes[entity.id]) {
43115 removeEntity(entity);
43118 insertions[entity.id] = entity;
43119 updateParents(entity, insertions, {});
43121 loadEntities(Object.values(insertions));
43124 function updateToGraph(graph) {
43125 if (graph === head)
43127 var diff = coreDifference(head, graph);
43129 var changed = diff.didChange;
43130 if (!changed.addition && !changed.deletion && !changed.geometry)
43132 var insertions = {};
43133 if (changed.deletion) {
43134 diff.deleted().forEach(function(entity) {
43135 removeEntity(entity);
43138 if (changed.geometry) {
43139 diff.modified().forEach(function(entity) {
43140 removeEntity(entity);
43141 insertions[entity.id] = entity;
43142 updateParents(entity, insertions, {});
43145 if (changed.addition) {
43146 diff.created().forEach(function(entity) {
43147 insertions[entity.id] = entity;
43150 loadEntities(Object.values(insertions));
43152 tree.intersects = function(extent, graph) {
43153 updateToGraph(graph);
43154 return _rtree.search(extent.bbox()).map(function(bbox2) {
43155 return graph.entity(bbox2.id);
43158 tree.waySegments = function(extent, graph) {
43159 updateToGraph(graph);
43160 return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
43161 return bbox2.segment;
43167 // modules/svg/icon.js
43168 function svgIcon(name, svgklass, useklass) {
43169 return function drawIcon(selection2) {
43170 selection2.selectAll("svg.icon" + (svgklass ? "." + svgklass.split(" ")[0] : "")).data([0]).enter().append("svg").attr("class", "icon " + (svgklass || "")).append("use").attr("xlink:href", name).attr("class", useklass);
43174 // modules/ui/modal.js
43175 function uiModal(selection2, blocking) {
43176 let keybinding = utilKeybinding("modal");
43177 let previous = selection2.select("div.modal");
43178 let animate = previous.empty();
43179 previous.transition().duration(200).style("opacity", 0).remove();
43180 let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
43181 shaded.close = () => {
43182 shaded.transition().duration(200).style("opacity", 0).remove();
43183 modal.transition().duration(200).style("top", "0px");
43184 select_default2(document).call(keybinding.unbind);
43186 let modal = shaded.append("div").attr("class", "modal fillL");
43187 modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
43189 shaded.on("click.remove-modal", (d3_event) => {
43190 if (d3_event.target === this) {
43194 modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
43195 keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
43196 select_default2(document).call(keybinding);
43198 modal.append("div").attr("class", "content");
43199 modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
43201 shaded.transition().style("opacity", 1);
43203 shaded.style("opacity", 1);
43206 function moveFocusToFirst() {
43207 let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
43211 select_default2(this).node().blur();
43214 function moveFocusToLast() {
43215 let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
43216 if (nodes.length) {
43217 nodes[nodes.length - 1].focus();
43219 select_default2(this).node().blur();
43224 // modules/ui/loading.js
43225 function uiLoading(context) {
43226 let _modalSelection = select_default2(null);
43228 let _blocking = false;
43229 let loading = (selection2) => {
43230 _modalSelection = uiModal(selection2, _blocking);
43231 let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
43232 loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
43233 loadertext.append("h3").html(_message);
43234 _modalSelection.select("button.close").attr("class", "hide");
43237 loading.message = function(val) {
43238 if (!arguments.length)
43243 loading.blocking = function(val) {
43244 if (!arguments.length)
43249 loading.close = () => {
43250 _modalSelection.remove();
43252 loading.isShown = () => {
43253 return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
43258 // modules/core/history.js
43259 function coreHistory(context) {
43260 var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
43261 var lock = utilSessionMutex("lock");
43262 var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
43263 var duration = 150;
43264 var _imageryUsed = [];
43265 var _photoOverlaysUsed = [];
43266 var _checkpoints = {};
43271 function _act(actions, t2) {
43272 actions = Array.prototype.slice.call(actions);
43274 if (typeof actions[actions.length - 1] !== "function") {
43275 annotation = actions.pop();
43277 var graph = _stack[_index].graph;
43278 for (var i3 = 0; i3 < actions.length; i3++) {
43279 graph = actions[i3](graph, t2);
43284 imageryUsed: _imageryUsed,
43285 photoOverlaysUsed: _photoOverlaysUsed,
43286 transform: context.projection.transform(),
43287 selectedIDs: context.selectedIDs()
43290 function _perform(args, t2) {
43291 var previous = _stack[_index].graph;
43292 _stack = _stack.slice(0, _index + 1);
43293 var actionResult = _act(args, t2);
43294 _stack.push(actionResult);
43296 return change(previous);
43298 function _replace(args, t2) {
43299 var previous = _stack[_index].graph;
43300 var actionResult = _act(args, t2);
43301 _stack[_index] = actionResult;
43302 return change(previous);
43304 function _overwrite(args, t2) {
43305 var previous = _stack[_index].graph;
43310 _stack = _stack.slice(0, _index + 1);
43311 var actionResult = _act(args, t2);
43312 _stack.push(actionResult);
43314 return change(previous);
43316 function change(previous) {
43317 var difference2 = coreDifference(previous, history.graph());
43318 if (!_pausedGraph) {
43319 dispatch14.call("change", this, difference2);
43321 return difference2;
43323 function getKey(n3) {
43324 return "iD_" + window.location.origin + "_" + n3;
43327 graph: function() {
43328 return _stack[_index].graph;
43334 return _stack[0].graph;
43336 merge: function(entities) {
43337 var stack = _stack.map(function(state) {
43338 return state.graph;
43340 _stack[0].graph.rebase(entities, stack, false);
43341 _tree.rebase(entities, false);
43342 dispatch14.call("merge", this, entities);
43344 perform: function() {
43345 select_default2(document).interrupt("history.perform");
43346 var transitionable = false;
43347 var action0 = arguments[0];
43348 if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
43349 transitionable = !!action0.transitionable;
43351 if (transitionable) {
43352 var origArguments = arguments;
43353 select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
43354 return function(t2) {
43356 _overwrite([action0], t2);
43358 }).on("start", function() {
43359 _perform([action0], 0);
43360 }).on("end interrupt", function() {
43361 _overwrite(origArguments, 1);
43364 return _perform(arguments);
43367 replace: function() {
43368 select_default2(document).interrupt("history.perform");
43369 return _replace(arguments, 1);
43371 // Same as calling pop and then perform
43372 overwrite: function() {
43373 select_default2(document).interrupt("history.perform");
43374 return _overwrite(arguments, 1);
43376 pop: function(n3) {
43377 select_default2(document).interrupt("history.perform");
43378 var previous = _stack[_index].graph;
43379 if (isNaN(+n3) || +n3 < 0) {
43382 while (n3-- > 0 && _index > 0) {
43386 return change(previous);
43388 // Back to the previous annotated state or _index = 0.
43390 select_default2(document).interrupt("history.perform");
43391 var previousStack = _stack[_index];
43392 var previous = previousStack.graph;
43393 while (_index > 0) {
43395 if (_stack[_index].annotation)
43398 dispatch14.call("undone", this, _stack[_index], previousStack);
43399 return change(previous);
43401 // Forward to the next annotated state.
43403 select_default2(document).interrupt("history.perform");
43404 var previousStack = _stack[_index];
43405 var previous = previousStack.graph;
43406 var tryIndex = _index;
43407 while (tryIndex < _stack.length - 1) {
43409 if (_stack[tryIndex].annotation) {
43411 dispatch14.call("redone", this, _stack[_index], previousStack);
43415 return change(previous);
43417 pauseChangeDispatch: function() {
43418 if (!_pausedGraph) {
43419 _pausedGraph = _stack[_index].graph;
43422 resumeChangeDispatch: function() {
43423 if (_pausedGraph) {
43424 var previous = _pausedGraph;
43425 _pausedGraph = null;
43426 return change(previous);
43429 undoAnnotation: function() {
43432 if (_stack[i3].annotation)
43433 return _stack[i3].annotation;
43437 redoAnnotation: function() {
43438 var i3 = _index + 1;
43439 while (i3 <= _stack.length - 1) {
43440 if (_stack[i3].annotation)
43441 return _stack[i3].annotation;
43445 // Returns the entities from the active graph with bounding boxes
43446 // overlapping the given `extent`.
43447 intersects: function(extent) {
43448 return _tree.intersects(extent, _stack[_index].graph);
43450 difference: function() {
43451 var base = _stack[0].graph;
43452 var head = _stack[_index].graph;
43453 return coreDifference(base, head);
43455 changes: function(action) {
43456 var base = _stack[0].graph;
43457 var head = _stack[_index].graph;
43459 head = action(head);
43461 var difference2 = coreDifference(base, head);
43463 modified: difference2.modified(),
43464 created: difference2.created(),
43465 deleted: difference2.deleted()
43468 hasChanges: function() {
43469 return this.difference().length() > 0;
43471 imageryUsed: function(sources) {
43473 _imageryUsed = sources;
43476 var s2 = /* @__PURE__ */ new Set();
43477 _stack.slice(1, _index + 1).forEach(function(state) {
43478 state.imageryUsed.forEach(function(source) {
43479 if (source !== "Custom") {
43484 return Array.from(s2);
43487 photoOverlaysUsed: function(sources) {
43489 _photoOverlaysUsed = sources;
43492 var s2 = /* @__PURE__ */ new Set();
43493 _stack.slice(1, _index + 1).forEach(function(state) {
43494 if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
43495 state.photoOverlaysUsed.forEach(function(photoOverlay) {
43496 s2.add(photoOverlay);
43500 return Array.from(s2);
43503 // save the current history state
43504 checkpoint: function(key) {
43505 _checkpoints[key] = {
43511 // restore history state to a given checkpoint or reset completely
43512 reset: function(key) {
43513 if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
43514 _stack = _checkpoints[key].stack;
43515 _index = _checkpoints[key].index;
43517 _stack = [{ graph: coreGraph() }];
43519 _tree = coreTree(_stack[0].graph);
43522 dispatch14.call("reset");
43523 dispatch14.call("change");
43526 // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
43529 // 1. Start the walkthrough.
43530 // 2. Get to a "free editing" tutorial step
43531 // 3. Make your edits to the walkthrough map
43532 // 4. In your browser dev console run:
43533 // `id.history().toIntroGraph()`
43534 // 5. This outputs stringified JSON to the browser console
43535 // 6. Copy it to `data/intro_graph.json` and prettify it in your code editor
43536 toIntroGraph: function() {
43537 var nextID = { n: 0, r: 0, w: 0 };
43539 var graph = this.graph();
43540 var baseEntities = {};
43541 Object.values(graph.base().entities).forEach(function(entity) {
43542 var copy2 = copyIntroEntity(entity);
43543 baseEntities[copy2.id] = copy2;
43545 Object.keys(graph.entities).forEach(function(id2) {
43546 var entity = graph.entities[id2];
43548 var copy2 = copyIntroEntity(entity);
43549 baseEntities[copy2.id] = copy2;
43551 delete baseEntities[id2];
43554 Object.values(baseEntities).forEach(function(entity) {
43555 if (Array.isArray(entity.nodes)) {
43556 entity.nodes = entity.nodes.map(function(node) {
43557 return permIDs[node] || node;
43560 if (Array.isArray(entity.members)) {
43561 entity.members = entity.members.map(function(member) {
43562 member.id = permIDs[member.id] || member.id;
43567 return JSON.stringify({ dataIntroGraph: baseEntities });
43568 function copyIntroEntity(source) {
43569 var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
43570 if (copy2.tags && !Object.keys(copy2.tags)) {
43573 if (Array.isArray(copy2.loc)) {
43574 copy2.loc[0] = +copy2.loc[0].toFixed(6);
43575 copy2.loc[1] = +copy2.loc[1].toFixed(6);
43577 var match = source.id.match(/([nrw])-\d*/);
43578 if (match !== null) {
43579 var nrw = match[1];
43582 permID = nrw + ++nextID[nrw];
43583 } while (baseEntities.hasOwnProperty(permID));
43584 copy2.id = permIDs[source.id] = permID;
43589 toJSON: function() {
43590 if (!this.hasChanges())
43592 var allEntities = {};
43593 var baseEntities = {};
43594 var base = _stack[0];
43595 var s2 = _stack.map(function(i3) {
43598 Object.keys(i3.graph.entities).forEach(function(id2) {
43599 var entity = i3.graph.entities[id2];
43601 var key = osmEntity.key(entity);
43602 allEntities[key] = entity;
43603 modified.push(key);
43607 if (id2 in base.graph.entities) {
43608 baseEntities[id2] = base.graph.entities[id2];
43610 if (entity && entity.nodes) {
43611 entity.nodes.forEach(function(nodeID) {
43612 if (nodeID in base.graph.entities) {
43613 baseEntities[nodeID] = base.graph.entities[nodeID];
43617 var baseParents = base.graph._parentWays[id2];
43619 baseParents.forEach(function(parentID) {
43620 if (parentID in base.graph.entities) {
43621 baseEntities[parentID] = base.graph.entities[parentID];
43627 if (modified.length)
43628 x2.modified = modified;
43629 if (deleted.length)
43630 x2.deleted = deleted;
43631 if (i3.imageryUsed)
43632 x2.imageryUsed = i3.imageryUsed;
43633 if (i3.photoOverlaysUsed)
43634 x2.photoOverlaysUsed = i3.photoOverlaysUsed;
43636 x2.annotation = i3.annotation;
43638 x2.transform = i3.transform;
43639 if (i3.selectedIDs)
43640 x2.selectedIDs = i3.selectedIDs;
43643 return JSON.stringify({
43645 entities: Object.values(allEntities),
43646 baseEntities: Object.values(baseEntities),
43648 nextIDs: osmEntity.id.next,
43650 // note the time the changes were saved
43651 timestamp: (/* @__PURE__ */ new Date()).getTime()
43654 fromJSON: function(json, loadChildNodes) {
43655 var h2 = JSON.parse(json);
43656 var loadComplete = true;
43657 osmEntity.id.next = h2.nextIDs;
43659 if (h2.version === 2 || h2.version === 3) {
43660 var allEntities = {};
43661 h2.entities.forEach(function(entity) {
43662 allEntities[osmEntity.key(entity)] = osmEntity(entity);
43664 if (h2.version === 3) {
43665 var baseEntities = h2.baseEntities.map(function(d2) {
43666 return osmEntity(d2);
43668 var stack = _stack.map(function(state) {
43669 return state.graph;
43671 _stack[0].graph.rebase(baseEntities, stack, true);
43672 _tree.rebase(baseEntities, true);
43673 if (loadChildNodes) {
43674 var osm = context.connection();
43675 var baseWays = baseEntities.filter(function(e3) {
43676 return e3.type === "way";
43678 var nodeIDs = baseWays.reduce(function(acc, way) {
43679 return utilArrayUnion(acc, way.nodes);
43681 var missing = nodeIDs.filter(function(n3) {
43682 return !_stack[0].graph.hasEntity(n3);
43684 if (missing.length && osm) {
43685 loadComplete = false;
43686 context.map().redrawEnable(false);
43687 var loading = uiLoading(context).blocking(true);
43688 context.container().call(loading);
43689 var childNodesLoaded = function(err, result) {
43691 var visibleGroups = utilArrayGroupBy(result.data, "visible");
43692 var visibles = visibleGroups.true || [];
43693 var invisibles = visibleGroups.false || [];
43694 if (visibles.length) {
43695 var visibleIDs = visibles.map(function(entity) {
43698 var stack2 = _stack.map(function(state) {
43699 return state.graph;
43701 missing = utilArrayDifference(missing, visibleIDs);
43702 _stack[0].graph.rebase(visibles, stack2, true);
43703 _tree.rebase(visibles, true);
43705 invisibles.forEach(function(entity) {
43706 osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
43709 if (err || !missing.length) {
43711 context.map().redrawEnable(true);
43712 dispatch14.call("change");
43713 dispatch14.call("restore", this);
43716 osm.loadMultiple(missing, childNodesLoaded);
43720 _stack = h2.stack.map(function(d2) {
43721 var entities = {}, entity;
43723 d2.modified.forEach(function(key) {
43724 entity = allEntities[key];
43725 entities[entity.id] = entity;
43729 d2.deleted.forEach(function(id2) {
43730 entities[id2] = void 0;
43734 graph: coreGraph(_stack[0].graph).load(entities),
43735 annotation: d2.annotation,
43736 imageryUsed: d2.imageryUsed,
43737 photoOverlaysUsed: d2.photoOverlaysUsed,
43738 transform: d2.transform,
43739 selectedIDs: d2.selectedIDs
43743 _stack = h2.stack.map(function(d2) {
43745 for (var i3 in d2.entities) {
43746 var entity = d2.entities[i3];
43747 entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
43749 d2.graph = coreGraph(_stack[0].graph).load(entities);
43753 var transform2 = _stack[_index].transform;
43755 context.map().transformEase(transform2, 0);
43757 if (loadComplete) {
43758 dispatch14.call("change");
43759 dispatch14.call("restore", this);
43764 return lock.lock();
43766 unlock: function() {
43770 if (lock.locked() && // don't overwrite existing, unresolved changes
43771 !_hasUnresolvedRestorableChanges) {
43772 const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
43774 dispatch14.call("storage_error");
43778 // delete the history version saved in localStorage
43779 clearSaved: function() {
43780 context.debouncedSave.cancel();
43781 if (lock.locked()) {
43782 _hasUnresolvedRestorableChanges = false;
43783 corePreferences(getKey("saved_history"), null);
43784 corePreferences("comment", null);
43785 corePreferences("hashtags", null);
43786 corePreferences("source", null);
43790 savedHistoryJSON: function() {
43791 return corePreferences(getKey("saved_history"));
43793 hasRestorableChanges: function() {
43794 return _hasUnresolvedRestorableChanges;
43796 // load history from a version stored in localStorage
43797 restore: function() {
43798 if (lock.locked()) {
43799 _hasUnresolvedRestorableChanges = false;
43800 var json = this.savedHistoryJSON();
43802 history.fromJSON(json, true);
43808 return utilRebind(history, dispatch14, "on");
43811 // modules/validations/index.js
43812 var validations_exports = {};
43813 __export(validations_exports, {
43814 validationAlmostJunction: () => validationAlmostJunction,
43815 validationCloseNodes: () => validationCloseNodes,
43816 validationCrossingWays: () => validationCrossingWays,
43817 validationDisconnectedWay: () => validationDisconnectedWay,
43818 validationFormatting: () => validationFormatting,
43819 validationHelpRequest: () => validationHelpRequest,
43820 validationImpossibleOneway: () => validationImpossibleOneway,
43821 validationIncompatibleSource: () => validationIncompatibleSource,
43822 validationMaprules: () => validationMaprules,
43823 validationMismatchedGeometry: () => validationMismatchedGeometry,
43824 validationMissingRole: () => validationMissingRole,
43825 validationMissingTag: () => validationMissingTag,
43826 validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
43827 validationOutdatedTags: () => validationOutdatedTags,
43828 validationPrivateData: () => validationPrivateData,
43829 validationSuspiciousName: () => validationSuspiciousName,
43830 validationUnsquareWay: () => validationUnsquareWay
43833 // modules/validations/almost_junction.js
43834 function validationAlmostJunction(context) {
43835 const type2 = "almost_junction";
43836 const EXTEND_TH_METERS = 5;
43837 const WELD_TH_METERS = 0.75;
43838 const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
43839 const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
43840 function isHighway(entity) {
43841 return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
43843 function isTaggedAsNotContinuing(node) {
43844 return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
43846 const validation = function checkAlmostJunction(entity, graph) {
43847 if (!isHighway(entity))
43849 if (entity.isDegenerate())
43851 const tree = context.history().tree();
43852 const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
43854 extendableNodeInfos.forEach((extendableNodeInfo) => {
43855 issues.push(new validationIssue({
43857 subtype: "highway-highway",
43858 severity: "warning",
43859 message: function(context2) {
43860 const entity1 = context2.hasEntity(this.entityIds[0]);
43861 if (this.entityIds[0] === this.entityIds[2]) {
43862 return entity1 ? _t.append("issues.almost_junction.self.message", {
43863 feature: utilDisplayLabel(entity1, context2.graph())
43866 const entity2 = context2.hasEntity(this.entityIds[2]);
43867 return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
43868 feature: utilDisplayLabel(entity1, context2.graph()),
43869 feature2: utilDisplayLabel(entity2, context2.graph())
43873 reference: showReference,
43876 extendableNodeInfo.node.id,
43877 extendableNodeInfo.wid
43879 loc: extendableNodeInfo.node.loc,
43880 hash: JSON.stringify(extendableNodeInfo.node.loc),
43882 midId: extendableNodeInfo.mid.id,
43883 edge: extendableNodeInfo.edge,
43884 cross_loc: extendableNodeInfo.cross_loc
43886 dynamicFixes: makeFixes
43890 function makeFixes(context2) {
43891 let fixes = [new validationIssueFix({
43892 icon: "iD-icon-abutment",
43893 title: _t.append("issues.fix.connect_features.title"),
43894 onClick: function(context3) {
43895 const annotation = _t("issues.fix.connect_almost_junction.annotation");
43896 const [, endNodeId, crossWayId] = this.issue.entityIds;
43897 const midNode = context3.entity(this.issue.data.midId);
43898 const endNode = context3.entity(endNodeId);
43899 const crossWay = context3.entity(crossWayId);
43900 const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
43901 if (nearEndNodes.length > 0) {
43902 const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
43905 actionMergeNodes([collinear.id, endNode.id], collinear.loc),
43911 const targetEdge = this.issue.data.edge;
43912 const crossLoc = this.issue.data.cross_loc;
43913 const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
43914 const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
43915 if (closestNodeInfo.distance < WELD_TH_METERS) {
43917 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
43922 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
43928 const node = context2.hasEntity(this.entityIds[1]);
43929 if (node && !node.hasInterestingTags()) {
43930 fixes.push(new validationIssueFix({
43931 icon: "maki-barrier",
43932 title: _t.append("issues.fix.tag_as_disconnected.title"),
43933 onClick: function(context3) {
43934 const nodeID = this.issue.entityIds[1];
43935 const tags = Object.assign({}, context3.entity(nodeID).tags);
43936 tags.noexit = "yes";
43938 actionChangeTags(nodeID, tags),
43939 _t("issues.fix.tag_as_disconnected.annotation")
43946 function showReference(selection2) {
43947 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
43949 function isExtendableCandidate(node, way) {
43950 const osm = services.osm;
43951 if (osm && !osm.isDataLoaded(node.loc)) {
43954 if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
43957 let occurrences = 0;
43958 for (const index in way.nodes) {
43959 if (way.nodes[index] === node.id) {
43961 if (occurrences > 1) {
43968 function findConnectableEndNodesByExtension(way) {
43970 if (way.isClosed())
43973 const indices = [0, way.nodes.length - 1];
43974 indices.forEach((nodeIndex) => {
43975 const nodeID = way.nodes[nodeIndex];
43976 const node = graph.entity(nodeID);
43977 if (!isExtendableCandidate(node, way))
43979 const connectionInfo = canConnectByExtend(way, nodeIndex);
43980 if (!connectionInfo)
43982 testNodes = graph.childNodes(way).slice();
43983 testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
43984 if (geoHasSelfIntersections(testNodes, nodeID))
43986 results.push(connectionInfo);
43990 function findNearbyEndNodes(node, way) {
43993 way.nodes[way.nodes.length - 1]
43994 ].map((d2) => graph.entity(d2)).filter((d2) => {
43995 return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
43998 function findSmallJoinAngle(midNode, tipNode, endNodes) {
44000 let minAngle = Infinity;
44001 endNodes.forEach((endNode) => {
44002 const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
44003 const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
44004 const diff = Math.max(a1, a2) - Math.min(a1, a2);
44005 if (diff < minAngle) {
44010 if (minAngle <= SIG_ANGLE_TH)
44014 function hasTag(tags, key) {
44015 return tags[key] !== void 0 && tags[key] !== "no";
44017 function canConnectWays(way, way2) {
44018 if (way.id === way2.id)
44020 if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge")))
44022 if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel")))
44024 const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
44025 if (layer1 !== layer2)
44027 const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
44028 if (level1 !== level2)
44032 function canConnectByExtend(way, endNodeIdx) {
44033 const tipNid = way.nodes[endNodeIdx];
44034 const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
44035 const tipNode = graph.entity(tipNid);
44036 const midNode = graph.entity(midNid);
44037 const lon = tipNode.loc[0];
44038 const lat = tipNode.loc[1];
44039 const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
44040 const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
44041 const queryExtent = geoExtent([
44042 [lon - lon_range, lat - lat_range],
44043 [lon + lon_range, lat + lat_range]
44045 const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
44046 const t2 = EXTEND_TH_METERS / edgeLen + 1;
44047 const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
44048 const segmentInfos = tree.waySegments(queryExtent, graph);
44049 for (let i3 = 0; i3 < segmentInfos.length; i3++) {
44050 let segmentInfo = segmentInfos[i3];
44051 let way2 = graph.entity(segmentInfo.wayId);
44052 if (!isHighway(way2))
44054 if (!canConnectWays(way, way2))
44056 let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
44057 if (nAid === tipNid || nBid === tipNid)
44059 let nA = graph.entity(nAid), nB = graph.entity(nBid);
44060 let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
44066 edge: [nA.id, nB.id],
44067 cross_loc: crossLoc
44074 validation.type = type2;
44078 // modules/validations/close_nodes.js
44079 function validationCloseNodes(context) {
44080 var type2 = "close_nodes";
44081 var pointThresholdMeters = 0.2;
44082 var validation = function(entity, graph) {
44083 if (entity.type === "node") {
44084 return getIssuesForNode(entity);
44085 } else if (entity.type === "way") {
44086 return getIssuesForWay(entity);
44089 function getIssuesForNode(node) {
44090 var parentWays = graph.parentWays(node);
44091 if (parentWays.length) {
44092 return getIssuesForVertex(node, parentWays);
44094 return getIssuesForDetachedPoint(node);
44097 function wayTypeFor(way) {
44098 if (way.tags.boundary && way.tags.boundary !== "no")
44100 if (way.tags.indoor && way.tags.indoor !== "no")
44102 if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no")
44104 if (osmPathHighwayTagValues[way.tags.highway])
44106 var parentRelations = graph.parentRelations(way);
44107 for (var i3 in parentRelations) {
44108 var relation = parentRelations[i3];
44109 if (relation.tags.type === "boundary")
44111 if (relation.isMultipolygon()) {
44112 if (relation.tags.indoor && relation.tags.indoor !== "no")
44114 if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no")
44120 function shouldCheckWay(way) {
44121 if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4)
44123 var bbox2 = way.extent(graph).bbox();
44124 var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
44125 if (hypotenuseMeters < 1.5)
44129 function getIssuesForWay(way) {
44130 if (!shouldCheckWay(way))
44132 var issues = [], nodes = graph.childNodes(way);
44133 for (var i3 = 0; i3 < nodes.length - 1; i3++) {
44134 var node1 = nodes[i3];
44135 var node2 = nodes[i3 + 1];
44136 var issue = getWayIssueIfAny(node1, node2, way);
44138 issues.push(issue);
44142 function getIssuesForVertex(node, parentWays) {
44144 function checkForCloseness(node1, node2, way) {
44145 var issue = getWayIssueIfAny(node1, node2, way);
44147 issues.push(issue);
44149 for (var i3 = 0; i3 < parentWays.length; i3++) {
44150 var parentWay = parentWays[i3];
44151 if (!shouldCheckWay(parentWay))
44153 var lastIndex = parentWay.nodes.length - 1;
44154 for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
44156 if (parentWay.nodes[j2 - 1] === node.id) {
44157 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
44160 if (j2 !== lastIndex) {
44161 if (parentWay.nodes[j2 + 1] === node.id) {
44162 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
44169 function thresholdMetersForWay(way) {
44170 if (!shouldCheckWay(way))
44172 var wayType = wayTypeFor(way);
44173 if (wayType === "boundary")
44175 if (wayType === "indoor")
44177 if (wayType === "building")
44179 if (wayType === "path")
44183 function getIssuesForDetachedPoint(node) {
44185 var lon = node.loc[0];
44186 var lat = node.loc[1];
44187 var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
44188 var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
44189 var queryExtent = geoExtent([
44190 [lon - lon_range, lat - lat_range],
44191 [lon + lon_range, lat + lat_range]
44193 var intersected = context.history().tree().intersects(queryExtent, graph);
44194 for (var j2 = 0; j2 < intersected.length; j2++) {
44195 var nearby = intersected[j2];
44196 if (nearby.id === node.id)
44198 if (nearby.type !== "node" || nearby.geometry(graph) !== "point")
44200 if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
44201 if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein")
44203 if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein")
44205 var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
44206 var zAxisDifferentiates = false;
44207 for (var key in zAxisKeys) {
44208 var nodeValue = node.tags[key] || "0";
44209 var nearbyValue = nearby.tags[key] || "0";
44210 if (nodeValue !== nearbyValue) {
44211 zAxisDifferentiates = true;
44215 if (zAxisDifferentiates)
44217 issues.push(new validationIssue({
44219 subtype: "detached",
44220 severity: "warning",
44221 message: function(context2) {
44222 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
44223 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
44224 feature: utilDisplayLabel(entity2, context2.graph()),
44225 feature2: utilDisplayLabel(entity22, context2.graph())
44228 reference: showReference,
44229 entityIds: [node.id, nearby.id],
44230 dynamicFixes: function() {
44232 new validationIssueFix({
44233 icon: "iD-operation-disconnect",
44234 title: _t.append("issues.fix.move_points_apart.title")
44236 new validationIssueFix({
44237 icon: "iD-icon-layers",
44238 title: _t.append("issues.fix.use_different_layers_or_levels.title")
44246 function showReference(selection2) {
44247 var referenceText = _t("issues.close_nodes.detached.reference");
44248 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
44251 function getWayIssueIfAny(node1, node2, way) {
44252 if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
44255 if (node1.loc !== node2.loc) {
44256 var parentWays1 = graph.parentWays(node1);
44257 var parentWays2 = new Set(graph.parentWays(node2));
44258 var sharedWays = parentWays1.filter(function(parentWay) {
44259 return parentWays2.has(parentWay);
44261 var thresholds = sharedWays.map(function(parentWay) {
44262 return thresholdMetersForWay(parentWay);
44264 var threshold = Math.min(...thresholds);
44265 var distance = geoSphericalDistance(node1.loc, node2.loc);
44266 if (distance > threshold)
44269 return new validationIssue({
44271 subtype: "vertices",
44272 severity: "warning",
44273 message: function(context2) {
44274 var entity2 = context2.hasEntity(this.entityIds[0]);
44275 return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
44277 reference: showReference,
44278 entityIds: [way.id, node1.id, node2.id],
44280 dynamicFixes: function() {
44282 new validationIssueFix({
44283 icon: "iD-icon-plus",
44284 title: _t.append("issues.fix.merge_points.title"),
44285 onClick: function(context2) {
44286 var entityIds = this.issue.entityIds;
44287 var action = actionMergeNodes([entityIds[1], entityIds[2]]);
44288 context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
44291 new validationIssueFix({
44292 icon: "iD-operation-disconnect",
44293 title: _t.append("issues.fix.move_points_apart.title")
44298 function showReference(selection2) {
44299 var referenceText = _t("issues.close_nodes.reference");
44300 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
44304 validation.type = type2;
44308 // modules/validations/crossing_ways.js
44309 var import_lodash3 = __toESM(require_lodash());
44310 function validationCrossingWays(context) {
44311 var type2 = "crossing_ways";
44312 function getFeatureWithFeatureTypeTagsForWay(way, graph) {
44313 if (getFeatureType(way, graph) === null) {
44314 var parentRels = graph.parentRelations(way);
44315 for (var i3 = 0; i3 < parentRels.length; i3++) {
44316 var rel = parentRels[i3];
44317 if (getFeatureType(rel, graph) !== null) {
44324 function hasTag(tags, key) {
44325 return tags[key] !== void 0 && tags[key] !== "no";
44327 function taggedAsIndoor(tags) {
44328 return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
44330 function allowsBridge(featureType) {
44331 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
44333 function allowsTunnel(featureType) {
44334 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
44336 var ignoredBuildings = {
44342 function getFeatureType(entity, graph) {
44343 var geometry = entity.geometry(graph);
44344 if (geometry !== "line" && geometry !== "area")
44346 var tags = entity.tags;
44347 if (hasTag(tags, "building") && !ignoredBuildings[tags.building])
44349 if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway])
44351 if (geometry !== "line")
44353 if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway])
44355 if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway])
44359 function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
44360 var level1 = tags1.level || "0";
44361 var level2 = tags2.level || "0";
44362 if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
44365 var layer1 = tags1.layer || "0";
44366 var layer2 = tags2.layer || "0";
44367 if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
44368 if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge"))
44370 if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge"))
44372 if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2)
44374 } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge"))
44376 else if (allowsBridge(featureType2) && hasTag(tags2, "bridge"))
44378 if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
44379 if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel"))
44381 if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel"))
44383 if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2)
44385 } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel"))
44387 else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel"))
44389 if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier")
44391 if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier")
44393 if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
44394 if (layer1 !== layer2)
44399 var highwaysDisallowingFords = {
44401 motorway_link: true,
44405 primary_link: true,
44407 secondary_link: true
44409 function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
44410 var featureType1 = getFeatureType(entity1, graph);
44411 var featureType2 = getFeatureType(entity2, graph);
44412 var geometry1 = entity1.geometry(graph);
44413 var geometry2 = entity2.geometry(graph);
44414 var bothLines = geometry1 === "line" && geometry2 === "line";
44415 if (featureType1 === featureType2) {
44416 if (featureType1 === "highway") {
44417 var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
44418 var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
44419 if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
44420 var roadFeature = entity1IsPath ? entity2 : entity1;
44421 var pathFeature = entity1IsPath ? entity1 : entity2;
44422 if (roadFeature.tags.highway === "track") {
44425 if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
44428 if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
44429 return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
44431 return bothLines ? { highway: "crossing" } : {};
44435 if (featureType1 === "waterway")
44437 if (featureType1 === "railway")
44440 var featureTypes = [featureType1, featureType2];
44441 if (featureTypes.indexOf("highway") !== -1) {
44442 if (featureTypes.indexOf("railway") !== -1) {
44445 var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
44446 if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
44448 return { railway: "tram_crossing" };
44449 return { railway: "crossing" };
44452 return { railway: "tram_level_crossing" };
44453 return { railway: "level_crossing" };
44456 if (featureTypes.indexOf("waterway") !== -1) {
44457 if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel"))
44459 if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge"))
44461 if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
44464 return bothLines ? { ford: "yes" } : {};
44470 function findCrossingsByWay(way1, graph, tree) {
44471 var edgeCrossInfos = [];
44472 if (way1.type !== "way")
44473 return edgeCrossInfos;
44474 var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
44475 var way1FeatureType = getFeatureType(taggedFeature1, graph);
44476 if (way1FeatureType === null)
44477 return edgeCrossInfos;
44478 var checkedSingleCrossingWays = {};
44481 var n1, n22, nA, nB, nAId, nBId;
44482 var segment1, segment2;
44484 var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
44485 var way1Nodes = graph.childNodes(way1);
44486 var comparedWays = {};
44487 for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
44488 n1 = way1Nodes[i3];
44489 n22 = way1Nodes[i3 + 1];
44490 extent = geoExtent([
44492 Math.min(n1.loc[0], n22.loc[0]),
44493 Math.min(n1.loc[1], n22.loc[1])
44496 Math.max(n1.loc[0], n22.loc[0]),
44497 Math.max(n1.loc[1], n22.loc[1])
44500 segmentInfos = tree.waySegments(extent, graph);
44501 for (j2 = 0; j2 < segmentInfos.length; j2++) {
44502 segment2Info = segmentInfos[j2];
44503 if (segment2Info.wayId === way1.id)
44505 if (checkedSingleCrossingWays[segment2Info.wayId])
44507 comparedWays[segment2Info.wayId] = true;
44508 way2 = graph.hasEntity(segment2Info.wayId);
44511 taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
44512 way2FeatureType = getFeatureType(taggedFeature2, graph);
44513 if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
44516 oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
44517 nAId = segment2Info.nodes[0];
44518 nBId = segment2Info.nodes[1];
44519 if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
44522 nA = graph.hasEntity(nAId);
44525 nB = graph.hasEntity(nBId);
44528 segment1 = [n1.loc, n22.loc];
44529 segment2 = [nA.loc, nB.loc];
44530 var point2 = geoLineIntersection(segment1, segment2);
44532 edgeCrossInfos.push({
44536 featureType: way1FeatureType,
44537 edge: [n1.id, n22.id]
44541 featureType: way2FeatureType,
44542 edge: [nA.id, nB.id]
44548 checkedSingleCrossingWays[way2.id] = true;
44554 return edgeCrossInfos;
44556 function waysToCheck(entity, graph) {
44557 var featureType = getFeatureType(entity, graph);
44560 if (entity.type === "way") {
44562 } else if (entity.type === "relation") {
44563 return entity.members.reduce(function(array2, member) {
44564 if (member.type === "way" && // only look at geometry ways
44565 (!member.role || member.role === "outer" || member.role === "inner")) {
44566 var entity2 = graph.hasEntity(member.id);
44567 if (entity2 && array2.indexOf(entity2) === -1) {
44568 array2.push(entity2);
44576 var validation = function checkCrossingWays(entity, graph) {
44577 var tree = context.history().tree();
44578 var ways = waysToCheck(entity, graph);
44580 var wayIndex, crossingIndex, crossings;
44581 for (wayIndex in ways) {
44582 crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
44583 for (crossingIndex in crossings) {
44584 issues.push(createIssue(crossings[crossingIndex], graph));
44589 function createIssue(crossing, graph) {
44590 crossing.wayInfos.sort(function(way1Info, way2Info) {
44591 var type1 = way1Info.featureType;
44592 var type22 = way2Info.featureType;
44593 if (type1 === type22) {
44594 return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
44595 } else if (type1 === "waterway") {
44597 } else if (type22 === "waterway") {
44600 return type1 < type22;
44602 var entities = crossing.wayInfos.map(function(wayInfo) {
44603 return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
44605 var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
44606 var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
44607 var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
44608 var featureType1 = crossing.wayInfos[0].featureType;
44609 var featureType2 = crossing.wayInfos[1].featureType;
44610 var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
44611 var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
44612 var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
44613 var subtype = [featureType1, featureType2].sort().join("-");
44614 var crossingTypeID = subtype;
44615 if (isCrossingIndoors) {
44616 crossingTypeID = "indoor-indoor";
44617 } else if (isCrossingTunnels) {
44618 crossingTypeID = "tunnel-tunnel";
44619 } else if (isCrossingBridges) {
44620 crossingTypeID = "bridge-bridge";
44622 if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
44623 crossingTypeID += "_connectable";
44625 var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
44626 return new validationIssue({
44629 severity: "warning",
44630 message: function(context2) {
44631 var graph2 = context2.graph();
44632 var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
44633 return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
44634 feature: utilDisplayLabel(entity1, graph2),
44635 feature2: utilDisplayLabel(entity2, graph2)
44638 reference: showReference,
44639 entityIds: entities.map(function(entity) {
44648 loc: crossing.crossPoint,
44649 dynamicFixes: function(context2) {
44650 var mode = context2.mode();
44651 if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1)
44653 var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
44654 var selectedFeatureType = this.data.featureTypes[selectedIndex];
44655 var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
44657 if (connectionTags) {
44658 fixes.push(makeConnectWaysFix(this.data.connectionTags));
44659 let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
44660 if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
44661 fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
44664 if (isCrossingIndoors) {
44665 fixes.push(new validationIssueFix({
44666 icon: "iD-icon-layers",
44667 title: _t.append("issues.fix.use_different_levels.title")
44669 } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
44670 fixes.push(makeChangeLayerFix("higher"));
44671 fixes.push(makeChangeLayerFix("lower"));
44672 } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
44673 if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
44674 fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
44676 var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
44677 if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
44678 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
44681 fixes.push(new validationIssueFix({
44682 icon: "iD-operation-move",
44683 title: _t.append("issues.fix.reposition_features.title")
44688 function showReference(selection2) {
44689 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
44692 function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
44693 return new validationIssueFix({
44695 title: _t.append("issues.fix." + fixTitleID + ".title"),
44696 onClick: function(context2) {
44697 var mode = context2.mode();
44698 if (!mode || mode.id !== "select")
44700 var selectedIDs = mode.selectedIDs();
44701 if (selectedIDs.length !== 1)
44703 var selectedWayID = selectedIDs[0];
44704 if (!context2.hasEntity(selectedWayID))
44706 var resultWayIDs = [selectedWayID];
44707 var edge, crossedEdge, crossedWayID;
44708 if (this.issue.entityIds[0] === selectedWayID) {
44709 edge = this.issue.data.edges[0];
44710 crossedEdge = this.issue.data.edges[1];
44711 crossedWayID = this.issue.entityIds[1];
44713 edge = this.issue.data.edges[1];
44714 crossedEdge = this.issue.data.edges[0];
44715 crossedWayID = this.issue.entityIds[0];
44717 var crossingLoc = this.issue.loc;
44718 var projection2 = context2.projection;
44719 var action = function actionAddStructure(graph) {
44720 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44721 var crossedWay = graph.hasEntity(crossedWayID);
44722 var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
44723 if (!structLengthMeters) {
44724 structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
44726 if (structLengthMeters) {
44727 if (getFeatureType(crossedWay, graph) === "railway") {
44728 structLengthMeters *= 2;
44731 structLengthMeters = 8;
44733 var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
44734 var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
44735 var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
44736 if (crossingAngle > Math.PI)
44737 crossingAngle -= Math.PI;
44738 structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
44739 structLengthMeters += 4;
44740 structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
44741 function geomToProj(geoPoint) {
44743 geoLonToMeters(geoPoint[0], geoPoint[1]),
44744 geoLatToMeters(geoPoint[1])
44747 function projToGeom(projPoint) {
44748 var lat = geoMetersToLat(projPoint[1]);
44750 geoMetersToLon(projPoint[0], lat),
44754 var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
44755 var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
44756 var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
44757 var projectedCrossingLoc = geomToProj(crossingLoc);
44758 var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
44759 function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
44760 var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
44761 return projToGeom([
44762 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
44763 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
44766 var endpointLocGetter1 = function(lengthMeters) {
44767 return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
44769 var endpointLocGetter2 = function(lengthMeters) {
44770 return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
44772 var minEdgeLengthMeters = 0.55;
44773 function determineEndpoint(edge2, endNode, locGetter) {
44775 var idealLengthMeters = structLengthMeters / 2;
44776 var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
44777 if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
44778 var idealNodeLoc = locGetter(idealLengthMeters);
44779 newNode = osmNode();
44780 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
44783 endNode.parentIntersectionWays(graph).forEach(function(way) {
44784 way.nodes.forEach(function(nodeID) {
44785 if (nodeID === endNode.id) {
44786 if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
44794 if (edgeCount >= 3) {
44795 var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
44796 if (insetLength > minEdgeLengthMeters) {
44797 var insetNodeLoc = locGetter(insetLength);
44798 newNode = osmNode();
44799 graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
44805 var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
44806 graph = splitAction(graph);
44807 if (splitAction.getCreatedWayIDs().length) {
44808 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
44812 var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
44813 var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
44814 var structureWay = resultWayIDs.map(function(id2) {
44815 return graph.entity(id2);
44816 }).find(function(way) {
44817 return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
44819 var tags = Object.assign({}, structureWay.tags);
44820 if (bridgeOrTunnel === "bridge") {
44821 tags.bridge = "yes";
44824 var tunnelValue = "yes";
44825 if (getFeatureType(structureWay, graph) === "waterway") {
44826 tunnelValue = "culvert";
44828 tags.tunnel = tunnelValue;
44831 graph = actionChangeTags(structureWay.id, tags)(graph);
44834 context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
44835 context2.enter(modeSelect(context2, resultWayIDs));
44839 function makeConnectWaysFix(connectionTags) {
44840 var fixTitleID = "connect_features";
44841 var fixIcon = "iD-icon-crossing";
44842 if (connectionTags.highway === "crossing") {
44843 fixTitleID = "connect_using_crossing";
44844 fixIcon = "temaki-pedestrian";
44846 if (connectionTags.ford) {
44847 fixTitleID = "connect_using_ford";
44848 fixIcon = "roentgen-ford";
44850 const fix = new validationIssueFix({
44852 title: _t.append("issues.fix." + fixTitleID + ".title"),
44853 onClick: function(context2) {
44854 var loc = this.issue.loc;
44855 var edges = this.issue.data.edges;
44857 function actionConnectCrossingWays(graph) {
44858 var node = osmNode({ loc, tags: connectionTags });
44859 graph = graph.replace(node);
44860 var nodesToMerge = [node.id];
44861 var mergeThresholdInMeters = 0.75;
44862 edges.forEach(function(edge) {
44863 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
44864 var nearby = geoSphericalClosestNode(edgeNodes, loc);
44865 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
44866 nodesToMerge.push(nearby.node.id);
44868 graph = actionAddMidpoint({ loc, edge }, node)(graph);
44871 if (nodesToMerge.length > 1) {
44872 graph = actionMergeNodes(nodesToMerge, loc)(graph);
44876 _t("issues.fix.connect_crossing_features.annotation")
44880 fix._connectionTags = connectionTags;
44883 function makeChangeLayerFix(higherOrLower) {
44884 return new validationIssueFix({
44885 icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
44886 title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
44887 onClick: function(context2) {
44888 var mode = context2.mode();
44889 if (!mode || mode.id !== "select")
44891 var selectedIDs = mode.selectedIDs();
44892 if (selectedIDs.length !== 1)
44894 var selectedID = selectedIDs[0];
44895 if (!this.issue.entityIds.some(function(entityId) {
44896 return entityId === selectedID;
44899 var entity = context2.hasEntity(selectedID);
44902 var tags = Object.assign({}, entity.tags);
44903 var layer = tags.layer && Number(tags.layer);
44904 if (layer && !isNaN(layer)) {
44905 if (higherOrLower === "higher") {
44911 if (higherOrLower === "higher") {
44917 tags.layer = layer.toString();
44919 actionChangeTags(entity.id, tags),
44920 _t("operations.change_tags.annotation")
44925 validation.type = type2;
44929 // modules/behavior/draw_way.js
44930 function behaviorDrawWay(context, wayID, mode, startGraph) {
44931 const keybinding = utilKeybinding("drawWay");
44932 var dispatch14 = dispatch_default("rejectedSelfIntersection");
44933 var behavior = behaviorDraw(context);
44939 var _pointerHasMoved = false;
44941 var _didResolveTempEdit = false;
44942 function createDrawNode(loc) {
44943 _drawNode = osmNode({ loc });
44944 context.pauseChangeDispatch();
44945 context.replace(function actionAddDrawNode(graph) {
44946 var way = graph.entity(wayID);
44947 return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
44949 context.resumeChangeDispatch();
44950 setActiveElements();
44952 function removeDrawNode() {
44953 context.pauseChangeDispatch();
44955 function actionDeleteDrawNode(graph) {
44956 var way = graph.entity(wayID);
44957 return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
44961 _drawNode = void 0;
44962 context.resumeChangeDispatch();
44964 function keydown(d3_event) {
44965 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44966 if (context.surface().classed("nope")) {
44967 context.surface().classed("nope-suppressed", true);
44969 context.surface().classed("nope", false).classed("nope-disabled", true);
44972 function keyup(d3_event) {
44973 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
44974 if (context.surface().classed("nope-suppressed")) {
44975 context.surface().classed("nope", true);
44977 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
44980 function allowsVertex(d2) {
44981 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
44983 function move(d3_event, datum2) {
44984 var loc = context.map().mouseCoordinates();
44986 createDrawNode(loc);
44987 context.surface().classed("nope-disabled", d3_event.altKey);
44988 var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
44989 var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
44992 } else if (targetNodes) {
44993 var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
44998 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
44999 _drawNode = context.entity(_drawNode.id);
45002 /* includeDrawNode */
45005 function checkGeometry(includeDrawNode) {
45006 var nopeDisabled = context.surface().classed("nope-disabled");
45007 var isInvalid = isInvalidGeometry(includeDrawNode);
45008 if (nopeDisabled) {
45009 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
45011 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
45014 function isInvalidGeometry(includeDrawNode) {
45015 var testNode = _drawNode;
45016 var parentWay = context.graph().entity(wayID);
45017 var nodes = context.graph().childNodes(parentWay).slice();
45018 if (includeDrawNode) {
45019 if (parentWay.isClosed()) {
45023 if (parentWay.isClosed()) {
45024 if (nodes.length < 3)
45027 nodes.splice(-2, 1);
45028 testNode = nodes[nodes.length - 2];
45033 return testNode && geoHasSelfIntersections(nodes, testNode.id);
45035 function undone() {
45036 _didResolveTempEdit = true;
45037 context.pauseChangeDispatch();
45039 if (context.graph() === startGraph) {
45040 nextMode = modeSelect(context, [wayID]);
45045 context.perform(actionNoop());
45047 context.resumeChangeDispatch();
45048 context.enter(nextMode);
45050 function setActiveElements() {
45053 context.surface().selectAll("." + _drawNode.id).classed("active", true);
45055 function resetToStartGraph() {
45056 while (context.graph() !== startGraph) {
45060 var drawWay = function(surface) {
45061 _drawNode = void 0;
45062 _didResolveTempEdit = false;
45063 _origWay = context.entity(wayID);
45064 if (typeof _nodeIndex === "number") {
45065 _headNodeID = _origWay.nodes[_nodeIndex];
45066 } else if (_origWay.isClosed()) {
45067 _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
45069 _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
45071 _wayGeometry = _origWay.geometry(context.graph());
45073 (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
45075 _pointerHasMoved = false;
45076 context.pauseChangeDispatch();
45077 context.perform(actionNoop(), _annotation);
45078 context.resumeChangeDispatch();
45079 behavior.hover().initialNodeID(_headNodeID);
45080 behavior.on("move", function() {
45081 _pointerHasMoved = true;
45082 move.apply(this, arguments);
45083 }).on("down", function() {
45084 move.apply(this, arguments);
45085 }).on("downcancel", function() {
45088 }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
45089 select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
45090 context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
45091 setActiveElements();
45092 surface.call(behavior);
45093 context.history().on("undone.draw", undone);
45095 drawWay.off = function(surface) {
45096 if (!_didResolveTempEdit) {
45097 context.pauseChangeDispatch();
45098 resetToStartGraph();
45099 context.resumeChangeDispatch();
45101 _drawNode = void 0;
45102 _nodeIndex = void 0;
45103 context.map().on("drawn.draw", null);
45104 surface.call(behavior.off).selectAll(".active").classed("active", false);
45105 surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
45106 select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
45107 context.history().on("undone.draw", null);
45109 function attemptAdd(d2, loc, doAdd) {
45111 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
45112 _drawNode = context.entity(_drawNode.id);
45114 createDrawNode(loc);
45118 /* includeDrawNode */
45120 if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
45121 if (!_pointerHasMoved) {
45124 dispatch14.call("rejectedSelfIntersection", this);
45127 context.pauseChangeDispatch();
45129 _didResolveTempEdit = true;
45130 context.resumeChangeDispatch();
45131 context.enter(mode);
45133 drawWay.add = function(loc, d2) {
45134 attemptAdd(d2, loc, function() {
45137 drawWay.addWay = function(loc, edge, d2) {
45138 attemptAdd(d2, loc, function() {
45140 actionAddMidpoint({ loc, edge }, _drawNode),
45145 drawWay.addNode = function(node, d2) {
45146 if (node.id === _headNodeID || // or the first node when drawing an area
45147 _origWay.isClosed() && node.id === _origWay.first()) {
45151 attemptAdd(d2, node.loc, function() {
45153 function actionReplaceDrawNode(graph) {
45154 graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
45155 return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
45161 function getFeatureType(ways) {
45162 if (ways.every((way) => way.isClosed()))
45164 if (ways.every((way) => !way.isClosed()))
45168 function followMode() {
45169 if (_didResolveTempEdit)
45172 const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
45173 const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
45174 const historyGraph = context.history().graph();
45175 if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
45176 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
45179 const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
45180 const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
45181 const featureType = getFeatureType(lastNodesParents);
45182 if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
45183 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_multiple_ways.".concat(featureType)))();
45186 if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
45187 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_different_ways.".concat(featureType)))();
45190 const way = lastNodesParents[0];
45191 const indexOfLast = way.nodes.indexOf(lastNodeId);
45192 const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
45193 const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
45194 let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
45195 if (nextNodeIndex === -1)
45196 nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
45197 const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
45198 drawWay.addNode(nextNode, {
45199 geometry: { type: "Point", coordinates: nextNode.loc },
45201 properties: { target: true, entity: nextNode }
45204 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
45207 keybinding.on(_t("operations.follow.key"), followMode);
45208 select_default2(document).call(keybinding);
45209 drawWay.finish = function() {
45212 /* includeDrawNode */
45214 if (context.surface().classed("nope")) {
45215 dispatch14.call("rejectedSelfIntersection", this);
45218 context.pauseChangeDispatch();
45220 _didResolveTempEdit = true;
45221 context.resumeChangeDispatch();
45222 var way = context.hasEntity(wayID);
45223 if (!way || way.isDegenerate()) {
45227 window.setTimeout(function() {
45228 context.map().dblclickZoomEnable(true);
45230 var isNewFeature = !mode.isContinuing;
45231 context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
45233 drawWay.cancel = function() {
45234 context.pauseChangeDispatch();
45235 resetToStartGraph();
45236 context.resumeChangeDispatch();
45237 window.setTimeout(function() {
45238 context.map().dblclickZoomEnable(true);
45240 context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
45241 context.enter(modeBrowse(context));
45243 drawWay.nodeIndex = function(val) {
45244 if (!arguments.length)
45249 drawWay.activeID = function() {
45250 if (!arguments.length)
45251 return _drawNode && _drawNode.id;
45254 return utilRebind(drawWay, dispatch14, "on");
45257 // modules/modes/draw_line.js
45258 function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
45263 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
45264 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
45266 mode.wayID = wayID;
45267 mode.isContinuing = continuing;
45268 mode.enter = function() {
45269 behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
45270 context.install(behavior);
45272 mode.exit = function() {
45273 context.uninstall(behavior);
45275 mode.selectedIDs = function() {
45278 mode.activeID = function() {
45279 return behavior && behavior.activeID() || [];
45284 // modules/validations/disconnected_way.js
45285 function validationDisconnectedWay() {
45286 var type2 = "disconnected_way";
45287 function isTaggedAsHighway(entity) {
45288 return osmRoutableHighwayTagValues[entity.tags.highway];
45290 var validation = function checkDisconnectedWay(entity, graph) {
45291 var routingIslandWays = routingIslandForEntity(entity);
45292 if (!routingIslandWays)
45294 return [new validationIssue({
45296 subtype: "highway",
45297 severity: "warning",
45298 message: function(context) {
45299 var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
45300 var label = entity2 && utilDisplayLabel(entity2, context.graph());
45301 return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
45303 reference: showReference,
45304 entityIds: Array.from(routingIslandWays).map(function(way) {
45307 dynamicFixes: makeFixes
45309 function makeFixes(context) {
45311 var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
45312 if (singleEntity) {
45313 if (singleEntity.type === "way" && !singleEntity.isClosed()) {
45314 var textDirection = _mainLocalizer.textDirection();
45315 var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
45317 fixes.push(startFix);
45318 var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
45320 fixes.push(endFix);
45322 if (!fixes.length) {
45323 fixes.push(new validationIssueFix({
45324 title: _t.append("issues.fix.connect_feature.title")
45327 fixes.push(new validationIssueFix({
45328 icon: "iD-operation-delete",
45329 title: _t.append("issues.fix.delete_feature.title"),
45330 entityIds: [singleEntity.id],
45331 onClick: function(context2) {
45332 var id2 = this.issue.entityIds[0];
45333 var operation2 = operationDelete(context2, [id2]);
45334 if (!operation2.disabled()) {
45340 fixes.push(new validationIssueFix({
45341 title: _t.append("issues.fix.connect_features.title")
45346 function showReference(selection2) {
45347 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
45349 function routingIslandForEntity(entity2) {
45350 var routingIsland = /* @__PURE__ */ new Set();
45351 var waysToCheck = [];
45352 function queueParentWays(node) {
45353 graph.parentWays(node).forEach(function(parentWay) {
45354 if (!routingIsland.has(parentWay) && // only check each feature once
45355 isRoutableWay(parentWay, false)) {
45356 routingIsland.add(parentWay);
45357 waysToCheck.push(parentWay);
45361 if (entity2.type === "way" && isRoutableWay(entity2, true)) {
45362 routingIsland.add(entity2);
45363 waysToCheck.push(entity2);
45364 } else if (entity2.type === "node" && isRoutableNode(entity2)) {
45365 routingIsland.add(entity2);
45366 queueParentWays(entity2);
45370 while (waysToCheck.length) {
45371 var wayToCheck = waysToCheck.pop();
45372 var childNodes = graph.childNodes(wayToCheck);
45373 for (var i3 in childNodes) {
45374 var vertex = childNodes[i3];
45375 if (isConnectedVertex(vertex)) {
45378 if (isRoutableNode(vertex)) {
45379 routingIsland.add(vertex);
45381 queueParentWays(vertex);
45384 return routingIsland;
45386 function isConnectedVertex(vertex) {
45387 var osm = services.osm;
45388 if (osm && !osm.isDataLoaded(vertex.loc))
45390 if (vertex.tags.entrance && vertex.tags.entrance !== "no")
45392 if (vertex.tags.amenity === "parking_entrance")
45396 function isRoutableNode(node) {
45397 if (node.tags.highway === "elevator")
45401 function isRoutableWay(way, ignoreInnerWays) {
45402 if (isTaggedAsHighway(way) || way.tags.route === "ferry")
45404 return graph.parentRelations(way).some(function(parentRelation) {
45405 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
45407 if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner"))
45412 function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
45413 var vertex = graph.hasEntity(vertexID);
45414 if (!vertex || vertex.tags.noexit === "yes")
45416 var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
45417 return new validationIssueFix({
45418 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
45419 title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
45420 entityIds: [vertexID],
45421 onClick: function(context) {
45422 var wayId = this.issue.entityIds[0];
45423 var way = context.hasEntity(wayId);
45424 var vertexId = this.entityIds[0];
45425 var vertex2 = context.hasEntity(vertexId);
45426 if (!way || !vertex2)
45428 var map2 = context.map();
45429 if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
45430 map2.zoomToEase(vertex2);
45433 modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
45439 validation.type = type2;
45443 // modules/validations/invalid_format.js
45444 function validationFormatting() {
45445 var type2 = "invalid_format";
45446 var validation = function(entity) {
45448 function isValidEmail(email) {
45449 var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
45450 return !email || valid_email.test(email);
45452 function showReferenceEmail(selection2) {
45453 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
45455 if (entity.tags.email) {
45456 var emails = entity.tags.email.split(";").map(function(s2) {
45458 }).filter(function(x2) {
45459 return !isValidEmail(x2);
45461 if (emails.length) {
45462 issues.push(new validationIssue({
45465 severity: "warning",
45466 message: function(context) {
45467 var entity2 = context.hasEntity(this.entityIds[0]);
45468 return entity2 ? _t.append(
45469 "issues.invalid_format.email.message" + this.data,
45470 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
45473 reference: showReferenceEmail,
45474 entityIds: [entity.id],
45475 hash: emails.join(),
45476 data: emails.length > 1 ? "_multi" : ""
45482 validation.type = type2;
45486 // modules/validations/help_request.js
45487 function validationHelpRequest(context) {
45488 var type2 = "help_request";
45489 var validation = function checkFixmeTag(entity) {
45490 if (!entity.tags.fixme)
45492 if (entity.version === void 0)
45494 if (entity.v !== void 0) {
45495 var baseEntity = context.history().base().hasEntity(entity.id);
45496 if (!baseEntity || !baseEntity.tags.fixme)
45499 return [new validationIssue({
45501 subtype: "fixme_tag",
45502 severity: "warning",
45503 message: function(context2) {
45504 var entity2 = context2.hasEntity(this.entityIds[0]);
45505 return entity2 ? _t.append("issues.fixme_tag.message", {
45506 feature: utilDisplayLabel(
45514 dynamicFixes: function() {
45516 new validationIssueFix({
45517 title: _t.append("issues.fix.address_the_concern.title")
45521 reference: showReference,
45522 entityIds: [entity.id]
45524 function showReference(selection2) {
45525 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
45528 validation.type = type2;
45532 // modules/validations/impossible_oneway.js
45533 function validationImpossibleOneway() {
45534 var type2 = "impossible_oneway";
45535 var validation = function checkImpossibleOneway(entity, graph) {
45536 if (entity.type !== "way" || entity.geometry(graph) !== "line")
45538 if (entity.isClosed())
45540 if (!typeForWay(entity))
45542 if (!isOneway(entity))
45544 var firstIssues = issuesForNode(entity, entity.first());
45545 var lastIssues = issuesForNode(entity, entity.last());
45546 return firstIssues.concat(lastIssues);
45547 function typeForWay(way) {
45548 if (way.geometry(graph) !== "line")
45550 if (osmRoutableHighwayTagValues[way.tags.highway])
45552 if (osmFlowingWaterwayTagValues[way.tags.waterway])
45556 function isOneway(way) {
45557 if (way.tags.oneway === "yes")
45559 if (way.tags.oneway)
45561 for (var key in way.tags) {
45562 if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
45568 function nodeOccursMoreThanOnce(way, nodeID) {
45569 var occurrences = 0;
45570 for (var index in way.nodes) {
45571 if (way.nodes[index] === nodeID) {
45573 if (occurrences > 1)
45579 function isConnectedViaOtherTypes(way, node) {
45580 var wayType = typeForWay(way);
45581 if (wayType === "highway") {
45582 if (node.tags.entrance && node.tags.entrance !== "no")
45584 if (node.tags.amenity === "parking_entrance")
45586 } else if (wayType === "waterway") {
45587 if (node.id === way.first()) {
45588 if (node.tags.natural === "spring")
45591 if (node.tags.manhole === "drain")
45595 return graph.parentWays(node).some(function(parentWay) {
45596 if (parentWay.id === way.id)
45598 if (wayType === "highway") {
45599 if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway])
45601 if (parentWay.tags.route === "ferry")
45603 return graph.parentRelations(parentWay).some(function(parentRelation) {
45604 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry")
45606 return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
45608 } else if (wayType === "waterway") {
45609 if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline")
45615 function issuesForNode(way, nodeID) {
45616 var isFirst = nodeID === way.first();
45617 var wayType = typeForWay(way);
45618 if (nodeOccursMoreThanOnce(way, nodeID))
45620 var osm = services.osm;
45623 var node = graph.hasEntity(nodeID);
45624 if (!node || !osm.isDataLoaded(node.loc))
45626 if (isConnectedViaOtherTypes(way, node))
45628 var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
45629 if (parentWay.id === way.id)
45631 return typeForWay(parentWay) === wayType;
45633 if (wayType === "waterway" && attachedWaysOfSameType.length === 0)
45635 var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
45636 return isOneway(attachedWay);
45638 if (attachedOneways.length < attachedWaysOfSameType.length)
45640 if (attachedOneways.length) {
45641 var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
45642 if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID)
45644 if (nodeOccursMoreThanOnce(attachedOneway, nodeID))
45648 if (connectedEndpointsOkay)
45651 var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
45652 if (wayType === "waterway") {
45653 messageID += "connected." + placement;
45654 referenceID += "connected";
45656 messageID += placement;
45657 referenceID += placement;
45659 return [new validationIssue({
45662 severity: "warning",
45663 message: function(context) {
45664 var entity2 = context.hasEntity(this.entityIds[0]);
45665 return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
45666 feature: utilDisplayLabel(entity2, context.graph())
45669 reference: getReference(referenceID),
45670 entityIds: [way.id, node.id],
45671 dynamicFixes: function() {
45673 if (attachedOneways.length) {
45674 fixes.push(new validationIssueFix({
45675 icon: "iD-operation-reverse",
45676 title: _t.append("issues.fix.reverse_feature.title"),
45677 entityIds: [way.id],
45678 onClick: function(context) {
45679 var id2 = this.issue.entityIds[0];
45680 context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
45684 if (node.tags.noexit !== "yes") {
45685 var textDirection = _mainLocalizer.textDirection();
45686 var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
45687 fixes.push(new validationIssueFix({
45688 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
45689 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
45690 onClick: function(context) {
45691 var entityID = this.issue.entityIds[0];
45692 var vertexID = this.issue.entityIds[1];
45693 var way2 = context.entity(entityID);
45694 var vertex = context.entity(vertexID);
45695 continueDrawing(way2, vertex, context);
45703 function getReference(referenceID2) {
45704 return function showReference(selection2) {
45705 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
45710 function continueDrawing(way, vertex, context) {
45711 var map2 = context.map();
45712 if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
45713 map2.zoomToEase(vertex);
45716 modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
45719 validation.type = type2;
45723 // modules/validations/incompatible_source.js
45724 function validationIncompatibleSource() {
45725 const type2 = "incompatible_source";
45726 const incompatibleRules = [
45729 regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
45733 regex: /(baidu|mapbar|百度)/i
45738 exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
45741 const validation = function checkIncompatibleSource(entity) {
45742 const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
45743 if (!entitySources)
45745 const entityID = entity.id;
45746 return entitySources.map((source) => {
45747 const matchRule = incompatibleRules.find((rule) => {
45748 if (!rule.regex.test(source))
45750 if (rule.exceptRegex && rule.exceptRegex.test(source))
45756 return new validationIssue({
45758 severity: "warning",
45759 message: (context) => {
45760 const entity2 = context.hasEntity(entityID);
45761 return entity2 ? _t.append("issues.incompatible_source.feature.message", {
45762 feature: utilDisplayLabel(
45771 reference: getReference(matchRule.id),
45772 entityIds: [entityID],
45774 dynamicFixes: () => {
45776 new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
45780 }).filter(Boolean);
45781 function getReference(id2) {
45782 return function showReference(selection2) {
45783 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.incompatible_source.reference.".concat(id2)));
45787 validation.type = type2;
45791 // modules/validations/maprules.js
45792 function validationMaprules() {
45793 var type2 = "maprules";
45794 var validation = function checkMaprules(entity, graph) {
45795 if (!services.maprules)
45797 var rules = services.maprules.validationRules();
45799 for (var i3 = 0; i3 < rules.length; i3++) {
45800 var rule = rules[i3];
45801 rule.findIssues(entity, graph, issues);
45805 validation.type = type2;
45809 // modules/validations/mismatched_geometry.js
45810 var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
45811 function validationMismatchedGeometry() {
45812 var type2 = "mismatched_geometry";
45813 function tagSuggestingLineIsArea(entity) {
45814 if (entity.type !== "way" || entity.isClosed())
45816 var tagSuggestingArea = entity.tagSuggestingArea();
45817 if (!tagSuggestingArea) {
45820 var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
45821 var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
45822 if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
45825 return tagSuggestingArea;
45827 function makeConnectEndpointsFixOnClick(way, graph) {
45828 if (way.nodes.length < 3)
45830 var nodes = graph.childNodes(way), testNodes;
45831 var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
45832 if (firstToLastDistanceMeters < 0.75) {
45833 testNodes = nodes.slice();
45835 testNodes.push(testNodes[0]);
45836 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45837 return function(context) {
45838 var way2 = context.entity(this.issue.entityIds[0]);
45840 actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
45841 _t("issues.fix.connect_endpoints.annotation")
45846 testNodes = nodes.slice();
45847 testNodes.push(testNodes[0]);
45848 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
45849 return function(context) {
45850 var wayId = this.issue.entityIds[0];
45851 var way2 = context.entity(wayId);
45852 var nodeId = way2.nodes[0];
45853 var index = way2.nodes.length;
45855 actionAddVertex(wayId, nodeId, index),
45856 _t("issues.fix.connect_endpoints.annotation")
45861 function lineTaggedAsAreaIssue(entity) {
45862 var tagSuggestingArea = tagSuggestingLineIsArea(entity);
45863 if (!tagSuggestingArea)
45865 var validAsLine = false;
45866 var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
45867 if (presetAsLine) {
45868 validAsLine = true;
45869 var key = Object.keys(tagSuggestingArea)[0];
45870 if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
45871 validAsLine = false;
45873 if (Object.keys(presetAsLine.tags).length === 0) {
45874 validAsLine = false;
45877 return new validationIssue({
45879 subtype: "area_as_line",
45880 severity: "warning",
45881 message: function(context) {
45882 var entity2 = context.hasEntity(this.entityIds[0]);
45883 return entity2 ? _t.append("issues.tag_suggests_area.message", {
45884 feature: utilDisplayLabel(
45890 tag: utilTagText({ tags: tagSuggestingArea })
45893 reference: showReference,
45894 entityIds: [entity.id],
45895 hash: JSON.stringify(tagSuggestingArea),
45896 dynamicFixes: function(context) {
45898 var entity2 = context.entity(this.entityIds[0]);
45899 var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
45900 if (!validAsLine) {
45901 fixes.push(new validationIssueFix({
45902 title: _t.append("issues.fix.connect_endpoints.title"),
45903 onClick: connectEndsOnClick
45906 fixes.push(new validationIssueFix({
45907 icon: "iD-operation-delete",
45908 title: _t.append("issues.fix.remove_tag.title"),
45909 onClick: function(context2) {
45910 var entityId = this.issue.entityIds[0];
45911 var entity3 = context2.entity(entityId);
45912 var tags = Object.assign({}, entity3.tags);
45913 for (var key2 in tagSuggestingArea) {
45917 actionChangeTags(entityId, tags),
45918 _t("issues.fix.remove_tag.annotation")
45925 function showReference(selection2) {
45926 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
45929 function vertexPointIssue(entity, graph) {
45930 if (entity.type !== "node")
45932 if (Object.keys(entity.tags).length === 0)
45934 if (entity.isOnAddressLine(graph))
45936 var geometry = entity.geometry(graph);
45937 var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
45938 if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
45939 return new validationIssue({
45941 subtype: "vertex_as_point",
45942 severity: "warning",
45943 message: function(context) {
45944 var entity2 = context.hasEntity(this.entityIds[0]);
45945 return entity2 ? _t.append("issues.vertex_as_point.message", {
45946 feature: utilDisplayLabel(
45954 reference: function showReference(selection2) {
45955 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
45957 entityIds: [entity.id]
45959 } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
45960 return new validationIssue({
45962 subtype: "point_as_vertex",
45963 severity: "warning",
45964 message: function(context) {
45965 var entity2 = context.hasEntity(this.entityIds[0]);
45966 return entity2 ? _t.append("issues.point_as_vertex.message", {
45967 feature: utilDisplayLabel(
45975 reference: function showReference(selection2) {
45976 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
45978 entityIds: [entity.id],
45979 dynamicFixes: extractPointDynamicFixes
45984 function otherMismatchIssue(entity, graph) {
45985 if (!entity.hasInterestingTags())
45987 if (entity.type !== "node" && entity.type !== "way")
45989 if (entity.type === "node" && entity.isOnAddressLine(graph))
45991 var sourceGeom = entity.geometry(graph);
45992 var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
45993 if (sourceGeom === "area")
45994 targetGeoms.unshift("line");
45995 var asSource = _mainPresetIndex.match(entity, graph);
45996 var targetGeom = targetGeoms.find((nodeGeom) => {
45997 var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
45998 if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
45999 (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags))
46001 if (asTarget.isFallback())
46003 var primaryKey = Object.keys(asTarget.tags)[0];
46004 if (primaryKey === "building")
46006 if (asTarget.tags[primaryKey] === "*")
46008 return asSource.isFallback() || asSource.tags[primaryKey] === "*";
46012 var subtype = targetGeom + "_as_" + sourceGeom;
46013 if (targetGeom === "vertex")
46014 targetGeom = "point";
46015 if (sourceGeom === "vertex")
46016 sourceGeom = "point";
46017 var referenceId = targetGeom + "_as_" + sourceGeom;
46019 if (targetGeom === "point") {
46020 dynamicFixes = extractPointDynamicFixes;
46021 } else if (sourceGeom === "area" && targetGeom === "line") {
46022 dynamicFixes = lineToAreaDynamicFixes;
46024 return new validationIssue({
46027 severity: "warning",
46028 message: function(context) {
46029 var entity2 = context.hasEntity(this.entityIds[0]);
46030 return entity2 ? _t.append("issues." + referenceId + ".message", {
46031 feature: utilDisplayLabel(
46039 reference: function showReference(selection2) {
46040 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
46042 entityIds: [entity.id],
46046 function lineToAreaDynamicFixes(context) {
46047 var convertOnClick;
46048 var entityId = this.entityIds[0];
46049 var entity = context.entity(entityId);
46050 var tags = Object.assign({}, entity.tags);
46052 if (!osmTagSuggestingArea(tags)) {
46053 convertOnClick = function(context2) {
46054 var entityId2 = this.issue.entityIds[0];
46055 var entity2 = context2.entity(entityId2);
46056 var tags2 = Object.assign({}, entity2.tags);
46061 actionChangeTags(entityId2, tags2),
46062 _t("issues.fix.convert_to_line.annotation")
46067 new validationIssueFix({
46068 icon: "iD-icon-line",
46069 title: _t.append("issues.fix.convert_to_line.title"),
46070 onClick: convertOnClick
46074 function extractPointDynamicFixes(context) {
46075 var entityId = this.entityIds[0];
46076 var extractOnClick = null;
46077 if (!context.hasHiddenConnections(entityId)) {
46078 extractOnClick = function(context2) {
46079 var entityId2 = this.issue.entityIds[0];
46080 var action = actionExtract(entityId2, context2.projection);
46083 _t("operations.extract.annotation", { n: 1 })
46085 context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
46089 new validationIssueFix({
46090 icon: "iD-operation-extract",
46091 title: _t.append("issues.fix.extract_point.title"),
46092 onClick: extractOnClick
46096 function unclosedMultipolygonPartIssues(entity, graph) {
46097 if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
46098 !entity.isComplete(graph))
46100 var sequences = osmJoinWays(entity.members, graph);
46102 for (var i3 in sequences) {
46103 var sequence = sequences[i3];
46104 if (!sequence.nodes)
46106 var firstNode = sequence.nodes[0];
46107 var lastNode = sequence.nodes[sequence.nodes.length - 1];
46108 if (firstNode === lastNode)
46110 var issue = new validationIssue({
46112 subtype: "unclosed_multipolygon_part",
46113 severity: "warning",
46114 message: function(context) {
46115 var entity2 = context.hasEntity(this.entityIds[0]);
46116 return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
46117 feature: utilDisplayLabel(
46125 reference: showReference,
46126 loc: sequence.nodes[0].loc,
46127 entityIds: [entity.id],
46128 hash: sequence.map(function(way) {
46132 issues.push(issue);
46135 function showReference(selection2) {
46136 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
46139 var validation = function checkMismatchedGeometry(entity, graph) {
46140 var vertexPoint = vertexPointIssue(entity, graph);
46142 return [vertexPoint];
46143 var lineAsArea = lineTaggedAsAreaIssue(entity);
46145 return [lineAsArea];
46146 var mismatch = otherMismatchIssue(entity, graph);
46149 return unclosedMultipolygonPartIssues(entity, graph);
46151 validation.type = type2;
46155 // modules/validations/missing_role.js
46156 function validationMissingRole() {
46157 var type2 = "missing_role";
46158 var validation = function checkMissingRole(entity, graph) {
46160 if (entity.type === "way") {
46161 graph.parentRelations(entity).forEach(function(relation) {
46162 if (!relation.isMultipolygon())
46164 var member = relation.memberById(entity.id);
46165 if (member && isMissingRole(member)) {
46166 issues.push(makeIssue(entity, relation, member));
46169 } else if (entity.type === "relation" && entity.isMultipolygon()) {
46170 entity.indexedMembers().forEach(function(member) {
46171 var way = graph.hasEntity(member.id);
46172 if (way && isMissingRole(member)) {
46173 issues.push(makeIssue(way, entity, member));
46179 function isMissingRole(member) {
46180 return !member.role || !member.role.trim().length;
46182 function makeIssue(way, relation, member) {
46183 return new validationIssue({
46185 severity: "warning",
46186 message: function(context) {
46187 var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
46188 return member2 && relation2 ? _t.append("issues.missing_role.message", {
46189 member: utilDisplayLabel(member2, context.graph()),
46190 relation: utilDisplayLabel(relation2, context.graph())
46193 reference: showReference,
46194 entityIds: [relation.id, way.id],
46198 hash: member.index.toString(),
46199 dynamicFixes: function() {
46201 makeAddRoleFix("inner"),
46202 makeAddRoleFix("outer"),
46203 new validationIssueFix({
46204 icon: "iD-operation-delete",
46205 title: _t.append("issues.fix.remove_from_relation.title"),
46206 onClick: function(context) {
46208 actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
46209 _t("operations.delete_member.annotation", {
46218 function showReference(selection2) {
46219 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
46222 function makeAddRoleFix(role) {
46223 return new validationIssueFix({
46224 title: _t.append("issues.fix.set_as_" + role + ".title"),
46225 onClick: function(context) {
46226 var oldMember = this.issue.data.member;
46227 var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
46229 actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
46230 _t("operations.change_role.annotation", {
46237 validation.type = type2;
46241 // modules/validations/missing_tag.js
46242 function validationMissingTag(context) {
46243 var type2 = "missing_tag";
46244 function hasDescriptiveTags(entity) {
46245 var onlyAttributeKeys = ["description", "name", "note", "start_date"];
46246 var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
46247 if (k2 === "area" || !osmIsInterestingTag(k2))
46249 return !onlyAttributeKeys.some(function(attributeKey) {
46250 return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
46253 if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
46256 return entityDescriptiveKeys.length > 0;
46258 function isUnknownRoad(entity) {
46259 return entity.type === "way" && entity.tags.highway === "road";
46261 function isUntypedRelation(entity) {
46262 return entity.type === "relation" && !entity.tags.type;
46264 var validation = function checkMissingTag(entity, graph) {
46266 var osm = context.connection();
46267 var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
46268 if (!isUnloadedNode && // allow untagged nodes that are part of ways
46269 entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
46270 !entity.hasParentRelations(graph)) {
46271 if (Object.keys(entity.tags).length === 0) {
46273 } else if (!hasDescriptiveTags(entity)) {
46274 subtype = "descriptive";
46275 } else if (isUntypedRelation(entity)) {
46276 subtype = "relation_type";
46279 if (!subtype && isUnknownRoad(entity)) {
46280 subtype = "highway_classification";
46284 var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
46285 var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
46286 var canDelete = entity.version === void 0 || entity.v !== void 0;
46287 var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
46288 return [new validationIssue({
46292 message: function(context2) {
46293 var entity2 = context2.hasEntity(this.entityIds[0]);
46294 return entity2 ? _t.append("issues." + messageID + ".message", {
46295 feature: utilDisplayLabel(entity2, context2.graph())
46298 reference: showReference,
46299 entityIds: [entity.id],
46300 dynamicFixes: function(context2) {
46302 var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
46303 fixes.push(new validationIssueFix({
46304 icon: "iD-icon-search",
46305 title: _t.append("issues.fix." + selectFixType + ".title"),
46306 onClick: function(context3) {
46307 context3.ui().sidebar.showPresetList();
46311 var id2 = this.entityIds[0];
46312 var operation2 = operationDelete(context2, [id2]);
46313 var disabledReasonID = operation2.disabled();
46314 if (!disabledReasonID) {
46315 deleteOnClick = function(context3) {
46316 var id3 = this.issue.entityIds[0];
46317 var operation3 = operationDelete(context3, [id3]);
46318 if (!operation3.disabled()) {
46324 new validationIssueFix({
46325 icon: "iD-operation-delete",
46326 title: _t.append("issues.fix.delete_feature.title"),
46327 disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
46328 onClick: deleteOnClick
46334 function showReference(selection2) {
46335 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
46338 validation.type = type2;
46342 // modules/validations/mutually_exclusive_tags.js
46343 function validationMutuallyExclusiveTags() {
46344 const type2 = "mutually_exclusive_tags";
46345 const tagKeyPairs = osmMutuallyExclusiveTagPairs;
46346 const validation = function checkMutuallyExclusiveTags(entity) {
46347 let pairsFounds = tagKeyPairs.filter((pair3) => {
46348 return pair3[0] in entity.tags && pair3[1] in entity.tags;
46349 }).filter((pair3) => {
46350 return !(pair3[0].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[0]] === "no" || pair3[1].match(/^(addr:)?no[a-z]/) && entity.tags[pair3[1]] === "no");
46352 Object.keys(entity.tags).forEach((key) => {
46353 let negative_key = "not:" + key;
46354 if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
46355 pairsFounds.push([negative_key, key, "same_value"]);
46357 if (key.match(/^name:[a-z]+/)) {
46358 negative_key = "not:name";
46359 if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
46360 pairsFounds.push([negative_key, key, "same_value"]);
46364 let issues = pairsFounds.map((pair3) => {
46365 const subtype = pair3[2] || "default";
46366 return new validationIssue({
46369 severity: "warning",
46370 message: function(context) {
46371 let entity2 = context.hasEntity(this.entityIds[0]);
46372 return entity2 ? _t.append("issues.".concat(type2, ".").concat(subtype, ".message"), {
46373 feature: utilDisplayLabel(entity2, context.graph()),
46378 reference: (selection2) => showReference(selection2, pair3, subtype),
46379 entityIds: [entity.id],
46380 dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
46383 function createIssueFix(tagToRemove) {
46384 return new validationIssueFix({
46385 icon: "iD-operation-delete",
46386 title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
46387 onClick: function(context) {
46388 const entityId = this.issue.entityIds[0];
46389 const entity2 = context.entity(entityId);
46390 let tags = Object.assign({}, entity2.tags);
46391 delete tags[tagToRemove];
46393 actionChangeTags(entityId, tags),
46394 _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
46399 function showReference(selection2, pair3, subtype) {
46400 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.".concat(type2, ".").concat(subtype, ".reference"), { tag1: pair3[0], tag2: pair3[1] }));
46404 validation.type = type2;
46408 // modules/validations/outdated_tags.js
46409 function validationOutdatedTags() {
46410 const type2 = "outdated_tags";
46411 let _waitingForDeprecated = true;
46412 let _dataDeprecated;
46413 _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
46414 }).finally(() => _waitingForDeprecated = false);
46415 function oldTagIssues(entity, graph) {
46416 if (!entity.hasInterestingTags())
46418 let preset = _mainPresetIndex.match(entity, graph);
46421 const oldTags = Object.assign({}, entity.tags);
46422 let subtype = "deprecated_tags";
46423 if (preset.replacement) {
46424 const newPreset = _mainPresetIndex.item(preset.replacement);
46425 graph = actionChangePreset(
46430 /* skip field defaults */
46432 entity = graph.entity(entity.id);
46433 preset = newPreset;
46435 const upgradeReasons = [];
46436 if (_dataDeprecated) {
46437 const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
46438 if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
46439 deprecatedTags.push({
46440 old: { traffic_calming: "island" },
46441 replace: { "area:highway": "traffic_island" }
46444 if (deprecatedTags.length) {
46445 deprecatedTags.forEach((tag2) => {
46446 graph = actionUpgradeTags(entity.id, tag2.old, tag2.replace)(graph);
46447 upgradeReasons.push({
46448 source: "id-tagging-schema--deprecated",
46452 entity = graph.entity(entity.id);
46455 let newTags = Object.assign({}, entity.tags);
46456 if (preset.tags !== preset.addTags) {
46457 Object.keys(preset.addTags).forEach((k2) => {
46458 if (!newTags[k2]) {
46459 if (preset.addTags[k2] === "*") {
46460 newTags[k2] = "yes";
46461 } else if (preset.addTags[k2]) {
46462 newTags[k2] = preset.addTags[k2];
46464 upgradeReasons.push({
46465 source: "id-tagging-schema--preset-addTags",
46471 const nsi = services.nsi;
46472 let waitingForNsi = false;
46475 waitingForNsi = nsi.status() === "loading";
46476 if (!waitingForNsi) {
46477 const loc = entity.extent(graph).center();
46478 nsiResult = nsi.upgradeTags(newTags, loc);
46480 newTags = nsiResult.newTags;
46481 subtype = "noncanonical_brand";
46482 upgradeReasons.push({
46483 source: "name-suggestion-index",
46490 issues.provisional = _waitingForDeprecated || waitingForNsi;
46491 const tagDiff = utilTagDiff(oldTags, newTags);
46492 if (!tagDiff.length)
46494 const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
46497 prefix = "noncanonical_brand.";
46498 } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
46499 subtype = "incomplete_tags";
46500 prefix = "incomplete.";
46502 let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
46503 issues.push(new validationIssue({
46506 severity: "warning",
46507 message: showMessage,
46508 reference: showReference,
46509 entityIds: [entity.id],
46510 hash: utilHashcode(JSON.stringify(tagDiff)),
46511 dynamicFixes: () => {
46513 new validationIssueFix({
46515 title: _t.append("issues.fix.upgrade_tags.title"),
46516 onClick: (context) => {
46517 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
46521 const item = nsiResult && nsiResult.matched;
46524 new validationIssueFix({
46525 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
46526 onClick: (context) => {
46527 context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
46536 function doUpgrade(graph2) {
46537 const currEntity = graph2.hasEntity(entity.id);
46540 let newTags2 = Object.assign({}, currEntity.tags);
46541 tagDiff.forEach((diff) => {
46542 if (diff.type === "-") {
46543 delete newTags2[diff.key];
46544 } else if (diff.type === "+") {
46545 newTags2[diff.key] = diff.newVal;
46548 return actionChangeTags(currEntity.id, newTags2)(graph2);
46550 function addNotTag(graph2) {
46551 const currEntity = graph2.hasEntity(entity.id);
46554 const item = nsiResult && nsiResult.matched;
46557 let newTags2 = Object.assign({}, currEntity.tags);
46558 const wd = item.mainTag;
46559 const notwd = "not:".concat(wd);
46560 const qid = item.tags[wd];
46561 newTags2[notwd] = qid;
46562 if (newTags2[wd] === qid) {
46563 const wp = item.mainTag.replace("wikidata", "wikipedia");
46564 delete newTags2[wd];
46565 delete newTags2[wp];
46567 return actionChangeTags(currEntity.id, newTags2)(graph2);
46569 function showMessage(context) {
46570 const currEntity = context.hasEntity(entity.id);
46573 let messageID = "issues.outdated_tags.".concat(prefix, "message");
46574 if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
46575 messageID += "_incomplete";
46577 return _t.append(messageID, {
46578 feature: utilDisplayLabel(
46586 function showReference(selection2) {
46587 let enter = selection2.selectAll(".issue-reference").data([0]).enter();
46588 enter.append("div").attr("class", "issue-reference").call(_t.append("issues.outdated_tags.".concat(prefix, "reference")));
46589 enter.append("strong").call(_t.append("issues.suggested"));
46590 enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
46591 let klass = d2.type === "+" ? "add" : "remove";
46592 return "tagDiff-cell tagDiff-cell-".concat(klass);
46593 }).html((d2) => d2.display);
46596 let validation = oldTagIssues;
46597 validation.type = type2;
46601 // modules/validations/private_data.js
46602 function validationPrivateData() {
46603 var type2 = "private_data";
46604 var privateBuildingValues = {
46610 semidetached_house: true,
46611 static_caravan: true
46622 var personalTags = {
46623 "contact:email": true,
46624 "contact:fax": true,
46625 "contact:phone": true,
46630 var validation = function checkPrivateData(entity) {
46631 var tags = entity.tags;
46632 if (!tags.building || !privateBuildingValues[tags.building])
46635 for (var k2 in tags) {
46636 if (publicKeys[k2])
46638 if (!personalTags[k2]) {
46639 keepTags[k2] = tags[k2];
46642 var tagDiff = utilTagDiff(tags, keepTags);
46643 if (!tagDiff.length)
46645 var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
46646 return [new validationIssue({
46648 severity: "warning",
46649 message: showMessage,
46650 reference: showReference,
46651 entityIds: [entity.id],
46652 dynamicFixes: function() {
46654 new validationIssueFix({
46655 icon: "iD-operation-delete",
46656 title: _t.append("issues.fix." + fixID + ".title"),
46657 onClick: function(context) {
46658 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
46664 function doUpgrade(graph) {
46665 var currEntity = graph.hasEntity(entity.id);
46668 var newTags = Object.assign({}, currEntity.tags);
46669 tagDiff.forEach(function(diff) {
46670 if (diff.type === "-") {
46671 delete newTags[diff.key];
46672 } else if (diff.type === "+") {
46673 newTags[diff.key] = diff.newVal;
46676 return actionChangeTags(currEntity.id, newTags)(graph);
46678 function showMessage(context) {
46679 var currEntity = context.hasEntity(this.entityIds[0]);
46683 "issues.private_data.contact.message",
46684 { feature: utilDisplayLabel(currEntity, context.graph()) }
46687 function showReference(selection2) {
46688 var enter = selection2.selectAll(".issue-reference").data([0]).enter();
46689 enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
46690 enter.append("strong").call(_t.append("issues.suggested"));
46691 enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", function(d2) {
46692 var klass = d2.type === "+" ? "add" : "remove";
46693 return "tagDiff-cell tagDiff-cell-" + klass;
46694 }).html(function(d2) {
46699 validation.type = type2;
46703 // modules/validations/suspicious_name.js
46704 function validationSuspiciousName() {
46705 const type2 = "suspicious_name";
46706 const keysToTestForGenericValues = [
46721 let _waitingForNsi = false;
46722 function isGenericMatchInNsi(tags) {
46723 const nsi = services.nsi;
46725 _waitingForNsi = nsi.status() === "loading";
46726 if (!_waitingForNsi) {
46727 return nsi.isGenericName(tags);
46732 function nameMatchesRawTag(lowercaseName, tags) {
46733 for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
46734 let key = keysToTestForGenericValues[i3];
46735 let val = tags[key];
46737 val = val.toLowerCase();
46738 if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
46745 function isGenericName(name, tags) {
46746 name = name.toLowerCase();
46747 return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
46749 function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
46750 return new validationIssue({
46752 subtype: "generic_name",
46753 severity: "warning",
46754 message: function(context) {
46755 let entity = context.hasEntity(this.entityIds[0]);
46758 let preset = _mainPresetIndex.match(entity, context.graph());
46759 let langName = langCode && _mainLocalizer.languageName(langCode);
46761 "issues.generic_name.message" + (langName ? "_language" : ""),
46762 { feature: preset.name(), name: genericName, language: langName }
46765 reference: showReference,
46766 entityIds: [entityId],
46767 hash: "".concat(nameKey, "=").concat(genericName),
46768 dynamicFixes: function() {
46770 new validationIssueFix({
46771 icon: "iD-operation-delete",
46772 title: _t.append("issues.fix.remove_the_name.title"),
46773 onClick: function(context) {
46774 let entityId2 = this.issue.entityIds[0];
46775 let entity = context.entity(entityId2);
46776 let tags = Object.assign({}, entity.tags);
46777 delete tags[nameKey];
46779 actionChangeTags(entityId2, tags),
46780 _t("issues.fix.remove_generic_name.annotation")
46787 function showReference(selection2) {
46788 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
46791 let validation = function checkGenericName(entity) {
46792 const tags = entity.tags;
46793 const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
46797 for (let key in tags) {
46798 const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
46801 const langCode = m2.length >= 2 ? m2[1] : null;
46802 const value = tags[key];
46803 if (isGenericName(value, tags)) {
46804 issues.provisional = _waitingForNsi;
46805 issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
46810 validation.type = type2;
46814 // modules/validations/unsquare_way.js
46815 function validationUnsquareWay(context) {
46816 var type2 = "unsquare_way";
46817 var DEFAULT_DEG_THRESHOLD = 5;
46818 var epsilon3 = 0.05;
46819 var nodeThreshold = 10;
46820 function isBuilding(entity, graph) {
46821 if (entity.type !== "way" || entity.geometry(graph) !== "area")
46823 return entity.tags.building && entity.tags.building !== "no";
46825 var validation = function checkUnsquareWay(entity, graph) {
46826 if (!isBuilding(entity, graph))
46828 if (entity.tags.nonsquare === "yes")
46830 var isClosed = entity.isClosed();
46833 var nodes = graph.childNodes(entity).slice();
46834 if (nodes.length > nodeThreshold + 1)
46836 var osm = services.osm;
46837 if (!osm || nodes.some(function(node) {
46838 return !osm.isDataLoaded(node.loc);
46841 var hasConnectedSquarableWays = nodes.some(function(node) {
46842 return graph.parentWays(node).some(function(way) {
46843 if (way.id === entity.id)
46845 if (isBuilding(way, graph))
46847 return graph.parentRelations(way).some(function(parentRelation) {
46848 return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
46852 if (hasConnectedSquarableWays)
46854 var storedDegreeThreshold = corePreferences("validate-square-degrees");
46855 var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
46856 var points = nodes.map(function(node) {
46857 return context.projection(node.loc);
46859 if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true))
46862 if (!entity.tags.wikidata) {
46863 var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
46864 autoAction.transitionable = false;
46865 autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
46867 return [new validationIssue({
46869 subtype: "building",
46870 severity: "warning",
46871 message: function(context2) {
46872 var entity2 = context2.hasEntity(this.entityIds[0]);
46873 return entity2 ? _t.append("issues.unsquare_way.message", {
46874 feature: utilDisplayLabel(entity2, context2.graph())
46877 reference: showReference,
46878 entityIds: [entity.id],
46879 hash: degreeThreshold,
46880 dynamicFixes: function() {
46882 new validationIssueFix({
46883 icon: "iD-operation-orthogonalize",
46884 title: _t.append("issues.fix.square_feature.title"),
46886 onClick: function(context2, completionHandler) {
46887 var entityId = this.issue.entityIds[0];
46889 actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
46890 _t("operations.orthogonalize.annotation.feature", { n: 1 })
46892 window.setTimeout(function() {
46893 completionHandler();
46898 new validationIssueFix({
46899 title: t.append('issues.fix.tag_as_unsquare.title'),
46900 onClick: function(context) {
46901 var entityId = this.issue.entityIds[0];
46902 var entity = context.entity(entityId);
46903 var tags = Object.assign({}, entity.tags); // shallow copy
46904 tags.nonsquare = 'yes';
46906 actionChangeTags(entityId, tags),
46907 t('issues.fix.tag_as_unsquare.annotation')
46915 function showReference(selection2) {
46916 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
46919 validation.type = type2;
46923 // modules/core/validator.js
46924 function coreValidator(context) {
46925 let dispatch14 = dispatch_default("validated", "focusedIssue");
46926 let validator = utilRebind({}, dispatch14, "on");
46928 let _disabledRules = {};
46929 let _ignoredIssueIDs = /* @__PURE__ */ new Set();
46930 let _resolvedIssueIDs = /* @__PURE__ */ new Set();
46931 let _baseCache = validationCache("base");
46932 let _headCache = validationCache("head");
46933 let _completeDiff = {};
46934 let _headIsCurrent = false;
46935 let _deferredRIC = {};
46936 let _deferredST = /* @__PURE__ */ new Set();
46939 const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
46940 const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
46941 const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
46942 function parseHashParam(param) {
46944 let rules = (param || "").split(",");
46945 rules.forEach((rule) => {
46946 rule = rule.trim();
46947 const parts = rule.split("/", 2);
46948 const type2 = parts[0];
46949 const subtype = parts[1] || "*";
46950 if (!type2 || !subtype)
46952 result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
46955 function makeRegExp(str) {
46956 const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
46957 return new RegExp("^" + escaped + "$");
46960 validator.init = () => {
46961 Object.values(validations_exports).forEach((validation) => {
46962 if (typeof validation !== "function")
46964 const fn = validation(context);
46965 const key = fn.type;
46968 let disabledRules = corePreferences("validate-disabledRules");
46969 if (disabledRules) {
46970 disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
46973 function reset(resetIgnored) {
46974 _baseCache.queue = [];
46975 _headCache.queue = [];
46976 Object.keys(_deferredRIC).forEach((key) => {
46977 window.cancelIdleCallback(key);
46978 _deferredRIC[key]();
46981 _deferredST.forEach(window.clearTimeout);
46982 _deferredST.clear();
46984 _ignoredIssueIDs.clear();
46985 _resolvedIssueIDs.clear();
46986 _baseCache = validationCache("base");
46987 _headCache = validationCache("head");
46988 _completeDiff = {};
46989 _headIsCurrent = false;
46991 validator.reset = () => {
46994 validator.resetIgnoredIssues = () => {
46995 _ignoredIssueIDs.clear();
46996 dispatch14.call("validated");
46998 validator.revalidateUnsquare = () => {
46999 revalidateUnsquare(_headCache);
47000 revalidateUnsquare(_baseCache);
47001 dispatch14.call("validated");
47003 function revalidateUnsquare(cache) {
47004 const checkUnsquareWay = _rules.unsquare_way;
47005 if (!cache.graph || typeof checkUnsquareWay !== "function")
47007 cache.uncacheIssuesOfType("unsquare_way");
47008 const buildings = context.history().tree().intersects(geoExtent([-180, -90], [180, 90]), cache.graph).filter((entity) => entity.type === "way" && entity.tags.building && entity.tags.building !== "no");
47009 buildings.forEach((entity) => {
47010 const detected = checkUnsquareWay(entity, cache.graph);
47011 if (!detected.length)
47013 cache.cacheIssues(detected);
47016 validator.getIssues = (options2) => {
47017 const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
47018 const view = context.map().extent();
47019 let seen = /* @__PURE__ */ new Set();
47021 if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
47022 Object.values(_headCache.issuesByIssueID).forEach((issue) => {
47023 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
47024 if (opts.what === "edited" && !userModified)
47026 if (!filter2(issue))
47028 seen.add(issue.id);
47029 results.push(issue);
47032 if (opts.what === "all") {
47033 Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
47034 if (!filter2(issue))
47036 seen.add(issue.id);
47037 results.push(issue);
47041 function filter2(issue) {
47044 if (seen.has(issue.id))
47046 if (_resolvedIssueIDs.has(issue.id))
47048 if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type])
47050 if (!opts.includeDisabledRules && _disabledRules[issue.type])
47052 if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id))
47054 if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id))
47056 if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2)))
47058 if (opts.where === "visible") {
47059 const extent = issue.extent(context.graph());
47060 if (!view.intersects(extent))
47066 validator.getResolvedIssues = () => {
47067 return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
47069 validator.focusIssue = (issue) => {
47070 const graph = context.graph();
47073 const issueExtent = issue.extent(graph);
47075 focusCenter = issueExtent.center();
47077 if (issue.entityIds && issue.entityIds.length) {
47078 selectID = issue.entityIds[0];
47079 if (selectID && selectID.charAt(0) === "r") {
47080 const ids = utilEntityAndDeepMemberIDs([selectID], graph);
47081 let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
47083 const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
47085 nodeID = graph.entity(wayID).first();
47089 focusCenter = graph.entity(nodeID).loc;
47094 const setZoom = Math.max(context.map().zoom(), 19);
47095 context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
47098 window.setTimeout(() => {
47099 context.enter(modeSelect(context, [selectID]));
47100 dispatch14.call("focusedIssue", this, issue);
47104 validator.getIssuesBySeverity = (options2) => {
47105 let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
47106 groups.error = groups.error || [];
47107 groups.warning = groups.warning || [];
47110 validator.getSharedEntityIssues = (entityIDs, options2) => {
47111 const orderedIssueTypes = [
47112 // Show some issue types in a particular order:
47115 // - missing data first
47117 "mismatched_geometry",
47118 // - identity issues
47121 // - geometry issues where fixing them might solve connectivity issues
47122 "disconnected_way",
47123 "impossible_oneway"
47124 // - finally connectivity issues
47126 const allIssues = validator.getIssues(options2);
47127 const forEntityIDs = new Set(entityIDs);
47128 return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
47129 if (issue1.type === issue2.type) {
47130 return issue1.id < issue2.id ? -1 : 1;
47132 const index1 = orderedIssueTypes.indexOf(issue1.type);
47133 const index2 = orderedIssueTypes.indexOf(issue2.type);
47134 if (index1 !== -1 && index2 !== -1) {
47135 return index1 - index2;
47136 } else if (index1 === -1 && index2 === -1) {
47137 return issue1.type < issue2.type ? -1 : 1;
47139 return index1 !== -1 ? -1 : 1;
47143 validator.getEntityIssues = (entityID, options2) => {
47144 return validator.getSharedEntityIssues([entityID], options2);
47146 validator.getRuleKeys = () => {
47147 return Object.keys(_rules);
47149 validator.isRuleEnabled = (key) => {
47150 return !_disabledRules[key];
47152 validator.toggleRule = (key) => {
47153 if (_disabledRules[key]) {
47154 delete _disabledRules[key];
47156 _disabledRules[key] = true;
47158 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47159 validator.validate();
47161 validator.disableRules = (keys2) => {
47162 _disabledRules = {};
47163 keys2.forEach((k2) => _disabledRules[k2] = true);
47164 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
47165 validator.validate();
47167 validator.ignoreIssue = (issueID) => {
47168 _ignoredIssueIDs.add(issueID);
47170 validator.validate = () => {
47171 const baseGraph = context.history().base();
47172 if (!_headCache.graph)
47173 _headCache.graph = baseGraph;
47174 if (!_baseCache.graph)
47175 _baseCache.graph = baseGraph;
47176 const prevGraph = _headCache.graph;
47177 const currGraph = context.graph();
47178 if (currGraph === prevGraph) {
47179 _headIsCurrent = true;
47180 dispatch14.call("validated");
47181 return Promise.resolve();
47183 if (_headPromise) {
47184 _headIsCurrent = false;
47185 return _headPromise;
47187 _headCache.graph = currGraph;
47188 _completeDiff = context.history().difference().complete();
47189 const incrementalDiff = coreDifference(prevGraph, currGraph);
47190 let entityIDs = Object.keys(incrementalDiff.complete());
47191 entityIDs = _headCache.withAllRelatedEntities(entityIDs);
47192 if (!entityIDs.size) {
47193 dispatch14.call("validated");
47194 return Promise.resolve();
47196 _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
47198 _headPromise = null;
47199 if (!_headIsCurrent) {
47200 validator.validate();
47203 return _headPromise;
47205 context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
47207 validator.validate();
47209 context.on("exit.validator", validator.validate);
47210 context.history().on("merge.validator", (entities) => {
47213 const baseGraph = context.history().base();
47214 if (!_headCache.graph)
47215 _headCache.graph = baseGraph;
47216 if (!_baseCache.graph)
47217 _baseCache.graph = baseGraph;
47218 let entityIDs = entities.map((entity) => entity.id);
47219 entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
47220 validateEntitiesAsync(entityIDs, _baseCache);
47222 function validateEntity(entity, graph) {
47223 let result = { issues: [], provisional: false };
47224 Object.keys(_rules).forEach(runValidation);
47226 function runValidation(key) {
47227 const fn = _rules[key];
47228 if (typeof fn !== "function") {
47229 console.error("no such validation rule = " + key);
47232 let detected = fn(entity, graph);
47233 if (detected.provisional) {
47234 result.provisional = true;
47236 detected = detected.filter(applySeverityOverrides);
47237 result.issues = result.issues.concat(detected);
47238 function applySeverityOverrides(issue) {
47239 const type2 = issue.type;
47240 const subtype = issue.subtype || "";
47242 for (i3 = 0; i3 < _errorOverrides.length; i3++) {
47243 if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
47244 issue.severity = "error";
47248 for (i3 = 0; i3 < _warningOverrides.length; i3++) {
47249 if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
47250 issue.severity = "warning";
47254 for (i3 = 0; i3 < _disableOverrides.length; i3++) {
47255 if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
47263 function updateResolvedIssues(entityIDs) {
47264 entityIDs.forEach((entityID) => {
47265 const baseIssues = _baseCache.issuesByEntityID[entityID];
47268 baseIssues.forEach((issueID) => {
47269 const issue = _baseCache.issuesByIssueID[issueID];
47270 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
47271 if (userModified && !_headCache.issuesByIssueID[issueID]) {
47272 _resolvedIssueIDs.add(issueID);
47274 _resolvedIssueIDs.delete(issueID);
47279 function validateEntitiesAsync(entityIDs, cache) {
47280 const jobs = Array.from(entityIDs).map((entityID) => {
47281 if (cache.queuedEntityIDs.has(entityID))
47283 cache.queuedEntityIDs.add(entityID);
47284 cache.uncacheEntityID(entityID);
47286 cache.queuedEntityIDs.delete(entityID);
47287 const graph = cache.graph;
47290 const entity = graph.hasEntity(entityID);
47293 const result = validateEntity(entity, graph);
47294 if (result.provisional) {
47295 cache.provisionalEntityIDs.add(entityID);
47297 cache.cacheIssues(result.issues);
47299 }).filter(Boolean);
47300 cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
47301 if (cache.queuePromise)
47302 return cache.queuePromise;
47303 cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
47304 }).finally(() => cache.queuePromise = null);
47305 return cache.queuePromise;
47307 function revalidateProvisionalEntities(cache) {
47308 if (!cache.provisionalEntityIDs.size)
47310 const handle = window.setTimeout(() => {
47311 _deferredST.delete(handle);
47312 if (!cache.provisionalEntityIDs.size)
47314 validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
47316 _deferredST.add(handle);
47318 function processQueue(cache) {
47319 if (!cache.queue.length)
47320 return Promise.resolve();
47321 const chunk = cache.queue.pop();
47322 return new Promise((resolvePromise, rejectPromise) => {
47323 const handle = window.requestIdleCallback(() => {
47324 delete _deferredRIC[handle];
47325 chunk.forEach((job) => job());
47328 _deferredRIC[handle] = rejectPromise;
47330 if (cache.queue.length % 25 === 0)
47331 dispatch14.call("validated");
47332 }).then(() => processQueue(cache));
47336 function validationCache(which) {
47341 queuePromise: null,
47342 queuedEntityIDs: /* @__PURE__ */ new Set(),
47343 provisionalEntityIDs: /* @__PURE__ */ new Set(),
47344 issuesByIssueID: {},
47345 // issue.id -> issue
47346 issuesByEntityID: {}
47347 // entity.id -> Set(issue.id)
47349 cache.cacheIssue = (issue) => {
47350 (issue.entityIds || []).forEach((entityID) => {
47351 if (!cache.issuesByEntityID[entityID]) {
47352 cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
47354 cache.issuesByEntityID[entityID].add(issue.id);
47356 cache.issuesByIssueID[issue.id] = issue;
47358 cache.uncacheIssue = (issue) => {
47359 (issue.entityIds || []).forEach((entityID) => {
47360 if (cache.issuesByEntityID[entityID]) {
47361 cache.issuesByEntityID[entityID].delete(issue.id);
47364 delete cache.issuesByIssueID[issue.id];
47366 cache.cacheIssues = (issues) => {
47367 issues.forEach(cache.cacheIssue);
47369 cache.uncacheIssues = (issues) => {
47370 issues.forEach(cache.uncacheIssue);
47372 cache.uncacheIssuesOfType = (type2) => {
47373 const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
47374 cache.uncacheIssues(issuesOfType);
47376 cache.uncacheEntityID = (entityID) => {
47377 const entityIssueIDs = cache.issuesByEntityID[entityID];
47378 if (entityIssueIDs) {
47379 entityIssueIDs.forEach((issueID) => {
47380 const issue = cache.issuesByIssueID[issueID];
47382 cache.uncacheIssue(issue);
47384 delete cache.issuesByIssueID[issueID];
47388 delete cache.issuesByEntityID[entityID];
47389 cache.provisionalEntityIDs.delete(entityID);
47391 cache.withAllRelatedEntities = (entityIDs) => {
47392 let result = /* @__PURE__ */ new Set();
47393 (entityIDs || []).forEach((entityID) => {
47394 result.add(entityID);
47395 const entityIssueIDs = cache.issuesByEntityID[entityID];
47396 if (entityIssueIDs) {
47397 entityIssueIDs.forEach((issueID) => {
47398 const issue = cache.issuesByIssueID[issueID];
47400 (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
47402 delete cache.issuesByIssueID[issueID];
47412 // modules/core/uploader.js
47413 function coreUploader(context) {
47414 var dispatch14 = dispatch_default(
47415 // Start and end events are dispatched exactly once each per legitimate outside call to `save`
47417 // dispatched as soon as a call to `save` has been deemed legitimate
47419 // dispatched after the result event has been dispatched
47420 "willAttemptUpload",
47421 // dispatched before the actual upload call occurs, if it will
47423 // Each save results in one of these outcomes:
47425 // upload wasn't attempted since there were no edits
47427 // upload failed due to errors
47429 // upload failed due to data conflicts
47431 // upload completed without errors
47433 var _isSaving = false;
47434 var _conflicts = [];
47437 var _discardTags = {};
47438 _mainFileFetcher.get("discarded").then(function(d2) {
47440 }).catch(function() {
47442 var uploader = utilRebind({}, dispatch14, "on");
47443 uploader.isSaving = function() {
47446 uploader.save = function(changeset, tryAgain, checkConflicts) {
47447 if (_isSaving && !tryAgain) {
47450 var osm = context.connection();
47453 if (!osm.authenticated()) {
47454 osm.authenticate(function(err) {
47456 uploader.save(changeset, tryAgain, checkConflicts);
47463 dispatch14.call("saveStarted", this);
47465 var history = context.history();
47468 _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
47470 history.perform(actionNoop());
47472 if (!checkConflicts) {
47475 performFullConflictCheck(changeset);
47478 function performFullConflictCheck(changeset) {
47479 var osm = context.connection();
47482 var history = context.history();
47483 var localGraph = context.graph();
47484 var remoteGraph = coreGraph(history.base(), true);
47485 var summary = history.difference().summary();
47487 for (var i3 = 0; i3 < summary.length; i3++) {
47488 var item = summary[i3];
47489 if (item.changeType === "modified") {
47490 _toCheck.push(item.entity.id);
47493 var _toLoad = withChildNodes(_toCheck, localGraph);
47495 var _toLoadCount = 0;
47496 var _toLoadTotal = _toLoad.length;
47497 if (_toCheck.length) {
47498 dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47499 _toLoad.forEach(function(id2) {
47500 _loaded[id2] = false;
47502 osm.loadMultiple(_toLoad, loaded);
47507 function withChildNodes(ids, graph) {
47508 var s2 = new Set(ids);
47509 ids.forEach(function(id2) {
47510 var entity = graph.entity(id2);
47511 if (entity.type !== "way")
47513 graph.childNodes(entity).forEach(function(child) {
47514 if (child.version !== void 0) {
47519 return Array.from(s2);
47521 function loaded(err, result) {
47522 if (_errors.length)
47526 msg: err.message || err.responseText,
47527 details: [_t("save.status_code", { code: err.status })]
47529 didResultInErrors();
47532 result.data.forEach(function(entity) {
47533 remoteGraph.replace(entity);
47534 _loaded[entity.id] = true;
47535 _toLoad = _toLoad.filter(function(val) {
47536 return val !== entity.id;
47538 if (!entity.visible)
47541 if (entity.type === "way") {
47542 for (i4 = 0; i4 < entity.nodes.length; i4++) {
47543 id2 = entity.nodes[i4];
47544 if (_loaded[id2] === void 0) {
47545 _loaded[id2] = false;
47546 loadMore.push(id2);
47549 } else if (entity.type === "relation" && entity.isMultipolygon()) {
47550 for (i4 = 0; i4 < entity.members.length; i4++) {
47551 id2 = entity.members[i4].id;
47552 if (_loaded[id2] === void 0) {
47553 _loaded[id2] = false;
47554 loadMore.push(id2);
47559 _toLoadCount += result.data.length;
47560 _toLoadTotal += loadMore.length;
47561 dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
47562 if (loadMore.length) {
47563 _toLoad.push.apply(_toLoad, loadMore);
47564 osm.loadMultiple(loadMore, loaded);
47566 if (!_toLoad.length) {
47572 function detectConflicts() {
47573 function choice(id2, text, action) {
47577 action: function() {
47578 history.replace(action);
47582 function formatUser(d2) {
47583 return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
47585 function entityName(entity) {
47586 return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
47588 function sameVersions(local, remote) {
47589 if (local.version !== remote.version)
47591 if (local.type === "way") {
47592 var children2 = utilArrayUnion(local.nodes, remote.nodes);
47593 for (var i4 = 0; i4 < children2.length; i4++) {
47594 var a2 = localGraph.hasEntity(children2[i4]);
47595 var b2 = remoteGraph.hasEntity(children2[i4]);
47596 if (a2 && b2 && a2.version !== b2.version)
47602 _toCheck.forEach(function(id2) {
47603 var local = localGraph.entity(id2);
47604 var remote = remoteGraph.entity(id2);
47605 if (sameVersions(local, remote))
47607 var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
47608 history.replace(merge2);
47609 var mergeConflicts = merge2.conflicts();
47610 if (!mergeConflicts.length)
47612 var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
47613 var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
47614 var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
47615 var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
47618 name: entityName(local),
47619 details: mergeConflicts,
47622 choice(id2, keepMine, forceLocal),
47623 choice(id2, keepTheirs, forceRemote)
47629 function upload(changeset) {
47630 var osm = context.connection();
47632 _errors.push({ msg: "No OSM Service" });
47634 if (_conflicts.length) {
47635 didResultInConflicts(changeset);
47636 } else if (_errors.length) {
47637 didResultInErrors();
47639 var history = context.history();
47640 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
47641 if (changes.modified.length || changes.created.length || changes.deleted.length) {
47642 dispatch14.call("willAttemptUpload", this);
47643 osm.putChangeset(changeset, changes, uploadCallback);
47645 didResultInNoChanges();
47649 function uploadCallback(err, changeset) {
47651 if (err.status === 409) {
47652 uploader.save(changeset, true, true);
47655 msg: err.message || err.responseText,
47656 details: [_t("save.status_code", { code: err.status })]
47658 didResultInErrors();
47661 didResultInSuccess(changeset);
47664 function didResultInNoChanges() {
47665 dispatch14.call("resultNoChanges", this);
47669 function didResultInErrors() {
47670 context.history().pop();
47671 dispatch14.call("resultErrors", this, _errors);
47674 function didResultInConflicts(changeset) {
47675 _conflicts.sort(function(a2, b2) {
47676 return b2.id.localeCompare(a2.id);
47678 dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
47681 function didResultInSuccess(changeset) {
47682 context.history().clearSaved();
47683 dispatch14.call("resultSuccess", this, changeset);
47684 window.setTimeout(function() {
47689 function endSave() {
47691 dispatch14.call("saveEnded", this);
47693 uploader.cancelConflictResolution = function() {
47694 context.history().pop();
47696 uploader.processResolvedConflicts = function(changeset) {
47697 var history = context.history();
47698 for (var i3 = 0; i3 < _conflicts.length; i3++) {
47699 if (_conflicts[i3].chosen === 1) {
47700 var entity = context.hasEntity(_conflicts[i3].id);
47701 if (entity && entity.type === "way") {
47702 var children2 = utilArrayUniq(entity.nodes);
47703 for (var j2 = 0; j2 < children2.length; j2++) {
47704 history.replace(actionRevert(children2[j2]));
47707 history.replace(actionRevert(_conflicts[i3].id));
47710 uploader.save(changeset, true, false);
47712 uploader.reset = function() {
47717 // modules/renderer/background_source.js
47718 var import_lodash4 = __toESM(require_lodash());
47720 // modules/util/IntervalTasksQueue.js
47721 var IntervalTasksQueue = class {
47723 * Interval in milliseconds inside which only 1 task can execute.
47724 * e.g. if interval is 200ms, and 5 async tasks are unqueued,
47725 * they will complete in ~1s if not cleared
47726 * @param {number} intervalInMs
47728 constructor(intervalInMs) {
47729 this.intervalInMs = intervalInMs;
47730 this.pendingHandles = [];
47734 let taskTimeout = this.time;
47735 this.time += this.intervalInMs;
47736 this.pendingHandles.push(setTimeout(() => {
47737 this.time -= this.intervalInMs;
47742 this.pendingHandles.forEach((timeoutHandle) => {
47743 clearTimeout(timeoutHandle);
47745 this.pendingHandles = [];
47750 // modules/renderer/background_source.js
47751 var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
47752 window.matchMedia("\n (-webkit-min-device-pixel-ratio: 2), /* Safari */\n (min-resolution: 2dppx), /* standard */\n (min-resolution: 192dpi) /* fallback */\n ").addListener(function() {
47753 isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
47755 function localeDateString(s2) {
47758 var options2 = { day: "numeric", month: "short", year: "numeric" };
47759 var d2 = new Date(s2);
47760 if (isNaN(d2.getTime()))
47762 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
47764 function vintageRange(vintage) {
47766 if (vintage.start || vintage.end) {
47767 s2 = vintage.start || "?";
47768 if (vintage.start !== vintage.end) {
47769 s2 += " - " + (vintage.end || "?");
47774 function rendererBackgroundSource(data) {
47775 var source = Object.assign({}, data);
47776 var _offset = [0, 0];
47777 var _name = source.name;
47778 var _description = source.description;
47779 var _best = !!source.best;
47780 var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
47781 source.tileSize = data.tileSize || 256;
47782 source.zoomExtent = data.zoomExtent || [0, 22];
47783 source.overzoom = data.overzoom !== false;
47784 source.offset = function(val) {
47785 if (!arguments.length)
47790 source.nudge = function(val, zoomlevel) {
47791 _offset[0] += val[0] / Math.pow(2, zoomlevel);
47792 _offset[1] += val[1] / Math.pow(2, zoomlevel);
47795 source.name = function() {
47796 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
47797 return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
47799 source.label = function() {
47800 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
47801 return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
47803 source.hasDescription = function() {
47804 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
47805 var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
47806 return descriptionText !== "";
47808 source.description = function() {
47809 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
47810 return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
47812 source.best = function() {
47815 source.area = function() {
47817 return Number.MAX_VALUE;
47818 var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
47819 return isNaN(area) ? 0 : area;
47821 source.imageryUsed = function() {
47822 return _name || source.id;
47824 source.template = function(val) {
47825 if (!arguments.length)
47827 if (source.id === "custom" || source.id === "Bing") {
47832 source.url = function(coord2) {
47833 var result = _template.replace(/#[\s\S]*/u, "");
47836 if (!source.type || source.id === "custom") {
47837 if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
47838 source.type = "wms";
47839 source.projection = "EPSG:3857";
47840 } else if (/\{(x|y)\}/.test(result)) {
47841 source.type = "tms";
47842 } else if (/\{u\}/.test(result)) {
47843 source.type = "bing";
47846 if (source.type === "wms") {
47847 var tileToProjectedCoords = function(x2, y2, z2) {
47848 var zoomSize = Math.pow(2, z2);
47849 var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
47850 var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
47851 switch (source.projection) {
47854 x: lon * 180 / Math.PI,
47855 y: lat * 180 / Math.PI
47858 var mercCoords = mercatorRaw(lon, lat);
47860 x: 2003750834e-2 / Math.PI * mercCoords[0],
47861 y: 2003750834e-2 / Math.PI * mercCoords[1]
47865 var tileSize = source.tileSize;
47866 var projection2 = source.projection;
47867 var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
47868 var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
47869 result = result.replace(/\{(\w+)\}/g, function(token, key) {
47875 return projection2;
47877 return projection2.replace(/^EPSG:/, "");
47879 if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
47880 /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
47881 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
47883 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
47897 } else if (source.type === "tms") {
47898 result = result.replace("{x}", coord2[0]).replace("{y}", coord2[1]).replace(/\{[t-]y\}/, Math.pow(2, coord2[2]) - coord2[1] - 1).replace(/\{z(oom)?\}/, coord2[2]).replace(/\{@2x\}|\{r\}/, isRetina ? "@2x" : "");
47899 } else if (source.type === "bing") {
47900 result = result.replace("{u}", function() {
47902 for (var zoom = coord2[2]; zoom > 0; zoom--) {
47904 var mask = 1 << zoom - 1;
47905 if ((coord2[0] & mask) !== 0)
47907 if ((coord2[1] & mask) !== 0)
47909 u2 += b2.toString();
47914 result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
47915 var subdomains = r2.split(",");
47916 return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
47920 source.validZoom = function(z2) {
47921 return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
47923 source.isLocatorOverlay = function() {
47924 return source.id === "mapbox_locator_overlay";
47926 source.isHidden = function() {
47927 return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
47929 source.copyrightNotices = function() {
47931 source.getMetadata = function(center, tileCoord, callback) {
47933 start: localeDateString(source.startDate),
47934 end: localeDateString(source.endDate)
47936 vintage.range = vintageRange(vintage);
47937 var metadata = { vintage };
47938 callback(null, metadata);
47942 rendererBackgroundSource.Bing = function(data, dispatch14) {
47943 data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
47944 var bing = rendererBackgroundSource(data);
47945 var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
47946 const strictParam = "n";
47947 var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
47950 var providers = [];
47951 var taskQueue = new IntervalTasksQueue(250);
47952 var metadataLastZoom = -1;
47953 json_default(url).then(function(json) {
47954 let imageryResource = json.resourceSets[0].resources[0];
47955 let template = imageryResource.imageUrl;
47956 let subDomains = imageryResource.imageUrlSubdomains;
47957 let subDomainNumbers = subDomains.map((subDomain) => {
47958 return subDomain.substring(1);
47960 template = template.replace("{subdomain}", "t{switch:".concat(subDomainNumbers, "}")).replace("{quadkey}", "{u}");
47961 if (!new URLSearchParams(template).has(strictParam)) {
47962 template += "&".concat(strictParam, "=z");
47964 bing.template(template);
47965 providers = imageryResource.imageryProviders.map(function(provider) {
47967 attribution: provider.attribution,
47968 areas: provider.coverageAreas.map(function(area) {
47970 zoom: [area.zoomMin, area.zoomMax],
47971 extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
47976 dispatch14.call("change");
47977 }).catch(function() {
47979 bing.copyrightNotices = function(zoom, extent) {
47980 zoom = Math.min(zoom, 21);
47981 return providers.filter(function(provider) {
47982 return provider.areas.some(function(area) {
47983 return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
47985 }).map(function(provider) {
47986 return provider.attribution;
47989 bing.getMetadata = function(center, tileCoord, callback) {
47990 var tileID = tileCoord.slice(0, 3).join("/");
47991 var zoom = Math.min(tileCoord[2], 21);
47992 var centerPoint = center[1] + "," + center[0];
47993 var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
47994 if (inflight[tileID])
47996 if (!cache[tileID]) {
47997 cache[tileID] = {};
47999 if (cache[tileID] && cache[tileID].metadata) {
48000 return callback(null, cache[tileID].metadata);
48002 inflight[tileID] = true;
48003 if (metadataLastZoom !== tileCoord[2]) {
48004 metadataLastZoom = tileCoord[2];
48007 taskQueue.enqueue(() => {
48008 json_default(url2).then(function(result) {
48009 delete inflight[tileID];
48011 throw new Error("Unknown Error");
48014 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
48015 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
48017 vintage.range = vintageRange(vintage);
48018 var metadata = { vintage };
48019 cache[tileID].metadata = metadata;
48021 callback(null, metadata);
48022 }).catch(function(err) {
48023 delete inflight[tileID];
48025 callback(err.message);
48029 bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
48032 rendererBackgroundSource.Esri = function(data) {
48033 if (data.template.match(/blankTile/) === null) {
48034 data.template = data.template + "?blankTile=false";
48036 var esri = rendererBackgroundSource(data);
48040 esri.fetchTilemap = function(center) {
48041 if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3)
48043 _prevCenter = center;
48045 var dummyUrl = esri.url([1, 2, 3]);
48046 var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
48047 var y2 = Math.floor((1 - Math.log(Math.tan(center[1] * Math.PI / 180) + 1 / Math.cos(center[1] * Math.PI / 180)) / Math.PI) / 2 * Math.pow(2, z2));
48048 var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
48049 json_default(tilemapUrl).then(function(tilemap) {
48051 throw new Error("Unknown Error");
48053 var hasTiles = true;
48054 for (var i3 = 0; i3 < tilemap.data.length; i3++) {
48055 if (!tilemap.data[i3]) {
48060 esri.zoomExtent[1] = hasTiles ? 22 : 19;
48061 }).catch(function() {
48064 esri.getMetadata = function(center, tileCoord, callback) {
48065 if (esri.id !== "EsriWorldImagery") {
48066 return callback(null, {});
48068 var tileID = tileCoord.slice(0, 3).join("/");
48069 var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
48070 var centerPoint = center[0] + "," + center[1];
48071 var unknown = _t("info_panels.background.unknown");
48074 if (inflight[tileID])
48076 var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
48077 url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
48078 if (!cache[tileID]) {
48079 cache[tileID] = {};
48081 if (cache[tileID] && cache[tileID].metadata) {
48082 return callback(null, cache[tileID].metadata);
48084 inflight[tileID] = true;
48085 json_default(url).then(function(result) {
48086 delete inflight[tileID];
48087 result = result.features.map((f2) => f2.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
48089 throw new Error("Unknown Error");
48090 } else if (result.features && result.features.length < 1) {
48091 throw new Error("No Results");
48092 } else if (result.error && result.error.message) {
48093 throw new Error(result.error.message);
48095 var captureDate = localeDateString(result.SRC_DATE2);
48097 start: captureDate,
48103 source: clean2(result.NICE_NAME),
48104 description: clean2(result.NICE_DESC),
48105 resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
48106 accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
48108 if (isFinite(metadata.resolution)) {
48109 metadata.resolution += " m";
48111 if (isFinite(metadata.accuracy)) {
48112 metadata.accuracy += " m";
48114 cache[tileID].metadata = metadata;
48116 callback(null, metadata);
48117 }).catch(function(err) {
48118 delete inflight[tileID];
48120 callback(err.message);
48122 function clean2(val) {
48123 return String(val).trim() || unknown;
48128 rendererBackgroundSource.None = function() {
48129 var source = rendererBackgroundSource({ id: "none", template: "" });
48130 source.name = function() {
48131 return _t("background.none");
48133 source.label = function() {
48134 return _t.append("background.none");
48136 source.imageryUsed = function() {
48139 source.area = function() {
48144 rendererBackgroundSource.Custom = function(template) {
48145 var source = rendererBackgroundSource({ id: "custom", template });
48146 source.name = function() {
48147 return _t("background.custom");
48149 source.label = function() {
48150 return _t.append("background.custom");
48152 source.imageryUsed = function() {
48153 var cleaned = source.template();
48154 if (cleaned.indexOf("?") !== -1) {
48155 var parts = cleaned.split("?", 2);
48156 var qs = utilStringQs(parts[1]);
48157 ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
48159 qs[param] = "{apikey}";
48162 cleaned = parts[0] + "?" + utilQsString(qs, true);
48164 cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
48165 return "Custom (" + cleaned + " )";
48167 source.area = function() {
48173 // node_modules/@turf/helpers/dist/es/index.js
48174 var earthRadius = 63710088e-1;
48176 centimeters: earthRadius * 100,
48177 centimetres: earthRadius * 100,
48178 degrees: earthRadius / 111325,
48179 feet: earthRadius * 3.28084,
48180 inches: earthRadius * 39.37,
48181 kilometers: earthRadius / 1e3,
48182 kilometres: earthRadius / 1e3,
48183 meters: earthRadius,
48184 metres: earthRadius,
48185 miles: earthRadius / 1609.344,
48186 millimeters: earthRadius * 1e3,
48187 millimetres: earthRadius * 1e3,
48188 nauticalmiles: earthRadius / 1852,
48190 yards: earthRadius * 1.0936
48192 var unitsFactors = {
48195 degrees: 1 / 111325,
48198 kilometers: 1 / 1e3,
48199 kilometres: 1 / 1e3,
48202 miles: 1 / 1609.344,
48205 nauticalmiles: 1 / 1852,
48206 radians: 1 / earthRadius,
48209 function feature2(geom, properties, options2) {
48210 if (options2 === void 0) {
48213 var feat = { type: "Feature" };
48214 if (options2.id === 0 || options2.id) {
48215 feat.id = options2.id;
48217 if (options2.bbox) {
48218 feat.bbox = options2.bbox;
48220 feat.properties = properties || {};
48221 feat.geometry = geom;
48224 function polygon(coordinates, properties, options2) {
48225 if (options2 === void 0) {
48228 for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
48229 var ring = coordinates_1[_i];
48230 if (ring.length < 4) {
48231 throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
48233 for (var j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
48234 if (ring[ring.length - 1][j2] !== ring[0][j2]) {
48235 throw new Error("First and last Position are not equivalent.");
48243 return feature2(geom, properties, options2);
48245 function lineString(coordinates, properties, options2) {
48246 if (options2 === void 0) {
48249 if (coordinates.length < 2) {
48250 throw new Error("coordinates must be an array of two or more positions");
48253 type: "LineString",
48256 return feature2(geom, properties, options2);
48258 function multiLineString(coordinates, properties, options2) {
48259 if (options2 === void 0) {
48263 type: "MultiLineString",
48266 return feature2(geom, properties, options2);
48268 function multiPolygon(coordinates, properties, options2) {
48269 if (options2 === void 0) {
48273 type: "MultiPolygon",
48276 return feature2(geom, properties, options2);
48279 // node_modules/@turf/invariant/dist/es/index.js
48280 function getGeom(geojson) {
48281 if (geojson.type === "Feature") {
48282 return geojson.geometry;
48287 // node_modules/@turf/bbox-clip/dist/es/lib/lineclip.js
48288 function lineclip(points, bbox2, result) {
48289 var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
48294 for (i3 = 1; i3 < len; i3++) {
48295 a2 = points[i3 - 1];
48297 codeB = lastCode = bitCode(b2, bbox2);
48299 if (!(codeA | codeB)) {
48301 if (codeB !== lastCode) {
48303 if (i3 < len - 1) {
48307 } else if (i3 === len - 1) {
48311 } else if (codeA & codeB) {
48313 } else if (codeA) {
48314 a2 = intersect(a2, b2, codeA, bbox2);
48315 codeA = bitCode(a2, bbox2);
48317 b2 = intersect(a2, b2, codeB, bbox2);
48318 codeB = bitCode(b2, bbox2);
48327 function polygonclip(points, bbox2) {
48328 var result, edge, prev, prevInside, i3, p2, inside;
48329 for (edge = 1; edge <= 8; edge *= 2) {
48331 prev = points[points.length - 1];
48332 prevInside = !(bitCode(prev, bbox2) & edge);
48333 for (i3 = 0; i3 < points.length; i3++) {
48335 inside = !(bitCode(p2, bbox2) & edge);
48336 if (inside !== prevInside)
48337 result.push(intersect(prev, p2, edge, bbox2));
48341 prevInside = inside;
48344 if (!points.length)
48349 function intersect(a2, b2, edge, bbox2) {
48350 return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : null;
48352 function bitCode(p2, bbox2) {
48354 if (p2[0] < bbox2[0])
48356 else if (p2[0] > bbox2[2])
48358 if (p2[1] < bbox2[1])
48360 else if (p2[1] > bbox2[3])
48365 // node_modules/@turf/bbox-clip/dist/es/index.js
48366 function bboxClip(feature3, bbox2) {
48367 var geom = getGeom(feature3);
48368 var type2 = geom.type;
48369 var properties = feature3.type === "Feature" ? feature3.properties : {};
48370 var coords = geom.coordinates;
48373 case "MultiLineString": {
48375 if (type2 === "LineString") {
48378 coords.forEach(function(line) {
48379 lineclip(line, bbox2, lines_1);
48381 if (lines_1.length === 1) {
48382 return lineString(lines_1[0], properties);
48384 return multiLineString(lines_1, properties);
48387 return polygon(clipPolygon(coords, bbox2), properties);
48388 case "MultiPolygon":
48389 return multiPolygon(coords.map(function(poly) {
48390 return clipPolygon(poly, bbox2);
48393 throw new Error("geometry " + type2 + " not supported");
48396 function clipPolygon(rings, bbox2) {
48398 for (var _i = 0, rings_1 = rings; _i < rings_1.length; _i++) {
48399 var ring = rings_1[_i];
48400 var clipped = polygonclip(ring, bbox2);
48401 if (clipped.length > 0) {
48402 if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
48403 clipped.push(clipped[0]);
48405 if (clipped.length >= 4) {
48406 outRings.push(clipped);
48413 // node_modules/@turf/meta/dist/es/index.js
48414 function coordEach(geojson, callback, excludeWrapCoord) {
48415 if (geojson === null)
48417 var j2, k2, l2, geometry, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
48418 for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
48419 geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
48420 isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
48421 stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
48422 for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
48423 var multiFeatureIndex = 0;
48424 var geometryIndex = 0;
48425 geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
48426 if (geometry === null)
48428 coords = geometry.coordinates;
48429 var geomType = geometry.type;
48430 wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
48431 switch (geomType) {
48444 multiFeatureIndex++;
48448 for (j2 = 0; j2 < coords.length; j2++) {
48458 if (geomType === "MultiPoint")
48459 multiFeatureIndex++;
48461 if (geomType === "LineString")
48462 multiFeatureIndex++;
48465 case "MultiLineString":
48466 for (j2 = 0; j2 < coords.length; j2++) {
48467 for (k2 = 0; k2 < coords[j2].length - wrapShrink; k2++) {
48478 if (geomType === "MultiLineString")
48479 multiFeatureIndex++;
48480 if (geomType === "Polygon")
48483 if (geomType === "Polygon")
48484 multiFeatureIndex++;
48486 case "MultiPolygon":
48487 for (j2 = 0; j2 < coords.length; j2++) {
48489 for (k2 = 0; k2 < coords[j2].length; k2++) {
48490 for (l2 = 0; l2 < coords[j2][k2].length - wrapShrink; l2++) {
48492 coords[j2][k2][l2],
48503 multiFeatureIndex++;
48506 case "GeometryCollection":
48507 for (j2 = 0; j2 < geometry.geometries.length; j2++)
48508 if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
48512 throw new Error("Unknown Geometry Type");
48518 // node_modules/@turf/bbox/dist/es/index.js
48519 function bbox(geojson) {
48520 var result = [Infinity, Infinity, -Infinity, -Infinity];
48521 coordEach(geojson, function(coord2) {
48522 if (result[0] > coord2[0]) {
48523 result[0] = coord2[0];
48525 if (result[1] > coord2[1]) {
48526 result[1] = coord2[1];
48528 if (result[2] < coord2[0]) {
48529 result[2] = coord2[0];
48531 if (result[3] < coord2[1]) {
48532 result[3] = coord2[1];
48537 bbox["default"] = bbox;
48538 var es_default = bbox;
48540 // modules/renderer/background.js
48541 var import_which_polygon3 = __toESM(require_which_polygon());
48543 // modules/renderer/tile_layer.js
48544 function rendererTileLayer(context) {
48545 var transformProp = utilPrefixCSSProperty("Transform");
48546 var tiler9 = utilTiler();
48547 var _tileSize = 256;
48553 function tileSizeAtZoom(d2, z2) {
48554 var EPSILON = 2e-3;
48555 return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
48557 function atZoom(t2, distance) {
48558 var power = Math.pow(2, distance);
48560 Math.floor(t2[0] * power),
48561 Math.floor(t2[1] * power),
48565 function lookUp(d2) {
48566 for (var up = -1; up > -d2[2]; up--) {
48567 var tile = atZoom(d2, up);
48568 if (_cache5[_source.url(tile)] !== false) {
48573 function uniqueBy(a2, n3) {
48576 for (var i3 = 0; i3 < a2.length; i3++) {
48577 if (seen[a2[i3][n3]] === void 0) {
48579 seen[a2[i3][n3]] = true;
48584 function addSource(d2) {
48585 d2.push(_source.url(d2));
48588 function background(selection2) {
48589 _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
48593 _source.offset()[0] * Math.pow(2, _zoom),
48594 _source.offset()[1] * Math.pow(2, _zoom)
48597 pixelOffset = [0, 0];
48600 _projection.translate()[0] + pixelOffset[0],
48601 _projection.translate()[1] + pixelOffset[1]
48603 tiler9.scale(_projection.scale() * 2 * Math.PI).translate(translate);
48605 _projection.scale() * Math.PI - translate[0],
48606 _projection.scale() * Math.PI - translate[1]
48608 render(selection2);
48610 function render(selection2) {
48614 var showDebug = context.getDebug("tile") && !_source.overlay;
48615 if (_source.validZoom(_zoom)) {
48616 tiler9.skipNullIsland(!!_source.overlay);
48617 tiler9().forEach(function(d2) {
48621 if (typeof d2[3] !== "string")
48624 if (_cache5[d2[3]] === false && lookUp(d2)) {
48625 requests.push(addSource(lookUp(d2)));
48628 requests = uniqueBy(requests, 3).filter(function(r2) {
48629 return _cache5[r2[3]] !== false;
48632 function load(d3_event, d2) {
48633 _cache5[d2[3]] = true;
48634 select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
48635 render(selection2);
48637 function error(d3_event, d2) {
48638 _cache5[d2[3]] = false;
48639 select_default2(this).on("error", null).on("load", null).remove();
48640 render(selection2);
48642 function imageTransform(d2) {
48643 var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
48644 var scale = tileSizeAtZoom(d2, _zoom);
48645 return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
48647 function tileCenter(d2) {
48648 var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
48650 d2[0] * ts - _tileOrigin[0] + ts / 2,
48651 d2[1] * ts - _tileOrigin[1] + ts / 2
48654 function debugTransform(d2) {
48655 var coord2 = tileCenter(d2);
48656 return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
48658 var dims = tiler9.size();
48659 var mapCenter = [dims[0] / 2, dims[1] / 2];
48660 var minDist = Math.max(dims[0], dims[1]);
48662 requests.forEach(function(d2) {
48663 var c2 = tileCenter(d2);
48664 var dist = geoVecLength(c2, mapCenter);
48665 if (dist < minDist) {
48670 var image = selection2.selectAll("img").data(requests, function(d2) {
48673 image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
48674 var tile = select_default2(this);
48675 window.setTimeout(function() {
48676 if (tile.classed("tile-removing")) {
48681 image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
48683 }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
48684 return d2 === nearCenter;
48686 var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
48689 debug2.exit().remove();
48691 var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
48692 debugEnter.append("div").attr("class", "tile-label-debug-coord");
48693 debugEnter.append("div").attr("class", "tile-label-debug-vintage");
48694 debug2 = debug2.merge(debugEnter);
48695 debug2.style(transformProp, debugTransform);
48696 debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
48697 return d2[2] + " / " + d2[0] + " / " + d2[1];
48699 debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
48700 var span = select_default2(this);
48701 var center = context.projection.invert(tileCenter(d2));
48702 _source.getMetadata(center, d2, function(err, result) {
48703 if (result && result.vintage && result.vintage.range) {
48704 span.text(result.vintage.range);
48707 span.call(_t.append("info_panels.background.vintage"));
48708 span.append("span").text(": ");
48709 span.call(_t.append("info_panels.background.unknown"));
48715 background.projection = function(val) {
48716 if (!arguments.length)
48717 return _projection;
48721 background.dimensions = function(val) {
48722 if (!arguments.length)
48723 return tiler9.size();
48727 background.source = function(val) {
48728 if (!arguments.length)
48731 _tileSize = _source.tileSize;
48733 tiler9.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
48739 // modules/renderer/background.js
48740 var _imageryIndex = null;
48741 function rendererBackground(context) {
48742 const dispatch14 = dispatch_default("change");
48743 const baseLayer = rendererTileLayer(context).projection(context.projection);
48744 let _checkedBlocklists = [];
48745 let _isValid = true;
48746 let _overlayLayers = [];
48747 let _brightness = 1;
48749 let _saturation = 1;
48750 let _sharpness = 1;
48751 function ensureImageryIndex() {
48752 return _mainFileFetcher.get("imagery").then((sources) => {
48754 return _imageryIndex;
48759 const features = sources.map((source) => {
48760 if (!source.polygon)
48762 const rings = source.polygon.map((ring) => [ring]);
48765 properties: { id: source.id },
48766 geometry: { type: "MultiPolygon", coordinates: rings }
48768 _imageryIndex.features[source.id] = feature3;
48770 }).filter(Boolean);
48771 _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
48772 _imageryIndex.backgrounds = sources.map((source) => {
48773 if (source.type === "bing") {
48774 return rendererBackgroundSource.Bing(source, dispatch14);
48775 } else if (/^EsriWorldImagery/.test(source.id)) {
48776 return rendererBackgroundSource.Esri(source);
48778 return rendererBackgroundSource(source);
48781 _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
48782 let template = corePreferences("background-custom-template") || "";
48783 const custom = rendererBackgroundSource.Custom(template);
48784 _imageryIndex.backgrounds.unshift(custom);
48785 return _imageryIndex;
48788 function background(selection2) {
48789 const currSource = baseLayer.source();
48790 if (context.map().zoom() > 18) {
48791 if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
48792 const center = context.map().center();
48793 currSource.fetchTilemap(center);
48796 const sources = background.sources(context.map().extent());
48797 const wasValid = _isValid;
48798 _isValid = !!sources.filter((d2) => d2 === currSource).length;
48799 if (wasValid !== _isValid) {
48800 background.updateImagery();
48802 let baseFilter = "";
48803 if (_brightness !== 1) {
48804 baseFilter += " brightness(".concat(_brightness, ")");
48806 if (_contrast !== 1) {
48807 baseFilter += " contrast(".concat(_contrast, ")");
48809 if (_saturation !== 1) {
48810 baseFilter += " saturate(".concat(_saturation, ")");
48812 if (_sharpness < 1) {
48813 const blur = number_default(0.5, 5)(1 - _sharpness);
48814 baseFilter += " blur(".concat(blur, "px)");
48816 let base = selection2.selectAll(".layer-background").data([0]);
48817 base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
48818 base.style("filter", baseFilter || null);
48819 let imagery = base.selectAll(".layer-imagery").data([0]);
48820 imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
48821 let maskFilter = "";
48822 let mixBlendMode = "";
48823 if (_sharpness > 1) {
48824 mixBlendMode = "overlay";
48825 maskFilter = "saturate(0) blur(3px) invert(1)";
48826 let contrast = _sharpness - 1;
48827 maskFilter += " contrast(".concat(contrast, ")");
48828 let brightness = number_default(1, 0.85)(_sharpness - 1);
48829 maskFilter += " brightness(".concat(brightness, ")");
48831 let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
48832 mask.exit().remove();
48833 mask.enter().append("div").attr("class", "layer layer-mask layer-unsharp-mask").merge(mask).call(baseLayer).style("filter", maskFilter || null).style("mix-blend-mode", mixBlendMode || null);
48834 let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
48835 overlays.exit().remove();
48836 overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
48838 background.updateImagery = function() {
48839 let currSource = baseLayer.source();
48840 if (context.inIntro() || !currSource)
48842 let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
48843 const meters = geoOffsetToMeters(currSource.offset());
48844 const EPSILON = 0.01;
48845 const x2 = +meters[0].toFixed(2);
48846 const y2 = +meters[1].toFixed(2);
48847 let hash = utilStringQs(window.location.hash);
48848 let id2 = currSource.id;
48849 if (id2 === "custom") {
48850 id2 = "custom:".concat(currSource.template());
48853 hash.background = id2;
48855 delete hash.background;
48858 hash.overlays = o2;
48860 delete hash.overlays;
48862 if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
48863 hash.offset = "".concat(x2, ",").concat(y2);
48865 delete hash.offset;
48867 if (!window.mocha) {
48868 window.location.replace("#" + utilQsString(hash, true));
48870 let imageryUsed = [];
48871 let photoOverlaysUsed = [];
48872 const currUsed = currSource.imageryUsed();
48873 if (currUsed && _isValid) {
48874 imageryUsed.push(currUsed);
48876 _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
48877 const dataLayer = context.layers().layer("data");
48878 if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
48879 imageryUsed.push(dataLayer.getSrc());
48881 const photoOverlayLayers = {
48882 streetside: "Bing Streetside",
48883 mapillary: "Mapillary Images",
48884 "mapillary-map-features": "Mapillary Map Features",
48885 "mapillary-signs": "Mapillary Signs",
48886 kartaview: "KartaView Images",
48887 vegbilder: "Norwegian Road Administration Images",
48888 mapilio: "Mapilio Images"
48890 for (let layerID in photoOverlayLayers) {
48891 const layer = context.layers().layer(layerID);
48892 if (layer && layer.enabled()) {
48893 photoOverlaysUsed.push(layerID);
48894 imageryUsed.push(photoOverlayLayers[layerID]);
48897 context.history().imageryUsed(imageryUsed);
48898 context.history().photoOverlaysUsed(photoOverlaysUsed);
48900 background.sources = (extent, zoom, includeCurrent) => {
48901 if (!_imageryIndex)
48904 (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
48905 const currSource = baseLayer.source();
48906 const osm = context.connection();
48907 const blocklists = osm && osm.imageryBlocklists() || [];
48908 const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
48909 if (blocklistChanged) {
48910 _imageryIndex.backgrounds.forEach((source) => {
48911 source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
48913 _checkedBlocklists = blocklists.map((regex) => String(regex));
48915 return _imageryIndex.backgrounds.filter((source) => {
48916 if (includeCurrent && currSource === source)
48918 if (source.isBlocked)
48920 if (!source.polygon)
48922 if (zoom && zoom < 6)
48924 return visible[source.id];
48927 background.dimensions = (val) => {
48930 baseLayer.dimensions(val);
48931 _overlayLayers.forEach((layer) => layer.dimensions(val));
48933 background.baseLayerSource = function(d2) {
48934 if (!arguments.length)
48935 return baseLayer.source();
48936 const osm = context.connection();
48939 const blocklists = osm.imageryBlocklists();
48940 const template = d2.template();
48944 for (let i3 = 0; i3 < blocklists.length; i3++) {
48945 regex = blocklists[i3];
48946 fail = regex.test(template);
48952 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
48953 fail = regex.test(template);
48955 baseLayer.source(!fail ? d2 : background.findSource("none"));
48956 dispatch14.call("change");
48957 background.updateImagery();
48960 background.findSource = (id2) => {
48961 if (!id2 || !_imageryIndex)
48963 return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
48965 background.bing = () => {
48966 background.baseLayerSource(background.findSource("Bing"));
48968 background.showsLayer = (d2) => {
48969 const currSource = baseLayer.source();
48970 if (!d2 || !currSource)
48972 return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
48974 background.overlayLayerSources = () => {
48975 return _overlayLayers.map((layer) => layer.source());
48977 background.toggleOverlayLayer = (d2) => {
48979 for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
48980 layer = _overlayLayers[i3];
48981 if (layer.source() === d2) {
48982 _overlayLayers.splice(i3, 1);
48983 dispatch14.call("change");
48984 background.updateImagery();
48988 layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
48989 baseLayer.dimensions()
48991 _overlayLayers.push(layer);
48992 dispatch14.call("change");
48993 background.updateImagery();
48995 background.nudge = (d2, zoom) => {
48996 const currSource = baseLayer.source();
48998 currSource.nudge(d2, zoom);
48999 dispatch14.call("change");
49000 background.updateImagery();
49004 background.offset = function(d2) {
49005 const currSource = baseLayer.source();
49006 if (!arguments.length) {
49007 return currSource && currSource.offset() || [0, 0];
49010 currSource.offset(d2);
49011 dispatch14.call("change");
49012 background.updateImagery();
49016 background.brightness = function(d2) {
49017 if (!arguments.length)
49018 return _brightness;
49020 if (context.mode())
49021 dispatch14.call("change");
49024 background.contrast = function(d2) {
49025 if (!arguments.length)
49028 if (context.mode())
49029 dispatch14.call("change");
49032 background.saturation = function(d2) {
49033 if (!arguments.length)
49034 return _saturation;
49036 if (context.mode())
49037 dispatch14.call("change");
49040 background.sharpness = function(d2) {
49041 if (!arguments.length)
49044 if (context.mode())
49045 dispatch14.call("change");
49049 background.ensureLoaded = () => {
49051 return _loadPromise;
49052 return _loadPromise = ensureImageryIndex();
49054 background.init = () => {
49055 const loadPromise = background.ensureLoaded();
49056 const hash = utilStringQs(window.location.hash);
49057 const requestedBackground = hash.background || hash.layer;
49058 const lastUsedBackground = corePreferences("background-last-used");
49059 return loadPromise.then((imageryIndex) => {
49060 const extent = context.map().extent();
49061 const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
49062 const first = validBackgrounds.length && validBackgrounds[0];
49063 const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
49065 if (!requestedBackground && extent) {
49066 const viewArea = extent.area();
49067 best = validBackgrounds.find((s2) => {
49068 if (!s2.best() || s2.overlay)
49070 let bbox2 = es_default(bboxClip(
49071 { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
49074 let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
49075 return area / viewArea > 0.5;
49078 if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
49079 const template = requestedBackground.replace(/^custom:/, "");
49080 const custom = background.findSource("custom");
49081 background.baseLayerSource(custom.template(template));
49082 corePreferences("background-custom-template", template);
49084 background.baseLayerSource(
49085 background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
49088 const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
49090 background.toggleOverlayLayer(locator);
49092 const overlays = (hash.overlays || "").split(",");
49093 overlays.forEach((overlay) => {
49094 overlay = background.findSource(overlay);
49096 background.toggleOverlayLayer(overlay);
49100 const gpx2 = context.layers().layer("data");
49102 gpx2.url(hash.gpx, ".gpx");
49106 const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
49107 if (offset.length === 2) {
49108 background.offset(geoMetersToOffset(offset));
49111 }).catch((err) => {
49112 console.error(err);
49115 return utilRebind(background, dispatch14, "on");
49118 // modules/renderer/features.js
49119 function rendererFeatures(context) {
49120 var dispatch14 = dispatch_default("change", "redraw");
49121 var features = utilRebind({}, dispatch14, "on");
49122 var _deferred2 = /* @__PURE__ */ new Set();
49123 var traffic_roads = {
49125 "motorway_link": true,
49127 "trunk_link": true,
49129 "primary_link": true,
49131 "secondary_link": true,
49133 "tertiary_link": true,
49134 "residential": true,
49135 "unclassified": true,
49136 "living_street": true,
49139 var service_roads = {
49152 var _cullFactor = 1;
49158 var _forceVisible = {};
49159 function update() {
49160 if (!window.mocha) {
49161 var hash = utilStringQs(window.location.hash);
49162 var disabled = features.disabled();
49163 if (disabled.length) {
49164 hash.disable_features = disabled.join(",");
49166 delete hash.disable_features;
49168 window.location.replace("#" + utilQsString(hash, true));
49169 corePreferences("disabled-features", disabled.join(","));
49171 _hidden = features.hidden();
49172 dispatch14.call("change");
49173 dispatch14.call("redraw");
49175 function defineRule(k2, filter2, max3) {
49176 var isEnabled = true;
49180 enabled: isEnabled,
49181 // whether the user wants it enabled..
49183 currentMax: max3 || Infinity,
49184 defaultMax: max3 || Infinity,
49185 enable: function() {
49186 this.enabled = true;
49187 this.currentMax = this.defaultMax;
49189 disable: function() {
49190 this.enabled = false;
49191 this.currentMax = 0;
49193 hidden: function() {
49194 return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
49196 autoHidden: function() {
49197 return this.hidden() && this.currentMax > 0;
49201 defineRule("points", function isPoint(tags, geometry) {
49202 return geometry === "point";
49204 defineRule("traffic_roads", function isTrafficRoad(tags) {
49205 return traffic_roads[tags.highway];
49207 defineRule("service_roads", function isServiceRoad(tags) {
49208 return service_roads[tags.highway];
49210 defineRule("paths", function isPath(tags) {
49211 return paths[tags.highway];
49213 defineRule("buildings", function isBuilding(tags) {
49214 return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
49216 defineRule("building_parts", function isBuildingPart(tags) {
49217 return tags["building:part"];
49219 defineRule("indoor", function isIndoor(tags) {
49220 return tags.indoor;
49222 defineRule("landuse", function isLanduse(tags, geometry) {
49223 return geometry === "area" && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
49225 defineRule("boundaries", function isBoundary(tags, geometry) {
49226 return (geometry === "line" && !!tags.boundary || geometry === "relation" && tags.type === "boundary") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway] || tags.waterway || tags.railway || tags.landuse || tags.natural || tags.building || tags.power);
49228 defineRule("water", function isWater(tags) {
49229 return !!tags.waterway || tags.natural === "water" || tags.natural === "coastline" || tags.natural === "bay" || tags.landuse === "pond" || tags.landuse === "basin" || tags.landuse === "reservoir" || tags.landuse === "salt_pond";
49231 defineRule("rail", function isRail(tags) {
49232 return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
49234 defineRule("pistes", function isPiste(tags) {
49235 return tags["piste:type"];
49237 defineRule("aerialways", function isPiste(tags) {
49238 return tags.aerialway && tags.aerialway !== "yes" && tags.aerialway !== "station";
49240 defineRule("power", function isPower(tags) {
49241 return !!tags.power;
49243 defineRule("past_future", function isPastFuture(tags) {
49244 if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
49247 var strings = Object.keys(tags);
49248 for (var i3 = 0; i3 < strings.length; i3++) {
49249 var s2 = strings[i3];
49250 if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[s2]])
49255 defineRule("others", function isOther(tags, geometry) {
49256 return geometry === "line" || geometry === "area";
49258 features.features = function() {
49261 features.keys = function() {
49264 features.enabled = function(k2) {
49265 if (!arguments.length) {
49266 return _keys.filter(function(k3) {
49267 return _rules[k3].enabled;
49270 return _rules[k2] && _rules[k2].enabled;
49272 features.disabled = function(k2) {
49273 if (!arguments.length) {
49274 return _keys.filter(function(k3) {
49275 return !_rules[k3].enabled;
49278 return _rules[k2] && !_rules[k2].enabled;
49280 features.hidden = function(k2) {
49281 if (!arguments.length) {
49282 return _keys.filter(function(k3) {
49283 return _rules[k3].hidden();
49286 return _rules[k2] && _rules[k2].hidden();
49288 features.autoHidden = function(k2) {
49289 if (!arguments.length) {
49290 return _keys.filter(function(k3) {
49291 return _rules[k3].autoHidden();
49294 return _rules[k2] && _rules[k2].autoHidden();
49296 features.enable = function(k2) {
49297 if (_rules[k2] && !_rules[k2].enabled) {
49298 _rules[k2].enable();
49302 features.enableAll = function() {
49303 var didEnable = false;
49304 for (var k2 in _rules) {
49305 if (!_rules[k2].enabled) {
49307 _rules[k2].enable();
49313 features.disable = function(k2) {
49314 if (_rules[k2] && _rules[k2].enabled) {
49315 _rules[k2].disable();
49319 features.disableAll = function() {
49320 var didDisable = false;
49321 for (var k2 in _rules) {
49322 if (_rules[k2].enabled) {
49324 _rules[k2].disable();
49330 features.toggle = function(k2) {
49333 return f2.enabled ? f2.disable() : f2.enable();
49338 features.resetStats = function() {
49339 for (var i3 = 0; i3 < _keys.length; i3++) {
49340 _rules[_keys[i3]].count = 0;
49342 dispatch14.call("change");
49344 features.gatherStats = function(d2, resolver, dimensions) {
49345 var needsRedraw = false;
49346 var types = utilArrayGroupBy(d2, "type");
49347 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
49348 var currHidden, geometry, matches, i3, j2;
49349 for (i3 = 0; i3 < _keys.length; i3++) {
49350 _rules[_keys[i3]].count = 0;
49352 _cullFactor = dimensions[0] * dimensions[1] / 1e6;
49353 for (i3 = 0; i3 < entities.length; i3++) {
49354 geometry = entities[i3].geometry(resolver);
49355 matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
49356 for (j2 = 0; j2 < matches.length; j2++) {
49357 _rules[matches[j2]].count++;
49360 currHidden = features.hidden();
49361 if (currHidden !== _hidden) {
49362 _hidden = currHidden;
49363 needsRedraw = true;
49364 dispatch14.call("change");
49366 return needsRedraw;
49368 features.stats = function() {
49369 for (var i3 = 0; i3 < _keys.length; i3++) {
49370 _stats[_keys[i3]] = _rules[_keys[i3]].count;
49374 features.clear = function(d2) {
49375 for (var i3 = 0; i3 < d2.length; i3++) {
49376 features.clearEntity(d2[i3]);
49379 features.clearEntity = function(entity) {
49380 delete _cache5[osmEntity.key(entity)];
49382 features.reset = function() {
49383 Array.from(_deferred2).forEach(function(handle) {
49384 window.cancelIdleCallback(handle);
49385 _deferred2.delete(handle);
49389 function relationShouldBeChecked(relation) {
49390 return relation.tags.type === "boundary";
49392 features.getMatches = function(entity, resolver, geometry) {
49393 if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity))
49395 var ent = osmEntity.key(entity);
49396 if (!_cache5[ent]) {
49399 if (!_cache5[ent].matches) {
49401 var hasMatch = false;
49402 for (var i3 = 0; i3 < _keys.length; i3++) {
49403 if (_keys[i3] === "others") {
49406 if (entity.type === "way") {
49407 var parents = features.getParents(entity, resolver, geometry);
49408 if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
49409 parents.length > 0 && parents.every(function(parent) {
49410 return parent.tags.type === "boundary";
49412 var pkey = osmEntity.key(parents[0]);
49413 if (_cache5[pkey] && _cache5[pkey].matches) {
49414 matches = Object.assign({}, _cache5[pkey].matches);
49420 if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
49421 matches[_keys[i3]] = hasMatch = true;
49424 _cache5[ent].matches = matches;
49426 return _cache5[ent].matches;
49428 features.getParents = function(entity, resolver, geometry) {
49429 if (geometry === "point")
49431 var ent = osmEntity.key(entity);
49432 if (!_cache5[ent]) {
49435 if (!_cache5[ent].parents) {
49437 if (geometry === "vertex") {
49438 parents = resolver.parentWays(entity);
49440 parents = resolver.parentRelations(entity);
49442 _cache5[ent].parents = parents;
49444 return _cache5[ent].parents;
49446 features.isHiddenPreset = function(preset, geometry) {
49447 if (!_hidden.length)
49451 var test = preset.setTags({}, geometry);
49452 for (var key in _rules) {
49453 if (_rules[key].filter(test, geometry)) {
49454 if (_hidden.indexOf(key) !== -1) {
49462 features.isHiddenFeature = function(entity, resolver, geometry) {
49463 if (!_hidden.length)
49465 if (!entity.version)
49467 if (_forceVisible[entity.id])
49469 var matches = Object.keys(features.getMatches(entity, resolver, geometry));
49470 return matches.length && matches.every(function(k2) {
49471 return features.hidden(k2);
49474 features.isHiddenChild = function(entity, resolver, geometry) {
49475 if (!_hidden.length)
49477 if (!entity.version || geometry === "point")
49479 if (_forceVisible[entity.id])
49481 var parents = features.getParents(entity, resolver, geometry);
49482 if (!parents.length)
49484 for (var i3 = 0; i3 < parents.length; i3++) {
49485 if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
49491 features.hasHiddenConnections = function(entity, resolver) {
49492 if (!_hidden.length)
49494 var childNodes, connections;
49495 if (entity.type === "midpoint") {
49496 childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
49499 childNodes = entity.nodes ? resolver.childNodes(entity) : [];
49500 connections = features.getParents(entity, resolver, entity.geometry(resolver));
49502 connections = childNodes.reduce(function(result, e3) {
49503 return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
49505 return connections.some(function(e3) {
49506 return features.isHidden(e3, resolver, e3.geometry(resolver));
49509 features.isHidden = function(entity, resolver, geometry) {
49510 if (!_hidden.length)
49512 if (!entity.version)
49514 var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
49515 return fn(entity, resolver, geometry);
49517 features.filter = function(d2, resolver) {
49518 if (!_hidden.length)
49521 for (var i3 = 0; i3 < d2.length; i3++) {
49522 var entity = d2[i3];
49523 if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
49524 result.push(entity);
49529 features.forceVisible = function(entityIDs) {
49530 if (!arguments.length)
49531 return Object.keys(_forceVisible);
49532 _forceVisible = {};
49533 for (var i3 = 0; i3 < entityIDs.length; i3++) {
49534 _forceVisible[entityIDs[i3]] = true;
49535 var entity = context.hasEntity(entityIDs[i3]);
49536 if (entity && entity.type === "relation") {
49537 for (var j2 in entity.members) {
49538 _forceVisible[entity.members[j2].id] = true;
49544 features.init = function() {
49545 var storage = corePreferences("disabled-features");
49547 var storageDisabled = storage.replace(/;/g, ",").split(",");
49548 storageDisabled.forEach(features.disable);
49550 var hash = utilStringQs(window.location.hash);
49551 if (hash.disable_features) {
49552 var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
49553 hashDisabled.forEach(features.disable);
49556 context.history().on("merge.features", function(newEntities) {
49559 var handle = window.requestIdleCallback(function() {
49560 var graph = context.graph();
49561 var types = utilArrayGroupBy(newEntities, "type");
49562 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
49563 for (var i3 = 0; i3 < entities.length; i3++) {
49564 var geometry = entities[i3].geometry(graph);
49565 features.getMatches(entities[i3], graph, geometry);
49568 _deferred2.add(handle);
49573 // modules/svg/areas.js
49574 var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
49576 // modules/svg/helpers.js
49577 function svgPassiveVertex(node, graph, activeID) {
49580 if (activeID === node.id)
49582 var parents = graph.parentWays(node);
49583 var i3, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
49584 for (i3 = 0; i3 < parents.length; i3++) {
49585 nodes = parents[i3].nodes;
49586 isClosed = parents[i3].isClosed();
49587 for (j2 = 0; j2 < nodes.length; j2++) {
49588 if (nodes[j2] === node.id) {
49594 max3 = nodes.length - 1;
49604 if (nodes[ix1] === activeID)
49606 else if (nodes[ix2] === activeID)
49608 else if (nodes[ix3] === activeID)
49610 else if (nodes[ix4] === activeID)
49612 else if (isClosed && nodes.indexOf(activeID) !== -1)
49619 function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
49620 return function(entity) {
49624 var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
49625 var coordinates = graph.childNodes(entity).map(function(n3) {
49629 if (shouldReverse(entity)) {
49630 coordinates.reverse();
49633 type: "LineString",
49635 }, projection2.stream(clip({
49636 lineStart: function() {
49638 lineEnd: function() {
49641 point: function(x2, y2) {
49644 var span = geoVecLength(a2, b2) - offset;
49646 var heading2 = geoVecAngle(a2, b2);
49647 var dx = dt2 * Math.cos(heading2);
49648 var dy = dt2 * Math.sin(heading2);
49650 a2[0] + offset * Math.cos(heading2),
49651 a2[1] + offset * Math.sin(heading2)
49653 var coord2 = [a2, p2];
49654 for (span -= dt2; span >= 0; span -= dt2) {
49655 p2 = geoVecAdd(p2, [dx, dy]);
49661 for (j2 = 0; j2 < coord2.length; j2++) {
49662 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
49664 segments.push({ id: entity.id, index: i3++, d: segment });
49665 if (bothDirections(entity)) {
49667 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
49668 segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
49670 segments.push({ id: entity.id, index: i3++, d: segment });
49681 function svgPath(projection2, graph, isArea) {
49683 var padding = isArea ? 65 : 5;
49684 var viewport = projection2.clipExtent();
49685 var paddedExtent = [
49686 [viewport[0][0] - padding, viewport[0][1] - padding],
49687 [viewport[1][0] + padding, viewport[1][1] + padding]
49689 var clip = identity_default2().clipExtent(paddedExtent).stream;
49690 var project = projection2.stream;
49691 var path = path_default().projection({ stream: function(output) {
49692 return project(clip(output));
49694 var svgpath = function(entity) {
49695 if (entity.id in cache) {
49696 return cache[entity.id];
49698 return cache[entity.id] = path(entity.asGeoJSON(graph));
49701 svgpath.geojson = function(d2) {
49702 if (d2.__featurehash__ !== void 0) {
49703 if (d2.__featurehash__ in cache) {
49704 return cache[d2.__featurehash__];
49706 return cache[d2.__featurehash__] = path(d2);
49714 function svgPointTransform(projection2) {
49715 var svgpoint = function(entity) {
49716 var pt2 = projection2(entity.loc);
49717 return "translate(" + pt2[0] + "," + pt2[1] + ")";
49719 svgpoint.geojson = function(d2) {
49720 return svgpoint(d2.properties.entity);
49724 function svgRelationMemberTags(graph) {
49725 return function(entity) {
49726 var tags = entity.tags;
49727 var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
49728 graph.parentRelations(entity).forEach(function(relation) {
49729 var type2 = relation.tags.type;
49730 if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
49731 tags = Object.assign({}, relation.tags, tags);
49737 function svgSegmentWay(way, graph, activeID) {
49738 if (activeID === void 0) {
49739 return graph.transient(way, "waySegments", getWaySegments);
49741 return getWaySegments();
49743 function getWaySegments() {
49744 var isActiveWay = way.nodes.indexOf(activeID) !== -1;
49745 var features = { passive: [], active: [] };
49749 for (var i3 = 0; i3 < way.nodes.length; i3++) {
49750 node = graph.entity(way.nodes[i3]);
49751 type2 = svgPassiveVertex(node, graph, activeID);
49752 end = { node, type: type2 };
49753 if (start2.type !== void 0) {
49754 if (start2.node.id === activeID || end.node.id === activeID) {
49755 } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
49756 pushActive(start2, end, i3);
49757 } else if (start2.type === 0 && end.type === 0) {
49758 pushActive(start2, end, i3);
49760 pushPassive(start2, end, i3);
49766 function pushActive(start3, end2, index) {
49767 features.active.push({
49769 id: way.id + "-" + index + "-nope",
49774 nodes: [start3.node, end2.node],
49778 type: "LineString",
49779 coordinates: [start3.node.loc, end2.node.loc]
49783 function pushPassive(start3, end2, index) {
49784 features.passive.push({
49786 id: way.id + "-" + index,
49790 nodes: [start3.node, end2.node],
49794 type: "LineString",
49795 coordinates: [start3.node.loc, end2.node.loc]
49802 // modules/svg/tag_classes.js
49803 function svgTagClasses() {
49827 var statuses = Object.keys(osmLifecyclePrefixes);
49828 var secondaries = [
49841 "public_transport",
49852 var _tags = function(entity) {
49853 return entity.tags;
49855 var tagClasses = function(selection2) {
49856 selection2.each(function tagClassesEach(entity) {
49857 var value = this.className;
49858 if (value.baseVal !== void 0) {
49859 value = value.baseVal;
49861 var t2 = _tags(entity);
49862 var computed = tagClasses.getClassesString(t2, value);
49863 if (computed !== value) {
49864 select_default2(this).attr("class", computed);
49868 tagClasses.getClassesString = function(t2, value) {
49869 var primary, status;
49870 var i3, j2, k2, v2;
49871 var overrideGeometry;
49872 if (/\bstroke\b/.test(value)) {
49873 if (!!t2.barrier && t2.barrier !== "no") {
49874 overrideGeometry = "line";
49877 var classes = value.trim().split(/\s+/).filter(function(klass) {
49878 return klass.length && !/^tag-/.test(klass);
49879 }).map(function(klass) {
49880 return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
49882 for (i3 = 0; i3 < primaries.length; i3++) {
49883 k2 = primaries[i3];
49885 if (!v2 || v2 === "no")
49887 if (k2 === "piste:type") {
49889 } else if (k2 === "building:part") {
49890 k2 = "building_part";
49893 if (statuses.indexOf(v2) !== -1) {
49895 classes.push("tag-" + k2);
49897 classes.push("tag-" + k2);
49898 classes.push("tag-" + k2 + "-" + v2);
49903 for (i3 = 0; i3 < statuses.length; i3++) {
49904 for (j2 = 0; j2 < primaries.length; j2++) {
49905 k2 = statuses[i3] + ":" + primaries[j2];
49907 if (!v2 || v2 === "no")
49909 status = statuses[i3];
49915 for (i3 = 0; i3 < statuses.length; i3++) {
49918 if (!v2 || v2 === "no")
49920 if (v2 === "yes") {
49922 } else if (primary && primary === v2) {
49924 } else if (!primary && primaries.indexOf(v2) !== -1) {
49927 classes.push("tag-" + v2);
49934 classes.push("tag-status");
49935 classes.push("tag-status-" + status);
49937 for (i3 = 0; i3 < secondaries.length; i3++) {
49938 k2 = secondaries[i3];
49940 if (!v2 || v2 === "no" || k2 === primary)
49942 classes.push("tag-" + k2);
49943 classes.push("tag-" + k2 + "-" + v2);
49945 if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
49946 var surface = t2.highway === "track" ? "unpaved" : "paved";
49949 if (k2 in osmPavedTags) {
49950 surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
49952 if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
49953 surface = "semipaved";
49956 classes.push("tag-" + surface);
49958 var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
49960 classes.push("tag-wikidata");
49962 return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
49964 tagClasses.tags = function(val) {
49965 if (!arguments.length)
49973 // modules/svg/tag_pattern.js
49975 // tag - pattern name
49977 // tag - value - pattern name
49979 // tag - value - rules (optional tag-values, pattern name)
49980 // (matches earlier rules first, so fallback should be last entry)
49982 grave_yard: "cemetery",
49983 fountain: "water_standing"
49987 { religion: "christian", pattern: "cemetery_christian" },
49988 { religion: "buddhist", pattern: "cemetery_buddhist" },
49989 { religion: "muslim", pattern: "cemetery_muslim" },
49990 { religion: "jewish", pattern: "cemetery_jewish" },
49991 { pattern: "cemetery" }
49993 construction: "construction",
49994 farmland: "farmland",
49995 farmyard: "farmyard",
49997 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
49998 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
49999 { leaf_type: "leafless", pattern: "forest_leafless" },
50000 { pattern: "forest" }
50001 // same as 'leaf_type:mixed'
50003 grave_yard: "cemetery",
50005 landfill: "landfill",
50007 military: "construction",
50008 orchard: "orchard",
50010 vineyard: "vineyard"
50013 horse_riding: "farmyard"
50017 grassland: "grass",
50021 { water: "pond", pattern: "pond" },
50022 { water: "reservoir", pattern: "water_standing" },
50023 { pattern: "waves" }
50026 { wetland: "marsh", pattern: "wetland_marsh" },
50027 { wetland: "swamp", pattern: "wetland_swamp" },
50028 { wetland: "bog", pattern: "wetland_bog" },
50029 { wetland: "reedbed", pattern: "wetland_reedbed" },
50030 { pattern: "wetland" }
50033 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
50034 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
50035 { leaf_type: "leafless", pattern: "forest_leafless" },
50036 { pattern: "forest" }
50037 // same as 'leaf_type:mixed'
50041 green: "golf_green",
50051 function svgTagPattern(tags) {
50052 if (tags.building && tags.building !== "no") {
50055 for (var tag2 in patterns) {
50056 var entityValue = tags[tag2];
50059 if (typeof patterns[tag2] === "string") {
50060 return "pattern-" + patterns[tag2];
50062 var values = patterns[tag2];
50063 for (var value in values) {
50064 if (entityValue !== value)
50066 var rules = values[value];
50067 if (typeof rules === "string") {
50068 return "pattern-" + rules;
50070 for (var ruleKey in rules) {
50071 var rule = rules[ruleKey];
50073 for (var criterion in rule) {
50074 if (criterion !== "pattern") {
50075 var v2 = tags[criterion];
50076 if (!v2 || v2 !== rule[criterion]) {
50083 return "pattern-" + rule.pattern;
50092 // modules/svg/areas.js
50093 function svgAreas(projection2, context) {
50094 function getPatternStyle(tags) {
50095 var imageID = svgTagPattern(tags);
50097 return 'url("#ideditor-' + imageID + '")';
50101 function drawTargets(selection2, graph, entities, filter2) {
50102 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
50103 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
50104 var getPath = svgPath(projection2).geojson;
50105 var activeID = context.activeID();
50106 var base = context.history().base();
50107 var data = { targets: [], nopes: [] };
50108 entities.forEach(function(way) {
50109 var features = svgSegmentWay(way, graph, activeID);
50110 data.targets.push.apply(data.targets, features.passive);
50111 data.nopes.push.apply(data.nopes, features.active);
50113 var targetData = data.targets.filter(getPath);
50114 var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
50115 return filter2(d2.properties.entity);
50116 }).data(targetData, function key(d2) {
50119 targets.exit().remove();
50120 var segmentWasEdited = function(d2) {
50121 var wayID = d2.properties.entity.id;
50122 if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
50125 return d2.properties.nodes.some(function(n3) {
50126 return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
50129 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
50130 return "way area target target-allowed " + targetClass + d2.id;
50131 }).classed("segment-edited", segmentWasEdited);
50132 var nopeData = data.nopes.filter(getPath);
50133 var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
50134 return filter2(d2.properties.entity);
50135 }).data(nopeData, function key(d2) {
50138 nopes.exit().remove();
50139 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
50140 return "way area target target-nope " + nopeClass + d2.id;
50141 }).classed("segment-edited", segmentWasEdited);
50143 function drawAreas(selection2, graph, entities, filter2) {
50144 var path = svgPath(projection2, graph, true);
50146 var base = context.history().base();
50147 for (var i3 = 0; i3 < entities.length; i3++) {
50148 var entity = entities[i3];
50149 if (entity.geometry(graph) !== "area")
50151 if (!areas[entity.id]) {
50152 areas[entity.id] = {
50154 area: Math.abs(entity.area(graph))
50158 var fills = Object.values(areas).filter(function hasPath(a2) {
50159 return path(a2.entity);
50161 fills.sort(function areaSort(a2, b2) {
50162 return b2.area - a2.area;
50164 fills = fills.map(function(a2) {
50167 var strokes = fills.filter(function(area) {
50168 return area.type === "way";
50176 var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
50177 clipPaths.exit().remove();
50178 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
50179 return "ideditor-" + entity2.id + "-clippath";
50181 clipPathsEnter.append("path");
50182 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
50183 var drawLayer = selection2.selectAll(".layer-osm.areas");
50184 var touchLayer = selection2.selectAll(".layer-touch.areas");
50185 var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
50186 areagroup = areagroup.enter().append("g").attr("class", function(d2) {
50187 return "areagroup area-" + d2;
50188 }).merge(areagroup);
50189 var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
50190 return data[layer];
50192 paths.exit().remove();
50193 var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
50194 var bisect = bisector(function(node) {
50195 return -node.__data__.area(graph);
50197 function sortedByArea(entity2) {
50198 if (this._parent.__data__ === "fill") {
50199 return fillpaths[bisect(fillpaths, -entity2.area(graph))];
50202 paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
50203 var layer = this.parentNode.__data__;
50204 this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
50205 if (layer === "fill") {
50206 this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
50207 this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
50209 }).classed("added", function(d2) {
50210 return !base.entities[d2.id];
50211 }).classed("geometry-edited", function(d2) {
50212 return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
50213 }).classed("retagged", function(d2) {
50214 return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal5.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
50215 }).call(svgTagClasses()).attr("d", path);
50216 touchLayer.call(drawTargets, graph, data.stroke, filter2);
50221 // modules/svg/data.js
50222 var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
50224 // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
50225 function $(element, tagName) {
50226 return Array.from(element.getElementsByTagName(tagName));
50228 function normalizeId(id2) {
50229 return id2[0] === "#" ? id2 : "#".concat(id2);
50231 function $ns(element, tagName, ns) {
50232 return Array.from(element.getElementsByTagNameNS(ns, tagName));
50234 function nodeVal(node) {
50235 node == null ? void 0 : node.normalize();
50236 return node && node.textContent || "";
50238 function get1(node, tagName, callback) {
50239 const n3 = node.getElementsByTagName(tagName);
50240 const result = n3.length ? n3[0] : null;
50241 if (result && callback)
50245 function get3(node, tagName, callback) {
50246 const properties = {};
50249 const n3 = node.getElementsByTagName(tagName);
50250 const result = n3.length ? n3[0] : null;
50251 if (result && callback) {
50252 return callback(result, properties);
50256 function val1(node, tagName, callback) {
50257 const val = nodeVal(get1(node, tagName));
50258 if (val && callback)
50259 return callback(val) || {};
50262 function $num(node, tagName, callback) {
50263 const val = parseFloat(nodeVal(get1(node, tagName)));
50266 if (val && callback)
50267 return callback(val) || {};
50270 function num1(node, tagName, callback) {
50271 const val = parseFloat(nodeVal(get1(node, tagName)));
50278 function getMulti(node, propertyNames) {
50279 const properties = {};
50280 for (const property of propertyNames) {
50281 val1(node, property, (val) => {
50282 properties[property] = val;
50287 function isElement(node) {
50288 return (node == null ? void 0 : node.nodeType) === 1;
50290 function getLineStyle(node) {
50291 return get3(node, "line", (lineStyle) => {
50292 const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
50293 return { stroke: "#".concat(color2) };
50294 }), $num(lineStyle, "opacity", (opacity) => {
50295 return { "stroke-opacity": opacity };
50296 }), $num(lineStyle, "width", (width) => {
50297 return { "stroke-width": width * 96 / 25.4 };
50302 function getExtensions(node) {
50306 for (const child of Array.from(node.childNodes)) {
50307 if (!isElement(child))
50309 const name = abbreviateName(child.nodeName);
50310 if (name === "gpxtpx:TrackPointExtension") {
50311 values = values.concat(getExtensions(child));
50313 const val = nodeVal(child);
50314 values.push([name, parseNumeric(val)]);
50319 function abbreviateName(name) {
50320 return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
50322 function parseNumeric(val) {
50323 const num = parseFloat(val);
50324 return isNaN(num) ? val : num;
50326 function coordPair$1(node) {
50328 parseFloat(node.getAttribute("lon") || ""),
50329 parseFloat(node.getAttribute("lat") || "")
50331 if (isNaN(ll[0]) || isNaN(ll[1])) {
50334 num1(node, "ele", (val) => {
50337 const time = get1(node, "time");
50340 time: time ? nodeVal(time) : null,
50341 extendedValues: getExtensions(get1(node, "extensions"))
50344 function extractProperties(node) {
50346 const properties = getMulti(node, [
50354 const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
50355 for (const child of extensions) {
50356 if (((_a2 = child.parentNode) == null ? void 0 : _a2.parentNode) === node) {
50357 properties[child.tagName.replace(":", "_")] = nodeVal(child);
50360 const links = $(node, "link");
50361 if (links.length) {
50362 properties.links = links.map((link3) => Object.assign({ href: link3.getAttribute("href") }, getMulti(link3, ["text", "type"])));
50366 function getPoints$1(node, pointname) {
50367 const pts = $(node, pointname);
50370 const extendedValues = {};
50371 for (let i3 = 0; i3 < pts.length; i3++) {
50372 const c2 = coordPair$1(pts[i3]);
50376 line.push(c2.coordinates);
50378 times.push(c2.time);
50379 for (const [name, val] of c2.extendedValues) {
50380 const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
50381 if (!extendedValues[plural]) {
50382 extendedValues[plural] = Array(pts.length).fill(null);
50384 extendedValues[plural][i3] = val;
50387 if (line.length < 2)
50395 function getRoute(node) {
50396 const line = getPoints$1(node, "rtept");
50401 properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
50403 type: "LineString",
50404 coordinates: line.line
50408 function getTrack(node) {
50409 const segments = $(node, "trkseg");
50412 const extractedLines = [];
50413 for (const segment of segments) {
50414 const line = getPoints$1(segment, "trkpt");
50416 extractedLines.push(line);
50417 if (line.times && line.times.length)
50418 times.push(line.times);
50421 if (extractedLines.length === 0)
50423 const multi = extractedLines.length > 1;
50424 const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
50425 coordinateProperties: {
50426 times: multi ? times : times[0]
50429 for (const line of extractedLines) {
50430 track.push(line.line);
50431 if (!properties.coordinateProperties) {
50432 properties.coordinateProperties = {};
50434 const props = properties.coordinateProperties;
50435 const entries = Object.entries(line.extendedValues);
50436 for (let i3 = 0; i3 < entries.length; i3++) {
50437 const [name, val] = entries[i3];
50439 if (!props[name]) {
50440 props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
50442 props[name][i3] = val;
50451 geometry: multi ? {
50452 type: "MultiLineString",
50455 type: "LineString",
50456 coordinates: track[0]
50460 function getPoint(node) {
50461 const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
50462 const pair3 = coordPair$1(node);
50470 coordinates: pair3.coordinates
50474 function* gpxGen(node) {
50475 for (const track of $(node, "trk")) {
50476 const feature3 = getTrack(track);
50480 for (const route of $(node, "rte")) {
50481 const feature3 = getRoute(route);
50485 for (const waypoint of $(node, "wpt")) {
50486 const point2 = getPoint(waypoint);
50491 function gpx(node) {
50493 type: "FeatureCollection",
50494 features: Array.from(gpxGen(node))
50497 function fixColor(v2, prefix) {
50498 const properties = {};
50499 const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
50500 if (v2[0] === "#") {
50501 v2 = v2.substring(1);
50503 if (v2.length === 6 || v2.length === 3) {
50504 properties[colorProp] = "#" + v2;
50505 } else if (v2.length === 8) {
50506 properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
50507 properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
50511 function numericProperty(node, source, target) {
50512 const properties = {};
50513 num1(node, source, (val) => {
50514 properties[target] = val;
50518 function getColor(node, output) {
50519 return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
50521 function extractIconHref(node) {
50522 return get3(node, "Icon", (icon2, properties) => {
50523 val1(icon2, "href", (href) => {
50524 properties.icon = href;
50529 function extractIcon(node) {
50530 return get3(node, "IconStyle", (iconStyle) => {
50531 return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
50532 const left = parseFloat(hotspot.getAttribute("x") || "");
50533 const top = parseFloat(hotspot.getAttribute("y") || "");
50534 const xunits = hotspot.getAttribute("xunits") || "";
50535 const yunits = hotspot.getAttribute("yunits") || "";
50536 if (!isNaN(left) && !isNaN(top))
50538 "icon-offset": [left, top],
50539 "icon-offset-units": [xunits, yunits]
50542 }), extractIconHref(iconStyle));
50545 function extractLabel(node) {
50546 return get3(node, "LabelStyle", (labelStyle) => {
50547 return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
50550 function extractLine(node) {
50551 return get3(node, "LineStyle", (lineStyle) => {
50552 return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
50555 function extractPoly(node) {
50556 return get3(node, "PolyStyle", (polyStyle, properties) => {
50557 return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
50559 return { "fill-opacity": 0 };
50560 }), val1(polyStyle, "outline", (outline) => {
50561 if (outline === "0")
50562 return { "stroke-opacity": 0 };
50566 function extractStyle(node) {
50567 return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
50569 var toNumber2 = (x2) => Number(x2);
50570 var typeConverters = {
50571 string: (x2) => x2,
50578 bool: (x2) => Boolean(x2)
50580 function extractExtendedData(node, schema) {
50581 return get3(node, "ExtendedData", (extendedData, properties) => {
50582 for (const data of $(extendedData, "Data")) {
50583 properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
50585 for (const simpleData of $(extendedData, "SimpleData")) {
50586 const name = simpleData.getAttribute("name") || "";
50587 const typeConverter = schema[name] || typeConverters.string;
50588 properties[name] = typeConverter(nodeVal(simpleData));
50593 function getMaybeHTMLDescription(node) {
50594 const descriptionNode = get1(node, "description");
50595 for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
50596 if (c2.nodeType === 4) {
50607 function extractTimeSpan(node) {
50608 return get3(node, "TimeSpan", (timeSpan) => {
50611 begin: nodeVal(get1(timeSpan, "begin")),
50612 end: nodeVal(get1(timeSpan, "end"))
50617 function extractTimeStamp(node) {
50618 return get3(node, "TimeStamp", (timeStamp) => {
50619 return { timestamp: nodeVal(get1(timeStamp, "when")) };
50622 function extractCascadedStyle(node, styleMap) {
50623 return val1(node, "styleUrl", (styleUrl) => {
50624 styleUrl = normalizeId(styleUrl);
50625 if (styleMap[styleUrl]) {
50626 return Object.assign({ styleUrl }, styleMap[styleUrl]);
50628 return { styleUrl };
50631 var removeSpace = /\s*/g;
50632 var trimSpace = /^\s*|\s*$/g;
50633 var splitSpace = /\s+/;
50634 function coord1(value) {
50635 return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
50637 function coord(value) {
50638 return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
50639 return coord2.length >= 2;
50642 function gxCoords(node) {
50643 let elems = $(node, "coord");
50644 if (elems.length === 0) {
50645 elems = $ns(node, "coord", "*");
50647 const coordinates = elems.map((elem) => {
50648 return nodeVal(elem).split(" ").map(parseFloat);
50650 if (coordinates.length === 0) {
50654 geometry: coordinates.length > 2 ? {
50655 type: "LineString",
50659 coordinates: coordinates[0]
50661 times: $(node, "when").map((elem) => nodeVal(elem))
50664 function fixRing(ring) {
50665 if (ring.length === 0)
50667 const first = ring[0];
50668 const last = ring[ring.length - 1];
50670 for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
50671 if (first[i3] !== last[i3]) {
50677 return ring.concat([ring[0]]);
50681 function getCoordinates(node) {
50682 return nodeVal(get1(node, "coordinates"));
50684 function getGeometry(node) {
50685 let geometries = [];
50686 let coordTimes = [];
50687 for (let i3 = 0; i3 < node.childNodes.length; i3++) {
50688 const child = node.childNodes.item(i3);
50689 if (isElement(child)) {
50690 switch (child.tagName) {
50691 case "MultiGeometry":
50693 case "gx:MultiTrack": {
50694 const childGeometries = getGeometry(child);
50695 geometries = geometries.concat(childGeometries.geometries);
50696 coordTimes = coordTimes.concat(childGeometries.coordTimes);
50700 const coordinates = coord1(getCoordinates(child));
50701 if (coordinates.length >= 2) {
50710 case "LineString": {
50711 const coordinates = coord(getCoordinates(child));
50712 if (coordinates.length >= 2) {
50714 type: "LineString",
50722 for (const linearRing of $(child, "LinearRing")) {
50723 const ring = fixRing(coord(getCoordinates(linearRing)));
50724 if (ring.length >= 4) {
50728 if (coords.length) {
50731 coordinates: coords
50738 const gx = gxCoords(child);
50741 const { times, geometry } = gx;
50742 geometries.push(geometry);
50744 coordTimes.push(times);
50755 function geometryListToGeometry(geometries) {
50756 return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
50757 type: "GeometryCollection",
50761 function getPlacemark(node, styleMap, schema, options2) {
50763 const { coordTimes, geometries } = getGeometry(node);
50764 const geometry = geometryListToGeometry(geometries);
50765 if (!geometry && options2.skipNullGeometry) {
50771 properties: Object.assign(getMulti(node, [
50778 ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
50779 coordinateProperties: {
50780 times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
50784 if (((_a2 = feature3.properties) == null ? void 0 : _a2.visibility) !== void 0) {
50785 feature3.properties.visibility = feature3.properties.visibility !== "0";
50787 const id2 = node.getAttribute("id");
50788 if (id2 !== null && id2 !== "")
50792 function getGroundOverlayBox(node) {
50793 const latLonQuad = get1(node, "gx:LatLonQuad");
50795 const ring = fixRing(coord(getCoordinates(node)));
50799 coordinates: [ring]
50803 return getLatLonBox(node);
50805 var DEGREES_TO_RADIANS = Math.PI / 180;
50806 function rotateBox(bbox2, coordinates, rotation) {
50807 const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
50809 coordinates[0].map((coordinate) => {
50810 const dy = coordinate[1] - center[1];
50811 const dx = coordinate[0] - center[0];
50812 const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
50813 const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
50815 center[0] + Math.cos(angle2) * distance,
50816 center[1] + Math.sin(angle2) * distance
50821 function getLatLonBox(node) {
50822 const latLonBox = get1(node, "LatLonBox");
50824 const north = num1(latLonBox, "north");
50825 const west = num1(latLonBox, "west");
50826 const east = num1(latLonBox, "east");
50827 const south = num1(latLonBox, "south");
50828 const rotation = num1(latLonBox, "rotation");
50829 if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
50830 const bbox2 = [west, south, east, north];
50831 let coordinates = [
50838 // top left (again)
50841 if (typeof rotation === "number") {
50842 coordinates = rotateBox(bbox2, coordinates, rotation);
50855 function getGroundOverlay(node, styleMap, schema, options2) {
50857 const box = getGroundOverlayBox(node);
50858 const geometry = (box == null ? void 0 : box.geometry) || null;
50859 if (!geometry && options2.skipNullGeometry) {
50865 properties: Object.assign(
50868 * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
50870 { "@geometry-type": "groundoverlay" },
50879 getMaybeHTMLDescription(node),
50880 extractCascadedStyle(node, styleMap),
50881 extractStyle(node),
50882 extractIconHref(node),
50883 extractExtendedData(node, schema),
50884 extractTimeSpan(node),
50885 extractTimeStamp(node)
50888 if (box == null ? void 0 : box.bbox) {
50889 feature3.bbox = box.bbox;
50891 if (((_a2 = feature3.properties) == null ? void 0 : _a2.visibility) !== void 0) {
50892 feature3.properties.visibility = feature3.properties.visibility !== "0";
50894 const id2 = node.getAttribute("id");
50895 if (id2 !== null && id2 !== "")
50899 function getStyleId(style) {
50900 let id2 = style.getAttribute("id");
50901 const parentNode = style.parentNode;
50902 if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
50903 id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
50905 return normalizeId(id2 || "");
50907 function buildStyleMap(node) {
50908 const styleMap = {};
50909 for (const style of $(node, "Style")) {
50910 styleMap[getStyleId(style)] = extractStyle(style);
50912 for (const map2 of $(node, "StyleMap")) {
50913 const id2 = normalizeId(map2.getAttribute("id") || "");
50914 val1(map2, "styleUrl", (styleUrl) => {
50915 styleUrl = normalizeId(styleUrl);
50916 if (styleMap[styleUrl]) {
50917 styleMap[id2] = styleMap[styleUrl];
50923 function buildSchema(node) {
50925 for (const field of $(node, "SimpleField")) {
50926 schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
50930 function* kmlGen(node, options2 = {
50931 skipNullGeometry: false
50933 const styleMap = buildStyleMap(node);
50934 const schema = buildSchema(node);
50935 for (const placemark of $(node, "Placemark")) {
50936 const feature3 = getPlacemark(placemark, styleMap, schema, options2);
50940 for (const groundOverlay of $(node, "GroundOverlay")) {
50941 const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
50946 function kml(node, options2 = {
50947 skipNullGeometry: false
50950 type: "FeatureCollection",
50951 features: Array.from(kmlGen(node, options2))
50955 // modules/svg/data.js
50956 var _initialized = false;
50957 var _enabled = false;
50959 function svgData(projection2, context, dispatch14) {
50960 var throttledRedraw = throttle_default(function() {
50961 dispatch14.call("change");
50963 var _showLabels = true;
50964 var detected = utilDetect();
50965 var layer = select_default2(null);
50970 const supportedFormats = [
50981 function over(d3_event) {
50982 d3_event.stopPropagation();
50983 d3_event.preventDefault();
50984 d3_event.dataTransfer.dropEffect = "copy";
50986 context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
50987 d3_event.stopPropagation();
50988 d3_event.preventDefault();
50989 if (!detected.filedrop)
50991 var f2 = d3_event.dataTransfer.files[0];
50992 var extension = getExtension(f2.name);
50993 if (!supportedFormats.includes(extension))
50995 drawData.fileList(d3_event.dataTransfer.files);
50996 }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
50997 _initialized = true;
50999 function getService() {
51000 if (services.vectorTile && !_vtService) {
51001 _vtService = services.vectorTile;
51002 _vtService.event.on("loadedData", throttledRedraw);
51003 } else if (!services.vectorTile && _vtService) {
51008 function showLayer() {
51010 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
51011 dispatch14.call("change");
51014 function hideLayer() {
51015 throttledRedraw.cancel();
51016 layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
51018 function layerOn() {
51019 layer.style("display", "block");
51021 function layerOff() {
51022 layer.selectAll(".viewfield-group").remove();
51023 layer.style("display", "none");
51025 function ensureIDs(gj) {
51028 if (gj.type === "FeatureCollection") {
51029 for (var i3 = 0; i3 < gj.features.length; i3++) {
51030 ensureFeatureID(gj.features[i3]);
51033 ensureFeatureID(gj);
51037 function ensureFeatureID(feature3) {
51040 feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
51043 function getFeatures(gj) {
51046 if (gj.type === "FeatureCollection") {
51047 return gj.features;
51052 function featureKey(d2) {
51053 return d2.__featurehash__;
51055 function isPolygon(d2) {
51056 return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
51058 function clipPathID(d2) {
51059 return "ideditor-data-" + d2.__featurehash__ + "-clippath";
51061 function featureClasses(d2) {
51063 "data" + d2.__featurehash__,
51065 isPolygon(d2) ? "area" : "",
51066 d2.__layerID__ || ""
51067 ].filter(Boolean).join(" ");
51069 function drawData(selection2) {
51070 var vtService = getService();
51071 var getPath = svgPath(projection2).geojson;
51072 var getAreaPath = svgPath(projection2, null, true).geojson;
51073 var hasData = drawData.hasData();
51074 layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
51075 layer.exit().remove();
51076 layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
51077 var surface = context.surface();
51078 if (!surface || surface.empty())
51080 var geoData, polygonData;
51081 if (_template && vtService) {
51082 var sourceID = _template;
51083 vtService.loadTiles(sourceID, _template, projection2);
51084 geoData = vtService.data(sourceID, projection2);
51086 geoData = getFeatures(_geojson);
51088 geoData = geoData.filter(getPath);
51089 polygonData = geoData.filter(isPolygon);
51090 var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
51091 clipPaths.exit().remove();
51092 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
51093 clipPathsEnter.append("path");
51094 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
51095 var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
51096 datagroups = datagroups.enter().append("g").attr("class", function(d2) {
51097 return "datagroup datagroup-" + d2;
51098 }).merge(datagroups);
51104 var paths = datagroups.selectAll("path").data(function(layer2) {
51105 return pathData[layer2];
51107 paths.exit().remove();
51108 paths = paths.enter().append("path").attr("class", function(d2) {
51109 var datagroup = this.parentNode.__data__;
51110 return "pathdata " + datagroup + " " + featureClasses(d2);
51111 }).attr("clip-path", function(d2) {
51112 var datagroup = this.parentNode.__data__;
51113 return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
51114 }).merge(paths).attr("d", function(d2) {
51115 var datagroup = this.parentNode.__data__;
51116 return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
51118 layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
51119 function drawLabels(selection3, textClass, data) {
51120 var labelPath = path_default(projection2);
51121 var labelData = data.filter(function(d2) {
51122 return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
51124 var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
51125 labels.exit().remove();
51126 labels = labels.enter().append("text").attr("class", function(d2) {
51127 return textClass + " " + featureClasses(d2);
51128 }).merge(labels).text(function(d2) {
51129 return d2.properties.desc || d2.properties.name;
51130 }).attr("x", function(d2) {
51131 var centroid = labelPath.centroid(d2);
51132 return centroid[0] + 11;
51133 }).attr("y", function(d2) {
51134 var centroid = labelPath.centroid(d2);
51135 return centroid[1];
51139 function getExtension(fileName) {
51142 var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
51143 var match = fileName.toLowerCase().match(re3);
51144 return match && match.length && match[0];
51146 function xmlToDom(textdata) {
51147 return new DOMParser().parseFromString(textdata, "text/xml");
51149 function stringifyGeojsonProperties(feature3) {
51150 const properties = feature3.properties;
51151 for (const key in properties) {
51152 const property = properties[key];
51153 if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
51154 properties[key] = property.toString();
51155 } else if (property === null) {
51156 properties[key] = "null";
51157 } else if (typeof property === "object") {
51158 properties[key] = JSON.stringify(property);
51162 drawData.setFile = function(extension, data) {
51168 switch (extension) {
51170 gj = gpx(xmlToDom(data));
51173 gj = kml(xmlToDom(data));
51177 gj = JSON.parse(data);
51178 if (gj.type === "FeatureCollection") {
51179 gj.features.forEach(stringifyGeojsonProperties);
51180 } else if (gj.type === "Feature") {
51181 stringifyGeojsonProperties(gj);
51186 if (Object.keys(gj).length) {
51187 _geojson = ensureIDs(gj);
51188 _src = extension + " data file";
51191 dispatch14.call("change");
51194 drawData.showLabels = function(val) {
51195 if (!arguments.length)
51196 return _showLabels;
51200 drawData.enabled = function(val) {
51201 if (!arguments.length)
51209 dispatch14.call("change");
51212 drawData.hasData = function() {
51213 var gj = _geojson || {};
51214 return !!(_template || Object.keys(gj).length);
51216 drawData.template = function(val, src) {
51217 if (!arguments.length)
51219 var osm = context.connection();
51221 var blocklists = osm.imageryBlocklists();
51225 for (var i3 = 0; i3 < blocklists.length; i3++) {
51226 regex = blocklists[i3];
51227 fail = regex.test(val);
51233 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
51234 fail = regex.test(val);
51240 _src = src || "vectortile:" + val.split(/[?#]/)[0];
51241 dispatch14.call("change");
51244 drawData.geojson = function(gj, src) {
51245 if (!arguments.length)
51252 if (Object.keys(gj).length) {
51253 _geojson = ensureIDs(gj);
51254 _src = src || "unknown.geojson";
51256 dispatch14.call("change");
51259 drawData.fileList = function(fileList) {
51260 if (!arguments.length)
51265 _fileList = fileList;
51266 if (!fileList || !fileList.length)
51268 var f2 = fileList[0];
51269 var extension = getExtension(f2.name);
51270 var reader = new FileReader();
51271 reader.onload = /* @__PURE__ */ function() {
51272 return function(e3) {
51273 drawData.setFile(extension, e3.target.result);
51276 reader.readAsText(f2);
51279 drawData.url = function(url, defaultExtension) {
51284 var testUrl = url.split(/[?#]/)[0];
51285 var extension = getExtension(testUrl) || defaultExtension;
51288 text_default3(url).then(function(data) {
51289 drawData.setFile(extension, data);
51290 }).catch(function() {
51293 drawData.template(url);
51297 drawData.getSrc = function() {
51300 drawData.fitZoom = function() {
51301 var features = getFeatures(_geojson);
51302 if (!features.length)
51304 var map2 = context.map();
51305 var viewport = map2.trimmedExtent().polygon();
51306 var coords = features.reduce(function(coords2, feature3) {
51307 var geom = feature3.geometry;
51310 var c2 = geom.coordinates;
51311 switch (geom.type) {
51317 case "MultiPolygon":
51318 c2 = utilArrayFlatten(c2);
51320 case "MultiLineString":
51321 c2 = utilArrayFlatten(c2);
51324 return utilArrayUnion(coords2, c2);
51326 if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
51327 var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
51328 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
51336 // modules/svg/debug.js
51337 function svgDebug(projection2, context) {
51338 function drawDebug(selection2) {
51339 const showTile = context.getDebug("tile");
51340 const showCollision = context.getDebug("collision");
51341 const showImagery = context.getDebug("imagery");
51342 const showTouchTargets = context.getDebug("target");
51343 const showDownloaded = context.getDebug("downloaded");
51344 let debugData = [];
51346 debugData.push({ class: "red", label: "tile" });
51348 if (showCollision) {
51349 debugData.push({ class: "yellow", label: "collision" });
51352 debugData.push({ class: "orange", label: "imagery" });
51354 if (showTouchTargets) {
51355 debugData.push({ class: "pink", label: "touchTargets" });
51357 if (showDownloaded) {
51358 debugData.push({ class: "purple", label: "downloaded" });
51360 let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
51361 legend.exit().remove();
51362 legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
51363 let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
51364 legendItems.exit().remove();
51365 legendItems.enter().append("span").attr("class", (d2) => "debug-legend-item ".concat(d2.class)).text((d2) => d2.label);
51366 let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
51367 layer.exit().remove();
51368 layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
51369 const extent = context.map().extent();
51370 _mainFileFetcher.get("imagery").then((d2) => {
51371 const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
51372 const features = hits.map((d4) => d4.features[d4.id]);
51373 let imagery = layer.selectAll("path.debug-imagery").data(features);
51374 imagery.exit().remove();
51375 imagery.enter().append("path").attr("class", "debug-imagery debug orange");
51378 const osm = context.connection();
51379 let dataDownloaded = [];
51380 if (osm && showDownloaded) {
51381 const rtree = osm.caches("get").tile.rtree;
51382 dataDownloaded = rtree.all().map((bbox2) => {
51385 properties: { id: bbox2.id },
51389 [bbox2.minX, bbox2.minY],
51390 [bbox2.minX, bbox2.maxY],
51391 [bbox2.maxX, bbox2.maxY],
51392 [bbox2.maxX, bbox2.minY],
51393 [bbox2.minX, bbox2.minY]
51399 let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
51400 downloaded.exit().remove();
51401 downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
51402 layer.selectAll("path").attr("d", svgPath(projection2).geojson);
51404 drawDebug.enabled = function() {
51405 if (!arguments.length) {
51406 return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
51414 // modules/svg/defs.js
51415 function svgDefs(context) {
51416 var _defsSelection = select_default2(null);
51417 var _spritesheetIds = [
51425 function drawDefs(selection2) {
51426 _defsSelection = selection2.append("defs");
51427 _defsSelection.append("marker").attr("id", "ideditor-oneway-marker").attr("viewBox", "0 0 10 5").attr("refX", 2.5).attr("refY", 2.5).attr("markerWidth", 2).attr("markerHeight", 2).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "oneway-marker-path").attr("d", "M 5,3 L 0,3 L 0,2 L 5,2 L 5,0 L 10,2.5 L 5,5 z").attr("stroke", "none").attr("fill", "#000").attr("opacity", "0.75");
51428 function addSidedMarker(name, color2, offset) {
51429 _defsSelection.append("marker").attr("id", "ideditor-sided-marker-" + name).attr("viewBox", "0 0 2 2").attr("refX", 1).attr("refY", -offset).attr("markerWidth", 1.5).attr("markerHeight", 1.5).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "sided-marker-path sided-marker-" + name + "-path").attr("d", "M 0,0 L 1,1 L 2,0 z").attr("stroke", "none").attr("fill", color2);
51431 addSidedMarker("natural", "rgb(170, 170, 170)", 0);
51432 addSidedMarker("coastline", "#77dede", 1);
51433 addSidedMarker("waterway", "#77dede", 1);
51434 addSidedMarker("barrier", "#ddd", 1);
51435 addSidedMarker("man_made", "#fff", 0);
51436 _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "#333").attr("fill-opacity", "0.75").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
51437 _defsSelection.append("marker").attr("id", "ideditor-viewfield-marker-wireframe").attr("viewBox", "0 0 16 16").attr("refX", 8).attr("refY", 16).attr("markerWidth", 4).attr("markerHeight", 4).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("class", "viewfield-marker-path").attr("d", "M 6,14 C 8,13.4 8,13.4 10,14 L 16,3 C 12,0 4,0 0,3 z").attr("fill", "none").attr("stroke", "#fff").attr("stroke-width", "0.5px").attr("stroke-opacity", "0.75");
51438 var patterns2 = _defsSelection.selectAll("pattern").data([
51439 // pattern name, pattern image name
51441 ["construction", "construction"],
51442 ["cemetery", "cemetery"],
51443 ["cemetery_christian", "cemetery_christian"],
51444 ["cemetery_buddhist", "cemetery_buddhist"],
51445 ["cemetery_muslim", "cemetery_muslim"],
51446 ["cemetery_jewish", "cemetery_jewish"],
51447 ["farmland", "farmland"],
51448 ["farmyard", "farmyard"],
51449 ["forest", "forest"],
51450 ["forest_broadleaved", "forest_broadleaved"],
51451 ["forest_needleleaved", "forest_needleleaved"],
51452 ["forest_leafless", "forest_leafless"],
51453 ["golf_green", "grass"],
51454 ["grass", "grass"],
51455 ["landfill", "landfill"],
51456 ["meadow", "grass"],
51457 ["orchard", "orchard"],
51459 ["quarry", "quarry"],
51460 ["scrub", "bushes"],
51461 ["vineyard", "vineyard"],
51462 ["water_standing", "lines"],
51463 ["waves", "waves"],
51464 ["wetland", "wetland"],
51465 ["wetland_marsh", "wetland_marsh"],
51466 ["wetland_swamp", "wetland_swamp"],
51467 ["wetland_bog", "wetland_bog"],
51468 ["wetland_reedbed", "wetland_reedbed"]
51469 ]).enter().append("pattern").attr("id", function(d2) {
51470 return "ideditor-pattern-" + d2[0];
51471 }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
51472 patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
51473 return "pattern-color-" + d2[0];
51475 patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
51476 return context.imagePath("pattern/" + d2[1] + ".png");
51478 _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
51479 return "ideditor-clip-square-" + d2;
51480 }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
51482 }).attr("height", function(d2) {
51485 addSprites(_spritesheetIds, true);
51487 function addSprites(ids, overrideColors) {
51488 _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
51489 var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
51490 spritesheets.enter().append("g").attr("class", function(d2) {
51491 return "spritesheet spritesheet-" + d2;
51492 }).each(function(d2) {
51493 var url = context.imagePath(d2 + ".svg");
51494 var node = select_default2(this).node();
51495 svg(url).then(function(svg2) {
51497 select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
51499 if (overrideColors && d2 !== "iD-sprite") {
51500 select_default2(node).selectAll("path").attr("fill", "currentColor");
51502 }).catch(function() {
51505 spritesheets.exit().remove();
51507 drawDefs.addSprites = addSprites;
51511 // modules/svg/keepRight.js
51512 var _layerEnabled = false;
51514 function svgKeepRight(projection2, context, dispatch14) {
51515 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
51516 const minZoom4 = 12;
51517 let touchLayer = select_default2(null);
51518 let drawLayer = select_default2(null);
51519 let layerVisible = false;
51520 function markerPath(selection2, klass) {
51521 selection2.attr("class", klass).attr("transform", "translate(-4, -24)").attr("d", "M11.6,6.2H7.1l1.4-5.1C8.6,0.6,8.1,0,7.5,0H2.2C1.7,0,1.3,0.3,1.3,0.8L0,10.2c-0.1,0.6,0.4,1.1,0.9,1.1h4.6l-1.8,7.6C3.6,19.4,4.1,20,4.7,20c0.3,0,0.6-0.2,0.8-0.5l6.9-11.9C12.7,7,12.3,6.2,11.6,6.2z");
51523 function getService() {
51524 if (services.keepRight && !_qaService) {
51525 _qaService = services.keepRight;
51526 _qaService.on("loaded", throttledRedraw);
51527 } else if (!services.keepRight && _qaService) {
51532 function editOn() {
51533 if (!layerVisible) {
51534 layerVisible = true;
51535 drawLayer.style("display", "block");
51538 function editOff() {
51539 if (layerVisible) {
51540 layerVisible = false;
51541 drawLayer.style("display", "none");
51542 drawLayer.selectAll(".qaItem.keepRight").remove();
51543 touchLayer.selectAll(".qaItem.keepRight").remove();
51546 function layerOn() {
51548 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
51550 function layerOff() {
51551 throttledRedraw.cancel();
51552 drawLayer.interrupt();
51553 touchLayer.selectAll(".qaItem.keepRight").remove();
51554 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
51556 dispatch14.call("change");
51559 function updateMarkers() {
51560 if (!layerVisible || !_layerEnabled)
51562 const service = getService();
51563 const selectedID = context.selectedErrorID();
51564 const data = service ? service.getItems(projection2) : [];
51565 const getTransform = svgPointTransform(projection2);
51566 const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
51567 markers.exit().remove();
51568 const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType));
51569 markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
51570 markersEnter.append("path").call(markerPath, "shadow");
51571 markersEnter.append("use").attr("class", "qaItem-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-bolt");
51572 markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
51573 if (touchLayer.empty())
51575 const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
51576 const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
51577 targets.exit().remove();
51578 targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", (d2) => "qaItem ".concat(d2.service, " target ").concat(fillClass, " itemId-").concat(d2.id)).attr("transform", getTransform);
51579 function sortY(a2, b2) {
51580 return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : a2.severity === "error" && b2.severity !== "error" ? 1 : b2.severity === "error" && a2.severity !== "error" ? -1 : b2.loc[1] - a2.loc[1];
51583 function drawKeepRight(selection2) {
51584 const service = getService();
51585 const surface = context.surface();
51586 if (surface && !surface.empty()) {
51587 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
51589 drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
51590 drawLayer.exit().remove();
51591 drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
51592 if (_layerEnabled) {
51593 if (service && ~~context.map().zoom() >= minZoom4) {
51595 service.loadIssues(projection2);
51602 drawKeepRight.enabled = function(val) {
51603 if (!arguments.length)
51604 return _layerEnabled;
51605 _layerEnabled = val;
51606 if (_layerEnabled) {
51610 if (context.selectedErrorID()) {
51611 context.enter(modeBrowse(context));
51614 dispatch14.call("change");
51617 drawKeepRight.supported = () => !!getService();
51618 return drawKeepRight;
51621 // modules/svg/geolocate.js
51622 function svgGeolocate(projection2) {
51623 var layer = select_default2(null);
51626 if (svgGeolocate.initialized)
51628 svgGeolocate.enabled = false;
51629 svgGeolocate.initialized = true;
51631 function showLayer() {
51632 layer.style("display", "block");
51634 function hideLayer() {
51635 layer.transition().duration(250).style("opacity", 0);
51637 function layerOn() {
51638 layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
51640 function layerOff() {
51641 layer.style("display", "none");
51643 function transform2(d2) {
51644 return svgPointTransform(projection2)(d2);
51646 function accuracy(accuracy2, loc) {
51647 var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
51648 return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
51650 function update() {
51651 var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
51652 var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
51653 groups.exit().remove();
51654 var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
51655 pointsEnter.append("circle").attr("class", "geolocate-radius").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("fill-opacity", "0.3").attr("r", "0");
51656 pointsEnter.append("circle").attr("dx", "0").attr("dy", "0").attr("fill", "rgb(15,128,225)").attr("stroke", "white").attr("stroke-width", "1.5").attr("r", "6");
51657 groups.merge(pointsEnter).attr("transform", transform2);
51658 layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
51660 function drawLocation(selection2) {
51661 var enabled = svgGeolocate.enabled;
51662 layer = selection2.selectAll(".layer-geolocate").data([0]);
51663 layer.exit().remove();
51664 var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
51665 layerEnter.append("g").attr("class", "geolocations");
51666 layer = layerEnter.merge(layer);
51673 drawLocation.enabled = function(position, enabled) {
51674 if (!arguments.length)
51675 return svgGeolocate.enabled;
51676 _position = position;
51677 svgGeolocate.enabled = enabled;
51678 if (svgGeolocate.enabled) {
51687 return drawLocation;
51690 // modules/svg/labels.js
51691 var import_rbush6 = __toESM(require_rbush_min());
51692 function svgLabels(projection2, context) {
51693 var path = path_default(projection2);
51694 var detected = utilDetect();
51695 var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
51696 var _rdrawn = new import_rbush6.default();
51697 var _rskipped = new import_rbush6.default();
51698 var _textWidthCache = {};
51699 var _entitybboxes = {};
51701 ["line", "aeroway", "*", 12],
51702 ["line", "highway", "motorway", 12],
51703 ["line", "highway", "trunk", 12],
51704 ["line", "highway", "primary", 12],
51705 ["line", "highway", "secondary", 12],
51706 ["line", "highway", "tertiary", 12],
51707 ["line", "highway", "*", 12],
51708 ["line", "railway", "*", 12],
51709 ["line", "waterway", "*", 12],
51710 ["area", "aeroway", "*", 12],
51711 ["area", "amenity", "*", 12],
51712 ["area", "building", "*", 12],
51713 ["area", "historic", "*", 12],
51714 ["area", "leisure", "*", 12],
51715 ["area", "man_made", "*", 12],
51716 ["area", "natural", "*", 12],
51717 ["area", "shop", "*", 12],
51718 ["area", "tourism", "*", 12],
51719 ["area", "camp_site", "*", 12],
51720 ["point", "aeroway", "*", 10],
51721 ["point", "amenity", "*", 10],
51722 ["point", "building", "*", 10],
51723 ["point", "historic", "*", 10],
51724 ["point", "leisure", "*", 10],
51725 ["point", "man_made", "*", 10],
51726 ["point", "natural", "*", 10],
51727 ["point", "shop", "*", 10],
51728 ["point", "tourism", "*", 10],
51729 ["point", "camp_site", "*", 10],
51730 ["line", "ref", "*", 12],
51731 ["area", "ref", "*", 12],
51732 ["point", "ref", "*", 10],
51733 ["line", "name", "*", 12],
51734 ["area", "name", "*", 12],
51735 ["point", "name", "*", 10]
51737 function shouldSkipIcon(preset) {
51738 var noIcons = ["building", "landuse", "natural"];
51739 return noIcons.some(function(s2) {
51740 return preset.id.indexOf(s2) >= 0;
51743 function get4(array2, prop) {
51744 return function(d2, i3) {
51745 return array2[i3][prop];
51748 function textWidth(text, size, elem) {
51749 var c2 = _textWidthCache[size];
51751 c2 = _textWidthCache[size] = {};
51755 c2[text] = elem.getComputedTextLength();
51758 var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
51759 if (str === null) {
51760 return size / 3 * 2 * text.length;
51762 return size / 3 * (2 * text.length + str.length);
51766 function drawLinePaths(selection2, entities, filter2, classes, labels) {
51767 var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
51768 paths.exit().remove();
51769 paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
51770 return "ideditor-labelpath-" + d2.id;
51771 }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
51773 function drawLineLabels(selection2, entities, filter2, classes, labels) {
51774 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
51775 texts.exit().remove();
51776 texts.enter().append("text").attr("class", function(d2, i3) {
51777 return classes + " " + labels[i3].classes + " " + d2.id;
51778 }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
51779 selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
51780 return "#ideditor-labelpath-" + d2.id;
51781 }).text(utilDisplayNameForPath);
51783 function drawPointLabels(selection2, entities, filter2, classes, labels) {
51784 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
51785 texts.exit().remove();
51786 texts.enter().append("text").attr("class", function(d2, i3) {
51787 return classes + " " + labels[i3].classes + " " + d2.id;
51788 }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
51789 textWidth(utilDisplayName(d2), labels[i3].height, this);
51792 function drawAreaLabels(selection2, entities, filter2, classes, labels) {
51793 entities = entities.filter(hasText);
51794 labels = labels.filter(hasText);
51795 drawPointLabels(selection2, entities, filter2, classes, labels);
51796 function hasText(d2, i3) {
51797 return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
51800 function drawAreaIcons(selection2, entities, filter2, classes, labels) {
51801 var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
51802 icons.exit().remove();
51803 icons.enter().append("use").attr("class", "icon " + classes).attr("width", "17px").attr("height", "17px").merge(icons).attr("transform", get4(labels, "transform")).attr("xlink:href", function(d2) {
51804 var preset = _mainPresetIndex.match(d2, context.graph());
51805 var picon = preset && preset.icon;
51806 return picon ? "#" + picon : "";
51809 function drawCollisionBoxes(selection2, rtree, which) {
51810 var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
51812 if (context.getDebug("collision")) {
51813 gj = rtree.all().map(function(d2) {
51814 return { type: "Polygon", coordinates: [[
51815 [d2.minX, d2.minY],
51816 [d2.maxX, d2.minY],
51817 [d2.maxX, d2.maxY],
51818 [d2.minX, d2.maxY],
51823 var boxes = selection2.selectAll("." + which).data(gj);
51824 boxes.exit().remove();
51825 boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
51827 function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
51828 var wireframe = context.surface().classed("fill-wireframe");
51829 var zoom = geoScaleToZoom(projection2.scale());
51830 var labelable = [];
51831 var renderNodeAs = {};
51832 var i3, j2, k2, entity, geometry;
51833 for (i3 = 0; i3 < labelStack.length; i3++) {
51834 labelable.push([]);
51839 _entitybboxes = {};
51841 for (i3 = 0; i3 < entities.length; i3++) {
51842 entity = entities[i3];
51843 var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
51844 for (j2 = 0; j2 < toRemove.length; j2++) {
51845 _rdrawn.remove(toRemove[j2]);
51846 _rskipped.remove(toRemove[j2]);
51850 for (i3 = 0; i3 < entities.length; i3++) {
51851 entity = entities[i3];
51852 geometry = entity.geometry(graph);
51853 if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
51854 var hasDirections = entity.directions(graph, projection2).length;
51856 if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
51857 renderNodeAs[entity.id] = "point";
51858 markerPadding = 20;
51860 renderNodeAs[entity.id] = "vertex";
51863 var coord2 = projection2(entity.loc);
51864 var nodePadding = 10;
51866 minX: coord2[0] - nodePadding,
51867 minY: coord2[1] - nodePadding - markerPadding,
51868 maxX: coord2[0] + nodePadding,
51869 maxY: coord2[1] + nodePadding
51871 doInsert(bbox2, entity.id + "P");
51873 if (geometry === "vertex") {
51874 geometry = "point";
51876 var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
51877 var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
51878 if (!icon2 && !utilDisplayName(entity))
51880 for (k2 = 0; k2 < labelStack.length; k2++) {
51881 var matchGeom = labelStack[k2][0];
51882 var matchKey = labelStack[k2][1];
51883 var matchVal = labelStack[k2][2];
51884 var hasVal = entity.tags[matchKey];
51885 if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
51886 labelable[k2].push(entity);
51901 for (k2 = 0; k2 < labelable.length; k2++) {
51902 var fontSize = labelStack[k2][3];
51903 for (i3 = 0; i3 < labelable[k2].length; i3++) {
51904 entity = labelable[k2][i3];
51905 geometry = entity.geometry(graph);
51906 var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
51907 var name = getName(entity);
51908 var width = name && textWidth(name, fontSize);
51910 if (geometry === "point" || geometry === "vertex") {
51913 var renderAs = renderNodeAs[entity.id];
51914 if (renderAs === "vertex" && zoom < 17)
51916 p2 = getPointLabel(entity, width, fontSize, renderAs);
51917 } else if (geometry === "line") {
51918 p2 = getLineLabel(entity, width, fontSize);
51919 } else if (geometry === "area") {
51920 p2 = getAreaLabel(entity, width, fontSize);
51923 if (geometry === "vertex") {
51924 geometry = "point";
51926 p2.classes = geometry + " tag-" + labelStack[k2][1];
51927 positions[geometry].push(p2);
51928 labelled[geometry].push(entity);
51932 function isInterestingVertex(entity2) {
51933 var selectedIDs = context.selectedIDs();
51934 return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
51935 return selectedIDs.indexOf(parent.id) !== -1;
51938 function getPointLabel(entity2, width2, height, geometry2) {
51939 var y2 = geometry2 === "point" ? -12 : 0;
51940 var pointOffsets = {
51941 ltr: [15, y2, "start"],
51942 rtl: [-15, y2, "end"]
51944 var textDirection = _mainLocalizer.textDirection();
51945 var coord3 = projection2(entity2.loc);
51946 var textPadding = 2;
51947 var offset = pointOffsets[textDirection];
51951 x: coord3[0] + offset[0],
51952 y: coord3[1] + offset[1],
51953 textAnchor: offset[2]
51956 if (textDirection === "rtl") {
51958 minX: p3.x - width2 - textPadding,
51959 minY: p3.y - height / 2 - textPadding,
51960 maxX: p3.x + textPadding,
51961 maxY: p3.y + height / 2 + textPadding
51965 minX: p3.x - textPadding,
51966 minY: p3.y - height / 2 - textPadding,
51967 maxX: p3.x + width2 + textPadding,
51968 maxY: p3.y + height / 2 + textPadding
51971 if (tryInsert([bbox3], entity2.id, true)) {
51975 function getLineLabel(entity2, width2, height) {
51976 var viewport = geoExtent(context.projection.clipExtent()).polygon();
51977 var points = graph.childNodes(entity2).map(function(node) {
51978 return projection2(node.loc);
51980 var length2 = geoPathLength(points);
51981 if (length2 < width2 + 20)
51983 var lineOffsets = [
52005 for (var i4 = 0; i4 < lineOffsets.length; i4++) {
52006 var offset = lineOffsets[i4];
52007 var middle = offset / 100 * length2;
52008 var start2 = middle - width2 / 2;
52009 if (start2 < 0 || start2 + width2 > length2)
52011 var sub = subpath(points, start2, start2 + width2);
52012 if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
52015 var isReverse = reverse(sub);
52017 sub = sub.reverse();
52020 var boxsize = (height + 2) / 2;
52021 for (var j3 = 0; j3 < sub.length - 1; j3++) {
52023 var b2 = sub[j3 + 1];
52024 var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
52025 for (var box = 0; box < num; box++) {
52026 var p3 = geoVecInterp(a2, b2, box / num);
52027 var x05 = p3[0] - boxsize - padding;
52028 var y05 = p3[1] - boxsize - padding;
52029 var x12 = p3[0] + boxsize + padding;
52030 var y12 = p3[1] + boxsize + padding;
52032 minX: Math.min(x05, x12),
52033 minY: Math.min(y05, y12),
52034 maxX: Math.max(x05, x12),
52035 maxY: Math.max(y05, y12)
52039 if (tryInsert(bboxes, entity2.id, false)) {
52041 "font-size": height + 2,
52042 lineString: lineString2(sub),
52043 startOffset: offset + "%"
52047 function reverse(p4) {
52048 var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
52049 return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
52051 function lineString2(points2) {
52052 return "M" + points2.join("L");
52054 function subpath(points2, from, to) {
52056 var start3, end, i0, i1;
52057 for (var i5 = 0; i5 < points2.length - 1; i5++) {
52058 var a3 = points2[i5];
52059 var b3 = points2[i5 + 1];
52060 var current = geoVecLength(a3, b3);
52062 if (!start3 && sofar + current >= from) {
52063 portion = (from - sofar) / current;
52065 a3[0] + portion * (b3[0] - a3[0]),
52066 a3[1] + portion * (b3[1] - a3[1])
52070 if (!end && sofar + current >= to) {
52071 portion = (to - sofar) / current;
52073 a3[0] + portion * (b3[0] - a3[0]),
52074 a3[1] + portion * (b3[1] - a3[1])
52080 var result = points2.slice(i0, i1);
52081 result.unshift(start3);
52086 function getAreaLabel(entity2, width2, height) {
52087 var centroid = path.centroid(entity2.asGeoJSON(graph));
52088 var extent = entity2.extent(graph);
52089 var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
52090 if (isNaN(centroid[0]) || areaWidth < 20)
52092 var preset2 = _mainPresetIndex.match(entity2, context.graph());
52093 var picon = preset2 && preset2.icon;
52099 addLabel(iconSize + padding);
52107 function addIcon() {
52108 var iconX = centroid[0] - iconSize / 2;
52109 var iconY = centroid[1] - iconSize / 2;
52113 maxX: iconX + iconSize,
52114 maxY: iconY + iconSize
52116 if (tryInsert([bbox3], entity2.id + "I", true)) {
52117 p3.transform = "translate(" + iconX + "," + iconY + ")";
52122 function addLabel(yOffset) {
52123 if (width2 && areaWidth >= width2 + 20) {
52124 var labelX = centroid[0];
52125 var labelY = centroid[1] + yOffset;
52127 minX: labelX - width2 / 2 - padding,
52128 minY: labelY - height / 2 - padding,
52129 maxX: labelX + width2 / 2 + padding,
52130 maxY: labelY + height / 2 + padding
52132 if (tryInsert([bbox3], entity2.id, true)) {
52135 p3.textAnchor = "middle";
52136 p3.height = height;
52143 function doInsert(bbox3, id2) {
52145 var oldbox = _entitybboxes[id2];
52147 _rdrawn.remove(oldbox);
52149 _entitybboxes[id2] = bbox3;
52150 _rdrawn.insert(bbox3);
52152 function tryInsert(bboxes, id2, saveSkipped) {
52153 var skipped = false;
52154 for (var i4 = 0; i4 < bboxes.length; i4++) {
52155 var bbox3 = bboxes[i4];
52157 if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
52161 if (_rdrawn.collides(bbox3)) {
52166 _entitybboxes[id2] = bboxes;
52169 _rskipped.load(bboxes);
52172 _rdrawn.load(bboxes);
52176 var layer = selection2.selectAll(".layer-osm.labels");
52177 layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
52178 return "labels-group " + d2;
52180 var halo = layer.selectAll(".labels-group.halo");
52181 var label = layer.selectAll(".labels-group.label");
52182 var debug2 = layer.selectAll(".labels-group.debug");
52183 drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
52184 drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
52185 drawLinePaths(layer, labelled.line, filter2, "", positions.line);
52186 drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
52187 drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
52188 drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
52189 drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
52190 drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
52191 drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
52192 drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
52193 drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
52194 layer.call(filterLabels);
52196 function filterLabels(selection2) {
52197 var drawLayer = selection2.selectAll(".layer-osm.labels");
52198 var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
52199 layers.selectAll(".nolabel").classed("nolabel", false);
52200 var mouse = context.map().mouse();
52201 var graph = context.graph();
52202 var selectedIDs = context.selectedIDs();
52207 bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
52208 var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
52211 ids.push.apply(ids, nearMouse);
52213 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
52214 var entity = graph.hasEntity(selectedIDs[i3]);
52215 if (entity && entity.type === "node") {
52216 ids.push(selectedIDs[i3]);
52219 layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
52220 var debug2 = selection2.selectAll(".labels-group.debug");
52222 if (context.getDebug("collision")) {
52226 [bbox2.minX, bbox2.minY],
52227 [bbox2.maxX, bbox2.minY],
52228 [bbox2.maxX, bbox2.maxY],
52229 [bbox2.minX, bbox2.maxY],
52230 [bbox2.minX, bbox2.minY]
52234 var box = debug2.selectAll(".debug-mouse").data(gj);
52235 box.exit().remove();
52236 box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
52238 var throttleFilterLabels = throttle_default(filterLabels, 100);
52239 drawLabels.observe = function(selection2) {
52240 var listener = function() {
52241 throttleFilterLabels(selection2);
52243 selection2.on("mousemove.hidelabels", listener);
52244 context.on("enter.hidelabels", listener);
52246 drawLabels.off = function(selection2) {
52247 throttleFilterLabels.cancel();
52248 selection2.on("mousemove.hidelabels", null);
52249 context.on("enter.hidelabels", null);
52254 // node_modules/exifr/dist/full.esm.mjs
52255 var e = "undefined" != typeof self ? self : global;
52256 var t = "undefined" != typeof navigator;
52257 var i2 = t && "undefined" == typeof HTMLImageElement;
52258 var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
52262 var o = (e3) => e3;
52263 function l(e3, t2 = o) {
52266 return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
52267 /* webpackIgnore: true */
52271 console.warn("Couldn't load ".concat(e3));
52275 var u = (e3) => h = e3;
52277 const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
52278 let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
52279 const f2 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
52280 "" !== o2 && (f2.port = Number(o2));
52281 const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
52282 if (301 === e4.statusCode || 302 === e4.statusCode) {
52283 let t3 = new URL(e4.headers.location, n3).toString();
52284 return i3(t3, { headers: s2 }).then(r2).catch(a2);
52286 r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
52288 e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
52291 d2.on("error", a2), d2.end();
52295 function c(e3, t2, i3) {
52296 return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
52298 var f = (e3) => p(e3) ? void 0 : e3;
52299 var d = (e3) => void 0 !== e3;
52301 return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
52304 let t2 = new Error(e3);
52305 throw delete t2.stack, t2;
52308 return "" === (e3 = function(e4) {
52309 for (; e4.endsWith("\0"); )
52310 e4 = e4.slice(0, -1);
52312 }(e3).trim()) ? void 0 : e3;
52315 let t2 = function(e4) {
52317 return e4.ifd0.enabled && (t3 += 1024), e4.exif.enabled && (t3 += 2048), e4.makerNote && (t3 += 2048), e4.userComment && (t3 += 1024), e4.gps.enabled && (t3 += 512), e4.interop.enabled && (t3 += 100), e4.ifd1.enabled && (t3 += 1024), t3 + 2048;
52319 return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
52321 var C = (e3) => String.fromCharCode.apply(null, e3);
52322 var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
52324 return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
52327 static from(e3, t2) {
52328 return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
52330 constructor(e3, t2 = 0, i3, n3) {
52331 if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3)
52332 this.byteOffset = 0, this.byteLength = 0;
52333 else if (e3 instanceof ArrayBuffer) {
52334 void 0 === i3 && (i3 = e3.byteLength - t2);
52335 let n4 = new DataView(e3, t2, i3);
52336 this._swapDataView(n4);
52337 } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
52338 void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
52339 let n4 = new DataView(e3.buffer, t2, i3);
52340 this._swapDataView(n4);
52341 } else if ("number" == typeof e3) {
52342 let t3 = new DataView(new ArrayBuffer(e3));
52343 this._swapDataView(t3);
52345 g2("Invalid input argument for BufferView: " + e3);
52347 _swapArrayBuffer(e3) {
52348 this._swapDataView(new DataView(e3));
52351 this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
52353 _swapDataView(e3) {
52354 this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
52357 return this.byteLength - e3;
52359 set(e3, t2, i3 = _I) {
52360 return e3 instanceof DataView || e3 instanceof _I ? e3 = new Uint8Array(e3.buffer, e3.byteOffset, e3.byteLength) : e3 instanceof ArrayBuffer && (e3 = new Uint8Array(e3)), e3 instanceof Uint8Array || g2("BufferView.set(): Invalid data argument."), this.toUint8().set(e3, t2), new i3(this, t2, e3.byteLength);
52363 return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
52366 return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
52368 getUint8Array(e3, t2) {
52369 return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
52371 getString(e3 = 0, t2 = this.byteLength) {
52372 return b(this.getUint8Array(e3, t2));
52374 getLatin1String(e3 = 0, t2 = this.byteLength) {
52375 let i3 = this.getUint8Array(e3, t2);
52378 getUnicodeString(e3 = 0, t2 = this.byteLength) {
52380 for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2)
52381 i3.push(this.getUint16(e3 + n3));
52385 return this.dataView.getInt8(e3);
52388 return this.dataView.getUint8(e3);
52390 getInt16(e3, t2 = this.le) {
52391 return this.dataView.getInt16(e3, t2);
52393 getInt32(e3, t2 = this.le) {
52394 return this.dataView.getInt32(e3, t2);
52396 getUint16(e3, t2 = this.le) {
52397 return this.dataView.getUint16(e3, t2);
52399 getUint32(e3, t2 = this.le) {
52400 return this.dataView.getUint32(e3, t2);
52402 getFloat32(e3, t2 = this.le) {
52403 return this.dataView.getFloat32(e3, t2);
52405 getFloat64(e3, t2 = this.le) {
52406 return this.dataView.getFloat64(e3, t2);
52408 getFloat(e3, t2 = this.le) {
52409 return this.dataView.getFloat32(e3, t2);
52411 getDouble(e3, t2 = this.le) {
52412 return this.dataView.getFloat64(e3, t2);
52414 getUintBytes(e3, t2, i3) {
52417 return this.getUint8(e3, i3);
52419 return this.getUint16(e3, i3);
52421 return this.getUint32(e3, i3);
52423 return this.getUint64 && this.getUint64(e3, i3);
52426 getUint(e3, t2, i3) {
52429 return this.getUint8(e3, i3);
52431 return this.getUint16(e3, i3);
52433 return this.getUint32(e3, i3);
52435 return this.getUint64 && this.getUint64(e3, i3);
52439 return this.dataView.toString(e3, this.constructor.name);
52444 function P(e3, t2) {
52445 g2("".concat(e3, " '").concat(t2, "' was not loaded, try using full build of exifr."));
52447 var k = class extends Map {
52449 super(), this.kind = e3;
52452 return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
52453 g2("Unknown ".concat(e4, " '").concat(t3, "'."));
52454 }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
52457 return Array.from(this.keys());
52460 var w = new k("file parser");
52461 var T = new k("segment parser");
52462 var A = new k("file reader");
52463 function D(e3, n3) {
52464 return "string" == typeof e3 ? O(e3, n3) : t && !i2 && e3 instanceof HTMLImageElement ? O(e3.src, n3) : e3 instanceof Uint8Array || e3 instanceof ArrayBuffer || e3 instanceof DataView ? new I(e3) : t && e3 instanceof Blob ? x(e3, n3, "blob", R) : void g2("Invalid input argument");
52466 function O(e3, i3) {
52467 return (s2 = e3).startsWith("data:") || s2.length > 1e4 ? v(e3, i3, "base64") : n2 && e3.includes("://") ? x(e3, i3, "url", M) : n2 ? v(e3, i3, "fs") : t ? x(e3, i3, "url", M) : void g2("Invalid input argument");
52470 async function x(e3, t2, i3, n3) {
52471 return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
52472 let i4 = await t3(e4);
52474 }(e3, n3) : void g2("Parser ".concat(i3, " is not loaded"));
52476 async function v(e3, t2, i3) {
52477 let n3 = new (A.get(i3))(e3, t2);
52478 return await n3.read(), n3;
52480 var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
52481 var R = (e3) => new Promise((t2, i3) => {
52482 let n3 = new FileReader();
52483 n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
52485 var L = class extends Map {
52487 return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
52490 return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
52493 function U(e3, t2, i3) {
52495 for (let [e4, t3] of i3)
52497 if (Array.isArray(t2))
52504 function F(e3, t2, i3) {
52505 let n3, s2 = e3.get(t2);
52507 s2.set(n3[0], n3[1]);
52509 var E = /* @__PURE__ */ new Map();
52510 var B = /* @__PURE__ */ new Map();
52511 var N = /* @__PURE__ */ new Map();
52512 var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
52513 var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
52514 var z = ["tiff", ...V];
52515 var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
52516 var j = [...z, ...H];
52517 var W = ["makerNote", "userComment"];
52518 var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
52519 var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
52522 return this.translateKeys || this.translateValues || this.reviveValues;
52525 var Y = class extends _ {
52527 return this.enabled || this.deps.size > 0;
52529 constructor(e3, t2, i3, n3) {
52530 if (super(), c(this, "enabled", false), c(this, "skip", /* @__PURE__ */ new Set()), c(this, "pick", /* @__PURE__ */ new Set()), c(this, "deps", /* @__PURE__ */ new Set()), c(this, "translateKeys", false), c(this, "translateValues", false), c(this, "reviveValues", false), this.key = e3, this.enabled = t2, this.parse = this.enabled, this.applyInheritables(n3), this.canBeFiltered = H.includes(e3), this.canBeFiltered && (this.dict = E.get(e3)), void 0 !== i3)
52531 if (Array.isArray(i3))
52532 this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
52533 else if ("object" == typeof i3) {
52534 if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
52535 let { pick: e4, skip: t3 } = i3;
52536 e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
52538 this.applyInheritables(i3);
52540 true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2("Invalid options argument: ".concat(i3));
52542 applyInheritables(e3) {
52545 i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
52547 translateTagSet(e3, t2) {
52549 let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
52551 "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
52556 finalizeFilters() {
52557 !this.enabled && this.deps.size > 0 ? (this.enabled = true, ee(this.pick, this.deps)) : this.enabled && this.pick.size > 0 && ee(this.pick, this.deps);
52560 var $2 = { jfif: false, tiff: true, xmp: false, icc: false, iptc: false, ifd0: true, ifd1: false, exif: true, gps: true, interop: false, ihdr: void 0, makerNote: false, userComment: false, multiSegment: false, skip: [], pick: [], translateKeys: true, translateValues: true, reviveValues: true, sanitize: true, mergeOutput: true, silentErrors: true, chunked: true, firstChunkSize: void 0, firstChunkSizeNode: 512, firstChunkSizeBrowser: 65536, chunkSize: 65536, chunkLimit: 5 };
52561 var J = /* @__PURE__ */ new Map();
52562 var q = class extends _ {
52563 static useCached(e3) {
52564 let t2 = J.get(e3);
52565 return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
52568 super(), true === e3 ? this.setupFromTrue() : void 0 === e3 ? this.setupFromUndefined() : Array.isArray(e3) ? this.setupFromArray(e3) : "object" == typeof e3 ? this.setupFromObject(e3) : g2("Invalid options argument ".concat(e3)), void 0 === this.firstChunkSize && (this.firstChunkSize = t ? this.firstChunkSizeBrowser : this.firstChunkSizeNode), this.mergeOutput && (this.ifd1.enabled = false), this.filterNestedSegmentTags(), this.traverseTiffDependencyTree(), this.checkLoadedPlugins();
52570 setupFromUndefined() {
52579 this[e3] = new Y(e3, $2[e3], void 0, this);
52590 this[e3] = new Y(e3, true, void 0, this);
52592 setupFromArray(e3) {
52601 this[t2] = new Y(t2, false, void 0, this);
52602 this.setupGlobalFilters(e3, void 0, H);
52604 setupFromObject(e3) {
52606 for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G))
52607 this[t2] = Z(e3[t2], $2[t2]);
52609 this[t2] = Z(e3[t2], $2[t2]);
52611 this[t2] = Z(e3[t2], $2[t2]);
52613 this[t2] = new Y(t2, $2[t2], e3[t2], this);
52615 this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
52616 this.setupGlobalFilters(e3.pick, e3.skip, H, j), true === e3.tiff ? this.batchEnableWithBool(H, true) : false === e3.tiff ? this.batchEnableWithUserValue(H, e3) : Array.isArray(e3.tiff) ? this.setupGlobalFilters(e3.tiff, void 0, H) : "object" == typeof e3.tiff && this.setupGlobalFilters(e3.tiff.pick, e3.tiff.skip, H);
52618 batchEnableWithBool(e3, t2) {
52620 this[i3].enabled = t2;
52622 batchEnableWithUserValue(e3, t2) {
52623 for (let i3 of e3) {
52625 this[i3].enabled = false !== e4 && void 0 !== e4;
52628 setupGlobalFilters(e3, t2, i3, n3 = i3) {
52629 if (e3 && e3.length) {
52631 this[e4].enabled = false;
52632 let t3 = Q(e3, i3);
52633 for (let [e4, i4] of t3)
52634 ee(this[e4].pick, i4), this[e4].enabled = true;
52635 } else if (t2 && t2.length) {
52636 let e4 = Q(t2, i3);
52637 for (let [t3, i4] of e4)
52638 ee(this[t3].skip, i4);
52641 filterNestedSegmentTags() {
52642 let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
52643 this.makerNote ? t2.deps.add(37500) : t2.skip.add(37500), this.userComment ? t2.deps.add(37510) : t2.skip.add(37510), i3.enabled || e3.skip.add(700), n3.enabled || e3.skip.add(33723), s2.enabled || e3.skip.add(34675);
52645 traverseTiffDependencyTree() {
52646 let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
52647 n3.needed && (t2.deps.add(40965), e3.deps.add(40965)), t2.needed && e3.deps.add(34665), i3.needed && e3.deps.add(34853), this.tiff.enabled = H.some((e4) => true === this[e4].enabled) || this.makerNote || this.userComment;
52649 this[e4].finalizeFilters();
52652 return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
52654 checkLoadedPlugins() {
52656 this[e3].enabled && !T.has(e3) && P("segment parser", e3);
52659 function Q(e3, t2) {
52660 let i3, n3, s2, r2, a2 = [];
52662 for (r2 of (i3 = E.get(s2), n3 = [], i3))
52663 (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
52664 n3.length && a2.push([s2, n3]);
52668 function Z(e3, t2) {
52669 return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
52671 function ee(e3, t2) {
52675 c(q, "default", $2);
52678 c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
52681 this.file = await D(e3, this.options);
52684 if (this.fileParser)
52686 let { file: e3 } = this, t2 = e3.getUint16(0);
52687 for (let [i3, n3] of w)
52688 if (n3.canHandle(e3, t2))
52689 return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
52690 this.file.close && this.file.close(), g2("Unknown file format");
52693 let { output: e3, errors: t2 } = this;
52694 return this.setup(), this.options.silentErrors ? (await this.executeParsers().catch(this.pushToErrors), t2.push(...this.fileParser.errors)) : await this.executeParsers(), this.file.close && this.file.close(), this.options.silentErrors && t2.length > 0 && (e3.errors = t2), f(e3);
52696 async executeParsers() {
52697 let { output: e3 } = this;
52698 await this.fileParser.parse();
52699 let t2 = Object.values(this.parsers).map(async (t3) => {
52700 let i3 = await t3.parse();
52701 t3.assignToOutput(e3, i3);
52703 this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
52705 async extractThumbnail() {
52707 let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
52709 if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3)
52711 let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
52712 return t2.close && t2.close(), a2;
52715 async function ie(e3, t2) {
52716 let i3 = new te(t2);
52717 return await i3.read(e3), i3.parse();
52719 var ne = Object.freeze({ __proto__: null, parse: ie, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q });
52721 constructor(e3, t2, i3) {
52722 c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
52723 let t3 = e4.start, i4 = e4.size || 65536;
52724 if (this.file.chunked)
52725 if (this.file.available(t3, i4))
52726 e4.chunk = this.file.subarray(t3, i4);
52729 e4.chunk = await this.file.readChunk(t3, i4);
52731 g2("Couldn't read segment: ".concat(JSON.stringify(e4), ". ").concat(t4.message));
52734 this.file.byteLength > t3 + i4 ? e4.chunk = this.file.subarray(t3, i4) : void 0 === e4.size ? e4.chunk = this.file.subarray(t3) : g2("Segment unreachable: " + JSON.stringify(e4));
52736 }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
52738 injectSegment(e3, t2) {
52739 this.options[e3].enabled && this.createParser(e3, t2);
52741 createParser(e3, t2) {
52742 let i3 = new (T.get(e3))(t2, this.options, this.file);
52743 return this.parsers[e3] = i3;
52745 createParsers(e3) {
52746 for (let t2 of e3) {
52747 let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
52748 if (n3 && n3.enabled) {
52749 let t3 = this.parsers[e4];
52750 t3 && t3.append || t3 || this.createParser(e4, i3);
52754 async readSegments(e3) {
52755 let t2 = e3.map(this.ensureSegmentChunk);
52756 await Promise.all(t2);
52760 static findPosition(e3, t2) {
52761 let i3 = e3.getUint16(t2 + 2) + 2, n3 = "function" == typeof this.headerLength ? this.headerLength(e3, t2, i3) : this.headerLength, s2 = t2 + n3, r2 = i3 - n3;
52762 return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
52764 static parse(e3, t2 = {}) {
52765 return new this(e3, new q({ [this.type]: t2 }), e3).parse();
52767 normalizeInput(e3) {
52768 return e3 instanceof I ? e3 : new I(e3);
52770 constructor(e3, t2 = {}, i3) {
52771 c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
52772 if (!this.options.silentErrors)
52774 this.errors.push(e4.message);
52775 }), this.chunk = this.normalizeInput(e3), this.file = i3, this.type = this.constructor.type, this.globalOptions = this.options = t2, this.localOptions = t2[this.type], this.canTranslate = this.localOptions && this.localOptions.translate;
52778 this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
52781 return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
52783 translateBlock(e3, t2) {
52784 let i3 = N.get(t2), n3 = B.get(t2), s2 = E.get(t2), r2 = this.options[t2], a2 = r2.reviveValues && !!i3, o2 = r2.translateValues && !!n3, l2 = r2.translateKeys && !!s2, h2 = {};
52785 for (let [t3, r3] of e3)
52786 a2 && i3.has(t3) ? r3 = i3.get(t3)(r3) : o2 && n3.has(t3) && (r3 = this.translateValue(r3, n3.get(t3))), l2 && s2.has(t3) && (t3 = s2.get(t3) || t3), h2[t3] = r3;
52789 translateValue(e3, t2) {
52790 return t2[e3] || t2.DEFAULT || e3;
52792 assignToOutput(e3, t2) {
52793 this.assignObjectToOutput(e3, this.constructor.type, t2);
52795 assignObjectToOutput(e3, t2, i3) {
52796 if (this.globalOptions.mergeOutput)
52797 return Object.assign(e3, i3);
52798 e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
52801 c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
52803 return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
52806 return e3 >= 224 && e3 <= 239;
52808 function le(e3, t2, i3) {
52809 for (let [n3, s2] of T)
52810 if (s2.canHandle(e3, t2, i3))
52813 var he = class extends se {
52814 constructor(...e3) {
52815 super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
52817 static canHandle(e3, t2) {
52818 return 65496 === t2;
52821 await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
52823 setupSegmentFinderArgs(e3) {
52824 true === e3 ? (this.findAll = true, this.wanted = new Set(T.keyList())) : (e3 = void 0 === e3 ? T.keyList().filter((e4) => this.options[e4].enabled) : e3.filter((e4) => this.options[e4].enabled && T.has(e4)), this.findAll = false, this.remaining = new Set(e3), this.wanted = new Set(e3)), this.unfinishedMultiSegment = false;
52826 async findAppSegments(e3 = 0, t2) {
52827 this.setupSegmentFinderArgs(t2);
52828 let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
52829 if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
52830 let t3 = T.get(e4), i4 = this.options[e4];
52831 return t3.multiSegment && i4.multiSegment;
52832 }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
52834 for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
52835 let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
52836 if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength)))
52841 findAppSegmentsInRange(e3, t2) {
52843 let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f2 } = this;
52844 for (; e3 < t2; e3++)
52845 if (255 === l2.getUint8(e3)) {
52846 if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
52847 if (n3 = l2.getUint16(e3 + 2), s2 = le(l2, e3, n3), s2 && u2.has(s2) && (r2 = T.get(s2), a2 = r2.findPosition(l2, e3), o2 = f2[s2], a2.type = s2, this.appSegments.push(a2), !h2 && (r2.multiSegment && o2.multiSegment ? (this.unfinishedMultiSegment = a2.chunkNumber < a2.chunkCount, this.unfinishedMultiSegment || c2.delete(s2)) : c2.delete(s2), 0 === c2.size)))
52849 f2.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
52850 } else if (ae(i3)) {
52851 if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos)
52853 f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
52858 mergeMultiSegments() {
52859 if (!this.appSegments.some((e4) => e4.multiSegment))
52861 let e3 = function(e4, t2) {
52862 let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
52863 for (let a2 = 0; a2 < e4.length; a2++)
52864 i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
52865 return Array.from(r2);
52866 }(this.appSegments, "type");
52867 this.mergedAppSegments = e3.map(([e4, t2]) => {
52868 let i3 = T.get(e4, this.options);
52869 if (i3.handleMultiSegments) {
52870 return { type: e4, chunk: i3.handleMultiSegments(t2) };
52876 return this.appSegments.find((t2) => t2.type === e3);
52878 async getOrFindSegment(e3) {
52879 let t2 = this.getSegment(e3);
52880 return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
52883 c(he, "type", "jpeg"), w.set("jpeg", he);
52884 var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
52885 var ce = class extends re2 {
52887 var e3 = this.chunk.getUint16();
52888 18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
52890 parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
52891 let { pick: n3, skip: s2 } = this.options[t2];
52893 let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
52895 for (let l2 = 0; l2 < o2; l2++) {
52896 let o3 = this.chunk.getUint16(e3);
52898 if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size))
52901 !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
52906 parseTag(e3, t2, i3) {
52907 let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
52908 if (a2 * r2 <= 4 ? e3 += 8 : e3 = n3.getUint32(e3 + 8), (s2 < 1 || s2 > 13) && g2("Invalid TIFF value type. block: ".concat(i3.toUpperCase(), ", tag: ").concat(t2.toString(16), ", type: ").concat(s2, ", offset ").concat(e3)), e3 > n3.byteLength && g2("Invalid TIFF value offset. block: ".concat(i3.toUpperCase(), ", tag: ").concat(t2.toString(16), ", type: ").concat(s2, ", offset ").concat(e3, " is outside of chunk size ").concat(n3.byteLength)), 1 === s2)
52909 return n3.getUint8Array(e3, r2);
52911 return m(n3.getString(e3, r2));
52913 return n3.getUint8Array(e3, r2);
52915 return this.parseTagValue(s2, e3);
52917 let t3 = new (function(e4) {
52922 return Uint16Array;
52924 return Uint32Array;
52936 return Float32Array;
52938 return Float64Array;
52942 }(s2))(r2), i4 = a2;
52943 for (let n4 = 0; n4 < r2; n4++)
52944 t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
52948 parseTagValue(e3, t2) {
52949 let { chunk: i3 } = this;
52952 return i3.getUint8(t2);
52954 return i3.getUint16(t2);
52956 return i3.getUint32(t2);
52958 return i3.getUint32(t2) / i3.getUint32(t2 + 4);
52960 return i3.getInt8(t2);
52962 return i3.getInt16(t2);
52964 return i3.getInt32(t2);
52966 return i3.getInt32(t2) / i3.getInt32(t2 + 4);
52968 return i3.getFloat(t2);
52970 return i3.getDouble(t2);
52972 return i3.getUint32(t2);
52974 g2("Invalid tiff type ".concat(e3));
52978 var fe = class extends ce {
52979 static canHandle(e3, t2) {
52980 return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
52983 this.parseHeader();
52984 let { options: e3 } = this;
52985 return e3.ifd0.enabled && await this.parseIfd0Block(), e3.exif.enabled && await this.safeParse("parseExifBlock"), e3.gps.enabled && await this.safeParse("parseGpsBlock"), e3.interop.enabled && await this.safeParse("parseInteropBlock"), e3.ifd1.enabled && await this.safeParse("parseThumbnailBlock"), this.createOutput();
52988 let t2 = this[e3]();
52989 return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
52992 void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
52995 if (void 0 === this.ifd1Offset) {
52996 this.findIfd0Offset();
52997 let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
52998 this.ifd1Offset = this.chunk.getUint32(t2);
53001 parseBlock(e3, t2) {
53002 let i3 = /* @__PURE__ */ new Map();
53003 return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
53005 async parseIfd0Block() {
53008 let { file: e3 } = this;
53009 this.findIfd0Offset(), this.ifd0Offset < 8 && g2("Malformed EXIF data"), !e3.chunked && this.ifd0Offset > e3.byteLength && g2("IFD0 offset points to outside of file.\nthis.ifd0Offset: ".concat(this.ifd0Offset, ", file.byteLength: ").concat(e3.byteLength)), e3.tiff && await e3.ensureChunk(this.ifd0Offset, S(this.options));
53010 let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
53011 return 0 !== t2.size ? (this.exifOffset = t2.get(34665), this.interopOffset = t2.get(40965), this.gpsOffset = t2.get(34853), this.xmp = t2.get(700), this.iptc = t2.get(33723), this.icc = t2.get(34675), this.options.sanitize && (t2.delete(34665), t2.delete(40965), t2.delete(34853), t2.delete(700), t2.delete(33723), t2.delete(34675)), t2) : void 0;
53013 async parseExifBlock() {
53016 if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset)
53018 this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
53019 let e3 = this.parseBlock(this.exifOffset, "exif");
53020 return this.interopOffset || (this.interopOffset = e3.get(40965)), this.makerNote = e3.get(37500), this.userComment = e3.get(37510), this.options.sanitize && (e3.delete(40965), e3.delete(37500), e3.delete(37510)), this.unpack(e3, 41728), this.unpack(e3, 41729), e3;
53023 let i3 = e3.get(t2);
53024 i3 && 1 === i3.length && e3.set(t2, i3[0]);
53026 async parseGpsBlock() {
53029 if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset)
53031 let e3 = this.parseBlock(this.gpsOffset, "gps");
53032 return e3 && e3.has(2) && e3.has(4) && (e3.set("latitude", de(...e3.get(2), e3.get(1))), e3.set("longitude", de(...e3.get(4), e3.get(3)))), e3;
53034 async parseInteropBlock() {
53035 if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset))
53036 return this.parseBlock(this.interopOffset, "interop");
53038 async parseThumbnailBlock(e3 = false) {
53039 if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3))
53040 return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
53042 async extractThumbnail() {
53043 if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1)
53045 let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
53046 return this.chunk.getUint8Array(e3, t2);
53055 let e3, t2, i3, n3 = {};
53057 if (e3 = this[t2], !p(e3))
53058 if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
53061 Object.assign(n3, i3);
53064 return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
53066 assignToOutput(e3, t2) {
53067 if (this.globalOptions.mergeOutput)
53068 Object.assign(e3, t2);
53070 for (let [i3, n3] of Object.entries(t2))
53071 this.assignObjectToOutput(e3, i3, n3);
53074 function de(e3, t2, i3, n3) {
53075 var s2 = e3 + t2 / 60 + i3 / 3600;
53076 return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
53078 c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
53079 var pe = Object.freeze({ __proto__: null, default: ne, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie });
53080 var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
53081 var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
53082 async function Se(e3) {
53083 let t2 = new te(me);
53085 let i3 = await t2.parse();
53086 if (i3 && i3.gps) {
53087 let { latitude: e4, longitude: t3 } = i3.gps;
53088 return { latitude: e4, longitude: t3 };
53091 var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
53092 async function ye(e3) {
53093 let t2 = new te(Ce);
53095 let i3 = await t2.extractThumbnail();
53096 return i3 && a ? s.from(i3) : i3;
53098 async function be(e3) {
53099 let t2 = await this.thumbnail(e3);
53100 if (void 0 !== t2) {
53101 let e4 = new Blob([t2]);
53102 return URL.createObjectURL(e4);
53105 var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
53106 async function Pe(e3) {
53107 let t2 = new te(Ie);
53109 let i3 = await t2.parse();
53111 return i3.ifd0[274];
53113 var ke = Object.freeze({ 1: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 0, rad: 0 }, 2: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 0, rad: 0 }, 3: { dimensionSwapped: false, scaleX: 1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 4: { dimensionSwapped: false, scaleX: -1, scaleY: 1, deg: 180, rad: 180 * Math.PI / 180 }, 5: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 90, rad: 90 * Math.PI / 180 }, 6: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 90, rad: 90 * Math.PI / 180 }, 7: { dimensionSwapped: true, scaleX: 1, scaleY: -1, deg: 270, rad: 270 * Math.PI / 180 }, 8: { dimensionSwapped: true, scaleX: 1, scaleY: 1, deg: 270, rad: 270 * Math.PI / 180 } });
53116 if ("object" == typeof navigator) {
53117 let e3 = navigator.userAgent;
53118 if (e3.includes("iPad") || e3.includes("iPhone")) {
53119 let t2 = e3.match(/OS (\d+)_(\d+)/);
53121 let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
53122 we = n3 < 13.4, Te = false;
53124 } else if (e3.includes("OS X 10")) {
53125 let [, t2] = e3.match(/OS X 10[_.](\d+)/);
53126 we = Te = Number(t2) < 15;
53128 if (e3.includes("Chrome/")) {
53129 let [, t2] = e3.match(/Chrome\/(\d+)/);
53130 we = Te = Number(t2) < 81;
53131 } else if (e3.includes("Firefox/")) {
53132 let [, t2] = e3.match(/Firefox\/(\d+)/);
53133 we = Te = Number(t2) < 77;
53136 async function Ae(e3) {
53137 let t2 = await Pe(e3);
53138 return Object.assign({ canvas: we, css: Te }, ke[t2]);
53140 var De = class extends I {
53141 constructor(...e3) {
53142 super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
53144 _tryExtend(e3, t2, i3) {
53145 if (0 === e3 && 0 === this.byteLength && i3) {
53146 let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
53147 this._swapDataView(e4);
53150 if (i4 > this.byteLength) {
53151 let { dataView: e4 } = this._extend(i4);
53152 this._swapDataView(e4);
53158 t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
53159 let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
53160 return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
53162 subarray(e3, t2, i3 = false) {
53163 return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
53165 set(e3, t2, i3 = false) {
53166 i3 && this._tryExtend(t2, e3.byteLength, e3);
53167 let n3 = super.set(e3, t2);
53168 return this.ranges.add(t2, n3.byteLength), n3;
53170 async ensureChunk(e3, t2) {
53171 this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
53173 available(e3, t2) {
53174 return this.ranges.available(e3, t2);
53179 c(this, "list", []);
53182 return this.list.length;
53184 add(e3, t2, i3 = 0) {
53185 let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
53186 if (s2.length > 0) {
53187 e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
53188 let i4 = s2.shift();
53189 i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
53191 this.list.push({ offset: e3, length: t2, end: n3 });
53193 available(e3, t2) {
53195 return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
53198 function xe(e3, t2, i3) {
53199 return e3 <= t2 && t2 <= i3;
53201 var ve = class extends De {
53202 constructor(e3, t2) {
53203 super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
53205 async readWhole() {
53206 this.chunked = false, await this.readChunk(this.nextChunkOffset);
53208 async readChunked() {
53209 this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
53211 async readNextChunk(e3 = this.nextChunkOffset) {
53212 if (this.fullyRead)
53213 return this.chunksRead++, false;
53214 let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
53215 return !!i3 && i3.byteLength === t2;
53217 async readChunk(e3, t2) {
53218 if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2)))
53219 return this._readChunk(e3, t2);
53221 safeWrapAddress(e3, t2) {
53222 return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
53224 get nextChunkOffset() {
53225 if (0 !== this.ranges.list.length)
53226 return this.ranges.list[0].length;
53228 get canReadNextChunk() {
53229 return this.chunksRead < this.options.chunkLimit;
53232 return void 0 !== this.size && this.nextChunkOffset === this.size;
53235 return this.options.chunked ? this.readChunked() : this.readWhole();
53240 A.set("blob", class extends ve {
53241 async readWhole() {
53242 this.chunked = false;
53243 let e3 = await R(this.input);
53244 this._swapArrayBuffer(e3);
53247 return this.chunked = true, this.size = this.input.size, super.readChunked();
53249 async _readChunk(e3, t2) {
53250 let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
53251 return this.set(s2, e3, true);
53254 var Me = Object.freeze({ __proto__: null, default: pe, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
53256 }, get rotateCss() {
53258 }, rotation: Ae });
53259 A.set("url", class extends ve {
53260 async readWhole() {
53261 this.chunked = false;
53262 let e3 = await M(this.input);
53263 e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
53265 async _readChunk(e3, t2) {
53266 let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
53267 (e3 || i3) && (n3.range = "bytes=".concat([e3, i3].join("-")));
53268 let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
53269 if (416 !== s2.status)
53270 return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
53273 I.prototype.getUint64 = function(e3) {
53274 let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
53275 return t2 < 1048575 ? t2 << 32 | i3 : void 0 !== typeof r ? (console.warn("Using BigInt because of type 64uint but JS can only handle 53b numbers."), r(t2) << r(32) | r(i3)) : void g2("Trying to read 64b value but JS can only handle 53b numbers.");
53277 var Re = class extends se {
53278 parseBoxes(e3 = 0) {
53280 for (; e3 < this.file.byteLength - 4; ) {
53281 let i3 = this.parseBoxHead(e3);
53282 if (t2.push(i3), 0 === i3.length)
53288 parseSubBoxes(e3) {
53289 e3.boxes = this.parseBoxes(e3.start);
53292 return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
53295 let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
53296 return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
53298 parseBoxFullHead(e3) {
53299 if (void 0 !== e3.version)
53301 let t2 = this.file.getUint32(e3.start);
53302 e3.version = t2 >> 24, e3.start += 4;
53305 var Le = class extends Re {
53306 static canHandle(e3, t2) {
53309 let i3 = e3.getUint16(2);
53312 let n3 = 16, s2 = [];
53314 s2.push(e3.getString(n3, 4)), n3 += 4;
53315 return s2.includes(this.type);
53318 let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
53319 for (; "meta" !== t2.kind; )
53320 e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
53321 await this.file.ensureChunk(t2.offset, t2.length), this.parseBoxFullHead(t2), this.parseSubBoxes(t2), this.options.icc.enabled && await this.findIcc(t2), this.options.tiff.enabled && await this.findExif(t2);
53323 async registerSegment(e3, t2, i3) {
53324 await this.file.ensureChunk(t2, i3);
53325 let n3 = this.file.subarray(t2, i3);
53326 this.createParser(e3, n3);
53328 async findIcc(e3) {
53329 let t2 = this.findBox(e3, "iprp");
53332 let i3 = this.findBox(t2, "ipco");
53335 let n3 = this.findBox(i3, "colr");
53336 void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
53338 async findExif(e3) {
53339 let t2 = this.findBox(e3, "iinf");
53342 let i3 = this.findBox(e3, "iloc");
53345 let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
53349 await this.file.ensureChunk(r2, a2);
53350 let o2 = 4 + this.file.getUint32(r2);
53351 r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
53353 findExifLocIdInIinf(e3) {
53354 this.parseBoxFullHead(e3);
53355 let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
53356 for (r2 += 2; a2--; ) {
53357 if (t2 = this.parseBoxHead(r2), this.parseBoxFullHead(t2), i3 = t2.start, t2.version >= 2 && (n3 = 3 === t2.version ? 4 : 2, s2 = this.file.getString(i3 + n3 + 2, 4), "Exif" === s2))
53358 return this.file.getUintBytes(i3, n3);
53363 let t2 = this.file.getUint8(e3);
53364 return [t2 >> 4, 15 & t2];
53366 findExtentInIloc(e3, t2) {
53367 this.parseBoxFullHead(e3);
53368 let i3 = e3.start, [n3, s2] = this.get8bits(i3++), [r2, a2] = this.get8bits(i3++), o2 = 2 === e3.version ? 4 : 2, l2 = 1 === e3.version || 2 === e3.version ? 2 : 0, h2 = a2 + n3 + s2, u2 = 2 === e3.version ? 4 : 2, c2 = this.file.getUintBytes(i3, u2);
53369 for (i3 += u2; c2--; ) {
53370 let e4 = this.file.getUintBytes(i3, o2);
53371 i3 += o2 + l2 + 2 + r2;
53372 let u3 = this.file.getUint16(i3);
53373 if (i3 += 2, e4 === t2)
53374 return u3 > 1 && console.warn("ILOC box has more than one extent but we're only processing one\nPlease create an issue at https://github.com/MikeKovarik/exifr with this file"), [this.file.getUintBytes(i3 + a2, n3), this.file.getUintBytes(i3 + a2 + n3, s2)];
53379 var Ue = class extends Le {
53381 c(Ue, "type", "heic");
53382 var Fe = class extends Le {
53384 c(Fe, "type", "avif"), w.set("heic", Ue), w.set("avif", Fe), U(E, ["ifd0", "ifd1"], [[256, "ImageWidth"], [257, "ImageHeight"], [258, "BitsPerSample"], [259, "Compression"], [262, "PhotometricInterpretation"], [270, "ImageDescription"], [271, "Make"], [272, "Model"], [273, "StripOffsets"], [274, "Orientation"], [277, "SamplesPerPixel"], [278, "RowsPerStrip"], [279, "StripByteCounts"], [282, "XResolution"], [283, "YResolution"], [284, "PlanarConfiguration"], [296, "ResolutionUnit"], [301, "TransferFunction"], [305, "Software"], [306, "ModifyDate"], [315, "Artist"], [316, "HostComputer"], [317, "Predictor"], [318, "WhitePoint"], [319, "PrimaryChromaticities"], [513, "ThumbnailOffset"], [514, "ThumbnailLength"], [529, "YCbCrCoefficients"], [530, "YCbCrSubSampling"], [531, "YCbCrPositioning"], [532, "ReferenceBlackWhite"], [700, "ApplicationNotes"], [33432, "Copyright"], [33723, "IPTC"], [34665, "ExifIFD"], [34675, "ICC"], [34853, "GpsIFD"], [330, "SubIFD"], [40965, "InteropIFD"], [40091, "XPTitle"], [40092, "XPComment"], [40093, "XPAuthor"], [40094, "XPKeywords"], [40095, "XPSubject"]]), U(E, "exif", [[33434, "ExposureTime"], [33437, "FNumber"], [34850, "ExposureProgram"], [34852, "SpectralSensitivity"], [34855, "ISO"], [34858, "TimeZoneOffset"], [34859, "SelfTimerMode"], [34864, "SensitivityType"], [34865, "StandardOutputSensitivity"], [34866, "RecommendedExposureIndex"], [34867, "ISOSpeed"], [34868, "ISOSpeedLatitudeyyy"], [34869, "ISOSpeedLatitudezzz"], [36864, "ExifVersion"], [36867, "DateTimeOriginal"], [36868, "CreateDate"], [36873, "GooglePlusUploadCode"], [36880, "OffsetTime"], [36881, "OffsetTimeOriginal"], [36882, "OffsetTimeDigitized"], [37121, "ComponentsConfiguration"], [37122, "CompressedBitsPerPixel"], [37377, "ShutterSpeedValue"], [37378, "ApertureValue"], [37379, "BrightnessValue"], [37380, "ExposureCompensation"], [37381, "MaxApertureValue"], [37382, "SubjectDistance"], [37383, "MeteringMode"], [37384, "LightSource"], [37385, "Flash"], [37386, "FocalLength"], [37393, "ImageNumber"], [37394, "SecurityClassification"], [37395, "ImageHistory"], [37396, "SubjectArea"], [37500, "MakerNote"], [37510, "UserComment"], [37520, "SubSecTime"], [37521, "SubSecTimeOriginal"], [37522, "SubSecTimeDigitized"], [37888, "AmbientTemperature"], [37889, "Humidity"], [37890, "Pressure"], [37891, "WaterDepth"], [37892, "Acceleration"], [37893, "CameraElevationAngle"], [40960, "FlashpixVersion"], [40961, "ColorSpace"], [40962, "ExifImageWidth"], [40963, "ExifImageHeight"], [40964, "RelatedSoundFile"], [41483, "FlashEnergy"], [41486, "FocalPlaneXResolution"], [41487, "FocalPlaneYResolution"], [41488, "FocalPlaneResolutionUnit"], [41492, "SubjectLocation"], [41493, "ExposureIndex"], [41495, "SensingMethod"], [41728, "FileSource"], [41729, "SceneType"], [41730, "CFAPattern"], [41985, "CustomRendered"], [41986, "ExposureMode"], [41987, "WhiteBalance"], [41988, "DigitalZoomRatio"], [41989, "FocalLengthIn35mmFormat"], [41990, "SceneCaptureType"], [41991, "GainControl"], [41992, "Contrast"], [41993, "Saturation"], [41994, "Sharpness"], [41996, "SubjectDistanceRange"], [42016, "ImageUniqueID"], [42032, "OwnerName"], [42033, "SerialNumber"], [42034, "LensInfo"], [42035, "LensMake"], [42036, "LensModel"], [42037, "LensSerialNumber"], [42080, "CompositeImage"], [42081, "CompositeImageCount"], [42082, "CompositeImageExposureTimes"], [42240, "Gamma"], [59932, "Padding"], [59933, "OffsetSchema"], [65e3, "OwnerName"], [65001, "SerialNumber"], [65002, "Lens"], [65100, "RawFile"], [65101, "Converter"], [65102, "WhiteBalance"], [65105, "Exposure"], [65106, "Shadows"], [65107, "Brightness"], [65108, "Contrast"], [65109, "Saturation"], [65110, "Sharpness"], [65111, "Smoothness"], [65112, "MoireFilter"], [40965, "InteropIFD"]]), U(E, "gps", [[0, "GPSVersionID"], [1, "GPSLatitudeRef"], [2, "GPSLatitude"], [3, "GPSLongitudeRef"], [4, "GPSLongitude"], [5, "GPSAltitudeRef"], [6, "GPSAltitude"], [7, "GPSTimeStamp"], [8, "GPSSatellites"], [9, "GPSStatus"], [10, "GPSMeasureMode"], [11, "GPSDOP"], [12, "GPSSpeedRef"], [13, "GPSSpeed"], [14, "GPSTrackRef"], [15, "GPSTrack"], [16, "GPSImgDirectionRef"], [17, "GPSImgDirection"], [18, "GPSMapDatum"], [19, "GPSDestLatitudeRef"], [20, "GPSDestLatitude"], [21, "GPSDestLongitudeRef"], [22, "GPSDestLongitude"], [23, "GPSDestBearingRef"], [24, "GPSDestBearing"], [25, "GPSDestDistanceRef"], [26, "GPSDestDistance"], [27, "GPSProcessingMethod"], [28, "GPSAreaInformation"], [29, "GPSDateStamp"], [30, "GPSDifferential"], [31, "GPSHPositioningError"]]), U(B, ["ifd0", "ifd1"], [[274, { 1: "Horizontal (normal)", 2: "Mirror horizontal", 3: "Rotate 180", 4: "Mirror vertical", 5: "Mirror horizontal and rotate 270 CW", 6: "Rotate 90 CW", 7: "Mirror horizontal and rotate 90 CW", 8: "Rotate 270 CW" }], [296, { 1: "None", 2: "inches", 3: "cm" }]]);
53385 var Ee = U(B, "exif", [[34850, { 0: "Not defined", 1: "Manual", 2: "Normal program", 3: "Aperture priority", 4: "Shutter priority", 5: "Creative program", 6: "Action program", 7: "Portrait mode", 8: "Landscape mode" }], [37121, { 0: "-", 1: "Y", 2: "Cb", 3: "Cr", 4: "R", 5: "G", 6: "B" }], [37383, { 0: "Unknown", 1: "Average", 2: "CenterWeightedAverage", 3: "Spot", 4: "MultiSpot", 5: "Pattern", 6: "Partial", 255: "Other" }], [37384, { 0: "Unknown", 1: "Daylight", 2: "Fluorescent", 3: "Tungsten (incandescent light)", 4: "Flash", 9: "Fine weather", 10: "Cloudy weather", 11: "Shade", 12: "Daylight fluorescent (D 5700 - 7100K)", 13: "Day white fluorescent (N 4600 - 5400K)", 14: "Cool white fluorescent (W 3900 - 4500K)", 15: "White fluorescent (WW 3200 - 3700K)", 17: "Standard light A", 18: "Standard light B", 19: "Standard light C", 20: "D55", 21: "D65", 22: "D75", 23: "D50", 24: "ISO studio tungsten", 255: "Other" }], [37385, { 0: "Flash did not fire", 1: "Flash fired", 5: "Strobe return light not detected", 7: "Strobe return light detected", 9: "Flash fired, compulsory flash mode", 13: "Flash fired, compulsory flash mode, return light not detected", 15: "Flash fired, compulsory flash mode, return light detected", 16: "Flash did not fire, compulsory flash mode", 24: "Flash did not fire, auto mode", 25: "Flash fired, auto mode", 29: "Flash fired, auto mode, return light not detected", 31: "Flash fired, auto mode, return light detected", 32: "No flash function", 65: "Flash fired, red-eye reduction mode", 69: "Flash fired, red-eye reduction mode, return light not detected", 71: "Flash fired, red-eye reduction mode, return light detected", 73: "Flash fired, compulsory flash mode, red-eye reduction mode", 77: "Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected", 79: "Flash fired, compulsory flash mode, red-eye reduction mode, return light detected", 89: "Flash fired, auto mode, red-eye reduction mode", 93: "Flash fired, auto mode, return light not detected, red-eye reduction mode", 95: "Flash fired, auto mode, return light detected, red-eye reduction mode" }], [41495, { 1: "Not defined", 2: "One-chip color area sensor", 3: "Two-chip color area sensor", 4: "Three-chip color area sensor", 5: "Color sequential area sensor", 7: "Trilinear sensor", 8: "Color sequential linear sensor" }], [41728, { 1: "Film Scanner", 2: "Reflection Print Scanner", 3: "Digital Camera" }], [41729, { 1: "Directly photographed" }], [41985, { 0: "Normal", 1: "Custom", 2: "HDR (no original saved)", 3: "HDR (original saved)", 4: "Original (for HDR)", 6: "Panorama", 7: "Portrait HDR", 8: "Portrait" }], [41986, { 0: "Auto", 1: "Manual", 2: "Auto bracket" }], [41987, { 0: "Auto", 1: "Manual" }], [41990, { 0: "Standard", 1: "Landscape", 2: "Portrait", 3: "Night", 4: "Other" }], [41991, { 0: "None", 1: "Low gain up", 2: "High gain up", 3: "Low gain down", 4: "High gain down" }], [41996, { 0: "Unknown", 1: "Macro", 2: "Close", 3: "Distant" }], [42080, { 0: "Unknown", 1: "Not a Composite Image", 2: "General Composite Image", 3: "Composite Image Captured While Shooting" }]]);
53386 var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
53387 Ee.set(37392, Be), Ee.set(41488, Be);
53388 var Ne = { 0: "Normal", 1: "Low", 2: "High" };
53390 return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
53393 let t2 = Array.from(e3).slice(1);
53394 return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
53397 if ("string" == typeof e3) {
53398 var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
53399 return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
53403 if ("string" == typeof e3)
53406 if (0 === e3[1] && 0 === e3[e3.length - 1])
53407 for (let i3 = 0; i3 < e3.length; i3 += 2)
53408 t2.push(je(e3[i3 + 1], e3[i3]));
53410 for (let i3 = 0; i3 < e3.length; i3 += 2)
53411 t2.push(je(e3[i3], e3[i3 + 1]));
53412 return m(String.fromCodePoint(...t2));
53414 function je(e3, t2) {
53415 return e3 << 8 | t2;
53417 Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
53418 return "string" != typeof e3 ? b(e3) : e3;
53419 }], [306, ze], [40091, He], [40092, He], [40093, He], [40094, He], [40095, He]]), U(N, "exif", [[40960, Ve], [36864, Ve], [36867, ze], [36868, ze], [40962, Ge], [40963, Ge]]), U(N, "gps", [[0, (e3) => Array.from(e3).join(".")], [7, (e3) => Array.from(e3).join(":")]]);
53420 var We = class extends re2 {
53421 static canHandle(e3, t2) {
53422 return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
53424 static headerLength(e3, t2) {
53425 return "http://ns.adobe.com/xmp/extension/" === e3.getString(t2 + 4, "http://ns.adobe.com/xmp/extension/".length) ? 79 : 4 + "http://ns.adobe.com/xap/1.0/".length + 1;
53427 static findPosition(e3, t2) {
53428 let i3 = super.findPosition(e3, t2);
53429 return i3.multiSegment = i3.extended = 79 === i3.headerLength, i3.multiSegment ? (i3.chunkCount = e3.getUint8(t2 + 72), i3.chunkNumber = e3.getUint8(t2 + 76), 0 !== e3.getUint8(t2 + 77) && i3.chunkNumber++) : (i3.chunkCount = 1 / 0, i3.chunkNumber = -1), i3;
53431 static handleMultiSegments(e3) {
53432 return e3.map((e4) => e4.chunk.getString()).join("");
53434 normalizeInput(e3) {
53435 return "string" == typeof e3 ? e3 : I.from(e3).getString();
53437 parse(e3 = this.chunk) {
53438 if (!this.localOptions.parse)
53440 e3 = function(e4) {
53441 let t3 = {}, i4 = {};
53443 t3[e6] = [], i4[e6] = 0;
53444 return e4.replace(et, (e6, n4, s2) => {
53447 return t3[s2].push(n5), "".concat(e6, "#").concat(n5);
53449 return "".concat(e6, "#").concat(t3[s2].pop());
53452 let t2 = Xe.findAll(e3, "rdf", "Description");
53453 0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
53456 for (let t3 of e4.properties)
53457 i3 = Je(t3.ns, n3), _e(t3, i3);
53458 return function(e4) {
53461 t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
53465 assignToOutput(e3, t2) {
53466 if (this.localOptions.parse)
53467 for (let [i3, n3] of Object.entries(t2))
53470 this.assignObjectToOutput(e3, "ifd0", n3);
53473 this.assignObjectToOutput(e3, "exif", n3);
53478 this.assignObjectToOutput(e3, i3, n3);
53484 c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
53485 var Ke = class _Ke {
53486 static findAll(e3) {
53487 return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
53489 static unpackMatch(e3) {
53490 let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
53491 return n3 = Qe(n3), new _Ke(t2, i3, n3);
53493 constructor(e3, t2, i3) {
53494 this.ns = e3, this.name = t2, this.value = i3;
53500 var Xe = class _Xe {
53501 static findAll(e3, t2, i3) {
53502 if (void 0 !== t2 || void 0 !== i3) {
53503 t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
53504 var n3 = new RegExp("<(".concat(t2, "):(").concat(i3, ")(#\\d+)?((\\s+?[\\w\\d-:]+=(\"[^\"]*\"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)"), "gm");
53506 n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
53507 return qe(e3, n3).map(_Xe.unpackMatch);
53509 static unpackMatch(e3) {
53510 let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
53511 return new _Xe(t2, i3, n3, s2);
53513 constructor(e3, t2, i3, n3) {
53514 this.ns = e3, this.name = t2, this.attrString = i3, this.innerXml = n3, this.attrs = Ke.findAll(i3), this.children = _Xe.findAll(n3), this.value = 0 === this.children.length ? Qe(n3) : void 0, this.properties = [...this.attrs, ...this.children];
53516 get isPrimitive() {
53517 return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
53519 get isListContainer() {
53520 return 1 === this.children.length && this.children[0].isList;
53523 let { ns: e3, name: t2 } = this;
53524 return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
53527 return "rdf" === this.ns && "li" === this.name;
53530 if (0 === this.properties.length && void 0 === this.value)
53532 if (this.isPrimitive)
53534 if (this.isListContainer)
53535 return this.children[0].serialize();
53537 return $e(this.children.map(Ye));
53538 if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length)
53539 return this.children[0].serialize();
53541 for (let t2 of this.properties)
53543 return void 0 !== this.value && (e3.value = this.value), f(e3);
53546 function _e(e3, t2) {
53547 let i3 = e3.serialize();
53548 void 0 !== i3 && (t2[e3.name] = i3);
53550 var Ye = (e3) => e3.serialize();
53551 var $e = (e3) => 1 === e3.length ? e3[0] : e3;
53552 var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
53553 function qe(e3, t2) {
53557 for (; null !== (i3 = t2.exec(e3)); )
53563 return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
53566 let t2 = Number(e3);
53567 if (!Number.isNaN(t2))
53569 let i3 = e3.toLowerCase();
53570 return "true" === i3 || "false" !== i3 && e3.trim();
53572 var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
53573 var et = new RegExp("(<|\\/)(".concat(Ze.join("|"), ")"), "g");
53574 var tt = Object.freeze({ __proto__: null, default: Me, Exifr: te, fileParsers: w, segmentParsers: T, fileReaders: A, tagKeys: E, tagValues: B, tagRevivers: N, createDictionary: U, extendDictionary: F, fetchUrlAsArrayBuffer: M, readBlobAsArrayBuffer: R, chunkedProps: G, otherSegments: V, segments: z, tiffBlocks: H, segmentsAndBlocks: j, tiffExtractables: W, inheritables: K, allFormatters: X, Options: q, parse: ie, gpsOnlyOptions: me, gps: Se, thumbnailOnlyOptions: Ce, thumbnail: ye, thumbnailUrl: be, orientationOnlyOptions: Ie, orientation: Pe, rotations: ke, get rotateCanvas() {
53576 }, get rotateCss() {
53578 }, rotation: Ae });
53579 var at = l("fs", (e3) => e3.promises);
53580 A.set("fs", class extends ve {
53581 async readWhole() {
53582 this.chunked = false, this.fs = await at;
53583 let e3 = await this.fs.readFile(this.input);
53584 this._swapBuffer(e3);
53586 async readChunked() {
53587 this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
53590 void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
53592 async _readChunk(e3, t2) {
53593 void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
53594 var i3 = this.subarray(e3, t2, true);
53595 return await this.fh.read(i3.dataView, 0, t2, e3), i3;
53600 this.fh = void 0, await e3.close();
53604 A.set("base64", class extends ve {
53605 constructor(...e3) {
53606 super(...e3), this.input = this.input.replace(/^data:([^;]+);base64,/gim, ""), this.size = this.input.length / 4 * 3, this.input.endsWith("==") ? this.size -= 2 : this.input.endsWith("=") && (this.size -= 1);
53608 async _readChunk(e3, t2) {
53609 let i3, n3, r2 = this.input;
53610 void 0 === e3 ? (e3 = 0, i3 = 0, n3 = 0) : (i3 = 4 * Math.floor(e3 / 3), n3 = e3 - i3 / 4 * 3), void 0 === t2 && (t2 = this.size);
53611 let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
53612 r2 = r2.slice(i3, l2);
53613 let h2 = Math.min(t2, this.size - e3);
53615 let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
53616 return this.set(t3, e3, true);
53619 let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
53620 for (let e4 = 0; e4 < h2; e4++)
53621 s2[e4] = i4.charCodeAt(n3 + e4);
53626 var ot = class extends se {
53627 static canHandle(e3, t2) {
53628 return 18761 === t2 || 19789 === t2;
53630 extendOptions(e3) {
53631 let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
53632 i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
53635 let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
53636 if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
53637 let e4 = Math.max(S(this.options), this.options.chunkSize);
53638 await this.file.ensureChunk(0, e4), this.createParser("tiff", this.file), this.parsers.tiff.parseHeader(), await this.parsers.tiff.parseIfd0Block(), this.adaptTiffPropAsSegment("xmp"), this.adaptTiffPropAsSegment("iptc"), this.adaptTiffPropAsSegment("icc");
53641 adaptTiffPropAsSegment(e3) {
53642 if (this.parsers.tiff[e3]) {
53643 let t2 = this.parsers.tiff[e3];
53644 this.injectSegment(e3, t2);
53648 c(ot, "type", "tiff"), w.set("tiff", ot);
53649 var lt = l("zlib");
53650 var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
53651 var ut = class extends se {
53652 constructor(...e3) {
53653 super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
53655 static canHandle(e3, t2) {
53656 return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
53659 let { file: e3 } = this;
53660 await this.findPngChunksInRange("\x89PNG\r\n
\1a\n".length, e3.byteLength), await this.readSegments(this.metaChunks), this.findIhdr(), this.parseTextChunks(), await this.findExif().catch(this.catchError), await this.findXmp().catch(this.catchError), await this.findIcc().catch(this.catchError);
53662 async findPngChunksInRange(e3, t2) {
53663 let { file: i3 } = this;
53664 for (; e3 < t2; ) {
53665 let t3 = i3.getUint32(e3), n3 = i3.getUint32(e3 + 4), s2 = i3.getString(e3 + 4, 4).toLowerCase(), r2 = t3 + 4 + 4 + 4, a2 = { type: s2, offset: e3, length: r2, start: e3 + 4 + 4, size: t3, marker: n3 };
53666 ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
53669 parseTextChunks() {
53670 let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
53671 for (let t2 of e3) {
53672 let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
53673 this.injectKeyValToIhdr(e4, i3);
53676 injectKeyValToIhdr(e3, t2) {
53677 let i3 = this.parsers.ihdr;
53678 i3 && i3.raw.set(e3, t2);
53681 let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
53682 e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
53685 let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
53686 e3 && this.injectSegment("tiff", e3.chunk);
53689 let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
53690 for (let t2 of e3) {
53691 "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
53695 let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
53698 let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
53699 for (; s2 < 80 && 0 !== i3[s2]; )
53701 let r2 = s2 + 2, a2 = t2.getString(0, s2);
53702 if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
53703 let e4 = await lt, i4 = t2.getUint8Array(r2);
53704 i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
53708 c(ut, "type", "png"), w.set("png", ut), U(E, "interop", [[1, "InteropIndex"], [2, "InteropVersion"], [4096, "RelatedImageFileFormat"], [4097, "RelatedImageWidth"], [4098, "RelatedImageHeight"]]), F(E, "ifd0", [[11, "ProcessingSoftware"], [254, "SubfileType"], [255, "OldSubfileType"], [263, "Thresholding"], [264, "CellWidth"], [265, "CellLength"], [266, "FillOrder"], [269, "DocumentName"], [280, "MinSampleValue"], [281, "MaxSampleValue"], [285, "PageName"], [286, "XPosition"], [287, "YPosition"], [290, "GrayResponseUnit"], [297, "PageNumber"], [321, "HalftoneHints"], [322, "TileWidth"], [323, "TileLength"], [332, "InkSet"], [337, "TargetPrinter"], [18246, "Rating"], [18249, "RatingPercent"], [33550, "PixelScale"], [34264, "ModelTransform"], [34377, "PhotoshopSettings"], [50706, "DNGVersion"], [50707, "DNGBackwardVersion"], [50708, "UniqueCameraModel"], [50709, "LocalizedCameraModel"], [50736, "DNGLensInfo"], [50739, "ShadowScale"], [50740, "DNGPrivateData"], [33920, "IntergraphMatrix"], [33922, "ModelTiePoint"], [34118, "SEMInfo"], [34735, "GeoTiffDirectory"], [34736, "GeoTiffDoubleParams"], [34737, "GeoTiffAsciiParams"], [50341, "PrintIM"], [50721, "ColorMatrix1"], [50722, "ColorMatrix2"], [50723, "CameraCalibration1"], [50724, "CameraCalibration2"], [50725, "ReductionMatrix1"], [50726, "ReductionMatrix2"], [50727, "AnalogBalance"], [50728, "AsShotNeutral"], [50729, "AsShotWhiteXY"], [50730, "BaselineExposure"], [50731, "BaselineNoise"], [50732, "BaselineSharpness"], [50734, "LinearResponseLimit"], [50735, "CameraSerialNumber"], [50741, "MakerNoteSafety"], [50778, "CalibrationIlluminant1"], [50779, "CalibrationIlluminant2"], [50781, "RawDataUniqueID"], [50827, "OriginalRawFileName"], [50828, "OriginalRawFileData"], [50831, "AsShotICCProfile"], [50832, "AsShotPreProfileMatrix"], [50833, "CurrentICCProfile"], [50834, "CurrentPreProfileMatrix"], [50879, "ColorimetricReference"], [50885, "SRawType"], [50898, "PanasonicTitle"], [50899, "PanasonicTitle2"], [50931, "CameraCalibrationSig"], [50932, "ProfileCalibrationSig"], [50933, "ProfileIFD"], [50934, "AsShotProfileName"], [50936, "ProfileName"], [50937, "ProfileHueSatMapDims"], [50938, "ProfileHueSatMapData1"], [50939, "ProfileHueSatMapData2"], [50940, "ProfileToneCurve"], [50941, "ProfileEmbedPolicy"], [50942, "ProfileCopyright"], [50964, "ForwardMatrix1"], [50965, "ForwardMatrix2"], [50966, "PreviewApplicationName"], [50967, "PreviewApplicationVersion"], [50968, "PreviewSettingsName"], [50969, "PreviewSettingsDigest"], [50970, "PreviewColorSpace"], [50971, "PreviewDateTime"], [50972, "RawImageDigest"], [50973, "OriginalRawFileDigest"], [50981, "ProfileLookTableDims"], [50982, "ProfileLookTableData"], [51043, "TimeCodes"], [51044, "FrameRate"], [51058, "TStop"], [51081, "ReelName"], [51089, "OriginalDefaultFinalSize"], [51090, "OriginalBestQualitySize"], [51091, "OriginalDefaultCropSize"], [51105, "CameraLabel"], [51107, "ProfileHueSatMapEncoding"], [51108, "ProfileLookTableEncoding"], [51109, "BaselineExposureOffset"], [51110, "DefaultBlackRender"], [51111, "NewRawImageDigest"], [51112, "RawToPreviewGain"]]);
53709 var ct = [[273, "StripOffsets"], [279, "StripByteCounts"], [288, "FreeOffsets"], [289, "FreeByteCounts"], [291, "GrayResponseCurve"], [292, "T4Options"], [293, "T6Options"], [300, "ColorResponseUnit"], [320, "ColorMap"], [324, "TileOffsets"], [325, "TileByteCounts"], [326, "BadFaxLines"], [327, "CleanFaxData"], [328, "ConsecutiveBadFaxLines"], [330, "SubIFD"], [333, "InkNames"], [334, "NumberofInks"], [336, "DotRange"], [338, "ExtraSamples"], [339, "SampleFormat"], [340, "SMinSampleValue"], [341, "SMaxSampleValue"], [342, "TransferRange"], [343, "ClipPath"], [344, "XClipPathUnits"], [345, "YClipPathUnits"], [346, "Indexed"], [347, "JPEGTables"], [351, "OPIProxy"], [400, "GlobalParametersIFD"], [401, "ProfileType"], [402, "FaxProfile"], [403, "CodingMethods"], [404, "VersionYear"], [405, "ModeNumber"], [433, "Decode"], [434, "DefaultImageColor"], [435, "T82Options"], [437, "JPEGTables"], [512, "JPEGProc"], [515, "JPEGRestartInterval"], [517, "JPEGLosslessPredictors"], [518, "JPEGPointTransforms"], [519, "JPEGQTables"], [520, "JPEGDCTables"], [521, "JPEGACTables"], [559, "StripRowCounts"], [999, "USPTOMiscellaneous"], [18247, "XP_DIP_XML"], [18248, "StitchInfo"], [28672, "SonyRawFileType"], [28688, "SonyToneCurve"], [28721, "VignettingCorrection"], [28722, "VignettingCorrParams"], [28724, "ChromaticAberrationCorrection"], [28725, "ChromaticAberrationCorrParams"], [28726, "DistortionCorrection"], [28727, "DistortionCorrParams"], [29895, "SonyCropTopLeft"], [29896, "SonyCropSize"], [32781, "ImageID"], [32931, "WangTag1"], [32932, "WangAnnotation"], [32933, "WangTag3"], [32934, "WangTag4"], [32953, "ImageReferencePoints"], [32954, "RegionXformTackPoint"], [32955, "WarpQuadrilateral"], [32956, "AffineTransformMat"], [32995, "Matteing"], [32996, "DataType"], [32997, "ImageDepth"], [32998, "TileDepth"], [33300, "ImageFullWidth"], [33301, "ImageFullHeight"], [33302, "TextureFormat"], [33303, "WrapModes"], [33304, "FovCot"], [33305, "MatrixWorldToScreen"], [33306, "MatrixWorldToCamera"], [33405, "Model2"], [33421, "CFARepeatPatternDim"], [33422, "CFAPattern2"], [33423, "BatteryLevel"], [33424, "KodakIFD"], [33445, "MDFileTag"], [33446, "MDScalePixel"], [33447, "MDColorTable"], [33448, "MDLabName"], [33449, "MDSampleInfo"], [33450, "MDPrepDate"], [33451, "MDPrepTime"], [33452, "MDFileUnits"], [33589, "AdventScale"], [33590, "AdventRevision"], [33628, "UIC1Tag"], [33629, "UIC2Tag"], [33630, "UIC3Tag"], [33631, "UIC4Tag"], [33918, "IntergraphPacketData"], [33919, "IntergraphFlagRegisters"], [33921, "INGRReserved"], [34016, "Site"], [34017, "ColorSequence"], [34018, "IT8Header"], [34019, "RasterPadding"], [34020, "BitsPerRunLength"], [34021, "BitsPerExtendedRunLength"], [34022, "ColorTable"], [34023, "ImageColorIndicator"], [34024, "BackgroundColorIndicator"], [34025, "ImageColorValue"], [34026, "BackgroundColorValue"], [34027, "PixelIntensityRange"], [34028, "TransparencyIndicator"], [34029, "ColorCharacterization"], [34030, "HCUsage"], [34031, "TrapIndicator"], [34032, "CMYKEquivalent"], [34152, "AFCP_IPTC"], [34232, "PixelMagicJBIGOptions"], [34263, "JPLCartoIFD"], [34306, "WB_GRGBLevels"], [34310, "LeafData"], [34687, "TIFF_FXExtensions"], [34688, "MultiProfiles"], [34689, "SharedData"], [34690, "T88Options"], [34732, "ImageLayer"], [34750, "JBIGOptions"], [34856, "Opto-ElectricConvFactor"], [34857, "Interlace"], [34908, "FaxRecvParams"], [34909, "FaxSubAddress"], [34910, "FaxRecvTime"], [34929, "FedexEDR"], [34954, "LeafSubIFD"], [37387, "FlashEnergy"], [37388, "SpatialFrequencyResponse"], [37389, "Noise"], [37390, "FocalPlaneXResolution"], [37391, "FocalPlaneYResolution"], [37392, "FocalPlaneResolutionUnit"], [37397, "ExposureIndex"], [37398, "TIFF-EPStandardID"], [37399, "SensingMethod"], [37434, "CIP3DataFile"], [37435, "CIP3Sheet"], [37436, "CIP3Side"], [37439, "StoNits"], [37679, "MSDocumentText"], [37680, "MSPropertySetStorage"], [37681, "MSDocumentTextPosition"], [37724, "ImageSourceData"], [40965, "InteropIFD"], [40976, "SamsungRawPointersOffset"], [40977, "SamsungRawPointersLength"], [41217, "SamsungRawByteOrder"], [41218, "SamsungRawUnknown"], [41484, "SpatialFrequencyResponse"], [41485, "Noise"], [41489, "ImageNumber"], [41490, "SecurityClassification"], [41491, "ImageHistory"], [41494, "TIFF-EPStandardID"], [41995, "DeviceSettingDescription"], [42112, "GDALMetadata"], [42113, "GDALNoData"], [44992, "ExpandSoftware"], [44993, "ExpandLens"], [44994, "ExpandFilm"], [44995, "ExpandFilterLens"], [44996, "ExpandScanner"], [44997, "ExpandFlashLamp"], [46275, "HasselbladRawImage"], [48129, "PixelFormat"], [48130, "Transformation"], [48131, "Uncompressed"], [48132, "ImageType"], [48256, "ImageWidth"], [48257, "ImageHeight"], [48258, "WidthResolution"], [48259, "HeightResolution"], [48320, "ImageOffset"], [48321, "ImageByteCount"], [48322, "AlphaOffset"], [48323, "AlphaByteCount"], [48324, "ImageDataDiscard"], [48325, "AlphaDataDiscard"], [50215, "OceScanjobDesc"], [50216, "OceApplicationSelector"], [50217, "OceIDNumber"], [50218, "OceImageLogic"], [50255, "Annotations"], [50459, "HasselbladExif"], [50547, "OriginalFileName"], [50560, "USPTOOriginalContentType"], [50656, "CR2CFAPattern"], [50710, "CFAPlaneColor"], [50711, "CFALayout"], [50712, "LinearizationTable"], [50713, "BlackLevelRepeatDim"], [50714, "BlackLevel"], [50715, "BlackLevelDeltaH"], [50716, "BlackLevelDeltaV"], [50717, "WhiteLevel"], [50718, "DefaultScale"], [50719, "DefaultCropOrigin"], [50720, "DefaultCropSize"], [50733, "BayerGreenSplit"], [50737, "ChromaBlurRadius"], [50738, "AntiAliasStrength"], [50752, "RawImageSegmentation"], [50780, "BestQualityScale"], [50784, "AliasLayerMetadata"], [50829, "ActiveArea"], [50830, "MaskedAreas"], [50935, "NoiseReductionApplied"], [50974, "SubTileBlockSize"], [50975, "RowInterleaveFactor"], [51008, "OpcodeList1"], [51009, "OpcodeList2"], [51022, "OpcodeList3"], [51041, "NoiseProfile"], [51114, "CacheVersion"], [51125, "DefaultUserCrop"], [51157, "NikonNEFInfo"], [65024, "KdcIFD"]];
53710 F(E, "ifd0", ct), F(E, "exif", ct), U(B, "gps", [[23, { M: "Magnetic North", T: "True North" }], [25, { K: "Kilometers", M: "Miles", N: "Nautical Miles" }]]);
53711 var ft = class extends re2 {
53712 static canHandle(e3, t2) {
53713 return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
53716 return this.parseTags(), this.translate(), this.output;
53719 this.raw = /* @__PURE__ */ new Map([[0, this.chunk.getUint16(0)], [2, this.chunk.getUint8(2)], [3, this.chunk.getUint16(3)], [5, this.chunk.getUint16(5)], [7, this.chunk.getUint8(7)], [8, this.chunk.getUint8(8)]]);
53722 c(ft, "type", "jfif"), c(ft, "headerLength", 9), T.set("jfif", ft), U(E, "jfif", [[0, "JFIFVersion"], [2, "ResolutionUnit"], [3, "XResolution"], [5, "YResolution"], [7, "ThumbnailWidth"], [8, "ThumbnailHeight"]]);
53723 var dt = class extends re2 {
53725 return this.parseTags(), this.translate(), this.output;
53728 this.raw = new Map([[0, this.chunk.getUint32(0)], [4, this.chunk.getUint32(4)], [8, this.chunk.getUint8(8)], [9, this.chunk.getUint8(9)], [10, this.chunk.getUint8(10)], [11, this.chunk.getUint8(11)], [12, this.chunk.getUint8(12)], ...Array.from(this.raw)]);
53731 c(dt, "type", "ihdr"), T.set("ihdr", dt), U(E, "ihdr", [[0, "ImageWidth"], [4, "ImageHeight"], [8, "BitDepth"], [9, "ColorType"], [10, "Compression"], [11, "Filter"], [12, "Interlace"]]), U(B, "ihdr", [[9, { 0: "Grayscale", 2: "RGB", 3: "Palette", 4: "Grayscale with Alpha", 6: "RGB with Alpha", DEFAULT: "Unknown" }], [10, { 0: "Deflate/Inflate", DEFAULT: "Unknown" }], [11, { 0: "Adaptive", DEFAULT: "Unknown" }], [12, { 0: "Noninterlaced", 1: "Adam7 Interlace", DEFAULT: "Unknown" }]]);
53732 var pt = class extends re2 {
53733 static canHandle(e3, t2) {
53734 return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
53736 static findPosition(e3, t2) {
53737 let i3 = super.findPosition(e3, t2);
53738 return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
53740 static handleMultiSegments(e3) {
53741 return function(e4) {
53742 let t2 = function(e6) {
53743 let t3 = e6[0].constructor, i3 = 0;
53746 let n3 = new t3(i3), s2 = 0;
53748 n3.set(t4, s2), s2 += t4.length;
53750 }(e4.map((e6) => e6.chunk.toUint8()));
53755 return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
53758 let { raw: e3 } = this;
53759 this.chunk.byteLength < 84 && g2("ICC header is too short");
53760 for (let [t2, i3] of Object.entries(gt)) {
53761 t2 = parseInt(t2, 10);
53762 let n3 = i3(this.chunk, t2);
53763 "\0\0\0\0" !== n3 && e3.set(t2, n3);
53767 let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
53769 if (e3 = this.chunk.getString(o2, 4), t2 = this.chunk.getUint32(o2 + 4), i3 = this.chunk.getUint32(o2 + 8), n3 = this.chunk.getString(t2, 4), t2 + i3 > l2)
53770 return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
53771 s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
53774 parseTag(e3, t2, i3) {
53777 return this.parseDesc(t2);
53779 return this.parseMluc(t2);
53781 return this.parseText(t2, i3);
53783 return this.parseSig(t2);
53785 if (!(t2 + i3 > this.chunk.byteLength))
53786 return this.chunk.getUint8Array(t2, i3);
53789 let t2 = this.chunk.getUint32(e3 + 8) - 1;
53790 return m(this.chunk.getString(e3 + 12, t2));
53792 parseText(e3, t2) {
53793 return m(this.chunk.getString(e3 + 8, t2 - 8));
53796 return m(this.chunk.getString(e3 + 8, 4));
53799 let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
53800 for (let a2 = 0; a2 < i3; a2++) {
53801 let i4 = t2.getString(s2 + 0, 2), a3 = t2.getString(s2 + 2, 2), o2 = t2.getUint32(s2 + 4), l2 = t2.getUint32(s2 + 8) + e3, h2 = m(t2.getUnicodeString(l2, o2));
53802 r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
53804 return 1 === i3 ? r2[0].text : r2;
53806 translateValue(e3, t2) {
53807 return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
53810 c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
53811 var gt = { 4: mt, 8: function(e3, t2) {
53812 return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
53813 }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
53814 const i3 = e3.getUint16(t2), n3 = e3.getUint16(t2 + 2) - 1, s2 = e3.getUint16(t2 + 4), r2 = e3.getUint16(t2 + 6), a2 = e3.getUint16(t2 + 8), o2 = e3.getUint16(t2 + 10);
53815 return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
53816 }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
53817 function mt(e3, t2) {
53818 return m(e3.getString(t2, 4));
53820 T.set("icc", pt), U(E, "icc", [[4, "ProfileCMMType"], [8, "ProfileVersion"], [12, "ProfileClass"], [16, "ColorSpaceData"], [20, "ProfileConnectionSpace"], [24, "ProfileDateTime"], [36, "ProfileFileSignature"], [40, "PrimaryPlatform"], [44, "CMMFlags"], [48, "DeviceManufacturer"], [52, "DeviceModel"], [56, "DeviceAttributes"], [64, "RenderingIntent"], [68, "ConnectionSpaceIlluminant"], [80, "ProfileCreator"], [84, "ProfileID"], ["Header", "ProfileHeader"], ["MS00", "WCSProfiles"], ["bTRC", "BlueTRC"], ["bXYZ", "BlueMatrixColumn"], ["bfd", "UCRBG"], ["bkpt", "MediaBlackPoint"], ["calt", "CalibrationDateTime"], ["chad", "ChromaticAdaptation"], ["chrm", "Chromaticity"], ["ciis", "ColorimetricIntentImageState"], ["clot", "ColorantTableOut"], ["clro", "ColorantOrder"], ["clrt", "ColorantTable"], ["cprt", "ProfileCopyright"], ["crdi", "CRDInfo"], ["desc", "ProfileDescription"], ["devs", "DeviceSettings"], ["dmdd", "DeviceModelDesc"], ["dmnd", "DeviceMfgDesc"], ["dscm", "ProfileDescriptionML"], ["fpce", "FocalPlaneColorimetryEstimates"], ["gTRC", "GreenTRC"], ["gXYZ", "GreenMatrixColumn"], ["gamt", "Gamut"], ["kTRC", "GrayTRC"], ["lumi", "Luminance"], ["meas", "Measurement"], ["meta", "Metadata"], ["mmod", "MakeAndModel"], ["ncl2", "NamedColor2"], ["ncol", "NamedColor"], ["ndin", "NativeDisplayInfo"], ["pre0", "Preview0"], ["pre1", "Preview1"], ["pre2", "Preview2"], ["ps2i", "PS2RenderingIntent"], ["ps2s", "PostScript2CSA"], ["psd0", "PostScript2CRD0"], ["psd1", "PostScript2CRD1"], ["psd2", "PostScript2CRD2"], ["psd3", "PostScript2CRD3"], ["pseq", "ProfileSequenceDesc"], ["psid", "ProfileSequenceIdentifier"], ["psvm", "PS2CRDVMSize"], ["rTRC", "RedTRC"], ["rXYZ", "RedMatrixColumn"], ["resp", "OutputResponse"], ["rhoc", "ReflectionHardcopyOrigColorimetry"], ["rig0", "PerceptualRenderingIntentGamut"], ["rig2", "SaturationRenderingIntentGamut"], ["rpoc", "ReflectionPrintOutputColorimetry"], ["sape", "SceneAppearanceEstimates"], ["scoe", "SceneColorimetryEstimates"], ["scrd", "ScreeningDesc"], ["scrn", "Screening"], ["targ", "CharTarget"], ["tech", "Technology"], ["vcgt", "VideoCardGamma"], ["view", "ViewingConditions"], ["vued", "ViewingCondDesc"], ["wtpt", "MediaWhitePoint"]]);
53821 var St = { "4d2p": "Erdt Systems", AAMA: "Aamazing Technologies", ACER: "Acer", ACLT: "Acolyte Color Research", ACTI: "Actix Sytems", ADAR: "Adara Technology", ADBE: "Adobe", ADI: "ADI Systems", AGFA: "Agfa Graphics", ALMD: "Alps Electric", ALPS: "Alps Electric", ALWN: "Alwan Color Expertise", AMTI: "Amiable Technologies", AOC: "AOC International", APAG: "Apago", APPL: "Apple Computer", AST: "AST", "AT&T": "AT&T", BAEL: "BARBIERI electronic", BRCO: "Barco NV", BRKP: "Breakpoint", BROT: "Brother", BULL: "Bull", BUS: "Bus Computer Systems", "C-IT": "C-Itoh", CAMR: "Intel", CANO: "Canon", CARR: "Carroll Touch", CASI: "Casio", CBUS: "Colorbus PL", CEL: "Crossfield", CELx: "Crossfield", CGS: "CGS Publishing Technologies International", CHM: "Rochester Robotics", CIGL: "Colour Imaging Group, London", CITI: "Citizen", CL00: "Candela", CLIQ: "Color IQ", CMCO: "Chromaco", CMiX: "CHROMiX", COLO: "Colorgraphic Communications", COMP: "Compaq", COMp: "Compeq/Focus Technology", CONR: "Conrac Display Products", CORD: "Cordata Technologies", CPQ: "Compaq", CPRO: "ColorPro", CRN: "Cornerstone", CTX: "CTX International", CVIS: "ColorVision", CWC: "Fujitsu Laboratories", DARI: "Darius Technology", DATA: "Dataproducts", DCP: "Dry Creek Photo", DCRC: "Digital Contents Resource Center, Chung-Ang University", DELL: "Dell Computer", DIC: "Dainippon Ink and Chemicals", DICO: "Diconix", DIGI: "Digital", "DL&C": "Digital Light & Color", DPLG: "Doppelganger", DS: "Dainippon Screen", DSOL: "DOOSOL", DUPN: "DuPont", EPSO: "Epson", ESKO: "Esko-Graphics", ETRI: "Electronics and Telecommunications Research Institute", EVER: "Everex Systems", EXAC: "ExactCODE", Eizo: "Eizo", FALC: "Falco Data Products", FF: "Fuji Photo Film", FFEI: "FujiFilm Electronic Imaging", FNRD: "Fnord Software", FORA: "Fora", FORE: "Forefront Technology", FP: "Fujitsu", FPA: "WayTech Development", FUJI: "Fujitsu", FX: "Fuji Xerox", GCC: "GCC Technologies", GGSL: "Global Graphics Software", GMB: "Gretagmacbeth", GMG: "GMG", GOLD: "GoldStar Technology", GOOG: "Google", GPRT: "Giantprint", GTMB: "Gretagmacbeth", GVC: "WayTech Development", GW2K: "Sony", HCI: "HCI", HDM: "Heidelberger Druckmaschinen", HERM: "Hermes", HITA: "Hitachi America", HP: "Hewlett-Packard", HTC: "Hitachi", HiTi: "HiTi Digital", IBM: "IBM", IDNT: "Scitex", IEC: "Hewlett-Packard", IIYA: "Iiyama North America", IKEG: "Ikegami Electronics", IMAG: "Image Systems", IMI: "Ingram Micro", INTC: "Intel", INTL: "N/A (INTL)", INTR: "Intra Electronics", IOCO: "Iocomm International Technology", IPS: "InfoPrint Solutions Company", IRIS: "Scitex", ISL: "Ichikawa Soft Laboratory", ITNL: "N/A (ITNL)", IVM: "IVM", IWAT: "Iwatsu Electric", Idnt: "Scitex", Inca: "Inca Digital Printers", Iris: "Scitex", JPEG: "Joint Photographic Experts Group", JSFT: "Jetsoft Development", JVC: "JVC Information Products", KART: "Scitex", KFC: "KFC Computek Components", KLH: "KLH Computers", KMHD: "Konica Minolta", KNCA: "Konica", KODA: "Kodak", KYOC: "Kyocera", Kart: "Scitex", LCAG: "Leica", LCCD: "Leeds Colour", LDAK: "Left Dakota", LEAD: "Leading Technology", LEXM: "Lexmark International", LINK: "Link Computer", LINO: "Linotronic", LITE: "Lite-On", Leaf: "Leaf", Lino: "Linotronic", MAGC: "Mag Computronic", MAGI: "MAG Innovision", MANN: "Mannesmann", MICN: "Micron Technology", MICR: "Microtek", MICV: "Microvitec", MINO: "Minolta", MITS: "Mitsubishi Electronics America", MITs: "Mitsuba", MNLT: "Minolta", MODG: "Modgraph", MONI: "Monitronix", MONS: "Monaco Systems", MORS: "Morse Technology", MOTI: "Motive Systems", MSFT: "Microsoft", MUTO: "MUTOH INDUSTRIES", Mits: "Mitsubishi Electric", NANA: "NANAO", NEC: "NEC", NEXP: "NexPress Solutions", NISS: "Nissei Sangyo America", NKON: "Nikon", NONE: "none", OCE: "Oce Technologies", OCEC: "OceColor", OKI: "Oki", OKID: "Okidata", OKIP: "Okidata", OLIV: "Olivetti", OLYM: "Olympus", ONYX: "Onyx Graphics", OPTI: "Optiquest", PACK: "Packard Bell", PANA: "Matsushita Electric Industrial", PANT: "Pantone", PBN: "Packard Bell", PFU: "PFU", PHIL: "Philips Consumer Electronics", PNTX: "HOYA", POne: "Phase One A/S", PREM: "Premier Computer Innovations", PRIN: "Princeton Graphic Systems", PRIP: "Princeton Publishing Labs", QLUX: "Hong Kong", QMS: "QMS", QPCD: "QPcard AB", QUAD: "QuadLaser", QUME: "Qume", RADI: "Radius", RDDx: "Integrated Color Solutions", RDG: "Roland DG", REDM: "REDMS Group", RELI: "Relisys", RGMS: "Rolf Gierling Multitools", RICO: "Ricoh", RNLD: "Edmund Ronald", ROYA: "Royal", RPC: "Ricoh Printing Systems", RTL: "Royal Information Electronics", SAMP: "Sampo", SAMS: "Samsung", SANT: "Jaime Santana Pomares", SCIT: "Scitex", SCRN: "Dainippon Screen", SDP: "Scitex", SEC: "Samsung", SEIK: "Seiko Instruments", SEIk: "Seikosha", SGUY: "ScanGuy.com", SHAR: "Sharp Laboratories", SICC: "International Color Consortium", SONY: "Sony", SPCL: "SpectraCal", STAR: "Star", STC: "Sampo Technology", Scit: "Scitex", Sdp: "Scitex", Sony: "Sony", TALO: "Talon Technology", TAND: "Tandy", TATU: "Tatung", TAXA: "TAXAN America", TDS: "Tokyo Denshi Sekei", TECO: "TECO Information Systems", TEGR: "Tegra", TEKT: "Tektronix", TI: "Texas Instruments", TMKR: "TypeMaker", TOSB: "Toshiba", TOSH: "Toshiba", TOTK: "TOTOKU ELECTRIC", TRIU: "Triumph", TSBT: "Toshiba", TTX: "TTX Computer Products", TVM: "TVM Professional Monitor", TW: "TW Casper", ULSX: "Ulead Systems", UNIS: "Unisys", UTZF: "Utz Fehlau & Sohn", VARI: "Varityper", VIEW: "Viewsonic", VISL: "Visual communication", VIVO: "Vivo Mobile Communication", WANG: "Wang", WLBR: "Wilbur Imaging", WTG2: "Ware To Go", WYSE: "WYSE Technology", XERX: "Xerox", XRIT: "X-Rite", ZRAN: "Zoran", Zebr: "Zebra Technologies", appl: "Apple Computer", bICC: "basICColor", berg: "bergdesign", ceyd: "Integrated Color Solutions", clsp: "MacDermid ColorSpan", ds: "Dainippon Screen", dupn: "DuPont", ffei: "FujiFilm Electronic Imaging", flux: "FluxData", iris: "Scitex", kart: "Scitex", lcms: "Little CMS", lino: "Linotronic", none: "none", ob4d: "Erdt Systems", obic: "Medigraph", quby: "Qubyx Sarl", scit: "Scitex", scrn: "Dainippon Screen", sdp: "Scitex", siwi: "SIWI GRAFIKA", yxym: "YxyMaster" };
53822 var Ct = { scnr: "Scanner", mntr: "Monitor", prtr: "Printer", link: "Device Link", abst: "Abstract", spac: "Color Space Conversion Profile", nmcl: "Named Color", cenc: "ColorEncodingSpace profile", mid: "MultiplexIdentification profile", mlnk: "MultiplexLink profile", mvis: "MultiplexVisualization profile", nkpf: "Nikon Input Device Profile (NON-STANDARD!)" };
53823 U(B, "icc", [[4, St], [12, Ct], [40, Object.assign({}, St, Ct)], [48, St], [80, St], [64, { 0: "Perceptual", 1: "Relative Colorimetric", 2: "Saturation", 3: "Absolute Colorimetric" }], ["tech", { amd: "Active Matrix Display", crt: "Cathode Ray Tube Display", kpcd: "Photo CD", pmd: "Passive Matrix Display", dcam: "Digital Camera", dcpj: "Digital Cinema Projector", dmpc: "Digital Motion Picture Camera", dsub: "Dye Sublimation Printer", epho: "Electrophotographic Printer", esta: "Electrostatic Printer", flex: "Flexography", fprn: "Film Writer", fscn: "Film Scanner", grav: "Gravure", ijet: "Ink Jet Printer", imgs: "Photo Image Setter", mpfr: "Motion Picture Film Recorder", mpfs: "Motion Picture Film Scanner", offs: "Offset Lithography", pjtv: "Projection Television", rpho: "Photographic Paper Printer", rscn: "Reflective Scanner", silk: "Silkscreen", twax: "Thermal Wax Printer", vidc: "Video Camera", vidm: "Video Monitor" }]]);
53824 var yt = class extends re2 {
53825 static canHandle(e3, t2, i3) {
53826 return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
53828 static headerLength(e3, t2, i3) {
53829 let n3, s2 = this.containsIptc8bim(e3, t2, i3);
53831 return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
53833 static containsIptc8bim(e3, t2, i3) {
53834 for (let n3 = 0; n3 < i3; n3++)
53835 if (this.isIptcSegmentHead(e3, t2 + n3))
53838 static isIptcSegmentHead(e3, t2) {
53839 return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
53842 let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
53843 for (let n3 = 0; n3 < t2; n3++)
53844 if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
53846 let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
53847 e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
53850 return this.translate(), this.output;
53852 pluralizeValue(e3, t2) {
53853 return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
53856 c(yt, "type", "iptc"), c(yt, "translateValues", false), c(yt, "reviveValues", false), T.set("iptc", yt), U(E, "iptc", [[0, "ApplicationRecordVersion"], [3, "ObjectTypeReference"], [4, "ObjectAttributeReference"], [5, "ObjectName"], [7, "EditStatus"], [8, "EditorialUpdate"], [10, "Urgency"], [12, "SubjectReference"], [15, "Category"], [20, "SupplementalCategories"], [22, "FixtureIdentifier"], [25, "Keywords"], [26, "ContentLocationCode"], [27, "ContentLocationName"], [30, "ReleaseDate"], [35, "ReleaseTime"], [37, "ExpirationDate"], [38, "ExpirationTime"], [40, "SpecialInstructions"], [42, "ActionAdvised"], [45, "ReferenceService"], [47, "ReferenceDate"], [50, "ReferenceNumber"], [55, "DateCreated"], [60, "TimeCreated"], [62, "DigitalCreationDate"], [63, "DigitalCreationTime"], [65, "OriginatingProgram"], [70, "ProgramVersion"], [75, "ObjectCycle"], [80, "Byline"], [85, "BylineTitle"], [90, "City"], [92, "Sublocation"], [95, "State"], [100, "CountryCode"], [101, "Country"], [103, "OriginalTransmissionReference"], [105, "Headline"], [110, "Credit"], [115, "Source"], [116, "CopyrightNotice"], [118, "Contact"], [120, "Caption"], [121, "LocalCaption"], [122, "Writer"], [125, "RasterizedCaption"], [130, "ImageType"], [131, "ImageOrientation"], [135, "LanguageIdentifier"], [150, "AudioType"], [151, "AudioSamplingRate"], [152, "AudioSamplingResolution"], [153, "AudioDuration"], [154, "AudioOutcue"], [184, "JobID"], [185, "MasterDocumentID"], [186, "ShortDocumentID"], [187, "UniqueDocumentID"], [188, "OwnerID"], [200, "ObjectPreviewFileFormat"], [201, "ObjectPreviewFileVersion"], [202, "ObjectPreviewData"], [221, "Prefs"], [225, "ClassifyState"], [228, "SimilarityIndex"], [230, "DocumentNotes"], [231, "DocumentHistory"], [232, "ExifCameraInfo"], [255, "CatalogSets"]]), U(B, "iptc", [[10, { 0: "0 (reserved)", 1: "1 (most urgent)", 2: "2", 3: "3", 4: "4", 5: "5 (normal urgency)", 6: "6", 7: "7", 8: "8 (least urgent)", 9: "9 (user-defined priority)" }], [75, { a: "Morning", b: "Both Morning and Evening", p: "Evening" }], [131, { L: "Landscape", P: "Portrait", S: "Square" }]]);
53857 var full_esm_default = tt;
53859 // modules/services/plane_photo.js
53860 var dispatch6 = dispatch_default("viewerChanged");
53864 var _widthOverflow;
53865 function zoomPan(d3_event) {
53866 let t2 = d3_event.transform;
53867 _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
53869 function zoomBeahvior() {
53870 const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
53871 const { naturalHeight, naturalWidth } = _photo.node();
53872 const intrinsicRatio = naturalWidth / naturalHeight;
53873 _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
53874 return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
53876 function loadImage(selection2, path) {
53877 return new Promise((resolve) => {
53878 selection2.attr("src", path);
53879 selection2.on("load", () => {
53880 resolve(selection2);
53884 var plane_photo_default = {
53885 init: async function(context, selection2) {
53886 this.event = utilRebind(this, dispatch6, "on");
53887 _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
53888 _photo = _wrapper.append("img").attr("class", "plane-photo");
53889 context.ui().photoviewer.on("resize.plane", () => {
53890 imgZoom = zoomBeahvior();
53891 _wrapper.call(imgZoom);
53893 await Promise.resolve();
53896 showPhotoFrame: function(context) {
53897 const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
53899 context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
53900 context.selectAll(".photo-frame.plane-frame").classed("hide", false);
53904 hidePhotoFrame: function(context) {
53905 context.select("photo-frame.plane-frame").classed("hide", false);
53908 selectPhoto: function(data, keepOrientation) {
53909 dispatch6.call("viewerChanged");
53910 loadImage(_photo, "");
53911 loadImage(_photo, data.image_path).then(() => {
53912 if (!keepOrientation) {
53913 imgZoom = zoomBeahvior();
53914 _wrapper.call(imgZoom);
53915 _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
53920 getYaw: function() {
53925 // modules/svg/local_photos.js
53926 var _initialized2 = false;
53927 var _enabled2 = false;
53928 var minViewfieldZoom = 16;
53929 function svgLocalPhotos(projection2, context, dispatch14) {
53930 const detected = utilDetect();
53931 let layer = select_default2(null);
53934 let _idAutoinc = 0;
53940 function over(d3_event) {
53941 d3_event.stopPropagation();
53942 d3_event.preventDefault();
53943 d3_event.dataTransfer.dropEffect = "copy";
53945 context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
53946 d3_event.stopPropagation();
53947 d3_event.preventDefault();
53948 if (!detected.filedrop)
53950 drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
53951 if (loaded.length > 0) {
53952 drawPhotos.fitZoom(false);
53955 }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
53956 _initialized2 = true;
53958 function ensureViewerLoaded(context2) {
53960 return Promise.resolve(_photoFrame);
53962 const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
53963 const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
53964 viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
53965 return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
53966 _photoFrame = planePhotoFrame;
53969 function click(d3_event, image, zoomTo) {
53970 ensureViewerLoaded(context).then(() => {
53971 const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
53972 const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
53973 const attribution = viewerWrap.selectAll(".photo-attribution").text("");
53975 attribution.append("span").text(image.date.toLocaleString());
53978 attribution.append("span").classed("filename", true).text(image.name);
53980 _photoFrame.selectPhoto({ image_path: "" });
53981 image.getSrc().then((src) => {
53982 _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
53987 context.map().centerEase(image.loc);
53990 function transform2(d2) {
53991 var svgpoint = projection2(d2.loc);
53992 return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
53994 function setStyles(hovered) {
53995 const viewer = context.container().select(".photoviewer");
53996 const selected = viewer.empty() ? void 0 : viewer.datum();
53997 context.container().selectAll(".layer-local-photos .viewfield-group").classed("hovered", (d2) => d2.id === (hovered == null ? void 0 : hovered.id)).classed("highlighted", (d2) => d2.id === (hovered == null ? void 0 : hovered.id) || d2.id === (selected == null ? void 0 : selected.id)).classed("currentView", (d2) => d2.id === (selected == null ? void 0 : selected.id));
53999 function display_markers(imageList) {
54000 imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
54001 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
54004 groups.exit().remove();
54005 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
54006 groupsEnter.append("g").attr("class", "viewfield-scale");
54007 const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
54008 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54009 const showViewfields = context.map().zoom() >= minViewfieldZoom;
54010 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54011 viewfields.exit().remove();
54012 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
54014 const d2 = this.parentNode.__data__;
54015 return "rotate(".concat(Math.round((_a2 = d2.direction) != null ? _a2 : 0), ",0,0),scale(1.5,1.5),translate(-8,-13)");
54016 }).attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z").style("visibility", function() {
54017 const d2 = this.parentNode.__data__;
54018 return isNumber_default(d2.direction) ? "visible" : "hidden";
54021 function drawPhotos(selection2) {
54022 layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
54023 layer.exit().remove();
54024 const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
54025 layerEnter.append("g").attr("class", "markers");
54026 layer = layerEnter.merge(layer);
54028 display_markers(_photos);
54031 function readFileAsDataURL(file) {
54032 return new Promise((resolve, reject) => {
54033 const reader = new FileReader();
54034 reader.onload = () => resolve(reader.result);
54035 reader.onerror = (error) => reject(error);
54036 reader.readAsDataURL(file);
54039 async function readmultifiles(files, callback) {
54041 for (const file of files) {
54043 const exifData = await full_esm_default.parse(file);
54047 getSrc: () => readFileAsDataURL(file),
54049 loc: [exifData.longitude, exifData.latitude],
54050 direction: exifData.GPSImgDirection,
54051 date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
54053 loaded.push(photo);
54054 const sameName = _photos.filter((i3) => i3.name === photo.name);
54055 if (sameName.length === 0) {
54056 _photos.push(photo);
54058 const thisContent = await photo.getSrc();
54059 const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
54060 if (!sameNameContent.some((i3) => i3.value === thisContent)) {
54061 _photos.push(photo);
54067 if (typeof callback === "function")
54069 dispatch14.call("change");
54071 drawPhotos.setFiles = function(fileList, callback) {
54072 readmultifiles(Array.from(fileList), callback);
54075 drawPhotos.fileList = function(fileList, callback) {
54076 if (!arguments.length)
54078 _fileList = fileList;
54079 if (!fileList || !fileList.length)
54081 drawPhotos.setFiles(_fileList, callback);
54084 drawPhotos.getPhotos = function() {
54087 drawPhotos.removePhoto = function(id2) {
54088 _photos = _photos.filter((i3) => i3.id !== id2);
54089 dispatch14.call("change");
54092 drawPhotos.openPhoto = click;
54093 drawPhotos.fitZoom = function(force) {
54094 const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
54095 if (coords.length === 0)
54097 const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
54098 const map2 = context.map();
54099 var viewport = map2.trimmedExtent().polygon();
54100 if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
54101 map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
54104 function showLayer() {
54105 layer.style("display", "block");
54106 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54107 dispatch14.call("change");
54110 function hideLayer() {
54111 layer.transition().duration(250).style("opacity", 0).on("end", () => {
54112 layer.selectAll(".viewfield-group").remove();
54113 layer.style("display", "none");
54116 drawPhotos.enabled = function(val) {
54117 if (!arguments.length)
54125 dispatch14.call("change");
54128 drawPhotos.hasData = function() {
54129 return isArray_default(_photos) && _photos.length > 0;
54135 // modules/svg/improveOSM.js
54136 var _layerEnabled2 = false;
54138 function svgImproveOSM(projection2, context, dispatch14) {
54139 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
54140 const minZoom4 = 12;
54141 let touchLayer = select_default2(null);
54142 let drawLayer = select_default2(null);
54143 let layerVisible = false;
54144 function markerPath(selection2, klass) {
54145 selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
54147 function getService() {
54148 if (services.improveOSM && !_qaService2) {
54149 _qaService2 = services.improveOSM;
54150 _qaService2.on("loaded", throttledRedraw);
54151 } else if (!services.improveOSM && _qaService2) {
54152 _qaService2 = null;
54154 return _qaService2;
54156 function editOn() {
54157 if (!layerVisible) {
54158 layerVisible = true;
54159 drawLayer.style("display", "block");
54162 function editOff() {
54163 if (layerVisible) {
54164 layerVisible = false;
54165 drawLayer.style("display", "none");
54166 drawLayer.selectAll(".qaItem.improveOSM").remove();
54167 touchLayer.selectAll(".qaItem.improveOSM").remove();
54170 function layerOn() {
54172 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
54174 function layerOff() {
54175 throttledRedraw.cancel();
54176 drawLayer.interrupt();
54177 touchLayer.selectAll(".qaItem.improveOSM").remove();
54178 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
54180 dispatch14.call("change");
54183 function updateMarkers() {
54184 if (!layerVisible || !_layerEnabled2)
54186 const service = getService();
54187 const selectedID = context.selectedErrorID();
54188 const data = service ? service.getItems(projection2) : [];
54189 const getTransform = svgPointTransform(projection2);
54190 const markers = drawLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
54191 markers.exit().remove();
54192 const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
54193 markersEnter.append("polygon").call(markerPath, "shadow");
54194 markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
54195 markersEnter.append("polygon").attr("fill", "currentColor").call(markerPath, "qaItem-fill");
54196 markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
54197 markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
54198 if (touchLayer.empty())
54200 const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
54201 const targets = touchLayer.selectAll(".qaItem.improveOSM").data(data, (d2) => d2.id);
54202 targets.exit().remove();
54203 targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => "qaItem ".concat(d2.service, " target ").concat(fillClass, " itemId-").concat(d2.id)).attr("transform", getTransform);
54204 function sortY(a2, b2) {
54205 return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
54208 function drawImproveOSM(selection2) {
54209 const service = getService();
54210 const surface = context.surface();
54211 if (surface && !surface.empty()) {
54212 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
54214 drawLayer = selection2.selectAll(".layer-improveOSM").data(service ? [0] : []);
54215 drawLayer.exit().remove();
54216 drawLayer = drawLayer.enter().append("g").attr("class", "layer-improveOSM").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
54217 if (_layerEnabled2) {
54218 if (service && ~~context.map().zoom() >= minZoom4) {
54220 service.loadIssues(projection2);
54227 drawImproveOSM.enabled = function(val) {
54228 if (!arguments.length)
54229 return _layerEnabled2;
54230 _layerEnabled2 = val;
54231 if (_layerEnabled2) {
54235 if (context.selectedErrorID()) {
54236 context.enter(modeBrowse(context));
54239 dispatch14.call("change");
54242 drawImproveOSM.supported = () => !!getService();
54243 return drawImproveOSM;
54246 // modules/svg/osmose.js
54247 var _layerEnabled3 = false;
54249 function svgOsmose(projection2, context, dispatch14) {
54250 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
54251 const minZoom4 = 12;
54252 let touchLayer = select_default2(null);
54253 let drawLayer = select_default2(null);
54254 let layerVisible = false;
54255 function markerPath(selection2, klass) {
54256 selection2.attr("class", klass).attr("transform", "translate(-10, -28)").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
54258 function getService() {
54259 if (services.osmose && !_qaService3) {
54260 _qaService3 = services.osmose;
54261 _qaService3.on("loaded", throttledRedraw);
54262 } else if (!services.osmose && _qaService3) {
54263 _qaService3 = null;
54265 return _qaService3;
54267 function editOn() {
54268 if (!layerVisible) {
54269 layerVisible = true;
54270 drawLayer.style("display", "block");
54273 function editOff() {
54274 if (layerVisible) {
54275 layerVisible = false;
54276 drawLayer.style("display", "none");
54277 drawLayer.selectAll(".qaItem.osmose").remove();
54278 touchLayer.selectAll(".qaItem.osmose").remove();
54281 function layerOn() {
54283 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
54285 function layerOff() {
54286 throttledRedraw.cancel();
54287 drawLayer.interrupt();
54288 touchLayer.selectAll(".qaItem.osmose").remove();
54289 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
54291 dispatch14.call("change");
54294 function updateMarkers() {
54295 if (!layerVisible || !_layerEnabled3)
54297 const service = getService();
54298 const selectedID = context.selectedErrorID();
54299 const data = service ? service.getItems(projection2) : [];
54300 const getTransform = svgPointTransform(projection2);
54301 const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
54302 markers.exit().remove();
54303 const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
54304 markersEnter.append("polygon").call(markerPath, "shadow");
54305 markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
54306 markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
54307 markersEnter.append("use").attr("class", "icon-annotation").attr("transform", "translate(-6, -22)").attr("width", "12px").attr("height", "12px").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
54308 markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
54309 if (touchLayer.empty())
54311 const fillClass = context.getDebug("target") ? "pink" : "nocolor";
54312 const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
54313 targets.exit().remove();
54314 targets.enter().append("rect").attr("width", "20px").attr("height", "30px").attr("x", "-10px").attr("y", "-28px").merge(targets).sort(sortY).attr("class", (d2) => "qaItem ".concat(d2.service, " target ").concat(fillClass, " itemId-").concat(d2.id)).attr("transform", getTransform);
54315 function sortY(a2, b2) {
54316 return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
54319 function drawOsmose(selection2) {
54320 const service = getService();
54321 const surface = context.surface();
54322 if (surface && !surface.empty()) {
54323 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
54325 drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
54326 drawLayer.exit().remove();
54327 drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled3 ? "block" : "none").merge(drawLayer);
54328 if (_layerEnabled3) {
54329 if (service && ~~context.map().zoom() >= minZoom4) {
54331 service.loadIssues(projection2);
54338 drawOsmose.enabled = function(val) {
54339 if (!arguments.length)
54340 return _layerEnabled3;
54341 _layerEnabled3 = val;
54342 if (_layerEnabled3) {
54343 getService().loadStrings().then(layerOn).catch((err) => {
54348 if (context.selectedErrorID()) {
54349 context.enter(modeBrowse(context));
54352 dispatch14.call("change");
54355 drawOsmose.supported = () => !!getService();
54359 // modules/svg/streetside.js
54360 function svgStreetside(projection2, context, dispatch14) {
54361 var throttledRedraw = throttle_default(function() {
54362 dispatch14.call("change");
54365 var minMarkerZoom = 16;
54366 var minViewfieldZoom2 = 18;
54367 var layer = select_default2(null);
54368 var _viewerYaw = 0;
54369 var _selectedSequence = null;
54372 if (svgStreetside.initialized)
54374 svgStreetside.enabled = false;
54375 svgStreetside.initialized = true;
54377 function getService() {
54378 if (services.streetside && !_streetside) {
54379 _streetside = services.streetside;
54380 _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
54381 } else if (!services.streetside && _streetside) {
54382 _streetside = null;
54384 return _streetside;
54386 function showLayer() {
54387 var service = getService();
54391 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54392 dispatch14.call("change");
54395 function hideLayer() {
54396 throttledRedraw.cancel();
54397 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54399 function editOn() {
54400 layer.style("display", "block");
54402 function editOff() {
54403 layer.selectAll(".viewfield-group").remove();
54404 layer.style("display", "none");
54406 function click(d3_event, d2) {
54407 var service = getService();
54410 if (d2.sequenceKey !== _selectedSequence) {
54413 _selectedSequence = d2.sequenceKey;
54414 service.ensureViewerLoaded(context).then(function() {
54415 service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
54417 context.map().centerEase(d2.loc);
54419 function mouseover(d3_event, d2) {
54420 var service = getService();
54422 service.setStyles(context, d2);
54424 function mouseout() {
54425 var service = getService();
54427 service.setStyles(context, null);
54429 function transform2(d2) {
54430 var t2 = svgPointTransform(projection2)(d2);
54431 var rot = d2.ca + _viewerYaw;
54433 t2 += " rotate(" + Math.floor(rot) + ",0,0)";
54437 function viewerChanged() {
54438 var service = getService();
54441 var viewer = service.viewer();
54444 _viewerYaw = viewer.getYaw();
54445 if (context.map().isTransformed())
54447 layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
54449 function filterBubbles(bubbles) {
54450 var fromDate = context.photos().fromDate();
54451 var toDate = context.photos().toDate();
54452 var usernames = context.photos().usernames();
54454 var fromTimestamp = new Date(fromDate).getTime();
54455 bubbles = bubbles.filter(function(bubble) {
54456 return new Date(bubble.captured_at).getTime() >= fromTimestamp;
54460 var toTimestamp = new Date(toDate).getTime();
54461 bubbles = bubbles.filter(function(bubble) {
54462 return new Date(bubble.captured_at).getTime() <= toTimestamp;
54466 bubbles = bubbles.filter(function(bubble) {
54467 return usernames.indexOf(bubble.captured_by) !== -1;
54472 function filterSequences(sequences) {
54473 var fromDate = context.photos().fromDate();
54474 var toDate = context.photos().toDate();
54475 var usernames = context.photos().usernames();
54477 var fromTimestamp = new Date(fromDate).getTime();
54478 sequences = sequences.filter(function(sequences2) {
54479 return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
54483 var toTimestamp = new Date(toDate).getTime();
54484 sequences = sequences.filter(function(sequences2) {
54485 return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
54489 sequences = sequences.filter(function(sequences2) {
54490 return usernames.indexOf(sequences2.properties.captured_by) !== -1;
54495 function update() {
54496 var viewer = context.container().select(".photoviewer");
54497 var selected = viewer.empty() ? void 0 : viewer.datum();
54498 var z2 = ~~context.map().zoom();
54499 var showMarkers = z2 >= minMarkerZoom;
54500 var showViewfields = z2 >= minViewfieldZoom2;
54501 var service = getService();
54502 var sequences = [];
54504 if (context.photos().showsPanoramic()) {
54505 sequences = service ? service.sequences(projection2) : [];
54506 bubbles = service && showMarkers ? service.bubbles(projection2) : [];
54507 sequences = filterSequences(sequences);
54508 bubbles = filterBubbles(bubbles);
54510 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54511 return d2.properties.key;
54513 traces.exit().remove();
54514 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54515 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
54516 return d2.key + (d2.sequenceKey ? "v1" : "v0");
54518 groups.exit().remove();
54519 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54520 groupsEnter.append("g").attr("class", "viewfield-scale");
54521 var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54522 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
54523 }).attr("transform", transform2).select(".viewfield-scale");
54524 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54525 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54526 viewfields.exit().remove();
54527 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54528 function viewfieldPath() {
54529 var d2 = this.parentNode.__data__;
54531 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54533 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54537 function drawImages(selection2) {
54538 var enabled = svgStreetside.enabled;
54539 var service = getService();
54540 layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
54541 layer.exit().remove();
54542 var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
54543 layerEnter.append("g").attr("class", "sequences");
54544 layerEnter.append("g").attr("class", "markers");
54545 layer = layerEnter.merge(layer);
54547 if (service && ~~context.map().zoom() >= minZoom4) {
54550 service.loadBubbles(projection2);
54556 drawImages.enabled = function(_2) {
54557 if (!arguments.length)
54558 return svgStreetside.enabled;
54559 svgStreetside.enabled = _2;
54560 if (svgStreetside.enabled) {
54562 context.photos().on("change.streetside", update);
54565 context.photos().on("change.streetside", null);
54567 dispatch14.call("change");
54570 drawImages.supported = function() {
54571 return !!getService();
54573 drawImages.rendered = function(zoom) {
54574 return zoom >= minZoom4;
54580 // modules/svg/vegbilder.js
54581 function svgVegbilder(projection2, context, dispatch14) {
54582 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
54583 const minZoom4 = 14;
54584 const minMarkerZoom = 16;
54585 const minViewfieldZoom2 = 18;
54586 let layer = select_default2(null);
54587 let _viewerYaw = 0;
54590 if (svgVegbilder.initialized)
54592 svgVegbilder.enabled = false;
54593 svgVegbilder.initialized = true;
54595 function getService() {
54596 if (services.vegbilder && !_vegbilder) {
54597 _vegbilder = services.vegbilder;
54598 _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
54599 } else if (!services.vegbilder && _vegbilder) {
54604 function showLayer() {
54605 const service = getService();
54609 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
54611 function hideLayer() {
54612 throttledRedraw.cancel();
54613 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54615 function editOn() {
54616 layer.style("display", "block");
54618 function editOff() {
54619 layer.selectAll(".viewfield-group").remove();
54620 layer.style("display", "none");
54622 function click(d3_event, d2) {
54623 const service = getService();
54626 service.ensureViewerLoaded(context).then(() => {
54627 service.selectImage(context, d2.key).showViewer(context);
54629 context.map().centerEase(d2.loc);
54631 function mouseover(d3_event, d2) {
54632 const service = getService();
54634 service.setStyles(context, d2);
54636 function mouseout() {
54637 const service = getService();
54639 service.setStyles(context, null);
54641 function transform2(d2, selected) {
54642 let t2 = svgPointTransform(projection2)(d2);
54644 if (d2 === selected) {
54648 t2 += " rotate(" + Math.floor(rot) + ",0,0)";
54652 function viewerChanged() {
54653 const service = getService();
54656 const frame2 = service.photoFrame();
54657 _viewerYaw = frame2.getYaw();
54658 if (context.map().isTransformed())
54660 layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
54662 function filterImages(images) {
54663 const photoContext = context.photos();
54664 const fromDateString = photoContext.fromDate();
54665 const toDateString = photoContext.toDate();
54666 const showsFlat = photoContext.showsFlat();
54667 const showsPano = photoContext.showsPanoramic();
54668 if (fromDateString) {
54669 const fromDate = new Date(fromDateString);
54670 images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
54672 if (toDateString) {
54673 const toDate = new Date(toDateString);
54674 images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
54677 images = images.filter((image) => !image.is_sphere);
54680 images = images.filter((image) => image.is_sphere);
54684 function filterSequences(sequences) {
54685 const photoContext = context.photos();
54686 const fromDateString = photoContext.fromDate();
54687 const toDateString = photoContext.toDate();
54688 const showsFlat = photoContext.showsFlat();
54689 const showsPano = photoContext.showsPanoramic();
54690 if (fromDateString) {
54691 const fromDate = new Date(fromDateString);
54692 sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
54694 if (toDateString) {
54695 const toDate = new Date(toDateString);
54696 sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
54699 sequences = sequences.filter(({ images }) => !images[0].is_sphere);
54702 sequences = sequences.filter(({ images }) => images[0].is_sphere);
54706 function update() {
54707 const viewer = context.container().select(".photoviewer");
54708 const selected = viewer.empty() ? void 0 : viewer.datum();
54709 const z2 = ~~context.map().zoom();
54710 const showMarkers = z2 >= minMarkerZoom;
54711 const showViewfields = z2 >= minViewfieldZoom2;
54712 const service = getService();
54713 let sequences = [];
54716 service.loadImages(context);
54717 sequences = service.sequences(projection2);
54718 images = showMarkers ? service.images(projection2) : [];
54719 images = filterImages(images);
54720 sequences = filterSequences(sequences);
54722 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
54723 traces.exit().remove();
54724 traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54725 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
54726 groups.exit().remove();
54727 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54728 groupsEnter.append("g").attr("class", "viewfield-scale");
54729 const markers = groups.merge(groupsEnter).sort((a2, b2) => {
54730 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
54731 }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
54732 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54733 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54734 viewfields.exit().remove();
54735 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54736 function viewfieldPath() {
54737 const d2 = this.parentNode.__data__;
54738 if (d2.is_sphere) {
54739 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54741 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54745 function drawImages(selection2) {
54746 const enabled = svgVegbilder.enabled;
54747 const service = getService();
54748 layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
54749 layer.exit().remove();
54750 const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
54751 layerEnter.append("g").attr("class", "sequences");
54752 layerEnter.append("g").attr("class", "markers");
54753 layer = layerEnter.merge(layer);
54755 if (service && ~~context.map().zoom() >= minZoom4) {
54758 service.loadImages(context);
54764 drawImages.enabled = function(_2) {
54765 if (!arguments.length)
54766 return svgVegbilder.enabled;
54767 svgVegbilder.enabled = _2;
54768 if (svgVegbilder.enabled) {
54770 context.photos().on("change.vegbilder", update);
54773 context.photos().on("change.vegbilder", null);
54775 dispatch14.call("change");
54778 drawImages.supported = function() {
54779 return !!getService();
54781 drawImages.rendered = function(zoom) {
54782 return zoom >= minZoom4;
54784 drawImages.validHere = function(extent, zoom) {
54785 return zoom >= minZoom4 - 2 && getService().validHere(extent);
54791 // modules/svg/mapillary_images.js
54792 function svgMapillaryImages(projection2, context, dispatch14) {
54793 const throttledRedraw = throttle_default(function() {
54794 dispatch14.call("change");
54796 const minZoom4 = 12;
54797 const minMarkerZoom = 16;
54798 const minViewfieldZoom2 = 18;
54799 let layer = select_default2(null);
54802 if (svgMapillaryImages.initialized)
54804 svgMapillaryImages.enabled = false;
54805 svgMapillaryImages.initialized = true;
54807 function getService() {
54808 if (services.mapillary && !_mapillary) {
54809 _mapillary = services.mapillary;
54810 _mapillary.event.on("loadedImages", throttledRedraw);
54811 } else if (!services.mapillary && _mapillary) {
54816 function showLayer() {
54817 const service = getService();
54821 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54822 dispatch14.call("change");
54825 function hideLayer() {
54826 throttledRedraw.cancel();
54827 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54829 function editOn() {
54830 layer.style("display", "block");
54832 function editOff() {
54833 layer.selectAll(".viewfield-group").remove();
54834 layer.style("display", "none");
54836 function click(d3_event, image) {
54837 const service = getService();
54840 service.ensureViewerLoaded(context).then(function() {
54841 service.selectImage(context, image.id).showViewer(context);
54843 context.map().centerEase(image.loc);
54845 function mouseover(d3_event, image) {
54846 const service = getService();
54848 service.setStyles(context, image);
54850 function mouseout() {
54851 const service = getService();
54853 service.setStyles(context, null);
54855 function transform2(d2) {
54856 let t2 = svgPointTransform(projection2)(d2);
54858 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
54862 function filterImages(images) {
54863 const showsPano = context.photos().showsPanoramic();
54864 const showsFlat = context.photos().showsFlat();
54865 const fromDate = context.photos().fromDate();
54866 const toDate = context.photos().toDate();
54867 if (!showsPano || !showsFlat) {
54868 images = images.filter(function(image) {
54875 images = images.filter(function(image) {
54876 return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
54880 images = images.filter(function(image) {
54881 return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
54886 function filterSequences(sequences) {
54887 const showsPano = context.photos().showsPanoramic();
54888 const showsFlat = context.photos().showsFlat();
54889 const fromDate = context.photos().fromDate();
54890 const toDate = context.photos().toDate();
54891 if (!showsPano || !showsFlat) {
54892 sequences = sequences.filter(function(sequence) {
54893 if (sequence.properties.hasOwnProperty("is_pano")) {
54894 if (sequence.properties.is_pano)
54902 sequences = sequences.filter(function(sequence) {
54903 return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
54907 sequences = sequences.filter(function(sequence) {
54908 return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
54913 function update() {
54914 const z2 = ~~context.map().zoom();
54915 const showMarkers = z2 >= minMarkerZoom;
54916 const showViewfields = z2 >= minViewfieldZoom2;
54917 const service = getService();
54918 let sequences = service ? service.sequences(projection2) : [];
54919 let images = service && showMarkers ? service.images(projection2) : [];
54920 images = filterImages(images);
54921 sequences = filterSequences(sequences, service);
54922 service.filterViewer(context);
54923 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54924 return d2.properties.id;
54926 traces.exit().remove();
54927 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54928 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
54931 groups.exit().remove();
54932 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54933 groupsEnter.append("g").attr("class", "viewfield-scale");
54934 const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54935 return b2.loc[1] - a2.loc[1];
54936 }).attr("transform", transform2).select(".viewfield-scale");
54937 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54938 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54939 viewfields.exit().remove();
54940 viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
54941 return this.parentNode.__data__.is_pano;
54942 }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54943 function viewfieldPath() {
54944 if (this.parentNode.__data__.is_pano) {
54945 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54947 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54951 function drawImages(selection2) {
54952 const enabled = svgMapillaryImages.enabled;
54953 const service = getService();
54954 layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
54955 layer.exit().remove();
54956 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
54957 layerEnter.append("g").attr("class", "sequences");
54958 layerEnter.append("g").attr("class", "markers");
54959 layer = layerEnter.merge(layer);
54961 if (service && ~~context.map().zoom() >= minZoom4) {
54964 service.loadImages(projection2);
54970 drawImages.enabled = function(_2) {
54971 if (!arguments.length)
54972 return svgMapillaryImages.enabled;
54973 svgMapillaryImages.enabled = _2;
54974 if (svgMapillaryImages.enabled) {
54976 context.photos().on("change.mapillary_images", update);
54979 context.photos().on("change.mapillary_images", null);
54981 dispatch14.call("change");
54984 drawImages.supported = function() {
54985 return !!getService();
54987 drawImages.rendered = function(zoom) {
54988 return zoom >= minZoom4;
54994 // modules/svg/mapillary_position.js
54995 function svgMapillaryPosition(projection2, context) {
54996 const throttledRedraw = throttle_default(function() {
54999 const minZoom4 = 12;
55000 const minViewfieldZoom2 = 18;
55001 let layer = select_default2(null);
55003 let viewerCompassAngle;
55005 if (svgMapillaryPosition.initialized)
55007 svgMapillaryPosition.initialized = true;
55009 function getService() {
55010 if (services.mapillary && !_mapillary) {
55011 _mapillary = services.mapillary;
55012 _mapillary.event.on("imageChanged", throttledRedraw);
55013 _mapillary.event.on("bearingChanged", function(e3) {
55014 viewerCompassAngle = e3.bearing;
55015 if (context.map().isTransformed())
55017 layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
55019 }).attr("transform", transform2);
55021 } else if (!services.mapillary && _mapillary) {
55026 function editOn() {
55027 layer.style("display", "block");
55029 function editOff() {
55030 layer.selectAll(".viewfield-group").remove();
55031 layer.style("display", "none");
55033 function transform2(d2) {
55034 let t2 = svgPointTransform(projection2)(d2);
55035 if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
55036 t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
55037 } else if (d2.ca) {
55038 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55042 function update() {
55043 const z2 = ~~context.map().zoom();
55044 const showViewfields = z2 >= minViewfieldZoom2;
55045 const service = getService();
55046 const image = service && service.getActiveImage();
55047 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
55050 groups.exit().remove();
55051 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
55052 groupsEnter.append("g").attr("class", "viewfield-scale");
55053 const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
55054 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55055 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55056 viewfields.exit().remove();
55057 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
55059 function drawImages(selection2) {
55060 const service = getService();
55061 layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
55062 layer.exit().remove();
55063 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
55064 layerEnter.append("g").attr("class", "markers");
55065 layer = layerEnter.merge(layer);
55066 if (service && ~~context.map().zoom() >= minZoom4) {
55073 drawImages.enabled = function() {
55077 drawImages.supported = function() {
55078 return !!getService();
55080 drawImages.rendered = function(zoom) {
55081 return zoom >= minZoom4;
55087 // modules/svg/mapillary_signs.js
55088 function svgMapillarySigns(projection2, context, dispatch14) {
55089 const throttledRedraw = throttle_default(function() {
55090 dispatch14.call("change");
55092 const minZoom4 = 12;
55093 let layer = select_default2(null);
55096 if (svgMapillarySigns.initialized)
55098 svgMapillarySigns.enabled = false;
55099 svgMapillarySigns.initialized = true;
55101 function getService() {
55102 if (services.mapillary && !_mapillary) {
55103 _mapillary = services.mapillary;
55104 _mapillary.event.on("loadedSigns", throttledRedraw);
55105 } else if (!services.mapillary && _mapillary) {
55110 function showLayer() {
55111 const service = getService();
55114 service.loadSignResources(context);
55117 function hideLayer() {
55118 throttledRedraw.cancel();
55121 function editOn() {
55122 layer.style("display", "block");
55124 function editOff() {
55125 layer.selectAll(".icon-sign").remove();
55126 layer.style("display", "none");
55128 function click(d3_event, d2) {
55129 const service = getService();
55132 context.map().centerEase(d2.loc);
55133 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
55134 service.getDetections(d2.id).then((detections) => {
55135 if (detections.length) {
55136 const imageId = detections[0].image.id;
55137 if (imageId === selectedImageId) {
55138 service.highlightDetection(detections[0]).selectImage(context, imageId);
55140 service.ensureViewerLoaded(context).then(function() {
55141 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
55147 function filterData(detectedFeatures) {
55148 var fromDate = context.photos().fromDate();
55149 var toDate = context.photos().toDate();
55151 var fromTimestamp = new Date(fromDate).getTime();
55152 detectedFeatures = detectedFeatures.filter(function(feature3) {
55153 return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
55157 var toTimestamp = new Date(toDate).getTime();
55158 detectedFeatures = detectedFeatures.filter(function(feature3) {
55159 return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
55162 return detectedFeatures;
55164 function update() {
55165 const service = getService();
55166 let data = service ? service.signs(projection2) : [];
55167 data = filterData(data);
55168 const transform2 = svgPointTransform(projection2);
55169 const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
55172 signs.exit().remove();
55173 const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
55174 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
55175 return "#" + d2.value;
55177 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
55178 signs.merge(enter).attr("transform", transform2);
55180 function drawSigns(selection2) {
55181 const enabled = svgMapillarySigns.enabled;
55182 const service = getService();
55183 layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
55184 layer.exit().remove();
55185 layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
55187 if (service && ~~context.map().zoom() >= minZoom4) {
55190 service.loadSigns(projection2);
55191 service.showSignDetections(true);
55195 } else if (service) {
55196 service.showSignDetections(false);
55199 drawSigns.enabled = function(_2) {
55200 if (!arguments.length)
55201 return svgMapillarySigns.enabled;
55202 svgMapillarySigns.enabled = _2;
55203 if (svgMapillarySigns.enabled) {
55205 context.photos().on("change.mapillary_signs", update);
55208 context.photos().on("change.mapillary_signs", null);
55210 dispatch14.call("change");
55213 drawSigns.supported = function() {
55214 return !!getService();
55216 drawSigns.rendered = function(zoom) {
55217 return zoom >= minZoom4;
55223 // modules/svg/mapillary_map_features.js
55224 function svgMapillaryMapFeatures(projection2, context, dispatch14) {
55225 const throttledRedraw = throttle_default(function() {
55226 dispatch14.call("change");
55228 const minZoom4 = 12;
55229 let layer = select_default2(null);
55232 if (svgMapillaryMapFeatures.initialized)
55234 svgMapillaryMapFeatures.enabled = false;
55235 svgMapillaryMapFeatures.initialized = true;
55237 function getService() {
55238 if (services.mapillary && !_mapillary) {
55239 _mapillary = services.mapillary;
55240 _mapillary.event.on("loadedMapFeatures", throttledRedraw);
55241 } else if (!services.mapillary && _mapillary) {
55246 function showLayer() {
55247 const service = getService();
55250 service.loadObjectResources(context);
55253 function hideLayer() {
55254 throttledRedraw.cancel();
55257 function editOn() {
55258 layer.style("display", "block");
55260 function editOff() {
55261 layer.selectAll(".icon-map-feature").remove();
55262 layer.style("display", "none");
55264 function click(d3_event, d2) {
55265 const service = getService();
55268 context.map().centerEase(d2.loc);
55269 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
55270 service.getDetections(d2.id).then((detections) => {
55271 if (detections.length) {
55272 const imageId = detections[0].image.id;
55273 if (imageId === selectedImageId) {
55274 service.highlightDetection(detections[0]).selectImage(context, imageId);
55276 service.ensureViewerLoaded(context).then(function() {
55277 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
55283 function filterData(detectedFeatures) {
55284 const fromDate = context.photos().fromDate();
55285 const toDate = context.photos().toDate();
55287 detectedFeatures = detectedFeatures.filter(function(feature3) {
55288 return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
55292 detectedFeatures = detectedFeatures.filter(function(feature3) {
55293 return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
55296 return detectedFeatures;
55298 function update() {
55299 const service = getService();
55300 let data = service ? service.mapFeatures(projection2) : [];
55301 data = filterData(data);
55302 const transform2 = svgPointTransform(projection2);
55303 const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
55306 mapFeatures.exit().remove();
55307 const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
55308 enter.append("title").text(function(d2) {
55309 var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
55310 return _t("mapillary_map_features." + id2);
55312 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
55313 if (d2.value === "object--billboard") {
55314 return "#object--sign--advertisement";
55316 return "#" + d2.value;
55318 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
55319 mapFeatures.merge(enter).attr("transform", transform2);
55321 function drawMapFeatures(selection2) {
55322 const enabled = svgMapillaryMapFeatures.enabled;
55323 const service = getService();
55324 layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
55325 layer.exit().remove();
55326 layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
55328 if (service && ~~context.map().zoom() >= minZoom4) {
55331 service.loadMapFeatures(projection2);
55332 service.showFeatureDetections(true);
55336 } else if (service) {
55337 service.showFeatureDetections(false);
55340 drawMapFeatures.enabled = function(_2) {
55341 if (!arguments.length)
55342 return svgMapillaryMapFeatures.enabled;
55343 svgMapillaryMapFeatures.enabled = _2;
55344 if (svgMapillaryMapFeatures.enabled) {
55346 context.photos().on("change.mapillary_map_features", update);
55349 context.photos().on("change.mapillary_map_features", null);
55351 dispatch14.call("change");
55354 drawMapFeatures.supported = function() {
55355 return !!getService();
55357 drawMapFeatures.rendered = function(zoom) {
55358 return zoom >= minZoom4;
55361 return drawMapFeatures;
55364 // modules/svg/kartaview_images.js
55365 function svgKartaviewImages(projection2, context, dispatch14) {
55366 var throttledRedraw = throttle_default(function() {
55367 dispatch14.call("change");
55370 var minMarkerZoom = 16;
55371 var minViewfieldZoom2 = 18;
55372 var layer = select_default2(null);
55375 if (svgKartaviewImages.initialized)
55377 svgKartaviewImages.enabled = false;
55378 svgKartaviewImages.initialized = true;
55380 function getService() {
55381 if (services.kartaview && !_kartaview) {
55382 _kartaview = services.kartaview;
55383 _kartaview.event.on("loadedImages", throttledRedraw);
55384 } else if (!services.kartaview && _kartaview) {
55389 function showLayer() {
55390 var service = getService();
55394 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55395 dispatch14.call("change");
55398 function hideLayer() {
55399 throttledRedraw.cancel();
55400 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55402 function editOn() {
55403 layer.style("display", "block");
55405 function editOff() {
55406 layer.selectAll(".viewfield-group").remove();
55407 layer.style("display", "none");
55409 function click(d3_event, d2) {
55410 var service = getService();
55413 service.ensureViewerLoaded(context).then(function() {
55414 service.selectImage(context, d2.key).showViewer(context);
55416 context.map().centerEase(d2.loc);
55418 function mouseover(d3_event, d2) {
55419 var service = getService();
55421 service.setStyles(context, d2);
55423 function mouseout() {
55424 var service = getService();
55426 service.setStyles(context, null);
55428 function transform2(d2) {
55429 var t2 = svgPointTransform(projection2)(d2);
55431 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
55435 function filterImages(images) {
55436 var fromDate = context.photos().fromDate();
55437 var toDate = context.photos().toDate();
55438 var usernames = context.photos().usernames();
55440 var fromTimestamp = new Date(fromDate).getTime();
55441 images = images.filter(function(item) {
55442 return new Date(item.captured_at).getTime() >= fromTimestamp;
55446 var toTimestamp = new Date(toDate).getTime();
55447 images = images.filter(function(item) {
55448 return new Date(item.captured_at).getTime() <= toTimestamp;
55452 images = images.filter(function(item) {
55453 return usernames.indexOf(item.captured_by) !== -1;
55458 function filterSequences(sequences) {
55459 var fromDate = context.photos().fromDate();
55460 var toDate = context.photos().toDate();
55461 var usernames = context.photos().usernames();
55463 var fromTimestamp = new Date(fromDate).getTime();
55464 sequences = sequences.filter(function(image) {
55465 return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
55469 var toTimestamp = new Date(toDate).getTime();
55470 sequences = sequences.filter(function(image) {
55471 return new Date(image.properties.captured_at).getTime() <= toTimestamp;
55475 sequences = sequences.filter(function(image) {
55476 return usernames.indexOf(image.properties.captured_by) !== -1;
55481 function update() {
55482 var viewer = context.container().select(".photoviewer");
55483 var selected = viewer.empty() ? void 0 : viewer.datum();
55484 var z2 = ~~context.map().zoom();
55485 var showMarkers = z2 >= minMarkerZoom;
55486 var showViewfields = z2 >= minViewfieldZoom2;
55487 var service = getService();
55488 var sequences = [];
55490 if (context.photos().showsFlat()) {
55491 sequences = service ? service.sequences(projection2) : [];
55492 images = service && showMarkers ? service.images(projection2) : [];
55493 sequences = filterSequences(sequences);
55494 images = filterImages(images);
55496 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55497 return d2.properties.key;
55499 traces.exit().remove();
55500 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55501 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
55504 groups.exit().remove();
55505 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55506 groupsEnter.append("g").attr("class", "viewfield-scale");
55507 var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55508 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
55509 }).attr("transform", transform2).select(".viewfield-scale");
55510 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55511 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55512 viewfields.exit().remove();
55513 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z");
55515 function drawImages(selection2) {
55516 var enabled = svgKartaviewImages.enabled, service = getService();
55517 layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
55518 layer.exit().remove();
55519 var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
55520 layerEnter.append("g").attr("class", "sequences");
55521 layerEnter.append("g").attr("class", "markers");
55522 layer = layerEnter.merge(layer);
55524 if (service && ~~context.map().zoom() >= minZoom4) {
55527 service.loadImages(projection2);
55533 drawImages.enabled = function(_2) {
55534 if (!arguments.length)
55535 return svgKartaviewImages.enabled;
55536 svgKartaviewImages.enabled = _2;
55537 if (svgKartaviewImages.enabled) {
55539 context.photos().on("change.kartaview_images", update);
55542 context.photos().on("change.kartaview_images", null);
55544 dispatch14.call("change");
55547 drawImages.supported = function() {
55548 return !!getService();
55550 drawImages.rendered = function(zoom) {
55551 return zoom >= minZoom4;
55557 // modules/svg/mapilio_images.js
55558 function svgMapilioImages(projection2, context, dispatch14) {
55559 const throttledRedraw = throttle_default(function() {
55560 dispatch14.call("change");
55562 const minZoom4 = 12;
55563 let layer = select_default2(null);
55565 const viewFieldZoomLevel = 18;
55567 if (svgMapilioImages.initialized)
55569 svgMapilioImages.enabled = false;
55570 svgMapilioImages.initialized = true;
55572 function getService() {
55573 if (services.mapilio && !_mapilio) {
55574 _mapilio = services.mapilio;
55575 _mapilio.event.on("loadedImages", throttledRedraw);
55576 } else if (!services.mapilio && _mapilio) {
55581 function showLayer() {
55582 const service = getService();
55586 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
55587 dispatch14.call("change");
55590 function hideLayer() {
55591 throttledRedraw.cancel();
55592 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
55594 function transform2(d2) {
55595 let t2 = svgPointTransform(projection2)(d2);
55597 t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
55601 function editOn() {
55602 layer.style("display", "block");
55604 function editOff() {
55605 layer.selectAll(".viewfield-group").remove();
55606 layer.style("display", "none");
55608 function click(d3_event, image) {
55609 const service = getService();
55612 service.ensureViewerLoaded(context, image.id).then(function() {
55613 service.selectImage(context, image.id).showViewer(context);
55615 context.map().centerEase(image.loc);
55617 function mouseover(d3_event, image) {
55618 const service = getService();
55620 service.setStyles(context, image);
55622 function mouseout() {
55623 const service = getService();
55625 service.setStyles(context, null);
55627 function update() {
55628 const z2 = ~~context.map().zoom();
55629 const showViewfields = z2 >= viewFieldZoomLevel;
55630 const service = getService();
55631 let sequences = service ? service.sequences(projection2) : [];
55632 let images = service ? service.images(projection2) : [];
55633 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
55634 return d2.properties.id;
55636 traces.exit().remove();
55637 traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
55638 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
55641 groups.exit().remove();
55642 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
55643 groupsEnter.append("g").attr("class", "viewfield-scale");
55644 const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
55645 return b2.loc[1] - a2.loc[1];
55646 }).attr("transform", transform2).select(".viewfield-scale");
55647 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
55648 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
55649 viewfields.exit().remove();
55650 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
55651 function viewfieldPath() {
55652 if (this.parentNode.__data__.isPano) {
55653 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
55655 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
55659 function drawImages(selection2) {
55660 const enabled = svgMapilioImages.enabled;
55661 const service = getService();
55662 layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
55663 layer.exit().remove();
55664 const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
55665 layerEnter.append("g").attr("class", "sequences");
55666 layerEnter.append("g").attr("class", "markers");
55667 layer = layerEnter.merge(layer);
55669 if (service && ~~context.map().zoom() >= minZoom4) {
55672 service.loadImages(projection2);
55673 service.loadLines(projection2);
55679 drawImages.enabled = function(_2) {
55680 if (!arguments.length)
55681 return svgMapilioImages.enabled;
55682 svgMapilioImages.enabled = _2;
55683 if (svgMapilioImages.enabled) {
55685 context.photos().on("change.mapilio_images", null);
55688 context.photos().on("change.mapilio_images", null);
55690 dispatch14.call("change");
55693 drawImages.supported = function() {
55694 return !!getService();
55696 drawImages.rendered = function(zoom) {
55697 return zoom >= minZoom4;
55703 // modules/svg/osm.js
55704 function svgOsm(projection2, context, dispatch14) {
55705 var enabled = true;
55706 function drawOsm(selection2) {
55707 selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
55708 return "layer-osm " + d2;
55710 selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
55711 return "points-group " + d2;
55714 function showLayer() {
55715 var layer = context.surface().selectAll(".data-layer.osm");
55717 layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
55718 dispatch14.call("change");
55721 function hideLayer() {
55722 var layer = context.surface().selectAll(".data-layer.osm");
55724 layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
55725 layer.classed("disabled", true);
55726 dispatch14.call("change");
55729 drawOsm.enabled = function(val) {
55730 if (!arguments.length)
55738 dispatch14.call("change");
55744 // modules/svg/notes.js
55745 var _notesEnabled = false;
55747 function svgNotes(projection2, context, dispatch14) {
55749 dispatch14 = dispatch_default("change");
55751 var throttledRedraw = throttle_default(function() {
55752 dispatch14.call("change");
55755 var touchLayer = select_default2(null);
55756 var drawLayer = select_default2(null);
55757 var _notesVisible = false;
55758 function markerPath(selection2, klass) {
55759 selection2.attr("class", klass).attr("transform", "translate(-8, -22)").attr("d", "m17.5,0l-15,0c-1.37,0 -2.5,1.12 -2.5,2.5l0,11.25c0,1.37 1.12,2.5 2.5,2.5l3.75,0l0,3.28c0,0.38 0.43,0.6 0.75,0.37l4.87,-3.65l5.62,0c1.37,0 2.5,-1.12 2.5,-2.5l0,-11.25c0,-1.37 -1.12,-2.5 -2.5,-2.5z");
55761 function getService() {
55762 if (services.osm && !_osmService) {
55763 _osmService = services.osm;
55764 _osmService.on("loadedNotes", throttledRedraw);
55765 } else if (!services.osm && _osmService) {
55766 _osmService = null;
55768 return _osmService;
55770 function editOn() {
55771 if (!_notesVisible) {
55772 _notesVisible = true;
55773 drawLayer.style("display", "block");
55776 function editOff() {
55777 if (_notesVisible) {
55778 _notesVisible = false;
55779 drawLayer.style("display", "none");
55780 drawLayer.selectAll(".note").remove();
55781 touchLayer.selectAll(".note").remove();
55784 function layerOn() {
55786 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
55787 dispatch14.call("change");
55790 function layerOff() {
55791 throttledRedraw.cancel();
55792 drawLayer.interrupt();
55793 touchLayer.selectAll(".note").remove();
55794 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
55796 dispatch14.call("change");
55799 function updateMarkers() {
55800 if (!_notesVisible || !_notesEnabled)
55802 var service = getService();
55803 var selectedID = context.selectedNoteID();
55804 var data = service ? service.notes(projection2) : [];
55805 var getTransform = svgPointTransform(projection2);
55806 var notes = drawLayer.selectAll(".note").data(data, function(d2) {
55807 return d2.status + d2.id;
55809 notes.exit().remove();
55810 var notesEnter = notes.enter().append("g").attr("class", function(d2) {
55811 return "note note-" + d2.id + " " + d2.status;
55812 }).classed("new", function(d2) {
55815 notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
55816 notesEnter.append("path").call(markerPath, "shadow");
55817 notesEnter.append("use").attr("class", "note-fill").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").attr("xlink:href", "#iD-icon-note");
55818 notesEnter.selectAll(".icon-annotation").data(function(d2) {
55820 }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
55822 return "#iD-icon-plus";
55823 if (d2.status === "open")
55824 return "#iD-icon-close";
55825 return "#iD-icon-apply";
55827 notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
55828 var mode = context.mode();
55829 var isMoving = mode && mode.id === "drag-note";
55830 return !isMoving && d2.id === selectedID;
55831 }).attr("transform", getTransform);
55832 if (touchLayer.empty())
55834 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
55835 var targets = touchLayer.selectAll(".note").data(data, function(d2) {
55838 targets.exit().remove();
55839 targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
55840 var newClass = d2.id < 0 ? "new" : "";
55841 return "note target note-" + d2.id + " " + fillClass + newClass;
55842 }).attr("transform", getTransform);
55843 function sortY(a2, b2) {
55844 if (a2.id === selectedID)
55846 if (b2.id === selectedID)
55848 return b2.loc[1] - a2.loc[1];
55851 function drawNotes(selection2) {
55852 var service = getService();
55853 var surface = context.surface();
55854 if (surface && !surface.empty()) {
55855 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
55857 drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
55858 drawLayer.exit().remove();
55859 drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
55860 if (_notesEnabled) {
55861 if (service && ~~context.map().zoom() >= minZoom4) {
55863 service.loadNotes(projection2);
55870 drawNotes.enabled = function(val) {
55871 if (!arguments.length)
55872 return _notesEnabled;
55873 _notesEnabled = val;
55874 if (_notesEnabled) {
55878 if (context.selectedNoteID()) {
55879 context.enter(modeBrowse(context));
55882 dispatch14.call("change");
55888 // modules/svg/touch.js
55889 function svgTouch() {
55890 function drawTouch(selection2) {
55891 selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
55892 return "layer-touch " + d2;
55898 // modules/util/dimensions.js
55899 function refresh(selection2, node) {
55900 var cr = node.getBoundingClientRect();
55901 var prop = [cr.width, cr.height];
55902 selection2.property("__dimensions__", prop);
55905 function utilGetDimensions(selection2, force) {
55906 if (!selection2 || selection2.empty()) {
55909 var node = selection2.node(), cached = selection2.property("__dimensions__");
55910 return !cached || force ? refresh(selection2, node) : cached;
55912 function utilSetDimensions(selection2, dimensions) {
55913 if (!selection2 || selection2.empty()) {
55916 var node = selection2.node();
55917 if (dimensions === null) {
55918 refresh(selection2, node);
55921 return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
55924 // modules/svg/layers.js
55925 function svgLayers(projection2, context) {
55926 var dispatch14 = dispatch_default("change");
55927 var svg2 = select_default2(null);
55929 { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
55930 { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
55931 { id: "data", layer: svgData(projection2, context, dispatch14) },
55932 { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
55933 { id: "improveOSM", layer: svgImproveOSM(projection2, context, dispatch14) },
55934 { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
55935 { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
55936 { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
55937 { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
55938 { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
55939 { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
55940 { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
55941 { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
55942 { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
55943 { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
55944 { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
55945 { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
55946 { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
55948 function drawLayers(selection2) {
55949 svg2 = selection2.selectAll(".surface").data([0]);
55950 svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
55951 var defs = svg2.selectAll(".surface-defs").data([0]);
55952 defs.enter().append("defs").attr("class", "surface-defs");
55953 var groups = svg2.selectAll(".data-layer").data(_layers);
55954 groups.exit().remove();
55955 groups.enter().append("g").attr("class", function(d2) {
55956 return "data-layer " + d2.id;
55957 }).merge(groups).each(function(d2) {
55958 select_default2(this).call(d2.layer);
55961 drawLayers.all = function() {
55964 drawLayers.layer = function(id2) {
55965 var obj = _layers.find(function(o2) {
55966 return o2.id === id2;
55968 return obj && obj.layer;
55970 drawLayers.only = function(what) {
55971 var arr = [].concat(what);
55972 var all = _layers.map(function(layer) {
55975 return drawLayers.remove(utilArrayDifference(all, arr));
55977 drawLayers.remove = function(what) {
55978 var arr = [].concat(what);
55979 arr.forEach(function(id2) {
55980 _layers = _layers.filter(function(o2) {
55981 return o2.id !== id2;
55984 dispatch14.call("change");
55987 drawLayers.add = function(what) {
55988 var arr = [].concat(what);
55989 arr.forEach(function(obj) {
55990 if ("id" in obj && "layer" in obj) {
55994 dispatch14.call("change");
55997 drawLayers.dimensions = function(val) {
55998 if (!arguments.length)
55999 return utilGetDimensions(svg2);
56000 utilSetDimensions(svg2, val);
56003 return utilRebind(drawLayers, dispatch14, "on");
56006 // modules/svg/lines.js
56007 var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
56008 function svgLines(projection2, context) {
56009 var detected = utilDetect();
56010 var highway_stack = {
56025 function drawTargets(selection2, graph, entities, filter2) {
56026 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
56027 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
56028 var getPath = svgPath(projection2).geojson;
56029 var activeID = context.activeID();
56030 var base = context.history().base();
56031 var data = { targets: [], nopes: [] };
56032 entities.forEach(function(way) {
56033 var features = svgSegmentWay(way, graph, activeID);
56034 data.targets.push.apply(data.targets, features.passive);
56035 data.nopes.push.apply(data.nopes, features.active);
56037 var targetData = data.targets.filter(getPath);
56038 var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
56039 return filter2(d2.properties.entity);
56040 }).data(targetData, function key(d2) {
56043 targets.exit().remove();
56044 var segmentWasEdited = function(d2) {
56045 var wayID = d2.properties.entity.id;
56046 if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
56049 return d2.properties.nodes.some(function(n3) {
56050 return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
56053 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
56054 return "way line target target-allowed " + targetClass + d2.id;
56055 }).classed("segment-edited", segmentWasEdited);
56056 var nopeData = data.nopes.filter(getPath);
56057 var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
56058 return filter2(d2.properties.entity);
56059 }).data(nopeData, function key(d2) {
56062 nopes.exit().remove();
56063 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
56064 return "way line target target-nope " + nopeClass + d2.id;
56065 }).classed("segment-edited", segmentWasEdited);
56067 function drawLines(selection2, graph, entities, filter2) {
56068 var base = context.history().base();
56069 function waystack(a2, b2) {
56070 var selected = context.selectedIDs();
56071 var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
56072 var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
56073 if (a2.tags.highway) {
56074 scoreA -= highway_stack[a2.tags.highway];
56076 if (b2.tags.highway) {
56077 scoreB -= highway_stack[b2.tags.highway];
56079 return scoreA - scoreB;
56081 function drawLineGroup(selection3, klass, isSelected) {
56082 var mode = context.mode();
56083 var isDrawing = mode && /^draw/.test(mode.id);
56084 var selectedClass = !isDrawing && isSelected ? "selected " : "";
56085 var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
56086 lines.exit().remove();
56087 lines.enter().append("path").attr("class", function(d2) {
56088 var prefix = "way line";
56089 if (!d2.hasInterestingTags()) {
56090 var parentRelations = graph.parentRelations(d2);
56091 var parentMultipolygons = parentRelations.filter(function(relation) {
56092 return relation.isMultipolygon();
56094 if (parentMultipolygons.length > 0 && // and only multipolygon relations
56095 parentRelations.length === parentMultipolygons.length) {
56096 prefix = "relation area";
56099 var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
56100 return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
56101 }).classed("added", function(d2) {
56102 return !base.entities[d2.id];
56103 }).classed("geometry-edited", function(d2) {
56104 return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].nodes, base.entities[d2.id].nodes);
56105 }).classed("retagged", function(d2) {
56106 return graph.entities[d2.id] && base.entities[d2.id] && !(0, import_fast_deep_equal6.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
56107 }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
56110 function getPathData(isSelected) {
56111 return function() {
56112 var layer = this.parentNode.__data__;
56113 var data = pathdata[layer] || [];
56114 return data.filter(function(d2) {
56116 return context.selectedIDs().indexOf(d2.id) !== -1;
56118 return context.selectedIDs().indexOf(d2.id) === -1;
56123 function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
56124 var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
56125 markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
56126 var markers = markergroup.selectAll("path").filter(filter2).data(
56128 return groupdata[this.parentNode.__data__] || [];
56131 return [d2.id, d2.index];
56134 markers.exit().remove();
56135 markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
56139 markers.each(function() {
56140 this.parentNode.insertBefore(this, this);
56144 var getPath = svgPath(projection2, graph);
56146 var onewaydata = {};
56147 var sideddata = {};
56148 var oldMultiPolygonOuters = {};
56149 for (var i3 = 0; i3 < entities.length; i3++) {
56150 var entity = entities[i3];
56151 if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
56155 ways = ways.filter(getPath);
56156 var pathdata = utilArrayGroupBy(ways, function(way) {
56157 return way.layer();
56159 Object.keys(pathdata).forEach(function(k2) {
56160 var v2 = pathdata[k2];
56161 var onewayArr = v2.filter(function(d2) {
56162 return d2.isOneWay();
56164 var onewaySegments = svgMarkerSegments(
56168 function shouldReverse(entity2) {
56169 return entity2.tags.oneway === "-1";
56171 function bothDirections(entity2) {
56172 return entity2.tags.oneway === "reversible" || entity2.tags.oneway === "alternating";
56175 onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
56176 var sidedArr = v2.filter(function(d2) {
56177 return d2.isSided();
56179 var sidedSegments = svgMarkerSegments(
56183 function shouldReverse() {
56186 function bothDirections() {
56190 sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
56192 var covered = selection2.selectAll(".layer-osm.covered");
56193 var uncovered = selection2.selectAll(".layer-osm.lines");
56194 var touchLayer = selection2.selectAll(".layer-touch.lines");
56195 [covered, uncovered].forEach(function(selection3) {
56196 var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
56197 var layergroup = selection3.selectAll("g.layergroup").data(range3);
56198 layergroup = layergroup.enter().append("g").attr("class", function(d2) {
56199 return "layergroup layer" + String(d2);
56200 }).merge(layergroup);
56201 layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
56202 return "linegroup line-" + d2;
56204 layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
56205 layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
56206 layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
56207 layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
56208 layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
56209 layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
56210 addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
56216 function marker(d2) {
56217 var category = graph.entity(d2.id).sidednessIdentifier();
56218 return "url(#ideditor-sided-marker-" + category + ")";
56222 touchLayer.call(drawTargets, graph, ways, filter2);
56227 // modules/svg/midpoints.js
56228 function svgMidpoints(projection2, context) {
56229 var targetRadius = 8;
56230 function drawTargets(selection2, graph, entities, filter2) {
56231 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
56232 var getTransform = svgPointTransform(projection2).geojson;
56233 var data = entities.map(function(midpoint) {
56243 coordinates: midpoint.loc
56247 var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
56248 return filter2(d2.properties.entity);
56249 }).data(data, function key(d2) {
56252 targets.exit().remove();
56253 targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
56254 return "node midpoint target " + fillClass + d2.id;
56255 }).attr("transform", getTransform);
56257 function drawMidpoints(selection2, graph, entities, filter2, extent) {
56258 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
56259 var touchLayer = selection2.selectAll(".layer-touch.points");
56260 var mode = context.mode();
56261 if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
56262 drawLayer.selectAll(".midpoint").remove();
56263 touchLayer.selectAll(".midpoint.target").remove();
56266 var poly = extent.polygon();
56267 var midpoints = {};
56268 for (var i3 = 0; i3 < entities.length; i3++) {
56269 var entity = entities[i3];
56270 if (entity.type !== "way")
56272 if (!filter2(entity))
56274 if (context.selectedIDs().indexOf(entity.id) < 0)
56276 var nodes = graph.childNodes(entity);
56277 for (var j2 = 0; j2 < nodes.length - 1; j2++) {
56278 var a2 = nodes[j2];
56279 var b2 = nodes[j2 + 1];
56280 var id2 = [a2.id, b2.id].sort().join("-");
56281 if (midpoints[id2]) {
56282 midpoints[id2].parents.push(entity);
56283 } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
56284 var point2 = geoVecInterp(a2.loc, b2.loc, 0.5);
56286 if (extent.intersects(point2)) {
56289 for (var k2 = 0; k2 < 4; k2++) {
56290 point2 = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
56291 if (point2 && geoVecLength(projection2(a2.loc), projection2(point2)) > 20 && geoVecLength(projection2(b2.loc), projection2(point2)) > 20) {
56302 edge: [a2.id, b2.id],
56309 function midpointFilter(d2) {
56310 if (midpoints[d2.id])
56312 for (var i4 = 0; i4 < d2.parents.length; i4++) {
56313 if (filter2(d2.parents[i4])) {
56319 var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
56322 groups.exit().remove();
56323 var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
56324 enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
56325 enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
56326 groups = groups.merge(enter).attr("transform", function(d2) {
56327 var translate = svgPointTransform(projection2);
56328 var a3 = graph.entity(d2.edge[0]);
56329 var b3 = graph.entity(d2.edge[1]);
56330 var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
56331 return translate(d2) + " rotate(" + angle2 + ")";
56332 }).call(svgTagClasses().tags(
56334 return d2.parents[0].tags;
56337 groups.select("polygon.shadow");
56338 groups.select("polygon.fill");
56339 touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
56341 return drawMidpoints;
56344 // modules/svg/points.js
56345 var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
56346 function svgPoints(projection2, context) {
56347 function markerPath(selection2, klass) {
56348 selection2.attr("class", klass).attr("transform", "translate(-8, -23)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
56350 function sortY(a2, b2) {
56351 return b2.loc[1] - a2.loc[1];
56353 function fastEntityKey(d2) {
56354 var mode = context.mode();
56355 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
56356 return isMoving ? d2.id : osmEntity.key(d2);
56358 function drawTargets(selection2, graph, entities, filter2) {
56359 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
56360 var getTransform = svgPointTransform(projection2).geojson;
56361 var activeID = context.activeID();
56363 entities.forEach(function(node) {
56364 if (activeID === node.id)
56373 geometry: node.asGeoJSON()
56376 var targets = selection2.selectAll(".point.target").filter(function(d2) {
56377 return filter2(d2.properties.entity);
56378 }).data(data, function key(d2) {
56381 targets.exit().remove();
56382 targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
56383 return "node point target " + fillClass + d2.id;
56384 }).attr("transform", getTransform);
56386 function drawPoints(selection2, graph, entities, filter2) {
56387 var wireframe = context.surface().classed("fill-wireframe");
56388 var zoom = geoScaleToZoom(projection2.scale());
56389 var base = context.history().base();
56390 function renderAsPoint(entity) {
56391 return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
56393 var points = wireframe ? [] : entities.filter(renderAsPoint);
56394 points.sort(sortY);
56395 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
56396 var touchLayer = selection2.selectAll(".layer-touch.points");
56397 var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
56398 groups.exit().remove();
56399 var enter = groups.enter().append("g").attr("class", function(d2) {
56400 return "node point " + d2.id;
56402 enter.append("path").call(markerPath, "shadow");
56403 enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
56404 enter.append("path").call(markerPath, "stroke");
56405 enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
56406 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
56407 return !base.entities[d2.id];
56408 }).classed("moved", function(d2) {
56409 return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
56410 }).classed("retagged", function(d2) {
56411 return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
56412 }).call(svgTagClasses());
56413 groups.select(".shadow");
56414 groups.select(".stroke");
56415 groups.select(".icon").attr("xlink:href", function(entity) {
56416 var preset = _mainPresetIndex.match(entity, graph);
56417 var picon = preset && preset.icon;
56418 return picon ? "#" + picon : "";
56420 touchLayer.call(drawTargets, graph, points, filter2);
56425 // modules/svg/turns.js
56426 function svgTurns(projection2, context) {
56427 function icon2(turn) {
56428 var u2 = turn.u ? "-u" : "";
56430 return "#iD-turn-no" + u2;
56432 return "#iD-turn-only" + u2;
56433 return "#iD-turn-yes" + u2;
56435 function drawTurns(selection2, graph, turns) {
56436 function turnTransform(d2) {
56438 var toWay = graph.entity(d2.to.way);
56439 var toPoints = graph.childNodes(toWay).map(function(n3) {
56441 }).map(projection2);
56442 var toLength = geoPathLength(toPoints);
56443 var mid = toLength / 2;
56444 var toNode = graph.entity(d2.to.node);
56445 var toVertex = graph.entity(d2.to.vertex);
56446 var a2 = geoAngle(toVertex, toNode, projection2);
56447 var o2 = projection2(toVertex.loc);
56448 var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
56449 return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
56451 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
56452 var touchLayer = selection2.selectAll(".layer-touch.turns");
56453 var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
56456 groups.exit().remove();
56457 var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
56458 return "turn " + d2.key;
56460 var turnsEnter = groupsEnter.filter(function(d2) {
56463 turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
56464 turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
56465 var uEnter = groupsEnter.filter(function(d2) {
56468 uEnter.append("circle").attr("r", "16");
56469 uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
56470 groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
56471 return d2.direct === false ? "0.7" : null;
56472 }).attr("transform", turnTransform);
56473 groups.select("use").attr("xlink:href", icon2);
56474 groups.select("rect");
56475 groups.select("circle");
56476 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
56477 groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
56480 groups.exit().remove();
56481 groupsEnter = groups.enter().append("g").attr("class", function(d2) {
56482 return "turn " + d2.key;
56484 turnsEnter = groupsEnter.filter(function(d2) {
56487 turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
56488 uEnter = groupsEnter.filter(function(d2) {
56491 uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
56492 groups = groups.merge(groupsEnter).attr("transform", turnTransform);
56493 groups.select("rect");
56494 groups.select("circle");
56500 // modules/svg/vertices.js
56501 var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
56502 function svgVertices(projection2, context) {
56504 // z16-, z17, z18+, w/icon
56505 shadow: [6, 7.5, 7.5, 12],
56506 stroke: [2.5, 3.5, 3.5, 8],
56507 fill: [1, 1.5, 1.5, 1.5]
56509 var _currHoverTarget;
56510 var _currPersistent = {};
56511 var _currHover = {};
56512 var _prevHover = {};
56513 var _currSelected = {};
56514 var _prevSelected = {};
56516 function sortY(a2, b2) {
56517 return b2.loc[1] - a2.loc[1];
56519 function fastEntityKey(d2) {
56520 var mode = context.mode();
56521 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
56522 return isMoving ? d2.id : osmEntity.key(d2);
56524 function draw(selection2, graph, vertices, sets2, filter2) {
56525 sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
56527 var directions = {};
56528 var wireframe = context.surface().classed("fill-wireframe");
56529 var zoom = geoScaleToZoom(projection2.scale());
56530 var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
56531 var activeID = context.activeID();
56532 var base = context.history().base();
56533 function getIcon(d2) {
56534 var entity = graph.entity(d2.id);
56535 if (entity.id in icons)
56536 return icons[entity.id];
56537 icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
56538 return icons[entity.id];
56540 function getDirections(entity) {
56541 if (entity.id in directions)
56542 return directions[entity.id];
56543 var angles = entity.directions(graph, projection2);
56544 directions[entity.id] = angles.length ? angles : false;
56547 function updateAttributes(selection3) {
56548 ["shadow", "stroke", "fill"].forEach(function(klass) {
56549 var rads = radiuses[klass];
56550 selection3.selectAll("." + klass).each(function(entity) {
56551 var i3 = z2 && getIcon(entity);
56552 var r2 = rads[i3 ? 3 : z2];
56553 if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
56556 if (klass === "shadow") {
56557 _radii[entity.id] = r2;
56559 select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
56563 vertices.sort(sortY);
56564 var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
56565 groups.exit().remove();
56566 var enter = groups.enter().append("g").attr("class", function(d2) {
56567 return "node vertex " + d2.id;
56569 enter.append("circle").attr("class", "shadow");
56570 enter.append("circle").attr("class", "stroke");
56571 enter.filter(function(d2) {
56572 return d2.hasInterestingTags();
56573 }).append("circle").attr("class", "fill");
56574 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
56575 return d2.id in sets2.selected;
56576 }).classed("shared", function(d2) {
56577 return graph.isShared(d2);
56578 }).classed("endpoint", function(d2) {
56579 return d2.isEndpoint(graph);
56580 }).classed("added", function(d2) {
56581 return !base.entities[d2.id];
56582 }).classed("moved", function(d2) {
56583 return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
56584 }).classed("retagged", function(d2) {
56585 return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
56586 }).call(updateAttributes);
56587 var iconUse = groups.selectAll(".icon").data(function data(d2) {
56588 return zoom >= 17 && getIcon(d2) ? [d2] : [];
56590 iconUse.exit().remove();
56591 iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
56592 var picon = getIcon(d2);
56593 return picon ? "#" + picon : "";
56595 var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
56596 return zoom >= 18 && getDirections(d2) ? [d2] : [];
56598 dgroups.exit().remove();
56599 dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
56600 var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
56601 return osmEntity.key(d2);
56603 viewfields.exit().remove();
56604 viewfields.enter().append("path").attr("class", "viewfield").attr("d", "M0,0H0").merge(viewfields).attr("marker-start", "url(#ideditor-viewfield-marker" + (wireframe ? "-wireframe" : "") + ")").attr("transform", function(d2) {
56605 return "rotate(" + d2 + ")";
56608 function drawTargets(selection2, graph, entities, filter2) {
56609 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
56610 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
56611 var getTransform = svgPointTransform(projection2).geojson;
56612 var activeID = context.activeID();
56613 var data = { targets: [], nopes: [] };
56614 entities.forEach(function(node) {
56615 if (activeID === node.id)
56617 var vertexType = svgPassiveVertex(node, graph, activeID);
56618 if (vertexType !== 0) {
56619 data.targets.push({
56626 geometry: node.asGeoJSON()
56631 id: node.id + "-nope",
56637 geometry: node.asGeoJSON()
56641 var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
56642 return filter2(d2.properties.entity);
56643 }).data(data.targets, function key(d2) {
56646 targets.exit().remove();
56647 targets.enter().append("circle").attr("r", function(d2) {
56648 return _radii[d2.id] || radiuses.shadow[3];
56649 }).merge(targets).attr("class", function(d2) {
56650 return "node vertex target target-allowed " + targetClass + d2.id;
56651 }).attr("transform", getTransform);
56652 var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
56653 return filter2(d2.properties.entity);
56654 }).data(data.nopes, function key(d2) {
56657 nopes.exit().remove();
56658 nopes.enter().append("circle").attr("r", function(d2) {
56659 return _radii[d2.properties.entity.id] || radiuses.shadow[3];
56660 }).merge(nopes).attr("class", function(d2) {
56661 return "node vertex target target-nope " + nopeClass + d2.id;
56662 }).attr("transform", getTransform);
56664 function renderAsVertex(entity, graph, wireframe, zoom) {
56665 var geometry = entity.geometry(graph);
56666 return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
56668 function isEditedNode(node, base, head) {
56669 var baseNode = base.entities[node.id];
56670 var headNode = head.entities[node.id];
56671 return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
56673 function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
56676 function addChildVertices(entity) {
56677 if (seenIds[entity.id])
56679 seenIds[entity.id] = true;
56680 var geometry = entity.geometry(graph);
56681 if (!context.features().isHiddenFeature(entity, graph, geometry)) {
56683 if (entity.type === "way") {
56684 for (i3 = 0; i3 < entity.nodes.length; i3++) {
56685 var child = graph.hasEntity(entity.nodes[i3]);
56687 addChildVertices(child);
56690 } else if (entity.type === "relation") {
56691 for (i3 = 0; i3 < entity.members.length; i3++) {
56692 var member = graph.hasEntity(entity.members[i3].id);
56694 addChildVertices(member);
56697 } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
56698 results[entity.id] = entity;
56702 ids.forEach(function(id2) {
56703 var entity = graph.hasEntity(id2);
56706 if (entity.type === "node") {
56707 if (renderAsVertex(entity, graph, wireframe, zoom)) {
56708 results[entity.id] = entity;
56709 graph.parentWays(entity).forEach(function(entity2) {
56710 addChildVertices(entity2);
56714 addChildVertices(entity);
56719 function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
56720 var wireframe = context.surface().classed("fill-wireframe");
56721 var visualDiff = context.surface().classed("highlight-edited");
56722 var zoom = geoScaleToZoom(projection2.scale());
56723 var mode = context.mode();
56724 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
56725 var base = context.history().base();
56726 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
56727 var touchLayer = selection2.selectAll(".layer-touch.points");
56729 _currPersistent = {};
56732 for (var i3 = 0; i3 < entities.length; i3++) {
56733 var entity = entities[i3];
56734 var geometry = entity.geometry(graph);
56736 if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
56737 _currPersistent[entity.id] = entity;
56739 } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
56740 _currPersistent[entity.id] = entity;
56743 if (!keep && !fullRedraw) {
56744 delete _currPersistent[entity.id];
56748 persistent: _currPersistent,
56749 // persistent = important vertices (render always)
56750 selected: _currSelected,
56751 // selected + siblings of selected (render always)
56752 hovered: _currHover
56753 // hovered + siblings of hovered (render only in draw modes)
56755 var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
56756 var filterRendered = function(d2) {
56757 return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
56759 drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
56760 var filterTouch = function(d2) {
56761 return isMoving ? true : filterRendered(d2);
56763 touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
56764 function currentVisible(which) {
56765 return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
56766 return entity2 && entity2.intersects(extent, graph);
56770 drawVertices.drawSelected = function(selection2, graph, extent) {
56771 var wireframe = context.surface().classed("fill-wireframe");
56772 var zoom = geoScaleToZoom(projection2.scale());
56773 _prevSelected = _currSelected || {};
56774 if (context.map().isInWideSelection()) {
56775 _currSelected = {};
56776 context.selectedIDs().forEach(function(id2) {
56777 var entity = graph.hasEntity(id2);
56780 if (entity.type === "node") {
56781 if (renderAsVertex(entity, graph, wireframe, zoom)) {
56782 _currSelected[entity.id] = entity;
56787 _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
56789 var filter2 = function(d2) {
56790 return d2.id in _prevSelected;
56792 drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
56794 drawVertices.drawHover = function(selection2, graph, target, extent) {
56795 if (target === _currHoverTarget)
56797 var wireframe = context.surface().classed("fill-wireframe");
56798 var zoom = geoScaleToZoom(projection2.scale());
56799 _prevHover = _currHover || {};
56800 _currHoverTarget = target;
56801 var entity = target && target.properties && target.properties.entity;
56803 _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
56807 var filter2 = function(d2) {
56808 return d2.id in _prevHover;
56810 drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
56812 return drawVertices;
56815 // modules/util/bind_once.js
56816 function utilBindOnce(target, type2, listener, capture) {
56817 var typeOnce = type2 + ".once";
56819 target.on(typeOnce, null);
56820 listener.apply(this, arguments);
56822 target.on(typeOnce, one2, capture);
56826 // modules/util/zoom_pan.js
56827 function defaultFilter3(d3_event) {
56828 return !d3_event.ctrlKey && !d3_event.button;
56830 function defaultExtent2() {
56832 if (e3 instanceof SVGElement) {
56833 e3 = e3.ownerSVGElement || e3;
56834 if (e3.hasAttribute("viewBox")) {
56835 e3 = e3.viewBox.baseVal;
56836 return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
56838 return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
56840 return [[0, 0], [e3.clientWidth, e3.clientHeight]];
56842 function defaultWheelDelta2(d3_event) {
56843 return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
56845 function defaultConstrain2(transform2, extent, translateExtent) {
56846 var dx0 = transform2.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent[1][1]) - translateExtent[1][1];
56847 return transform2.translate(
56848 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
56849 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
56852 function utilZoomPan() {
56853 var filter2 = defaultFilter3, extent = defaultExtent2, constrain = defaultConstrain2, wheelDelta = defaultWheelDelta2, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], interpolate = zoom_default, dispatch14 = dispatch_default("start", "zoom", "end"), _wheelDelay = 150, _transform = identity2, _activeGesture;
56854 function zoom(selection2) {
56855 selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
56856 select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
56858 zoom.transform = function(collection, transform2, point2) {
56859 var selection2 = collection.selection ? collection.selection() : collection;
56860 if (collection !== selection2) {
56861 schedule(collection, transform2, point2);
56863 selection2.interrupt().each(function() {
56864 gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
56868 zoom.scaleBy = function(selection2, k2, p2) {
56869 zoom.scaleTo(selection2, function() {
56870 var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
56874 zoom.scaleTo = function(selection2, k2, p2) {
56875 zoom.transform(selection2, function() {
56876 var e3 = extent.apply(this, arguments), t0 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2, p1 = t0.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
56877 return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
56880 zoom.translateBy = function(selection2, x2, y2) {
56881 zoom.transform(selection2, function() {
56882 return constrain(_transform.translate(
56883 typeof x2 === "function" ? x2.apply(this, arguments) : x2,
56884 typeof y2 === "function" ? y2.apply(this, arguments) : y2
56885 ), extent.apply(this, arguments), translateExtent);
56888 zoom.translateTo = function(selection2, x2, y2, p2) {
56889 zoom.transform(selection2, function() {
56890 var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
56891 return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
56892 typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
56893 typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
56894 ), e3, translateExtent);
56897 function scale(transform2, k2) {
56898 k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
56899 return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
56901 function translate(transform2, p02, p1) {
56902 var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
56903 return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
56905 function centroid(extent2) {
56906 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
56908 function schedule(transition2, transform2, point2) {
56909 transition2.on("start.zoom", function() {
56910 gesture(this, arguments).start(null);
56911 }).on("interrupt.zoom end.zoom", function() {
56912 gesture(this, arguments).end(null);
56913 }).tween("zoom", function() {
56914 var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point2 ? centroid(e3) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e3[1][0] - e3[0][0], e3[1][1] - e3[0][1]), a2 = _transform, b2 = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i3 = interpolate(a2.invert(p2).concat(w2 / a2.k), b2.invert(p2).concat(w2 / b2.k));
56915 return function(t2) {
56920 var k2 = w2 / l2[2];
56921 t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
56923 g3.zoom(null, null, t2);
56927 function gesture(that, args, clean2) {
56928 return !clean2 && _activeGesture || new Gesture(that, args);
56930 function Gesture(that, args) {
56934 this.extent = extent.apply(that, args);
56936 Gesture.prototype = {
56937 start: function(d3_event) {
56938 if (++this.active === 1) {
56939 _activeGesture = this;
56940 dispatch14.call("start", this, d3_event);
56944 zoom: function(d3_event, key, transform2) {
56945 if (this.mouse && key !== "mouse")
56946 this.mouse[1] = transform2.invert(this.mouse[0]);
56947 if (this.pointer0 && key !== "touch")
56948 this.pointer0[1] = transform2.invert(this.pointer0[0]);
56949 if (this.pointer1 && key !== "touch")
56950 this.pointer1[1] = transform2.invert(this.pointer1[0]);
56951 _transform = transform2;
56952 dispatch14.call("zoom", this, d3_event, key, transform2);
56955 end: function(d3_event) {
56956 if (--this.active === 0) {
56957 _activeGesture = null;
56958 dispatch14.call("end", this, d3_event);
56963 function wheeled(d3_event) {
56964 if (!filter2.apply(this, arguments))
56966 var g3 = gesture(this, arguments), t2 = _transform, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t2.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p2 = utilFastMouse(this)(d3_event);
56968 if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
56969 g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
56971 clearTimeout(g3.wheel);
56973 g3.mouse = [p2, t2.invert(p2)];
56974 interrupt_default(this);
56975 g3.start(d3_event);
56977 d3_event.preventDefault();
56978 d3_event.stopImmediatePropagation();
56979 g3.wheel = setTimeout(wheelidled, _wheelDelay);
56980 g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
56981 function wheelidled() {
56986 var _downPointerIDs = /* @__PURE__ */ new Set();
56987 var _pointerLocGetter;
56988 function pointerdown(d3_event) {
56989 _downPointerIDs.add(d3_event.pointerId);
56990 if (!filter2.apply(this, arguments))
56992 var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
56994 d3_event.stopImmediatePropagation();
56995 _pointerLocGetter = utilFastMouse(this);
56996 var loc = _pointerLocGetter(d3_event);
56997 var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
56998 if (!g3.pointer0) {
57001 } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
57005 interrupt_default(this);
57006 g3.start(d3_event);
57009 function pointermove(d3_event) {
57010 if (!_downPointerIDs.has(d3_event.pointerId))
57012 if (!_activeGesture || !_pointerLocGetter)
57014 var g3 = gesture(this, arguments);
57015 var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
57016 var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
57017 if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
57019 _downPointerIDs.delete(g3.pointer0[2]);
57021 _downPointerIDs.delete(g3.pointer1[2]);
57025 d3_event.preventDefault();
57026 d3_event.stopImmediatePropagation();
57027 var loc = _pointerLocGetter(d3_event);
57030 g3.pointer0[0] = loc;
57031 else if (isPointer1)
57032 g3.pointer1[0] = loc;
57035 var p02 = g3.pointer0[0], l0 = g3.pointer0[1], p1 = g3.pointer1[0], l1 = g3.pointer1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
57036 t2 = scale(t2, Math.sqrt(dp / dl));
57037 p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
57038 l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
57039 } else if (g3.pointer0) {
57040 p2 = g3.pointer0[0];
57041 l2 = g3.pointer0[1];
57045 g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
57047 function pointerup(d3_event) {
57048 if (!_downPointerIDs.has(d3_event.pointerId))
57050 _downPointerIDs.delete(d3_event.pointerId);
57051 if (!_activeGesture)
57053 var g3 = gesture(this, arguments);
57054 d3_event.stopImmediatePropagation();
57055 if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId)
57056 delete g3.pointer0;
57057 else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId)
57058 delete g3.pointer1;
57059 if (g3.pointer1 && !g3.pointer0) {
57060 g3.pointer0 = g3.pointer1;
57061 delete g3.pointer1;
57064 g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
57069 zoom.wheelDelta = function(_2) {
57070 return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
57072 zoom.filter = function(_2) {
57073 return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
57075 zoom.extent = function(_2) {
57076 return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
57078 zoom.scaleExtent = function(_2) {
57079 return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
57081 zoom.translateExtent = function(_2) {
57082 return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
57084 zoom.constrain = function(_2) {
57085 return arguments.length ? (constrain = _2, zoom) : constrain;
57087 zoom.interpolate = function(_2) {
57088 return arguments.length ? (interpolate = _2, zoom) : interpolate;
57090 zoom._transform = function(_2) {
57091 return arguments.length ? (_transform = _2, zoom) : _transform;
57093 return utilRebind(zoom, dispatch14, "on");
57096 // modules/util/double_up.js
57097 function utilDoubleUp() {
57098 var dispatch14 = dispatch_default("doubleUp");
57099 var _maxTimespan = 500;
57100 var _maxDistance = 20;
57102 function pointerIsValidFor(loc) {
57103 return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
57104 geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
57106 function pointerdown(d3_event) {
57107 if (d3_event.ctrlKey || d3_event.button === 2)
57109 var loc = [d3_event.clientX, d3_event.clientY];
57110 if (_pointer && !pointerIsValidFor(loc)) {
57116 startTime: (/* @__PURE__ */ new Date()).getTime(),
57118 pointerId: d3_event.pointerId
57121 _pointer.pointerId = d3_event.pointerId;
57124 function pointerup(d3_event) {
57125 if (d3_event.ctrlKey || d3_event.button === 2)
57127 if (!_pointer || _pointer.pointerId !== d3_event.pointerId)
57129 _pointer.upCount += 1;
57130 if (_pointer.upCount === 2) {
57131 var loc = [d3_event.clientX, d3_event.clientY];
57132 if (pointerIsValidFor(loc)) {
57133 var locInThis = utilFastMouse(this)(d3_event);
57134 dispatch14.call("doubleUp", this, d3_event, locInThis);
57139 function doubleUp(selection2) {
57140 if ("PointerEvent" in window) {
57141 selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
57143 selection2.on("dblclick.doubleUp", function(d3_event) {
57144 dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
57148 doubleUp.off = function(selection2) {
57149 selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
57151 return utilRebind(doubleUp, dispatch14, "on");
57154 // modules/renderer/map.js
57155 var TILESIZE = 256;
57158 var kMin = geoZoomToScale(minZoom2, TILESIZE);
57159 var kMax = geoZoomToScale(maxZoom, TILESIZE);
57160 function clamp2(num, min3, max3) {
57161 return Math.max(min3, Math.min(num, max3));
57163 function rendererMap(context) {
57164 var dispatch14 = dispatch_default(
57167 "crossEditableZoom",
57169 "changeHighlighting",
57172 var projection2 = context.projection;
57173 var curtainProjection = context.curtainProjection;
57181 var _selection = select_default2(null);
57182 var supersurface = select_default2(null);
57183 var wrapper = select_default2(null);
57184 var surface = select_default2(null);
57185 var _dimensions = [1, 1];
57186 var _dblClickZoomEnabled = true;
57187 var _redrawEnabled = true;
57188 var _gestureTransformStart;
57189 var _transformStart = projection2.transform();
57190 var _transformLast;
57191 var _isTransformed = false;
57193 var _getMouseCoords;
57194 var _lastPointerEvent;
57195 var _lastWithinEditableZoom;
57196 var _pointerDown = false;
57197 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
57198 var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
57199 var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
57200 _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
57201 }).on("end.map", function() {
57202 _pointerDown = false;
57204 var _doubleUpHandler = utilDoubleUp();
57205 var scheduleRedraw = throttle_default(redraw, 750);
57206 function cancelPendingRedraw() {
57207 scheduleRedraw.cancel();
57209 function map2(selection2) {
57210 _selection = selection2;
57211 context.on("change.map", immediateRedraw);
57212 var osm = context.connection();
57214 osm.on("change.map", immediateRedraw);
57216 function didUndoOrRedo(targetTransform) {
57217 var mode = context.mode().id;
57218 if (mode !== "browse" && mode !== "select")
57220 if (targetTransform) {
57221 map2.transformEase(targetTransform);
57224 context.history().on("merge.map", function() {
57226 }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
57227 didUndoOrRedo(fromStack.transform);
57228 }).on("redone.map", function(stack) {
57229 didUndoOrRedo(stack.transform);
57231 context.background().on("change.map", immediateRedraw);
57232 context.features().on("redraw.map", immediateRedraw);
57233 drawLayers.on("change.map", function() {
57234 context.background().updateImagery();
57237 selection2.on("wheel.map mousewheel.map", function(d3_event) {
57238 d3_event.preventDefault();
57239 }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
57240 map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
57241 wrapper = supersurface.append("div").attr("class", "layer layer-data");
57242 map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
57243 surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
57244 _lastPointerEvent = d3_event;
57245 if (d3_event.button === 2) {
57246 d3_event.stopPropagation();
57248 }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
57249 _lastPointerEvent = d3_event;
57250 if (resetTransform()) {
57253 }).on(_pointerPrefix + "move.map", function(d3_event) {
57254 _lastPointerEvent = d3_event;
57255 }).on(_pointerPrefix + "over.vertices", function(d3_event) {
57256 if (map2.editableDataEnabled() && !_isTransformed) {
57257 var hover = d3_event.target.__data__;
57258 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
57259 dispatch14.call("drawn", this, { full: false });
57261 }).on(_pointerPrefix + "out.vertices", function(d3_event) {
57262 if (map2.editableDataEnabled() && !_isTransformed) {
57263 var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
57264 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
57265 dispatch14.call("drawn", this, { full: false });
57268 var detected = utilDetect();
57269 if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
57270 // but we only need to do this on desktop Safari anyway. – #7694
57271 !detected.isMobileWebKit) {
57272 surface.on("gesturestart.surface", function(d3_event) {
57273 d3_event.preventDefault();
57274 _gestureTransformStart = projection2.transform();
57275 }).on("gesturechange.surface", gestureChange);
57278 _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
57279 if (!_dblClickZoomEnabled)
57281 if (typeof d3_event.target.__data__ === "object" && // or area fills
57282 !select_default2(d3_event.target).classed("fill"))
57284 var zoomOut2 = d3_event.shiftKey;
57285 var t2 = projection2.transform();
57286 var p1 = t2.invert(p02);
57287 t2 = t2.scale(zoomOut2 ? 0.5 : 2);
57288 t2.x = p02[0] - p1[0] * t2.k;
57289 t2.y = p02[1] - p1[1] * t2.k;
57290 map2.transformEase(t2);
57292 context.on("enter.map", function() {
57293 if (!map2.editableDataEnabled(
57295 /* skip zoom check */
57298 if (_isTransformed)
57300 var graph = context.graph();
57301 var selectedAndParents = {};
57302 context.selectedIDs().forEach(function(id2) {
57303 var entity = graph.hasEntity(id2);
57305 selectedAndParents[entity.id] = entity;
57306 if (entity.type === "node") {
57307 graph.parentWays(entity).forEach(function(parent) {
57308 selectedAndParents[parent.id] = parent;
57313 var data = Object.values(selectedAndParents);
57314 var filter2 = function(d2) {
57315 return d2.id in selectedAndParents;
57317 data = context.features().filter(data, graph);
57318 surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
57319 dispatch14.call("drawn", this, { full: false });
57322 map2.dimensions(utilGetDimensions(selection2));
57324 function zoomEventFilter(d3_event) {
57325 if (d3_event.type === "mousedown") {
57326 var hasOrphan = false;
57327 var listeners = window.__on;
57328 for (var i3 = 0; i3 < listeners.length; i3++) {
57329 var listener = listeners[i3];
57330 if (listener.name === "zoom" && listener.type === "mouseup") {
57336 var event = window.CustomEvent;
57338 event = new event("mouseup");
57340 event = window.document.createEvent("Event");
57341 event.initEvent("mouseup", false, false);
57343 event.view = window;
57344 window.dispatchEvent(event);
57347 return d3_event.button !== 2;
57349 function pxCenter() {
57350 return [_dimensions[0] / 2, _dimensions[1] / 2];
57352 function drawEditable(difference2, extent) {
57353 var mode = context.mode();
57354 var graph = context.graph();
57355 var features = context.features();
57356 var all = context.history().intersects(map2.extent());
57357 var fullRedraw = false;
57361 var applyFeatureLayerFilters = true;
57362 if (map2.isInWideSelection()) {
57364 utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
57365 var entity = context.hasEntity(id2);
57370 filter2 = utilFunctor(true);
57371 applyFeatureLayerFilters = false;
57372 } else if (difference2) {
57373 var complete = difference2.complete(map2.extent());
57374 data = Object.values(complete).filter(Boolean);
57375 set4 = new Set(Object.keys(complete));
57376 filter2 = function(d2) {
57377 return set4.has(d2.id);
57379 features.clear(data);
57381 if (features.gatherStats(all, graph, _dimensions)) {
57385 data = context.history().intersects(map2.extent().intersection(extent));
57386 set4 = new Set(data.map(function(entity) {
57389 filter2 = function(d2) {
57390 return set4.has(d2.id);
57395 filter2 = utilFunctor(true);
57398 if (applyFeatureLayerFilters) {
57399 data = features.filter(data, graph);
57401 context.features().resetStats();
57403 if (mode && mode.id === "select") {
57404 surface.call(drawVertices.drawSelected, graph, map2.extent());
57406 surface.call(drawVertices, graph, data, filter2, map2.extent(), fullRedraw).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent()).call(drawLabels, graph, data, filter2, _dimensions, fullRedraw).call(drawPoints, graph, data, filter2);
57407 dispatch14.call("drawn", this, { full: true });
57409 map2.init = function() {
57410 drawLayers = svgLayers(projection2, context);
57411 drawPoints = svgPoints(projection2, context);
57412 drawVertices = svgVertices(projection2, context);
57413 drawLines = svgLines(projection2, context);
57414 drawAreas = svgAreas(projection2, context);
57415 drawMidpoints = svgMidpoints(projection2, context);
57416 drawLabels = svgLabels(projection2, context);
57418 function editOff() {
57419 context.features().resetStats();
57420 surface.selectAll(".layer-osm *").remove();
57421 surface.selectAll(".layer-touch:not(.markers) *").remove();
57425 "select-note": true,
57426 "select-data": true,
57427 "select-error": true
57429 var mode = context.mode();
57430 if (mode && !allowed[mode.id]) {
57431 context.enter(modeBrowse(context));
57433 dispatch14.call("drawn", this, { full: true });
57435 function gestureChange(d3_event) {
57437 e3.preventDefault();
57440 // dummy values to ignore in zoomPan
57442 // dummy values to ignore in zoomPan
57443 clientX: e3.clientX,
57444 clientY: e3.clientY,
57445 screenX: e3.screenX,
57446 screenY: e3.screenY,
57450 var e22 = new WheelEvent("wheel", props);
57451 e22._scale = e3.scale;
57452 e22._rotation = e3.rotation;
57453 _selection.node().dispatchEvent(e22);
57455 function zoomPan2(event, key, transform2) {
57456 var source = event && event.sourceEvent || event;
57457 var eventTransform = transform2 || event && event.transform;
57458 var x2 = eventTransform.x;
57459 var y2 = eventTransform.y;
57460 var k2 = eventTransform.k;
57461 if (source && source.type === "wheel") {
57464 var detected = utilDetect();
57465 var dX = source.deltaX;
57466 var dY = source.deltaY;
57471 if (source.deltaMode === 1) {
57472 var lines = Math.abs(source.deltaY);
57473 var sign2 = source.deltaY > 0 ? 1 : -1;
57474 dY = sign2 * clamp2(
57475 Math.exp((lines - 1) * 0.75) * 4.000244140625,
57481 if (detected.os !== "mac") {
57484 t0 = _isTransformed ? _transformLast : _transformStart;
57485 p02 = _getMouseCoords(source);
57486 p1 = t0.invert(p02);
57487 k22 = t0.k * Math.pow(2, -dY / 500);
57488 k22 = clamp2(k22, kMin, kMax);
57489 x22 = p02[0] - p1[0] * k22;
57490 y22 = p02[1] - p1[1] * k22;
57491 } else if (source._scale) {
57492 t0 = _gestureTransformStart;
57493 p02 = _getMouseCoords(source);
57494 p1 = t0.invert(p02);
57495 k22 = t0.k * source._scale;
57496 k22 = clamp2(k22, kMin, kMax);
57497 x22 = p02[0] - p1[0] * k22;
57498 y22 = p02[1] - p1[1] * k22;
57499 } else if (source.ctrlKey && !isInteger(dY)) {
57501 t0 = _isTransformed ? _transformLast : _transformStart;
57502 p02 = _getMouseCoords(source);
57503 p1 = t0.invert(p02);
57504 k22 = t0.k * Math.pow(2, -dY / 500);
57505 k22 = clamp2(k22, kMin, kMax);
57506 x22 = p02[0] - p1[0] * k22;
57507 y22 = p02[1] - p1[1] * k22;
57508 } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
57509 t0 = _isTransformed ? _transformLast : _transformStart;
57510 p02 = _getMouseCoords(source);
57511 p1 = t0.invert(p02);
57512 k22 = t0.k * Math.pow(2, -dY / 500);
57513 k22 = clamp2(k22, kMin, kMax);
57514 x22 = p02[0] - p1[0] * k22;
57515 y22 = p02[1] - p1[1] * k22;
57516 } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
57517 p1 = projection2.translate();
57520 k22 = projection2.scale();
57521 k22 = clamp2(k22, kMin, kMax);
57523 if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
57527 eventTransform = identity2.translate(x22, y22).scale(k22);
57528 if (_zoomerPanner._transform) {
57529 _zoomerPanner._transform(eventTransform);
57531 _selection.node().__zoom = eventTransform;
57535 if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
57538 if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
57539 surface.interrupt();
57540 dispatch14.call("hitMinZoom", this, map2);
57541 setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
57543 dispatch14.call("move", this, map2);
57546 projection2.transform(eventTransform);
57547 var withinEditableZoom = map2.withinEditableZoom();
57548 if (_lastWithinEditableZoom !== withinEditableZoom) {
57549 if (_lastWithinEditableZoom !== void 0) {
57550 dispatch14.call("crossEditableZoom", this, withinEditableZoom);
57552 _lastWithinEditableZoom = withinEditableZoom;
57554 var scale = k2 / _transformStart.k;
57555 var tX = (x2 / scale - _transformStart.x) * scale;
57556 var tY = (y2 / scale - _transformStart.y) * scale;
57557 if (context.inIntro()) {
57558 curtainProjection.transform({
57565 _lastPointerEvent = event;
57567 _isTransformed = true;
57568 _transformLast = eventTransform;
57569 utilSetTransform(supersurface, tX, tY, scale);
57571 dispatch14.call("move", this, map2);
57572 function isInteger(val) {
57573 return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
57576 function resetTransform() {
57577 if (!_isTransformed)
57579 utilSetTransform(supersurface, 0, 0);
57580 _isTransformed = false;
57581 if (context.inIntro()) {
57582 curtainProjection.transform(projection2.transform());
57586 function redraw(difference2, extent) {
57587 if (surface.empty() || !_redrawEnabled)
57589 if (resetTransform()) {
57590 difference2 = extent = void 0;
57592 var zoom = map2.zoom();
57593 var z2 = String(~~zoom);
57594 if (surface.attr("data-zoom") !== z2) {
57595 surface.attr("data-zoom", z2);
57597 var lat = map2.center()[1];
57598 var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
57599 surface.classed("low-zoom", zoom <= lowzoom(lat));
57600 if (!difference2) {
57601 supersurface.call(context.background());
57602 wrapper.call(drawLayers);
57604 if (map2.editableDataEnabled() || map2.isInWideSelection()) {
57605 context.loadTiles(projection2);
57606 drawEditable(difference2, extent);
57610 _transformStart = projection2.transform();
57613 var immediateRedraw = function(difference2, extent) {
57614 if (!difference2 && !extent)
57615 cancelPendingRedraw();
57616 redraw(difference2, extent);
57618 map2.lastPointerEvent = function() {
57619 return _lastPointerEvent;
57621 map2.mouse = function(d3_event) {
57622 var event = d3_event || _lastPointerEvent;
57625 while (s2 = event.sourceEvent) {
57628 return _getMouseCoords(event);
57632 map2.mouseCoordinates = function() {
57633 var coord2 = map2.mouse() || pxCenter();
57634 return projection2.invert(coord2);
57636 map2.dblclickZoomEnable = function(val) {
57637 if (!arguments.length)
57638 return _dblClickZoomEnabled;
57639 _dblClickZoomEnabled = val;
57642 map2.redrawEnable = function(val) {
57643 if (!arguments.length)
57644 return _redrawEnabled;
57645 _redrawEnabled = val;
57648 map2.isTransformed = function() {
57649 return _isTransformed;
57651 function setTransform(t2, duration, force) {
57652 var t3 = projection2.transform();
57653 if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y)
57656 _selection.transition().duration(duration).on("start", function() {
57658 }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
57660 projection2.transform(t2);
57661 _transformStart = t2;
57662 _selection.call(_zoomerPanner.transform, _transformStart);
57666 function setCenterZoom(loc2, z2, duration, force) {
57667 var c2 = map2.center();
57668 var z3 = map2.zoom();
57669 if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force)
57671 var proj = geoRawMercator().transform(projection2.transform());
57672 var k2 = clamp2(geoZoomToScale(z2, TILESIZE), kMin, kMax);
57674 var t2 = proj.translate();
57675 var point2 = proj(loc2);
57676 var center = pxCenter();
57677 t2[0] += center[0] - point2[0];
57678 t2[1] += center[1] - point2[1];
57679 return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
57681 map2.pan = function(delta, duration) {
57682 var t2 = projection2.translate();
57683 var k2 = projection2.scale();
57687 _selection.transition().duration(duration).on("start", function() {
57689 }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
57691 projection2.translate(t2);
57692 _transformStart = projection2.transform();
57693 _selection.call(_zoomerPanner.transform, _transformStart);
57694 dispatch14.call("move", this, map2);
57699 map2.dimensions = function(val) {
57700 if (!arguments.length)
57701 return _dimensions;
57703 drawLayers.dimensions(_dimensions);
57704 context.background().dimensions(_dimensions);
57705 projection2.clipExtent([[0, 0], _dimensions]);
57706 _getMouseCoords = utilFastMouse(supersurface.node());
57710 function zoomIn(delta) {
57711 setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
57713 function zoomOut(delta) {
57714 setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
57716 map2.zoomIn = function() {
57719 map2.zoomInFurther = function() {
57722 map2.canZoomIn = function() {
57723 return map2.zoom() < maxZoom;
57725 map2.zoomOut = function() {
57728 map2.zoomOutFurther = function() {
57731 map2.canZoomOut = function() {
57732 return map2.zoom() > minZoom2;
57734 map2.center = function(loc2) {
57735 if (!arguments.length) {
57736 return projection2.invert(pxCenter());
57738 if (setCenterZoom(loc2, map2.zoom())) {
57739 dispatch14.call("move", this, map2);
57744 map2.unobscuredCenterZoomEase = function(loc, zoom) {
57745 var offset = map2.unobscuredOffsetPx();
57746 var proj = geoRawMercator().transform(projection2.transform());
57747 proj.scale(geoZoomToScale(zoom, TILESIZE));
57748 var locPx = proj(loc);
57749 var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
57750 var offsetLoc = proj.invert(offsetLocPx);
57751 map2.centerZoomEase(offsetLoc, zoom);
57753 map2.unobscuredOffsetPx = function() {
57754 var openPane = context.container().select(".map-panes .map-pane.shown");
57755 if (!openPane.empty()) {
57756 return [openPane.node().offsetWidth / 2, 0];
57760 map2.zoom = function(z2) {
57761 if (!arguments.length) {
57762 return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
57764 if (z2 < _minzoom) {
57765 surface.interrupt();
57766 dispatch14.call("hitMinZoom", this, map2);
57767 z2 = context.minEditableZoom();
57769 if (setCenterZoom(map2.center(), z2)) {
57770 dispatch14.call("move", this, map2);
57775 map2.centerZoom = function(loc2, z2) {
57776 if (setCenterZoom(loc2, z2)) {
57777 dispatch14.call("move", this, map2);
57782 map2.zoomTo = function(entity) {
57783 var extent = entity.extent(context.graph());
57784 if (!isFinite(extent.area()))
57786 var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
57787 return map2.centerZoom(extent.center(), z2);
57789 map2.centerEase = function(loc2, duration) {
57790 duration = duration || 250;
57791 setCenterZoom(loc2, map2.zoom(), duration);
57794 map2.zoomEase = function(z2, duration) {
57795 duration = duration || 250;
57796 setCenterZoom(map2.center(), z2, duration, false);
57799 map2.centerZoomEase = function(loc2, z2, duration) {
57800 duration = duration || 250;
57801 setCenterZoom(loc2, z2, duration, false);
57804 map2.transformEase = function(t2, duration) {
57805 duration = duration || 250;
57814 map2.zoomToEase = function(obj, duration) {
57816 if (Array.isArray(obj)) {
57817 obj.forEach(function(entity) {
57818 var entityExtent = entity.extent(context.graph());
57820 extent = entityExtent;
57822 extent = extent.extend(entityExtent);
57826 extent = obj.extent(context.graph());
57828 if (!isFinite(extent.area()))
57830 var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
57831 return map2.centerZoomEase(extent.center(), z2, duration);
57833 map2.startEase = function() {
57834 utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
57839 map2.cancelEase = function() {
57840 _selection.interrupt();
57843 map2.extent = function(val) {
57844 if (!arguments.length) {
57845 return new geoExtent(
57846 projection2.invert([0, _dimensions[1]]),
57847 projection2.invert([_dimensions[0], 0])
57850 var extent = geoExtent(val);
57851 map2.centerZoom(extent.center(), map2.extentZoom(extent));
57854 map2.trimmedExtent = function(val) {
57855 if (!arguments.length) {
57859 return new geoExtent(
57860 projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
57861 projection2.invert([_dimensions[0] - pad2, headerY + pad2])
57864 var extent = geoExtent(val);
57865 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
57868 function calcExtentZoom(extent, dim) {
57869 var tl = projection2([extent[0][0], extent[1][1]]);
57870 var br2 = projection2([extent[1][0], extent[0][1]]);
57871 var hFactor = (br2[0] - tl[0]) / dim[0];
57872 var vFactor = (br2[1] - tl[1]) / dim[1];
57873 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
57874 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
57875 var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
57878 map2.extentZoom = function(val) {
57879 return calcExtentZoom(geoExtent(val), _dimensions);
57881 map2.trimmedExtentZoom = function(val) {
57884 var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
57885 return calcExtentZoom(geoExtent(val), trimmed);
57887 map2.withinEditableZoom = function() {
57888 return map2.zoom() >= context.minEditableZoom();
57890 map2.isInWideSelection = function() {
57891 return !map2.withinEditableZoom() && context.selectedIDs().length;
57893 map2.editableDataEnabled = function(skipZoomCheck) {
57894 var layer = context.layers().layer("osm");
57895 if (!layer || !layer.enabled())
57897 return skipZoomCheck || map2.withinEditableZoom();
57899 map2.notesEditable = function() {
57900 var layer = context.layers().layer("notes");
57901 if (!layer || !layer.enabled())
57903 return map2.withinEditableZoom();
57905 map2.minzoom = function(val) {
57906 if (!arguments.length)
57911 map2.toggleHighlightEdited = function() {
57912 surface.classed("highlight-edited", !surface.classed("highlight-edited"));
57914 dispatch14.call("changeHighlighting", this);
57916 map2.areaFillOptions = ["wireframe", "partial", "full"];
57917 map2.activeAreaFill = function(val) {
57918 if (!arguments.length)
57919 return corePreferences("area-fill") || "partial";
57920 corePreferences("area-fill", val);
57921 if (val !== "wireframe") {
57922 corePreferences("area-fill-toggle", val);
57926 dispatch14.call("changeAreaFill", this);
57929 map2.toggleWireframe = function() {
57930 var activeFill = map2.activeAreaFill();
57931 if (activeFill === "wireframe") {
57932 activeFill = corePreferences("area-fill-toggle") || "partial";
57934 activeFill = "wireframe";
57936 map2.activeAreaFill(activeFill);
57938 function updateAreaFill() {
57939 var activeFill = map2.activeAreaFill();
57940 map2.areaFillOptions.forEach(function(opt) {
57941 surface.classed("fill-" + opt, Boolean(opt === activeFill));
57944 map2.layers = () => drawLayers;
57945 map2.doubleUpHandler = function() {
57946 return _doubleUpHandler;
57948 return utilRebind(map2, dispatch14, "on");
57951 // modules/renderer/photos.js
57952 function rendererPhotos(context) {
57953 var dispatch14 = dispatch_default("change");
57954 var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder"];
57955 var _allPhotoTypes = ["flat", "panoramic"];
57956 var _shownPhotoTypes = _allPhotoTypes.slice();
57957 var _dateFilters = ["fromDate", "toDate"];
57961 function photos() {
57963 function updateStorage() {
57966 var hash = utilStringQs(window.location.hash);
57967 var enabled = context.layers().all().filter(function(d2) {
57968 return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
57969 }).map(function(d2) {
57972 if (enabled.length) {
57973 hash.photo_overlay = enabled.join(",");
57975 delete hash.photo_overlay;
57977 window.location.replace("#" + utilQsString(hash, true));
57979 photos.overlayLayerIDs = function() {
57982 photos.allPhotoTypes = function() {
57983 return _allPhotoTypes;
57985 photos.dateFilters = function() {
57986 return _dateFilters;
57988 photos.dateFilterValue = function(val) {
57989 return val === _dateFilters[0] ? _fromDate : _toDate;
57991 photos.setDateFilter = function(type2, val, updateUrl) {
57992 var date = val && new Date(val);
57993 if (date && !isNaN(date)) {
57994 val = date.toISOString().slice(0, 10);
57998 if (type2 === _dateFilters[0]) {
58000 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
58001 _toDate = _fromDate;
58004 if (type2 === _dateFilters[1]) {
58006 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
58007 _fromDate = _toDate;
58010 dispatch14.call("change", this);
58013 if (_fromDate || _toDate) {
58014 rangeString = (_fromDate || "") + "_" + (_toDate || "");
58016 setUrlFilterValue("photo_dates", rangeString);
58019 photos.setUsernameFilter = function(val, updateUrl) {
58020 if (val && typeof val === "string")
58021 val = val.replace(/;/g, ",").split(",");
58023 val = val.map((d2) => d2.trim()).filter(Boolean);
58029 dispatch14.call("change", this);
58033 hashString = _usernames.join(",");
58035 setUrlFilterValue("photo_username", hashString);
58038 function setUrlFilterValue(property, val) {
58039 if (!window.mocha) {
58040 var hash = utilStringQs(window.location.hash);
58042 if (hash[property] === val)
58044 hash[property] = val;
58046 if (!(property in hash))
58048 delete hash[property];
58050 window.location.replace("#" + utilQsString(hash, true));
58053 function showsLayer(id2) {
58054 var layer = context.layers().layer(id2);
58055 return layer && layer.supported() && layer.enabled();
58057 photos.shouldFilterByDate = function() {
58058 return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder");
58060 photos.shouldFilterByPhotoType = function() {
58061 return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder");
58063 photos.shouldFilterByUsername = function() {
58064 return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside");
58066 photos.showsPhotoType = function(val) {
58067 if (!photos.shouldFilterByPhotoType())
58069 return _shownPhotoTypes.indexOf(val) !== -1;
58071 photos.showsFlat = function() {
58072 return photos.showsPhotoType("flat");
58074 photos.showsPanoramic = function() {
58075 return photos.showsPhotoType("panoramic");
58077 photos.fromDate = function() {
58080 photos.toDate = function() {
58083 photos.togglePhotoType = function(val) {
58084 var index = _shownPhotoTypes.indexOf(val);
58085 if (index !== -1) {
58086 _shownPhotoTypes.splice(index, 1);
58088 _shownPhotoTypes.push(val);
58090 dispatch14.call("change", this);
58093 photos.usernames = function() {
58096 photos.init = function() {
58097 var hash = utilStringQs(window.location.hash);
58098 if (hash.photo_dates) {
58099 var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
58100 this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
58101 this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
58103 if (hash.photo_username) {
58104 this.setUsernameFilter(hash.photo_username, false);
58106 if (hash.photo_overlay) {
58107 var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
58108 hashOverlayIDs.forEach(function(id2) {
58109 if (id2 === "openstreetcam")
58111 var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
58112 if (layer2 && !layer2.enabled())
58113 layer2.enabled(true);
58117 var photoIds = hash.photo.replace(/;/g, ",").split(",");
58118 var photoId = photoIds.length && photoIds[0].trim();
58119 var results = /(.*)\/(.*)/g.exec(photoId);
58120 if (results && results.length >= 3) {
58121 var serviceId = results[1];
58122 if (serviceId === "openstreetcam")
58123 serviceId = "kartaview";
58124 var photoKey = results[2];
58125 var service = services[serviceId];
58126 if (service && service.ensureViewerLoaded) {
58127 var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
58128 if (layer && !layer.enabled())
58129 layer.enabled(true);
58130 var baselineTime = Date.now();
58131 service.on("loadedImages.rendererPhotos", function() {
58132 if (Date.now() - baselineTime > 45e3) {
58133 service.on("loadedImages.rendererPhotos", null);
58136 if (!service.cachedImage(photoKey))
58138 service.on("loadedImages.rendererPhotos", null);
58139 service.ensureViewerLoaded(context).then(function() {
58140 service.selectImage(context, photoKey).showViewer(context);
58146 context.layers().on("change.rendererPhotos", updateStorage);
58148 return utilRebind(photos, dispatch14, "on");
58151 // modules/ui/account.js
58152 function uiAccount(context) {
58153 const osm = context.connection();
58154 function updateUserDetails(selection2) {
58157 if (!osm.authenticated()) {
58158 render(selection2, null);
58160 osm.userDetails((err, user) => render(selection2, user));
58163 function render(selection2, user) {
58164 let userInfo = selection2.select(".userInfo");
58165 let loginLogout = selection2.select(".loginLogout");
58167 userInfo.html("").classed("hide", false);
58168 let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
58169 if (user.image_url) {
58170 userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
58172 userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
58174 userLink.append("span").attr("class", "label").text(user.display_name);
58175 loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
58176 e3.preventDefault();
58181 userInfo.html("").classed("hide", true);
58182 loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
58183 e3.preventDefault();
58184 osm.authenticate();
58188 function tryLogout() {
58191 const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
58197 ["left", window.screen.width / 2 - w2 / 2],
58198 ["top", window.screen.height / 2 - h2 / 2]
58199 ].map((x2) => x2.join("=")).join(",");
58200 window.open(url, "_blank", settings);
58202 return function(selection2) {
58205 selection2.append("li").attr("class", "userInfo").classed("hide", true);
58206 selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
58207 osm.on("change.account", () => updateUserDetails(selection2));
58208 updateUserDetails(selection2);
58212 // modules/ui/attribution.js
58213 function uiAttribution(context) {
58214 let _selection = select_default2(null);
58215 function render(selection2, data, klass) {
58216 let div = selection2.selectAll(".".concat(klass)).data([0]);
58217 div = div.enter().append("div").attr("class", klass).merge(div);
58218 let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
58219 attributions.exit().remove();
58220 attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
58221 let attribution = select_default2(nodes[i3]);
58222 if (d2.terms_html) {
58223 attribution.html(d2.terms_html);
58226 if (d2.terms_url) {
58227 attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
58229 const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
58230 const terms_text = _t(
58231 "imagery.".concat(sourceID, ".attribution.text"),
58232 { default: d2.terms_text || d2.id || d2.name() }
58234 if (d2.icon && !d2.overlay) {
58235 attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
58237 attribution.append("span").attr("class", "attribution-text").text(terms_text);
58238 }).merge(attributions);
58239 let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
58240 let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
58241 return notice ? [notice] : [];
58243 copyright.exit().remove();
58244 copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
58245 copyright.text(String);
58247 function update() {
58248 let baselayer = context.background().baseLayerSource();
58249 _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
58250 const z2 = context.map().zoom();
58251 let overlays = context.background().overlayLayerSources() || [];
58252 _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
58254 return function(selection2) {
58255 _selection = selection2;
58256 context.background().on("change.attribution", update);
58257 context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
58262 // modules/ui/contributors.js
58263 function uiContributors(context) {
58264 var osm = context.connection(), debouncedUpdate = debounce_default(function() {
58266 }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
58267 function update() {
58270 var users = {}, entities = context.history().intersects(context.map().extent());
58271 entities.forEach(function(entity) {
58272 if (entity && entity.user)
58273 users[entity.user] = true;
58275 var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
58276 wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
58277 var userList = select_default2(document.createElement("span"));
58278 userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
58279 return osm.userURL(d2);
58280 }).attr("target", "_blank").text(String);
58281 if (u2.length > limit) {
58282 var count = select_default2(document.createElement("span"));
58283 var othersNum = u2.length - limit + 1;
58284 count.append("a").attr("target", "_blank").attr("href", function() {
58285 return osm.changesetsURL(context.map().center(), context.map().zoom());
58286 }).text(othersNum);
58287 wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
58289 wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
58293 wrap2.transition().style("opacity", 0);
58294 } else if (hidden) {
58295 wrap2.transition().style("opacity", 1);
58298 return function(selection2) {
58301 wrap2 = selection2;
58303 osm.on("loaded.contributors", debouncedUpdate);
58304 context.map().on("move.contributors", debouncedUpdate);
58308 // modules/ui/popover.js
58309 var _popoverID = 0;
58310 function uiPopover(klass) {
58311 var _id = _popoverID++;
58312 var _anchorSelection = select_default2(null);
58313 var popover = function(selection2) {
58314 _anchorSelection = selection2;
58315 selection2.each(setup);
58317 var _animation = utilFunctor(false);
58318 var _placement = utilFunctor("top");
58319 var _alignment = utilFunctor("center");
58320 var _scrollContainer = utilFunctor(select_default2(null));
58322 var _displayType = utilFunctor("");
58323 var _hasArrow = utilFunctor(true);
58324 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
58325 popover.displayType = function(val) {
58326 if (arguments.length) {
58327 _displayType = utilFunctor(val);
58330 return _displayType;
58333 popover.hasArrow = function(val) {
58334 if (arguments.length) {
58335 _hasArrow = utilFunctor(val);
58341 popover.placement = function(val) {
58342 if (arguments.length) {
58343 _placement = utilFunctor(val);
58349 popover.alignment = function(val) {
58350 if (arguments.length) {
58351 _alignment = utilFunctor(val);
58357 popover.scrollContainer = function(val) {
58358 if (arguments.length) {
58359 _scrollContainer = utilFunctor(val);
58362 return _scrollContainer;
58365 popover.content = function(val) {
58366 if (arguments.length) {
58373 popover.isShown = function() {
58374 var popoverSelection = _anchorSelection.select(".popover-" + _id);
58375 return !popoverSelection.empty() && popoverSelection.classed("in");
58377 popover.show = function() {
58378 _anchorSelection.each(show);
58380 popover.updateContent = function() {
58381 _anchorSelection.each(updateContent);
58383 popover.hide = function() {
58384 _anchorSelection.each(hide);
58386 popover.toggle = function() {
58387 _anchorSelection.each(toggle);
58389 popover.destroy = function(selection2, selector) {
58390 selector = selector || ".popover-" + _id;
58391 selection2.on(_pointerPrefix + "enter.popover", null).on(_pointerPrefix + "leave.popover", null).on(_pointerPrefix + "up.popover", null).on(_pointerPrefix + "down.popover", null).on("click.popover", null).attr("title", function() {
58392 return this.getAttribute("data-original-title") || this.getAttribute("title");
58393 }).attr("data-original-title", null).selectAll(selector).remove();
58395 popover.destroyAny = function(selection2) {
58396 selection2.call(popover.destroy, ".popover");
58399 var anchor = select_default2(this);
58400 var animate = _animation.apply(this, arguments);
58401 var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
58402 var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
58403 enter.append("div").attr("class", "popover-arrow");
58404 enter.append("div").attr("class", "popover-inner");
58405 popoverSelection = enter.merge(popoverSelection);
58407 popoverSelection.classed("fade", true);
58409 var display = _displayType.apply(this, arguments);
58410 if (display === "hover") {
58411 var _lastNonMouseEnterTime;
58412 anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
58413 if (d3_event.pointerType) {
58414 if (d3_event.pointerType !== "mouse") {
58415 _lastNonMouseEnterTime = d3_event.timeStamp;
58417 } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
58421 if (d3_event.buttons !== 0)
58423 show.apply(this, arguments);
58424 }).on(_pointerPrefix + "leave.popover", function() {
58425 hide.apply(this, arguments);
58426 }).on("focus.popover", function() {
58427 show.apply(this, arguments);
58428 }).on("blur.popover", function() {
58429 hide.apply(this, arguments);
58431 } else if (display === "clickFocus") {
58432 anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
58433 d3_event.preventDefault();
58434 d3_event.stopPropagation();
58435 }).on(_pointerPrefix + "up.popover", function(d3_event) {
58436 d3_event.preventDefault();
58437 d3_event.stopPropagation();
58438 }).on("click.popover", toggle);
58439 popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
58440 anchor.each(function() {
58441 hide.apply(this, arguments);
58447 var anchor = select_default2(this);
58448 var popoverSelection = anchor.selectAll(".popover-" + _id);
58449 if (popoverSelection.empty()) {
58450 anchor.call(popover.destroy);
58451 anchor.each(setup);
58452 popoverSelection = anchor.selectAll(".popover-" + _id);
58454 popoverSelection.classed("in", true);
58455 var displayType = _displayType.apply(this, arguments);
58456 if (displayType === "clickFocus") {
58457 anchor.classed("active", true);
58458 popoverSelection.node().focus();
58460 anchor.each(updateContent);
58462 function updateContent() {
58463 var anchor = select_default2(this);
58465 anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
58467 updatePosition.apply(this, arguments);
58468 updatePosition.apply(this, arguments);
58469 updatePosition.apply(this, arguments);
58471 function updatePosition() {
58472 var anchor = select_default2(this);
58473 var popoverSelection = anchor.selectAll(".popover-" + _id);
58474 var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
58475 var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
58476 var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
58477 var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
58478 var placement = _placement.apply(this, arguments);
58479 popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
58480 var alignment = _alignment.apply(this, arguments);
58481 var alignFactor = 0.5;
58482 if (alignment === "leading") {
58484 } else if (alignment === "trailing") {
58487 var anchorFrame = getFrame(anchor.node());
58488 var popoverFrame = getFrame(popoverSelection.node());
58490 switch (placement) {
58493 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
58494 y: anchorFrame.y - popoverFrame.h
58499 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
58500 y: anchorFrame.y + anchorFrame.h
58505 x: anchorFrame.x - popoverFrame.w,
58506 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
58511 x: anchorFrame.x + anchorFrame.w,
58512 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
58517 if (scrollNode && (placement === "top" || placement === "bottom")) {
58518 var initialPosX = position.x;
58519 if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
58520 position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
58521 } else if (position.x < 10) {
58524 var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
58525 var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
58526 arrow.style("left", ~~arrowPosX + "px");
58528 popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
58530 popoverSelection.style("left", null).style("top", null);
58532 function getFrame(node) {
58533 var positionStyle = select_default2(node).style("position");
58534 if (positionStyle === "absolute" || positionStyle === "static") {
58536 x: node.offsetLeft - scrollLeft,
58537 y: node.offsetTop - scrollTop,
58538 w: node.offsetWidth,
58539 h: node.offsetHeight
58545 w: node.offsetWidth,
58546 h: node.offsetHeight
58552 var anchor = select_default2(this);
58553 if (_displayType.apply(this, arguments) === "clickFocus") {
58554 anchor.classed("active", false);
58556 anchor.selectAll(".popover-" + _id).classed("in", false);
58558 function toggle() {
58559 if (select_default2(this).select(".popover-" + _id).classed("in")) {
58560 hide.apply(this, arguments);
58562 show.apply(this, arguments);
58568 // modules/ui/tooltip.js
58569 function uiTooltip(klass) {
58570 var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
58571 var _title = function() {
58572 var title = this.getAttribute("data-original-title");
58576 title = this.getAttribute("title");
58577 this.removeAttribute("title");
58578 this.setAttribute("data-original-title", title);
58582 var _heading = utilFunctor(null);
58583 var _keys = utilFunctor(null);
58584 tooltip.title = function(val) {
58585 if (!arguments.length)
58587 _title = utilFunctor(val);
58590 tooltip.heading = function(val) {
58591 if (!arguments.length)
58593 _heading = utilFunctor(val);
58596 tooltip.keys = function(val) {
58597 if (!arguments.length)
58599 _keys = utilFunctor(val);
58602 tooltip.content(function() {
58603 var heading2 = _heading.apply(this, arguments);
58604 var text = _title.apply(this, arguments);
58605 var keys2 = _keys.apply(this, arguments);
58606 var headingCallback = typeof heading2 === "function" ? heading2 : (s2) => s2.text(heading2);
58607 var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
58608 return function(selection2) {
58609 var headingSelect = selection2.selectAll(".tooltip-heading").data(heading2 ? [heading2] : []);
58610 headingSelect.exit().remove();
58611 headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
58612 var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
58613 textSelect.exit().remove();
58614 textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
58615 var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
58616 keyhintWrap.exit().remove();
58617 var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
58618 keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
58619 keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
58620 keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
58628 // modules/ui/edit_menu.js
58629 function uiEditMenu(context) {
58630 var dispatch14 = dispatch_default("toggled");
58631 var _menu = select_default2(null);
58632 var _operations = [];
58633 var _anchorLoc = [0, 0];
58634 var _anchorLocLonLat = [0, 0];
58635 var _triggerType = "";
58636 var _vpTopMargin = 85;
58637 var _vpBottomMargin = 45;
58638 var _vpSideMargin = 35;
58639 var _menuTop = false;
58642 var _verticalPadding = 4;
58643 var _tooltipWidth = 210;
58644 var _menuSideMargin = 10;
58645 var _tooltips = [];
58646 var editMenu = function(selection2) {
58647 var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
58648 var ops = _operations.filter(function(op) {
58649 return !isTouchMenu || !op.mouseOnly;
58654 _menuTop = isTouchMenu;
58655 var showLabels = isTouchMenu;
58656 var buttonHeight = showLabels ? 32 : 34;
58658 _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
58659 return op.title.length;
58664 _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
58665 _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
58666 var buttons = _menu.selectAll(".edit-menu-item").data(ops);
58667 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
58668 return "edit-menu-item edit-menu-item-" + d2.id;
58669 }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
58670 d3_event.stopPropagation();
58671 }).on("mouseenter.highlight", function(d3_event, d2) {
58672 if (!d2.relatedEntityIds || select_default2(this).classed("disabled"))
58674 utilHighlightEntities(d2.relatedEntityIds(), true, context);
58675 }).on("mouseleave.highlight", function(d3_event, d2) {
58676 if (!d2.relatedEntityIds)
58678 utilHighlightEntities(d2.relatedEntityIds(), false, context);
58680 buttonsEnter.each(function(d2) {
58681 var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
58682 _tooltips.push(tooltip);
58683 select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
58686 buttonsEnter.append("span").attr("class", "label").each(function(d2) {
58687 select_default2(this).call(d2.title);
58690 buttonsEnter.merge(buttons).classed("disabled", function(d2) {
58691 return d2.disabled();
58694 var initialScale = context.projection.scale();
58695 context.map().on("move.edit-menu", function() {
58696 if (initialScale !== context.projection.scale()) {
58699 }).on("drawn.edit-menu", function(info) {
58703 var lastPointerUpType;
58704 function pointerup(d3_event) {
58705 lastPointerUpType = d3_event.pointerType;
58707 function click(d3_event, operation2) {
58708 d3_event.stopPropagation();
58709 if (operation2.relatedEntityIds) {
58710 utilHighlightEntities(operation2.relatedEntityIds(), false, context);
58712 if (operation2.disabled()) {
58713 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
58714 context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
58717 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
58718 context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
58723 lastPointerUpType = null;
58725 dispatch14.call("toggled", this, true);
58727 function updatePosition() {
58728 if (!_menu || _menu.empty())
58730 var anchorLoc = context.projection(_anchorLocLonLat);
58731 var viewport = context.surfaceRect();
58732 if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
58736 var menuLeft = displayOnLeft(viewport);
58737 var offset = [0, 0];
58738 offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
58740 if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
58741 offset[1] = -anchorLoc[1] + _vpTopMargin;
58743 offset[1] = -_menuHeight;
58746 if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
58747 offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
58752 var origin = geoVecAdd(anchorLoc, offset);
58753 _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
58754 var tooltipSide = tooltipPosition(viewport, menuLeft);
58755 _tooltips.forEach(function(tooltip) {
58756 tooltip.placement(tooltipSide);
58758 function displayOnLeft(viewport2) {
58759 if (_mainLocalizer.textDirection() === "ltr") {
58760 if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
58765 if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
58771 function tooltipPosition(viewport2, menuLeft2) {
58772 if (_mainLocalizer.textDirection() === "ltr") {
58776 if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
58784 if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
58791 editMenu.close = function() {
58792 context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
58795 dispatch14.call("toggled", this, false);
58797 editMenu.anchorLoc = function(val) {
58798 if (!arguments.length)
58801 _anchorLocLonLat = context.projection.invert(_anchorLoc);
58804 editMenu.triggerType = function(val) {
58805 if (!arguments.length)
58806 return _triggerType;
58807 _triggerType = val;
58810 editMenu.operations = function(val) {
58811 if (!arguments.length)
58812 return _operations;
58816 return utilRebind(editMenu, dispatch14, "on");
58819 // modules/ui/feature_info.js
58820 function uiFeatureInfo(context) {
58821 function update(selection2) {
58822 var features = context.features();
58823 var stats = features.stats();
58825 var hiddenList = features.hidden().map(function(k2) {
58827 count += stats[k2];
58828 return _t.append("inspector.title_count", {
58829 title: _t("feature." + k2 + ".description"),
58834 }).filter(Boolean);
58835 selection2.text("");
58836 if (hiddenList.length) {
58837 var tooltipBehavior = uiTooltip().placement("top").title(function() {
58838 return (selection3) => {
58839 hiddenList.forEach((hiddenFeature) => {
58840 selection3.append("div").call(hiddenFeature);
58844 selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
58845 tooltipBehavior.hide();
58846 d3_event.preventDefault();
58847 context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
58850 selection2.classed("hide", !hiddenList.length);
58852 return function(selection2) {
58853 update(selection2);
58854 context.features().on("change.feature_info", function() {
58855 update(selection2);
58860 // modules/ui/flash.js
58861 function uiFlash(context) {
58863 var _duration = 2e3;
58864 var _iconName = "#iD-icon-no";
58865 var _iconClass = "disabled";
58866 var _label = (s2) => s2.text("");
58869 _flashTimer.stop();
58871 context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
58872 context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
58873 var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
58874 var contentEnter = content.enter().append("div").attr("class", "flash-content");
58875 var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
58876 iconEnter.append("circle").attr("r", 9);
58877 iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
58878 contentEnter.append("div").attr("class", "flash-text");
58879 content = content.merge(contentEnter);
58880 content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
58881 content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
58882 content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
58883 _flashTimer = timeout_default(function() {
58884 _flashTimer = null;
58885 context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
58886 context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
58890 flash.duration = function(_2) {
58891 if (!arguments.length)
58896 flash.label = function(_2) {
58897 if (!arguments.length)
58899 if (typeof _2 !== "function") {
58900 _label = (selection2) => selection2.text(_2);
58902 _label = (selection2) => selection2.text("").call(_2);
58906 flash.iconName = function(_2) {
58907 if (!arguments.length)
58912 flash.iconClass = function(_2) {
58913 if (!arguments.length)
58921 // modules/ui/full_screen.js
58922 function uiFullScreen(context) {
58923 var element = context.container().node();
58924 function getFullScreenFn() {
58925 if (element.requestFullscreen) {
58926 return element.requestFullscreen;
58927 } else if (element.msRequestFullscreen) {
58928 return element.msRequestFullscreen;
58929 } else if (element.mozRequestFullScreen) {
58930 return element.mozRequestFullScreen;
58931 } else if (element.webkitRequestFullscreen) {
58932 return element.webkitRequestFullscreen;
58935 function getExitFullScreenFn() {
58936 if (document.exitFullscreen) {
58937 return document.exitFullscreen;
58938 } else if (document.msExitFullscreen) {
58939 return document.msExitFullscreen;
58940 } else if (document.mozCancelFullScreen) {
58941 return document.mozCancelFullScreen;
58942 } else if (document.webkitExitFullscreen) {
58943 return document.webkitExitFullscreen;
58946 function isFullScreen() {
58947 return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
58949 function isSupported() {
58950 return !!getFullScreenFn();
58952 function fullScreen(d3_event) {
58953 d3_event.preventDefault();
58954 if (!isFullScreen()) {
58955 getFullScreenFn().apply(element);
58957 getExitFullScreenFn().apply(document);
58960 return function() {
58961 if (!isSupported())
58963 var detected = utilDetect();
58964 var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
58965 context.keybinding().on(keys2, fullScreen);
58969 // modules/ui/geolocate.js
58970 function uiGeolocate(context) {
58971 var _geolocationOptions = {
58972 // prioritize speed and power usage over precision
58973 enableHighAccuracy: false,
58974 // don't hang indefinitely getting the location
58978 var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
58979 var _layer = context.layers().layer("geolocate");
58983 var _button = select_default2(null);
58985 if (context.inIntro())
58987 if (!_layer.enabled() && !_locating.isShown()) {
58988 _timeoutID = setTimeout(
58993 context.container().call(_locating);
58994 navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
58997 _layer.enabled(null, false);
58998 updateButtonState();
59001 function zoomTo() {
59002 context.enter(modeBrowse(context));
59003 var map2 = context.map();
59004 _layer.enabled(_position, true);
59005 updateButtonState();
59006 map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
59008 function success(geolocation) {
59009 _position = geolocation;
59010 var coords = _position.coords;
59011 _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
59019 context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
59023 function finish() {
59026 clearTimeout(_timeoutID);
59028 _timeoutID = void 0;
59030 function updateButtonState() {
59031 _button.classed("active", _layer.enabled());
59032 _button.attr("aria-pressed", _layer.enabled());
59034 return function(selection2) {
59035 if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition)
59037 _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
59038 uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
59040 context.keybinding().on(_t("geolocate.key"), click);
59044 // modules/ui/panels/background.js
59045 function uiPanelBackground(context) {
59046 var background = context.background();
59047 var _currSourceName = null;
59048 var _metadata = {};
59049 var _metadataKeys = [
59057 var debouncedRedraw = debounce_default(redraw, 250);
59058 function redraw(selection2) {
59059 var source = background.baseLayerSource();
59062 var isDG = source.id.match(/^DigitalGlobe/i) !== null;
59063 var sourceLabel = source.label();
59064 if (_currSourceName !== sourceLabel) {
59065 _currSourceName = sourceLabel;
59068 selection2.text("");
59069 var list2 = selection2.append("ul").attr("class", "background-info");
59070 list2.append("li").call(_currSourceName);
59071 _metadataKeys.forEach(function(k2) {
59072 if (isDG && k2 === "vintage")
59074 list2.append("li").attr("class", "background-info-list-" + k2).classed("hide", !_metadata[k2]).call(_t.append("info_panels.background." + k2, { suffix: ":" })).append("span").attr("class", "background-info-span-" + k2).text(_metadata[k2]);
59076 debouncedGetMetadata(selection2);
59077 var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
59078 selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
59079 d3_event.preventDefault();
59080 context.setDebug("tile", !context.getDebug("tile"));
59081 selection2.call(redraw);
59084 var key = source.id + "-vintage";
59085 var sourceVintage = context.background().findSource(key);
59086 var showsVintage = context.background().showsLayer(sourceVintage);
59087 var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
59088 selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
59089 d3_event.preventDefault();
59090 context.background().toggleOverlayLayer(sourceVintage);
59091 selection2.call(redraw);
59094 ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
59095 if (source.id !== layerId) {
59096 var key2 = layerId + "-vintage";
59097 var sourceVintage2 = context.background().findSource(key2);
59098 if (context.background().showsLayer(sourceVintage2)) {
59099 context.background().toggleOverlayLayer(sourceVintage2);
59104 var debouncedGetMetadata = debounce_default(getMetadata, 250);
59105 function getMetadata(selection2) {
59106 var tile = context.container().select(".layer-background img.tile-center");
59109 var sourceName = _currSourceName;
59110 var d2 = tile.datum();
59111 var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
59112 var center = context.map().center();
59113 _metadata.zoom = String(zoom);
59114 selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
59115 if (!d2 || !d2.length >= 3)
59117 background.baseLayerSource().getMetadata(center, d2, function(err, result) {
59118 if (err || _currSourceName !== sourceName)
59120 var vintage = result.vintage;
59121 _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
59122 selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
59123 _metadataKeys.forEach(function(k2) {
59124 if (k2 === "zoom" || k2 === "vintage")
59126 var val = result[k2];
59127 _metadata[k2] = val;
59128 selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
59132 var panel = function(selection2) {
59133 selection2.call(redraw);
59134 context.map().on("drawn.info-background", function() {
59135 selection2.call(debouncedRedraw);
59136 }).on("move.info-background", function() {
59137 selection2.call(debouncedGetMetadata);
59140 panel.off = function() {
59141 context.map().on("drawn.info-background", null).on("move.info-background", null);
59143 panel.id = "background";
59144 panel.label = _t.append("info_panels.background.title");
59145 panel.key = _t("info_panels.background.key");
59149 // modules/ui/panels/history.js
59150 function uiPanelHistory(context) {
59152 function displayTimestamp(timestamp) {
59154 return _t("info_panels.history.unknown");
59163 var d2 = new Date(timestamp);
59164 if (isNaN(d2.getTime()))
59165 return _t("info_panels.history.unknown");
59166 return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
59168 function displayUser(selection2, userName) {
59170 selection2.append("span").call(_t.append("info_panels.history.unknown"));
59173 selection2.append("span").attr("class", "user-name").text(userName);
59174 var links = selection2.append("div").attr("class", "links");
59176 links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
59178 links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
59180 function displayChangeset(selection2, changeset) {
59182 selection2.append("span").call(_t.append("info_panels.history.unknown"));
59185 selection2.append("span").attr("class", "changeset-id").text(changeset);
59186 var links = selection2.append("div").attr("class", "links");
59188 links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
59190 links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
59191 links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
59193 function redraw(selection2) {
59194 var selectedNoteID = context.selectedNoteID();
59195 osm = context.connection();
59196 var selected, note, entity;
59197 if (selectedNoteID && osm) {
59198 selected = [_t.html("note.note") + " " + selectedNoteID];
59199 note = osm.getNote(selectedNoteID);
59201 selected = context.selectedIDs().filter(function(e3) {
59202 return context.hasEntity(e3);
59204 if (selected.length) {
59205 entity = context.entity(selected[0]);
59208 var singular = selected.length === 1 ? selected[0] : null;
59209 selection2.html("");
59211 selection2.append("h4").attr("class", "history-heading").html(singular);
59213 selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
59218 selection2.call(redrawEntity, entity);
59220 selection2.call(redrawNote, note);
59223 function redrawNote(selection2, note) {
59224 if (!note || note.isNew()) {
59225 selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
59228 var list2 = selection2.append("ul");
59229 list2.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
59230 if (note.comments.length) {
59231 list2.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
59232 list2.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
59235 selection2.append("a").attr("class", "view-history-on-osm").attr("target", "_blank").attr("href", osm.noteURL(note)).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("info_panels.history.note_link_text"));
59238 function redrawEntity(selection2, entity) {
59239 if (!entity || entity.isNew()) {
59240 selection2.append("div").call(_t.append("info_panels.history.no_history"));
59243 var links = selection2.append("div").attr("class", "links");
59245 links.append("a").attr("class", "view-history-on-osm").attr("href", osm.historyURL(entity)).attr("target", "_blank").call(_t.append("info_panels.history.history_link"));
59247 links.append("a").attr("class", "pewu-history-viewer-link").attr("href", "https://pewu.github.io/osm-history/#/" + entity.type + "/" + entity.osmId()).attr("target", "_blank").attr("tabindex", -1).text("PeWu");
59248 var list2 = selection2.append("ul");
59249 list2.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
59250 list2.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
59251 list2.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
59252 list2.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
59254 var panel = function(selection2) {
59255 selection2.call(redraw);
59256 context.map().on("drawn.info-history", function() {
59257 selection2.call(redraw);
59259 context.on("enter.info-history", function() {
59260 selection2.call(redraw);
59263 panel.off = function() {
59264 context.map().on("drawn.info-history", null);
59265 context.on("enter.info-history", null);
59267 panel.id = "history";
59268 panel.label = _t.append("info_panels.history.title");
59269 panel.key = _t("info_panels.history.key");
59273 // modules/ui/panels/location.js
59274 function uiPanelLocation(context) {
59275 var currLocation = "";
59276 function redraw(selection2) {
59277 selection2.html("");
59278 var list2 = selection2.append("ul");
59279 var coord2 = context.map().mouseCoordinates();
59280 if (coord2.some(isNaN)) {
59281 coord2 = context.map().center();
59283 list2.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
59284 selection2.append("div").attr("class", "location-info").text(currLocation || " ");
59285 debouncedGetLocation(selection2, coord2);
59287 var debouncedGetLocation = debounce_default(getLocation, 250);
59288 function getLocation(selection2, coord2) {
59289 if (!services.geocoder) {
59290 currLocation = _t("info_panels.location.unknown_location");
59291 selection2.selectAll(".location-info").text(currLocation);
59293 services.geocoder.reverse(coord2, function(err, result) {
59294 currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
59295 selection2.selectAll(".location-info").text(currLocation);
59299 var panel = function(selection2) {
59300 selection2.call(redraw);
59301 context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
59302 selection2.call(redraw);
59305 panel.off = function() {
59306 context.surface().on(".info-location", null);
59308 panel.id = "location";
59309 panel.label = _t.append("info_panels.location.title");
59310 panel.key = _t("info_panels.location.key");
59314 // modules/ui/panels/measurement.js
59315 function uiPanelMeasurement(context) {
59316 function radiansToMeters(r2) {
59317 return r2 * 63710071809e-4;
59319 function steradiansToSqmeters(r2) {
59320 return r2 / (4 * Math.PI) * 510065621724e3;
59322 function toLineString(feature3) {
59323 if (feature3.type === "LineString")
59325 var result = { type: "LineString", coordinates: [] };
59326 if (feature3.type === "Polygon") {
59327 result.coordinates = feature3.coordinates[0];
59328 } else if (feature3.type === "MultiPolygon") {
59329 result.coordinates = feature3.coordinates[0][0];
59333 var _isImperial = !_mainLocalizer.usesMetric();
59334 function redraw(selection2) {
59335 var graph = context.graph();
59336 var selectedNoteID = context.selectedNoteID();
59337 var osm = services.osm;
59338 var localeCode = _mainLocalizer.localeCode();
59340 var center, location, centroid;
59341 var closed, geometry;
59342 var totalNodeCount, length2 = 0, area = 0, distance;
59343 if (selectedNoteID && osm) {
59344 var note = osm.getNote(selectedNoteID);
59345 heading2 = _t.html("note.note") + " " + selectedNoteID;
59346 location = note.loc;
59349 var selectedIDs = context.selectedIDs().filter(function(id2) {
59350 return context.hasEntity(id2);
59352 var selected = selectedIDs.map(function(id2) {
59353 return context.entity(id2);
59355 heading2 = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
59356 if (selected.length) {
59357 var extent = geoExtent();
59358 for (var i3 in selected) {
59359 var entity = selected[i3];
59360 extent._extend(entity.extent(graph));
59361 geometry = entity.geometry(graph);
59362 if (geometry === "line" || geometry === "area") {
59363 closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
59364 var feature3 = entity.asGeoJSON(graph);
59365 length2 += radiansToMeters(length_default(toLineString(feature3)));
59366 centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
59367 centroid = centroid && context.projection.invert(centroid);
59368 if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
59369 centroid = entity.extent(graph).center();
59372 area += steradiansToSqmeters(entity.area(graph));
59376 if (selected.length > 1) {
59381 if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
59382 distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
59384 if (selected.length === 1 && selected[0].type === "node") {
59385 location = selected[0].loc;
59387 totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
59389 if (!location && !centroid) {
59390 center = extent.center();
59394 selection2.html("");
59396 selection2.append("h4").attr("class", "measurement-heading").html(heading2);
59398 var list2 = selection2.append("ul");
59401 list2.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
59402 closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
59405 if (totalNodeCount) {
59406 list2.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
59409 list2.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
59412 list2.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
59414 if (typeof distance === "number") {
59415 list2.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
59418 coordItem = list2.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
59419 coordItem.append("span").text(dmsCoordinatePair(location));
59420 coordItem.append("span").text(decimalCoordinatePair(location));
59423 coordItem = list2.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
59424 coordItem.append("span").text(dmsCoordinatePair(centroid));
59425 coordItem.append("span").text(decimalCoordinatePair(centroid));
59428 coordItem = list2.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
59429 coordItem.append("span").text(dmsCoordinatePair(center));
59430 coordItem.append("span").text(decimalCoordinatePair(center));
59432 if (length2 || area || typeof distance === "number") {
59433 var toggle = _isImperial ? "imperial" : "metric";
59434 selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
59435 d3_event.preventDefault();
59436 _isImperial = !_isImperial;
59437 selection2.call(redraw);
59441 var panel = function(selection2) {
59442 selection2.call(redraw);
59443 context.map().on("drawn.info-measurement", function() {
59444 selection2.call(redraw);
59446 context.on("enter.info-measurement", function() {
59447 selection2.call(redraw);
59450 panel.off = function() {
59451 context.map().on("drawn.info-measurement", null);
59452 context.on("enter.info-measurement", null);
59454 panel.id = "measurement";
59455 panel.label = _t.append("info_panels.measurement.title");
59456 panel.key = _t("info_panels.measurement.key");
59460 // modules/ui/panels/index.js
59461 var uiInfoPanels = {
59462 background: uiPanelBackground,
59463 history: uiPanelHistory,
59464 location: uiPanelLocation,
59465 measurement: uiPanelMeasurement
59468 // modules/ui/info.js
59469 function uiInfo(context) {
59470 var ids = Object.keys(uiInfoPanels);
59471 var wasActive = ["measurement"];
59474 ids.forEach(function(k2) {
59476 panels[k2] = uiInfoPanels[k2](context);
59477 active[k2] = false;
59480 function info(selection2) {
59481 function redraw() {
59482 var activeids = ids.filter(function(k2) {
59485 var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
59488 containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
59489 select_default2(this).call(panels[d2].off).remove();
59491 var enter = containers.enter().append("div").attr("class", function(d2) {
59492 return "fillD2 panel-container panel-container-" + d2;
59494 enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
59495 var title = enter.append("div").attr("class", "panel-title fillD2");
59496 title.append("h3").each(function(d2) {
59497 return panels[d2].label(select_default2(this));
59499 title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
59500 d3_event.stopImmediatePropagation();
59501 d3_event.preventDefault();
59503 }).call(svgIcon("#iD-icon-close"));
59504 enter.append("div").attr("class", function(d2) {
59505 return "panel-content panel-content-" + d2;
59507 infoPanels.selectAll(".panel-content").each(function(d2) {
59508 select_default2(this).call(panels[d2]);
59511 info.toggle = function(which) {
59512 var activeids = ids.filter(function(k2) {
59516 active[which] = !active[which];
59517 if (activeids.length === 1 && activeids[0] === which) {
59518 wasActive = [which];
59520 context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
59522 if (activeids.length) {
59523 wasActive = activeids;
59524 activeids.forEach(function(k2) {
59525 active[k2] = false;
59528 wasActive.forEach(function(k2) {
59535 var infoPanels = selection2.selectAll(".info-panels").data([0]);
59536 infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
59538 context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
59539 d3_event.stopImmediatePropagation();
59540 d3_event.preventDefault();
59543 ids.forEach(function(k2) {
59544 var key = _t("info_panels." + k2 + ".key", { default: null });
59547 context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
59548 d3_event.stopImmediatePropagation();
59549 d3_event.preventDefault();
59557 // modules/ui/intro/helper.js
59558 function pointBox(loc, context) {
59559 var rect = context.surfaceRect();
59560 var point2 = context.curtainProjection(loc);
59562 left: point2[0] + rect.left - 40,
59563 top: point2[1] + rect.top - 60,
59568 function pad(locOrBox, padding, context) {
59570 if (locOrBox instanceof Array) {
59571 var rect = context.surfaceRect();
59572 var point2 = context.curtainProjection(locOrBox);
59574 left: point2[0] + rect.left,
59575 top: point2[1] + rect.top
59581 left: box.left - padding,
59582 top: box.top - padding,
59583 width: (box.width || 0) + 2 * padding,
59584 height: (box.width || 0) + 2 * padding
59587 function icon(name, svgklass, useklass) {
59588 return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
59590 var helpStringReplacements;
59591 function helpHtml(id2, replacements) {
59592 if (!helpStringReplacements) {
59593 helpStringReplacements = {
59594 // insert icons corresponding to various UI elements
59595 point_icon: icon("#iD-icon-point", "inline"),
59596 line_icon: icon("#iD-icon-line", "inline"),
59597 area_icon: icon("#iD-icon-area", "inline"),
59598 note_icon: icon("#iD-icon-note", "inline add-note"),
59599 plus: icon("#iD-icon-plus", "inline"),
59600 minus: icon("#iD-icon-minus", "inline"),
59601 layers_icon: icon("#iD-icon-layers", "inline"),
59602 data_icon: icon("#iD-icon-data", "inline"),
59603 inspect: icon("#iD-icon-inspect", "inline"),
59604 help_icon: icon("#iD-icon-help", "inline"),
59605 undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
59606 redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
59607 save_icon: icon("#iD-icon-save", "inline"),
59609 circularize_icon: icon("#iD-operation-circularize", "inline operation"),
59610 continue_icon: icon("#iD-operation-continue", "inline operation"),
59611 copy_icon: icon("#iD-operation-copy", "inline operation"),
59612 delete_icon: icon("#iD-operation-delete", "inline operation"),
59613 disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
59614 downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
59615 extract_icon: icon("#iD-operation-extract", "inline operation"),
59616 merge_icon: icon("#iD-operation-merge", "inline operation"),
59617 move_icon: icon("#iD-operation-move", "inline operation"),
59618 orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
59619 paste_icon: icon("#iD-operation-paste", "inline operation"),
59620 reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
59621 reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
59622 reverse_icon: icon("#iD-operation-reverse", "inline operation"),
59623 rotate_icon: icon("#iD-operation-rotate", "inline operation"),
59624 split_icon: icon("#iD-operation-split", "inline operation"),
59625 straighten_icon: icon("#iD-operation-straighten", "inline operation"),
59626 // interaction icons
59627 leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
59628 rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
59629 mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
59630 tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
59631 doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
59632 longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
59633 touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
59634 pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
59635 // insert keys; may be localized and platform-dependent
59636 shift: uiCmd.display("\u21E7"),
59637 alt: uiCmd.display("\u2325"),
59638 return: uiCmd.display("\u21B5"),
59639 esc: _t.html("shortcuts.key.esc"),
59640 space: _t.html("shortcuts.key.space"),
59641 add_note_key: _t.html("modes.add_note.key"),
59642 help_key: _t.html("help.key"),
59643 shortcuts_key: _t.html("shortcuts.toggle.key"),
59644 // reference localized UI labels directly so that they'll always match
59645 save: _t.html("save.title"),
59646 undo: _t.html("undo.title"),
59647 redo: _t.html("redo.title"),
59648 upload: _t.html("commit.save"),
59649 point: _t.html("modes.add_point.title"),
59650 line: _t.html("modes.add_line.title"),
59651 area: _t.html("modes.add_area.title"),
59652 note: _t.html("modes.add_note.label"),
59653 circularize: _t.html("operations.circularize.title"),
59654 continue: _t.html("operations.continue.title"),
59655 copy: _t.html("operations.copy.title"),
59656 delete: _t.html("operations.delete.title"),
59657 disconnect: _t.html("operations.disconnect.title"),
59658 downgrade: _t.html("operations.downgrade.title"),
59659 extract: _t.html("operations.extract.title"),
59660 merge: _t.html("operations.merge.title"),
59661 move: _t.html("operations.move.title"),
59662 orthogonalize: _t.html("operations.orthogonalize.title"),
59663 paste: _t.html("operations.paste.title"),
59664 reflect_long: _t.html("operations.reflect.title.long"),
59665 reflect_short: _t.html("operations.reflect.title.short"),
59666 reverse: _t.html("operations.reverse.title"),
59667 rotate: _t.html("operations.rotate.title"),
59668 split: _t.html("operations.split.title"),
59669 straighten: _t.html("operations.straighten.title"),
59670 map_data: _t.html("map_data.title"),
59671 osm_notes: _t.html("map_data.layers.notes.title"),
59672 fields: _t.html("inspector.fields"),
59673 tags: _t.html("inspector.tags"),
59674 relations: _t.html("inspector.relations"),
59675 new_relation: _t.html("inspector.new_relation"),
59676 turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
59677 background_settings: _t.html("background.description"),
59678 imagery_offset: _t.html("background.fix_misalignment"),
59679 start_the_walkthrough: _t.html("splash.walkthrough"),
59680 help: _t.html("help.title"),
59681 ok: _t.html("intro.ok")
59683 for (var key in helpStringReplacements) {
59684 helpStringReplacements[key] = { html: helpStringReplacements[key] };
59688 if (replacements) {
59689 reps = Object.assign(replacements, helpStringReplacements);
59691 reps = helpStringReplacements;
59693 return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
59695 function slugify(text) {
59696 return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
59698 var missingStrings = {};
59699 function checkKey(key, text) {
59700 if (_t(key, { default: void 0 }) === void 0) {
59701 if (missingStrings.hasOwnProperty(key))
59703 missingStrings[key] = text;
59704 var missing = key + ": " + text;
59705 if (typeof console !== "undefined")
59706 console.log(missing);
59709 function localize(obj) {
59711 var name = obj.tags && obj.tags.name;
59713 key = "intro.graph.name." + slugify(name);
59714 obj.tags.name = _t(key, { default: name });
59715 checkKey(key, name);
59717 var street = obj.tags && obj.tags["addr:street"];
59719 key = "intro.graph.name." + slugify(street);
59720 obj.tags["addr:street"] = _t(key, { default: street });
59721 checkKey(key, street);
59736 addrTags.forEach(function(k2) {
59737 var key2 = "intro.graph." + k2;
59738 var tag2 = "addr:" + k2;
59739 var val = obj.tags && obj.tags[tag2];
59740 var str = _t(key2, { default: val });
59742 if (str.match(/^<.*>$/) !== null) {
59743 delete obj.tags[tag2];
59745 obj.tags[tag2] = str;
59752 function isMostlySquare(points) {
59753 var threshold = 15;
59754 var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
59755 var upperBound = Math.cos(threshold * Math.PI / 180);
59756 for (var i3 = 0; i3 < points.length; i3++) {
59757 var a2 = points[(i3 - 1 + points.length) % points.length];
59758 var origin = points[i3];
59759 var b2 = points[(i3 + 1) % points.length];
59760 var dotp = geoVecNormalizedDot(a2, b2, origin);
59761 var mag = Math.abs(dotp);
59762 if (mag > lowerBound && mag < upperBound) {
59768 function selectMenuItem(context, operation2) {
59769 return context.container().select(".edit-menu .edit-menu-item-" + operation2);
59771 function transitionTime(point1, point2) {
59772 var distance = geoSphericalDistance(point1, point2);
59773 if (distance === 0) {
59775 } else if (distance < 80) {
59782 // modules/ui/toggle.js
59783 function uiToggle(show, callback) {
59784 return function(selection2) {
59785 selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
59786 select_default2(this).classed("hide", !show).style("opacity", null);
59788 callback.apply(this);
59793 // modules/ui/curtain.js
59794 function uiCurtain(containerNode) {
59795 var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
59796 function curtain(selection2) {
59797 surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
59798 darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
59799 select_default2(window).on("resize.curtain", resize);
59800 tooltip = selection2.append("div").attr("class", "tooltip");
59801 tooltip.append("div").attr("class", "popover-arrow");
59802 tooltip.append("div").attr("class", "popover-inner");
59804 function resize() {
59805 surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
59806 curtain.cut(darkness.datum());
59809 curtain.reveal = function(box, html3, options2) {
59810 options2 = options2 || {};
59811 if (typeof box === "string") {
59812 box = select_default2(box).node();
59814 if (box && box.getBoundingClientRect) {
59815 box = copyBox(box.getBoundingClientRect());
59816 var containerRect = containerNode.getBoundingClientRect();
59817 box.top -= containerRect.top;
59818 box.left -= containerRect.left;
59820 if (box && options2.padding) {
59821 box.top -= options2.padding;
59822 box.left -= options2.padding;
59823 box.bottom += options2.padding;
59824 box.right += options2.padding;
59825 box.height += options2.padding * 2;
59826 box.width += options2.padding * 2;
59829 if (options2.tooltipBox) {
59830 tooltipBox = options2.tooltipBox;
59831 if (typeof tooltipBox === "string") {
59832 tooltipBox = select_default2(tooltipBox).node();
59834 if (tooltipBox && tooltipBox.getBoundingClientRect) {
59835 tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
59840 if (tooltipBox && html3) {
59841 if (html3.indexOf("**") !== -1) {
59842 if (html3.indexOf("<span") === 0) {
59843 html3 = html3.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
59845 html3 = html3.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
59847 html3 = html3.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
59849 html3 = html3.replace(/\*(.*?)\*/g, "<em>$1</em>");
59850 html3 = html3.replace(/\{br\}/g, "<br/><br/>");
59851 if (options2.buttonText && options2.buttonCallback) {
59852 html3 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
59854 var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
59855 tooltip.classed(classes, true).selectAll(".popover-inner").html(html3);
59856 if (options2.buttonText && options2.buttonCallback) {
59857 var button = tooltip.selectAll(".button-section .button.action");
59858 button.on("click", function(d3_event) {
59859 d3_event.preventDefault();
59860 options2.buttonCallback();
59863 var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
59864 if (options2.tooltipClass === "intro-mouse") {
59867 if (tooltipBox.top + tooltipBox.height > h2) {
59868 tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
59870 if (tooltipBox.left + tooltipBox.width > w2) {
59871 tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
59873 if (tooltipBox.top + tooltipBox.height < 100) {
59876 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
59877 tooltipBox.top + tooltipBox.height
59879 } else if (tooltipBox.top > h2 - 140) {
59882 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
59883 tooltipBox.top - tip.height
59886 var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
59887 if (_mainLocalizer.textDirection() === "rtl") {
59888 if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
59890 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
59893 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
59896 if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
59898 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
59901 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
59905 if (options2.duration !== 0 || !tooltip.classed(side)) {
59906 tooltip.call(uiToggle(true));
59908 tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
59910 if (side === "left" || side === "right") {
59912 shiftY = 60 - pos[1];
59913 } else if (pos[1] + tip.height > h2 - 100) {
59914 shiftY = h2 - pos[1] - tip.height - 100;
59917 tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
59919 tooltip.classed("in", false).call(uiToggle(false));
59921 curtain.cut(box, options2.duration);
59924 curtain.cut = function(datum2, duration) {
59925 darkness.datum(datum2).interrupt();
59927 if (duration === 0) {
59928 selection2 = darkness;
59930 selection2 = darkness.transition().duration(duration || 600).ease(linear2);
59932 selection2.attr("d", function(d2) {
59933 var containerWidth = containerNode.clientWidth;
59934 var containerHeight = containerNode.clientHeight;
59935 var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
59938 return string + "M" + d2.left + "," + d2.top + "L" + d2.left + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + (d2.top + d2.height) + "L" + (d2.left + d2.width) + "," + d2.top + "Z";
59941 curtain.remove = function() {
59944 select_default2(window).on("resize.curtain", null);
59946 function copyBox(src) {
59950 bottom: src.bottom,
59959 // modules/ui/intro/welcome.js
59960 function uiIntroWelcome(context, reveal) {
59961 var dispatch14 = dispatch_default("done");
59963 title: "intro.welcome.title"
59965 function welcome() {
59966 context.map().centerZoom([-85.63591, 41.94285], 19);
59968 ".intro-nav-wrap .chapter-welcome",
59969 helpHtml("intro.welcome.welcome"),
59970 { buttonText: _t.html("intro.ok"), buttonCallback: practice }
59973 function practice() {
59975 ".intro-nav-wrap .chapter-welcome",
59976 helpHtml("intro.welcome.practice"),
59977 { buttonText: _t.html("intro.ok"), buttonCallback: words }
59982 ".intro-nav-wrap .chapter-welcome",
59983 helpHtml("intro.welcome.words"),
59984 { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
59987 function chapters() {
59988 dispatch14.call("done");
59990 ".intro-nav-wrap .chapter-navigation",
59991 helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
59994 chapter.enter = function() {
59997 chapter.exit = function() {
59998 context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
60000 chapter.restart = function() {
60004 return utilRebind(chapter, dispatch14, "on");
60007 // modules/ui/intro/navigation.js
60008 function uiIntroNavigation(context, reveal) {
60009 var dispatch14 = dispatch_default("done");
60011 var hallId = "n2061";
60012 var townHall = [-85.63591, 41.94285];
60013 var springStreetId = "w397";
60014 var springStreetEndId = "n1834";
60015 var springStreet = [-85.63582, 41.94255];
60016 var onewayField = _mainPresetIndex.field("oneway");
60017 var maxspeedField = _mainPresetIndex.field("maxspeed");
60019 title: "intro.navigation.title"
60021 function timeout2(f2, t2) {
60022 timeouts.push(window.setTimeout(f2, t2));
60024 function eventCancel(d3_event) {
60025 d3_event.stopPropagation();
60026 d3_event.preventDefault();
60028 function isTownHallSelected() {
60029 var ids = context.selectedIDs();
60030 return ids.length === 1 && ids[0] === hallId;
60032 function dragMap() {
60033 context.enter(modeBrowse(context));
60034 context.history().reset("initial");
60035 var msec = transitionTime(townHall, context.map().center());
60037 reveal(null, null, { duration: 0 });
60039 context.map().centerZoomEase(townHall, 19, msec);
60040 timeout2(function() {
60041 var centerStart = context.map().center();
60042 var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
60043 var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
60044 reveal(".surface", dragString);
60045 context.map().on("drawn.intro", function() {
60046 reveal(".surface", dragString, { duration: 0 });
60048 context.map().on("move.intro", function() {
60049 var centerNow = context.map().center();
60050 if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
60051 context.map().on("move.intro", null);
60052 timeout2(function() {
60053 continueTo(zoomMap);
60058 function continueTo(nextStep) {
60059 context.map().on("move.intro drawn.intro", null);
60063 function zoomMap() {
60064 var zoomStart = context.map().zoom();
60065 var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
60066 var zoomString = helpHtml("intro.navigation." + textId);
60067 reveal(".surface", zoomString);
60068 context.map().on("drawn.intro", function() {
60069 reveal(".surface", zoomString, { duration: 0 });
60071 context.map().on("move.intro", function() {
60072 if (context.map().zoom() !== zoomStart) {
60073 context.map().on("move.intro", null);
60074 timeout2(function() {
60075 continueTo(features);
60079 function continueTo(nextStep) {
60080 context.map().on("move.intro drawn.intro", null);
60084 function features() {
60085 var onClick = function() {
60086 continueTo(pointsLinesAreas);
60090 helpHtml("intro.navigation.features"),
60091 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60093 context.map().on("drawn.intro", function() {
60096 helpHtml("intro.navigation.features"),
60097 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60100 function continueTo(nextStep) {
60101 context.map().on("drawn.intro", null);
60105 function pointsLinesAreas() {
60106 var onClick = function() {
60107 continueTo(nodesWays);
60111 helpHtml("intro.navigation.points_lines_areas"),
60112 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60114 context.map().on("drawn.intro", function() {
60117 helpHtml("intro.navigation.points_lines_areas"),
60118 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60121 function continueTo(nextStep) {
60122 context.map().on("drawn.intro", null);
60126 function nodesWays() {
60127 var onClick = function() {
60128 continueTo(clickTownHall);
60132 helpHtml("intro.navigation.nodes_ways"),
60133 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60135 context.map().on("drawn.intro", function() {
60138 helpHtml("intro.navigation.nodes_ways"),
60139 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60142 function continueTo(nextStep) {
60143 context.map().on("drawn.intro", null);
60147 function clickTownHall() {
60148 context.enter(modeBrowse(context));
60149 context.history().reset("initial");
60150 var entity = context.hasEntity(hallId);
60153 reveal(null, null, { duration: 0 });
60154 context.map().centerZoomEase(entity.loc, 19, 500);
60155 timeout2(function() {
60156 var entity2 = context.hasEntity(hallId);
60159 var box = pointBox(entity2.loc, context);
60160 var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
60161 reveal(box, helpHtml("intro.navigation." + textId));
60162 context.map().on("move.intro drawn.intro", function() {
60163 var entity3 = context.hasEntity(hallId);
60166 var box2 = pointBox(entity3.loc, context);
60167 reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
60169 context.on("enter.intro", function() {
60170 if (isTownHallSelected())
60171 continueTo(selectedTownHall);
60174 context.history().on("change.intro", function() {
60175 if (!context.hasEntity(hallId)) {
60176 continueTo(clickTownHall);
60179 function continueTo(nextStep) {
60180 context.on("enter.intro", null);
60181 context.map().on("move.intro drawn.intro", null);
60182 context.history().on("change.intro", null);
60186 function selectedTownHall() {
60187 if (!isTownHallSelected())
60188 return clickTownHall();
60189 var entity = context.hasEntity(hallId);
60191 return clickTownHall();
60192 var box = pointBox(entity.loc, context);
60193 var onClick = function() {
60194 continueTo(editorTownHall);
60198 helpHtml("intro.navigation.selected_townhall"),
60199 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60201 context.map().on("move.intro drawn.intro", function() {
60202 var entity2 = context.hasEntity(hallId);
60205 var box2 = pointBox(entity2.loc, context);
60208 helpHtml("intro.navigation.selected_townhall"),
60209 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60212 context.history().on("change.intro", function() {
60213 if (!context.hasEntity(hallId)) {
60214 continueTo(clickTownHall);
60217 function continueTo(nextStep) {
60218 context.map().on("move.intro drawn.intro", null);
60219 context.history().on("change.intro", null);
60223 function editorTownHall() {
60224 if (!isTownHallSelected())
60225 return clickTownHall();
60226 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60227 var onClick = function() {
60228 continueTo(presetTownHall);
60231 ".entity-editor-pane",
60232 helpHtml("intro.navigation.editor_townhall"),
60233 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60235 context.on("exit.intro", function() {
60236 continueTo(clickTownHall);
60238 context.history().on("change.intro", function() {
60239 if (!context.hasEntity(hallId)) {
60240 continueTo(clickTownHall);
60243 function continueTo(nextStep) {
60244 context.on("exit.intro", null);
60245 context.history().on("change.intro", null);
60246 context.container().select(".inspector-wrap").on("wheel.intro", null);
60250 function presetTownHall() {
60251 if (!isTownHallSelected())
60252 return clickTownHall();
60253 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60254 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60255 var entity = context.entity(context.selectedIDs()[0]);
60256 var preset = _mainPresetIndex.match(entity, context.graph());
60257 var onClick = function() {
60258 continueTo(fieldsTownHall);
60261 ".entity-editor-pane .section-feature-type",
60262 helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
60263 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60265 context.on("exit.intro", function() {
60266 continueTo(clickTownHall);
60268 context.history().on("change.intro", function() {
60269 if (!context.hasEntity(hallId)) {
60270 continueTo(clickTownHall);
60273 function continueTo(nextStep) {
60274 context.on("exit.intro", null);
60275 context.history().on("change.intro", null);
60276 context.container().select(".inspector-wrap").on("wheel.intro", null);
60280 function fieldsTownHall() {
60281 if (!isTownHallSelected())
60282 return clickTownHall();
60283 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60284 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60285 var onClick = function() {
60286 continueTo(closeTownHall);
60289 ".entity-editor-pane .section-preset-fields",
60290 helpHtml("intro.navigation.fields_townhall"),
60291 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60293 context.on("exit.intro", function() {
60294 continueTo(clickTownHall);
60296 context.history().on("change.intro", function() {
60297 if (!context.hasEntity(hallId)) {
60298 continueTo(clickTownHall);
60301 function continueTo(nextStep) {
60302 context.on("exit.intro", null);
60303 context.history().on("change.intro", null);
60304 context.container().select(".inspector-wrap").on("wheel.intro", null);
60308 function closeTownHall() {
60309 if (!isTownHallSelected())
60310 return clickTownHall();
60311 var selector = ".entity-editor-pane button.close svg use";
60312 var href = select_default2(selector).attr("href") || "#iD-icon-close";
60314 ".entity-editor-pane",
60315 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
60317 context.on("exit.intro", function() {
60318 continueTo(searchStreet);
60320 context.history().on("change.intro", function() {
60321 var selector2 = ".entity-editor-pane button.close svg use";
60322 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60324 ".entity-editor-pane",
60325 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
60329 function continueTo(nextStep) {
60330 context.on("exit.intro", null);
60331 context.history().on("change.intro", null);
60335 function searchStreet() {
60336 context.enter(modeBrowse(context));
60337 context.history().reset("initial");
60338 var msec = transitionTime(springStreet, context.map().center());
60340 reveal(null, null, { duration: 0 });
60342 context.map().centerZoomEase(springStreet, 19, msec);
60343 timeout2(function() {
60345 ".search-header input",
60346 helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
60348 context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
60351 function checkSearchResult() {
60352 var first = context.container().select(".feature-list-item:nth-child(0n+2)");
60353 var firstName = first.select(".entity-name");
60354 var name = _t("intro.graph.name.spring-street");
60355 if (!firstName.empty() && firstName.html() === name) {
60358 helpHtml("intro.navigation.choose_street", { name }),
60361 context.on("exit.intro", function() {
60362 continueTo(selectedStreet);
60364 context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60366 function continueTo(nextStep) {
60367 context.on("exit.intro", null);
60368 context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
60372 function selectedStreet() {
60373 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60374 return searchStreet();
60376 var onClick = function() {
60377 continueTo(editorStreet);
60379 var entity = context.entity(springStreetEndId);
60380 var box = pointBox(entity.loc, context);
60384 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60385 { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60387 timeout2(function() {
60388 context.map().on("move.intro drawn.intro", function() {
60389 var entity2 = context.hasEntity(springStreetEndId);
60392 var box2 = pointBox(entity2.loc, context);
60396 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
60397 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
60401 context.on("enter.intro", function(mode) {
60402 if (!context.hasEntity(springStreetId)) {
60403 return continueTo(searchStreet);
60405 var ids = context.selectedIDs();
60406 if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
60407 context.enter(modeSelect(context, [springStreetId]));
60410 context.history().on("change.intro", function() {
60411 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
60412 timeout2(function() {
60413 continueTo(searchStreet);
60417 function continueTo(nextStep) {
60418 context.map().on("move.intro drawn.intro", null);
60419 context.on("enter.intro", null);
60420 context.history().on("change.intro", null);
60424 function editorStreet() {
60425 var selector = ".entity-editor-pane button.close svg use";
60426 var href = select_default2(selector).attr("href") || "#iD-icon-close";
60427 reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60428 button: { html: icon(href, "inline") },
60429 field1: onewayField.title(),
60430 field2: maxspeedField.title()
60432 context.on("exit.intro", function() {
60435 context.history().on("change.intro", function() {
60436 var selector2 = ".entity-editor-pane button.close svg use";
60437 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
60439 ".entity-editor-pane",
60440 helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
60441 button: { html: icon(href2, "inline") },
60442 field1: onewayField.title(),
60443 field2: maxspeedField.title()
60448 function continueTo(nextStep) {
60449 context.on("exit.intro", null);
60450 context.history().on("change.intro", null);
60455 dispatch14.call("done");
60458 helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
60460 tooltipBox: ".intro-nav-wrap .chapter-point",
60461 buttonText: _t.html("intro.ok"),
60462 buttonCallback: function() {
60463 reveal(".ideditor");
60468 chapter.enter = function() {
60471 chapter.exit = function() {
60472 timeouts.forEach(window.clearTimeout);
60473 context.on("enter.intro exit.intro", null);
60474 context.map().on("move.intro drawn.intro", null);
60475 context.history().on("change.intro", null);
60476 context.container().select(".inspector-wrap").on("wheel.intro", null);
60477 context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
60479 chapter.restart = function() {
60483 return utilRebind(chapter, dispatch14, "on");
60486 // modules/ui/intro/point.js
60487 function uiIntroPoint(context, reveal) {
60488 var dispatch14 = dispatch_default("done");
60490 var intersection2 = [-85.63279, 41.94394];
60491 var building = [-85.632422, 41.944045];
60492 var cafePreset = _mainPresetIndex.item("amenity/cafe");
60493 var _pointID = null;
60495 title: "intro.points.title"
60497 function timeout2(f2, t2) {
60498 timeouts.push(window.setTimeout(f2, t2));
60500 function eventCancel(d3_event) {
60501 d3_event.stopPropagation();
60502 d3_event.preventDefault();
60504 function addPoint() {
60505 context.enter(modeBrowse(context));
60506 context.history().reset("initial");
60507 var msec = transitionTime(intersection2, context.map().center());
60509 reveal(null, null, { duration: 0 });
60511 context.map().centerZoomEase(intersection2, 19, msec);
60512 timeout2(function() {
60513 var tooltip = reveal(
60514 "button.add-point",
60515 helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
60518 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
60519 context.on("enter.intro", function(mode) {
60520 if (mode.id !== "add-point")
60522 continueTo(placePoint);
60525 function continueTo(nextStep) {
60526 context.on("enter.intro", null);
60530 function placePoint() {
60531 if (context.mode().id !== "add-point") {
60532 return chapter.restart();
60534 var pointBox2 = pad(building, 150, context);
60535 var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
60536 reveal(pointBox2, helpHtml("intro.points." + textId));
60537 context.map().on("move.intro drawn.intro", function() {
60538 pointBox2 = pad(building, 150, context);
60539 reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
60541 context.on("enter.intro", function(mode) {
60542 if (mode.id !== "select")
60543 return chapter.restart();
60544 _pointID = context.mode().selectedIDs()[0];
60545 if (context.graph().geometry(_pointID) === "vertex") {
60546 context.map().on("move.intro drawn.intro", null);
60547 context.on("enter.intro", null);
60548 reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
60549 buttonText: _t.html("intro.ok"),
60550 buttonCallback: function() {
60551 return chapter.restart();
60555 continueTo(searchPreset);
60558 function continueTo(nextStep) {
60559 context.map().on("move.intro drawn.intro", null);
60560 context.on("enter.intro", null);
60564 function searchPreset() {
60565 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60568 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60569 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60571 ".preset-search-input",
60572 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
60574 context.on("enter.intro", function(mode) {
60575 if (!_pointID || !context.hasEntity(_pointID)) {
60576 return continueTo(addPoint);
60578 var ids = context.selectedIDs();
60579 if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
60580 context.enter(modeSelect(context, [_pointID]));
60581 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60582 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60584 ".preset-search-input",
60585 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
60587 context.history().on("change.intro", null);
60590 function checkPresetSearch() {
60591 var first = context.container().select(".preset-list-item:first-child");
60592 if (first.classed("preset-amenity-cafe")) {
60593 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60595 first.select(".preset-list-button").node(),
60596 helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
60599 context.history().on("change.intro", function() {
60600 continueTo(aboutFeatureEditor);
60604 function continueTo(nextStep) {
60605 context.on("enter.intro", null);
60606 context.history().on("change.intro", null);
60607 context.container().select(".inspector-wrap").on("wheel.intro", null);
60608 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60612 function aboutFeatureEditor() {
60613 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60616 timeout2(function() {
60617 reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
60618 tooltipClass: "intro-points-describe",
60619 buttonText: _t.html("intro.ok"),
60620 buttonCallback: function() {
60621 continueTo(addName);
60625 context.on("exit.intro", function() {
60626 continueTo(reselectPoint);
60628 function continueTo(nextStep) {
60629 context.on("exit.intro", null);
60633 function addName() {
60634 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60637 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60638 var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
60639 timeout2(function() {
60640 var entity = context.entity(_pointID);
60641 if (entity.tags.name) {
60642 var tooltip = reveal(".entity-editor-pane", addNameString, {
60643 tooltipClass: "intro-points-describe",
60644 buttonText: _t.html("intro.ok"),
60645 buttonCallback: function() {
60646 continueTo(addCloseEditor);
60649 tooltip.select(".instruction").style("display", "none");
60652 ".entity-editor-pane",
60654 { tooltipClass: "intro-points-describe" }
60658 context.history().on("change.intro", function() {
60659 continueTo(addCloseEditor);
60661 context.on("exit.intro", function() {
60662 continueTo(reselectPoint);
60664 function continueTo(nextStep) {
60665 context.on("exit.intro", null);
60666 context.history().on("change.intro", null);
60670 function addCloseEditor() {
60671 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60672 var selector = ".entity-editor-pane button.close svg use";
60673 var href = select_default2(selector).attr("href") || "#iD-icon-close";
60674 context.on("exit.intro", function() {
60675 continueTo(reselectPoint);
60678 ".entity-editor-pane",
60679 helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
60681 function continueTo(nextStep) {
60682 context.on("exit.intro", null);
60686 function reselectPoint() {
60688 return chapter.restart();
60689 var entity = context.hasEntity(_pointID);
60691 return chapter.restart();
60692 var oldPreset = _mainPresetIndex.match(entity, context.graph());
60693 context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
60694 context.enter(modeBrowse(context));
60695 var msec = transitionTime(entity.loc, context.map().center());
60697 reveal(null, null, { duration: 0 });
60699 context.map().centerEase(entity.loc, msec);
60700 timeout2(function() {
60701 var box = pointBox(entity.loc, context);
60702 reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
60703 timeout2(function() {
60704 context.map().on("move.intro drawn.intro", function() {
60705 var entity2 = context.hasEntity(_pointID);
60707 return chapter.restart();
60708 var box2 = pointBox(entity2.loc, context);
60709 reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
60712 context.on("enter.intro", function(mode) {
60713 if (mode.id !== "select")
60715 continueTo(updatePoint);
60718 function continueTo(nextStep) {
60719 context.map().on("move.intro drawn.intro", null);
60720 context.on("enter.intro", null);
60724 function updatePoint() {
60725 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60726 return continueTo(reselectPoint);
60728 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60729 context.on("exit.intro", function() {
60730 continueTo(reselectPoint);
60732 context.history().on("change.intro", function() {
60733 continueTo(updateCloseEditor);
60735 timeout2(function() {
60737 ".entity-editor-pane",
60738 helpHtml("intro.points.update"),
60739 { tooltipClass: "intro-points-describe" }
60742 function continueTo(nextStep) {
60743 context.on("exit.intro", null);
60744 context.history().on("change.intro", null);
60748 function updateCloseEditor() {
60749 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
60750 return continueTo(reselectPoint);
60752 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
60753 context.on("exit.intro", function() {
60754 continueTo(rightClickPoint);
60756 timeout2(function() {
60758 ".entity-editor-pane",
60759 helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
60762 function continueTo(nextStep) {
60763 context.on("exit.intro", null);
60767 function rightClickPoint() {
60769 return chapter.restart();
60770 var entity = context.hasEntity(_pointID);
60772 return chapter.restart();
60773 context.enter(modeBrowse(context));
60774 var box = pointBox(entity.loc, context);
60775 var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
60776 reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
60777 timeout2(function() {
60778 context.map().on("move.intro", function() {
60779 var entity2 = context.hasEntity(_pointID);
60781 return chapter.restart();
60782 var box2 = pointBox(entity2.loc, context);
60783 reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
60786 context.on("enter.intro", function(mode) {
60787 if (mode.id !== "select")
60789 var ids = context.selectedIDs();
60790 if (ids.length !== 1 || ids[0] !== _pointID)
60792 timeout2(function() {
60793 var node = selectMenuItem(context, "delete").node();
60796 continueTo(enterDelete);
60799 function continueTo(nextStep) {
60800 context.on("enter.intro", null);
60801 context.map().on("move.intro", null);
60805 function enterDelete() {
60807 return chapter.restart();
60808 var entity = context.hasEntity(_pointID);
60810 return chapter.restart();
60811 var node = selectMenuItem(context, "delete").node();
60813 return continueTo(rightClickPoint);
60817 helpHtml("intro.points.delete"),
60820 timeout2(function() {
60821 context.map().on("move.intro", function() {
60824 helpHtml("intro.points.delete"),
60825 { duration: 0, padding: 50 }
60829 context.on("exit.intro", function() {
60831 return chapter.restart();
60832 var entity2 = context.hasEntity(_pointID);
60834 return continueTo(rightClickPoint);
60836 context.history().on("change.intro", function(changed) {
60837 if (changed.deleted().length) {
60841 function continueTo(nextStep) {
60842 context.map().on("move.intro", null);
60843 context.history().on("change.intro", null);
60844 context.on("exit.intro", null);
60849 context.history().on("change.intro", function() {
60853 ".top-toolbar button.undo-button",
60854 helpHtml("intro.points.undo")
60856 function continueTo(nextStep) {
60857 context.history().on("change.intro", null);
60862 dispatch14.call("done");
60865 helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
60867 tooltipBox: ".intro-nav-wrap .chapter-area",
60868 buttonText: _t.html("intro.ok"),
60869 buttonCallback: function() {
60870 reveal(".ideditor");
60875 chapter.enter = function() {
60878 chapter.exit = function() {
60879 timeouts.forEach(window.clearTimeout);
60880 context.on("enter.intro exit.intro", null);
60881 context.map().on("move.intro drawn.intro", null);
60882 context.history().on("change.intro", null);
60883 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60884 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60886 chapter.restart = function() {
60890 return utilRebind(chapter, dispatch14, "on");
60893 // modules/ui/intro/area.js
60894 function uiIntroArea(context, reveal) {
60895 var dispatch14 = dispatch_default("done");
60896 var playground = [-85.63552, 41.94159];
60897 var playgroundPreset = _mainPresetIndex.item("leisure/playground");
60898 var nameField = _mainPresetIndex.field("name");
60899 var descriptionField = _mainPresetIndex.field("description");
60903 title: "intro.areas.title"
60905 function timeout2(f2, t2) {
60906 timeouts.push(window.setTimeout(f2, t2));
60908 function eventCancel(d3_event) {
60909 d3_event.stopPropagation();
60910 d3_event.preventDefault();
60912 function revealPlayground(center, text, options2) {
60913 var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
60914 var box = pad(center, padding, context);
60915 reveal(box, text, options2);
60917 function addArea() {
60918 context.enter(modeBrowse(context));
60919 context.history().reset("initial");
60921 var msec = transitionTime(playground, context.map().center());
60923 reveal(null, null, { duration: 0 });
60925 context.map().centerZoomEase(playground, 19, msec);
60926 timeout2(function() {
60927 var tooltip = reveal(
60929 helpHtml("intro.areas.add_playground")
60931 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
60932 context.on("enter.intro", function(mode) {
60933 if (mode.id !== "add-area")
60935 continueTo(startPlayground);
60938 function continueTo(nextStep) {
60939 context.on("enter.intro", null);
60943 function startPlayground() {
60944 if (context.mode().id !== "add-area") {
60945 return chapter.restart();
60948 context.map().zoomEase(19.5, 500);
60949 timeout2(function() {
60950 var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
60951 var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
60957 timeout2(function() {
60958 context.map().on("move.intro drawn.intro", function() {
60965 context.on("enter.intro", function(mode) {
60966 if (mode.id !== "draw-area")
60967 return chapter.restart();
60968 continueTo(continuePlayground);
60972 function continueTo(nextStep) {
60973 context.map().on("move.intro drawn.intro", null);
60974 context.on("enter.intro", null);
60978 function continuePlayground() {
60979 if (context.mode().id !== "draw-area") {
60980 return chapter.restart();
60985 helpHtml("intro.areas.continue_playground"),
60988 timeout2(function() {
60989 context.map().on("move.intro drawn.intro", function() {
60992 helpHtml("intro.areas.continue_playground"),
60997 context.on("enter.intro", function(mode) {
60998 if (mode.id === "draw-area") {
60999 var entity = context.hasEntity(context.selectedIDs()[0]);
61000 if (entity && entity.nodes.length >= 6) {
61001 return continueTo(finishPlayground);
61005 } else if (mode.id === "select") {
61006 _areaID = context.selectedIDs()[0];
61007 return continueTo(searchPresets);
61009 return chapter.restart();
61012 function continueTo(nextStep) {
61013 context.map().on("move.intro drawn.intro", null);
61014 context.on("enter.intro", null);
61018 function finishPlayground() {
61019 if (context.mode().id !== "draw-area") {
61020 return chapter.restart();
61023 var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
61029 timeout2(function() {
61030 context.map().on("move.intro drawn.intro", function() {
61038 context.on("enter.intro", function(mode) {
61039 if (mode.id === "draw-area") {
61041 } else if (mode.id === "select") {
61042 _areaID = context.selectedIDs()[0];
61043 return continueTo(searchPresets);
61045 return chapter.restart();
61048 function continueTo(nextStep) {
61049 context.map().on("move.intro drawn.intro", null);
61050 context.on("enter.intro", null);
61054 function searchPresets() {
61055 if (!_areaID || !context.hasEntity(_areaID)) {
61058 var ids = context.selectedIDs();
61059 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61060 context.enter(modeSelect(context, [_areaID]));
61062 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61063 timeout2(function() {
61064 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61065 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61067 ".preset-search-input",
61068 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61071 context.on("enter.intro", function(mode) {
61072 if (!_areaID || !context.hasEntity(_areaID)) {
61073 return continueTo(addArea);
61075 var ids2 = context.selectedIDs();
61076 if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
61077 context.enter(modeSelect(context, [_areaID]));
61078 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61079 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61080 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
61082 ".preset-search-input",
61083 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
61085 context.history().on("change.intro", null);
61088 function checkPresetSearch() {
61089 var first = context.container().select(".preset-list-item:first-child");
61090 if (first.classed("preset-leisure-playground")) {
61092 first.select(".preset-list-button").node(),
61093 helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
61096 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
61097 context.history().on("change.intro", function() {
61098 continueTo(clickAddField);
61102 function continueTo(nextStep) {
61103 context.container().select(".inspector-wrap").on("wheel.intro", null);
61104 context.on("enter.intro", null);
61105 context.history().on("change.intro", null);
61106 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61110 function clickAddField() {
61111 if (!_areaID || !context.hasEntity(_areaID)) {
61114 var ids = context.selectedIDs();
61115 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61116 return searchPresets();
61118 if (!context.container().select(".form-field-description").empty()) {
61119 return continueTo(describePlayground);
61121 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61122 timeout2(function() {
61123 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61124 var entity = context.entity(_areaID);
61125 if (entity.tags.description) {
61126 return continueTo(play);
61128 var box = context.container().select(".more-fields").node().getBoundingClientRect();
61129 if (box.top > 300) {
61130 var pane = context.container().select(".entity-editor-pane .inspector-body");
61131 var start2 = pane.node().scrollTop;
61132 var end = start2 + (box.top - 300);
61133 pane.transition().duration(250).tween("scroll.inspector", function() {
61135 var i3 = number_default(start2, end);
61136 return function(t2) {
61137 node.scrollTop = i3(t2);
61141 timeout2(function() {
61143 ".more-fields .combobox-input",
61144 helpHtml("intro.areas.add_field", {
61145 name: nameField.title(),
61146 description: descriptionField.title()
61150 context.container().select(".more-fields .combobox-input").on("click.intro", function() {
61152 watcher = window.setInterval(function() {
61153 if (!context.container().select("div.combobox").empty()) {
61154 window.clearInterval(watcher);
61155 continueTo(chooseDescriptionField);
61161 context.on("exit.intro", function() {
61162 return continueTo(searchPresets);
61164 function continueTo(nextStep) {
61165 context.container().select(".inspector-wrap").on("wheel.intro", null);
61166 context.container().select(".more-fields .combobox-input").on("click.intro", null);
61167 context.on("exit.intro", null);
61171 function chooseDescriptionField() {
61172 if (!_areaID || !context.hasEntity(_areaID)) {
61175 var ids = context.selectedIDs();
61176 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61177 return searchPresets();
61179 if (!context.container().select(".form-field-description").empty()) {
61180 return continueTo(describePlayground);
61182 if (context.container().select("div.combobox").empty()) {
61183 return continueTo(clickAddField);
61186 watcher = window.setInterval(function() {
61187 if (context.container().select("div.combobox").empty()) {
61188 window.clearInterval(watcher);
61189 timeout2(function() {
61190 if (context.container().select(".form-field-description").empty()) {
61191 continueTo(retryChooseDescription);
61193 continueTo(describePlayground);
61200 helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
61203 context.on("exit.intro", function() {
61204 return continueTo(searchPresets);
61206 function continueTo(nextStep) {
61208 window.clearInterval(watcher);
61209 context.on("exit.intro", null);
61213 function describePlayground() {
61214 if (!_areaID || !context.hasEntity(_areaID)) {
61217 var ids = context.selectedIDs();
61218 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61219 return searchPresets();
61221 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61222 if (context.container().select(".form-field-description").empty()) {
61223 return continueTo(retryChooseDescription);
61225 context.on("exit.intro", function() {
61229 ".entity-editor-pane",
61230 helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
61233 function continueTo(nextStep) {
61234 context.on("exit.intro", null);
61238 function retryChooseDescription() {
61239 if (!_areaID || !context.hasEntity(_areaID)) {
61242 var ids = context.selectedIDs();
61243 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
61244 return searchPresets();
61246 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
61248 ".entity-editor-pane",
61249 helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
61251 buttonText: _t.html("intro.ok"),
61252 buttonCallback: function() {
61253 continueTo(clickAddField);
61257 context.on("exit.intro", function() {
61258 return continueTo(searchPresets);
61260 function continueTo(nextStep) {
61261 context.on("exit.intro", null);
61266 dispatch14.call("done");
61269 helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
61271 tooltipBox: ".intro-nav-wrap .chapter-line",
61272 buttonText: _t.html("intro.ok"),
61273 buttonCallback: function() {
61274 reveal(".ideditor");
61279 chapter.enter = function() {
61282 chapter.exit = function() {
61283 timeouts.forEach(window.clearTimeout);
61284 context.on("enter.intro exit.intro", null);
61285 context.map().on("move.intro drawn.intro", null);
61286 context.history().on("change.intro", null);
61287 context.container().select(".inspector-wrap").on("wheel.intro", null);
61288 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
61289 context.container().select(".more-fields .combobox-input").on("click.intro", null);
61291 chapter.restart = function() {
61295 return utilRebind(chapter, dispatch14, "on");
61298 // modules/ui/intro/line.js
61299 function uiIntroLine(context, reveal) {
61300 var dispatch14 = dispatch_default("done");
61302 var _tulipRoadID = null;
61303 var flowerRoadID = "w646";
61304 var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
61305 var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
61306 var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
61307 var roadCategory = _mainPresetIndex.item("category-road_minor");
61308 var residentialPreset = _mainPresetIndex.item("highway/residential");
61309 var woodRoadID = "w525";
61310 var woodRoadEndID = "n2862";
61311 var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
61312 var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
61313 var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
61314 var washingtonStreetID = "w522";
61315 var twelfthAvenueID = "w1";
61316 var eleventhAvenueEndID = "n3550";
61317 var twelfthAvenueEndID = "n5";
61318 var _washingtonSegmentID = null;
61319 var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
61320 var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
61321 var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
61322 var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
61324 title: "intro.lines.title"
61326 function timeout2(f2, t2) {
61327 timeouts.push(window.setTimeout(f2, t2));
61329 function eventCancel(d3_event) {
61330 d3_event.stopPropagation();
61331 d3_event.preventDefault();
61333 function addLine() {
61334 context.enter(modeBrowse(context));
61335 context.history().reset("initial");
61336 var msec = transitionTime(tulipRoadStart, context.map().center());
61338 reveal(null, null, { duration: 0 });
61340 context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
61341 timeout2(function() {
61342 var tooltip = reveal(
61344 helpHtml("intro.lines.add_line")
61346 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
61347 context.on("enter.intro", function(mode) {
61348 if (mode.id !== "add-line")
61350 continueTo(startLine);
61353 function continueTo(nextStep) {
61354 context.on("enter.intro", null);
61358 function startLine() {
61359 if (context.mode().id !== "add-line")
61360 return chapter.restart();
61361 _tulipRoadID = null;
61362 var padding = 70 * Math.pow(2, context.map().zoom() - 18);
61363 var box = pad(tulipRoadStart, padding, context);
61364 box.height = box.height + 100;
61365 var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
61366 var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
61367 reveal(box, startLineString);
61368 context.map().on("move.intro drawn.intro", function() {
61369 padding = 70 * Math.pow(2, context.map().zoom() - 18);
61370 box = pad(tulipRoadStart, padding, context);
61371 box.height = box.height + 100;
61372 reveal(box, startLineString, { duration: 0 });
61374 context.on("enter.intro", function(mode) {
61375 if (mode.id !== "draw-line")
61376 return chapter.restart();
61377 continueTo(drawLine);
61379 function continueTo(nextStep) {
61380 context.map().on("move.intro drawn.intro", null);
61381 context.on("enter.intro", null);
61385 function drawLine() {
61386 if (context.mode().id !== "draw-line")
61387 return chapter.restart();
61388 _tulipRoadID = context.mode().selectedIDs()[0];
61389 context.map().centerEase(tulipRoadMidpoint, 500);
61390 timeout2(function() {
61391 var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61392 var box = pad(tulipRoadMidpoint, padding, context);
61393 box.height = box.height * 2;
61396 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
61398 context.map().on("move.intro drawn.intro", function() {
61399 padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
61400 box = pad(tulipRoadMidpoint, padding, context);
61401 box.height = box.height * 2;
61404 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
61409 context.history().on("change.intro", function() {
61410 if (isLineConnected()) {
61411 continueTo(continueLine);
61414 context.on("enter.intro", function(mode) {
61415 if (mode.id === "draw-line") {
61417 } else if (mode.id === "select") {
61418 continueTo(retryIntersect);
61421 return chapter.restart();
61424 function continueTo(nextStep) {
61425 context.map().on("move.intro drawn.intro", null);
61426 context.history().on("change.intro", null);
61427 context.on("enter.intro", null);
61431 function isLineConnected() {
61432 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
61435 var drawNodes = context.graph().childNodes(entity);
61436 return drawNodes.some(function(node) {
61437 return context.graph().parentWays(node).some(function(parent) {
61438 return parent.id === flowerRoadID;
61442 function retryIntersect() {
61443 select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
61444 var box = pad(tulipRoadIntersection, 80, context);
61447 helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
61449 timeout2(chapter.restart, 3e3);
61451 function continueLine() {
61452 if (context.mode().id !== "draw-line")
61453 return chapter.restart();
61454 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
61456 return chapter.restart();
61457 context.map().centerEase(tulipRoadIntersection, 500);
61458 var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
61459 reveal(".surface", continueLineText);
61460 context.on("enter.intro", function(mode) {
61461 if (mode.id === "draw-line") {
61463 } else if (mode.id === "select") {
61464 return continueTo(chooseCategoryRoad);
61466 return chapter.restart();
61469 function continueTo(nextStep) {
61470 context.on("enter.intro", null);
61474 function chooseCategoryRoad() {
61475 if (context.mode().id !== "select")
61476 return chapter.restart();
61477 context.on("exit.intro", function() {
61478 return chapter.restart();
61480 var button = context.container().select(".preset-category-road_minor .preset-list-button");
61481 if (button.empty())
61482 return chapter.restart();
61483 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61484 timeout2(function() {
61485 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
61488 helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
61490 button.on("click.intro", function() {
61491 continueTo(choosePresetResidential);
61494 function continueTo(nextStep) {
61495 context.container().select(".inspector-wrap").on("wheel.intro", null);
61496 context.container().select(".preset-list-button").on("click.intro", null);
61497 context.on("exit.intro", null);
61501 function choosePresetResidential() {
61502 if (context.mode().id !== "select")
61503 return chapter.restart();
61504 context.on("exit.intro", function() {
61505 return chapter.restart();
61507 var subgrid = context.container().select(".preset-category-road_minor .subgrid");
61508 if (subgrid.empty())
61509 return chapter.restart();
61510 subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
61511 continueTo(retryPresetResidential);
61513 subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
61514 continueTo(nameRoad);
61516 timeout2(function() {
61519 helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
61520 { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
61523 function continueTo(nextStep) {
61524 context.container().select(".preset-list-button").on("click.intro", null);
61525 context.on("exit.intro", null);
61529 function retryPresetResidential() {
61530 if (context.mode().id !== "select")
61531 return chapter.restart();
61532 context.on("exit.intro", function() {
61533 return chapter.restart();
61535 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
61536 timeout2(function() {
61537 var button = context.container().select(".entity-editor-pane .preset-list-button");
61540 helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
61542 button.on("click.intro", function() {
61543 continueTo(chooseCategoryRoad);
61546 function continueTo(nextStep) {
61547 context.container().select(".inspector-wrap").on("wheel.intro", null);
61548 context.container().select(".preset-list-button").on("click.intro", null);
61549 context.on("exit.intro", null);
61553 function nameRoad() {
61554 context.on("exit.intro", function() {
61555 continueTo(didNameRoad);
61557 timeout2(function() {
61559 ".entity-editor-pane",
61560 helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
61561 { tooltipClass: "intro-lines-name_road" }
61564 function continueTo(nextStep) {
61565 context.on("exit.intro", null);
61569 function didNameRoad() {
61570 context.history().checkpoint("doneAddLine");
61571 timeout2(function() {
61572 reveal(".surface", helpHtml("intro.lines.did_name_road"), {
61573 buttonText: _t.html("intro.ok"),
61574 buttonCallback: function() {
61575 continueTo(updateLine);
61579 function continueTo(nextStep) {
61583 function updateLine() {
61584 context.history().reset("doneAddLine");
61585 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61586 return chapter.restart();
61588 var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
61590 reveal(null, null, { duration: 0 });
61592 context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
61593 timeout2(function() {
61594 var padding = 250 * Math.pow(2, context.map().zoom() - 19);
61595 var box = pad(woodRoadDragMidpoint, padding, context);
61596 var advance = function() {
61597 continueTo(addNode);
61601 helpHtml("intro.lines.update_line"),
61602 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
61604 context.map().on("move.intro drawn.intro", function() {
61605 var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
61606 var box2 = pad(woodRoadDragMidpoint, padding2, context);
61609 helpHtml("intro.lines.update_line"),
61610 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
61614 function continueTo(nextStep) {
61615 context.map().on("move.intro drawn.intro", null);
61619 function addNode() {
61620 context.history().reset("doneAddLine");
61621 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61622 return chapter.restart();
61624 var padding = 40 * Math.pow(2, context.map().zoom() - 19);
61625 var box = pad(woodRoadAddNode, padding, context);
61626 var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
61627 reveal(box, addNodeString);
61628 context.map().on("move.intro drawn.intro", function() {
61629 var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
61630 var box2 = pad(woodRoadAddNode, padding2, context);
61631 reveal(box2, addNodeString, { duration: 0 });
61633 context.history().on("change.intro", function(changed) {
61634 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61635 return continueTo(updateLine);
61637 if (changed.created().length === 1) {
61638 timeout2(function() {
61639 continueTo(startDragEndpoint);
61643 context.on("enter.intro", function(mode) {
61644 if (mode.id !== "select") {
61645 continueTo(updateLine);
61648 function continueTo(nextStep) {
61649 context.map().on("move.intro drawn.intro", null);
61650 context.history().on("change.intro", null);
61651 context.on("enter.intro", null);
61655 function startDragEndpoint() {
61656 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61657 return continueTo(updateLine);
61659 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
61660 var box = pad(woodRoadDragEndpoint, padding, context);
61661 var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
61662 reveal(box, startDragString);
61663 context.map().on("move.intro drawn.intro", function() {
61664 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61665 return continueTo(updateLine);
61667 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
61668 var box2 = pad(woodRoadDragEndpoint, padding2, context);
61669 reveal(box2, startDragString, { duration: 0 });
61670 var entity = context.entity(woodRoadEndID);
61671 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
61672 continueTo(finishDragEndpoint);
61675 function continueTo(nextStep) {
61676 context.map().on("move.intro drawn.intro", null);
61680 function finishDragEndpoint() {
61681 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61682 return continueTo(updateLine);
61684 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
61685 var box = pad(woodRoadDragEndpoint, padding, context);
61686 var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
61687 reveal(box, finishDragString);
61688 context.map().on("move.intro drawn.intro", function() {
61689 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61690 return continueTo(updateLine);
61692 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
61693 var box2 = pad(woodRoadDragEndpoint, padding2, context);
61694 reveal(box2, finishDragString, { duration: 0 });
61695 var entity = context.entity(woodRoadEndID);
61696 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
61697 continueTo(startDragEndpoint);
61700 context.on("enter.intro", function() {
61701 continueTo(startDragMidpoint);
61703 function continueTo(nextStep) {
61704 context.map().on("move.intro drawn.intro", null);
61705 context.on("enter.intro", null);
61709 function startDragMidpoint() {
61710 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61711 return continueTo(updateLine);
61713 if (context.selectedIDs().indexOf(woodRoadID) === -1) {
61714 context.enter(modeSelect(context, [woodRoadID]));
61716 var padding = 80 * Math.pow(2, context.map().zoom() - 19);
61717 var box = pad(woodRoadDragMidpoint, padding, context);
61718 reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
61719 context.map().on("move.intro drawn.intro", function() {
61720 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61721 return continueTo(updateLine);
61723 var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
61724 var box2 = pad(woodRoadDragMidpoint, padding2, context);
61725 reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
61727 context.history().on("change.intro", function(changed) {
61728 if (changed.created().length === 1) {
61729 continueTo(continueDragMidpoint);
61732 context.on("enter.intro", function(mode) {
61733 if (mode.id !== "select") {
61734 context.enter(modeSelect(context, [woodRoadID]));
61737 function continueTo(nextStep) {
61738 context.map().on("move.intro drawn.intro", null);
61739 context.history().on("change.intro", null);
61740 context.on("enter.intro", null);
61744 function continueDragMidpoint() {
61745 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61746 return continueTo(updateLine);
61748 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
61749 var box = pad(woodRoadDragEndpoint, padding, context);
61751 var advance = function() {
61752 context.history().checkpoint("doneUpdateLine");
61753 continueTo(deleteLines);
61757 helpHtml("intro.lines.continue_drag_midpoint"),
61758 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
61760 context.map().on("move.intro drawn.intro", function() {
61761 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
61762 return continueTo(updateLine);
61764 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
61765 var box2 = pad(woodRoadDragEndpoint, padding2, context);
61766 box2.height += 400;
61769 helpHtml("intro.lines.continue_drag_midpoint"),
61770 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
61773 function continueTo(nextStep) {
61774 context.map().on("move.intro drawn.intro", null);
61778 function deleteLines() {
61779 context.history().reset("doneUpdateLine");
61780 context.enter(modeBrowse(context));
61781 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
61782 return chapter.restart();
61784 var msec = transitionTime(deleteLinesLoc, context.map().center());
61786 reveal(null, null, { duration: 0 });
61788 context.map().centerZoomEase(deleteLinesLoc, 18, msec);
61789 timeout2(function() {
61790 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
61791 var box = pad(deleteLinesLoc, padding, context);
61794 var advance = function() {
61795 continueTo(rightClickIntersection);
61799 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
61800 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
61802 context.map().on("move.intro drawn.intro", function() {
61803 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
61804 var box2 = pad(deleteLinesLoc, padding2, context);
61806 box2.height += 400;
61809 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
61810 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
61813 context.history().on("change.intro", function() {
61814 timeout2(function() {
61815 continueTo(deleteLines);
61819 function continueTo(nextStep) {
61820 context.map().on("move.intro drawn.intro", null);
61821 context.history().on("change.intro", null);
61825 function rightClickIntersection() {
61826 context.history().reset("doneUpdateLine");
61827 context.enter(modeBrowse(context));
61828 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
61829 var rightClickString = helpHtml("intro.lines.split_street", {
61830 street1: _t("intro.graph.name.11th-avenue"),
61831 street2: _t("intro.graph.name.washington-street")
61832 }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
61833 timeout2(function() {
61834 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
61835 var box = pad(eleventhAvenueEnd, padding, context);
61836 reveal(box, rightClickString);
61837 context.map().on("move.intro drawn.intro", function() {
61838 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
61839 var box2 = pad(eleventhAvenueEnd, padding2, context);
61846 context.on("enter.intro", function(mode) {
61847 if (mode.id !== "select")
61849 var ids = context.selectedIDs();
61850 if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID)
61852 timeout2(function() {
61853 var node = selectMenuItem(context, "split").node();
61856 continueTo(splitIntersection);
61859 context.history().on("change.intro", function() {
61860 timeout2(function() {
61861 continueTo(deleteLines);
61865 function continueTo(nextStep) {
61866 context.map().on("move.intro drawn.intro", null);
61867 context.on("enter.intro", null);
61868 context.history().on("change.intro", null);
61872 function splitIntersection() {
61873 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
61874 return continueTo(deleteLines);
61876 var node = selectMenuItem(context, "split").node();
61878 return continueTo(rightClickIntersection);
61880 var wasChanged = false;
61881 _washingtonSegmentID = null;
61885 "intro.lines.split_intersection",
61886 { street: _t("intro.graph.name.washington-street") }
61890 context.map().on("move.intro drawn.intro", function() {
61891 var node2 = selectMenuItem(context, "split").node();
61892 if (!wasChanged && !node2) {
61893 return continueTo(rightClickIntersection);
61898 "intro.lines.split_intersection",
61899 { street: _t("intro.graph.name.washington-street") }
61901 { duration: 0, padding: 50 }
61904 context.history().on("change.intro", function(changed) {
61906 timeout2(function() {
61907 if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
61908 _washingtonSegmentID = changed.created()[0].id;
61909 continueTo(didSplit);
61911 _washingtonSegmentID = null;
61912 continueTo(retrySplit);
61916 function continueTo(nextStep) {
61917 context.map().on("move.intro drawn.intro", null);
61918 context.history().on("change.intro", null);
61922 function retrySplit() {
61923 context.enter(modeBrowse(context));
61924 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
61925 var advance = function() {
61926 continueTo(rightClickIntersection);
61928 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
61929 var box = pad(eleventhAvenueEnd, padding, context);
61932 helpHtml("intro.lines.retry_split"),
61933 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
61935 context.map().on("move.intro drawn.intro", function() {
61936 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
61937 var box2 = pad(eleventhAvenueEnd, padding2, context);
61940 helpHtml("intro.lines.retry_split"),
61941 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
61944 function continueTo(nextStep) {
61945 context.map().on("move.intro drawn.intro", null);
61949 function didSplit() {
61950 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
61951 return continueTo(rightClickIntersection);
61953 var ids = context.selectedIDs();
61954 var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
61955 var street = _t("intro.graph.name.washington-street");
61956 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
61957 var box = pad(twelfthAvenue, padding, context);
61958 box.width = box.width / 2;
61961 helpHtml(string, { street1: street, street2: street }),
61964 timeout2(function() {
61965 context.map().centerZoomEase(twelfthAvenue, 18, 500);
61966 context.map().on("move.intro drawn.intro", function() {
61967 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
61968 var box2 = pad(twelfthAvenue, padding2, context);
61969 box2.width = box2.width / 2;
61972 helpHtml(string, { street1: street, street2: street }),
61977 context.on("enter.intro", function() {
61978 var ids2 = context.selectedIDs();
61979 if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
61980 continueTo(multiSelect);
61983 context.history().on("change.intro", function() {
61984 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
61985 return continueTo(rightClickIntersection);
61988 function continueTo(nextStep) {
61989 context.map().on("move.intro drawn.intro", null);
61990 context.on("enter.intro", null);
61991 context.history().on("change.intro", null);
61995 function multiSelect() {
61996 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
61997 return continueTo(rightClickIntersection);
61999 var ids = context.selectedIDs();
62000 var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
62001 var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
62002 if (hasWashington && hasTwelfth) {
62003 return continueTo(multiRightClick);
62004 } else if (!hasWashington && !hasTwelfth) {
62005 return continueTo(didSplit);
62007 context.map().centerZoomEase(twelfthAvenue, 18, 500);
62008 timeout2(function() {
62009 var selected, other, padding, box;
62010 if (hasWashington) {
62011 selected = _t("intro.graph.name.washington-street");
62012 other = _t("intro.graph.name.12th-avenue");
62013 padding = 60 * Math.pow(2, context.map().zoom() - 18);
62014 box = pad(twelfthAvenueEnd, padding, context);
62017 selected = _t("intro.graph.name.12th-avenue");
62018 other = _t("intro.graph.name.washington-street");
62019 padding = 200 * Math.pow(2, context.map().zoom() - 18);
62020 box = pad(twelfthAvenue, padding, context);
62026 "intro.lines.multi_select",
62027 { selected, other1: other }
62028 ) + " " + helpHtml(
62029 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62030 { selected, other2: other }
62033 context.map().on("move.intro drawn.intro", function() {
62034 if (hasWashington) {
62035 selected = _t("intro.graph.name.washington-street");
62036 other = _t("intro.graph.name.12th-avenue");
62037 padding = 60 * Math.pow(2, context.map().zoom() - 18);
62038 box = pad(twelfthAvenueEnd, padding, context);
62041 selected = _t("intro.graph.name.12th-avenue");
62042 other = _t("intro.graph.name.washington-street");
62043 padding = 200 * Math.pow(2, context.map().zoom() - 18);
62044 box = pad(twelfthAvenue, padding, context);
62050 "intro.lines.multi_select",
62051 { selected, other1: other }
62052 ) + " " + helpHtml(
62053 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
62054 { selected, other2: other }
62059 context.on("enter.intro", function() {
62060 continueTo(multiSelect);
62062 context.history().on("change.intro", function() {
62063 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62064 return continueTo(rightClickIntersection);
62068 function continueTo(nextStep) {
62069 context.map().on("move.intro drawn.intro", null);
62070 context.on("enter.intro", null);
62071 context.history().on("change.intro", null);
62075 function multiRightClick() {
62076 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62077 return continueTo(rightClickIntersection);
62079 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62080 var box = pad(twelfthAvenue, padding, context);
62081 var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
62082 reveal(box, rightClickString);
62083 context.map().on("move.intro drawn.intro", function() {
62084 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
62085 var box2 = pad(twelfthAvenue, padding2, context);
62086 reveal(box2, rightClickString, { duration: 0 });
62088 context.ui().editMenu().on("toggled.intro", function(open) {
62091 timeout2(function() {
62092 var ids = context.selectedIDs();
62093 if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62094 var node = selectMenuItem(context, "delete").node();
62097 continueTo(multiDelete);
62098 } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
62099 return continueTo(multiSelect);
62101 return continueTo(didSplit);
62105 context.history().on("change.intro", function() {
62106 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62107 return continueTo(rightClickIntersection);
62110 function continueTo(nextStep) {
62111 context.map().on("move.intro drawn.intro", null);
62112 context.ui().editMenu().on("toggled.intro", null);
62113 context.history().on("change.intro", null);
62117 function multiDelete() {
62118 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
62119 return continueTo(rightClickIntersection);
62121 var node = selectMenuItem(context, "delete").node();
62123 return continueTo(multiRightClick);
62126 helpHtml("intro.lines.multi_delete"),
62129 context.map().on("move.intro drawn.intro", function() {
62132 helpHtml("intro.lines.multi_delete"),
62133 { duration: 0, padding: 50 }
62136 context.on("exit.intro", function() {
62137 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62138 return continueTo(multiSelect);
62141 context.history().on("change.intro", function() {
62142 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
62143 continueTo(retryDelete);
62148 function continueTo(nextStep) {
62149 context.map().on("move.intro drawn.intro", null);
62150 context.on("exit.intro", null);
62151 context.history().on("change.intro", null);
62155 function retryDelete() {
62156 context.enter(modeBrowse(context));
62157 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
62158 var box = pad(twelfthAvenue, padding, context);
62159 reveal(box, helpHtml("intro.lines.retry_delete"), {
62160 buttonText: _t.html("intro.ok"),
62161 buttonCallback: function() {
62162 continueTo(multiSelect);
62165 function continueTo(nextStep) {
62170 dispatch14.call("done");
62173 helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
62175 tooltipBox: ".intro-nav-wrap .chapter-building",
62176 buttonText: _t.html("intro.ok"),
62177 buttonCallback: function() {
62178 reveal(".ideditor");
62183 chapter.enter = function() {
62186 chapter.exit = function() {
62187 timeouts.forEach(window.clearTimeout);
62188 select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
62189 context.on("enter.intro exit.intro", null);
62190 context.map().on("move.intro drawn.intro", null);
62191 context.history().on("change.intro", null);
62192 context.container().select(".inspector-wrap").on("wheel.intro", null);
62193 context.container().select(".preset-list-button").on("click.intro", null);
62195 chapter.restart = function() {
62199 return utilRebind(chapter, dispatch14, "on");
62202 // modules/ui/intro/building.js
62203 function uiIntroBuilding(context, reveal) {
62204 var dispatch14 = dispatch_default("done");
62205 var house = [-85.62815, 41.95638];
62206 var tank = [-85.62732, 41.95347];
62207 var buildingCatetory = _mainPresetIndex.item("category-building");
62208 var housePreset = _mainPresetIndex.item("building/house");
62209 var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
62211 var _houseID = null;
62212 var _tankID = null;
62214 title: "intro.buildings.title"
62216 function timeout2(f2, t2) {
62217 timeouts.push(window.setTimeout(f2, t2));
62219 function eventCancel(d3_event) {
62220 d3_event.stopPropagation();
62221 d3_event.preventDefault();
62223 function revealHouse(center, text, options2) {
62224 var padding = 160 * Math.pow(2, context.map().zoom() - 20);
62225 var box = pad(center, padding, context);
62226 reveal(box, text, options2);
62228 function revealTank(center, text, options2) {
62229 var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
62230 var box = pad(center, padding, context);
62231 reveal(box, text, options2);
62233 function addHouse() {
62234 context.enter(modeBrowse(context));
62235 context.history().reset("initial");
62237 var msec = transitionTime(house, context.map().center());
62239 reveal(null, null, { duration: 0 });
62241 context.map().centerZoomEase(house, 19, msec);
62242 timeout2(function() {
62243 var tooltip = reveal(
62245 helpHtml("intro.buildings.add_building")
62247 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
62248 context.on("enter.intro", function(mode) {
62249 if (mode.id !== "add-area")
62251 continueTo(startHouse);
62254 function continueTo(nextStep) {
62255 context.on("enter.intro", null);
62259 function startHouse() {
62260 if (context.mode().id !== "add-area") {
62261 return continueTo(addHouse);
62264 context.map().zoomEase(20, 500);
62265 timeout2(function() {
62266 var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
62267 revealHouse(house, startString);
62268 context.map().on("move.intro drawn.intro", function() {
62269 revealHouse(house, startString, { duration: 0 });
62271 context.on("enter.intro", function(mode) {
62272 if (mode.id !== "draw-area")
62273 return chapter.restart();
62274 continueTo(continueHouse);
62277 function continueTo(nextStep) {
62278 context.map().on("move.intro drawn.intro", null);
62279 context.on("enter.intro", null);
62283 function continueHouse() {
62284 if (context.mode().id !== "draw-area") {
62285 return continueTo(addHouse);
62288 var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
62289 revealHouse(house, continueString);
62290 context.map().on("move.intro drawn.intro", function() {
62291 revealHouse(house, continueString, { duration: 0 });
62293 context.on("enter.intro", function(mode) {
62294 if (mode.id === "draw-area") {
62296 } else if (mode.id === "select") {
62297 var graph = context.graph();
62298 var way = context.entity(context.selectedIDs()[0]);
62299 var nodes = graph.childNodes(way);
62300 var points = utilArrayUniq(nodes).map(function(n3) {
62301 return context.projection(n3.loc);
62303 if (isMostlySquare(points)) {
62305 return continueTo(chooseCategoryBuilding);
62307 return continueTo(retryHouse);
62310 return chapter.restart();
62313 function continueTo(nextStep) {
62314 context.map().on("move.intro drawn.intro", null);
62315 context.on("enter.intro", null);
62319 function retryHouse() {
62320 var onClick = function() {
62321 continueTo(addHouse);
62325 helpHtml("intro.buildings.retry_building"),
62326 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62328 context.map().on("move.intro drawn.intro", function() {
62331 helpHtml("intro.buildings.retry_building"),
62332 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
62335 function continueTo(nextStep) {
62336 context.map().on("move.intro drawn.intro", null);
62340 function chooseCategoryBuilding() {
62341 if (!_houseID || !context.hasEntity(_houseID)) {
62344 var ids = context.selectedIDs();
62345 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62346 context.enter(modeSelect(context, [_houseID]));
62348 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62349 timeout2(function() {
62350 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62351 var button = context.container().select(".preset-category-building .preset-list-button");
62354 helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
62356 button.on("click.intro", function() {
62357 button.on("click.intro", null);
62358 continueTo(choosePresetHouse);
62361 context.on("enter.intro", function(mode) {
62362 if (!_houseID || !context.hasEntity(_houseID)) {
62363 return continueTo(addHouse);
62365 var ids2 = context.selectedIDs();
62366 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62367 return continueTo(chooseCategoryBuilding);
62370 function continueTo(nextStep) {
62371 context.container().select(".inspector-wrap").on("wheel.intro", null);
62372 context.container().select(".preset-list-button").on("click.intro", null);
62373 context.on("enter.intro", null);
62377 function choosePresetHouse() {
62378 if (!_houseID || !context.hasEntity(_houseID)) {
62381 var ids = context.selectedIDs();
62382 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62383 context.enter(modeSelect(context, [_houseID]));
62385 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62386 timeout2(function() {
62387 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62388 var button = context.container().select(".preset-building-house .preset-list-button");
62391 helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
62394 button.on("click.intro", function() {
62395 button.on("click.intro", null);
62396 continueTo(closeEditorHouse);
62399 context.on("enter.intro", function(mode) {
62400 if (!_houseID || !context.hasEntity(_houseID)) {
62401 return continueTo(addHouse);
62403 var ids2 = context.selectedIDs();
62404 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
62405 return continueTo(chooseCategoryBuilding);
62408 function continueTo(nextStep) {
62409 context.container().select(".inspector-wrap").on("wheel.intro", null);
62410 context.container().select(".preset-list-button").on("click.intro", null);
62411 context.on("enter.intro", null);
62415 function closeEditorHouse() {
62416 if (!_houseID || !context.hasEntity(_houseID)) {
62419 var ids = context.selectedIDs();
62420 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
62421 context.enter(modeSelect(context, [_houseID]));
62423 context.history().checkpoint("hasHouse");
62424 context.on("exit.intro", function() {
62425 continueTo(rightClickHouse);
62427 timeout2(function() {
62429 ".entity-editor-pane",
62430 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
62433 function continueTo(nextStep) {
62434 context.on("exit.intro", null);
62438 function rightClickHouse() {
62440 return chapter.restart();
62441 context.enter(modeBrowse(context));
62442 context.history().reset("hasHouse");
62443 var zoom = context.map().zoom();
62447 context.map().centerZoomEase(house, zoom, 500);
62448 context.on("enter.intro", function(mode) {
62449 if (mode.id !== "select")
62451 var ids = context.selectedIDs();
62452 if (ids.length !== 1 || ids[0] !== _houseID)
62454 timeout2(function() {
62455 var node = selectMenuItem(context, "orthogonalize").node();
62458 continueTo(clickSquare);
62461 context.map().on("move.intro drawn.intro", function() {
62462 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
62463 revealHouse(house, rightclickString, { duration: 0 });
62465 context.history().on("change.intro", function() {
62466 continueTo(rightClickHouse);
62468 function continueTo(nextStep) {
62469 context.on("enter.intro", null);
62470 context.map().on("move.intro drawn.intro", null);
62471 context.history().on("change.intro", null);
62475 function clickSquare() {
62477 return chapter.restart();
62478 var entity = context.hasEntity(_houseID);
62480 return continueTo(rightClickHouse);
62481 var node = selectMenuItem(context, "orthogonalize").node();
62483 return continueTo(rightClickHouse);
62485 var wasChanged = false;
62488 helpHtml("intro.buildings.square_building"),
62491 context.on("enter.intro", function(mode) {
62492 if (mode.id === "browse") {
62493 continueTo(rightClickHouse);
62494 } else if (mode.id === "move" || mode.id === "rotate") {
62495 continueTo(retryClickSquare);
62498 context.map().on("move.intro", function() {
62499 var node2 = selectMenuItem(context, "orthogonalize").node();
62500 if (!wasChanged && !node2) {
62501 return continueTo(rightClickHouse);
62505 helpHtml("intro.buildings.square_building"),
62506 { duration: 0, padding: 50 }
62509 context.history().on("change.intro", function() {
62511 context.history().on("change.intro", null);
62512 timeout2(function() {
62513 if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
62514 continueTo(doneSquare);
62516 continueTo(retryClickSquare);
62520 function continueTo(nextStep) {
62521 context.on("enter.intro", null);
62522 context.map().on("move.intro", null);
62523 context.history().on("change.intro", null);
62527 function retryClickSquare() {
62528 context.enter(modeBrowse(context));
62529 revealHouse(house, helpHtml("intro.buildings.retry_square"), {
62530 buttonText: _t.html("intro.ok"),
62531 buttonCallback: function() {
62532 continueTo(rightClickHouse);
62535 function continueTo(nextStep) {
62539 function doneSquare() {
62540 context.history().checkpoint("doneSquare");
62541 revealHouse(house, helpHtml("intro.buildings.done_square"), {
62542 buttonText: _t.html("intro.ok"),
62543 buttonCallback: function() {
62544 continueTo(addTank);
62547 function continueTo(nextStep) {
62551 function addTank() {
62552 context.enter(modeBrowse(context));
62553 context.history().reset("doneSquare");
62555 var msec = transitionTime(tank, context.map().center());
62557 reveal(null, null, { duration: 0 });
62559 context.map().centerZoomEase(tank, 19.5, msec);
62560 timeout2(function() {
62563 helpHtml("intro.buildings.add_tank")
62565 context.on("enter.intro", function(mode) {
62566 if (mode.id !== "add-area")
62568 continueTo(startTank);
62571 function continueTo(nextStep) {
62572 context.on("enter.intro", null);
62576 function startTank() {
62577 if (context.mode().id !== "add-area") {
62578 return continueTo(addTank);
62581 timeout2(function() {
62582 var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
62583 revealTank(tank, startString);
62584 context.map().on("move.intro drawn.intro", function() {
62585 revealTank(tank, startString, { duration: 0 });
62587 context.on("enter.intro", function(mode) {
62588 if (mode.id !== "draw-area")
62589 return chapter.restart();
62590 continueTo(continueTank);
62593 function continueTo(nextStep) {
62594 context.map().on("move.intro drawn.intro", null);
62595 context.on("enter.intro", null);
62599 function continueTank() {
62600 if (context.mode().id !== "draw-area") {
62601 return continueTo(addTank);
62604 var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
62605 revealTank(tank, continueString);
62606 context.map().on("move.intro drawn.intro", function() {
62607 revealTank(tank, continueString, { duration: 0 });
62609 context.on("enter.intro", function(mode) {
62610 if (mode.id === "draw-area") {
62612 } else if (mode.id === "select") {
62613 _tankID = context.selectedIDs()[0];
62614 return continueTo(searchPresetTank);
62616 return continueTo(addTank);
62619 function continueTo(nextStep) {
62620 context.map().on("move.intro drawn.intro", null);
62621 context.on("enter.intro", null);
62625 function searchPresetTank() {
62626 if (!_tankID || !context.hasEntity(_tankID)) {
62629 var ids = context.selectedIDs();
62630 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
62631 context.enter(modeSelect(context, [_tankID]));
62633 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62634 timeout2(function() {
62635 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62636 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
62638 ".preset-search-input",
62639 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
62642 context.on("enter.intro", function(mode) {
62643 if (!_tankID || !context.hasEntity(_tankID)) {
62644 return continueTo(addTank);
62646 var ids2 = context.selectedIDs();
62647 if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
62648 context.enter(modeSelect(context, [_tankID]));
62649 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
62650 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
62651 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
62653 ".preset-search-input",
62654 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
62656 context.history().on("change.intro", null);
62659 function checkPresetSearch() {
62660 var first = context.container().select(".preset-list-item:first-child");
62661 if (first.classed("preset-man_made-storage_tank")) {
62663 first.select(".preset-list-button").node(),
62664 helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
62667 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
62668 context.history().on("change.intro", function() {
62669 continueTo(closeEditorTank);
62673 function continueTo(nextStep) {
62674 context.container().select(".inspector-wrap").on("wheel.intro", null);
62675 context.on("enter.intro", null);
62676 context.history().on("change.intro", null);
62677 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
62681 function closeEditorTank() {
62682 if (!_tankID || !context.hasEntity(_tankID)) {
62685 var ids = context.selectedIDs();
62686 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
62687 context.enter(modeSelect(context, [_tankID]));
62689 context.history().checkpoint("hasTank");
62690 context.on("exit.intro", function() {
62691 continueTo(rightClickTank);
62693 timeout2(function() {
62695 ".entity-editor-pane",
62696 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
62699 function continueTo(nextStep) {
62700 context.on("exit.intro", null);
62704 function rightClickTank() {
62706 return continueTo(addTank);
62707 context.enter(modeBrowse(context));
62708 context.history().reset("hasTank");
62709 context.map().centerEase(tank, 500);
62710 timeout2(function() {
62711 context.on("enter.intro", function(mode) {
62712 if (mode.id !== "select")
62714 var ids = context.selectedIDs();
62715 if (ids.length !== 1 || ids[0] !== _tankID)
62717 timeout2(function() {
62718 var node = selectMenuItem(context, "circularize").node();
62721 continueTo(clickCircle);
62724 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
62725 revealTank(tank, rightclickString);
62726 context.map().on("move.intro drawn.intro", function() {
62727 revealTank(tank, rightclickString, { duration: 0 });
62729 context.history().on("change.intro", function() {
62730 continueTo(rightClickTank);
62733 function continueTo(nextStep) {
62734 context.on("enter.intro", null);
62735 context.map().on("move.intro drawn.intro", null);
62736 context.history().on("change.intro", null);
62740 function clickCircle() {
62742 return chapter.restart();
62743 var entity = context.hasEntity(_tankID);
62745 return continueTo(rightClickTank);
62746 var node = selectMenuItem(context, "circularize").node();
62748 return continueTo(rightClickTank);
62750 var wasChanged = false;
62753 helpHtml("intro.buildings.circle_tank"),
62756 context.on("enter.intro", function(mode) {
62757 if (mode.id === "browse") {
62758 continueTo(rightClickTank);
62759 } else if (mode.id === "move" || mode.id === "rotate") {
62760 continueTo(retryClickCircle);
62763 context.map().on("move.intro", function() {
62764 var node2 = selectMenuItem(context, "circularize").node();
62765 if (!wasChanged && !node2) {
62766 return continueTo(rightClickTank);
62770 helpHtml("intro.buildings.circle_tank"),
62771 { duration: 0, padding: 50 }
62774 context.history().on("change.intro", function() {
62776 context.history().on("change.intro", null);
62777 timeout2(function() {
62778 if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
62781 continueTo(retryClickCircle);
62785 function continueTo(nextStep) {
62786 context.on("enter.intro", null);
62787 context.map().on("move.intro", null);
62788 context.history().on("change.intro", null);
62792 function retryClickCircle() {
62793 context.enter(modeBrowse(context));
62794 revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
62795 buttonText: _t.html("intro.ok"),
62796 buttonCallback: function() {
62797 continueTo(rightClickTank);
62800 function continueTo(nextStep) {
62805 dispatch14.call("done");
62808 helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
62810 tooltipBox: ".intro-nav-wrap .chapter-startEditing",
62811 buttonText: _t.html("intro.ok"),
62812 buttonCallback: function() {
62813 reveal(".ideditor");
62818 chapter.enter = function() {
62821 chapter.exit = function() {
62822 timeouts.forEach(window.clearTimeout);
62823 context.on("enter.intro exit.intro", null);
62824 context.map().on("move.intro drawn.intro", null);
62825 context.history().on("change.intro", null);
62826 context.container().select(".inspector-wrap").on("wheel.intro", null);
62827 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
62828 context.container().select(".more-fields .combobox-input").on("click.intro", null);
62830 chapter.restart = function() {
62834 return utilRebind(chapter, dispatch14, "on");
62837 // modules/ui/intro/start_editing.js
62838 function uiIntroStartEditing(context, reveal) {
62839 var dispatch14 = dispatch_default("done", "startEditing");
62840 var modalSelection = select_default2(null);
62842 title: "intro.startediting.title"
62844 function showHelp() {
62846 ".map-control.help-control",
62847 helpHtml("intro.startediting.help"),
62849 buttonText: _t.html("intro.ok"),
62850 buttonCallback: function() {
62856 function shortcuts() {
62858 ".map-control.help-control",
62859 helpHtml("intro.startediting.shortcuts"),
62861 buttonText: _t.html("intro.ok"),
62862 buttonCallback: function() {
62868 function showSave() {
62869 context.container().selectAll(".shaded").remove();
62871 ".top-toolbar button.save",
62872 helpHtml("intro.startediting.save"),
62874 buttonText: _t.html("intro.ok"),
62875 buttonCallback: function() {
62881 function showStart() {
62882 context.container().selectAll(".shaded").remove();
62883 modalSelection = uiModal(context.container());
62884 modalSelection.select(".modal").attr("class", "modal-splash modal");
62885 modalSelection.selectAll(".close").remove();
62886 var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
62887 modalSelection.remove();
62889 startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
62890 startbutton.append("h2").call(_t.append("intro.startediting.start"));
62891 dispatch14.call("startEditing");
62893 chapter.enter = function() {
62896 chapter.exit = function() {
62897 modalSelection.remove();
62898 context.container().selectAll(".shaded").remove();
62900 return utilRebind(chapter, dispatch14, "on");
62903 // modules/ui/intro/intro.js
62905 welcome: uiIntroWelcome,
62906 navigation: uiIntroNavigation,
62907 point: uiIntroPoint,
62910 building: uiIntroBuilding,
62911 startEditing: uiIntroStartEditing
62913 var chapterFlow = [
62922 function uiIntro(context) {
62923 const INTRO_IMAGERY = "EsriWorldImageryClarity";
62924 let _introGraph = {};
62926 function intro(selection2) {
62927 _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
62928 for (let id2 in dataIntroGraph) {
62929 if (!_introGraph[id2]) {
62930 _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
62933 selection2.call(startIntro);
62934 }).catch(function() {
62937 function startIntro(selection2) {
62938 context.enter(modeBrowse(context));
62939 let osm = context.connection();
62940 let history = context.history().toJSON();
62941 let hash = window.location.hash;
62942 let center = context.map().center();
62943 let zoom = context.map().zoom();
62944 let background = context.background().baseLayerSource();
62945 let overlays = context.background().overlayLayerSources();
62946 let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
62947 let caches = osm && osm.caches();
62948 let baseEntities = context.history().graph().base().entities;
62949 context.ui().sidebar.expand();
62950 context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
62951 context.inIntro(true);
62953 osm.toggle(false).reset();
62955 context.history().reset();
62956 context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
62957 context.history().checkpoint("initial");
62958 let imagery = context.background().findSource(INTRO_IMAGERY);
62960 context.background().baseLayerSource(imagery);
62962 context.background().bing();
62964 overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
62965 let layers = context.layers();
62966 layers.all().forEach((item) => {
62967 if (typeof item.layer.enabled === "function") {
62968 item.layer.enabled(item.id === "osm");
62971 context.container().selectAll(".main-map .layer-background").style("opacity", 1);
62972 let curtain = uiCurtain(context.container().node());
62973 selection2.call(curtain);
62974 corePreferences("walkthrough_started", "yes");
62975 let storedProgress = corePreferences("walkthrough_progress") || "";
62976 let progress = storedProgress.split(";").filter(Boolean);
62977 let chapters = chapterFlow.map((chapter, i3) => {
62978 let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
62979 buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
62980 if (i3 < chapterFlow.length - 1) {
62981 const next = chapterFlow[i3 + 1];
62982 context.container().select("button.chapter-".concat(next)).classed("next", true);
62984 progress.push(chapter);
62985 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
62989 chapters[chapters.length - 1].on("startEditing", () => {
62990 progress.push("startEditing");
62991 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
62992 let incomplete = utilArrayDifference(chapterFlow, progress);
62993 if (!incomplete.length) {
62994 corePreferences("walkthrough_completed", "yes");
62998 context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
62999 context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
63001 osm.toggle(true).reset().caches(caches);
63003 context.history().reset().merge(Object.values(baseEntities));
63004 context.background().baseLayerSource(background);
63005 overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
63007 context.history().fromJSON(history, false);
63009 context.map().centerZoom(center, zoom);
63010 window.location.replace(hash);
63011 context.inIntro(false);
63013 let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
63014 navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
63015 let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
63016 let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => "chapter chapter-".concat(chapterFlow[i3])).on("click", enterChapter);
63017 buttons.append("span").html((d2) => _t.html(d2.title));
63018 buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
63019 enterChapter(null, chapters[0]);
63020 function enterChapter(d3_event, newChapter) {
63021 if (_currChapter) {
63022 _currChapter.exit();
63024 context.enter(modeBrowse(context));
63025 _currChapter = newChapter;
63026 _currChapter.enter();
63027 buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
63033 // modules/ui/issues_info.js
63034 function uiIssuesInfo(context) {
63035 var warningsItem = {
63038 iconID: "iD-icon-alert",
63039 descriptionID: "issues.warnings_and_errors"
63041 var resolvedItem = {
63044 iconID: "iD-icon-apply",
63045 descriptionID: "issues.user_resolved_issues"
63047 function update(selection2) {
63048 var shownItems = [];
63049 var liveIssues = context.validator().getIssues({
63050 what: corePreferences("validate-what") || "edited",
63051 where: corePreferences("validate-where") || "all"
63053 if (liveIssues.length) {
63054 warningsItem.count = liveIssues.length;
63055 shownItems.push(warningsItem);
63057 if (corePreferences("validate-what") === "all") {
63058 var resolvedIssues = context.validator().getResolvedIssues();
63059 if (resolvedIssues.length) {
63060 resolvedItem.count = resolvedIssues.length;
63061 shownItems.push(resolvedItem);
63064 var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
63067 chips.exit().remove();
63068 var enter = chips.enter().append("a").attr("class", function(d2) {
63069 return "chip " + d2.id + "-count";
63070 }).attr("href", "#").each(function(d2) {
63071 var chipSelection = select_default2(this);
63072 var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
63073 chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
63074 d3_event.preventDefault();
63075 tooltipBehavior.hide(select_default2(this));
63076 context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
63078 chipSelection.call(svgIcon("#" + d2.iconID));
63080 enter.append("span").attr("class", "count");
63081 enter.merge(chips).selectAll("span.count").text(function(d2) {
63082 return d2.count.toString();
63085 return function(selection2) {
63086 update(selection2);
63087 context.validator().on("validated.infobox", function() {
63088 update(selection2);
63093 // modules/ui/map_in_map.js
63094 function uiMapInMap(context) {
63095 function mapInMap(selection2) {
63096 var backgroundLayer = rendererTileLayer(context);
63097 var overlayLayers = {};
63098 var projection2 = geoRawMercator();
63099 var dataLayer = svgData(projection2, context).showLabels(false);
63100 var debugLayer = svgDebug(projection2, context);
63101 var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
63102 var wrap2 = select_default2(null);
63103 var tiles = select_default2(null);
63104 var viewport = select_default2(null);
63105 var _isTransformed = false;
63106 var _isHidden = true;
63107 var _skipEvents = false;
63108 var _gesture = null;
63115 function zoomStarted() {
63118 _tStart = _tCurr = projection2.transform();
63121 function zoomed(d3_event) {
63124 var x2 = d3_event.transform.x;
63125 var y2 = d3_event.transform.y;
63126 var k2 = d3_event.transform.k;
63127 var isZooming = k2 !== _tStart.k;
63128 var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
63129 if (!isZooming && !isPanning) {
63133 _gesture = isZooming ? "zoom" : "pan";
63135 var tMini = projection2.transform();
63137 if (_gesture === "zoom") {
63138 scale = k2 / tMini.k;
63139 tX = (_cMini[0] / scale - _cMini[0]) * scale;
63140 tY = (_cMini[1] / scale - _cMini[1]) * scale;
63147 utilSetTransform(tiles, tX, tY, scale);
63148 utilSetTransform(viewport, 0, 0, scale);
63149 _isTransformed = true;
63150 _tCurr = identity2.translate(x2, y2).scale(k2);
63151 var zMain = geoScaleToZoom(context.projection.scale());
63152 var zMini = geoScaleToZoom(k2);
63153 _zDiff = zMain - zMini;
63156 function zoomEnded() {
63159 if (_gesture !== "pan")
63161 updateProjection();
63163 context.map().center(projection2.invert(_cMini));
63165 function updateProjection() {
63166 var loc = context.map().center();
63167 var tMain = context.projection.transform();
63168 var zMain = geoScaleToZoom(tMain.k);
63169 var zMini = Math.max(zMain - _zDiff, 0.5);
63170 var kMini = geoZoomToScale(zMini);
63171 projection2.translate([tMain.x, tMain.y]).scale(kMini);
63172 var point2 = projection2(loc);
63173 var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
63174 var xMini = _cMini[0] - point2[0] + tMain.x + mouse[0];
63175 var yMini = _cMini[1] - point2[1] + tMain.y + mouse[1];
63176 projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
63177 _tCurr = projection2.transform();
63178 if (_isTransformed) {
63179 utilSetTransform(tiles, 0, 0);
63180 utilSetTransform(viewport, 0, 0);
63181 _isTransformed = false;
63183 zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
63184 _skipEvents = true;
63185 wrap2.call(zoom.transform, _tCurr);
63186 _skipEvents = false;
63188 function redraw() {
63189 clearTimeout(_timeoutID);
63192 updateProjection();
63193 var zMini = geoScaleToZoom(projection2.scale());
63194 tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
63195 tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
63196 backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
63197 var background = tiles.selectAll(".map-in-map-background").data([0]);
63198 background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
63199 var overlaySources = context.background().overlayLayerSources();
63200 var activeOverlayLayers = [];
63201 for (var i3 = 0; i3 < overlaySources.length; i3++) {
63202 if (overlaySources[i3].validZoom(zMini)) {
63203 if (!overlayLayers[i3])
63204 overlayLayers[i3] = rendererTileLayer(context);
63205 activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
63208 var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
63209 overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
63210 var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
63211 return d2.source().name();
63213 overlays.exit().remove();
63214 overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
63215 select_default2(this).call(layer);
63217 var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
63218 dataLayers.exit().remove();
63219 dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
63220 if (_gesture !== "pan") {
63221 var getPath = path_default(projection2);
63222 var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
63223 viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
63224 viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
63225 var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
63226 path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
63227 return getPath.area(d2) < 30;
63231 function queueRedraw() {
63232 clearTimeout(_timeoutID);
63233 _timeoutID = setTimeout(function() {
63237 function toggle(d3_event) {
63239 d3_event.preventDefault();
63240 _isHidden = !_isHidden;
63241 context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
63243 wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
63244 selection2.selectAll(".map-in-map").style("display", "none");
63247 wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
63252 uiMapInMap.toggle = toggle;
63253 wrap2 = selection2.selectAll(".map-in-map").data([0]);
63254 wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
63255 _dMini = [200, 150];
63256 _cMini = geoVecScale(_dMini, 0.5);
63257 context.map().on("drawn.map-in-map", function(drawn) {
63258 if (drawn.full === true) {
63263 context.keybinding().on(_t("background.minimap.key"), toggle);
63268 // modules/ui/notice.js
63269 function uiNotice(context) {
63270 return function(selection2) {
63271 var div = selection2.append("div").attr("class", "notice");
63272 var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
63273 context.map().zoomEase(context.minEditableZoom());
63274 }).on("wheel", function(d3_event) {
63275 var e22 = new WheelEvent(d3_event.type, d3_event);
63276 context.surface().node().dispatchEvent(e22);
63278 button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
63279 function disableTooHigh() {
63280 var canEdit = context.map().zoom() >= context.minEditableZoom();
63281 div.style("display", canEdit ? "none" : "block");
63283 context.map().on("move.notice", debounce_default(disableTooHigh, 500));
63288 // modules/ui/photoviewer.js
63289 function uiPhotoviewer(context) {
63290 var dispatch14 = dispatch_default("resize");
63291 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
63292 function photoviewer(selection2) {
63293 selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
63294 if (services.streetside) {
63295 services.streetside.hideViewer(context);
63297 if (services.mapillary) {
63298 services.mapillary.hideViewer(context);
63300 if (services.kartaview) {
63301 services.kartaview.hideViewer(context);
63303 if (services.mapilio) {
63304 services.mapilio.hideViewer(context);
63306 if (services.vegbilder) {
63307 services.vegbilder.hideViewer(context);
63309 }).append("div").call(svgIcon("#iD-icon-close"));
63310 function preventDefault(d3_event) {
63311 d3_event.preventDefault();
63313 selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
63314 _pointerPrefix + "down",
63315 buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
63317 selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
63318 _pointerPrefix + "down",
63319 buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
63321 selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
63322 _pointerPrefix + "down",
63323 buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
63325 function buildResizeListener(target, eventName, dispatch15, options2) {
63326 var resizeOnX = !!options2.resizeOnX;
63327 var resizeOnY = !!options2.resizeOnY;
63328 var minHeight = options2.minHeight || 240;
63329 var minWidth = options2.minWidth || 320;
63335 function startResize(d3_event) {
63336 if (pointerId !== (d3_event.pointerId || "mouse"))
63338 d3_event.preventDefault();
63339 d3_event.stopPropagation();
63340 var mapSize = context.map().dimensions();
63342 var maxWidth = mapSize[0];
63343 var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
63344 target.style("width", newWidth + "px");
63347 var maxHeight = mapSize[1] - 90;
63348 var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
63349 target.style("height", newHeight + "px");
63351 dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
63353 function clamp3(num, min3, max3) {
63354 return Math.max(min3, Math.min(num, max3));
63356 function stopResize(d3_event) {
63357 if (pointerId !== (d3_event.pointerId || "mouse"))
63359 d3_event.preventDefault();
63360 d3_event.stopPropagation();
63361 select_default2(window).on("." + eventName, null);
63363 return function initResize(d3_event) {
63364 d3_event.preventDefault();
63365 d3_event.stopPropagation();
63366 pointerId = d3_event.pointerId || "mouse";
63367 startX = d3_event.clientX;
63368 startY = d3_event.clientY;
63369 var targetRect = target.node().getBoundingClientRect();
63370 startWidth = targetRect.width;
63371 startHeight = targetRect.height;
63372 select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
63373 if (_pointerPrefix === "pointer") {
63374 select_default2(window).on("pointercancel." + eventName, stopResize, false);
63379 photoviewer.onMapResize = function() {
63380 var photoviewer2 = context.container().select(".photoviewer");
63381 var content = context.container().select(".main-content");
63382 var mapDimensions = utilGetDimensions(content, true);
63383 var photoDimensions = utilGetDimensions(photoviewer2, true);
63384 if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
63385 var setPhotoDimensions = [
63386 Math.min(photoDimensions[0], mapDimensions[0]),
63387 Math.min(photoDimensions[1], mapDimensions[1] - 90)
63389 photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
63390 dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
63393 function subtractPadding(dimensions, selection2) {
63395 dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
63396 dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
63399 return utilRebind(photoviewer, dispatch14, "on");
63402 // modules/ui/restore.js
63403 function uiRestore(context) {
63404 return function(selection2) {
63405 if (!context.history().hasRestorableChanges())
63407 let modalSelection = uiModal(selection2, true);
63408 modalSelection.select(".modal").attr("class", "modal fillL");
63409 let introModal = modalSelection.select(".content");
63410 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
63411 introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
63412 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
63413 let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
63414 context.history().restore();
63415 modalSelection.remove();
63417 restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
63418 restore.append("div").call(_t.append("restore.restore"));
63419 let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
63420 context.history().clearSaved();
63421 modalSelection.remove();
63423 reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
63424 reset.append("div").call(_t.append("restore.reset"));
63425 restore.node().focus();
63429 // modules/ui/scale.js
63430 function uiScale(context) {
63431 var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
63432 function scaleDefs(loc1, loc2) {
63433 var lat = (loc2[1] + loc1[1]) / 2, conversion = isImperial ? 3.28084 : 1, dist = geoLonToMeters(loc2[0] - loc1[0], lat) * conversion, scale = { dist: 0, px: 0, text: "" }, buckets, i3, val, dLon;
63435 buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
63437 buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
63439 for (i3 = 0; i3 < buckets.length; i3++) {
63442 scale.dist = Math.floor(dist / val) * val;
63445 scale.dist = +dist.toFixed(2);
63448 dLon = geoMetersToLon(scale.dist / conversion, lat);
63449 scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
63450 scale.text = displayLength(scale.dist / conversion, isImperial);
63453 function update(selection2) {
63454 var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
63455 selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
63456 selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
63458 return function(selection2) {
63459 function switchUnits() {
63460 isImperial = !isImperial;
63461 selection2.call(update);
63463 var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
63464 scalegroup.append("path").attr("class", "scale-path");
63465 selection2.append("div").attr("class", "scale-text");
63466 selection2.call(update);
63467 context.map().on("move.scale", function() {
63468 update(selection2);
63473 // modules/ui/shortcuts.js
63474 function uiShortcuts(context) {
63475 var detected = utilDetect();
63476 var _activeTab = 0;
63477 var _modalSelection;
63478 var _selection = select_default2(null);
63479 var _dataShortcuts;
63480 function shortcutsModal(_modalSelection2) {
63481 _modalSelection2.select(".modal").classed("modal-shortcuts", true);
63482 var content = _modalSelection2.select(".content");
63483 content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
63484 _mainFileFetcher.get("shortcuts").then(function(data) {
63485 _dataShortcuts = data;
63486 content.call(render);
63487 }).catch(function() {
63490 function render(selection2) {
63491 if (!_dataShortcuts)
63493 var wrapper = selection2.selectAll(".wrapper").data([0]);
63494 var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
63495 var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
63496 var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
63497 wrapper = wrapper.merge(wrapperEnter);
63498 var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
63499 var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
63500 d3_event.preventDefault();
63501 var i3 = _dataShortcuts.indexOf(d2);
63503 render(selection2);
63505 tabsEnter.append("span").html(function(d2) {
63506 return _t.html(d2.text);
63508 wrapper.selectAll(".tab").classed("active", function(d2, i3) {
63509 return i3 === _activeTab;
63511 var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
63512 var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
63513 return "shortcut-tab shortcut-tab-" + d2.tab;
63515 var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
63517 }).enter().append("table").attr("class", "shortcut-column");
63518 var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
63520 }).enter().append("tr").attr("class", "shortcut-row");
63521 var sectionRows = rowsEnter.filter(function(d2) {
63522 return !d2.shortcuts;
63524 sectionRows.append("td");
63525 sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
63526 return _t.html(d2.text);
63528 var shortcutRows = rowsEnter.filter(function(d2) {
63529 return d2.shortcuts;
63531 var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
63532 var modifierKeys = shortcutKeys.filter(function(d2) {
63533 return d2.modifiers;
63535 modifierKeys.selectAll("kbd.modifier").data(function(d2) {
63536 if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
63538 } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
63541 return d2.modifiers;
63543 }).enter().each(function() {
63544 var selection3 = select_default2(this);
63545 selection3.append("kbd").attr("class", "modifier").text(function(d2) {
63546 return uiCmd.display(d2);
63548 selection3.append("span").text("+");
63550 shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
63551 var arr = d2.shortcuts;
63552 if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
63554 } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
63557 arr = arr.map(function(s2) {
63558 return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
63560 return utilArrayUniq(arr).map(function(s2) {
63563 separator: d2.separator,
63567 }).enter().each(function(d2, i3, nodes) {
63568 var selection3 = select_default2(this);
63569 var click = d2.shortcut.toLowerCase().match(/(.*).click/);
63570 if (click && click[1]) {
63571 selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
63572 } else if (d2.shortcut.toLowerCase() === "long-press") {
63573 selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
63574 } else if (d2.shortcut.toLowerCase() === "tap") {
63575 selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
63577 selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
63578 return d4.shortcut;
63581 if (i3 < nodes.length - 1) {
63582 selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
63583 } else if (i3 === nodes.length - 1 && d2.suffix) {
63584 selection3.append("span").text(d2.suffix);
63587 shortcutKeys.filter(function(d2) {
63589 }).each(function() {
63590 var selection3 = select_default2(this);
63591 selection3.append("span").text("+");
63592 selection3.append("span").attr("class", "gesture").html(function(d2) {
63593 return _t.html(d2.gesture);
63596 shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
63597 return d2.text ? _t.html(d2.text) : "\xA0";
63599 wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
63600 return i3 === _activeTab ? "flex" : "none";
63603 return function(selection2, show) {
63604 _selection = selection2;
63606 _modalSelection = uiModal(selection2);
63607 _modalSelection.call(shortcutsModal);
63609 context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
63610 if (context.container().selectAll(".modal-shortcuts").size()) {
63611 if (_modalSelection) {
63612 _modalSelection.close();
63613 _modalSelection = null;
63616 _modalSelection = uiModal(_selection);
63617 _modalSelection.call(shortcutsModal);
63624 // modules/ui/data_header.js
63625 function uiDataHeader() {
63627 function dataHeader(selection2) {
63628 var header = selection2.selectAll(".data-header").data(
63629 _datum ? [_datum] : [],
63631 return d2.__featurehash__;
63634 header.exit().remove();
63635 var headerEnter = header.enter().append("div").attr("class", "data-header");
63636 var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
63637 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
63638 headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
63640 dataHeader.datum = function(val) {
63641 if (!arguments.length)
63649 // modules/ui/combobox.js
63650 var _comboHideTimerID;
63651 function uiCombobox(context, klass) {
63652 var dispatch14 = dispatch_default("accept", "cancel", "update");
63653 var container = context.container();
63654 var _suggestions = [];
63657 var _selected = null;
63658 var _canAutocomplete = true;
63659 var _caseSensitive = false;
63660 var _cancelFetch = false;
63663 var _mouseEnterHandler, _mouseLeaveHandler;
63664 var _fetcher = function(val, cb) {
63665 cb(_data.filter(function(d2) {
63666 var terms = d2.terms || [];
63667 terms.push(d2.value);
63669 terms.push(d2.key);
63671 return terms.some(function(term) {
63672 return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
63676 var combobox = function(input, attachTo) {
63677 if (!input || input.empty())
63679 input.classed("combobox-input", true).on("focus.combo-input", focus).on("blur.combo-input", blur).on("keydown.combo-input", keydown).on("keyup.combo-input", keyup).on("input.combo-input", change).on("mousedown.combo-input", mousedown).each(function() {
63680 var parent = this.parentNode;
63681 var sibling = this.nextSibling;
63682 select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
63683 return d2 === input.node();
63684 }).data([input.node()]).enter().insert("div", function() {
63686 }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
63687 d3_event.preventDefault();
63688 input.node().focus();
63689 mousedown(d3_event);
63690 }).on("mouseup.combo-caret", function(d3_event) {
63691 d3_event.preventDefault();
63695 function mousedown(d3_event) {
63696 if (d3_event.button !== 0)
63698 if (input.classed("disabled"))
63700 _tDown = +/* @__PURE__ */ new Date();
63701 var start2 = input.property("selectionStart");
63702 var end = input.property("selectionEnd");
63703 if (start2 !== end) {
63704 var val = utilGetSetValue(input);
63705 input.node().setSelectionRange(val.length, val.length);
63708 input.on("mouseup.combo-input", mouseup);
63710 function mouseup(d3_event) {
63711 input.on("mouseup.combo-input", null);
63712 if (d3_event.button !== 0)
63714 if (input.classed("disabled"))
63716 if (input.node() !== document.activeElement)
63718 var start2 = input.property("selectionStart");
63719 var end = input.property("selectionEnd");
63720 if (start2 !== end)
63722 var combo = container.selectAll(".combobox");
63723 if (combo.empty() || combo.datum() !== input.node()) {
63724 var tOrig = _tDown;
63725 window.setTimeout(function() {
63726 if (tOrig !== _tDown)
63728 fetchComboData("", function() {
63738 fetchComboData("");
63741 _comboHideTimerID = window.setTimeout(hide, 75);
63745 container.insert("div", ":first-child").datum(input.node()).attr("class", "combobox" + (klass ? " combobox-" + klass : "")).style("position", "absolute").style("display", "block").style("left", "0px").on("mousedown.combo-container", function(d3_event) {
63746 d3_event.preventDefault();
63748 container.on("scroll.combo-scroll", render, true);
63751 if (_comboHideTimerID) {
63752 window.clearTimeout(_comboHideTimerID);
63753 _comboHideTimerID = void 0;
63755 container.selectAll(".combobox").remove();
63756 container.on("scroll.combo-scroll", null);
63758 function keydown(d3_event) {
63759 var shown = !container.selectAll(".combobox").empty();
63760 var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
63761 switch (d3_event.keyCode) {
63764 d3_event.stopPropagation();
63767 input.on("input.combo-input", function() {
63768 var start2 = input.property("selectionStart");
63769 input.node().setSelectionRange(start2, start2);
63770 input.on("input.combo-input", change);
63778 d3_event.preventDefault();
63779 d3_event.stopPropagation();
63783 if (tagName === "textarea" && !shown)
63785 d3_event.preventDefault();
63786 if (tagName === "input" && !shown) {
63792 if (tagName === "textarea" && !shown)
63794 d3_event.preventDefault();
63795 if (tagName === "input" && !shown) {
63802 function keyup(d3_event) {
63803 switch (d3_event.keyCode) {
63809 function change(doAutoComplete) {
63810 if (doAutoComplete === void 0)
63811 doAutoComplete = true;
63812 fetchComboData(value(), function(skipAutosuggest) {
63814 var val = input.property("value");
63815 if (_suggestions.length) {
63816 if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
63817 _selected = tryAutocomplete();
63824 var combo = container.selectAll(".combobox");
63825 if (combo.empty()) {
63834 function nav(dir) {
63835 if (_suggestions.length) {
63837 for (var i3 = 0; i3 < _suggestions.length; i3++) {
63838 if (_selected && _suggestions[i3].value === _selected) {
63843 index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
63844 _selected = _suggestions[index].value;
63845 utilGetSetValue(input, _selected);
63846 dispatch14.call("update");
63851 function ensureVisible() {
63852 var combo = container.selectAll(".combobox");
63855 var containerRect = container.node().getBoundingClientRect();
63856 var comboRect = combo.node().getBoundingClientRect();
63857 if (comboRect.bottom > containerRect.bottom) {
63858 var node = attachTo ? attachTo.node() : input.node();
63859 node.scrollIntoView({ behavior: "instant", block: "center" });
63862 var selected = combo.selectAll(".combobox-option.selected").node();
63864 selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
63868 var value2 = input.property("value");
63869 var start2 = input.property("selectionStart");
63870 var end = input.property("selectionEnd");
63871 if (start2 && end) {
63872 value2 = value2.substring(0, start2);
63876 function fetchComboData(v2, cb) {
63877 _cancelFetch = false;
63878 _fetcher.call(input, v2, function(results, skipAutosuggest) {
63881 _suggestions = results;
63882 results.forEach(function(d2) {
63883 _fetched[d2.value] = d2;
63886 cb(skipAutosuggest);
63890 function tryAutocomplete() {
63891 if (!_canAutocomplete)
63893 var val = _caseSensitive ? value() : value().toLowerCase();
63898 const suggestionValues = [];
63899 _suggestions.forEach((s2) => {
63900 suggestionValues.push(s2.value);
63901 if (s2.key && s2.key !== s2.value) {
63902 suggestionValues.push(s2.key);
63905 var bestIndex = -1;
63906 for (var i3 = 0; i3 < suggestionValues.length; i3++) {
63907 var suggestion = suggestionValues[i3];
63908 var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
63909 if (compare2 === val) {
63912 } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
63916 if (bestIndex !== -1) {
63917 var bestVal = suggestionValues[bestIndex];
63918 input.property("value", bestVal);
63919 input.node().setSelectionRange(val.length, bestVal.length);
63920 dispatch14.call("update");
63924 function render() {
63925 if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
63929 var shown = !container.selectAll(".combobox").empty();
63932 var combo = container.selectAll(".combobox");
63933 var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
63936 options2.exit().remove();
63937 options2.enter().append("a").attr("class", function(d2) {
63938 return "combobox-option " + (d2.klass || "");
63939 }).attr("title", function(d2) {
63941 }).each(function(d2) {
63943 d2.display(select_default2(this));
63945 select_default2(this).text(d2.value);
63947 }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
63948 return d2.value === _selected || d2.key === _selected;
63949 }).on("click.combo-option", accept).order();
63950 var node = attachTo ? attachTo.node() : input.node();
63951 var containerRect = container.node().getBoundingClientRect();
63952 var rect = node.getBoundingClientRect();
63953 combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
63955 function accept(d3_event, d2) {
63956 _cancelFetch = true;
63957 var thiz = input.node();
63959 utilGetSetValue(input, d2.value);
63960 utilTriggerEvent(input, "change");
63962 var val = utilGetSetValue(input);
63963 thiz.setSelectionRange(val.length, val.length);
63964 d2 = _fetched[val];
63965 dispatch14.call("accept", thiz, d2, val);
63968 function cancel() {
63969 _cancelFetch = true;
63970 var thiz = input.node();
63971 var val = utilGetSetValue(input);
63972 var start2 = input.property("selectionStart");
63973 var end = input.property("selectionEnd");
63974 val = val.slice(0, start2) + val.slice(end);
63975 utilGetSetValue(input, val);
63976 thiz.setSelectionRange(val.length, val.length);
63977 dispatch14.call("cancel", thiz);
63981 combobox.canAutocomplete = function(val) {
63982 if (!arguments.length)
63983 return _canAutocomplete;
63984 _canAutocomplete = val;
63987 combobox.caseSensitive = function(val) {
63988 if (!arguments.length)
63989 return _caseSensitive;
63990 _caseSensitive = val;
63993 combobox.data = function(val) {
63994 if (!arguments.length)
63999 combobox.fetcher = function(val) {
64000 if (!arguments.length)
64005 combobox.minItems = function(val) {
64006 if (!arguments.length)
64011 combobox.itemsMouseEnter = function(val) {
64012 if (!arguments.length)
64013 return _mouseEnterHandler;
64014 _mouseEnterHandler = val;
64017 combobox.itemsMouseLeave = function(val) {
64018 if (!arguments.length)
64019 return _mouseLeaveHandler;
64020 _mouseLeaveHandler = val;
64023 return utilRebind(combobox, dispatch14, "on");
64025 uiCombobox.off = function(input, context) {
64026 input.on("focus.combo-input", null).on("blur.combo-input", null).on("keydown.combo-input", null).on("keyup.combo-input", null).on("input.combo-input", null).on("mousedown.combo-input", null).on("mouseup.combo-input", null);
64027 context.container().on("scroll.combo-scroll", null);
64030 // modules/ui/disclosure.js
64031 function uiDisclosure(context, key, expandedDefault) {
64032 var dispatch14 = dispatch_default("toggled");
64034 var _label = utilFunctor("");
64035 var _updatePreference = true;
64036 var _content = function() {
64038 var disclosure = function(selection2) {
64039 if (_expanded === void 0 || _expanded === null) {
64040 var preference = corePreferences("disclosure." + key + ".expanded");
64041 _expanded = preference === null ? !!expandedDefault : preference === "true";
64043 var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
64044 var hideToggleEnter = hideToggle.enter().append("h3").append("a").attr("role", "button").attr("href", "#").attr("class", "hide-toggle hide-toggle-" + key).call(svgIcon("", "pre-text", "hide-toggle-icon"));
64045 hideToggleEnter.append("span").attr("class", "hide-toggle-text");
64046 hideToggle = hideToggleEnter.merge(hideToggle);
64047 hideToggle.on("click", toggle).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand"))).attr("aria-expanded", _expanded).classed("expanded", _expanded);
64048 const label = _label();
64049 const labelSelection = hideToggle.selectAll(".hide-toggle-text");
64050 if (typeof label !== "function") {
64051 labelSelection.text(_label());
64053 labelSelection.text("").call(label);
64055 hideToggle.selectAll(".hide-toggle-icon").attr(
64057 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64059 var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
64060 wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
64062 wrap2.call(_content);
64064 function toggle(d3_event) {
64065 d3_event.preventDefault();
64066 _expanded = !_expanded;
64067 if (_updatePreference) {
64068 corePreferences("disclosure." + key + ".expanded", _expanded);
64070 hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand")));
64071 hideToggle.selectAll(".hide-toggle-icon").attr(
64073 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64075 wrap2.call(uiToggle(_expanded));
64077 wrap2.call(_content);
64079 dispatch14.call("toggled", this, _expanded);
64082 disclosure.label = function(val) {
64083 if (!arguments.length)
64085 _label = utilFunctor(val);
64088 disclosure.expanded = function(val) {
64089 if (!arguments.length)
64094 disclosure.updatePreference = function(val) {
64095 if (!arguments.length)
64096 return _updatePreference;
64097 _updatePreference = val;
64100 disclosure.content = function(val) {
64101 if (!arguments.length)
64106 return utilRebind(disclosure, dispatch14, "on");
64109 // modules/ui/section.js
64110 function uiSection(id2, context) {
64111 var _classes = utilFunctor("");
64112 var _shouldDisplay;
64116 var _expandedByDefault = utilFunctor(true);
64117 var _disclosureContent;
64118 var _disclosureExpanded;
64119 var _containerSelection = select_default2(null);
64123 section.classes = function(val) {
64124 if (!arguments.length)
64126 _classes = utilFunctor(val);
64129 section.label = function(val) {
64130 if (!arguments.length)
64132 _label = utilFunctor(val);
64135 section.expandedByDefault = function(val) {
64136 if (!arguments.length)
64137 return _expandedByDefault;
64138 _expandedByDefault = utilFunctor(val);
64141 section.shouldDisplay = function(val) {
64142 if (!arguments.length)
64143 return _shouldDisplay;
64144 _shouldDisplay = utilFunctor(val);
64147 section.content = function(val) {
64148 if (!arguments.length)
64153 section.disclosureContent = function(val) {
64154 if (!arguments.length)
64155 return _disclosureContent;
64156 _disclosureContent = val;
64159 section.disclosureExpanded = function(val) {
64160 if (!arguments.length)
64161 return _disclosureExpanded;
64162 _disclosureExpanded = val;
64165 section.render = function(selection2) {
64166 _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
64167 var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
64168 _containerSelection = sectionEnter.merge(_containerSelection);
64169 _containerSelection.call(renderContent);
64171 section.reRender = function() {
64172 _containerSelection.call(renderContent);
64174 section.selection = function() {
64175 return _containerSelection;
64177 section.disclosure = function() {
64178 return _disclosure;
64180 function renderContent(selection2) {
64181 if (_shouldDisplay) {
64182 var shouldDisplay = _shouldDisplay();
64183 selection2.classed("hide", !shouldDisplay);
64184 if (!shouldDisplay) {
64185 selection2.html("");
64189 if (_disclosureContent) {
64190 if (!_disclosure) {
64191 _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
64193 if (_disclosureExpanded !== void 0) {
64194 _disclosure.expanded(_disclosureExpanded);
64195 _disclosureExpanded = void 0;
64197 selection2.call(_disclosure);
64201 selection2.call(_content);
64207 // modules/ui/tag_reference.js
64208 function uiTagReference(what) {
64209 var wikibase = what.qid ? services.wikidata : services.osmWikibase;
64210 var tagReference = {};
64211 var _button = select_default2(null);
64212 var _body = select_default2(null);
64218 _button.classed("tag-reference-loading", true);
64219 wikibase.getDocs(what, gotDocs);
64221 function gotDocs(err, docs) {
64223 if (!docs || !docs.title) {
64224 _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
64228 if (docs.imageURL) {
64229 _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
64231 }).on("error", function() {
64232 select_default2(this).remove();
64238 var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
64239 if (docs.description) {
64240 tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
64242 tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
64244 tagReferenceDescription.append("a").attr("class", "tag-reference-edit").attr("target", "_blank").attr("title", _t("inspector.edit_reference")).attr("href", docs.editURL).call(svgIcon("#iD-icon-edit", "inline"));
64246 _body.append("a").attr("class", "tag-reference-link").attr("target", "_blank").attr("href", docs.wiki.url).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append(docs.wiki.text));
64248 if (what.key === "comment") {
64249 _body.append("a").attr("class", "tag-reference-comment-link").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", _t("commit.about_changeset_comments_link")).append("span").call(_t.append("commit.about_changeset_comments"));
64254 _button.classed("tag-reference-loading", false);
64255 _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
64257 _button.selectAll("svg.icon use").each(function() {
64258 var iconUse = select_default2(this);
64259 if (iconUse.attr("href") === "#iD-icon-info") {
64260 iconUse.attr("href", "#iD-icon-info-filled");
64265 _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
64266 _body.classed("expanded", false);
64269 _button.selectAll("svg.icon use").each(function() {
64270 var iconUse = select_default2(this);
64271 if (iconUse.attr("href") === "#iD-icon-info-filled") {
64272 iconUse.attr("href", "#iD-icon-info");
64276 tagReference.button = function(selection2, klass, iconName) {
64277 _button = selection2.selectAll(".tag-reference-button").data([0]);
64278 _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
64279 _button.on("click", function(d3_event) {
64280 d3_event.stopPropagation();
64281 d3_event.preventDefault();
64285 } else if (_loaded) {
64292 tagReference.body = function(selection2) {
64293 var itemID = what.qid || what.key + "-" + (what.value || "");
64294 _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
64297 _body.exit().remove();
64298 _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
64299 if (_showing === false) {
64303 tagReference.showing = function(val) {
64304 if (!arguments.length)
64307 return tagReference;
64309 return tagReference;
64312 // modules/ui/field_help.js
64313 function uiFieldHelp(context, fieldName) {
64314 var fieldHelp = {};
64315 var _inspector = select_default2(null);
64316 var _wrap = select_default2(null);
64317 var _body = select_default2(null);
64318 var fieldHelpKeys = {
64346 "indirect_example",
64351 var fieldHelpHeadings = {};
64352 var replacements = {
64353 distField: { html: _t.html("restriction.controls.distance") },
64354 viaField: { html: _t.html("restriction.controls.via") },
64355 fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
64356 allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
64357 restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
64358 onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
64359 allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
64360 restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
64361 onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
64363 var docs = fieldHelpKeys[fieldName].map(function(key) {
64364 var helpkey = "help.field." + fieldName + "." + key[0];
64365 var text = key[1].reduce(function(all, part) {
64366 var subkey = helpkey + "." + part;
64367 var depth = fieldHelpHeadings[subkey];
64368 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
64369 return all + hhh + _t.html(subkey, replacements) + "\n\n";
64373 title: _t.html(helpkey + ".title"),
64374 html: marked(text.trim())
64379 _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
64382 _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
64383 _body.classed("hide", true);
64386 function clickHelp(index) {
64387 var d2 = docs[index];
64388 var tkeys = fieldHelpKeys[fieldName][index][1];
64389 _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
64390 return i3 === index;
64392 var content = _body.selectAll(".field-help-content").html(d2.html);
64393 content.selectAll("p").attr("class", function(d4, i3) {
64396 if (d2.key === "help.field.restrictions.inspecting") {
64397 content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
64398 } else if (d2.key === "help.field.restrictions.modifying") {
64399 content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
64402 fieldHelp.button = function(selection2) {
64405 var button = selection2.selectAll(".field-help-button").data([0]);
64406 button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
64407 d3_event.stopPropagation();
64408 d3_event.preventDefault();
64409 if (_body.classed("hide")) {
64416 function updatePosition() {
64417 var wrap2 = _wrap.node();
64418 var inspector = _inspector.node();
64419 var wRect = wrap2.getBoundingClientRect();
64420 var iRect = inspector.getBoundingClientRect();
64421 _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
64423 fieldHelp.body = function(selection2) {
64424 _wrap = selection2.selectAll(".form-field-input-wrap");
64427 _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
64428 if (_inspector.empty())
64430 _body = _inspector.selectAll(".field-help-body").data([0]);
64431 var enter = _body.enter().append("div").attr("class", "field-help-body hide");
64432 var titleEnter = enter.append("div").attr("class", "field-help-title cf");
64433 titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
64434 titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
64435 d3_event.stopPropagation();
64436 d3_event.preventDefault();
64438 }).call(svgIcon("#iD-icon-close"));
64439 var navEnter = enter.append("div").attr("class", "field-help-nav cf");
64440 var titles = docs.map(function(d2) {
64443 navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
64445 }).on("click", function(d3_event, d2) {
64446 d3_event.stopPropagation();
64447 d3_event.preventDefault();
64448 clickHelp(titles.indexOf(d2));
64450 enter.append("div").attr("class", "field-help-content");
64451 _body = _body.merge(enter);
64457 // modules/ui/fields/check.js
64458 function uiFieldCheck(field, context) {
64459 var dispatch14 = dispatch_default("change");
64460 var options2 = field.options;
64464 var input = select_default2(null);
64465 var text = select_default2(null);
64466 var label = select_default2(null);
64467 var reverser = select_default2(null);
64469 var _entityIDs = [];
64471 var stringsField = field.resolveReference("stringsCrossReference");
64472 if (!options2 && stringsField.options) {
64473 options2 = stringsField.options;
64476 for (var i3 in options2) {
64477 var v2 = options2[i3];
64478 values.push(v2 === "undefined" ? void 0 : v2);
64479 texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
64482 values = [void 0, "yes"];
64483 texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
64484 if (field.type !== "defaultCheck") {
64486 texts.push(_t.html("inspector.check.no"));
64489 function checkImpliedYes() {
64490 _impliedYes = field.id === "oneway_yes";
64491 if (field.id === "oneway") {
64492 var entity = context.entity(_entityIDs[0]);
64493 for (var key in entity.tags) {
64494 if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
64495 _impliedYes = true;
64496 texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
64502 function reverserHidden() {
64503 if (!context.container().select("div.inspector-hover").empty())
64505 return !(_value === "yes" || _impliedYes && !_value);
64507 function reverserSetText(selection2) {
64508 var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
64509 if (reverserHidden() || !entity)
64511 var first = entity.first();
64512 var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
64513 var pseudoDirection = first < last;
64514 var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
64515 selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
64518 var check = function(selection2) {
64520 label = selection2.selectAll(".form-field-input-wrap").data([0]);
64521 var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
64522 enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
64523 enter.append("span").html(texts[0]).attr("class", "value");
64524 if (field.type === "onewayCheck") {
64525 enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
64527 label = label.merge(enter);
64528 input = label.selectAll("input");
64529 text = label.selectAll("span.value");
64530 input.on("click", function(d3_event) {
64531 d3_event.stopPropagation();
64533 if (Array.isArray(_tags[field.key])) {
64534 if (values.indexOf("yes") !== -1) {
64535 t2[field.key] = "yes";
64537 t2[field.key] = values[0];
64540 t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
64542 if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
64543 t2[field.key] = values[0];
64545 dispatch14.call("change", this, t2);
64547 if (field.type === "onewayCheck") {
64548 reverser = label.selectAll(".reverser");
64549 reverser.call(reverserSetText).on("click", function(d3_event) {
64550 d3_event.preventDefault();
64551 d3_event.stopPropagation();
64554 for (var i4 in _entityIDs) {
64555 graph = actionReverse(_entityIDs[i4])(graph);
64559 _t("operations.reverse.annotation.line", { n: 1 })
64561 context.validator().validate();
64562 select_default2(this).call(reverserSetText);
64566 check.entityIDs = function(val) {
64567 if (!arguments.length)
64572 check.tags = function(tags) {
64574 function isChecked(val) {
64575 return val !== "no" && val !== "" && val !== void 0 && val !== null;
64577 function textFor(val) {
64580 var index = values.indexOf(val);
64581 return index !== -1 ? texts[index] : '"' + val + '"';
64584 var isMixed = Array.isArray(tags[field.key]);
64585 _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
64586 if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
64589 input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
64590 text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
64591 label.classed("set", !!_value);
64592 if (field.type === "onewayCheck") {
64593 reverser.classed("hide", reverserHidden()).call(reverserSetText);
64596 check.focus = function() {
64597 input.node().focus();
64599 return utilRebind(check, dispatch14, "on");
64602 // modules/ui/length_indicator.js
64603 function uiLengthIndicator(maxChars) {
64604 var _wrap = select_default2(null);
64605 var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
64606 selection2.text("");
64607 selection2.call(svgIcon("#iD-icon-alert", "inline"));
64608 selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
64610 var _silent = false;
64611 var lengthIndicator = function(selection2) {
64612 _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
64613 _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
64614 selection2.call(_tooltip);
64616 lengthIndicator.update = function(val) {
64617 const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
64618 let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
64619 indicator.enter().append("span").merge(indicator).classed("length-indicator", true).classed("limit-reached", (d2) => d2 > maxChars).style("border-right-width", (d2) => "".concat(Math.abs(maxChars - d2) * 2, "px")).style("margin-right", (d2) => d2 > maxChars ? "".concat((maxChars - d2) * 2, "px") : 0).style("opacity", (d2) => d2 > maxChars * 0.8 ? Math.min(1, (d2 / maxChars - 0.8) / (1 - 0.8)) : 0).style("pointer-events", (d2) => d2 > maxChars * 0.8 ? null : "none");
64622 if (strLen > maxChars) {
64628 lengthIndicator.silent = function(val) {
64629 if (!arguments.length)
64632 return lengthIndicator;
64634 return lengthIndicator;
64637 // modules/ui/fields/combo.js
64638 function uiFieldCombo(field, context) {
64639 var dispatch14 = dispatch_default("change");
64640 var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
64641 var _isNetwork = field.type === "networkCombo";
64642 var _isSemi = field.type === "semiCombo";
64643 var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
64644 var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
64645 var _snake_case = field.snake_case || field.snake_case === void 0;
64646 var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
64647 var _container = select_default2(null);
64648 var _inputWrap = select_default2(null);
64649 var _input = select_default2(null);
64650 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
64651 var _comboData = [];
64652 var _multiData = [];
64653 var _entityIDs = [];
64656 var _staticPlaceholder;
64657 var _dataDeprecated = [];
64658 _mainFileFetcher.get("deprecated").then(function(d2) {
64659 _dataDeprecated = d2;
64660 }).catch(function() {
64662 if (_isMulti && field.key && /[^:]$/.test(field.key)) {
64665 function snake(s2) {
64666 return s2.replace(/\s+/g, "_");
64668 function clean2(s2) {
64669 return s2.split(";").map(function(s3) {
64673 function tagValue(dval) {
64674 dval = clean2(dval || "");
64675 var found = getOptions(true).find(function(o2) {
64676 return o2.key && clean2(o2.value) === dval;
64680 if (field.type === "typeCombo" && !dval) {
64683 return restrictTagValueSpelling(dval) || void 0;
64685 function restrictTagValueSpelling(dval) {
64687 dval = snake(dval);
64689 if (!field.caseSensitive) {
64690 dval = dval.toLowerCase();
64694 function getLabelId(field2, v2) {
64695 return field2.hasTextForStringId("options.".concat(v2, ".title")) ? "options.".concat(v2, ".title") : "options.".concat(v2);
64697 function displayValue(tval) {
64699 var stringsField = field.resolveReference("stringsCrossReference");
64700 const labelId = getLabelId(stringsField, tval);
64701 if (stringsField.hasTextForStringId(labelId)) {
64702 return stringsField.t(labelId, { default: tval });
64704 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
64709 function renderValue(tval) {
64711 var stringsField = field.resolveReference("stringsCrossReference");
64712 const labelId = getLabelId(stringsField, tval);
64713 if (stringsField.hasTextForStringId(labelId)) {
64714 return stringsField.t.append(labelId, { default: tval });
64716 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
64719 return (selection2) => selection2.text(tval);
64721 function objectDifference(a2, b2) {
64722 return a2.filter(function(d1) {
64723 return !b2.some(function(d2) {
64724 return d1.value === d2.value;
64728 function initCombo(selection2, attachTo) {
64729 if (!_allowCustomValues) {
64730 selection2.attr("readonly", "readonly");
64732 if (_showTagInfoSuggestions && services.taginfo) {
64733 selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
64734 setTaginfoValues("", setPlaceholder);
64736 selection2.call(_combobox, attachTo);
64737 setTimeout(() => setStaticValues(setPlaceholder), 0);
64740 function getOptions(allOptions) {
64741 var stringsField = field.resolveReference("stringsCrossReference");
64742 if (!(field.options || stringsField.options))
64745 if (allOptions !== true) {
64746 options2 = field.options || stringsField.options;
64748 options2 = [].concat(field.options, stringsField.options).filter(Boolean);
64750 return options2.map(function(v2) {
64751 const labelId = getLabelId(stringsField, v2);
64754 value: stringsField.t(labelId, { default: v2 }),
64755 title: stringsField.t("options.".concat(v2, ".description"), { default: v2 }),
64756 display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
64757 klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
64761 function hasStaticValues() {
64762 return getOptions().length > 0;
64764 function setStaticValues(callback, filter2) {
64765 _comboData = getOptions();
64766 if (filter2 !== void 0) {
64767 _comboData = _comboData.filter(filter2);
64769 _comboData = objectDifference(_comboData, _multiData);
64770 _combobox.data(_comboData);
64772 callback(_comboData);
64774 function setTaginfoValues(q2, callback) {
64775 var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
64776 if (hasStaticValues()) {
64777 setStaticValues(callback, queryFilter);
64779 var stringsField = field.resolveReference("stringsCrossReference");
64780 var fn = _isMulti ? "multikeys" : "values";
64781 var query = (_isMulti ? field.key : "") + q2;
64782 var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
64783 if (hasCountryPrefix) {
64784 query = _countryCode + ":";
64787 debounce: q2 !== "",
64791 if (_entityIDs.length) {
64792 params.geometry = context.graph().geometry(_entityIDs[0]);
64794 services.taginfo[fn](params, function(err, data) {
64797 data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
64798 data = data.filter((d2) => {
64799 var value = d2.value;
64801 value = value.slice(field.key.length);
64803 return value === restrictTagValueSpelling(value);
64805 var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
64806 if (deprecatedValues) {
64807 data = data.filter((d2) => !deprecatedValues.includes(d2.value));
64809 if (hasCountryPrefix) {
64810 data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
64812 const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
64813 _container.classed("empty-combobox", data.length === 0);
64814 _comboData = data.concat(additionalOptions).map(function(d2) {
64817 v2 = v2.replace(field.key, "");
64818 const labelId = getLabelId(stringsField, v2);
64819 var isLocalizable = stringsField.hasTextForStringId(labelId);
64820 var label = stringsField.t(labelId, { default: v2 });
64824 title: stringsField.t("options.".concat(v2, ".description"), { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
64825 display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
64826 klass: isLocalizable ? "" : "raw-option"
64829 _comboData = _comboData.filter(queryFilter);
64830 _comboData = objectDifference(_comboData, _multiData);
64832 callback(_comboData, hasStaticValues());
64835 function addComboboxIcons(disp, value) {
64836 const iconsField = field.resolveReference("iconsCrossReference");
64837 if (iconsField.icons) {
64838 return function(selection2) {
64839 var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
64840 if (iconsField.icons[value]) {
64841 span.call(svgIcon("#".concat(iconsField.icons[value])));
64843 disp.call(this, selection2);
64848 function setPlaceholder(values) {
64849 if (_isMulti || _isSemi) {
64850 _staticPlaceholder = field.placeholder() || _t("inspector.add");
64852 var vals = values.map(function(d2) {
64854 }).filter(function(s2) {
64855 return s2.length < 20;
64857 var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
64860 _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
64862 if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
64863 _staticPlaceholder += "\u2026";
64866 if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
64867 ph = _t("inspector.multiple_values");
64869 ph = _staticPlaceholder;
64871 _container.selectAll("input").attr("placeholder", ph);
64872 var hideAdd = !_allowCustomValues && !values.length;
64873 _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
64875 function change() {
64878 if (_isMulti || _isSemi) {
64881 vals = [tagValue(utilGetSetValue(_input))];
64882 } else if (_isSemi) {
64883 val = tagValue(utilGetSetValue(_input)) || "";
64884 val = val.replace(/,/g, ";");
64885 vals = val.split(";");
64887 vals = vals.filter(Boolean);
64890 _container.classed("active", false);
64891 utilGetSetValue(_input, "");
64893 utilArrayUniq(vals).forEach(function(v2) {
64894 var key = (field.key || "") + v2;
64896 var old = _tags[key];
64897 if (typeof old === "string" && old.toLowerCase() !== "no")
64900 key = context.cleanTagKey(key);
64901 field.keys.push(key);
64904 } else if (_isSemi) {
64905 var arr = _multiData.map(function(d2) {
64908 arr = arr.concat(vals);
64909 t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
64911 window.setTimeout(function() {
64912 _input.node().focus();
64915 var rawValue = utilGetSetValue(_input);
64916 if (!rawValue && Array.isArray(_tags[field.key]))
64918 val = context.cleanTagValue(tagValue(rawValue));
64919 t2[field.key] = val || void 0;
64921 dispatch14.call("change", this, t2);
64923 function removeMultikey(d3_event, d2) {
64924 d3_event.preventDefault();
64925 d3_event.stopPropagation();
64928 t2[d2.key] = void 0;
64929 } else if (_isSemi) {
64930 var arr = _multiData.map(function(md) {
64931 return md.key === d2.key ? null : md.key;
64932 }).filter(Boolean);
64933 arr = utilArrayUniq(arr);
64934 t2[field.key] = arr.length ? arr.join(";") : void 0;
64935 _lengthIndicator.update(t2[field.key]);
64937 dispatch14.call("change", this, t2);
64939 function invertMultikey(d3_event, d2) {
64940 d3_event.preventDefault();
64941 d3_event.stopPropagation();
64944 t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
64946 dispatch14.call("change", this, t2);
64948 function combo(selection2) {
64949 _container = selection2.selectAll(".form-field-input-wrap").data([0]);
64950 var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
64951 _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
64952 if (_isMulti || _isSemi) {
64953 _container = _container.selectAll(".chiplist").data([0]);
64954 var listClass = "chiplist";
64955 if (field.key === "destination" || field.key === "via") {
64956 listClass += " full-line-chips";
64958 _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
64959 window.setTimeout(function() {
64960 _input.node().focus();
64962 }).merge(_container);
64963 _inputWrap = _container.selectAll(".input-wrap").data([0]);
64964 _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
64965 var hideAdd = !_allowCustomValues && !_comboData.length;
64966 _inputWrap.style("display", hideAdd ? "none" : null);
64967 _input = _inputWrap.selectAll("input").data([0]);
64969 _input = _container.selectAll("input").data([0]);
64971 _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
64973 _inputWrap.call(_lengthIndicator);
64974 } else if (!_isMulti) {
64975 _container.call(_lengthIndicator);
64978 var extent = combinedEntityExtent();
64979 var countryCode = extent && iso1A2Code(extent.center());
64980 _countryCode = countryCode && countryCode.toLowerCase();
64982 _input.on("change", change).on("blur", change).on("input", function() {
64983 let val = utilGetSetValue(_input);
64985 if (_isSemi && _tags[field.key]) {
64986 val += ";" + _tags[field.key];
64988 _lengthIndicator.update(val);
64990 _input.on("keydown.field", function(d3_event) {
64991 switch (d3_event.keyCode) {
64993 _input.node().blur();
64994 d3_event.stopPropagation();
64998 if (_isMulti || _isSemi) {
64999 _combobox.on("accept", function() {
65000 _input.node().blur();
65001 _input.node().focus();
65003 _input.on("focus", function() {
65004 _container.classed("active", true);
65007 _combobox.on("cancel", function() {
65008 _input.node().blur();
65009 }).on("update", function() {
65010 updateIcon(utilGetSetValue(_input));
65013 function updateIcon(value) {
65014 value = tagValue(value);
65015 let container = _container;
65016 if (field.type === "multiCombo" || field.type === "semiCombo") {
65017 container = _container.select(".input-wrap");
65019 const iconsField = field.resolveReference("iconsCrossReference");
65020 if (iconsField.icons) {
65021 container.selectAll(".tag-value-icon").remove();
65022 if (iconsField.icons[value]) {
65023 container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#".concat(iconsField.icons[value])));
65027 combo.tags = function(tags) {
65029 var stringsField = field.resolveReference("stringsCrossReference");
65030 var isMixed = Array.isArray(tags[field.key]);
65031 var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
65032 var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId("options.".concat(value)) && !stringsField.hasTextForStringId("options.".concat(value, ".title"));
65033 var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
65034 var isReadOnly = !_allowCustomValues;
65035 if (_isMulti || _isSemi) {
65039 for (var k2 in tags) {
65040 if (field.key && k2.indexOf(field.key) !== 0)
65042 if (!field.key && field.keys.indexOf(k2) === -1)
65045 var suffix = field.key ? k2.slice(field.key.length) : k2;
65048 value: displayValue(suffix),
65049 display: addComboboxIcons(renderValue(suffix), suffix),
65050 state: typeof v2 === "string" ? v2.toLowerCase() : "",
65051 isMixed: Array.isArray(v2)
65055 field.keys = _multiData.map(function(d2) {
65058 maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
65060 maxLength = context.maxCharsForTagKey();
65062 } else if (_isSemi) {
65063 var allValues = [];
65065 if (Array.isArray(tags[field.key])) {
65066 tags[field.key].forEach(function(tagVal) {
65067 var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
65068 allValues = allValues.concat(thisVals);
65069 if (!commonValues) {
65070 commonValues = thisVals;
65072 commonValues = commonValues.filter((value) => thisVals.includes(value));
65075 allValues = utilArrayUniq(allValues).filter(Boolean);
65077 allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
65078 commonValues = allValues;
65080 _multiData = allValues.map(function(v3) {
65083 value: displayValue(v3),
65084 display: addComboboxIcons(renderValue(v3), v3),
65085 isMixed: !commonValues.includes(v3)
65088 var currLength = utilUnicodeCharsCount(commonValues.join(";"));
65089 maxLength = context.maxCharsForTagValue() - currLength;
65090 if (currLength > 0) {
65094 maxLength = Math.max(0, maxLength);
65095 var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
65096 _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
65097 var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
65098 var chips = _container.selectAll(".chip").data(_multiData);
65099 chips.exit().remove();
65100 var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
65101 enter.append("span");
65102 const field_buttons = enter.append("div").attr("class", "field_buttons");
65103 field_buttons.append("a").attr("class", "remove");
65104 chips = chips.merge(enter).order().classed("raw-value", function(d2) {
65107 k3 = k3.replace(field.key, "");
65108 return !stringsField.hasTextForStringId("options." + k3);
65109 }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
65111 }).attr("title", function(d2) {
65113 return _t("inspector.unshared_value_tooltip");
65115 if (!["yes", "no"].includes(d2.state)) {
65119 }).classed("negated", (d2) => d2.state === "no");
65121 chips.selectAll("input[type=checkbox]").remove();
65122 chips.insert("input", "span").attr("type", "checkbox").property("checked", (d2) => d2.state === "yes").property("indeterminate", (d2) => d2.isMixed || !["yes", "no"].includes(d2.state)).on("click", invertMultikey);
65124 if (allowDragAndDrop) {
65125 registerDragAndDrop(chips);
65127 chips.each(function(d2) {
65128 const selection2 = select_default2(this);
65129 const text_span = selection2.select("span");
65130 const field_buttons2 = selection2.select(".field_buttons");
65131 const clean_value = d2.value.trim();
65132 text_span.text("");
65133 if (!field_buttons2.select("button").empty()) {
65134 field_buttons2.select("button").remove();
65136 if (clean_value.startsWith("https://")) {
65137 text_span.text(clean_value);
65138 field_buttons2.append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).attr("aria-label", () => _t("icons.visit_website")).on("click", function(d3_event) {
65139 d3_event.preventDefault();
65140 window.open(clean_value, "_blank");
65145 d2.display(text_span);
65148 text_span.text(d2.value);
65150 chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
65153 var mixedValues = isMixed && tags[field.key].map(function(val) {
65154 return displayValue(val);
65155 }).filter(Boolean);
65156 utilGetSetValue(_input, !isMixed ? displayValue(tags[field.key]) : "").data([tags[field.key]]).classed("raw-value", isRawValue).classed("known-value", isKnownValue).attr("readonly", isReadOnly ? "readonly" : void 0).attr("title", isMixed ? mixedValues.join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _staticPlaceholder || "").classed("mixed", isMixed).on("keydown.deleteCapture", function(d3_event) {
65157 if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
65158 d3_event.preventDefault();
65159 d3_event.stopPropagation();
65161 t2[field.key] = void 0;
65162 dispatch14.call("change", this, t2);
65165 if (!Array.isArray(tags[field.key])) {
65166 updateIcon(tags[field.key]);
65169 _lengthIndicator.update(tags[field.key]);
65172 const refreshStyles = () => {
65173 _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
65175 _input.on("input.refreshStyles", refreshStyles);
65176 _combobox.on("update.refreshStyles", refreshStyles);
65179 function registerDragAndDrop(selection2) {
65180 var dragOrigin, targetIndex;
65182 drag_default().on("start", function(d3_event) {
65187 targetIndex = null;
65188 }).on("drag", function(d3_event) {
65189 var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
65190 if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
65191 Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
65193 var index = selection2.nodes().indexOf(this);
65194 select_default2(this).classed("dragging", true);
65195 targetIndex = null;
65196 var targetIndexOffsetTop = null;
65197 var draggedTagWidth = select_default2(this).node().offsetWidth;
65198 if (field.key === "destination" || field.key === "via") {
65199 _container.selectAll(".chip").style("transform", function(d2, index2) {
65200 var node = select_default2(this).node();
65201 if (index === index2) {
65202 return "translate(" + x2 + "px, " + y2 + "px)";
65203 } else if (index2 > index && d3_event.y > node.offsetTop) {
65204 if (targetIndex === null || index2 > targetIndex) {
65205 targetIndex = index2;
65207 return "translateY(-100%)";
65208 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
65209 if (targetIndex === null || index2 < targetIndex) {
65210 targetIndex = index2;
65212 return "translateY(100%)";
65217 _container.selectAll(".chip").each(function(d2, index2) {
65218 var node = select_default2(this).node();
65219 if (index !== index2 && d3_event.x < node.offsetLeft + node.offsetWidth + 5 && d3_event.x > node.offsetLeft && d3_event.y < node.offsetTop + node.offsetHeight && d3_event.y > node.offsetTop) {
65220 targetIndex = index2;
65221 targetIndexOffsetTop = node.offsetTop;
65223 }).style("transform", function(d2, index2) {
65224 var node = select_default2(this).node();
65225 if (index === index2) {
65226 return "translate(" + x2 + "px, " + y2 + "px)";
65228 if (node.offsetTop === targetIndexOffsetTop) {
65229 if (index2 < index && index2 >= targetIndex) {
65230 return "translateX(" + draggedTagWidth + "px)";
65231 } else if (index2 > index && index2 <= targetIndex) {
65232 return "translateX(-" + draggedTagWidth + "px)";
65238 }).on("end", function() {
65239 if (!select_default2(this).classed("dragging")) {
65242 var index = selection2.nodes().indexOf(this);
65243 select_default2(this).classed("dragging", false);
65244 _container.selectAll(".chip").style("transform", null);
65245 if (typeof targetIndex === "number") {
65246 var element = _multiData[index];
65247 _multiData.splice(index, 1);
65248 _multiData.splice(targetIndex, 0, element);
65250 if (_multiData.length) {
65251 t2[field.key] = _multiData.map(function(element2) {
65252 return element2.key;
65255 t2[field.key] = void 0;
65257 dispatch14.call("change", this, t2);
65259 dragOrigin = void 0;
65260 targetIndex = void 0;
65264 combo.focus = function() {
65265 _input.node().focus();
65267 combo.entityIDs = function(val) {
65268 if (!arguments.length)
65273 function combinedEntityExtent() {
65274 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
65276 return utilRebind(combo, dispatch14, "on");
65279 // modules/ui/fields/input.js
65280 var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
65281 function uiFieldText(field, context) {
65282 var dispatch14 = dispatch_default("change");
65283 var input = select_default2(null);
65284 var outlinkButton = select_default2(null);
65285 var wrap2 = select_default2(null);
65286 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
65287 var _entityIDs = [];
65289 var _phoneFormats = {};
65290 const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
65291 const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
65292 const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
65293 const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
65294 if (field.type === "tel") {
65295 _mainFileFetcher.get("phone_formats").then(function(d2) {
65296 _phoneFormats = d2;
65297 updatePhonePlaceholder();
65298 }).catch(function() {
65301 function calcLocked() {
65302 var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
65303 var entity = context.graph().hasEntity(entityID);
65306 if (entity.tags.wikidata)
65308 var preset = _mainPresetIndex.match(entity, context.graph());
65309 var isSuggestion = preset && preset.suggestion;
65310 var which = field.id;
65311 return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
65313 field.locked(isLocked);
65315 function i3(selection2) {
65317 var isLocked = field.locked();
65318 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65319 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
65320 input = wrap2.selectAll("input").data([0]);
65321 input = input.enter().append("input").attr("type", field.type === "identifier" ? "text" : field.type).attr("id", field.domId).classed(field.type, true).call(utilNoAuto).merge(input);
65322 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
65323 wrap2.call(_lengthIndicator);
65324 if (field.type === "tel") {
65325 updatePhonePlaceholder();
65326 } else if (field.type === "number") {
65327 var rtl = _mainLocalizer.textDirection() === "rtl";
65328 input.attr("type", "text");
65329 var inc = field.increment;
65330 var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
65331 buttons.enter().append("button").attr("class", function(d2) {
65332 var which = d2 > 0 ? "increment" : "decrement";
65333 return "form-field-button " + which;
65334 }).attr("title", function(d2) {
65335 var which = d2 > 0 ? "increment" : "decrement";
65336 return _t("inspector.".concat(which));
65337 }).merge(buttons).on("click", function(d3_event, d2) {
65338 d3_event.preventDefault();
65339 var isMixed = Array.isArray(_tags[field.key]);
65342 var raw_vals = input.node().value || "0";
65343 var vals = raw_vals.split(";");
65344 vals = vals.map(function(v2) {
65346 const isRawNumber = likelyRawNumberFormat.test(v2);
65347 var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
65348 if (isDirectionField) {
65349 const compassDir = cardinal[v2.toLowerCase()];
65350 if (compassDir !== void 0) {
65354 if (!isFinite(num))
65356 num = parseFloat(num);
65357 if (!isFinite(num))
65360 if (isDirectionField) {
65361 num = (num % 360 + 360) % 360;
65363 return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
65365 input.node().value = vals.join(";");
65368 } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
65369 input.attr("type", "text");
65370 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
65371 outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
65372 var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
65373 if (domainResults.length >= 2 && domainResults[1]) {
65374 var domain = domainResults[1];
65375 return _t("icons.view_on", { domain });
65378 }).merge(outlinkButton);
65379 outlinkButton.on("click", function(d3_event) {
65380 d3_event.preventDefault();
65381 var value = validIdentifierValueForLink();
65383 var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
65384 window.open(url, "_blank");
65386 }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
65387 } else if (field.type === "url") {
65388 input.attr("type", "text");
65389 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
65390 outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", () => _t("icons.visit_website")).on("click", function(d3_event) {
65391 d3_event.preventDefault();
65392 const value = validIdentifierValueForLink();
65394 window.open(value, "_blank");
65395 }).merge(outlinkButton);
65396 } else if (field.type === "colour") {
65397 input.attr("type", "text");
65398 updateColourPreview();
65399 } else if (field.type === "date") {
65400 input.attr("type", "text");
65404 function updateColourPreview() {
65405 wrap2.selectAll(".colour-preview").remove();
65406 const colour = utilGetSetValue(input);
65407 if (!isColourValid(colour) && colour !== "") {
65408 wrap2.selectAll("input.colour-selector").remove();
65409 wrap2.selectAll(".form-field-button").remove();
65412 var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
65413 colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
65414 d3_event.preventDefault();
65415 var colour2 = this.value;
65416 if (!isColourValid(colour2))
65418 utilGetSetValue(input, this.value);
65420 updateColourPreview();
65422 wrap2.selectAll("input.colour-selector").attr("value", colour);
65423 var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
65424 chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
65425 if (colour === "") {
65426 chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
65428 chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
65430 function updateDateField() {
65431 function isDateValid(date2) {
65432 return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
65434 const date = utilGetSetValue(input);
65435 const now3 = /* @__PURE__ */ new Date();
65436 const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
65437 if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
65438 wrap2.selectAll(".date-set-today").data([0]).enter().append("button").attr("class", "form-field-button date-set-today").call(svgIcon("#fas-rotate")).call(uiTooltip().title(() => _t.append("inspector.set_today"))).on("click", () => {
65439 utilGetSetValue(input, today);
65444 wrap2.selectAll(".date-set-today").remove();
65446 if (!isDateValid(date) && date !== "") {
65447 wrap2.selectAll("input.date-selector").remove();
65448 wrap2.selectAll(".date-calendar").remove();
65451 if (utilDetect().browser !== "Safari") {
65452 var dateSelector = wrap2.selectAll(".date-selector").data([0]);
65453 dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
65454 d3_event.preventDefault();
65455 var date2 = this.value;
65456 if (!isDateValid(date2))
65458 utilGetSetValue(input, this.value);
65462 wrap2.selectAll("input.date-selector").attr("value", date);
65463 var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
65464 calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
65465 calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
65468 function updatePhonePlaceholder() {
65469 if (input.empty() || !Object.keys(_phoneFormats).length)
65471 var extent = combinedEntityExtent();
65472 var countryCode = extent && iso1A2Code(extent.center());
65473 var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
65475 input.attr("placeholder", format2);
65477 function validIdentifierValueForLink() {
65479 const value = utilGetSetValue(input).trim();
65480 if (field.type === "url" && value) {
65482 return new URL(value).href;
65487 if (field.type === "identifier" && field.pattern) {
65488 return value && ((_a2 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a2[0]);
65492 function clamped(num) {
65493 if (field.minValue !== void 0) {
65494 num = Math.max(num, field.minValue);
65496 if (field.maxValue !== void 0) {
65497 num = Math.min(num, field.maxValue);
65501 function getVals(tags) {
65503 const multiSelection = context.selectedIDs();
65504 tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
65505 return tags.map((tags2) => new Set(field.keys.reduce((acc, key) => acc.concat(tags2[key]), []).filter(Boolean))).map((vals) => vals.size === 0 ? /* @__PURE__ */ new Set([void 0]) : vals).reduce((a2, b2) => /* @__PURE__ */ new Set([...a2, ...b2]));
65507 return new Set([].concat(tags[field.key]));
65510 function change(onInput) {
65511 return function() {
65513 var val = utilGetSetValue(input);
65515 val = context.cleanTagValue(val);
65516 if (!val && getVals(_tags).size > 1)
65518 var displayVal = val;
65519 if (field.type === "number" && val) {
65520 var numbers2 = val.split(";");
65521 numbers2 = numbers2.map(function(v2) {
65522 if (likelyRawNumberFormat.test(v2)) {
65525 var num = parseLocaleFloat(v2);
65526 const fractionDigits = countDecimalPlaces(v2);
65527 return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
65529 val = numbers2.join(";");
65532 utilGetSetValue(input, displayVal);
65533 t2[field.key] = val || void 0;
65535 dispatch14.call("change", this, (tags) => {
65536 if (field.keys.some((key) => tags[key])) {
65537 field.keys.filter((key) => tags[key]).forEach((key) => {
65538 tags[key] = val || void 0;
65541 tags[field.key] = val || void 0;
65546 dispatch14.call("change", this, t2, onInput);
65550 i3.entityIDs = function(val) {
65551 if (!arguments.length)
65556 i3.tags = function(tags) {
65559 const vals = getVals(tags);
65560 const isMixed = vals.size > 1;
65561 var val = vals.size === 1 ? (_a2 = [...vals][0]) != null ? _a2 : "" : "";
65563 if (field.type === "number" && val) {
65564 var numbers2 = val.split(";");
65565 var oriNumbers = utilGetSetValue(input).split(";");
65566 if (numbers2.length !== oriNumbers.length)
65567 shouldUpdate = true;
65568 numbers2 = numbers2.map(function(v2) {
65570 var num = Number(v2);
65571 if (!isFinite(num) || v2 === "")
65573 const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
65574 return formatFloat(num, fractionDigits);
65576 val = numbers2.join(";");
65577 shouldUpdate = (inputValue, setValue) => {
65578 const inputNums = inputValue.split(";").map(
65579 (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
65581 const setNums = setValue.split(";").map(parseLocaleFloat);
65582 return !isEqual_default(inputNums, setNums);
65585 utilGetSetValue(input, val, shouldUpdate).attr("title", isMixed ? [...vals].join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
65586 if (field.type === "number") {
65587 const buttons = wrap2.selectAll(".increment, .decrement");
65589 buttons.attr("disabled", "disabled").classed("disabled", true);
65591 var raw_vals = tags[field.key] || "0";
65592 const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
65593 buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
65596 if (field.type === "tel")
65597 updatePhonePlaceholder();
65598 if (field.type === "colour")
65599 updateColourPreview();
65600 if (field.type === "date")
65602 if (outlinkButton && !outlinkButton.empty()) {
65603 var disabled = !validIdentifierValueForLink();
65604 outlinkButton.classed("disabled", disabled);
65607 _lengthIndicator.update(tags[field.key]);
65610 i3.focus = function() {
65611 var node = input.node();
65615 function combinedEntityExtent() {
65616 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
65618 return utilRebind(i3, dispatch14, "on");
65621 // modules/ui/fields/access.js
65622 function uiFieldAccess(field, context) {
65623 var dispatch14 = dispatch_default("change");
65624 var items = select_default2(null);
65626 function access(selection2) {
65627 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
65628 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
65629 var list2 = wrap2.selectAll("ul").data([0]);
65630 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
65631 items = list2.selectAll("li").data(field.keys);
65632 var enter = items.enter().append("li").attr("class", function(d2) {
65633 return "labeled-input preset-access-" + d2;
65635 enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
65636 return "preset-input-access-" + d2;
65637 }).html(function(d2) {
65638 return field.t.html("types." + d2);
65640 enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
65641 return "preset-input-access preset-input-access-" + d2;
65642 }).call(utilNoAuto).each(function(d2) {
65643 select_default2(this).call(
65644 uiCombobox(context, "access-" + d2).data(access.options(d2))
65647 items = items.merge(enter);
65648 wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
65650 function change(d3_event, d2) {
65652 var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
65653 if (!value && typeof _tags[d2] !== "string")
65655 tag2[d2] = value || void 0;
65656 dispatch14.call("change", this, tag2);
65658 access.options = function(type2) {
65670 if (type2 === "access") {
65671 options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
65673 if (type2 === "bicycle") {
65674 options2.splice(options2.length - 4, 0, "dismount");
65676 var stringsField = field.resolveReference("stringsCrossReference");
65677 return options2.map(function(option) {
65679 title: stringsField.t("options." + option + ".description"),
65684 const placeholdersByTag = {
65687 foot: "designated",
65688 motor_vehicle: "no"
65692 motor_vehicle: "no",
65698 motor_vehicle: "no"
65701 motor_vehicle: "no",
65702 bicycle: "designated"
65705 motor_vehicle: "no",
65706 horse: "designated"
65710 motor_vehicle: "no",
65716 motor_vehicle: "yes",
65721 motor_vehicle: "yes"
65725 motor_vehicle: "yes",
65731 motor_vehicle: "yes",
65737 motor_vehicle: "yes",
65743 motor_vehicle: "yes",
65749 motor_vehicle: "yes",
65755 motor_vehicle: "yes",
65761 motor_vehicle: "yes",
65766 motor_vehicle: "yes"
65770 motor_vehicle: "yes",
65776 motor_vehicle: "yes",
65782 motor_vehicle: "yes",
65802 motor_vehicle: "no",
65814 motor_vehicle: "no"
65831 motorcycle_barrier: {
65832 motor_vehicle: "no"
65839 access.tags = function(tags) {
65841 utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
65842 return typeof tags[d2] === "string" ? tags[d2] : "";
65843 }).classed("mixed", function(d2) {
65844 return tags[d2] && Array.isArray(tags[d2]);
65845 }).attr("title", function(d2) {
65846 return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
65847 }).attr("placeholder", function(d2) {
65848 if (tags[d2] && Array.isArray(tags[d2])) {
65849 return _t("inspector.multiple_values");
65851 if (d2 === "bicycle" || d2 === "motor_vehicle") {
65852 if (tags.vehicle && typeof tags.vehicle === "string") {
65853 return tags.vehicle;
65856 if (tags.access && typeof tags.access === "string") {
65857 return tags.access;
65859 function getPlaceholdersByTag(key, placeholdersByKey) {
65860 if (typeof tags[key] === "string") {
65861 if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
65862 return placeholdersByKey[tags[key]][d2];
65865 var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
65866 return placeholdersByKey[val] && placeholdersByKey[val][d2];
65867 }).filter(Boolean);
65868 if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
65869 return impliedAccesses[0];
65873 for (const key in placeholdersByTag) {
65875 const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
65876 if (impliedAccess) {
65877 return impliedAccess;
65881 if (d2 === "access" && !tags.barrier) {
65884 return field.placeholder();
65887 access.focus = function() {
65888 items.selectAll(".preset-input-access").node().focus();
65890 return utilRebind(access, dispatch14, "on");
65893 // modules/ui/fields/address.js
65894 function uiFieldAddress(field, context) {
65895 var dispatch14 = dispatch_default("change");
65896 var _selection = select_default2(null);
65897 var _wrap = select_default2(null);
65898 var addrField = _mainPresetIndex.field("address");
65899 var _entityIDs = [];
65902 var _addressFormats = [{
65904 ["housenumber", "street"],
65905 ["city", "postcode"]
65908 _mainFileFetcher.get("address_formats").then(function(d2) {
65909 _addressFormats = d2;
65910 if (!_selection.empty()) {
65911 _selection.call(address);
65913 }).catch(function() {
65915 function getNear(isAddressable, type2, searchRadius, resultProp) {
65916 var extent = combinedEntityExtent();
65917 var l2 = extent.center();
65918 var box = geoExtent(l2).padByMeters(searchRadius);
65919 var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
65920 let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
65921 if (d2.geometry(context.graph()) === "line") {
65922 var loc = context.projection([
65923 (extent[0][0] + extent[1][0]) / 2,
65924 (extent[0][1] + extent[1][1]) / 2
65926 var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
65927 dist = geoSphericalDistance(choice.loc, l2);
65929 const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
65931 if (type2 === "street") {
65932 title = "".concat(addrField.t("placeholders.street"), ": ").concat(title);
65933 } else if (type2 === "place") {
65934 title = "".concat(addrField.t("placeholders.place"), ": ").concat(title);
65941 klass: "address-".concat(type2)
65943 }).sort(function(a2, b2) {
65944 return a2.dist - b2.dist;
65946 return utilArrayUniqBy(features, "value");
65948 function getNearStreets() {
65949 function isAddressable(d2) {
65950 return d2.tags.highway && d2.tags.name && d2.type === "way";
65952 return getNear(isAddressable, "street", 200);
65954 function getNearPlaces() {
65955 function isAddressable(d2) {
65956 if (d2.tags.name) {
65959 if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8)
65964 return getNear(isAddressable, "place", 200);
65966 function getNearCities() {
65967 function isAddressable(d2) {
65968 if (d2.tags.name) {
65969 if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8")
65971 if (d2.tags.border_type === "city")
65973 if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village")
65976 if (d2.tags["".concat(field.key, ":city")])
65980 return getNear(isAddressable, "city", 200, "".concat(field.key, ":city"));
65982 function getNearPostcodes() {
65983 return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
65985 function getNearValues(key) {
65986 const tagKey = "".concat(field.key, ":").concat(key);
65987 function hasTag(d2) {
65988 return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
65990 return getNear(hasTag, key, 200, tagKey);
65992 function updateForCountryCode() {
65996 for (var i3 = 0; i3 < _addressFormats.length; i3++) {
65997 var format2 = _addressFormats[i3];
65998 if (!format2.countryCodes) {
65999 addressFormat = format2;
66000 } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
66001 addressFormat = format2;
66005 var dropdowns = addressFormat.dropdowns || [
66022 var widths = addressFormat.widths || {
66023 housenumber: 1 / 5,
66032 var total = r2.reduce(function(sum, key) {
66033 return sum + (widths[key] || 0.5);
66035 return r2.map(function(key) {
66038 width: (widths[key] || 0.5) / total
66042 var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
66043 return d2.toString();
66045 rows.exit().remove();
66046 rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
66047 return "addr-" + d2.id;
66048 }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
66049 return d2.width * 100 + "%";
66051 function addDropdown(d2) {
66052 if (dropdowns.indexOf(d2.id) === -1)
66057 nearValues = getNearStreets;
66060 nearValues = getNearPlaces;
66062 case "street+place":
66063 nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
66064 d2.isAutoStreetPlace = true;
66065 d2.id = _tags["".concat(field.key, ":place")] ? "place" : "street";
66068 nearValues = getNearCities;
66071 nearValues = getNearPostcodes;
66074 nearValues = getNearValues;
66076 select_default2(this).call(
66077 uiCombobox(context, "address-".concat(d2.isAutoStreetPlace ? "street-place" : d2.id)).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
66078 typedValue = typedValue.toLowerCase();
66079 callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
66080 }).on("accept", function(selected) {
66081 if (d2.isAutoStreetPlace) {
66082 d2.id = selected ? selected.type : "street";
66087 _wrap.selectAll("input").on("blur", change()).on("change", change());
66088 _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
66092 function address(selection2) {
66093 _selection = selection2;
66094 _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
66095 _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
66096 var extent = combinedEntityExtent();
66099 if (context.inIntro()) {
66100 countryCode = _t("intro.graph.countrycode");
66102 var center = extent.center();
66103 countryCode = iso1A2Code(center);
66106 _countryCode = countryCode.toLowerCase();
66107 updateForCountryCode();
66111 function change(onInput) {
66112 return function() {
66115 _wrap.selectAll("input").each(function(subfield) {
66116 var key = field.key + ":" + subfield.id;
66117 var value = this.value;
66119 value = context.cleanTagValue(value);
66120 if (Array.isArray(_tags[key]) && !value)
66122 if (subfield.isAutoStreetPlace) {
66123 if (subfield.id === "street") {
66124 tags["".concat(field.key, ":place")] = void 0;
66125 } else if (subfield.id === "place") {
66126 tags["".concat(field.key, ":street")] = void 0;
66129 tags[key] = value || void 0;
66131 Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
66132 dispatch14.call("change", this, tags, onInput);
66136 function updatePlaceholder(inputSelection) {
66137 return inputSelection.attr("placeholder", function(subfield) {
66138 if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
66139 return _t("inspector.multiple_values");
66141 if (subfield.isAutoStreetPlace) {
66142 return "".concat(getLocalPlaceholder("street"), " / ").concat(getLocalPlaceholder("place"));
66144 return getLocalPlaceholder(subfield.id);
66147 function getLocalPlaceholder(key) {
66148 if (_countryCode) {
66149 var localkey = key + "!" + _countryCode;
66150 var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
66151 return addrField.t("placeholders." + tkey);
66154 function updateTags(tags) {
66155 utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
66157 if (subfield.isAutoStreetPlace) {
66158 const streetKey = "".concat(field.key, ":street");
66159 const placeKey = "".concat(field.key, ":place");
66160 if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
66161 val = tags[streetKey];
66162 subfield.id = "street";
66164 val = tags[placeKey];
66165 subfield.id = "place";
66168 val = tags["".concat(field.key, ":").concat(subfield.id)];
66170 return typeof val === "string" ? val : "";
66171 }).attr("title", function(subfield) {
66172 var val = tags[field.key + ":" + subfield.id];
66173 return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
66174 }).classed("mixed", function(subfield) {
66175 return Array.isArray(tags[field.key + ":" + subfield.id]);
66176 }).call(updatePlaceholder);
66178 function combinedEntityExtent() {
66179 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
66181 address.entityIDs = function(val) {
66182 if (!arguments.length)
66187 address.tags = function(tags) {
66191 address.focus = function() {
66192 var node = _wrap.selectAll("input").node();
66196 return utilRebind(address, dispatch14, "on");
66199 // modules/ui/fields/directional_combo.js
66200 function uiFieldDirectionalCombo(field, context) {
66201 var dispatch14 = dispatch_default("change");
66202 var items = select_default2(null);
66203 var wrap2 = select_default2(null);
66206 if (field.type === "cycleway") {
66209 key: field.keys[0],
66210 keys: field.keys.slice(1)
66213 function directionalCombo(selection2) {
66214 function stripcolon(s2) {
66215 return s2.replace(":", "");
66217 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66218 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
66219 var div = wrap2.selectAll("ul").data([0]);
66220 div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
66221 items = div.selectAll("li").data(field.keys);
66222 var enter = items.enter().append("li").attr("class", function(d2) {
66223 return "labeled-input preset-directionalcombo-" + stripcolon(d2);
66225 enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
66226 return "preset-input-directionalcombo-" + stripcolon(d2);
66227 }).html(function(d2) {
66228 return field.t.html("types." + d2);
66230 enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
66236 const combo = uiFieldCombo(subField, context);
66237 combo.on("change", (t2) => change(key, t2[key]));
66238 _combos[key] = combo;
66239 select_default2(this).call(combo);
66241 items = items.merge(enter);
66242 wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
66244 function change(key, newValue) {
66245 const commonKey = field.key;
66246 const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
66247 dispatch14.call("change", this, (tags) => {
66248 const otherValue = tags[otherKey] || tags[commonKey];
66249 if (newValue === otherValue) {
66250 tags[commonKey] = newValue;
66252 delete tags[otherKey];
66254 tags[key] = newValue;
66255 delete tags[commonKey];
66256 tags[otherKey] = otherValue;
66261 directionalCombo.tags = function(tags) {
66263 const commonKey = field.key;
66264 for (let key in _combos) {
66265 const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
66266 _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
66269 directionalCombo.focus = function() {
66270 var node = wrap2.selectAll("input").node();
66274 return utilRebind(directionalCombo, dispatch14, "on");
66277 // modules/ui/fields/lanes.js
66278 function uiFieldLanes(field, context) {
66279 var dispatch14 = dispatch_default("change");
66280 var LANE_WIDTH = 40;
66281 var LANE_HEIGHT = 200;
66282 var _entityIDs = [];
66283 function lanes(selection2) {
66284 var lanesData = context.entity(_entityIDs[0]).lanes();
66285 if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
66286 selection2.call(lanes.off);
66289 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66290 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
66291 var surface = wrap2.selectAll(".surface").data([0]);
66292 var d2 = utilGetDimensions(wrap2);
66293 var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
66294 surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
66295 var lanesSelection = surface.selectAll(".lanes").data([0]);
66296 lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
66297 lanesSelection.attr("transform", function() {
66298 return "translate(" + freeSpace / 2 + ", 0)";
66300 var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
66301 lane.exit().remove();
66302 var enter = lane.enter().append("g").attr("class", "lane");
66303 enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
66304 enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
66305 enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
66306 enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
66307 lane = lane.merge(enter);
66308 lane.attr("transform", function(d4) {
66309 return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
66311 lane.select(".forward").style("visibility", function(d4) {
66312 return d4.direction === "forward" ? "visible" : "hidden";
66314 lane.select(".bothways").style("visibility", function(d4) {
66315 return d4.direction === "bothways" ? "visible" : "hidden";
66317 lane.select(".backward").style("visibility", function(d4) {
66318 return d4.direction === "backward" ? "visible" : "hidden";
66321 lanes.entityIDs = function(val) {
66324 lanes.tags = function() {
66326 lanes.focus = function() {
66328 lanes.off = function() {
66330 return utilRebind(lanes, dispatch14, "on");
66332 uiFieldLanes.supportsMultiselection = false;
66334 // modules/ui/fields/localized.js
66335 var _languagesArray = [];
66336 function uiFieldLocalized(field, context) {
66337 var dispatch14 = dispatch_default("change", "input");
66338 var wikipedia = services.wikipedia;
66339 var input = select_default2(null);
66340 var localizedInputs = select_default2(null);
66341 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
66344 _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
66346 var _territoryLanguages = {};
66347 _mainFileFetcher.get("territory_languages").then(function(d2) {
66348 _territoryLanguages = d2;
66349 }).catch(function() {
66351 var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
66352 var _selection = select_default2(null);
66353 var _multilingual = [];
66354 var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
66356 var _entityIDs = [];
66357 function loadLanguagesArray(dataLanguages) {
66358 if (_languagesArray.length !== 0)
66360 var replacements = {
66362 // in OSM, `sr` implies Cyrillic
66364 // `sr-Cyrl` isn't used in OSM
66366 for (var code in dataLanguages) {
66367 if (replacements[code] === false)
66369 var metaCode = code;
66370 if (replacements[code])
66371 metaCode = replacements[code];
66372 _languagesArray.push({
66373 localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
66374 nativeName: dataLanguages[metaCode].nativeName,
66376 label: _mainLocalizer.languageName(metaCode)
66380 function calcLocked() {
66381 var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
66382 var entity = context.graph().hasEntity(entityID);
66385 if (entity.tags.wikidata)
66387 if (entity.tags["name:etymology:wikidata"])
66389 var preset = _mainPresetIndex.match(entity, context.graph());
66391 var isSuggestion = preset.suggestion;
66392 var fields = preset.fields(entity.extent(context.graph()).center());
66393 var showsBrandField = fields.some(function(d2) {
66394 return d2.id === "brand";
66396 var showsOperatorField = fields.some(function(d2) {
66397 return d2.id === "operator";
66399 var setsName = preset.addTags.name;
66400 var setsBrandWikidata = preset.addTags["brand:wikidata"];
66401 var setsOperatorWikidata = preset.addTags["operator:wikidata"];
66402 return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
66406 field.locked(isLocked);
66408 function calcMultilingual(tags) {
66409 var existingLangsOrdered = _multilingual.map(function(item2) {
66412 var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
66413 for (var k2 in tags) {
66414 var m2 = k2.match(/^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/);
66415 if (m2 && m2[1] === field.key && m2[2]) {
66416 var item = { lang: m2[2], value: tags[k2] };
66417 if (existingLangs.has(item.lang)) {
66418 _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
66419 existingLangs.delete(item.lang);
66421 _multilingual.push(item);
66425 _multilingual.forEach(function(item2) {
66426 if (item2.lang && existingLangs.has(item2.lang)) {
66431 function localized(selection2) {
66432 _selection = selection2;
66434 var isLocked = field.locked();
66435 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66436 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
66437 input = wrap2.selectAll(".localized-main").data([0]);
66438 input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
66439 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
66440 wrap2.call(_lengthIndicator);
66441 var translateButton = wrap2.selectAll(".localized-add").data([0]);
66442 translateButton = translateButton.enter().append("button").attr("class", "localized-add form-field-button").attr("aria-label", _t("icons.plus")).call(svgIcon("#iD-icon-plus")).merge(translateButton);
66443 translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
66444 if (_tags && !_multilingual.length) {
66445 calcMultilingual(_tags);
66447 localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
66448 localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
66449 localizedInputs.call(renderMultilingual);
66450 localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
66451 selection2.selectAll(".combobox-caret").classed("nope", true);
66452 function addNew(d3_event) {
66453 d3_event.preventDefault();
66454 if (field.locked())
66456 var defaultLang = _mainLocalizer.languageCode().toLowerCase();
66457 var langExists = _multilingual.find(function(datum2) {
66458 return datum2.lang === defaultLang;
66460 var isLangEn = defaultLang.indexOf("en") > -1;
66461 if (isLangEn || langExists) {
66463 langExists = _multilingual.find(function(datum2) {
66464 return datum2.lang === defaultLang;
66468 _multilingual.unshift({ lang: defaultLang, value: "" });
66469 localizedInputs.call(renderMultilingual);
66472 function change(onInput) {
66473 return function(d3_event) {
66474 if (field.locked()) {
66475 d3_event.preventDefault();
66478 var val = utilGetSetValue(select_default2(this));
66480 val = context.cleanTagValue(val);
66481 if (!val && Array.isArray(_tags[field.key]))
66484 t2[field.key] = val || void 0;
66485 dispatch14.call("change", this, t2, onInput);
66489 function key(lang) {
66490 return field.key + ":" + lang;
66492 function changeLang(d3_event, d2) {
66494 var lang = utilGetSetValue(select_default2(this)).toLowerCase();
66495 var language = _languagesArray.find(function(d4) {
66496 return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
66499 lang = language.code;
66500 if (d2.lang && d2.lang !== lang) {
66501 tags[key(d2.lang)] = void 0;
66503 var newKey = lang && context.cleanTagKey(key(lang));
66504 var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
66505 if (newKey && value) {
66506 tags[newKey] = value;
66507 } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
66508 tags[newKey] = _wikiTitles[d2.lang];
66511 dispatch14.call("change", this, tags);
66513 function changeValue(d3_event, d2) {
66516 var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
66517 if (!value && Array.isArray(d2.value))
66520 t2[key(d2.lang)] = value;
66522 dispatch14.call("change", this, t2);
66524 function fetchLanguages(value, cb) {
66525 var v2 = value.toLowerCase();
66526 var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
66527 if (_countryCode && _territoryLanguages[_countryCode]) {
66528 langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
66530 var langItems = [];
66531 langCodes.forEach(function(code) {
66532 var langItem = _languagesArray.find(function(item) {
66533 return item.code === code;
66536 langItems.push(langItem);
66538 langItems = utilArrayUniq(langItems.concat(_languagesArray));
66539 cb(langItems.filter(function(d2) {
66540 return d2.label.toLowerCase().indexOf(v2) >= 0 || d2.localName && d2.localName.toLowerCase().indexOf(v2) >= 0 || d2.nativeName && d2.nativeName.toLowerCase().indexOf(v2) >= 0 || d2.code.toLowerCase().indexOf(v2) >= 0;
66541 }).map(function(d2) {
66542 return { value: d2.label };
66545 function renderMultilingual(selection2) {
66546 var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
66549 entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
66550 var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
66551 var wrap2 = select_default2(this);
66552 var domId = utilUniqueDomId(index);
66553 var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
66554 var text = label.append("span").attr("class", "label-text");
66555 text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
66556 text.append("span").attr("class", "label-textannotation");
66557 label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
66558 if (field.locked())
66560 d3_event.preventDefault();
66561 _multilingual.splice(_multilingual.indexOf(d2), 1);
66562 var langKey = d2.lang && key(d2.lang);
66563 if (langKey && langKey in _tags) {
66564 delete _tags[langKey];
66566 t2[langKey] = void 0;
66567 dispatch14.call("change", this, t2);
66570 renderMultilingual(selection2);
66571 }).call(svgIcon("#iD-operation-delete"));
66572 wrap2.append("input").attr("class", "localized-lang").attr("id", domId).attr("type", "text").attr("placeholder", _t("translate.localized_translation_language")).on("blur", changeLang).on("change", changeLang).call(langCombo);
66573 wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
66575 entriesEnter.style("margin-top", "0px").style("max-height", "0px").style("opacity", "0").transition().duration(200).style("margin-top", "10px").style("max-height", "240px").style("opacity", "1").on("end", function() {
66576 select_default2(this).style("max-height", "").style("overflow", "visible");
66578 entries = entries.merge(entriesEnter);
66580 entries.classed("present", true);
66581 utilGetSetValue(entries.select(".localized-lang"), function(d2) {
66582 var langItem = _languagesArray.find(function(item) {
66583 return item.code === d2.lang;
66586 return langItem.label;
66589 utilGetSetValue(entries.select(".localized-value"), function(d2) {
66590 return typeof d2.value === "string" ? d2.value : "";
66591 }).attr("title", function(d2) {
66592 return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
66593 }).attr("placeholder", function(d2) {
66594 return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
66595 }).classed("mixed", function(d2) {
66596 return Array.isArray(d2.value);
66599 localized.tags = function(tags) {
66601 if (typeof tags.wikipedia === "string" && !_wikiTitles) {
66603 var wm = tags.wikipedia.match(/([^:]+):(.+)/);
66604 if (wm && wm[0] && wm[1]) {
66605 wikipedia.translations(wm[1], wm[2], function(err, d2) {
66612 var isMixed = Array.isArray(tags[field.key]);
66613 utilGetSetValue(input, typeof tags[field.key] === "string" ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
66614 calcMultilingual(tags);
66615 _selection.call(localized);
66617 _lengthIndicator.update(tags[field.key]);
66620 localized.focus = function() {
66621 input.node().focus();
66623 localized.entityIDs = function(val) {
66624 if (!arguments.length)
66627 _multilingual = [];
66631 function loadCountryCode() {
66632 var extent = combinedEntityExtent();
66633 var countryCode = extent && iso1A2Code(extent.center());
66634 _countryCode = countryCode && countryCode.toLowerCase();
66636 function combinedEntityExtent() {
66637 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
66639 return utilRebind(localized, dispatch14, "on");
66642 // modules/ui/fields/roadheight.js
66643 function uiFieldRoadheight(field, context) {
66644 var dispatch14 = dispatch_default("change");
66645 var primaryUnitInput = select_default2(null);
66646 var primaryInput = select_default2(null);
66647 var secondaryInput = select_default2(null);
66648 var secondaryUnitInput = select_default2(null);
66649 var _entityIDs = [];
66652 var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
66653 var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
66654 var primaryUnits = [
66657 title: _t("inspector.roadheight.meter")
66661 title: _t("inspector.roadheight.foot")
66664 var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
66665 function roadheight(selection2) {
66666 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66667 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
66668 primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
66669 primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
66670 primaryInput.on("change", change).on("blur", change);
66671 var loc = combinedEntityExtent().center();
66672 _isImperial = roadHeightUnit(loc) === "ft";
66673 primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
66674 primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
66675 primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
66676 secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
66677 secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
66678 secondaryInput.on("change", change).on("blur", change);
66679 secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
66680 secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
66681 function changeUnits() {
66682 var primaryUnit = utilGetSetValue(primaryUnitInput);
66683 if (primaryUnit === "m") {
66684 _isImperial = false;
66685 } else if (primaryUnit === "ft") {
66686 _isImperial = true;
66688 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
66689 setUnitSuggestions();
66693 function setUnitSuggestions() {
66694 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
66696 function change() {
66698 var primaryValue = utilGetSetValue(primaryInput).trim();
66699 var secondaryValue = utilGetSetValue(secondaryInput).trim();
66700 if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key]))
66702 if (!primaryValue && !secondaryValue) {
66703 tag2[field.key] = void 0;
66705 var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
66706 if (isNaN(rawPrimaryValue))
66707 rawPrimaryValue = primaryValue;
66708 var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
66709 if (isNaN(rawSecondaryValue))
66710 rawSecondaryValue = secondaryValue;
66711 if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
66712 tag2[field.key] = context.cleanTagValue(rawPrimaryValue);
66714 if (rawPrimaryValue !== "") {
66715 rawPrimaryValue = rawPrimaryValue + "'";
66717 if (rawSecondaryValue !== "") {
66718 rawSecondaryValue = rawSecondaryValue + '"';
66720 tag2[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
66723 dispatch14.call("change", this, tag2);
66725 roadheight.tags = function(tags) {
66727 var primaryValue = tags[field.key];
66728 var secondaryValue;
66729 var isMixed = Array.isArray(primaryValue);
66731 if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
66732 secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
66733 if (secondaryValue !== null) {
66734 secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
66736 primaryValue = primaryValue.match(/(-?[\d.]+)'/);
66737 if (primaryValue !== null) {
66738 primaryValue = formatFloat(parseFloat(primaryValue[1]));
66740 _isImperial = true;
66741 } else if (primaryValue) {
66742 var rawValue = primaryValue;
66743 primaryValue = parseFloat(rawValue);
66744 if (isNaN(primaryValue)) {
66745 primaryValue = rawValue;
66747 primaryValue = formatFloat(primaryValue);
66749 _isImperial = false;
66752 setUnitSuggestions();
66753 var inchesPlaceholder = formatFloat(0);
66754 utilGetSetValue(primaryInput, typeof primaryValue === "string" ? primaryValue : "").attr("title", isMixed ? primaryValue.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : _t("inspector.unknown")).classed("mixed", isMixed);
66755 utilGetSetValue(secondaryInput, typeof secondaryValue === "string" ? secondaryValue : "").attr("placeholder", isMixed ? _t("inspector.multiple_values") : _isImperial ? inchesPlaceholder : null).classed("mixed", isMixed).classed("disabled", !_isImperial).attr("readonly", _isImperial ? null : "readonly");
66756 secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
66758 roadheight.focus = function() {
66759 primaryInput.node().focus();
66761 roadheight.entityIDs = function(val) {
66764 function combinedEntityExtent() {
66765 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
66767 return utilRebind(roadheight, dispatch14, "on");
66770 // modules/ui/fields/roadspeed.js
66771 function uiFieldRoadspeed(field, context) {
66772 var dispatch14 = dispatch_default("change");
66773 var unitInput = select_default2(null);
66774 var input = select_default2(null);
66775 var _entityIDs = [];
66778 var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
66779 var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
66780 var speedCombo = uiCombobox(context, "roadspeed");
66781 var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
66782 var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
66783 var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
66784 function roadspeed(selection2) {
66785 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66786 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
66787 input = wrap2.selectAll("input.roadspeed-number").data([0]);
66788 input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
66789 input.on("change", change).on("blur", change);
66790 var loc = combinedEntityExtent().center();
66791 _isImperial = roadSpeedUnit(loc) === "mph";
66792 unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
66793 unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
66794 unitInput.on("blur", changeUnits).on("change", changeUnits);
66795 function changeUnits() {
66796 var unit2 = utilGetSetValue(unitInput);
66797 if (unit2 === "km/h") {
66798 _isImperial = false;
66799 } else if (unit2 === "mph") {
66800 _isImperial = true;
66802 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
66803 setUnitSuggestions();
66807 function setUnitSuggestions() {
66808 speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
66809 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
66811 function comboValues(d2) {
66813 value: formatFloat(d2),
66814 title: formatFloat(d2)
66817 function change() {
66819 var value = utilGetSetValue(input).trim();
66820 if (!value && Array.isArray(_tags[field.key]))
66823 tag2[field.key] = void 0;
66825 var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
66826 if (isNaN(rawValue))
66828 if (isNaN(rawValue) || !_isImperial) {
66829 tag2[field.key] = context.cleanTagValue(rawValue);
66831 tag2[field.key] = context.cleanTagValue(rawValue + " mph");
66834 dispatch14.call("change", this, tag2);
66836 roadspeed.tags = function(tags) {
66838 var rawValue = tags[field.key];
66839 var value = rawValue;
66840 var isMixed = Array.isArray(value);
66842 if (rawValue && rawValue.indexOf("mph") >= 0) {
66843 _isImperial = true;
66844 } else if (rawValue) {
66845 _isImperial = false;
66847 value = parseInt(value, 10);
66848 if (isNaN(value)) {
66851 value = formatFloat(value);
66854 setUnitSuggestions();
66855 utilGetSetValue(input, typeof value === "string" ? value : "").attr("title", isMixed ? value.filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder()).classed("mixed", isMixed);
66857 roadspeed.focus = function() {
66858 input.node().focus();
66860 roadspeed.entityIDs = function(val) {
66863 function combinedEntityExtent() {
66864 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
66866 return utilRebind(roadspeed, dispatch14, "on");
66869 // modules/ui/fields/radio.js
66870 function uiFieldRadio(field, context) {
66871 var dispatch14 = dispatch_default("change");
66872 var placeholder = select_default2(null);
66873 var wrap2 = select_default2(null);
66874 var labels = select_default2(null);
66875 var radios = select_default2(null);
66876 var radioData = (field.options || field.keys).slice();
66880 var _entityIDs = [];
66881 function selectedKey() {
66882 var node = wrap2.selectAll(".form-field-input-radio label.active input");
66883 return !node.empty() && node.datum();
66885 function radio(selection2) {
66886 selection2.classed("preset-radio", true);
66887 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
66888 var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
66889 enter.append("span").attr("class", "placeholder");
66890 wrap2 = wrap2.merge(enter);
66891 placeholder = wrap2.selectAll(".placeholder");
66892 labels = wrap2.selectAll("label").data(radioData);
66893 enter = labels.enter().append("label");
66894 var stringsField = field.resolveReference("stringsCrossReference");
66895 enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
66896 return stringsField.t("options." + d2, { "default": d2 });
66897 }).attr("checked", false);
66898 enter.append("span").each(function(d2) {
66899 stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
66901 labels = labels.merge(enter);
66902 radios = labels.selectAll("input").on("change", changeRadio);
66904 function structureExtras(selection2, tags) {
66905 var selected = selectedKey() || tags.layer !== void 0;
66906 var type2 = _mainPresetIndex.field(selected);
66907 var layer = _mainPresetIndex.field("layer");
66908 var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
66909 var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
66910 extrasWrap.exit().remove();
66911 extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
66912 var list2 = extrasWrap.selectAll("ul").data([0]);
66913 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
66915 if (!typeField || typeField.id !== selected) {
66916 typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
66918 typeField.tags(tags);
66922 var typeItem = list2.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
66925 typeItem.exit().remove();
66926 var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
66927 typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
66928 typeEnter.append("div").attr("class", "structure-input-type-wrap");
66929 typeItem = typeItem.merge(typeEnter);
66931 typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
66933 if (layer && showLayer) {
66935 layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
66937 layerField.tags(tags);
66938 field.keys = utilArrayUnion(field.keys, ["layer"]);
66941 field.keys = field.keys.filter(function(k2) {
66942 return k2 !== "layer";
66945 var layerItem = list2.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
66946 layerItem.exit().remove();
66947 var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
66948 layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
66949 layerEnter.append("div").attr("class", "structure-input-layer-wrap");
66950 layerItem = layerItem.merge(layerEnter);
66952 layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
66955 function changeType(t2, onInput) {
66956 var key = selectedKey();
66960 if (val !== "no") {
66961 _oldType[key] = val;
66963 if (field.type === "structureRadio") {
66964 if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
66967 if (t2.layer === void 0) {
66968 if (key === "bridge" && val !== "no") {
66971 if (key === "tunnel" && val !== "no" && val !== "building_passage") {
66976 dispatch14.call("change", this, t2, onInput);
66978 function changeLayer(t2, onInput) {
66979 if (t2.layer === "0") {
66982 dispatch14.call("change", this, t2, onInput);
66984 function changeRadio() {
66988 t2[field.key] = void 0;
66990 radios.each(function(d2) {
66991 var active = select_default2(this).property("checked");
66996 t2[field.key] = d2;
66998 var val = _oldType[activeKey] || "yes";
66999 t2[d2] = active ? val : void 0;
67002 if (field.type === "structureRadio") {
67003 if (activeKey === "bridge") {
67005 } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
67011 dispatch14.call("change", this, t2);
67013 radio.tags = function(tags) {
67014 function isOptionChecked(d2) {
67016 return tags[field.key] === d2;
67018 return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
67020 function isMixed(d2) {
67022 return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
67024 return Array.isArray(tags[d2]);
67026 radios.property("checked", function(d2) {
67027 return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
67029 labels.classed("active", function(d2) {
67031 return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
67033 return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
67034 }).classed("mixed", isMixed).attr("title", function(d2) {
67035 return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
67037 var selection2 = radios.filter(function() {
67038 return this.checked;
67040 if (selection2.empty()) {
67041 placeholder.text("");
67042 placeholder.call(_t.append("inspector.none"));
67044 placeholder.text(selection2.attr("value"));
67045 _oldType[selection2.datum()] = tags[selection2.datum()];
67047 if (field.type === "structureRadio") {
67048 if (!!tags.waterway && !_oldType.tunnel) {
67049 _oldType.tunnel = "culvert";
67051 wrap2.call(structureExtras, tags);
67054 radio.focus = function() {
67055 radios.node().focus();
67057 radio.entityIDs = function(val) {
67058 if (!arguments.length)
67064 radio.isAllowed = function() {
67065 return _entityIDs.length === 1;
67067 return utilRebind(radio, dispatch14, "on");
67070 // modules/ui/fields/restrictions.js
67071 function uiFieldRestrictions(field, context) {
67072 var dispatch14 = dispatch_default("change");
67073 var breathe = behaviorBreathe(context);
67074 corePreferences("turn-restriction-via-way", null);
67075 var storedViaWay = corePreferences("turn-restriction-via-way0");
67076 var storedDistance = corePreferences("turn-restriction-distance");
67077 var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
67078 var _maxDistance = storedDistance ? +storedDistance : 30;
67079 var _initialized3 = false;
67080 var _parent = select_default2(null);
67081 var _container = select_default2(null);
67088 function restrictions(selection2) {
67089 _parent = selection2;
67090 if (_vertexID && (context.graph() !== _graph || !_intersection)) {
67091 _graph = context.graph();
67092 _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
67094 var isOK = _intersection && _intersection.vertices.length && // has vertices
67095 _intersection.vertices.filter(function(vertex) {
67096 return vertex.id === _vertexID;
67097 }).length && _intersection.ways.length > 2;
67098 select_default2(selection2.node().parentNode).classed("hide", !isOK);
67099 if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
67100 selection2.call(restrictions.off);
67103 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
67104 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
67105 var container = wrap2.selectAll(".restriction-container").data([0]);
67106 var containerEnter = container.enter().append("div").attr("class", "restriction-container");
67107 containerEnter.append("div").attr("class", "restriction-help");
67108 _container = containerEnter.merge(container).call(renderViewer);
67109 var controls = wrap2.selectAll(".restriction-controls").data([0]);
67110 controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
67112 function renderControls(selection2) {
67113 var distControl = selection2.selectAll(".restriction-distance").data([0]);
67114 distControl.exit().remove();
67115 var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
67116 distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
67117 distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
67118 distControlEnter.append("span").attr("class", "restriction-distance-text");
67119 selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
67120 var val = select_default2(this).property("value");
67121 _maxDistance = +val;
67122 _intersection = null;
67123 _container.selectAll(".layer-osm .layer-turns *").remove();
67124 corePreferences("turn-restriction-distance", _maxDistance);
67125 _parent.call(restrictions);
67127 selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
67128 var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
67129 viaControl.exit().remove();
67130 var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
67131 viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
67132 viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
67133 viaControlEnter.append("span").attr("class", "restriction-via-way-text");
67134 selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
67135 var val = select_default2(this).property("value");
67137 _container.selectAll(".layer-osm .layer-turns *").remove();
67138 corePreferences("turn-restriction-via-way0", _maxViaWay);
67139 _parent.call(restrictions);
67141 selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
67143 function renderViewer(selection2) {
67144 if (!_intersection)
67146 var vgraph = _intersection.graph;
67147 var filter2 = utilFunctor(true);
67148 var projection2 = geoRawMercator();
67149 var sdims = utilGetDimensions(context.container().select(".sidebar"));
67150 var d2 = [sdims[0] - 50, 370];
67151 var c2 = geoVecScale(d2, 0.5);
67153 projection2.scale(geoZoomToScale(z2));
67154 var extent = geoExtent();
67155 for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
67156 extent._extend(_intersection.vertices[i3].extent());
67159 if (_intersection.vertices.length > 1) {
67160 var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
67161 var vPadding = 160;
67162 var tl = projection2([extent[0][0], extent[1][1]]);
67163 var br2 = projection2([extent[1][0], extent[0][1]]);
67164 var hFactor = (br2[0] - tl[0]) / (d2[0] - hPadding);
67165 var vFactor = (br2[1] - tl[1]) / (d2[1] - vPadding - padTop);
67166 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
67167 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
67168 z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
67169 projection2.scale(geoZoomToScale(z2));
67171 var extentCenter = projection2(extent.center());
67172 extentCenter[1] = extentCenter[1] - padTop / 2;
67173 projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
67174 var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
67175 var drawVertices = svgVertices(projection2, context);
67176 var drawLines = svgLines(projection2, context);
67177 var drawTurns = svgTurns(projection2, context);
67178 var firstTime = selection2.selectAll(".surface").empty();
67179 selection2.call(drawLayers);
67180 var surface = selection2.selectAll(".surface").classed("tr", true);
67182 _initialized3 = true;
67183 surface.call(breathe);
67185 if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
67189 surface.call(utilSetDimensions, d2).call(drawVertices, vgraph, _intersection.vertices, filter2, extent, z2).call(drawLines, vgraph, _intersection.ways, filter2).call(drawTurns, vgraph, _intersection.turns(_fromWayID, _maxViaWay));
67190 surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
67191 surface.selectAll(".selected").classed("selected", false);
67192 surface.selectAll(".related").classed("related", false);
67195 way = vgraph.entity(_fromWayID);
67196 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
67198 document.addEventListener("resizeWindow", function() {
67199 utilSetDimensions(_container, null);
67203 function click(d3_event) {
67204 surface.call(breathe.off).call(breathe);
67205 var datum2 = d3_event.target.__data__;
67206 var entity = datum2 && datum2.properties && datum2.properties.entity;
67210 if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
67211 _fromWayID = datum2.id;
67214 } else if (datum2 instanceof osmTurn) {
67215 var actions, extraActions, turns, i4;
67216 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
67217 if (datum2.restrictionID && !datum2.direct) {
67219 } else if (datum2.restrictionID && !datum2.only) {
67221 var datumOnly = JSON.parse(JSON.stringify(datum2));
67222 datumOnly.only = true;
67223 restrictionType = restrictionType.replace(/^no/, "only");
67224 turns = _intersection.turns(_fromWayID, 2);
67227 for (i4 = 0; i4 < turns.length; i4++) {
67228 var turn = turns[i4];
67229 if (seen[turn.restrictionID])
67231 if (turn.direct && turn.path[1] === datum2.path[1]) {
67232 seen[turns[i4].restrictionID] = true;
67233 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
67234 _oldTurns.push(turn);
67235 extraActions.push(actionUnrestrictTurn(turn));
67238 actions = _intersection.actions.concat(extraActions, [
67239 actionRestrictTurn(datumOnly, restrictionType),
67240 _t("operations.restriction.annotation.create")
67242 } else if (datum2.restrictionID) {
67243 turns = _oldTurns || [];
67245 for (i4 = 0; i4 < turns.length; i4++) {
67246 if (turns[i4].key !== datum2.key) {
67247 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
67251 actions = _intersection.actions.concat(extraActions, [
67252 actionUnrestrictTurn(datum2),
67253 _t("operations.restriction.annotation.delete")
67256 actions = _intersection.actions.concat([
67257 actionRestrictTurn(datum2, restrictionType),
67258 _t("operations.restriction.annotation.create")
67261 context.perform.apply(context, actions);
67262 var s2 = surface.selectAll("." + datum2.key);
67263 datum2 = s2.empty() ? null : s2.datum();
67264 updateHints(datum2);
67271 function mouseover(d3_event) {
67272 var datum2 = d3_event.target.__data__;
67273 updateHints(datum2);
67275 _lastXPos = _lastXPos || sdims[0];
67276 function redraw(minChange) {
67279 xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
67281 if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
67282 if (context.hasEntity(_vertexID)) {
67284 _container.call(renderViewer);
67288 function highlightPathsFrom(wayID) {
67289 surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
67290 surface.selectAll("." + wayID).classed("related", true);
67292 var turns = _intersection.turns(wayID, _maxViaWay);
67293 for (var i4 = 0; i4 < turns.length; i4++) {
67294 var turn = turns[i4];
67295 var ids = [turn.to.way];
67296 var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
67297 if (turn.only || turns.length === 1) {
67298 if (turn.via.ways) {
67299 ids = ids.concat(turn.via.ways);
67301 } else if (turn.to.way === wayID) {
67304 surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
67308 function updateHints(datum2) {
67309 var help = _container.selectAll(".restriction-help").html("");
67310 var placeholders = {};
67311 ["from", "via", "to"].forEach(function(k2) {
67312 placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
67314 var entity = datum2 && datum2.properties && datum2.properties.entity;
67319 way = vgraph.entity(_fromWayID);
67320 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
67322 if (datum2 instanceof osmWay && datum2.__from) {
67324 highlightPathsFrom(_fromWayID ? null : way.id);
67325 surface.selectAll("." + way.id).classed("related", true);
67326 var clickSelect = !_fromWayID || _fromWayID !== way.id;
67327 help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
67328 from: placeholders.from,
67329 fromName: displayName(way.id, vgraph)
67331 } else if (datum2 instanceof osmTurn) {
67332 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
67333 var turnType = restrictionType.replace(/^(only|no)\_/, "");
67334 var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
67335 var klass, turnText, nextText;
67337 klass = "restrict";
67338 turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
67339 nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
67340 } else if (datum2.only) {
67342 turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
67343 nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
67346 turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
67347 nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
67349 help.append("div").attr("class", "qualifier " + klass).html(turnText);
67350 help.append("div").html(_t.html("restriction.help.from_name_to_name", {
67351 from: placeholders.from,
67352 fromName: displayName(datum2.from.way, vgraph),
67353 to: placeholders.to,
67354 toName: displayName(datum2.to.way, vgraph)
67356 if (datum2.via.ways && datum2.via.ways.length) {
67358 for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
67359 var prev = names[names.length - 1];
67360 var curr = displayName(datum2.via.ways[i4], vgraph);
67361 if (!prev || curr !== prev) {
67365 help.append("div").html(_t.html("restriction.help.via_names", {
67366 via: placeholders.via,
67367 viaNames: names.join(", ")
67371 help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
67373 highlightPathsFrom(null);
67374 var alongIDs = datum2.path.slice();
67375 surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
67377 highlightPathsFrom(null);
67379 help.append("div").html(_t.html("restriction.help.from_name", {
67380 from: placeholders.from,
67381 fromName: displayName(_fromWayID, vgraph)
67384 help.append("div").html(_t.html("restriction.help.select_from", {
67385 from: placeholders.from
67391 function displayMaxDistance(maxDist) {
67392 return (selection2) => {
67393 var isImperial = !_mainLocalizer.usesMetric();
67397 // imprecise conversion for prettier display
67406 opts = { distance: _t("units.feet", { quantity: distToFeet }) };
67408 opts = { distance: _t("units.meters", { quantity: maxDist }) };
67410 return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
67413 function displayMaxVia(maxVia) {
67414 return (selection2) => {
67415 selection2 = selection2.html("");
67416 return maxVia === 0 ? selection2.call(_t.append("restriction.controls.via_node_only")) : maxVia === 1 ? selection2.call(_t.append("restriction.controls.via_up_to_one")) : selection2.call(_t.append("restriction.controls.via_up_to_two"));
67419 function displayName(entityID, graph) {
67420 var entity = graph.entity(entityID);
67421 var name = utilDisplayName(entity) || "";
67422 var matched = _mainPresetIndex.match(entity, graph);
67423 var type2 = matched && matched.name() || utilDisplayType(entity.id);
67424 return name || type2;
67426 restrictions.entityIDs = function(val) {
67427 _intersection = null;
67430 _vertexID = val[0];
67432 restrictions.tags = function() {
67434 restrictions.focus = function() {
67436 restrictions.off = function(selection2) {
67437 if (!_initialized3)
67439 selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
67440 select_default2(window).on("resize.restrictions", null);
67442 return utilRebind(restrictions, dispatch14, "on");
67444 uiFieldRestrictions.supportsMultiselection = false;
67446 // modules/ui/fields/textarea.js
67447 function uiFieldTextarea(field, context) {
67448 var dispatch14 = dispatch_default("change");
67449 var input = select_default2(null);
67450 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
67452 function textarea(selection2) {
67453 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
67454 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
67455 input = wrap2.selectAll("textarea").data([0]);
67456 input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
67457 wrap2.call(_lengthIndicator);
67458 function change(onInput) {
67459 return function() {
67460 var val = utilGetSetValue(input);
67462 val = context.cleanTagValue(val);
67463 if (!val && Array.isArray(_tags[field.key]))
67466 t2[field.key] = val || void 0;
67467 dispatch14.call("change", this, t2, onInput);
67471 textarea.tags = function(tags) {
67473 var isMixed = Array.isArray(tags[field.key]);
67474 utilGetSetValue(input, !isMixed && tags[field.key] ? tags[field.key] : "").attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : void 0).attr("placeholder", isMixed ? _t("inspector.multiple_values") : field.placeholder() || _t("inspector.unknown")).classed("mixed", isMixed);
67476 _lengthIndicator.update(tags[field.key]);
67479 textarea.focus = function() {
67480 input.node().focus();
67482 return utilRebind(textarea, dispatch14, "on");
67485 // modules/ui/fields/wikidata.js
67486 function uiFieldWikidata(field, context) {
67487 var wikidata = services.wikidata;
67488 var dispatch14 = dispatch_default("change");
67489 var _selection = select_default2(null);
67490 var _searchInput = select_default2(null);
67492 var _wikidataEntity = null;
67494 var _entityIDs = [];
67495 var _wikipediaKey = field.keys && field.keys.find(function(key) {
67496 return key.includes("wikipedia");
67498 var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
67499 var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
67500 function wiki(selection2) {
67501 _selection = selection2;
67502 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
67503 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
67504 var list2 = wrap2.selectAll("ul").data([0]);
67505 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
67506 var searchRow = list2.selectAll("li.wikidata-search").data([0]);
67507 var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
67508 searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
67509 var node = select_default2(this).node();
67510 node.setSelectionRange(0, node.value.length);
67511 }).on("blur", function() {
67512 setLabelForEntity();
67513 }).call(combobox.fetcher(fetchWikidataItems));
67514 combobox.on("accept", function(d2) {
67519 }).on("cancel", function() {
67520 setLabelForEntity();
67522 searchRowEnter.append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain: "wikidata.org" })).call(svgIcon("#iD-icon-out-link")).on("click", function(d3_event) {
67523 d3_event.preventDefault();
67525 window.open(_wikiURL, "_blank");
67527 searchRow = searchRow.merge(searchRowEnter);
67528 _searchInput = searchRow.select("input");
67529 var wikidataProperties = ["description", "identifier"];
67530 var items = list2.selectAll("li.labeled-input").data(wikidataProperties);
67531 var enter = items.enter().append("li").attr("class", function(d2) {
67532 return "labeled-input preset-wikidata-" + d2;
67534 enter.append("div").attr("class", "label").html(function(d2) {
67535 return _t.html("wikidata." + d2);
67537 enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
67538 enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
67539 d3_event.preventDefault();
67540 select_default2(this.parentNode).select("input").node().select();
67541 document.execCommand("copy");
67544 function fetchWikidataItems(q2, callback) {
67545 if (!q2 && _hintKey) {
67546 for (var i3 in _entityIDs) {
67547 var entity = context.hasEntity(_entityIDs[i3]);
67548 if (entity.tags[_hintKey]) {
67549 q2 = entity.tags[_hintKey];
67554 wikidata.itemsForSearchQuery(q2, function(err, data) {
67556 if (err !== "No query")
67557 console.error(err);
67560 var result = data.map(function(item) {
67563 value: item.display.label.value + " (" + item.id + ")",
67564 display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
67565 title: item.display.description && item.display.description.value,
67566 terms: item.aliases
67573 function change() {
67575 syncTags[field.key] = _qid;
67576 dispatch14.call("change", this, syncTags);
67577 var initGraph = context.graph();
67578 var initEntityIDs = _entityIDs;
67579 wikidata.entityByQID(_qid, function(err, entity) {
67582 if (context.graph() !== initGraph)
67584 if (!entity.sitelinks)
67586 var langs = wikidata.languagesToQuery();
67587 ["labels", "descriptions"].forEach(function(key) {
67590 var valueLangs = Object.keys(entity[key]);
67591 if (valueLangs.length === 0)
67593 var valueLang = valueLangs[0];
67594 if (langs.indexOf(valueLang) === -1) {
67595 langs.push(valueLang);
67598 var newWikipediaValue;
67599 if (_wikipediaKey) {
67600 var foundPreferred;
67601 for (var i3 in langs) {
67602 var lang = langs[i3];
67603 var siteID = lang.replace("-", "_") + "wiki";
67604 if (entity.sitelinks[siteID]) {
67605 foundPreferred = true;
67606 newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
67610 if (!foundPreferred) {
67611 var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
67612 return site.endsWith("wiki");
67614 if (wikiSiteKeys.length === 0) {
67615 newWikipediaValue = null;
67617 var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
67618 var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
67619 newWikipediaValue = wikiLang + ":" + wikiTitle;
67623 if (newWikipediaValue) {
67624 newWikipediaValue = context.cleanTagValue(newWikipediaValue);
67626 if (typeof newWikipediaValue === "undefined")
67628 var actions = initEntityIDs.map(function(entityID) {
67629 var entity2 = context.hasEntity(entityID);
67632 var currTags = Object.assign({}, entity2.tags);
67633 if (newWikipediaValue === null) {
67634 if (!currTags[_wikipediaKey])
67636 delete currTags[_wikipediaKey];
67638 currTags[_wikipediaKey] = newWikipediaValue;
67640 return actionChangeTags(entityID, currTags);
67641 }).filter(Boolean);
67642 if (!actions.length)
67645 function actionUpdateWikipediaTags(graph) {
67646 actions.forEach(function(action) {
67647 graph = action(graph);
67651 context.history().undoAnnotation()
67655 function setLabelForEntity() {
67657 if (_wikidataEntity) {
67658 label = entityPropertyForDisplay(_wikidataEntity, "labels");
67659 if (label.length === 0) {
67660 label = _wikidataEntity.id.toString();
67663 utilGetSetValue(_searchInput, label);
67665 wiki.tags = function(tags) {
67666 var isMixed = Array.isArray(tags[field.key]);
67667 _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
67668 _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
67669 if (!/^Q[0-9]*$/.test(_qid)) {
67673 _wikiURL = "https://wikidata.org/wiki/" + _qid;
67674 wikidata.entityByQID(_qid, function(err, entity) {
67679 _wikidataEntity = entity;
67680 setLabelForEntity();
67681 var description = entityPropertyForDisplay(entity, "descriptions");
67682 _selection.select("button.wiki-link").classed("disabled", false);
67683 _selection.select(".preset-wikidata-description").style("display", function() {
67684 return description.length > 0 ? "flex" : "none";
67685 }).select("input").attr("value", description);
67686 _selection.select(".preset-wikidata-identifier").style("display", function() {
67687 return entity.id ? "flex" : "none";
67688 }).select("input").attr("value", entity.id);
67690 function unrecognized() {
67691 _wikidataEntity = null;
67692 setLabelForEntity();
67693 _selection.select(".preset-wikidata-description").style("display", "none");
67694 _selection.select(".preset-wikidata-identifier").style("display", "none");
67695 _selection.select("button.wiki-link").classed("disabled", true);
67696 if (_qid && _qid !== "") {
67697 _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
67703 function entityPropertyForDisplay(wikidataEntity, propKey) {
67704 if (!wikidataEntity[propKey])
67706 var propObj = wikidataEntity[propKey];
67707 var langKeys = Object.keys(propObj);
67708 if (langKeys.length === 0)
67710 var langs = wikidata.languagesToQuery();
67711 for (var i3 in langs) {
67712 var lang = langs[i3];
67713 var valueObj = propObj[lang];
67714 if (valueObj && valueObj.value && valueObj.value.length > 0)
67715 return valueObj.value;
67717 return propObj[langKeys[0]].value;
67719 wiki.entityIDs = function(val) {
67720 if (!arguments.length)
67725 wiki.focus = function() {
67726 _searchInput.node().focus();
67728 return utilRebind(wiki, dispatch14, "on");
67731 // modules/ui/fields/wikipedia.js
67732 function uiFieldWikipedia(field, context) {
67733 const scheme = "https://";
67734 const domain = "wikipedia.org";
67735 const dispatch14 = dispatch_default("change");
67736 const wikipedia = services.wikipedia;
67737 const wikidata = services.wikidata;
67738 let _langInput = select_default2(null);
67739 let _titleInput = select_default2(null);
67743 let _dataWikipedia = [];
67744 _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
67745 _dataWikipedia = d2;
67747 updateForTags(_tags);
67750 const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
67751 const v2 = value.toLowerCase();
67753 _dataWikipedia.filter((d2) => {
67754 return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
67755 }).map((d2) => ({ value: d2[1] }))
67758 const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
67761 for (let i3 in _entityIDs) {
67762 let entity = context.hasEntity(_entityIDs[i3]);
67763 if (entity.tags.name) {
67764 value = entity.tags.name;
67769 const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
67770 searchfn(language()[2], value, (query, data) => {
67771 callback(data.map((d2) => ({ value: d2 })));
67774 function wiki(selection2) {
67775 let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
67776 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-".concat(field.type)).merge(wrap2);
67777 let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
67778 langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
67779 _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
67780 _langInput = _langInput.enter().append("input").attr("type", "text").attr("class", "wiki-lang").attr("placeholder", _t("translate.localized_translation_language")).call(utilNoAuto).call(langCombo).merge(_langInput);
67781 _langInput.on("blur", changeLang).on("change", changeLang);
67782 let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
67783 titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
67784 _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
67785 _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
67786 _titleInput.on("blur", function() {
67788 }).on("change", function() {
67791 let link3 = titleContainer.selectAll(".wiki-link").data([0]);
67792 link3 = link3.enter().append("button").attr("class", "form-field-button wiki-link").attr("title", _t("icons.view_on", { domain })).call(svgIcon("#iD-icon-out-link")).merge(link3);
67793 link3.on("click", (d3_event) => {
67794 d3_event.preventDefault();
67796 window.open(_wikiURL, "_blank");
67799 function defaultLanguageInfo(skipEnglishFallback) {
67800 const langCode = _mainLocalizer.languageCode().toLowerCase();
67801 for (let i3 in _dataWikipedia) {
67802 let d2 = _dataWikipedia[i3];
67803 if (d2[2] === langCode)
67806 return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
67808 function language(skipEnglishFallback) {
67809 const value = utilGetSetValue(_langInput).toLowerCase();
67810 for (let i3 in _dataWikipedia) {
67811 let d2 = _dataWikipedia[i3];
67812 if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value)
67815 return defaultLanguageInfo(skipEnglishFallback);
67817 function changeLang() {
67818 utilGetSetValue(_langInput, language()[1]);
67821 function change(skipWikidata) {
67822 let value = utilGetSetValue(_titleInput);
67823 const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
67824 const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
67827 const nativeLangName = langInfo[1];
67828 value = decodeURIComponent(m2[2]).replace(/_/g, " ");
67831 anchor = decodeURIComponent(m2[3]);
67832 value += "#" + anchor.replace(/_/g, " ");
67834 value = value.slice(0, 1).toUpperCase() + value.slice(1);
67835 utilGetSetValue(_langInput, nativeLangName);
67836 utilGetSetValue(_titleInput, value);
67839 syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
67841 syncTags.wikipedia = void 0;
67843 dispatch14.call("change", this, syncTags);
67844 if (skipWikidata || !value || !language()[2])
67846 const initGraph = context.graph();
67847 const initEntityIDs = _entityIDs;
67848 wikidata.itemsByTitle(language()[2], value, (err, data) => {
67849 if (err || !data || !Object.keys(data).length)
67851 if (context.graph() !== initGraph)
67853 const qids = Object.keys(data);
67854 const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
67855 let actions = initEntityIDs.map((entityID) => {
67856 let entity = context.entity(entityID).tags;
67857 let currTags = Object.assign({}, entity);
67858 if (currTags.wikidata !== value2) {
67859 currTags.wikidata = value2;
67860 return actionChangeTags(entityID, currTags);
67863 }).filter(Boolean);
67864 if (!actions.length)
67867 function actionUpdateWikidataTags(graph) {
67868 actions.forEach(function(action) {
67869 graph = action(graph);
67873 context.history().undoAnnotation()
67877 wiki.tags = (tags) => {
67879 updateForTags(tags);
67881 function updateForTags(tags) {
67882 const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
67883 const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
67884 const tagLang = m2 && m2[1];
67885 const tagArticleTitle = m2 && m2[2];
67886 let anchor = m2 && m2[3];
67887 const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
67889 const nativeLangName = tagLangInfo[1];
67890 utilGetSetValue(_langInput, nativeLangName);
67891 utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
67892 _wikiURL = "".concat(scheme).concat(tagLang, ".").concat(domain, "/wiki/").concat(wiki.encodePath(tagArticleTitle, anchor));
67894 utilGetSetValue(_titleInput, value);
67895 if (value && value !== "") {
67896 utilGetSetValue(_langInput, "");
67897 const defaultLangInfo = defaultLanguageInfo();
67898 _wikiURL = "".concat(scheme).concat(defaultLangInfo[2], ".").concat(domain, "/w/index.php?fulltext=1&search=").concat(value);
67900 const shownOrDefaultLangInfo = language(
67902 /* skipEnglishFallback */
67904 utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
67909 wiki.encodePath = (tagArticleTitle, anchor) => {
67910 const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
67911 const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
67912 const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
67913 return "".concat(uriEncodedUnderscoredTitle).concat(uriEncodedAnchorFragment);
67915 wiki.encodeURIAnchorFragment = (anchor) => {
67918 const underscoredAnchor = anchor.replace(/ /g, "_");
67919 return "#" + encodeURIComponent(underscoredAnchor);
67921 wiki.entityIDs = (val) => {
67922 if (!arguments.length)
67927 wiki.focus = () => {
67928 _titleInput.node().focus();
67930 return utilRebind(wiki, dispatch14, "on");
67932 uiFieldWikipedia.supportsMultiselection = false;
67934 // modules/ui/fields/index.js
67936 access: uiFieldAccess,
67937 address: uiFieldAddress,
67938 check: uiFieldCheck,
67939 colour: uiFieldText,
67940 combo: uiFieldCombo,
67941 cycleway: uiFieldDirectionalCombo,
67943 defaultCheck: uiFieldCheck,
67944 directionalCombo: uiFieldDirectionalCombo,
67945 email: uiFieldText,
67946 identifier: uiFieldText,
67947 lanes: uiFieldLanes,
67948 localized: uiFieldLocalized,
67949 roadheight: uiFieldRoadheight,
67950 roadspeed: uiFieldRoadspeed,
67951 manyCombo: uiFieldCombo,
67952 multiCombo: uiFieldCombo,
67953 networkCombo: uiFieldCombo,
67954 number: uiFieldText,
67955 onewayCheck: uiFieldCheck,
67956 radio: uiFieldRadio,
67957 restrictions: uiFieldRestrictions,
67958 semiCombo: uiFieldCombo,
67959 structureRadio: uiFieldRadio,
67962 textarea: uiFieldTextarea,
67963 typeCombo: uiFieldCombo,
67965 wikidata: uiFieldWikidata,
67966 wikipedia: uiFieldWikipedia
67969 // modules/ui/field.js
67970 function uiField(context, presetField2, entityIDs, options2) {
67971 options2 = Object.assign({
67978 var dispatch14 = dispatch_default("change", "revert");
67979 var field = Object.assign({}, presetField2);
67980 field.domId = utilUniqueDomId("form-field-" + field.safeid);
67981 var _show = options2.show;
67985 if (entityIDs && entityIDs.length) {
67986 _entityExtent = entityIDs.reduce(function(extent, entityID) {
67987 var entity = context.graph().entity(entityID);
67988 return extent.extend(entity.extent(context.graph()));
67991 var _locked = false;
67992 var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
67993 if (_show && !field.impl) {
67996 function createField() {
67997 field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
67998 dispatch14.call("change", field, t2, onInput);
68001 field.entityIDs = entityIDs;
68002 if (field.impl.entityIDs) {
68003 field.impl.entityIDs(entityIDs);
68007 function allKeys() {
68008 let keys2 = field.keys || [field.key];
68009 if (field.type === "directionalCombo" && field.key) {
68010 keys2 = keys2.concat(field.key);
68014 function isModified() {
68015 if (!entityIDs || !entityIDs.length)
68017 return entityIDs.some(function(entityID) {
68018 var original = context.graph().base().entities[entityID];
68019 var latest = context.graph().entity(entityID);
68020 return allKeys().some(function(key) {
68021 return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
68025 function tagsContainFieldKey() {
68026 return allKeys().some(function(key) {
68027 if (field.type === "multiCombo") {
68028 for (var tagKey in _tags) {
68029 if (tagKey.indexOf(key) === 0) {
68035 return _tags[key] !== void 0;
68038 function revert(d3_event, d2) {
68039 d3_event.stopPropagation();
68040 d3_event.preventDefault();
68041 if (!entityIDs || _locked)
68043 dispatch14.call("revert", d2, allKeys());
68045 function remove2(d3_event, d2) {
68046 d3_event.stopPropagation();
68047 d3_event.preventDefault();
68051 allKeys().forEach(function(key) {
68054 dispatch14.call("change", d2, t2);
68056 field.render = function(selection2) {
68057 var container = selection2.selectAll(".form-field").data([field]);
68058 var enter = container.enter().append("div").attr("class", function(d2) {
68059 return "form-field form-field-" + d2.safeid;
68060 }).classed("nowrap", !options2.wrap);
68061 if (options2.wrap) {
68062 var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
68065 var textEnter = labelEnter.append("span").attr("class", "label-text");
68066 textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
68067 d2.label()(select_default2(this));
68069 textEnter.append("span").attr("class", "label-textannotation");
68070 if (options2.remove) {
68071 labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
68073 if (options2.revert) {
68074 labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
68077 container = container.merge(enter);
68078 container.select(".field-label > .remove-icon").on("click", remove2);
68079 container.select(".field-label > .modified-icon").on("click", revert);
68080 container.each(function(d2) {
68081 var selection3 = select_default2(this);
68085 var reference, help;
68086 if (options2.wrap && field.type === "restrictions") {
68087 help = uiFieldHelp(context, "restrictions");
68089 if (options2.wrap && options2.info) {
68090 var referenceKey = d2.key || "";
68091 if (d2.type === "multiCombo") {
68092 referenceKey = referenceKey.replace(/:$/, "");
68094 var referenceOptions = d2.reference || {
68096 value: _tags[referenceKey]
68098 reference = uiTagReference(referenceOptions, context);
68099 if (_state === "hover") {
68100 reference.showing(false);
68103 selection3.call(d2.impl);
68105 selection3.call(help.body).select(".field-label").call(help.button);
68108 selection3.call(reference.body).select(".field-label").call(reference.button);
68110 d2.impl.tags(_tags);
68112 container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
68113 var annotation = container.selectAll(".field-label .label-textannotation");
68114 var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
68115 icon2.exit().remove();
68116 icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
68117 container.call(_locked ? _lockedTip : _lockedTip.destroy);
68119 field.state = function(val) {
68120 if (!arguments.length)
68125 field.tags = function(val) {
68126 if (!arguments.length)
68129 if (tagsContainFieldKey() && !_show) {
68137 field.locked = function(val) {
68138 if (!arguments.length)
68143 field.show = function() {
68148 if (field.default && field.key && _tags[field.key] !== field.default) {
68150 t2[field.key] = field.default;
68151 dispatch14.call("change", this, t2);
68154 field.isShown = function() {
68157 field.isAllowed = function() {
68158 if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false)
68160 if (field.geometry && !entityIDs.every(function(entityID) {
68161 return field.matchGeometry(context.graph().geometry(entityID));
68164 if (entityIDs && _entityExtent && field.locationSetID) {
68165 var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
68166 if (!validHere[field.locationSetID])
68169 var prerequisiteTag = field.prerequisiteTag;
68170 if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
68172 if (!entityIDs.every(function(entityID) {
68173 var entity = context.graph().entity(entityID);
68174 if (prerequisiteTag.key) {
68175 var value = entity.tags[prerequisiteTag.key];
68178 if (prerequisiteTag.valueNot) {
68179 return prerequisiteTag.valueNot !== value;
68181 if (prerequisiteTag.value) {
68182 return prerequisiteTag.value === value;
68184 } else if (prerequisiteTag.keyNot) {
68185 if (entity.tags[prerequisiteTag.keyNot])
68194 field.focus = function() {
68196 field.impl.focus();
68199 return utilRebind(field, dispatch14, "on");
68202 // modules/ui/form_fields.js
68203 function uiFormFields(context) {
68204 var moreCombo = uiCombobox(context, "more-fields").minItems(1);
68205 var _fieldsArr = [];
68206 var _lastPlaceholder = "";
68209 function formFields(selection2) {
68210 var allowedFields = _fieldsArr.filter(function(field) {
68211 return field.isAllowed();
68213 var shown = allowedFields.filter(function(field) {
68214 return field.isShown();
68216 var notShown = allowedFields.filter(function(field) {
68217 return !field.isShown();
68219 var container = selection2.selectAll(".form-fields-container").data([0]);
68220 container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
68221 var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
68222 return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
68224 fields.exit().remove();
68225 var enter = fields.enter().append("div").attr("class", function(d2) {
68226 return "wrap-form-field wrap-form-field-" + d2.safeid;
68228 fields = fields.merge(enter);
68229 fields.order().each(function(d2) {
68230 select_default2(this).call(d2.render);
68233 var moreFields = notShown.map(function(field) {
68234 var title = field.title();
68235 titles.push(title);
68236 var terms = field.terms();
68238 terms.push(field.key);
68240 terms = terms.concat(field.keys);
68242 display: field.label(),
68249 var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
68250 var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
68251 more.exit().remove();
68252 var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
68253 moreEnter.append("span").call(_t.append("inspector.add_fields"));
68254 more = moreEnter.merge(more);
68255 var input = more.selectAll(".value").data([0]);
68256 input.exit().remove();
68257 input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
68258 input.call(utilGetSetValue, "").call(
68259 moreCombo.data(moreFields).on("accept", function(d2) {
68262 var field = d2.field;
68264 selection2.call(formFields);
68268 if (_lastPlaceholder !== placeholder) {
68269 input.attr("placeholder", placeholder);
68270 _lastPlaceholder = placeholder;
68273 formFields.fieldsArr = function(val) {
68274 if (!arguments.length)
68276 _fieldsArr = val || [];
68279 formFields.state = function(val) {
68280 if (!arguments.length)
68285 formFields.klass = function(val) {
68286 if (!arguments.length)
68294 // modules/ui/changeset_editor.js
68295 function uiChangesetEditor(context) {
68296 var dispatch14 = dispatch_default("change");
68297 var formFields = uiFormFields(context);
68298 var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
68302 function changesetEditor(selection2) {
68303 render(selection2);
68305 function render(selection2) {
68306 var initial = false;
68309 var presets = _mainPresetIndex;
68311 uiField(context, presets.field("comment"), null, { show: true, revert: false }),
68312 uiField(context, presets.field("source"), null, { show: true, revert: false }),
68313 uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
68315 _fieldsArr.forEach(function(field) {
68316 field.on("change", function(t2, onInput) {
68317 dispatch14.call("change", field, void 0, t2, onInput);
68321 _fieldsArr.forEach(function(field) {
68324 selection2.call(formFields.fieldsArr(_fieldsArr));
68326 var commentField = selection2.select(".form-field-comment textarea");
68327 var commentNode = commentField.node();
68329 commentNode.focus();
68330 commentNode.select();
68332 utilTriggerEvent(commentField, "blur");
68333 var osm = context.connection();
68335 osm.userChangesets(function(err, changesets) {
68338 var comments = changesets.map(function(changeset) {
68339 var comment = changeset.tags.comment;
68340 return comment ? { title: comment, value: comment } : null;
68341 }).filter(Boolean);
68343 commentCombo.data(utilArrayUniqBy(comments, "title"))
68348 const warnings = [];
68349 if (_tags.comment.match(/google/i)) {
68351 id: 'contains "google"',
68352 msg: _t.append("commit.google_warning"),
68353 link: _t("commit.google_warning_link")
68356 const maxChars = context.maxCharsForTagValue();
68357 const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
68358 if (strLen > maxChars || false) {
68360 id: "message too long",
68361 msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
68364 var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
68365 commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
68366 var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
68367 commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
68368 commentEnter.transition().duration(200).style("opacity", 1);
68369 commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
68370 let selection3 = select_default2(this);
68372 selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
68374 selection3.call(d2.msg);
68377 changesetEditor.tags = function(_2) {
68378 if (!arguments.length)
68381 return changesetEditor;
68383 changesetEditor.changesetID = function(_2) {
68384 if (!arguments.length)
68385 return _changesetID;
68386 if (_changesetID === _2)
68387 return changesetEditor;
68390 return changesetEditor;
68392 return utilRebind(changesetEditor, dispatch14, "on");
68395 // modules/ui/commit.js
68396 var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
68398 // modules/util/jxon.js
68399 var JXON = new function() {
68400 var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
68401 function parseText(sValue) {
68402 if (rIsNull.test(sValue)) {
68405 if (rIsBool.test(sValue)) {
68406 return sValue.toLowerCase() === "true";
68408 if (isFinite(sValue)) {
68409 return parseFloat(sValue);
68411 if (isFinite(Date.parse(sValue))) {
68412 return new Date(sValue);
68416 function EmptyTree() {
68418 EmptyTree.prototype.toString = function() {
68421 EmptyTree.prototype.valueOf = function() {
68424 function objectify(vValue) {
68425 return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
68427 function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
68428 var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
68429 var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
68430 /* put here the default value for empty nodes: */
68434 for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
68435 oNode = oParentNode.childNodes.item(nItem);
68436 if (oNode.nodeType === 4) {
68437 sCollectedTxt += oNode.nodeValue;
68438 } else if (oNode.nodeType === 3) {
68439 sCollectedTxt += oNode.nodeValue.trim();
68440 } else if (oNode.nodeType === 1 && !oNode.prefix) {
68441 aCache.push(oNode);
68445 var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
68446 if (!bHighVerb && (bChildren || bAttributes)) {
68447 vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
68449 for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
68450 sProp = aCache[nElId].nodeName.toLowerCase();
68451 vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
68452 if (vResult.hasOwnProperty(sProp)) {
68453 if (vResult[sProp].constructor !== Array) {
68454 vResult[sProp] = [vResult[sProp]];
68456 vResult[sProp].push(vContent);
68458 vResult[sProp] = vContent;
68463 var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
68464 for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
68465 oAttrib = oParentNode.attributes.item(nAttrib);
68466 oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
68470 Object.freeze(oAttrParent);
68472 vResult[sAttributesProp] = oAttrParent;
68473 nLength -= nAttrLen - 1;
68476 if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
68477 vResult[sValueProp] = vBuiltVal;
68478 } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
68479 vResult = vBuiltVal;
68481 if (bFreeze && (bHighVerb || nLength > 0)) {
68482 Object.freeze(vResult);
68484 aCache.length = nLevelStart;
68487 function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
68488 var vValue, oChild;
68489 if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
68490 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
68491 } else if (oParentObj.constructor === Date) {
68492 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
68494 for (var sName in oParentObj) {
68495 vValue = oParentObj[sName];
68496 if (isFinite(sName) || vValue instanceof Function) {
68499 if (sName === sValueProp) {
68500 if (vValue !== null && vValue !== true) {
68501 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
68503 } else if (sName === sAttributesProp) {
68504 for (var sAttrib in vValue) {
68505 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
68507 } else if (sName.charAt(0) === sAttrPref) {
68508 oParentEl.setAttribute(sName.slice(1), vValue);
68509 } else if (vValue.constructor === Array) {
68510 for (var nItem = 0; nItem < vValue.length; nItem++) {
68511 oChild = oXMLDoc.createElement(sName);
68512 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
68513 oParentEl.appendChild(oChild);
68516 oChild = oXMLDoc.createElement(sName);
68517 if (vValue instanceof Object) {
68518 loadObjTree(oXMLDoc, oChild, vValue);
68519 } else if (vValue !== null && vValue !== true) {
68520 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
68522 oParentEl.appendChild(oChild);
68526 this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
68527 var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
68528 /* put here the default verbosity level: */
68531 return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
68533 this.unbuild = function(oObjTree) {
68534 var oNewDoc = document.implementation.createDocument("", "", null);
68535 loadObjTree(oNewDoc, oNewDoc, oObjTree);
68538 this.stringify = function(oObjTree) {
68539 return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
68543 // modules/ui/sections/changes.js
68544 function uiSectionChanges(context) {
68545 var _discardTags = {};
68546 _mainFileFetcher.get("discarded").then(function(d2) {
68548 }).catch(function() {
68550 var section = uiSection("changes-list", context).label(function() {
68551 var history = context.history();
68552 var summary = history.difference().summary();
68553 return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
68554 }).disclosureContent(renderDisclosureContent);
68555 function renderDisclosureContent(selection2) {
68556 var history = context.history();
68557 var summary = history.difference().summary();
68558 var container = selection2.selectAll(".commit-section").data([0]);
68559 var containerEnter = container.enter().append("div").attr("class", "commit-section");
68560 containerEnter.append("ul").attr("class", "changeset-list");
68561 container = containerEnter.merge(container);
68562 var items = container.select("ul").selectAll("li").data(summary);
68563 var itemsEnter = items.enter().append("li").attr("class", "change-item");
68564 var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
68565 buttons.each(function(d2) {
68566 select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
68568 buttons.append("span").attr("class", "change-type").html(function(d2) {
68569 return _t.html("commit." + d2.changeType) + " ";
68571 buttons.append("strong").attr("class", "entity-type").text(function(d2) {
68572 var matched = _mainPresetIndex.match(d2.entity, d2.graph);
68573 return matched && matched.name() || utilDisplayType(d2.entity.id);
68575 buttons.append("span").attr("class", "entity-name").text(function(d2) {
68576 var name = utilDisplayName(d2.entity) || "", string = "";
68580 return string += " " + name;
68582 items = itemsEnter.merge(items);
68583 var changeset = new osmChangeset().update({ id: void 0 });
68584 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
68585 delete changeset.id;
68586 var data = JXON.stringify(changeset.osmChangeJXON(changes));
68587 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
68588 var fileName = "changes.osc";
68589 var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
68590 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
68591 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
68592 function mouseover(d2) {
68594 context.surface().selectAll(
68595 utilEntityOrMemberSelector([d2.entity.id], context.graph())
68596 ).classed("hover", true);
68599 function mouseout() {
68600 context.surface().selectAll(".hover").classed("hover", false);
68602 function click(d3_event, change) {
68603 if (change.changeType !== "deleted") {
68604 var entity = change.entity;
68605 context.map().zoomToEase(entity);
68606 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
68613 // modules/ui/commit_warnings.js
68614 function uiCommitWarnings(context) {
68615 function commitWarnings(selection2) {
68616 var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
68617 for (var severity in issuesBySeverity) {
68618 var issues = issuesBySeverity[severity];
68619 if (severity !== "error") {
68620 issues = issues.filter(function(issue) {
68621 return issue.type !== "help_request";
68624 var section = severity + "-section";
68625 var issueItem = severity + "-item";
68626 var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
68627 container.exit().remove();
68628 var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
68629 containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
68630 containerEnter.append("ul").attr("class", "changeset-list");
68631 container = containerEnter.merge(container);
68632 var items = container.select("ul").selectAll("li").data(issues, function(d2) {
68635 items.exit().remove();
68636 var itemsEnter = items.enter().append("li").attr("class", issueItem);
68637 var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
68638 if (d2.entityIds) {
68639 context.surface().selectAll(
68640 utilEntityOrMemberSelector(
68644 ).classed("hover", true);
68646 }).on("mouseout", function() {
68647 context.surface().selectAll(".hover").classed("hover", false);
68648 }).on("click", function(d3_event, d2) {
68649 context.validator().focusIssue(d2);
68651 buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
68652 buttons.append("strong").attr("class", "issue-message");
68653 buttons.filter(function(d2) {
68656 uiTooltip().title(function(d2) {
68658 }).placement("top")
68660 items = itemsEnter.merge(items);
68661 items.selectAll(".issue-message").text("").each(function(d2) {
68662 return d2.message(context)(select_default2(this));
68666 return commitWarnings;
68669 // modules/ui/commit.js
68670 var readOnlyTags = [
68671 /^changesets_count$/,
68680 /^closed:keepright$/,
68681 /^closed:improveosm:/,
68684 var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
68685 function uiCommit(context) {
68686 var dispatch14 = dispatch_default("cancel");
68689 var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
68690 var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
68691 var commitChanges = uiSectionChanges(context);
68692 var commitWarnings = uiCommitWarnings(context);
68693 function commit(selection2) {
68694 _selection = selection2;
68695 if (!context.changeset)
68697 loadDerivedChangesetTags();
68698 selection2.call(render);
68700 function initChangeset() {
68701 var commentDate = +corePreferences("commentDate") || 0;
68702 var currDate = Date.now();
68703 var cutoff = 2 * 86400 * 1e3;
68704 if (commentDate > currDate || currDate - commentDate > cutoff) {
68705 corePreferences("comment", null);
68706 corePreferences("hashtags", null);
68707 corePreferences("source", null);
68709 if (context.defaultChangesetComment()) {
68710 corePreferences("comment", context.defaultChangesetComment());
68711 corePreferences("commentDate", Date.now());
68713 if (context.defaultChangesetSource()) {
68714 corePreferences("source", context.defaultChangesetSource());
68715 corePreferences("commentDate", Date.now());
68717 if (context.defaultChangesetHashtags()) {
68718 corePreferences("hashtags", context.defaultChangesetHashtags());
68719 corePreferences("commentDate", Date.now());
68721 var detected = utilDetect();
68723 comment: corePreferences("comment") || "",
68724 created_by: context.cleanTagValue("iD " + context.version),
68725 host: context.cleanTagValue(detected.host),
68726 locale: context.cleanTagValue(_mainLocalizer.localeCode())
68728 findHashtags(tags, true);
68729 var hashtags = corePreferences("hashtags");
68731 tags.hashtags = hashtags;
68733 var source = corePreferences("source");
68735 tags.source = source;
68737 var photoOverlaysUsed = context.history().photoOverlaysUsed();
68738 if (photoOverlaysUsed.length) {
68739 var sources = (tags.source || "").split(";");
68740 if (sources.indexOf("streetlevel imagery") === -1) {
68741 sources.push("streetlevel imagery");
68743 photoOverlaysUsed.forEach(function(photoOverlay) {
68744 if (sources.indexOf(photoOverlay) === -1) {
68745 sources.push(photoOverlay);
68748 tags.source = context.cleanTagValue(sources.join(";"));
68750 context.changeset = new osmChangeset({ tags });
68752 function loadDerivedChangesetTags() {
68753 var osm = context.connection();
68756 var tags = Object.assign({}, context.changeset.tags);
68757 var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
68758 tags.imagery_used = imageryUsed || "None";
68759 var osmClosed = osm.getClosedIDs();
68761 if (osmClosed.length) {
68762 tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
68764 if (services.keepRight) {
68765 var krClosed = services.keepRight.getClosedIDs();
68766 if (krClosed.length) {
68767 tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
68770 if (services.improveOSM) {
68771 var iOsmClosed = services.improveOSM.getClosedCounts();
68772 for (itemType in iOsmClosed) {
68773 tags["closed:improveosm:" + itemType] = context.cleanTagValue(iOsmClosed[itemType].toString());
68776 if (services.osmose) {
68777 var osmoseClosed = services.osmose.getClosedCounts();
68778 for (itemType in osmoseClosed) {
68779 tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
68782 for (var key in tags) {
68783 if (key.match(/(^warnings:)|(^resolved:)/)) {
68787 function addIssueCounts(issues, prefix) {
68788 var issuesByType = utilArrayGroupBy(issues, "type");
68789 for (var issueType in issuesByType) {
68790 var issuesOfType = issuesByType[issueType];
68791 if (issuesOfType[0].subtype) {
68792 var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
68793 for (var issueSubtype in issuesBySubtype) {
68794 var issuesOfSubtype = issuesBySubtype[issueSubtype];
68795 tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
68798 tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
68802 var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
68803 return issue.type !== "help_request";
68805 addIssueCounts(warnings, "warnings");
68806 var resolvedIssues = context.validator().getResolvedIssues();
68807 addIssueCounts(resolvedIssues, "resolved");
68808 context.changeset = context.changeset.update({ tags });
68810 function render(selection2) {
68811 var osm = context.connection();
68814 var header = selection2.selectAll(".header").data([0]);
68815 var headerTitle = header.enter().append("div").attr("class", "header fillL");
68816 headerTitle.append("div").append("h2").call(_t.append("commit.title"));
68817 headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
68818 dispatch14.call("cancel", this);
68819 }).call(svgIcon("#iD-icon-close"));
68820 var body = selection2.selectAll(".body").data([0]);
68821 body = body.enter().append("div").attr("class", "body").merge(body);
68822 var changesetSection = body.selectAll(".changeset-editor").data([0]);
68823 changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
68824 changesetSection.call(
68825 changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
68827 body.call(commitWarnings);
68828 var saveSection = body.selectAll(".save-section").data([0]);
68829 saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
68830 var prose = saveSection.selectAll(".commit-info").data([0]);
68831 if (prose.enter().size()) {
68832 _userDetails2 = null;
68834 prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
68835 osm.userDetails(function(err, user) {
68838 if (_userDetails2 === user)
68840 _userDetails2 = user;
68841 var userLink = select_default2(document.createElement("div"));
68842 if (user.image_url) {
68843 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
68845 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
68846 prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
68848 var requestReview = saveSection.selectAll(".request-review").data([0]);
68849 var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
68850 var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
68851 var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
68852 if (!labelEnter.empty()) {
68853 labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
68855 labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
68856 labelEnter.append("span").call(_t.append("commit.request_review"));
68857 requestReview = requestReview.merge(requestReviewEnter);
68858 var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
68859 var buttonSection = saveSection.selectAll(".buttons").data([0]);
68860 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
68861 buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
68862 var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
68863 uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
68864 var uploadBlockerTooltipText = getUploadBlockerMessage();
68865 buttonSection = buttonSection.merge(buttonEnter);
68866 buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
68867 dispatch14.call("cancel", this);
68869 buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
68870 if (!select_default2(this).classed("disabled")) {
68872 for (var key in context.changeset.tags) {
68874 delete context.changeset.tags[key];
68876 context.uploader().save(context.changeset);
68879 uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
68880 if (uploadBlockerTooltipText) {
68881 buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
68883 var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
68884 tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
68886 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
68888 var changesSection = body.selectAll(".commit-changes-section").data([0]);
68889 changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
68890 changesSection.call(commitChanges.render);
68891 function toggleRequestReview() {
68892 var rr = requestReviewInput.property("checked");
68893 updateChangeset({ review_requested: rr ? "yes" : void 0 });
68895 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
68899 function getUploadBlockerMessage() {
68900 var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
68901 if (errors.length) {
68902 return _t.append("commit.outstanding_errors_message", { count: errors.length });
68904 var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
68905 if (!hasChangesetComment) {
68906 return _t.append("commit.comment_needed_message");
68911 function changeTags(_2, changed, onInput) {
68912 if (changed.hasOwnProperty("comment")) {
68913 if (changed.comment === void 0) {
68914 changed.comment = "";
68917 corePreferences("comment", changed.comment);
68918 corePreferences("commentDate", Date.now());
68921 if (changed.hasOwnProperty("source")) {
68922 if (changed.source === void 0) {
68923 corePreferences("source", null);
68924 } else if (!onInput) {
68925 corePreferences("source", changed.source);
68926 corePreferences("commentDate", Date.now());
68929 updateChangeset(changed, onInput);
68931 _selection.call(render);
68934 function findHashtags(tags, commentOnly) {
68935 var detectedHashtags = commentHashtags();
68936 if (detectedHashtags.length) {
68937 corePreferences("hashtags", null);
68939 if (!detectedHashtags.length || !commentOnly) {
68940 detectedHashtags = detectedHashtags.concat(hashtagHashtags());
68942 var allLowerCase = /* @__PURE__ */ new Set();
68943 return detectedHashtags.filter(function(hashtag) {
68944 var lowerCase = hashtag.toLowerCase();
68945 if (!allLowerCase.has(lowerCase)) {
68946 allLowerCase.add(lowerCase);
68951 function commentHashtags() {
68952 var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
68953 return matches || [];
68955 function hashtagHashtags() {
68956 var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
68957 if (s2[0] !== "#") {
68960 var matched = s2.match(hashtagRegex);
68961 return matched && matched[0];
68962 }).filter(Boolean);
68963 return matches || [];
68966 function isReviewRequested(tags) {
68967 var rr = tags.review_requested;
68970 rr = rr.trim().toLowerCase();
68971 return !(rr === "" || rr === "no");
68973 function updateChangeset(changed, onInput) {
68974 var tags = Object.assign({}, context.changeset.tags);
68975 Object.keys(changed).forEach(function(k2) {
68976 var v2 = changed[k2];
68977 k2 = context.cleanTagKey(k2);
68978 if (readOnlyTags.indexOf(k2) !== -1)
68980 if (v2 === void 0) {
68982 } else if (onInput) {
68985 tags[k2] = context.cleanTagValue(v2);
68989 var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
68990 var arr = findHashtags(tags, commentOnly);
68992 tags.hashtags = context.cleanTagValue(arr.join(";"));
68993 corePreferences("hashtags", tags.hashtags);
68995 delete tags.hashtags;
68996 corePreferences("hashtags", null);
68999 if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
69000 var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
69001 tags.changesets_count = String(changesetsCount);
69002 if (changesetsCount <= 100) {
69004 s2 = corePreferences("walkthrough_completed");
69006 tags["ideditor:walkthrough_completed"] = s2;
69008 s2 = corePreferences("walkthrough_progress");
69010 tags["ideditor:walkthrough_progress"] = s2;
69012 s2 = corePreferences("walkthrough_started");
69014 tags["ideditor:walkthrough_started"] = s2;
69018 delete tags.changesets_count;
69020 if (!(0, import_fast_deep_equal9.default)(context.changeset.tags, tags)) {
69021 context.changeset = context.changeset.update({ tags });
69024 commit.reset = function() {
69025 context.changeset = null;
69027 return utilRebind(commit, dispatch14, "on");
69030 // modules/ui/confirm.js
69031 function uiConfirm(selection2) {
69032 var modalSelection = uiModal(selection2);
69033 modalSelection.select(".modal").classed("modal-alert", true);
69034 var section = modalSelection.select(".content");
69035 section.append("div").attr("class", "modal-section header");
69036 section.append("div").attr("class", "modal-section message-text");
69037 var buttons = section.append("div").attr("class", "modal-section buttons cf");
69038 modalSelection.okButton = function() {
69039 buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
69040 modalSelection.remove();
69041 }).call(_t.append("confirm.okay")).node().focus();
69042 return modalSelection;
69044 return modalSelection;
69047 // modules/ui/conflicts.js
69048 function uiConflicts(context) {
69049 var dispatch14 = dispatch_default("cancel", "save");
69050 var keybinding = utilKeybinding("conflicts");
69053 var _shownConflictIndex;
69054 function keybindingOn() {
69055 select_default2(document).call(keybinding.on("\u238B", cancel, true));
69057 function keybindingOff() {
69058 select_default2(document).call(keybinding.unbind);
69060 function tryAgain() {
69062 dispatch14.call("save");
69064 function cancel() {
69066 dispatch14.call("cancel");
69068 function conflicts(selection2) {
69070 var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
69071 headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
69072 headerEnter.append("h2").call(_t.append("save.conflict.header"));
69073 var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
69074 var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
69075 var changeset = new osmChangeset();
69076 delete changeset.id;
69077 var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
69078 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
69079 var fileName = "changes.osc";
69080 var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
69081 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
69082 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
69083 bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
69084 bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
69085 var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
69086 buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
69087 buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
69089 function showConflict(selection2, index) {
69090 index = utilWrap(index, _conflictList.length);
69091 _shownConflictIndex = index;
69092 var parent = select_default2(selection2.node().parentNode);
69093 if (index === _conflictList.length - 1) {
69094 window.setTimeout(function() {
69095 parent.select(".conflicts-button").attr("disabled", null);
69096 parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
69099 var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
69100 conflict.exit().remove();
69101 var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
69102 conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
69103 conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
69105 }).on("click", function(d3_event, d2) {
69106 d3_event.preventDefault();
69107 zoomToEntity(d2.id);
69109 var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
69110 details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
69111 return d2.details || [];
69112 }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
69115 details.append("div").attr("class", "conflict-choices").call(addChoices);
69116 details.append("div").attr("class", "conflict-nav-buttons joined cf").selectAll("button").data(["previous", "next"]).enter().append("button").attr("class", "conflict-nav-button action col6").attr("disabled", function(d2, i3) {
69117 return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
69118 }).on("click", function(d3_event, d2) {
69119 d3_event.preventDefault();
69120 var container = parent.selectAll(".conflict-container");
69121 var sign2 = d2 === "previous" ? -1 : 1;
69122 container.selectAll(".conflict").remove();
69123 container.call(showConflict, index + sign2);
69124 }).each(function(d2) {
69125 _t.append("save.conflict." + d2)(select_default2(this));
69128 function addChoices(selection2) {
69129 var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
69130 return d2.choices || [];
69132 var choicesEnter = choices.enter().append("li").attr("class", "layer");
69133 var labelEnter = choicesEnter.append("label");
69134 labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
69136 }).on("change", function(d3_event, d2) {
69137 var ul = this.parentNode.parentNode.parentNode;
69138 ul.__data__.chosen = d2.id;
69139 choose(d3_event, ul, d2);
69141 labelEnter.append("span").text(function(d2) {
69144 choicesEnter.merge(choices).each(function(d2) {
69145 var ul = this.parentNode;
69146 if (ul.__data__.chosen === d2.id) {
69147 choose(null, ul, d2);
69151 function choose(d3_event, ul, datum2) {
69153 d3_event.preventDefault();
69154 select_default2(ul).selectAll("li").classed("active", function(d2) {
69155 return d2 === datum2;
69156 }).selectAll("input").property("checked", function(d2) {
69157 return d2 === datum2;
69159 var extent = geoExtent();
69161 entity = context.graph().hasEntity(datum2.id);
69163 extent._extend(entity.extent(context.graph()));
69165 entity = context.graph().hasEntity(datum2.id);
69167 extent._extend(entity.extent(context.graph()));
69168 zoomToEntity(datum2.id, extent);
69170 function zoomToEntity(id2, extent) {
69171 context.surface().selectAll(".hover").classed("hover", false);
69172 var entity = context.graph().hasEntity(id2);
69175 context.map().trimmedExtent(extent);
69177 context.map().zoomToEase(entity);
69179 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
69182 conflicts.conflictList = function(_2) {
69183 if (!arguments.length)
69184 return _conflictList;
69185 _conflictList = _2;
69188 conflicts.origChanges = function(_2) {
69189 if (!arguments.length)
69190 return _origChanges;
69194 conflicts.shownEntityIds = function() {
69195 if (_conflictList && typeof _shownConflictIndex === "number") {
69196 return [_conflictList[_shownConflictIndex].id];
69200 return utilRebind(conflicts, dispatch14, "on");
69203 // modules/ui/entity_editor.js
69204 var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
69206 // modules/ui/sections/entity_issues.js
69207 function uiSectionEntityIssues(context) {
69208 var preference = corePreferences("entity-issues.reference.expanded");
69209 var _expanded = preference === null ? true : preference === "true";
69210 var _entityIDs = [];
69212 var _activeIssueID;
69213 var section = uiSection("entity-issues", context).shouldDisplay(function() {
69214 return _issues.length > 0;
69215 }).label(function() {
69216 return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
69217 }).disclosureContent(renderDisclosureContent);
69218 context.validator().on("validated.entity_issues", function() {
69220 section.reRender();
69221 }).on("focusedIssue.entity_issues", function(issue) {
69222 makeActiveIssue(issue.id);
69224 function reloadIssues() {
69225 _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
69227 function makeActiveIssue(issueID) {
69228 _activeIssueID = issueID;
69229 section.selection().selectAll(".issue-container").classed("active", function(d2) {
69230 return d2.id === _activeIssueID;
69233 function renderDisclosureContent(selection2) {
69234 selection2.classed("grouped-items-area", true);
69235 _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
69236 var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
69239 containers.exit().remove();
69240 var containersEnter = containers.enter().append("div").attr("class", "issue-container");
69241 var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
69242 return "issue severity-" + d2.severity;
69243 }).on("mouseover.highlight", function(d3_event, d2) {
69244 var ids = d2.entityIds.filter(function(e3) {
69245 return _entityIDs.indexOf(e3) === -1;
69247 utilHighlightEntities(ids, true, context);
69248 }).on("mouseout.highlight", function(d3_event, d2) {
69249 var ids = d2.entityIds.filter(function(e3) {
69250 return _entityIDs.indexOf(e3) === -1;
69252 utilHighlightEntities(ids, false, context);
69254 var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
69255 var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
69256 makeActiveIssue(d2.id);
69257 var extent = d2.extent(context.graph());
69259 var setZoom = Math.max(context.map().zoom(), 19);
69260 context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
69263 textEnter.each(function(d2) {
69264 var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
69265 select_default2(this).call(svgIcon(iconName, "issue-icon"));
69267 textEnter.append("span").attr("class", "issue-message");
69268 var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
69269 infoButton.on("click", function(d3_event) {
69270 d3_event.stopPropagation();
69271 d3_event.preventDefault();
69273 var container = select_default2(this.parentNode.parentNode.parentNode);
69274 var info = container.selectAll(".issue-info");
69275 var isExpanded = info.classed("expanded");
69276 _expanded = !isExpanded;
69277 corePreferences("entity-issues.reference.expanded", _expanded);
69279 info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
69280 info.classed("expanded", false);
69283 info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
69284 info.style("max-height", null);
69288 itemsEnter.append("ul").attr("class", "issue-fix-list");
69289 containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
69290 if (typeof d2.reference === "function") {
69291 select_default2(this).call(d2.reference);
69293 select_default2(this).call(_t.append("inspector.no_documentation_key"));
69296 containers = containers.merge(containersEnter).classed("active", function(d2) {
69297 return d2.id === _activeIssueID;
69299 containers.selectAll(".issue-message").text("").each(function(d2) {
69300 return d2.message(context)(select_default2(this));
69302 var fixLists = containers.selectAll(".issue-fix-list");
69303 var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
69304 return d2.fixes ? d2.fixes(context) : [];
69308 fixes.exit().remove();
69309 var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
69310 var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
69311 if (select_default2(this).attr("disabled") || !d2.onClick)
69313 if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3)
69315 d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
69316 utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
69317 new Promise(function(resolve, reject) {
69318 d2.onClick(context, resolve, reject);
69319 if (d2.onClick.length <= 1) {
69322 }).then(function() {
69323 context.validator().validate();
69325 }).on("mouseover.highlight", function(d3_event, d2) {
69326 utilHighlightEntities(d2.entityIds, true, context);
69327 }).on("mouseout.highlight", function(d3_event, d2) {
69328 utilHighlightEntities(d2.entityIds, false, context);
69330 buttons.each(function(d2) {
69331 var iconName = d2.icon || "iD-icon-wrench";
69332 if (iconName.startsWith("maki")) {
69335 select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
69337 buttons.append("span").attr("class", "fix-message").each(function(d2) {
69338 return d2.title(select_default2(this));
69340 fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
69342 }).attr("disabled", function(d2) {
69343 return d2.onClick ? null : "true";
69344 }).attr("title", function(d2) {
69345 if (d2.disabledReason) {
69346 return d2.disabledReason;
69351 section.entityIDs = function(val) {
69352 if (!arguments.length)
69354 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
69356 _activeIssueID = null;
69364 // modules/ui/preset_icon.js
69365 function uiPresetIcon() {
69368 function presetIcon(selection2) {
69369 selection2.each(render);
69371 function getIcon(p2, geom) {
69372 if (p2.isFallback && p2.isFallback())
69373 return geom === "vertex" ? "" : "iD-icon-" + p2.id;
69376 if (geom === "line")
69377 return "iD-other-line";
69378 if (geom === "vertex")
69379 return "temaki-vertex";
69380 return "maki-marker-stroked";
69382 function renderPointBorder(container, drawPoint) {
69383 let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
69384 pointBorder.exit().remove();
69385 let pointBorderEnter = pointBorder.enter();
69388 pointBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-point-border").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2)).append("path").attr("transform", "translate(11.5, 8)").attr("d", "M 17,8 C 17,13 11,21 8.5,23.5 C 6,21 0,13 0,8 C 0,4 4,-0.5 8.5,-0.5 C 13,-0.5 17,4 17,8 z");
69389 pointBorder = pointBorderEnter.merge(pointBorder);
69391 function renderCategoryBorder(container, category) {
69392 let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
69393 categoryBorder.exit().remove();
69394 let categoryBorderEnter = categoryBorder.enter();
69396 let svgEnter = categoryBorderEnter.append("svg").attr("class", "preset-icon-fill preset-icon-category-border").attr("width", d2).attr("height", d2).attr("viewBox", "0 0 ".concat(d2, " ").concat(d2));
69397 svgEnter.append("path").attr("class", "area").attr("d", "M9.5,7.5 L25.5,7.5 L28.5,12.5 L49.5,12.5 C51.709139,12.5 53.5,14.290861 53.5,16.5 L53.5,43.5 C53.5,45.709139 51.709139,47.5 49.5,47.5 L10.5,47.5 C8.290861,47.5 6.5,45.709139 6.5,43.5 L6.5,12.5 L9.5,7.5 Z");
69398 categoryBorder = categoryBorderEnter.merge(categoryBorder);
69400 categoryBorder.selectAll("path").attr("class", "area ".concat(category.id));
69403 function renderCircleFill(container, drawVertex) {
69404 let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
69405 vertexFill.exit().remove();
69406 let vertexFillEnter = vertexFill.enter();
69410 vertexFillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-vertex").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2)).append("circle").attr("cx", w2 / 2).attr("cy", h2 / 2).attr("r", d2 / 2);
69411 vertexFill = vertexFillEnter.merge(vertexFill);
69413 function renderSquareFill(container, drawArea, tagClasses) {
69414 let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
69415 fill.exit().remove();
69416 let fillEnter = fill.enter();
69420 const l2 = d2 * 2 / 3;
69421 const c1 = (w2 - l2) / 2;
69422 const c2 = c1 + l2;
69423 fillEnter = fillEnter.append("svg").attr("class", "preset-icon-fill preset-icon-fill-area").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
69424 ["fill", "stroke"].forEach((klass) => {
69425 fillEnter.append("path").attr("d", "M".concat(c1, " ").concat(c1, " L").concat(c1, " ").concat(c2, " L").concat(c2, " ").concat(c2, " L").concat(c2, " ").concat(c1, " Z")).attr("class", "area ".concat(klass));
69427 const rVertex = 2.5;
69428 [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point2) => {
69429 fillEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rVertex);
69431 const rMidpoint = 1.25;
69432 [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point2) => {
69433 fillEnter.append("circle").attr("class", "midpoint").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", rMidpoint);
69435 fill = fillEnter.merge(fill);
69436 fill.selectAll("path.stroke").attr("class", "area stroke ".concat(tagClasses));
69437 fill.selectAll("path.fill").attr("class", "area fill ".concat(tagClasses));
69439 function renderLine(container, drawLine, tagClasses) {
69440 let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
69441 line.exit().remove();
69442 let lineEnter = line.enter();
69446 const y2 = Math.round(d2 * 0.72);
69447 const l2 = Math.round(d2 * 0.6);
69449 const x12 = (w2 - l2) / 2;
69450 const x2 = x12 + l2;
69451 lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
69452 ["casing", "stroke"].forEach((klass) => {
69453 lineEnter.append("path").attr("d", "M".concat(x12, " ").concat(y2, " L").concat(x2, " ").concat(y2)).attr("class", "line ".concat(klass));
69455 [[x12 - 1, y2], [x2 + 1, y2]].forEach((point2) => {
69456 lineEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
69458 line = lineEnter.merge(line);
69459 line.selectAll("path.stroke").attr("class", "line stroke ".concat(tagClasses));
69460 line.selectAll("path.casing").attr("class", "line casing ".concat(tagClasses));
69462 function renderRoute(container, drawRoute, p2) {
69463 let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
69464 route.exit().remove();
69465 let routeEnter = route.enter();
69469 const y12 = Math.round(d2 * 0.8);
69470 const y2 = Math.round(d2 * 0.68);
69471 const l2 = Math.round(d2 * 0.6);
69473 const x12 = (w2 - l2) / 2;
69474 const x2 = x12 + l2 / 3;
69475 const x3 = x2 + l2 / 3;
69476 const x4 = x3 + l2 / 3;
69477 routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
69478 ["casing", "stroke"].forEach((klass) => {
69479 routeEnter.append("path").attr("d", "M".concat(x12, " ").concat(y12, " L").concat(x2, " ").concat(y2)).attr("class", "segment0 line ".concat(klass));
69480 routeEnter.append("path").attr("d", "M".concat(x2, " ").concat(y2, " L").concat(x3, " ").concat(y12)).attr("class", "segment1 line ".concat(klass));
69481 routeEnter.append("path").attr("d", "M".concat(x3, " ").concat(y12, " L").concat(x4, " ").concat(y2)).attr("class", "segment2 line ".concat(klass));
69483 [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point2) => {
69484 routeEnter.append("circle").attr("class", "vertex").attr("cx", point2[0]).attr("cy", point2[1]).attr("r", r2);
69486 route = routeEnter.merge(route);
69488 let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
69489 const segmentPresetIDs = routeSegments[routeType];
69490 for (let i3 in segmentPresetIDs) {
69491 const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
69492 const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
69493 route.selectAll("path.stroke.segment".concat(i3)).attr("class", "segment".concat(i3, " line stroke ").concat(segmentTagClasses));
69494 route.selectAll("path.casing.segment".concat(i3)).attr("class", "segment".concat(i3, " line casing ").concat(segmentTagClasses));
69498 function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
69499 const isMaki = picon && /^maki-/.test(picon);
69500 const isTemaki = picon && /^temaki-/.test(picon);
69501 const isFa = picon && /^fa[srb]-/.test(picon);
69502 const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
69503 const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
69504 let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
69505 icon2.exit().remove();
69506 icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
69507 icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
69508 icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
69509 icon2.selectAll("use").attr("href", "#" + picon);
69511 function renderImageIcon(container, imageURL) {
69512 let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
69513 imageIcon.exit().remove();
69514 imageIcon = imageIcon.enter().append("img").attr("class", "image-icon").on("load", () => container.classed("showing-img", true)).on("error", () => container.classed("showing-img", false)).merge(imageIcon);
69515 imageIcon.attr("src", imageURL);
69517 const routeSegments = {
69518 bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
69519 bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
69520 trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
69521 detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
69522 ferry: ["route/ferry", "route/ferry", "route/ferry"],
69523 foot: ["highway/footway", "highway/footway", "highway/footway"],
69524 hiking: ["highway/path", "highway/path", "highway/path"],
69525 horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
69526 light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
69527 monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
69528 mtb: ["highway/path", "highway/track", "highway/bridleway"],
69529 pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
69530 piste: ["piste/downhill", "piste/hike", "piste/nordic"],
69531 power: ["power/line", "power/line", "power/line"],
69532 road: ["highway/secondary", "highway/primary", "highway/trunk"],
69533 subway: ["railway/subway", "railway/subway", "railway/subway"],
69534 train: ["railway/rail", "railway/rail", "railway/rail"],
69535 tram: ["railway/tram", "railway/tram", "railway/tram"],
69536 railway: ["railway/rail", "railway/rail", "railway/rail"],
69537 waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
69539 function render() {
69540 let p2 = _preset.apply(this, arguments);
69541 let geom = _geometry ? _geometry.apply(this, arguments) : null;
69542 if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
69545 const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
69546 const isFallback = p2.isFallback && p2.isFallback();
69547 const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
69548 const picon = getIcon(p2, geom);
69549 const isCategory = !p2.setTags;
69550 const drawPoint = false;
69551 const drawVertex = picon !== null && geom === "vertex";
69552 const drawLine = picon && geom === "line" && !isFallback && !isCategory;
69553 const drawArea = picon && geom === "area" && !isFallback && !isCategory;
69554 const drawRoute = picon && geom === "route";
69555 const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
69556 let tags = !isCategory ? p2.setTags({}, geom) : {};
69557 for (let k2 in tags) {
69558 if (tags[k2] === "*") {
69562 let tagClasses = svgTagClasses().getClassesString(tags, "");
69563 let selection2 = select_default2(this);
69564 let container = selection2.selectAll(".preset-icon-container").data([0]);
69565 container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
69566 container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
69567 renderCategoryBorder(container, isCategory && p2);
69568 renderPointBorder(container, drawPoint);
69569 renderCircleFill(container, drawVertex);
69570 renderSquareFill(container, drawArea, tagClasses);
69571 renderLine(container, drawLine, tagClasses);
69572 renderRoute(container, drawRoute, p2);
69573 renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
69574 renderImageIcon(container, imageURL);
69576 presetIcon.preset = function(val) {
69577 if (!arguments.length)
69579 _preset = utilFunctor(val);
69582 presetIcon.geometry = function(val) {
69583 if (!arguments.length)
69585 _geometry = utilFunctor(val);
69591 // modules/ui/sections/feature_type.js
69592 function uiSectionFeatureType(context) {
69593 var dispatch14 = dispatch_default("choose");
69594 var _entityIDs = [];
69597 var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
69598 function renderDisclosureContent(selection2) {
69599 selection2.classed("preset-list-item", true);
69600 selection2.classed("mixed-types", _presets.length > 1);
69601 var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
69602 var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
69603 uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
69605 presetButton.append("div").attr("class", "preset-icon-container");
69606 presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
69607 presetButtonWrap.append("div").attr("class", "accessory-buttons");
69608 var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
69609 tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
69610 if (_tagReference) {
69611 selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
69612 tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
69614 selection2.selectAll(".preset-reset").on("click", function() {
69615 dispatch14.call("choose", this, _presets);
69616 }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
69617 d3_event.preventDefault();
69618 d3_event.stopPropagation();
69620 var geometries = entityGeometries();
69621 selection2.select(".preset-list-item button").call(
69622 uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
69624 var names = _presets.length === 1 ? [
69625 _presets[0].nameLabel(),
69626 _presets[0].subtitleLabel()
69627 ].filter(Boolean) : [_t.append("inspector.multiple_types")];
69628 var label = selection2.select(".label-inner");
69629 var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
69630 nameparts.exit().remove();
69631 nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
69632 d2(select_default2(this));
69635 section.entityIDs = function(val) {
69636 if (!arguments.length)
69641 section.presets = function(val) {
69642 if (!arguments.length)
69644 if (!utilArrayIdentical(val, _presets)) {
69646 if (_presets.length === 1) {
69647 _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
69652 function entityGeometries() {
69654 for (var i3 in _entityIDs) {
69655 var geometry = context.graph().geometry(_entityIDs[i3]);
69656 if (!counts[geometry])
69657 counts[geometry] = 0;
69658 counts[geometry] += 1;
69660 return Object.keys(counts).sort(function(geom1, geom2) {
69661 return counts[geom2] - counts[geom1];
69664 return utilRebind(section, dispatch14, "on");
69667 // modules/ui/sections/preset_fields.js
69668 function uiSectionPresetFields(context) {
69669 var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
69670 var dispatch14 = dispatch_default("change", "revert");
69671 var formFields = uiFormFields(context);
69677 function renderDisclosureContent(selection2) {
69679 var graph = context.graph();
69680 var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
69681 geoms[graph.entity(entityID).geometry(graph)] = true;
69684 const loc = _entityIDs.reduce(function(extent, entityID) {
69685 var entity = context.graph().entity(entityID);
69686 return extent.extend(entity.extent(context.graph()));
69687 }, geoExtent()).center();
69688 var presetsManager = _mainPresetIndex;
69689 var allFields = [];
69690 var allMoreFields = [];
69691 var sharedTotalFields;
69692 _presets.forEach(function(preset) {
69693 var fields = preset.fields(loc);
69694 var moreFields = preset.moreFields(loc);
69695 allFields = utilArrayUnion(allFields, fields);
69696 allMoreFields = utilArrayUnion(allMoreFields, moreFields);
69697 if (!sharedTotalFields) {
69698 sharedTotalFields = utilArrayUnion(fields, moreFields);
69700 sharedTotalFields = sharedTotalFields.filter(function(field) {
69701 return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
69705 var sharedFields = allFields.filter(function(field) {
69706 return sharedTotalFields.indexOf(field) !== -1;
69708 var sharedMoreFields = allMoreFields.filter(function(field) {
69709 return sharedTotalFields.indexOf(field) !== -1;
69712 sharedFields.forEach(function(field) {
69713 if (field.matchAllGeometry(geometries)) {
69715 uiField(context, field, _entityIDs)
69719 var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
69720 if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
69722 uiField(context, presetsManager.field("restrictions"), _entityIDs)
69725 var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
69726 additionalFields.sort(function(field1, field2) {
69727 return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
69729 additionalFields.forEach(function(field) {
69730 if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
69732 uiField(context, field, _entityIDs, { show: false })
69736 _fieldsArr.forEach(function(field) {
69737 field.on("change", function(t2, onInput) {
69738 dispatch14.call("change", field, _entityIDs, t2, onInput);
69739 }).on("revert", function(keys2) {
69740 dispatch14.call("revert", field, keys2);
69744 _fieldsArr.forEach(function(field) {
69745 field.state(_state).tags(_tags);
69748 formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
69751 section.presets = function(val) {
69752 if (!arguments.length)
69754 if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
69760 section.state = function(val) {
69761 if (!arguments.length)
69766 section.tags = function(val) {
69767 if (!arguments.length)
69772 section.entityIDs = function(val) {
69773 if (!arguments.length)
69775 if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
69781 return utilRebind(section, dispatch14, "on");
69784 // modules/ui/sections/raw_member_editor.js
69785 function uiSectionRawMemberEditor(context) {
69786 var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
69787 if (!_entityIDs || _entityIDs.length !== 1)
69789 var entity = context.hasEntity(_entityIDs[0]);
69790 return entity && entity.type === "relation";
69791 }).label(function() {
69792 var entity = context.hasEntity(_entityIDs[0]);
69795 var gt2 = entity.members.length > _maxMembers ? ">" : "";
69796 var count = gt2 + entity.members.slice(0, _maxMembers).length;
69797 return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
69798 }).disclosureContent(renderDisclosureContent);
69799 var taginfo = services.taginfo;
69801 var _maxMembers = 1e3;
69802 function downloadMember(d3_event, d2) {
69803 d3_event.preventDefault();
69804 select_default2(this).classed("loading", true);
69805 context.loadEntity(d2.id, function() {
69806 section.reRender();
69809 function zoomToMember(d3_event, d2) {
69810 d3_event.preventDefault();
69811 var entity = context.entity(d2.id);
69812 context.map().zoomToEase(entity);
69813 utilHighlightEntities([d2.id], true, context);
69815 function selectMember(d3_event, d2) {
69816 d3_event.preventDefault();
69817 utilHighlightEntities([d2.id], false, context);
69818 var entity = context.entity(d2.id);
69819 var mapExtent = context.map().extent();
69820 if (!entity.intersects(mapExtent, context.graph())) {
69821 context.map().zoomToEase(entity);
69823 context.enter(modeSelect(context, [d2.id]));
69825 function changeRole(d3_event, d2) {
69826 var oldRole = d2.role;
69827 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
69828 if (oldRole !== newRole) {
69829 var member = { id: d2.id, type: d2.type, role: newRole };
69831 actionChangeMember(d2.relation.id, member, d2.index),
69832 _t("operations.change_role.annotation", {
69836 context.validator().validate();
69839 function deleteMember(d3_event, d2) {
69840 utilHighlightEntities([d2.id], false, context);
69842 actionDeleteMember(d2.relation.id, d2.index),
69843 _t("operations.delete_member.annotation", {
69847 if (!context.hasEntity(d2.relation.id)) {
69848 context.enter(modeBrowse(context));
69850 context.validator().validate();
69853 function renderDisclosureContent(selection2) {
69854 var entityID = _entityIDs[0];
69855 var memberships = [];
69856 var entity = context.entity(entityID);
69857 entity.members.slice(0, _maxMembers).forEach(function(member, index) {
69864 member: context.hasEntity(member.id),
69865 domId: utilUniqueDomId(entityID + "-member-" + index)
69868 var list2 = selection2.selectAll(".member-list").data([0]);
69869 list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
69870 var items = list2.selectAll("li").data(memberships, function(d2) {
69871 return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
69873 items.exit().each(unbind).remove();
69874 var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
69877 itemsEnter.each(function(d2) {
69878 var item = select_default2(this);
69879 var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
69881 item.on("mouseover", function() {
69882 utilHighlightEntities([d2.id], true, context);
69883 }).on("mouseout", function() {
69884 utilHighlightEntities([d2.id], false, context);
69886 var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
69887 labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
69888 var matched = _mainPresetIndex.match(d4.member, context.graph());
69889 return matched && matched.name() || utilDisplayType(d4.member.id);
69891 labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d4) => d4.member.type === "relation" && d4.member.tags.colour && isColourValid(d4.member.tags.colour)).style("border-color", (d4) => d4.member.type === "relation" && d4.member.tags.colour).text(function(d4) {
69892 return utilDisplayName(d4.member);
69894 label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
69895 label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
69897 var labelText = label.append("span").attr("class", "label-text");
69898 labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
69899 labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
69900 label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
69903 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
69904 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
69906 }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
69908 wrapEnter.each(bindTypeahead);
69910 items = items.merge(itemsEnter).order();
69911 items.select("input.member-role").property("value", function(d2) {
69913 }).on("blur", changeRole).on("change", changeRole);
69914 items.select("button.member-delete").on("click", deleteMember);
69915 var dragOrigin, targetIndex;
69917 drag_default().on("start", function(d3_event) {
69922 targetIndex = null;
69923 }).on("drag", function(d3_event) {
69924 var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
69925 if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
69926 Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5)
69928 var index = items.nodes().indexOf(this);
69929 select_default2(this).classed("dragging", true);
69930 targetIndex = null;
69931 selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
69932 var node = select_default2(this).node();
69933 if (index === index2) {
69934 return "translate(" + x2 + "px, " + y2 + "px)";
69935 } else if (index2 > index && d3_event.y > node.offsetTop) {
69936 if (targetIndex === null || index2 > targetIndex) {
69937 targetIndex = index2;
69939 return "translateY(-100%)";
69940 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
69941 if (targetIndex === null || index2 < targetIndex) {
69942 targetIndex = index2;
69944 return "translateY(100%)";
69948 }).on("end", function(d3_event, d2) {
69949 if (!select_default2(this).classed("dragging"))
69951 var index = items.nodes().indexOf(this);
69952 select_default2(this).classed("dragging", false);
69953 selection2.selectAll("li.member-row").style("transform", null);
69954 if (targetIndex !== null) {
69956 actionMoveMember(d2.relation.id, index, targetIndex),
69957 _t("operations.reorder_members.annotation")
69959 context.validator().validate();
69963 function bindTypeahead(d2) {
69964 var row = select_default2(this);
69965 var role = row.selectAll("input.member-role");
69966 var origValue = role.property("value");
69967 function sort(value, data) {
69968 var sameletter = [];
69970 for (var i3 = 0; i3 < data.length; i3++) {
69971 if (data[i3].value.substring(0, value.length) === value) {
69972 sameletter.push(data[i3]);
69974 other.push(data[i3]);
69977 return sameletter.concat(other);
69980 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
69983 geometry = context.graph().geometry(d2.member.id);
69984 } else if (d2.type === "relation") {
69985 geometry = "relation";
69986 } else if (d2.type === "way") {
69989 geometry = "point";
69991 var rtype = entity.tags.type;
69994 rtype: rtype || "",
69997 }, function(err, data) {
69999 callback(sort(role2, data));
70001 }).on("cancel", function() {
70002 role.property("value", origValue);
70006 function unbind() {
70007 var row = select_default2(this);
70008 row.selectAll("input.member-role").call(uiCombobox.off, context);
70011 section.entityIDs = function(val) {
70012 if (!arguments.length)
70020 // modules/actions/delete_members.js
70021 function actionDeleteMembers(relationId, memberIndexes) {
70022 return function(graph) {
70023 memberIndexes.sort((a2, b2) => b2 - a2);
70024 for (var i3 in memberIndexes) {
70025 graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
70031 // modules/ui/sections/raw_membership_editor.js
70032 function uiSectionRawMembershipEditor(context) {
70033 var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
70034 return _entityIDs && _entityIDs.length;
70035 }).label(function() {
70036 var parents = getSharedParentRelations();
70037 var gt2 = parents.length > _maxMemberships ? ">" : "";
70038 var count = gt2 + parents.slice(0, _maxMemberships).length;
70039 return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
70040 }).disclosureContent(renderDisclosureContent);
70041 var taginfo = services.taginfo;
70042 var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
70044 utilHighlightEntities([d2.relation.id], true, context);
70045 }).itemsMouseLeave(function(d3_event, d2) {
70047 utilHighlightEntities([d2.relation.id], false, context);
70049 var _inChange = false;
70050 var _entityIDs = [];
70052 var _maxMemberships = 1e3;
70053 function getSharedParentRelations() {
70055 for (var i3 = 0; i3 < _entityIDs.length; i3++) {
70056 var entity = context.graph().hasEntity(_entityIDs[i3]);
70060 parents = context.graph().parentRelations(entity);
70062 parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
70064 if (!parents.length)
70069 function getMemberships() {
70070 var memberships = [];
70071 var relations = getSharedParentRelations().slice(0, _maxMemberships);
70072 var isMultiselect = _entityIDs.length > 1;
70073 var i3, relation, membership, index, member, indexedMember;
70074 for (i3 = 0; i3 < relations.length; i3++) {
70075 relation = relations[i3];
70079 hash: osmEntity.key(relation)
70081 for (index = 0; index < relation.members.length; index++) {
70082 member = relation.members[index];
70083 if (_entityIDs.indexOf(member.id) !== -1) {
70084 indexedMember = Object.assign({}, member, { index });
70085 membership.members.push(indexedMember);
70086 membership.hash += "," + index.toString();
70087 if (!isMultiselect) {
70088 memberships.push(membership);
70092 hash: osmEntity.key(relation)
70097 if (membership.members.length)
70098 memberships.push(membership);
70100 memberships.forEach(function(membership2) {
70101 membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
70103 membership2.members.forEach(function(member2) {
70104 if (roles.indexOf(member2.role) === -1)
70105 roles.push(member2.role);
70107 membership2.role = roles.length === 1 ? roles[0] : roles;
70109 return memberships;
70111 function selectRelation(d3_event, d2) {
70112 d3_event.preventDefault();
70113 utilHighlightEntities([d2.relation.id], false, context);
70114 context.enter(modeSelect(context, [d2.relation.id]));
70116 function zoomToRelation(d3_event, d2) {
70117 d3_event.preventDefault();
70118 var entity = context.entity(d2.relation.id);
70119 context.map().zoomToEase(entity);
70120 utilHighlightEntities([d2.relation.id], true, context);
70122 function changeRole(d3_event, d2) {
70127 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
70128 if (!newRole.trim() && typeof d2.role !== "string")
70130 var membersToUpdate = d2.members.filter(function(member) {
70131 return member.role !== newRole;
70133 if (membersToUpdate.length) {
70136 function actionChangeMemberRoles(graph) {
70137 membersToUpdate.forEach(function(member) {
70138 var newMember = Object.assign({}, member, { role: newRole });
70139 delete newMember.index;
70140 graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
70144 _t("operations.change_role.annotation", {
70145 n: membersToUpdate.length
70148 context.validator().validate();
70152 function addMembership(d2, role) {
70154 _showBlank = false;
70155 function actionAddMembers(relationId, ids, role2) {
70156 return function(graph) {
70157 for (var i3 in ids) {
70158 var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
70159 graph = actionAddMember(relationId, member)(graph);
70166 actionAddMembers(d2.relation.id, _entityIDs, role),
70167 _t("operations.add_member.annotation", {
70168 n: _entityIDs.length
70171 context.validator().validate();
70173 var relation = osmRelation();
70175 actionAddEntity(relation),
70176 actionAddMembers(relation.id, _entityIDs, role),
70177 _t("operations.add.annotation.relation")
70179 context.enter(modeSelect(context, [relation.id]).newFeature(true));
70182 function downloadMembers(d3_event, d2) {
70183 d3_event.preventDefault();
70184 const button = select_default2(this);
70185 button.classed("loading", true);
70186 context.loadEntity(d2.relation.id, function() {
70187 section.reRender();
70190 function deleteMembership(d3_event, d2) {
70194 utilHighlightEntities([d2.relation.id], false, context);
70195 var indexes = d2.members.map(function(member) {
70196 return member.index;
70199 actionDeleteMembers(d2.relation.id, indexes),
70200 _t("operations.delete_member.annotation", {
70201 n: _entityIDs.length
70204 context.validator().validate();
70206 function fetchNearbyRelations(q2, callback) {
70207 var newRelation = {
70209 value: _t("inspector.new_relation"),
70210 display: _t.append("inspector.new_relation")
70212 var entityID = _entityIDs[0];
70214 var graph = context.graph();
70215 function baseDisplayValue(entity) {
70216 var matched = _mainPresetIndex.match(entity, graph);
70217 var presetName = matched && matched.name() || _t("inspector.relation");
70218 var entityName = utilDisplayName(entity) || "";
70219 return presetName + " " + entityName;
70221 function baseDisplayLabel(entity) {
70222 var matched = _mainPresetIndex.match(entity, graph);
70223 var presetName = matched && matched.name() || _t("inspector.relation");
70224 var entityName = utilDisplayName(entity) || "";
70225 return (selection2) => {
70226 selection2.append("b").text(presetName + " ");
70227 selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
70230 var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
70231 if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
70233 relation: explicitRelation,
70234 value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
70235 display: baseDisplayLabel(explicitRelation)
70238 context.history().intersects(context.map().extent()).forEach(function(entity) {
70239 if (entity.type !== "relation" || entity.id === entityID)
70241 var value = baseDisplayValue(entity);
70242 if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1)
70247 display: baseDisplayLabel(entity)
70250 result.sort(function(a2, b2) {
70251 return osmRelation.creationOrder(a2.relation, b2.relation);
70253 var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
70254 return v2.length > 1;
70256 dupeGroups.forEach(function(group) {
70257 group.forEach(function(obj) {
70258 obj.value += " " + obj.relation.id;
70262 result.forEach(function(obj) {
70263 obj.title = obj.value;
70265 result.unshift(newRelation);
70268 function renderDisclosureContent(selection2) {
70269 var memberships = getMemberships();
70270 var list2 = selection2.selectAll(".member-list").data([0]);
70271 list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
70272 var items = list2.selectAll("li.member-row-normal").data(memberships, function(d2) {
70275 items.exit().each(unbind).remove();
70276 var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
70277 itemsEnter.on("mouseover", function(d3_event, d2) {
70278 utilHighlightEntities([d2.relation.id], true, context);
70279 }).on("mouseout", function(d3_event, d2) {
70280 utilHighlightEntities([d2.relation.id], false, context);
70282 var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
70285 var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
70286 labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
70287 var matched = _mainPresetIndex.match(d2.relation, context.graph());
70288 return matched && matched.name() || _t.html("inspector.relation");
70290 labelLink.append("span").attr("class", "member-entity-name").classed("has-colour", (d2) => d2.relation.tags.colour && isColourValid(d2.relation.tags.colour)).style("border-color", (d2) => d2.relation.tags.colour).text(function(d2) {
70291 return utilDisplayName(d2.relation);
70293 labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
70294 labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
70295 labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
70296 items = items.merge(itemsEnter);
70297 items.selectAll("button.members-download").classed("hide", (d2) => {
70298 const graph = context.graph();
70299 return d2.relation.members.every((m2) => graph.hasEntity(m2.id));
70301 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
70302 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
70304 }).property("type", "text").property("value", function(d2) {
70305 return typeof d2.role === "string" ? d2.role : "";
70306 }).attr("title", function(d2) {
70307 return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
70308 }).attr("placeholder", function(d2) {
70309 return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
70310 }).classed("mixed", function(d2) {
70311 return Array.isArray(d2.role);
70312 }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
70314 wrapEnter.each(bindTypeahead);
70316 var newMembership = list2.selectAll(".member-row-new").data(_showBlank ? [0] : []);
70317 newMembership.exit().remove();
70318 var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
70319 var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
70320 newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
70321 newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
70322 list2.selectAll(".member-row-new").remove();
70324 var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
70325 newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
70326 newMembership = newMembership.merge(newMembershipEnter);
70327 newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
70328 nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
70330 var addRow = selection2.selectAll(".add-row").data([0]);
70331 var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
70332 var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
70333 addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
70334 addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
70335 addRowEnter.append("div").attr("class", "space-value");
70336 addRowEnter.append("div").attr("class", "space-buttons");
70337 addRow = addRow.merge(addRowEnter);
70338 addRow.select(".add-relation").on("click", function() {
70340 section.reRender();
70341 list2.selectAll(".member-entity-input").node().focus();
70343 function acceptEntity(d2) {
70349 utilHighlightEntities([d2.relation.id], false, context);
70350 var role = context.cleanRelationRole(list2.selectAll(".member-row-new .member-role").property("value"));
70351 addMembership(d2, role);
70353 function cancelEntity() {
70354 var input = newMembership.selectAll(".member-entity-input");
70355 input.property("value", "");
70356 context.surface().selectAll(".highlighted").classed("highlighted", false);
70358 function bindTypeahead(d2) {
70359 var row = select_default2(this);
70360 var role = row.selectAll("input.member-role");
70361 var origValue = role.property("value");
70362 function sort(value, data) {
70363 var sameletter = [];
70365 for (var i3 = 0; i3 < data.length; i3++) {
70366 if (data[i3].value.substring(0, value.length) === value) {
70367 sameletter.push(data[i3]);
70369 other.push(data[i3]);
70372 return sameletter.concat(other);
70375 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
70376 var rtype = d2.relation.tags.type;
70379 rtype: rtype || "",
70380 geometry: context.graph().geometry(_entityIDs[0]),
70382 }, function(err, data) {
70384 callback(sort(role2, data));
70386 }).on("cancel", function() {
70387 role.property("value", origValue);
70391 function unbind() {
70392 var row = select_default2(this);
70393 row.selectAll("input.member-role").call(uiCombobox.off, context);
70396 section.entityIDs = function(val) {
70397 if (!arguments.length)
70400 _showBlank = false;
70406 // modules/ui/sections/selection_list.js
70407 function uiSectionSelectionList(context) {
70408 var _selectedIDs = [];
70409 var section = uiSection("selected-features", context).shouldDisplay(function() {
70410 return _selectedIDs.length > 1;
70411 }).label(function() {
70412 return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
70413 }).disclosureContent(renderDisclosureContent);
70414 context.history().on("change.selectionList", function(difference2) {
70416 section.reRender();
70419 section.entityIDs = function(val) {
70420 if (!arguments.length)
70421 return _selectedIDs;
70422 _selectedIDs = val;
70425 function selectEntity(d3_event, entity) {
70426 context.enter(modeSelect(context, [entity.id]));
70428 function deselectEntity(d3_event, entity) {
70429 var selectedIDs = _selectedIDs.slice();
70430 var index = selectedIDs.indexOf(entity.id);
70432 selectedIDs.splice(index, 1);
70433 context.enter(modeSelect(context, selectedIDs));
70436 function renderDisclosureContent(selection2) {
70437 var list2 = selection2.selectAll(".feature-list").data([0]);
70438 list2 = list2.enter().append("ul").attr("class", "feature-list").merge(list2);
70439 var entities = _selectedIDs.map(function(id2) {
70440 return context.hasEntity(id2);
70441 }).filter(Boolean);
70442 var items = list2.selectAll(".feature-list-item").data(entities, osmEntity.key);
70443 items.exit().remove();
70444 var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
70445 select_default2(this).on("mouseover", function() {
70446 utilHighlightEntities([d2.id], true, context);
70447 }).on("mouseout", function() {
70448 utilHighlightEntities([d2.id], false, context);
70451 var label = enter.append("button").attr("class", "label").on("click", selectEntity);
70452 label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
70453 label.append("span").attr("class", "entity-type");
70454 label.append("span").attr("class", "entity-name");
70455 enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
70456 items = items.merge(enter);
70457 items.selectAll(".entity-geom-icon use").attr("href", function() {
70458 var entity = this.parentNode.parentNode.__data__;
70459 return "#iD-icon-" + entity.geometry(context.graph());
70461 items.selectAll(".entity-type").text(function(entity) {
70462 return _mainPresetIndex.match(entity, context.graph()).name();
70464 items.selectAll(".entity-name").text(function(d2) {
70465 var entity = context.entity(d2.id);
70466 return utilDisplayName(entity);
70472 // modules/ui/entity_editor.js
70473 function uiEntityEditor(context) {
70474 var dispatch14 = dispatch_default("choose");
70475 var _state = "select";
70476 var _coalesceChanges = false;
70477 var _modified = false;
70480 var _activePresets = [];
70483 function entityEditor(selection2) {
70484 var combinedTags = utilCombinedTags(_entityIDs, context.graph());
70485 var header = selection2.selectAll(".header").data([0]);
70486 var headerEnter = header.enter().append("div").attr("class", "header fillL");
70487 var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
70488 headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon("#iD-icon-".concat(direction)));
70489 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
70490 context.enter(modeBrowse(context));
70491 }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
70492 headerEnter.append("h2");
70493 header = header.merge(headerEnter);
70494 header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
70495 header.selectAll(".preset-reset").on("click", function() {
70496 dispatch14.call("choose", this, _activePresets);
70498 var body = selection2.selectAll(".inspector-body").data([0]);
70499 var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
70500 body = body.merge(bodyEnter);
70503 uiSectionSelectionList(context),
70504 uiSectionFeatureType(context).on("choose", function(presets) {
70505 dispatch14.call("choose", this, presets);
70507 uiSectionEntityIssues(context),
70508 uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
70509 uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
70510 uiSectionRawMemberEditor(context),
70511 uiSectionRawMembershipEditor(context)
70514 _sections.forEach(function(section) {
70515 if (section.entityIDs) {
70516 section.entityIDs(_entityIDs);
70518 if (section.presets) {
70519 section.presets(_activePresets);
70521 if (section.tags) {
70522 section.tags(combinedTags);
70524 if (section.state) {
70525 section.state(_state);
70527 body.call(section.render);
70529 context.history().on("change.entity-editor", historyChanged);
70530 function historyChanged(difference2) {
70531 if (selection2.selectAll(".entity-editor").empty())
70533 if (_state === "hide")
70535 var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
70538 _entityIDs = _entityIDs.filter(context.hasEntity);
70539 if (!_entityIDs.length)
70541 var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
70542 loadActivePresets();
70543 var graph = context.graph();
70544 entityEditor.modified(_base !== graph);
70545 entityEditor(selection2);
70546 if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
70547 context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
70551 function changeTags(entityIDs, changed, onInput) {
70553 for (var i3 in entityIDs) {
70554 var entityID = entityIDs[i3];
70555 var entity = context.entity(entityID);
70556 var tags = Object.assign({}, entity.tags);
70557 if (typeof changed === "function") {
70558 tags = changed(tags);
70560 for (var k2 in changed) {
70563 var v2 = changed[k2];
70564 if (typeof v2 === "object") {
70565 tags[k2] = tags[v2.oldKey];
70566 } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70572 tags = utilCleanTags(tags);
70574 if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
70575 actions.push(actionChangeTags(entityID, tags));
70578 if (actions.length) {
70579 var combinedAction = function(graph) {
70580 actions.forEach(function(action) {
70581 graph = action(graph);
70585 var annotation = _t("operations.change_tags.annotation");
70586 if (_coalesceChanges) {
70587 context.overwrite(combinedAction, annotation);
70589 context.perform(combinedAction, annotation);
70590 _coalesceChanges = !!onInput;
70594 context.validator().validate();
70597 function revertTags(keys2) {
70599 for (var i3 in _entityIDs) {
70600 var entityID = _entityIDs[i3];
70601 var original = context.graph().base().entities[entityID];
70603 for (var j2 in keys2) {
70604 var key = keys2[j2];
70605 changed[key] = original ? original.tags[key] : void 0;
70607 var entity = context.entity(entityID);
70608 var tags = Object.assign({}, entity.tags);
70609 for (var k2 in changed) {
70612 var v2 = changed[k2];
70613 if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
70617 tags = utilCleanTags(tags);
70618 if (!(0, import_fast_deep_equal10.default)(entity.tags, tags)) {
70619 actions.push(actionChangeTags(entityID, tags));
70622 if (actions.length) {
70623 var combinedAction = function(graph) {
70624 actions.forEach(function(action) {
70625 graph = action(graph);
70629 var annotation = _t("operations.change_tags.annotation");
70630 if (_coalesceChanges) {
70631 context.overwrite(combinedAction, annotation);
70633 context.perform(combinedAction, annotation);
70634 _coalesceChanges = false;
70637 context.validator().validate();
70639 entityEditor.modified = function(val) {
70640 if (!arguments.length)
70643 return entityEditor;
70645 entityEditor.state = function(val) {
70646 if (!arguments.length)
70649 return entityEditor;
70651 entityEditor.entityIDs = function(val) {
70652 if (!arguments.length)
70654 _base = context.graph();
70655 _coalesceChanges = false;
70656 if (val && _entityIDs && utilArrayIdentical(_entityIDs, val))
70657 return entityEditor;
70659 loadActivePresets(true);
70660 return entityEditor.modified(false);
70662 entityEditor.newFeature = function(val) {
70663 if (!arguments.length)
70664 return _newFeature;
70666 return entityEditor;
70668 function loadActivePresets(isForNewSelection) {
70669 var graph = context.graph();
70671 for (var i3 in _entityIDs) {
70672 var entity = graph.hasEntity(_entityIDs[i3]);
70675 var match = _mainPresetIndex.match(entity, graph);
70676 if (!counts[match.id])
70677 counts[match.id] = 0;
70678 counts[match.id] += 1;
70680 var matches = Object.keys(counts).sort(function(p1, p2) {
70681 return counts[p2] - counts[p1];
70682 }).map(function(pID) {
70683 return _mainPresetIndex.item(pID);
70685 if (!isForNewSelection) {
70686 var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
70687 if (weakPreset && matches.length === 1 && matches[0].isFallback())
70690 entityEditor.presets(matches);
70692 entityEditor.presets = function(val) {
70693 if (!arguments.length)
70694 return _activePresets;
70695 if (!utilArrayIdentical(val, _activePresets)) {
70696 _activePresets = val;
70698 return entityEditor;
70700 return utilRebind(entityEditor, dispatch14, "on");
70703 // modules/ui/feature_list.js
70704 var sexagesimal = __toESM(require_sexagesimal());
70706 // modules/modes/draw_area.js
70707 function modeDrawArea(context, wayID, startGraph, button) {
70712 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
70713 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
70715 mode.wayID = wayID;
70716 mode.enter = function() {
70717 context.install(behavior);
70719 mode.exit = function() {
70720 context.uninstall(behavior);
70722 mode.selectedIDs = function() {
70725 mode.activeID = function() {
70726 return behavior && behavior.activeID() || [];
70731 // modules/modes/add_area.js
70732 function modeAddArea(context, mode) {
70733 mode.id = "add-area";
70734 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
70735 function defaultTags(loc) {
70736 var defaultTags2 = { area: "yes" };
70738 defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
70739 return defaultTags2;
70741 function actionClose(wayId) {
70742 return function(graph) {
70743 return graph.replace(graph.entity(wayId).close());
70746 function start2(loc) {
70747 var startGraph = context.graph();
70748 var node = osmNode({ loc });
70749 var way = osmWay({ tags: defaultTags(loc) });
70751 actionAddEntity(node),
70752 actionAddEntity(way),
70753 actionAddVertex(way.id, node.id),
70754 actionClose(way.id)
70756 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
70758 function startFromWay(loc, edge) {
70759 var startGraph = context.graph();
70760 var node = osmNode({ loc });
70761 var way = osmWay({ tags: defaultTags(loc) });
70763 actionAddEntity(node),
70764 actionAddEntity(way),
70765 actionAddVertex(way.id, node.id),
70766 actionClose(way.id),
70767 actionAddMidpoint({ loc, edge }, node)
70769 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
70771 function startFromNode(node) {
70772 var startGraph = context.graph();
70773 var way = osmWay({ tags: defaultTags(node.loc) });
70775 actionAddEntity(way),
70776 actionAddVertex(way.id, node.id),
70777 actionClose(way.id)
70779 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
70781 mode.enter = function() {
70782 context.install(behavior);
70784 mode.exit = function() {
70785 context.uninstall(behavior);
70790 // modules/modes/add_line.js
70791 function modeAddLine(context, mode) {
70792 mode.id = "add-line";
70793 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
70794 function defaultTags(loc) {
70795 var defaultTags2 = {};
70797 defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
70798 return defaultTags2;
70800 function start2(loc) {
70801 var startGraph = context.graph();
70802 var node = osmNode({ loc });
70803 var way = osmWay({ tags: defaultTags(loc) });
70805 actionAddEntity(node),
70806 actionAddEntity(way),
70807 actionAddVertex(way.id, node.id)
70809 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
70811 function startFromWay(loc, edge) {
70812 var startGraph = context.graph();
70813 var node = osmNode({ loc });
70814 var way = osmWay({ tags: defaultTags(loc) });
70816 actionAddEntity(node),
70817 actionAddEntity(way),
70818 actionAddVertex(way.id, node.id),
70819 actionAddMidpoint({ loc, edge }, node)
70821 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
70823 function startFromNode(node) {
70824 var startGraph = context.graph();
70825 var way = osmWay({ tags: defaultTags(node.loc) });
70827 actionAddEntity(way),
70828 actionAddVertex(way.id, node.id)
70830 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
70832 mode.enter = function() {
70833 context.install(behavior);
70835 mode.exit = function() {
70836 context.uninstall(behavior);
70841 // modules/modes/add_point.js
70842 function modeAddPoint(context, mode) {
70843 mode.id = "add-point";
70844 var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
70845 function defaultTags(loc) {
70846 var defaultTags2 = {};
70848 defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
70849 return defaultTags2;
70851 function add(loc) {
70852 var node = osmNode({ loc, tags: defaultTags(loc) });
70854 actionAddEntity(node),
70855 _t("operations.add.annotation.point")
70857 enterSelectMode(node);
70859 function addWay(loc, edge) {
70860 var node = osmNode({ tags: defaultTags(loc) });
70862 actionAddMidpoint({ loc, edge }, node),
70863 _t("operations.add.annotation.vertex")
70865 enterSelectMode(node);
70867 function enterSelectMode(node) {
70869 modeSelect(context, [node.id]).newFeature(true)
70872 function addNode(node) {
70873 const _defaultTags = defaultTags(node.loc);
70874 if (Object.keys(_defaultTags).length === 0) {
70875 enterSelectMode(node);
70878 var tags = Object.assign({}, node.tags);
70879 for (var key in _defaultTags) {
70880 tags[key] = _defaultTags[key];
70883 actionChangeTags(node.id, tags),
70884 _t("operations.add.annotation.point")
70886 enterSelectMode(node);
70888 function cancel() {
70889 context.enter(modeBrowse(context));
70891 mode.enter = function() {
70892 context.install(behavior);
70894 mode.exit = function() {
70895 context.uninstall(behavior);
70900 // modules/ui/note_comments.js
70901 function uiNoteComments() {
70903 function noteComments(selection2) {
70906 var comments = selection2.selectAll(".comments-container").data([0]);
70907 comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
70908 var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
70909 commentEnter.append("div").attr("class", function(d2) {
70910 return "comment-avatar user-" + d2.uid;
70911 }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
70912 var mainEnter = commentEnter.append("div").attr("class", "comment-main");
70913 var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
70914 metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
70915 var selection3 = select_default2(this);
70916 var osm = services.osm;
70917 if (osm && d2.user) {
70918 selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
70921 selection3.text(d2.user);
70923 selection3.call(_t.append("note.anonymous"));
70926 metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
70927 return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
70929 mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
70931 }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
70932 comments.call(replaceAvatars);
70934 function replaceAvatars(selection2) {
70935 var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
70936 var osm = services.osm;
70937 if (showThirdPartyIcons !== "true" || !osm)
70940 _note.comments.forEach(function(d2) {
70942 uids[d2.uid] = true;
70944 Object.keys(uids).forEach(function(uid) {
70945 osm.loadUser(uid, function(err, user) {
70946 if (!user || !user.image_url)
70948 selection2.selectAll(".comment-avatar.user-" + uid).html("").append("img").attr("class", "icon comment-avatar-icon").attr("src", user.image_url).attr("alt", user.display_name);
70952 function localeDateString2(s2) {
70955 var options2 = { day: "numeric", month: "short", year: "numeric" };
70956 s2 = s2.replace(/-/g, "/");
70957 var d2 = new Date(s2);
70958 if (isNaN(d2.getTime()))
70960 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
70962 noteComments.note = function(val) {
70963 if (!arguments.length)
70966 return noteComments;
70968 return noteComments;
70971 // modules/ui/note_header.js
70972 function uiNoteHeader() {
70974 function noteHeader(selection2) {
70975 var header = selection2.selectAll(".note-header").data(
70976 _note ? [_note] : [],
70978 return d2.status + d2.id;
70981 header.exit().remove();
70982 var headerEnter = header.enter().append("div").attr("class", "note-header");
70983 var iconEnter = headerEnter.append("div").attr("class", function(d2) {
70984 return "note-header-icon " + d2.status;
70985 }).classed("new", function(d2) {
70988 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
70989 iconEnter.each(function(d2) {
70992 statusIcon = "#iD-icon-plus";
70993 } else if (d2.status === "open") {
70994 statusIcon = "#iD-icon-close";
70996 statusIcon = "#iD-icon-apply";
70998 iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
71000 headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
71001 if (_note.isNew()) {
71002 return _t.html("note.new");
71004 return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
71007 noteHeader.note = function(val) {
71008 if (!arguments.length)
71016 // modules/ui/note_report.js
71017 function uiNoteReport() {
71019 function noteReport(selection2) {
71021 if (services.osm && _note instanceof osmNote && !_note.isNew()) {
71022 url = services.osm.noteReportURL(_note);
71024 var link3 = selection2.selectAll(".note-report").data(url ? [url] : []);
71025 link3.exit().remove();
71026 var linkEnter = link3.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
71028 }).call(svgIcon("#iD-icon-out-link", "inline"));
71029 linkEnter.append("span").call(_t.append("note.report"));
71031 noteReport.note = function(val) {
71032 if (!arguments.length)
71040 // modules/ui/view_on_osm.js
71041 function uiViewOnOSM(context) {
71043 function viewOnOSM(selection2) {
71045 if (_what instanceof osmEntity) {
71046 url = context.connection().entityURL(_what);
71047 } else if (_what instanceof osmNote) {
71048 url = context.connection().noteURL(_what);
71050 var data = !_what || _what.isNew() ? [] : [_what];
71051 var link3 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
71054 link3.exit().remove();
71055 var linkEnter = link3.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
71056 linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
71058 viewOnOSM.what = function(_2) {
71059 if (!arguments.length)
71067 // modules/ui/note_editor.js
71068 function uiNoteEditor(context) {
71069 var dispatch14 = dispatch_default("change");
71070 var noteComments = uiNoteComments(context);
71071 var noteHeader = uiNoteHeader();
71074 function noteEditor(selection2) {
71075 var header = selection2.selectAll(".header").data([0]);
71076 var headerEnter = header.enter().append("div").attr("class", "header fillL");
71077 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
71078 context.enter(modeBrowse(context));
71079 }).call(svgIcon("#iD-icon-close"));
71080 headerEnter.append("h2").call(_t.append("note.title"));
71081 var body = selection2.selectAll(".body").data([0]);
71082 body = body.enter().append("div").attr("class", "body").merge(body);
71083 var editor = body.selectAll(".note-editor").data([0]);
71084 editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
71085 var footer = selection2.selectAll(".footer").data([0]);
71086 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
71087 var osm = services.osm;
71089 osm.on("change.note-save", function() {
71090 selection2.call(noteEditor);
71094 function noteSaveSection(selection2) {
71095 var isSelected = _note && _note.id === context.selectedNoteID();
71096 var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
71097 return d2.status + d2.id;
71099 noteSave.exit().remove();
71100 var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
71101 noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
71102 if (_note.isNew()) {
71103 _t.append("note.newDescription")(select_default2(this));
71105 _t.append("note.newComment")(select_default2(this));
71108 var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
71109 return d2.newComment;
71110 }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
71111 if (!commentTextarea.empty() && _newNote) {
71112 commentTextarea.node().focus();
71114 noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
71115 function keydown(d3_event) {
71116 if (!(d3_event.keyCode === 13 && // ↩ Return
71119 var osm = services.osm;
71122 var hasAuth = osm.authenticated();
71125 if (!_note.newComment)
71127 d3_event.preventDefault();
71128 select_default2(this).on("keydown.note-input", null);
71129 window.setTimeout(function() {
71130 if (_note.isNew()) {
71131 noteSave.selectAll(".save-button").node().focus();
71134 noteSave.selectAll(".comment-button").node().focus();
71135 clickComment(_note);
71139 function changeInput() {
71140 var input = select_default2(this);
71141 var val = input.property("value").trim() || void 0;
71142 _note = _note.update({ newComment: val });
71143 var osm = services.osm;
71145 osm.replaceNote(_note);
71147 noteSave.call(noteSaveButtons);
71150 function userDetails(selection2) {
71151 var detailSection = selection2.selectAll(".detail-section").data([0]);
71152 detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
71153 var osm = services.osm;
71156 var hasAuth = osm.authenticated();
71157 var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
71158 authWarning.exit().transition().duration(200).style("opacity", 0).remove();
71159 var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
71160 authEnter.call(svgIcon("#iD-icon-alert", "inline"));
71161 authEnter.append("span").call(_t.append("note.login"));
71162 authEnter.append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.note-login", function(d3_event) {
71163 d3_event.preventDefault();
71164 osm.authenticate();
71166 authEnter.transition().duration(200).style("opacity", 1);
71167 var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
71168 prose.exit().remove();
71169 prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
71170 osm.userDetails(function(err, user) {
71173 var userLink = select_default2(document.createElement("div"));
71174 if (user.image_url) {
71175 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
71177 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
71178 prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
71181 function noteSaveButtons(selection2) {
71182 var osm = services.osm;
71183 var hasAuth = osm && osm.authenticated();
71184 var isSelected = _note && _note.id === context.selectedNoteID();
71185 var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
71186 return d2.status + d2.id;
71188 buttonSection.exit().remove();
71189 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71190 if (_note.isNew()) {
71191 buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
71192 buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
71194 buttonEnter.append("button").attr("class", "button status-button action");
71195 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
71197 buttonSection = buttonSection.merge(buttonEnter);
71198 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
71199 buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
71200 buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).text("").each(function(d2) {
71201 var action = d2.status === "open" ? "close" : "open";
71202 var andComment = d2.newComment ? "_comment" : "";
71203 _t.append("note." + action + andComment)(select_default2(this));
71205 buttonSection.select(".status-button").on("click.status", clickStatus);
71206 buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
71207 function isSaveDisabled(d2) {
71208 return hasAuth && d2.status === "open" && d2.newComment ? null : true;
71211 function clickCancel(d3_event, d2) {
71213 var osm = services.osm;
71215 osm.removeNote(d2);
71217 context.enter(modeBrowse(context));
71218 dispatch14.call("change");
71220 function clickSave(d3_event, d2) {
71222 var osm = services.osm;
71224 osm.postNoteCreate(d2, function(err, note) {
71225 dispatch14.call("change", note);
71229 function clickStatus(d3_event, d2) {
71231 var osm = services.osm;
71233 var setStatus = d2.status === "open" ? "closed" : "open";
71234 osm.postNoteUpdate(d2, setStatus, function(err, note) {
71235 dispatch14.call("change", note);
71239 function clickComment(d3_event, d2) {
71241 var osm = services.osm;
71243 osm.postNoteUpdate(d2, d2.status, function(err, note) {
71244 dispatch14.call("change", note);
71248 noteEditor.note = function(val) {
71249 if (!arguments.length)
71254 noteEditor.newNote = function(val) {
71255 if (!arguments.length)
71260 return utilRebind(noteEditor, dispatch14, "on");
71263 // modules/modes/select_note.js
71264 function modeSelectNote(context, selectedNoteID) {
71269 var _keybinding = utilKeybinding("select-note");
71270 var _noteEditor = uiNoteEditor(context).on("change", function() {
71271 context.map().pan([0, 0]);
71272 var note = checkSelectedID();
71275 context.ui().sidebar.show(_noteEditor.note(note));
71278 behaviorBreathe(context),
71279 behaviorHover(context),
71280 behaviorSelect(context),
71281 behaviorLasso(context),
71282 modeDragNode(context).behavior,
71283 modeDragNote(context).behavior
71285 var _newFeature = false;
71286 function checkSelectedID() {
71289 var note = services.osm.getNote(selectedNoteID);
71291 context.enter(modeBrowse(context));
71295 function selectNote(d3_event, drawn) {
71296 if (!checkSelectedID())
71298 var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
71299 if (selection2.empty()) {
71300 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
71301 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
71302 context.enter(modeBrowse(context));
71305 selection2.classed("selected", true);
71306 context.selectedNoteID(selectedNoteID);
71310 if (context.container().select(".combobox").size())
71312 context.enter(modeBrowse(context));
71314 mode.zoomToSelected = function() {
71317 var note = services.osm.getNote(selectedNoteID);
71319 context.map().centerZoomEase(note.loc, 20);
71322 mode.newFeature = function(val) {
71323 if (!arguments.length)
71324 return _newFeature;
71328 mode.enter = function() {
71329 var note = checkSelectedID();
71332 _behaviors.forEach(context.install);
71333 _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
71334 select_default2(document).call(_keybinding);
71336 var sidebar = context.ui().sidebar;
71337 sidebar.show(_noteEditor.note(note).newNote(_newFeature));
71338 sidebar.expand(sidebar.intersects(note.extent()));
71339 context.map().on("drawn.select", selectNote);
71341 mode.exit = function() {
71342 _behaviors.forEach(context.uninstall);
71343 select_default2(document).call(_keybinding.unbind);
71344 context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
71345 context.map().on("drawn.select", null);
71346 context.ui().sidebar.hide();
71347 context.selectedNoteID(null);
71352 // modules/modes/add_note.js
71353 function modeAddNote(context) {
71357 description: _t.append("modes.add_note.description"),
71358 key: _t("modes.add_note.key")
71360 var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
71361 function add(loc) {
71362 var osm = services.osm;
71365 var note = osmNote({ loc, status: "open", comments: [] });
71366 osm.replaceNote(note);
71367 context.map().pan([0, 0]);
71368 context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
71370 function cancel() {
71371 context.enter(modeBrowse(context));
71373 mode.enter = function() {
71374 context.install(behavior);
71376 mode.exit = function() {
71377 context.uninstall(behavior);
71382 // node_modules/osm-community-index/lib/simplify.js
71383 var import_diacritics2 = __toESM(require_diacritics(), 1);
71384 function simplify(str) {
71385 if (typeof str !== "string")
71387 return import_diacritics2.default.remove(
71388 str.replace(/&/g, "and").replace(/(İ|i̇)/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
71392 // node_modules/osm-community-index/lib/resolve_strings.js
71393 function resolveStrings(item, defaults, localizerFn) {
71394 let itemStrings = Object.assign({}, item.strings);
71395 let defaultStrings = Object.assign({}, defaults[item.type]);
71396 const anyToken = new RegExp(/(\{\w+\})/, "gi");
71398 if (itemStrings.community) {
71399 const communityID = simplify(itemStrings.community);
71400 itemStrings.community = localizerFn("_communities.".concat(communityID));
71402 ["name", "description", "extendedDescription"].forEach((prop) => {
71403 if (defaultStrings[prop])
71404 defaultStrings[prop] = localizerFn("_defaults.".concat(item.type, ".").concat(prop));
71405 if (itemStrings[prop])
71406 itemStrings[prop] = localizerFn("".concat(item.id, ".").concat(prop));
71409 let replacements = {
71410 account: item.account,
71411 community: itemStrings.community,
71412 signupUrl: itemStrings.signupUrl,
71413 url: itemStrings.url
71415 if (!replacements.signupUrl) {
71416 replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
71418 if (!replacements.url) {
71419 replacements.url = resolve(itemStrings.url || defaultStrings.url);
71422 name: resolve(itemStrings.name || defaultStrings.name),
71423 url: resolve(itemStrings.url || defaultStrings.url),
71424 signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
71425 description: resolve(itemStrings.description || defaultStrings.description),
71426 extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
71428 resolved.nameHTML = linkify(resolved.url, resolved.name);
71429 resolved.urlHTML = linkify(resolved.url);
71430 resolved.signupUrlHTML = linkify(resolved.signupUrl);
71431 resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
71432 resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
71434 function resolve(s2, addLinks) {
71438 for (let key in replacements) {
71439 const token = "{".concat(key, "}");
71440 const regex = new RegExp(token, "g");
71441 if (regex.test(result)) {
71442 let replacement = replacements[key];
71443 if (!replacement) {
71444 throw new Error("Cannot resolve token: ".concat(token));
71446 if (addLinks && (key === "signupUrl" || key === "url")) {
71447 replacement = linkify(replacement);
71449 result = result.replace(regex, replacement);
71453 const leftovers = result.match(anyToken);
71455 throw new Error("Cannot resolve tokens: ".concat(leftovers));
71457 if (addLinks && item.type === "reddit") {
71458 result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
71462 function linkify(url, text) {
71465 text = text || url;
71466 return '<a target="_blank" href="'.concat(url, '">').concat(text, "</a>");
71470 // modules/ui/success.js
71472 function uiSuccess(context) {
71473 const MAXEVENTS = 2;
71474 const dispatch14 = dispatch_default("cancel");
71477 ensureOSMCommunityIndex();
71478 function ensureOSMCommunityIndex() {
71479 const data = _mainFileFetcher;
71480 return Promise.all([
71481 data.get("oci_features"),
71482 data.get("oci_resources"),
71483 data.get("oci_defaults")
71484 ]).then((vals) => {
71487 if (vals[0] && Array.isArray(vals[0].features)) {
71488 _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
71490 let ociResources = Object.values(vals[1].resources);
71491 if (ociResources.length) {
71492 return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
71494 resources: ociResources,
71495 defaults: vals[2].defaults
71503 defaults: vals[2].defaults
71509 function parseEventDate(when) {
71512 let raw = when.trim();
71515 if (!/Z$/.test(raw)) {
71518 const parsed = new Date(raw);
71519 return new Date(parsed.toUTCString().slice(0, 25));
71521 function success(selection2) {
71522 let header = selection2.append("div").attr("class", "header fillL");
71523 header.append("h2").call(_t.append("success.just_edited"));
71524 header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
71525 let body = selection2.append("div").attr("class", "body save-success fillL");
71526 let summary = body.append("div").attr("class", "save-summary");
71527 summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
71528 summary.append("p").call(_t.append("success.help_html")).append("a").attr("class", "link-out").attr("target", "_blank").attr("href", _t("success.help_link_url")).call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("success.help_link_text"));
71529 let osm = context.connection();
71532 let changesetURL = osm.changesetURL(_changeset2.id);
71533 let table = summary.append("table").attr("class", "summary-table");
71534 let row = table.append("tr").attr("class", "summary-row");
71535 row.append("td").attr("class", "cell-icon summary-icon").append("a").attr("target", "_blank").attr("href", changesetURL).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-logo-osm");
71536 let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
71537 summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
71538 summaryDetail.append("div").html(_t.html("success.changeset_id", {
71539 changeset_id: { html: '<a href="'.concat(changesetURL, '" target="_blank">').concat(_changeset2.id, "</a>") }
71541 if (showDonationMessage !== false) {
71542 const donationUrl = "https://supporting.openstreetmap.org/";
71543 let supporting = body.append("div").attr("class", "save-supporting");
71544 supporting.append("h3").call(_t.append("success.supporting.title"));
71545 supporting.append("p").call(_t.append("success.supporting.details"));
71546 table = supporting.append("table").attr("class", "supporting-table");
71547 row = table.append("tr").attr("class", "supporting-row");
71548 row.append("td").attr("class", "cell-icon supporting-icon").append("a").attr("target", "_blank").attr("href", donationUrl).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", "#iD-donation");
71549 let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
71550 supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
71551 supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
71553 ensureOSMCommunityIndex().then((oci) => {
71554 const loc = context.map().center();
71555 const validHere = _sharedLocationManager.locationSetsAt(loc);
71556 let communities = [];
71557 oci.resources.forEach((resource) => {
71558 let area = validHere[resource.locationSetID];
71561 const localizer = (stringID) => _t.html("community.".concat(stringID));
71562 resource.resolved = resolveStrings(resource, oci.defaults, localizer);
71565 order: resource.order || 0,
71569 communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
71570 body.call(showCommunityLinks, communities.map((c2) => c2.resource));
71573 function showCommunityLinks(selection2, resources) {
71574 let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
71575 communityLinks.append("h3").call(_t.append("success.like_osm"));
71576 let table = communityLinks.append("table").attr("class", "community-table");
71577 let row = table.selectAll(".community-row").data(resources);
71578 let rowEnter = row.enter().append("tr").attr("class", "community-row");
71579 rowEnter.append("td").attr("class", "cell-icon community-icon").append("a").attr("target", "_blank").attr("href", (d2) => d2.resolved.url).append("svg").attr("class", "logo-small").append("use").attr("xlink:href", (d2) => "#community-".concat(d2.type));
71580 let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
71581 communityDetail.each(showCommunityDetails);
71582 communityLinks.append("div").attr("class", "community-missing").call(_t.append("success.missing")).append("a").attr("class", "link-out").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmlab/osm-community-index/issues").append("span").call(_t.append("success.tell_us"));
71584 function showCommunityDetails(d2) {
71585 let selection2 = select_default2(this);
71586 let communityID = d2.id;
71587 selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
71588 selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
71589 if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
71590 selection2.append("div").call(
71591 uiDisclosure(context, "community-more-".concat(d2.id), false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
71594 let nextEvents = (d2.events || []).map((event) => {
71595 event.date = parseEventDate(event.when);
71597 }).filter((event) => {
71598 const t2 = event.date.getTime();
71599 const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
71600 return !isNaN(t2) && t2 >= now3;
71601 }).sort((a2, b2) => {
71602 return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
71603 }).slice(0, MAXEVENTS);
71604 if (nextEvents.length) {
71605 selection2.append("div").call(
71606 uiDisclosure(context, "community-events-".concat(d2.id), false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
71607 ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
71609 function showMore(selection3) {
71610 let more = selection3.selectAll(".community-more").data([0]);
71611 let moreEnter = more.enter().append("div").attr("class", "community-more");
71612 if (d2.resolved.extendedDescriptionHTML) {
71613 moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
71615 if (d2.languageCodes && d2.languageCodes.length) {
71616 const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
71617 moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
71620 function showNextEvents(selection3) {
71621 let events = selection3.append("div").attr("class", "community-events");
71622 let item = events.selectAll(".community-event").data(nextEvents);
71623 let itemEnter = item.enter().append("div").attr("class", "community-event");
71624 itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
71625 let name = d4.name;
71626 if (d4.i18n && d4.id) {
71627 name = _t("community.".concat(communityID, ".events.").concat(d4.id, ".name"), { default: name });
71631 itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
71632 let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
71633 if (d4.date.getHours() || d4.date.getMinutes()) {
71634 options2.hour = "numeric";
71635 options2.minute = "numeric";
71637 return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
71639 itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
71640 let where = d4.where;
71641 if (d4.i18n && d4.id) {
71642 where = _t("community.".concat(communityID, ".events.").concat(d4.id, ".where"), { default: where });
71646 itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
71647 let description = d4.description;
71648 if (d4.i18n && d4.id) {
71649 description = _t("community.".concat(communityID, ".events.").concat(d4.id, ".description"), { default: description });
71651 return description;
71655 success.changeset = function(val) {
71656 if (!arguments.length)
71657 return _changeset2;
71661 success.location = function(val) {
71662 if (!arguments.length)
71667 return utilRebind(success, dispatch14, "on");
71670 // modules/modes/save.js
71671 function modeSave(context) {
71672 var mode = { id: "save" };
71673 var keybinding = utilKeybinding("modeSave");
71674 var commit = uiCommit(context).on("cancel", cancel);
71678 var uploader = context.uploader().on("saveStarted.modeSave", function() {
71680 }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
71682 }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
71683 function cancel() {
71684 context.enter(modeBrowse(context));
71686 function showProgress(num, total) {
71687 var modal = context.container().select(".loading-modal .modal-section");
71688 var progress = modal.selectAll(".progress").data([0]);
71689 progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
71691 function showConflicts(changeset, conflicts, origChanges) {
71692 var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
71693 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71694 _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
71695 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71696 selection2.remove();
71698 uploader.cancelConflictResolution();
71699 }).on("save", function() {
71700 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71701 selection2.remove();
71702 uploader.processResolvedConflicts(changeset);
71704 selection2.call(_conflictsUi);
71706 function showErrors(errors) {
71708 var selection2 = uiConfirm(context.container());
71709 selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
71710 addErrors(selection2, errors);
71711 selection2.okButton();
71713 function addErrors(selection2, data) {
71714 var message = selection2.select(".modal-section.message-text");
71715 var items = message.selectAll(".error-container").data(data);
71716 var enter = items.enter().append("div").attr("class", "error-container");
71717 enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
71718 return d2.msg || _t("save.unknown_error_details");
71719 }).on("click", function(d3_event) {
71720 d3_event.preventDefault();
71721 var error = select_default2(this);
71722 var detail = select_default2(this.nextElementSibling);
71723 var exp2 = error.classed("expanded");
71724 detail.style("display", exp2 ? "none" : "block");
71725 error.classed("expanded", !exp2);
71727 var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
71728 details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
71729 return d2.details || [];
71730 }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
71733 items.exit().remove();
71735 function showSuccess(changeset) {
71737 var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
71738 context.ui().sidebar.hide();
71740 context.enter(modeBrowse(context).sidebar(ui));
71742 function keybindingOn() {
71743 select_default2(document).call(keybinding.on("\u238B", cancel, true));
71745 function keybindingOff() {
71746 select_default2(document).call(keybinding.unbind);
71748 function prepareForSuccess() {
71749 _success = uiSuccess(context);
71751 if (!services.geocoder)
71753 services.geocoder.reverse(context.map().center(), function(err, result) {
71754 if (err || !result || !result.address)
71756 var addr = result.address;
71757 var place = addr && (addr.town || addr.city || addr.county) || "";
71758 var region = addr && (addr.state || addr.country) || "";
71759 var separator = place && region ? _t("success.thank_you_where.separator") : "";
71761 "success.thank_you_where.format",
71762 { place, separator, region }
71766 mode.selectedIDs = function() {
71767 return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
71769 mode.enter = function() {
71770 context.ui().sidebar.expand();
71772 context.ui().sidebar.show(commit);
71775 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
71776 var osm = context.connection();
71781 if (osm.authenticated()) {
71784 osm.authenticate(function(err) {
71793 mode.exit = function() {
71795 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
71796 context.ui().sidebar.hide();
71801 // modules/ui/improveOSM_comments.js
71802 function uiImproveOsmComments() {
71804 function issueComments(selection2) {
71805 let comments = selection2.selectAll(".comments-container").data([0]);
71806 comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
71807 services.improveOSM.getComments(_qaItem).then((d2) => {
71810 const commentEnter = comments.selectAll(".comment").data(d2.comments).enter().append("div").attr("class", "comment");
71811 commentEnter.append("div").attr("class", "comment-avatar").call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
71812 const mainEnter = commentEnter.append("div").attr("class", "comment-main");
71813 const metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
71814 metadataEnter.append("div").attr("class", "comment-author").each(function(d4) {
71815 const osm = services.osm;
71816 let selection3 = select_default2(this);
71817 if (osm && d4.username) {
71818 selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d4.username)).attr("target", "_blank");
71820 selection3.text((d5) => d5.username);
71822 metadataEnter.append("div").attr("class", "comment-date").html((d4) => _t.html("note.status.commented", { when: localeDateString2(d4.timestamp) }));
71823 mainEnter.append("div").attr("class", "comment-text").append("p").text((d4) => d4.text);
71824 }).catch((err) => {
71828 function localeDateString2(s2) {
71831 const options2 = { day: "numeric", month: "short", year: "numeric" };
71832 const d2 = new Date(s2 * 1e3);
71833 if (isNaN(d2.getTime()))
71835 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
71837 issueComments.issue = function(val) {
71838 if (!arguments.length)
71841 return issueComments;
71843 return issueComments;
71846 // modules/ui/improveOSM_details.js
71847 function uiImproveOsmDetails(context) {
71849 function issueDetail(d2) {
71852 const issueKey = d2.issueKey;
71853 d2.replacements = d2.replacements || {};
71854 d2.replacements.default = { html: _t.html("inspector.unknown") };
71855 return _t.html("QA.improveOSM.error_types.".concat(issueKey, ".description"), d2.replacements);
71857 function improveOsmDetails(selection2) {
71858 const details = selection2.selectAll(".error-details").data(
71859 _qaItem ? [_qaItem] : [],
71860 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
71862 details.exit().remove();
71863 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
71864 const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
71865 descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
71866 descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
71867 let relatedEntities = [];
71868 descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
71869 const link3 = select_default2(this);
71870 const isObjectLink = link3.classed("error_object_link");
71871 const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
71872 const entity = context.hasEntity(entityID);
71873 relatedEntities.push(entityID);
71874 link3.on("mouseenter", () => {
71875 utilHighlightEntities([entityID], true, context);
71876 }).on("mouseleave", () => {
71877 utilHighlightEntities([entityID], false, context);
71878 }).on("click", (d3_event) => {
71879 d3_event.preventDefault();
71880 utilHighlightEntities([entityID], false, context);
71881 const osmlayer = context.layers().layer("osm");
71882 if (!osmlayer.enabled()) {
71883 osmlayer.enabled(true);
71885 context.map().centerZoom(_qaItem.loc, 20);
71887 context.enter(modeSelect(context, [entityID]));
71889 context.loadEntity(entityID, (err, result) => {
71892 const entity2 = result.data.find((e3) => e3.id === entityID);
71894 context.enter(modeSelect(context, [entityID]));
71899 let name = utilDisplayName(entity);
71900 if (!name && !isObjectLink) {
71901 const preset = _mainPresetIndex.match(entity, context.graph());
71902 name = preset && !preset.isFallback() && preset.name();
71905 this.innerText = name;
71909 context.features().forceVisible(relatedEntities);
71910 context.map().pan([0, 0]);
71912 improveOsmDetails.issue = function(val) {
71913 if (!arguments.length)
71916 return improveOsmDetails;
71918 return improveOsmDetails;
71921 // modules/ui/improveOSM_header.js
71922 function uiImproveOsmHeader() {
71924 function issueTitle(d2) {
71925 const issueKey = d2.issueKey;
71926 d2.replacements = d2.replacements || {};
71927 d2.replacements.default = { html: _t.html("inspector.unknown") };
71928 return _t.html("QA.improveOSM.error_types.".concat(issueKey, ".title"), d2.replacements);
71930 function improveOsmHeader(selection2) {
71931 const header = selection2.selectAll(".qa-header").data(
71932 _qaItem ? [_qaItem] : [],
71933 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
71935 header.exit().remove();
71936 const headerEnter = header.enter().append("div").attr("class", "qa-header");
71937 const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => "preset-icon-28 qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
71938 svgEnter.append("polygon").attr("fill", "currentColor").attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
71939 svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
71940 headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
71942 improveOsmHeader.issue = function(val) {
71943 if (!arguments.length)
71946 return improveOsmHeader;
71948 return improveOsmHeader;
71951 // modules/ui/improveOSM_editor.js
71952 function uiImproveOsmEditor(context) {
71953 const dispatch14 = dispatch_default("change");
71954 const qaDetails = uiImproveOsmDetails(context);
71955 const qaComments = uiImproveOsmComments(context);
71956 const qaHeader = uiImproveOsmHeader(context);
71958 function improveOsmEditor(selection2) {
71959 const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
71960 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
71961 headerEnter.append("h2").call(_t.append("QA.improveOSM.title"));
71962 let body = selection2.selectAll(".body").data([0]);
71963 body = body.enter().append("div").attr("class", "body").merge(body);
71964 const editor = body.selectAll(".qa-editor").data([0]);
71965 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(qaComments.issue(_qaItem)).call(improveOsmSaveSection);
71967 function improveOsmSaveSection(selection2) {
71968 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71969 const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
71970 let saveSection = selection2.selectAll(".qa-save").data(
71971 isShown ? [_qaItem] : [],
71972 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
71974 saveSection.exit().remove();
71975 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
71976 saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("note.newComment"));
71977 saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
71978 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
71979 function changeInput() {
71980 const input = select_default2(this);
71981 let val = input.property("value").trim();
71985 _qaItem = _qaItem.update({ newComment: val });
71986 const qaService = services.improveOSM;
71988 qaService.replaceItem(_qaItem);
71990 saveSection.call(qaSaveButtons);
71993 function qaSaveButtons(selection2) {
71994 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
71995 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
71996 buttonSection.exit().remove();
71997 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
71998 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
71999 buttonEnter.append("button").attr("class", "button close-button action");
72000 buttonEnter.append("button").attr("class", "button ignore-button action");
72001 buttonSection = buttonSection.merge(buttonEnter);
72002 buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
72004 const qaService = services.improveOSM;
72006 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72009 buttonSection.select(".close-button").html((d2) => {
72010 const andComment = d2.newComment ? "_comment" : "";
72011 return _t.html("QA.keepRight.close".concat(andComment));
72012 }).on("click.close", function(d3_event, d2) {
72014 const qaService = services.improveOSM;
72016 d2.newStatus = "SOLVED";
72017 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72020 buttonSection.select(".ignore-button").html((d2) => {
72021 const andComment = d2.newComment ? "_comment" : "";
72022 return _t.html("QA.keepRight.ignore".concat(andComment));
72023 }).on("click.ignore", function(d3_event, d2) {
72025 const qaService = services.improveOSM;
72027 d2.newStatus = "INVALID";
72028 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72032 improveOsmEditor.error = function(val) {
72033 if (!arguments.length)
72036 return improveOsmEditor;
72038 return utilRebind(improveOsmEditor, dispatch14, "on");
72041 // modules/ui/keepRight_details.js
72042 function uiKeepRightDetails(context) {
72044 function issueDetail(d2) {
72045 const { itemType, parentIssueType } = d2;
72046 const unknown = { html: _t.html("inspector.unknown") };
72047 let replacements = d2.replacements || {};
72048 replacements.default = unknown;
72049 if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
72050 return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".description"), replacements);
72052 return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".description"), replacements);
72055 function keepRightDetails(selection2) {
72056 const details = selection2.selectAll(".error-details").data(
72057 _qaItem ? [_qaItem] : [],
72058 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72060 details.exit().remove();
72061 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
72062 const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
72063 descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
72064 descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
72065 let relatedEntities = [];
72066 descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
72067 const link3 = select_default2(this);
72068 const isObjectLink = link3.classed("error_object_link");
72069 const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
72070 const entity = context.hasEntity(entityID);
72071 relatedEntities.push(entityID);
72072 link3.on("mouseenter", () => {
72073 utilHighlightEntities([entityID], true, context);
72074 }).on("mouseleave", () => {
72075 utilHighlightEntities([entityID], false, context);
72076 }).on("click", (d3_event) => {
72077 d3_event.preventDefault();
72078 utilHighlightEntities([entityID], false, context);
72079 const osmlayer = context.layers().layer("osm");
72080 if (!osmlayer.enabled()) {
72081 osmlayer.enabled(true);
72083 context.map().centerZoomEase(_qaItem.loc, 20);
72085 context.enter(modeSelect(context, [entityID]));
72087 context.loadEntity(entityID, (err, result) => {
72090 const entity2 = result.data.find((e3) => e3.id === entityID);
72092 context.enter(modeSelect(context, [entityID]));
72097 let name = utilDisplayName(entity);
72098 if (!name && !isObjectLink) {
72099 const preset = _mainPresetIndex.match(entity, context.graph());
72100 name = preset && !preset.isFallback() && preset.name();
72103 this.innerText = name;
72107 context.features().forceVisible(relatedEntities);
72108 context.map().pan([0, 0]);
72110 keepRightDetails.issue = function(val) {
72111 if (!arguments.length)
72114 return keepRightDetails;
72116 return keepRightDetails;
72119 // modules/ui/keepRight_header.js
72120 function uiKeepRightHeader() {
72122 function issueTitle(d2) {
72123 const { itemType, parentIssueType } = d2;
72124 const unknown = _t.html("inspector.unknown");
72125 let replacements = d2.replacements || {};
72126 replacements.default = { html: unknown };
72127 if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
72128 return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".title"), replacements);
72130 return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".title"), replacements);
72133 function keepRightHeader(selection2) {
72134 const header = selection2.selectAll(".qa-header").data(
72135 _qaItem ? [_qaItem] : [],
72136 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72138 header.exit().remove();
72139 const headerEnter = header.enter().append("div").attr("class", "qa-header");
72140 const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
72141 iconEnter.append("div").attr("class", (d2) => "preset-icon-28 qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType)).call(svgIcon("#iD-icon-bolt", "qaItem-fill"));
72142 headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
72144 keepRightHeader.issue = function(val) {
72145 if (!arguments.length)
72148 return keepRightHeader;
72150 return keepRightHeader;
72153 // modules/ui/view_on_keepRight.js
72154 function uiViewOnKeepRight() {
72156 function viewOnKeepRight(selection2) {
72158 if (services.keepRight && _qaItem instanceof QAItem) {
72159 url = services.keepRight.issueURL(_qaItem);
72161 const link3 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
72162 link3.exit().remove();
72163 const linkEnter = link3.enter().append("a").attr("class", "view-on-keepRight").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
72164 linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
72166 viewOnKeepRight.what = function(val) {
72167 if (!arguments.length)
72170 return viewOnKeepRight;
72172 return viewOnKeepRight;
72175 // modules/ui/keepRight_editor.js
72176 function uiKeepRightEditor(context) {
72177 const dispatch14 = dispatch_default("change");
72178 const qaDetails = uiKeepRightDetails(context);
72179 const qaHeader = uiKeepRightHeader(context);
72181 function keepRightEditor(selection2) {
72182 const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
72183 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
72184 headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
72185 let body = selection2.selectAll(".body").data([0]);
72186 body = body.enter().append("div").attr("class", "body").merge(body);
72187 const editor = body.selectAll(".qa-editor").data([0]);
72188 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
72189 const footer = selection2.selectAll(".footer").data([0]);
72190 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
72192 function keepRightSaveSection(selection2) {
72193 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
72194 const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
72195 let saveSection = selection2.selectAll(".qa-save").data(
72196 isShown ? [_qaItem] : [],
72197 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72199 saveSection.exit().remove();
72200 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
72201 saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
72202 saveSectionEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("QA.keepRight.comment_placeholder")).attr("maxlength", 1e3).property("value", (d2) => d2.newComment || d2.comment).call(utilNoAuto).on("input", changeInput).on("blur", changeInput);
72203 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
72204 function changeInput() {
72205 const input = select_default2(this);
72206 let val = input.property("value").trim();
72207 if (val === _qaItem.comment) {
72210 _qaItem = _qaItem.update({ newComment: val });
72211 const qaService = services.keepRight;
72213 qaService.replaceItem(_qaItem);
72215 saveSection.call(qaSaveButtons);
72218 function qaSaveButtons(selection2) {
72219 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
72220 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
72221 buttonSection.exit().remove();
72222 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
72223 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
72224 buttonEnter.append("button").attr("class", "button close-button action");
72225 buttonEnter.append("button").attr("class", "button ignore-button action");
72226 buttonSection = buttonSection.merge(buttonEnter);
72227 buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
72229 const qaService = services.keepRight;
72231 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72234 buttonSection.select(".close-button").html((d2) => {
72235 const andComment = d2.newComment ? "_comment" : "";
72236 return _t.html("QA.keepRight.close".concat(andComment));
72237 }).on("click.close", function(d3_event, d2) {
72239 const qaService = services.keepRight;
72241 d2.newStatus = "ignore_t";
72242 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72245 buttonSection.select(".ignore-button").html((d2) => {
72246 const andComment = d2.newComment ? "_comment" : "";
72247 return _t.html("QA.keepRight.ignore".concat(andComment));
72248 }).on("click.ignore", function(d3_event, d2) {
72250 const qaService = services.keepRight;
72252 d2.newStatus = "ignore";
72253 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72257 keepRightEditor.error = function(val) {
72258 if (!arguments.length)
72261 return keepRightEditor;
72263 return utilRebind(keepRightEditor, dispatch14, "on");
72266 // modules/ui/osmose_details.js
72267 function uiOsmoseDetails(context) {
72269 function issueString(d2, type2) {
72272 const s2 = services.osmose.getStrings(d2.itemType);
72273 return type2 in s2 ? s2[type2] : "";
72275 function osmoseDetails(selection2) {
72276 const details = selection2.selectAll(".error-details").data(
72277 _qaItem ? [_qaItem] : [],
72278 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72280 details.exit().remove();
72281 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
72282 if (issueString(_qaItem, "detail")) {
72283 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
72284 div.append("h4").call(_t.append("QA.keepRight.detail_description"));
72285 div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
72287 const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
72288 const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
72289 if (issueString(_qaItem, "fix")) {
72290 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
72291 div.append("h4").call(_t.append("QA.osmose.fix_title"));
72292 div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
72294 if (issueString(_qaItem, "trap")) {
72295 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
72296 div.append("h4").call(_t.append("QA.osmose.trap_title"));
72297 div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
72299 const thisItem = _qaItem;
72300 services.osmose.loadIssueDetail(_qaItem).then((d2) => {
72301 if (!d2.elems || d2.elems.length === 0)
72303 if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(".qaItem.osmose.hover.itemId-".concat(thisItem.id)).empty())
72306 detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
72307 detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
72309 elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
72310 elemsDiv.append("ul").selectAll("li").data(d2.elems).enter().append("li").append("a").attr("href", "#").attr("class", "error_entity_link").text((d4) => d4).each(function() {
72311 const link3 = select_default2(this);
72312 const entityID = this.textContent;
72313 const entity = context.hasEntity(entityID);
72314 link3.on("mouseenter", () => {
72315 utilHighlightEntities([entityID], true, context);
72316 }).on("mouseleave", () => {
72317 utilHighlightEntities([entityID], false, context);
72318 }).on("click", (d3_event) => {
72319 d3_event.preventDefault();
72320 utilHighlightEntities([entityID], false, context);
72321 const osmlayer = context.layers().layer("osm");
72322 if (!osmlayer.enabled()) {
72323 osmlayer.enabled(true);
72325 context.map().centerZoom(d2.loc, 20);
72327 context.enter(modeSelect(context, [entityID]));
72329 context.loadEntity(entityID, (err, result) => {
72332 const entity2 = result.data.find((e3) => e3.id === entityID);
72334 context.enter(modeSelect(context, [entityID]));
72339 let name = utilDisplayName(entity);
72341 const preset = _mainPresetIndex.match(entity, context.graph());
72342 name = preset && !preset.isFallback() && preset.name();
72345 this.innerText = name;
72349 context.features().forceVisible(d2.elems);
72350 context.map().pan([0, 0]);
72351 }).catch((err) => {
72355 osmoseDetails.issue = function(val) {
72356 if (!arguments.length)
72359 return osmoseDetails;
72361 return osmoseDetails;
72364 // modules/ui/osmose_header.js
72365 function uiOsmoseHeader() {
72367 function issueTitle(d2) {
72368 const unknown = _t("inspector.unknown");
72371 const s2 = services.osmose.getStrings(d2.itemType);
72372 return "title" in s2 ? s2.title : unknown;
72374 function osmoseHeader(selection2) {
72375 const header = selection2.selectAll(".qa-header").data(
72376 _qaItem ? [_qaItem] : [],
72377 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72379 header.exit().remove();
72380 const headerEnter = header.enter().append("div").attr("class", "qa-header");
72381 const svgEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0).append("svg").attr("width", "20px").attr("height", "30px").attr("viewbox", "0 0 20 30").attr("class", (d2) => "preset-icon-28 qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
72382 svgEnter.append("polygon").attr("fill", (d2) => services.osmose.getColor(d2.item)).attr("class", "qaItem-fill").attr("points", "16,3 4,3 1,6 1,17 4,20 7,20 10,27 13,20 16,20 19,17.033 19,6");
72383 svgEnter.append("use").attr("class", "icon-annotation").attr("width", "12px").attr("height", "12px").attr("transform", "translate(4, 5.5)").attr("xlink:href", (d2) => d2.icon ? "#" + d2.icon : "");
72384 headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
72386 osmoseHeader.issue = function(val) {
72387 if (!arguments.length)
72390 return osmoseHeader;
72392 return osmoseHeader;
72395 // modules/ui/view_on_osmose.js
72396 function uiViewOnOsmose() {
72398 function viewOnOsmose(selection2) {
72400 if (services.osmose && _qaItem instanceof QAItem) {
72401 url = services.osmose.itemURL(_qaItem);
72403 const link3 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
72404 link3.exit().remove();
72405 const linkEnter = link3.enter().append("a").attr("class", "view-on-osmose").attr("target", "_blank").attr("rel", "noopener").attr("href", (d2) => d2).call(svgIcon("#iD-icon-out-link", "inline"));
72406 linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
72408 viewOnOsmose.what = function(val) {
72409 if (!arguments.length)
72412 return viewOnOsmose;
72414 return viewOnOsmose;
72417 // modules/ui/osmose_editor.js
72418 function uiOsmoseEditor(context) {
72419 const dispatch14 = dispatch_default("change");
72420 const qaDetails = uiOsmoseDetails(context);
72421 const qaHeader = uiOsmoseHeader(context);
72423 function osmoseEditor(selection2) {
72424 const header = selection2.selectAll(".header").data([0]);
72425 const headerEnter = header.enter().append("div").attr("class", "header fillL");
72426 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
72427 headerEnter.append("h2").call(_t.append("QA.osmose.title"));
72428 let body = selection2.selectAll(".body").data([0]);
72429 body = body.enter().append("div").attr("class", "body").merge(body);
72430 let editor = body.selectAll(".qa-editor").data([0]);
72431 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
72432 const footer = selection2.selectAll(".footer").data([0]);
72433 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
72435 function osmoseSaveSection(selection2) {
72436 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
72437 const isShown = _qaItem && isSelected;
72438 let saveSection = selection2.selectAll(".qa-save").data(
72439 isShown ? [_qaItem] : [],
72440 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
72442 saveSection.exit().remove();
72443 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
72444 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
72446 function qaSaveButtons(selection2) {
72447 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
72448 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
72449 buttonSection.exit().remove();
72450 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
72451 buttonEnter.append("button").attr("class", "button close-button action");
72452 buttonEnter.append("button").attr("class", "button ignore-button action");
72453 buttonSection = buttonSection.merge(buttonEnter);
72454 buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
72456 const qaService = services.osmose;
72458 d2.newStatus = "done";
72459 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72462 buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
72464 const qaService = services.osmose;
72466 d2.newStatus = "false";
72467 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
72471 osmoseEditor.error = function(val) {
72472 if (!arguments.length)
72475 return osmoseEditor;
72477 return utilRebind(osmoseEditor, dispatch14, "on");
72480 // modules/modes/select_error.js
72481 function modeSelectError(context, selectedErrorID, selectedErrorService) {
72483 id: "select-error",
72486 var keybinding = utilKeybinding("select-error");
72487 var errorService = services[selectedErrorService];
72489 switch (selectedErrorService) {
72491 errorEditor = uiImproveOsmEditor(context).on("change", function() {
72492 context.map().pan([0, 0]);
72493 var error = checkSelectedID();
72496 context.ui().sidebar.show(errorEditor.error(error));
72500 errorEditor = uiKeepRightEditor(context).on("change", function() {
72501 context.map().pan([0, 0]);
72502 var error = checkSelectedID();
72505 context.ui().sidebar.show(errorEditor.error(error));
72509 errorEditor = uiOsmoseEditor(context).on("change", function() {
72510 context.map().pan([0, 0]);
72511 var error = checkSelectedID();
72514 context.ui().sidebar.show(errorEditor.error(error));
72519 behaviorBreathe(context),
72520 behaviorHover(context),
72521 behaviorSelect(context),
72522 behaviorLasso(context),
72523 modeDragNode(context).behavior,
72524 modeDragNote(context).behavior
72526 function checkSelectedID() {
72529 var error = errorService.getError(selectedErrorID);
72531 context.enter(modeBrowse(context));
72535 mode.zoomToSelected = function() {
72538 var error = errorService.getError(selectedErrorID);
72540 context.map().centerZoomEase(error.loc, 20);
72543 mode.enter = function() {
72544 var error = checkSelectedID();
72547 behaviors.forEach(context.install);
72548 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
72549 select_default2(document).call(keybinding);
72551 var sidebar = context.ui().sidebar;
72552 sidebar.show(errorEditor.error(error));
72553 context.map().on("drawn.select-error", selectError);
72554 function selectError(d3_event, drawn) {
72555 if (!checkSelectedID())
72557 var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
72558 if (selection2.empty()) {
72559 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
72560 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
72561 context.enter(modeBrowse(context));
72564 selection2.classed("selected", true);
72565 context.selectedErrorID(selectedErrorID);
72569 if (context.container().select(".combobox").size())
72571 context.enter(modeBrowse(context));
72574 mode.exit = function() {
72575 behaviors.forEach(context.uninstall);
72576 select_default2(document).call(keybinding.unbind);
72577 context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
72578 context.map().on("drawn.select-error", null);
72579 context.ui().sidebar.hide();
72580 context.selectedErrorID(null);
72581 context.features().forceVisible([]);
72586 // modules/ui/feature_list.js
72587 function uiFeatureList(context) {
72588 var _geocodeResults;
72589 function featureList(selection2) {
72590 var header = selection2.append("div").attr("class", "header fillL");
72591 header.append("h2").call(_t.append("inspector.feature_list"));
72592 var searchWrap = selection2.append("div").attr("class", "search-header");
72593 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
72594 var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
72595 var listWrap = selection2.append("div").attr("class", "inspector-body");
72596 var list2 = listWrap.append("div").attr("class", "feature-list");
72597 context.on("exit.feature-list", clearSearch);
72598 context.map().on("drawn.feature-list", mapDrawn);
72599 context.keybinding().on(uiCmd("\u2318F"), focusSearch);
72600 function focusSearch(d3_event) {
72601 var mode = context.mode() && context.mode().id;
72602 if (mode !== "browse")
72604 d3_event.preventDefault();
72605 search.node().focus();
72607 function keydown(d3_event) {
72608 if (d3_event.keyCode === 27) {
72609 search.node().blur();
72612 function keypress(d3_event) {
72613 var q2 = search.property("value"), items = list2.selectAll(".feature-list-item");
72614 if (d3_event.keyCode === 13 && // ↩ Return
72615 q2.length && items.size()) {
72616 click(d3_event, items.datum());
72619 function inputevent() {
72620 _geocodeResults = void 0;
72623 function clearSearch() {
72624 search.property("value", "");
72627 function mapDrawn(e3) {
72632 function features() {
72634 var graph = context.graph();
72635 var visibleCenter = context.map().extent().center();
72636 var q2 = search.property("value").toLowerCase();
72639 var locationMatch = sexagesimal.pair(q2.toUpperCase()) || dmsMatcher(q2);
72640 if (locationMatch) {
72641 var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
72645 type: _t("inspector.location"),
72646 name: dmsCoordinatePair([loc[1], loc[0]]),
72650 var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
72652 var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
72653 var elemId = idMatch[2];
72655 id: elemType + elemId,
72656 geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
72657 type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
72661 var allEntities = graph.entities;
72662 var localResults = [];
72663 for (var id2 in allEntities) {
72664 var entity = allEntities[id2];
72667 var name = utilDisplayName(entity) || "";
72668 if (name.toLowerCase().indexOf(q2) < 0)
72670 var matched = _mainPresetIndex.match(entity, graph);
72671 var type2 = matched && matched.name() || utilDisplayType(entity.id);
72672 var extent = entity.extent(graph);
72673 var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
72674 localResults.push({
72677 geometry: entity.geometry(graph),
72682 if (localResults.length > 100)
72685 localResults = localResults.sort(function byDistance(a2, b2) {
72686 return a2.distance - b2.distance;
72688 result = result.concat(localResults);
72689 (_geocodeResults || []).forEach(function(d2) {
72690 if (d2.osm_type && d2.osm_id) {
72691 var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
72693 tags[d2.class] = d2.type;
72694 var attrs = { id: id3, type: d2.osm_type, tags };
72695 if (d2.osm_type === "way") {
72696 attrs.nodes = ["a", "a"];
72698 var tempEntity = osmEntity(attrs);
72699 var tempGraph = coreGraph([tempEntity]);
72700 var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
72701 var type3 = matched2 && matched2.name() || utilDisplayType(id3);
72704 geometry: tempEntity.geometry(tempGraph),
72706 name: d2.display_name,
72707 extent: new geoExtent(
72708 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
72709 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
72714 if (q2.match(/^[0-9]+$/)) {
72718 type: _t("inspector.node"),
72724 type: _t("inspector.way"),
72729 geometry: "relation",
72730 type: _t("inspector.relation"),
72736 type: _t("note.note"),
72742 function drawList() {
72743 var value = search.property("value");
72744 var results = features();
72745 list2.classed("filtered", value.length);
72746 var resultsIndicator = list2.selectAll(".no-results-item").data([0]).enter().append("button").property("disabled", true).attr("class", "no-results-item").call(svgIcon("#iD-icon-alert", "pre-text"));
72747 resultsIndicator.append("span").attr("class", "entity-name");
72748 list2.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
72749 if (services.geocoder) {
72750 list2.selectAll(".geocode-item").data([0]).enter().append("button").attr("class", "geocode-item secondary-action").on("click", geocoderSearch).append("div").attr("class", "label").append("span").attr("class", "entity-name").call(_t.append("geocoder.search"));
72752 list2.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
72753 list2.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
72754 list2.selectAll(".feature-list-item").data([-1]).remove();
72755 var items = list2.selectAll(".feature-list-item").data(results, function(d2) {
72758 var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
72759 var label = enter.append("div").attr("class", "label");
72760 label.each(function(d2) {
72761 select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
72763 label.append("span").attr("class", "entity-type").text(function(d2) {
72766 label.append("span").attr("class", "entity-name").classed("has-colour", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour && isColourValid(d2.entity.tags.colour)).style("border-color", (d2) => d2.entity && d2.entity.type === "relation" && d2.entity.tags.colour).text(function(d2) {
72769 enter.style("opacity", 0).transition().style("opacity", 1);
72771 items.exit().remove();
72773 function mouseover(d3_event, d2) {
72776 utilHighlightEntities([d2.id], true, context);
72778 function mouseout(d3_event, d2) {
72781 utilHighlightEntities([d2.id], false, context);
72783 function click(d3_event, d2) {
72784 d3_event.preventDefault();
72786 context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
72787 } else if (d2.entity) {
72788 utilHighlightEntities([d2.id], false, context);
72789 context.enter(modeSelect(context, [d2.entity.id]));
72790 context.map().zoomToEase(d2.entity);
72791 } else if (d2.geometry === "note") {
72792 const noteId = d2.id.replace(/\D/g, "");
72793 context.loadNote(noteId, (err, result) => {
72796 const entity = result.data.find((e3) => e3.id === noteId);
72798 const note = services.osm.getNote(noteId);
72799 context.map().centerZoom(note.loc, 15);
72800 const noteLayer = context.layers().layer("notes");
72801 noteLayer.enabled(true);
72802 context.enter(modeSelectNote(context, noteId));
72806 context.zoomToEntity(d2.id);
72809 function geocoderSearch() {
72810 services.geocoder.search(search.property("value"), function(err, resp) {
72811 _geocodeResults = resp || [];
72816 return featureList;
72819 // modules/ui/preset_list.js
72820 function uiPresetList(context) {
72821 var dispatch14 = dispatch_default("cancel", "choose");
72824 var _currentPresets;
72825 var _autofocus = false;
72826 function presetList(selection2) {
72829 var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
72830 selection2.html("");
72831 var messagewrap = selection2.append("div").attr("class", "header fillL");
72832 var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
72833 var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
72834 messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
72835 dispatch14.call("cancel", this);
72836 }).call(svgIcon("#iD-icon-".concat(direction)));
72837 function initialKeydown(d3_event) {
72838 if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
72839 d3_event.preventDefault();
72840 d3_event.stopPropagation();
72841 operationDelete(context, _entityIDs)();
72842 } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
72843 d3_event.preventDefault();
72844 d3_event.stopPropagation();
72846 } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
72847 select_default2(this).on("keydown", keydown);
72848 keydown.call(this, d3_event);
72851 function keydown(d3_event) {
72852 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
72853 search.node().selectionStart === search.property("value").length) {
72854 d3_event.preventDefault();
72855 d3_event.stopPropagation();
72856 var buttons = list2.selectAll(".preset-list-button");
72857 if (!buttons.empty())
72858 buttons.nodes()[0].focus();
72861 function keypress(d3_event) {
72862 var value = search.property("value");
72863 if (d3_event.keyCode === 13 && // ↩ Return
72865 list2.selectAll(".preset-list-item:first-child").each(function(d2) {
72866 d2.choose.call(this);
72870 function inputevent() {
72871 var value = search.property("value");
72872 list2.classed("filtered", value.length);
72873 var results, messageText;
72874 if (value.length) {
72875 results = presets.search(value, entityGeometries()[0], _currLoc);
72876 messageText = _t.html("inspector.results", {
72877 n: results.collection.length,
72881 var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
72882 results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
72883 messageText = _t.html("inspector.choose");
72885 list2.call(drawList, results);
72886 message.html(messageText);
72888 var searchWrap = selection2.append("div").attr("class", "search-header");
72889 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
72890 var search = searchWrap.append("input").attr("class", "preset-search-input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keydown", initialKeydown).on("keypress", keypress).on("input", debounce_default(inputevent));
72892 search.node().focus();
72893 setTimeout(function() {
72894 search.node().focus();
72897 var listWrap = selection2.append("div").attr("class", "inspector-body");
72898 var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
72899 var list2 = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
72900 context.features().on("change.preset-list", updateForFeatureHiddenState);
72902 function drawList(list2, presets) {
72903 presets = presets.matchAllGeometry(entityGeometries());
72904 var collection = presets.collection.reduce(function(collection2, preset) {
72906 return collection2;
72907 if (preset.members) {
72908 if (preset.members.collection.filter(function(preset2) {
72909 return preset2.addable();
72911 collection2.push(CategoryItem(preset));
72913 } else if (preset.addable()) {
72914 collection2.push(PresetItem(preset));
72916 return collection2;
72918 var items = list2.selectAll(".preset-list-item").data(collection, function(d2) {
72919 return d2.preset.id;
72922 items.exit().remove();
72923 items.enter().append("div").attr("class", function(item) {
72924 return "preset-list-item preset-" + item.preset.id.replace("/", "-");
72925 }).classed("current", function(item) {
72926 return _currentPresets.indexOf(item.preset) !== -1;
72927 }).each(function(item) {
72928 select_default2(this).call(item);
72929 }).style("opacity", 0).transition().style("opacity", 1);
72930 updateForFeatureHiddenState();
72932 function itemKeydown(d3_event) {
72933 var item = select_default2(this.closest(".preset-list-item"));
72934 var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
72935 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
72936 d3_event.preventDefault();
72937 d3_event.stopPropagation();
72938 var nextItem = select_default2(item.node().nextElementSibling);
72939 if (nextItem.empty()) {
72940 if (!parentItem.empty()) {
72941 nextItem = select_default2(parentItem.node().nextElementSibling);
72943 } else if (select_default2(this).classed("expanded")) {
72944 nextItem = item.select(".subgrid .preset-list-item:first-child");
72946 if (!nextItem.empty()) {
72947 nextItem.select(".preset-list-button").node().focus();
72949 } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
72950 d3_event.preventDefault();
72951 d3_event.stopPropagation();
72952 var previousItem = select_default2(item.node().previousElementSibling);
72953 if (previousItem.empty()) {
72954 if (!parentItem.empty()) {
72955 previousItem = parentItem;
72957 } else if (previousItem.select(".preset-list-button").classed("expanded")) {
72958 previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
72960 if (!previousItem.empty()) {
72961 previousItem.select(".preset-list-button").node().focus();
72963 var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
72964 search.node().focus();
72966 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
72967 d3_event.preventDefault();
72968 d3_event.stopPropagation();
72969 if (!parentItem.empty()) {
72970 parentItem.select(".preset-list-button").node().focus();
72972 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
72973 d3_event.preventDefault();
72974 d3_event.stopPropagation();
72975 item.datum().choose.call(select_default2(this).node());
72978 function CategoryItem(preset) {
72979 var box, sublist, shown = false;
72980 function item(selection2) {
72981 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
72983 var isExpanded = select_default2(this).classed("expanded");
72984 var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
72985 select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
72986 select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
72989 var geometries = entityGeometries();
72990 var button = wrap2.append("button").attr("class", "preset-list-button").attr("title", _t("icons.expand")).classed("expanded", false).call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", click).on("keydown", function(d3_event) {
72991 if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
72992 d3_event.preventDefault();
72993 d3_event.stopPropagation();
72994 if (!select_default2(this).classed("expanded")) {
72995 click.call(this, d3_event);
72997 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
72998 d3_event.preventDefault();
72999 d3_event.stopPropagation();
73000 if (select_default2(this).classed("expanded")) {
73001 click.call(this, d3_event);
73004 itemKeydown.call(this, d3_event);
73007 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
73008 label.append("div").attr("class", "namepart").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline")).append("span").call(preset.nameLabel()).append("span").text("\u2026");
73009 box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
73010 box.append("div").attr("class", "arrow");
73011 sublist = box.append("div").attr("class", "preset-list fillL3");
73013 item.choose = function() {
73014 if (!box || !sublist)
73018 box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
73021 var members = preset.members.matchAllGeometry(entityGeometries());
73022 sublist.call(drawList, members);
73023 box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
73026 item.preset = preset;
73029 function PresetItem(preset) {
73030 function item(selection2) {
73031 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
73032 var geometries = entityGeometries();
73033 var button = wrap2.append("button").attr("class", "preset-list-button").call(uiPresetIcon().geometry(geometries.length === 1 && geometries[0]).preset(preset)).on("click", item.choose).on("keydown", itemKeydown);
73034 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
73036 preset.nameLabel(),
73037 preset.subtitleLabel()
73039 label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
73040 d2(select_default2(this));
73042 wrap2.call(item.reference.button);
73043 selection2.call(item.reference.body);
73045 item.choose = function() {
73046 if (select_default2(this).classed("disabled"))
73048 if (!context.inIntro()) {
73049 _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
73053 for (var i3 in _entityIDs) {
73054 var entityID = _entityIDs[i3];
73055 var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
73056 graph = actionChangePreset(entityID, oldPreset, preset)(graph);
73060 _t("operations.change_tags.annotation")
73062 context.validator().validate();
73063 dispatch14.call("choose", this, preset);
73065 item.help = function(d3_event) {
73066 d3_event.stopPropagation();
73067 item.reference.toggle();
73069 item.preset = preset;
73070 item.reference = uiTagReference(preset.reference(), context);
73073 function updateForFeatureHiddenState() {
73074 if (!_entityIDs.every(context.hasEntity))
73076 var geometries = entityGeometries();
73077 var button = context.container().selectAll(".preset-list .preset-list-button");
73078 button.call(uiTooltip().destroyAny);
73079 button.each(function(item, index) {
73080 var hiddenPresetFeaturesId;
73081 for (var i3 in geometries) {
73082 hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
73083 if (hiddenPresetFeaturesId)
73086 var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
73087 select_default2(this).classed("disabled", isHiddenPreset);
73088 if (isHiddenPreset) {
73089 var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
73090 select_default2(this).call(
73091 uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
73092 features: _t("feature." + hiddenPresetFeaturesId + ".description")
73093 })).placement(index < 2 ? "bottom" : "top")
73098 presetList.autofocus = function(val) {
73099 if (!arguments.length)
73104 presetList.entityIDs = function(val) {
73105 if (!arguments.length)
73109 if (_entityIDs && _entityIDs.length) {
73110 const extent = _entityIDs.reduce(function(extent2, entityID) {
73111 var entity = context.graph().entity(entityID);
73112 return extent2.extend(entity.extent(context.graph()));
73114 _currLoc = extent.center();
73115 var presets = _entityIDs.map(function(entityID) {
73116 return _mainPresetIndex.match(context.entity(entityID), context.graph());
73118 presetList.presets(presets);
73122 presetList.presets = function(val) {
73123 if (!arguments.length)
73124 return _currentPresets;
73125 _currentPresets = val;
73128 function entityGeometries() {
73130 for (var i3 in _entityIDs) {
73131 var entityID = _entityIDs[i3];
73132 var entity = context.entity(entityID);
73133 var geometry = entity.geometry(context.graph());
73134 if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
73135 geometry = "point";
73137 if (!counts[geometry])
73138 counts[geometry] = 0;
73139 counts[geometry] += 1;
73141 return Object.keys(counts).sort(function(geom1, geom2) {
73142 return counts[geom2] - counts[geom1];
73145 return utilRebind(presetList, dispatch14, "on");
73148 // modules/ui/inspector.js
73149 function uiInspector(context) {
73150 var presetList = uiPresetList(context);
73151 var entityEditor = uiEntityEditor(context);
73152 var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
73153 var _state = "select";
73155 var _newFeature = false;
73156 function inspector(selection2) {
73157 presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
73158 inspector.setPreset();
73160 entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
73161 wrap2 = selection2.selectAll(".panewrap").data([0]);
73162 var enter = wrap2.enter().append("div").attr("class", "panewrap");
73163 enter.append("div").attr("class", "preset-list-pane pane");
73164 enter.append("div").attr("class", "entity-editor-pane pane");
73165 wrap2 = wrap2.merge(enter);
73166 presetPane = wrap2.selectAll(".preset-list-pane");
73167 editorPane = wrap2.selectAll(".entity-editor-pane");
73168 function shouldDefaultToPresetList() {
73169 if (_state !== "select")
73171 if (_entityIDs.length !== 1)
73173 var entityID = _entityIDs[0];
73174 var entity = context.hasEntity(entityID);
73177 if (entity.hasNonGeometryTags())
73181 if (entity.geometry(context.graph()) !== "vertex")
73183 if (context.graph().parentRelations(entity).length)
73185 if (context.validator().getEntityIssues(entityID).length)
73187 if (entity.isHighwayIntersection(context.graph()))
73191 if (shouldDefaultToPresetList()) {
73192 wrap2.style("right", "-100%");
73193 editorPane.classed("hide", true);
73194 presetPane.classed("hide", false).call(presetList);
73196 wrap2.style("right", "0%");
73197 presetPane.classed("hide", true);
73198 editorPane.classed("hide", false).call(entityEditor);
73200 var footer = selection2.selectAll(".footer").data([0]);
73201 footer = footer.enter().append("div").attr("class", "footer").merge(footer);
73203 uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
73206 inspector.showList = function(presets) {
73207 presetPane.classed("hide", false);
73208 wrap2.transition().styleTween("right", function() {
73209 return value_default("0%", "-100%");
73210 }).on("end", function() {
73211 editorPane.classed("hide", true);
73214 presetList.presets(presets);
73216 presetPane.call(presetList.autofocus(true));
73218 inspector.setPreset = function(preset) {
73219 if (preset && preset.id === "type/multipolygon") {
73220 presetPane.call(presetList.autofocus(true));
73222 editorPane.classed("hide", false);
73223 wrap2.transition().styleTween("right", function() {
73224 return value_default("-100%", "0%");
73225 }).on("end", function() {
73226 presetPane.classed("hide", true);
73229 entityEditor.presets([preset]);
73231 editorPane.call(entityEditor);
73234 inspector.state = function(val) {
73235 if (!arguments.length)
73238 entityEditor.state(_state);
73239 context.container().selectAll(".field-help-body").remove();
73242 inspector.entityIDs = function(val) {
73243 if (!arguments.length)
73248 inspector.newFeature = function(val) {
73249 if (!arguments.length)
73250 return _newFeature;
73257 // modules/ui/lasso.js
73258 function uiLasso(context) {
73259 var group, polygon2;
73260 lasso.coordinates = [];
73261 function lasso(selection2) {
73262 context.container().classed("lasso", true);
73263 group = selection2.append("g").attr("class", "lasso hide");
73264 polygon2 = group.append("path").attr("class", "lasso-path");
73265 group.call(uiToggle(true));
73269 polygon2.data([lasso.coordinates]).attr("d", function(d2) {
73270 return "M" + d2.join(" L") + " Z";
73274 lasso.extent = function() {
73275 return lasso.coordinates.reduce(function(extent, point2) {
73276 return extent.extend(geoExtent(point2));
73279 lasso.p = function(_2) {
73280 if (!arguments.length)
73282 lasso.coordinates.push(_2);
73286 lasso.close = function() {
73288 group.call(uiToggle(false, function() {
73289 select_default2(this).remove();
73292 context.container().classed("lasso", false);
73297 // modules/ui/source_switch.js
73298 function uiSourceSwitch(context) {
73300 function click(d3_event) {
73301 d3_event.preventDefault();
73302 var osm = context.connection();
73305 if (context.inIntro())
73307 if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes")))
73309 var isLive = select_default2(this).classed("live");
73311 context.enter(modeBrowse(context));
73312 context.history().clearSaved();
73314 select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
73315 osm.switch(isLive ? keys2[0] : keys2[1]);
73317 var sourceSwitch = function(selection2) {
73318 selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
73320 sourceSwitch.keys = function(_2) {
73321 if (!arguments.length)
73324 return sourceSwitch;
73326 return sourceSwitch;
73329 // modules/ui/spinner.js
73330 function uiSpinner(context) {
73331 var osm = context.connection();
73332 return function(selection2) {
73333 var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
73335 osm.on("loading.spinner", function() {
73336 img.transition().style("opacity", 1);
73337 }).on("loaded.spinner", function() {
73338 img.transition().style("opacity", 0);
73344 // modules/ui/sections/privacy.js
73345 function uiSectionPrivacy(context) {
73346 let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
73347 function renderDisclosureContent(selection2) {
73348 selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
73349 let thirdPartyIconsEnter = selection2.select(".privacy-options-list").selectAll(".privacy-third-party-icons-item").data([corePreferences("preferences.privacy.thirdpartyicons") || "true"]).enter().append("li").attr("class", "privacy-third-party-icons-item").append("label").call(
73350 uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
73352 thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
73353 d3_event.preventDefault();
73354 corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
73356 thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
73357 selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
73358 selection2.selectAll(".privacy-link").data([0]).enter().append("div").attr("class", "privacy-link").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/release/PRIVACY.md").append("span").call(_t.append("preferences.privacy.privacy_link"));
73360 corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
73364 // modules/ui/splash.js
73365 function uiSplash(context) {
73366 return (selection2) => {
73367 if (context.history().hasRestorableChanges())
73369 let updateMessage = "";
73370 const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
73371 let showSplash = !corePreferences("sawSplash");
73372 if (sawPrivacyVersion !== context.privacyVersion) {
73373 updateMessage = _t("splash.privacy_update");
73378 corePreferences("sawSplash", true);
73379 corePreferences("sawPrivacyVersion", context.privacyVersion);
73380 _mainFileFetcher.get("intro_graph");
73381 let modalSelection = uiModal(selection2);
73382 modalSelection.select(".modal").attr("class", "modal-splash modal");
73383 let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
73384 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
73385 let modalSection = introModal.append("div").attr("class", "modal-section");
73386 modalSection.append("p").html(_t.html("splash.text", {
73387 version: context.version,
73388 website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
73389 github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
73391 modalSection.append("p").html(_t.html("splash.privacy", {
73393 privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
73395 uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
73396 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
73397 let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
73398 context.container().call(uiIntro(context));
73399 modalSelection.close();
73401 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
73402 walkthrough.append("div").call(_t.append("splash.walkthrough"));
73403 let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
73404 startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
73405 startEditing.append("div").call(_t.append("splash.start"));
73406 modalSelection.select("button.close").attr("class", "hide");
73410 // modules/ui/status.js
73411 function uiStatus(context) {
73412 var osm = context.connection();
73413 return function(selection2) {
73416 function update(err, apiStatus) {
73417 selection2.html("");
73419 if (apiStatus === "connectionSwitched") {
73421 } else if (apiStatus === "rateLimited") {
73422 selection2.call(_t.append("osm_api_status.message.rateLimit")).append("a").attr("href", "#").attr("class", "api-status-login").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).append("span").call(_t.append("login")).on("click.login", function(d3_event) {
73423 d3_event.preventDefault();
73424 osm.authenticate();
73427 var throttledRetry = throttle_default(function() {
73428 context.loadTiles(context.projection);
73429 osm.reloadApiStatus();
73431 selection2.call(_t.append("osm_api_status.message.error", { suffix: " " })).append("a").attr("href", "#").call(_t.append("osm_api_status.retry")).on("click.retry", function(d3_event) {
73432 d3_event.preventDefault();
73436 } else if (apiStatus === "readonly") {
73437 selection2.call(_t.append("osm_api_status.message.readonly"));
73438 } else if (apiStatus === "offline") {
73439 selection2.call(_t.append("osm_api_status.message.offline"));
73441 selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
73443 osm.on("apiStatusChange.uiStatus", update);
73444 context.history().on("storage_error", () => {
73445 selection2.selectAll("span.local-storage-full").remove();
73446 selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
73447 selection2.classed("error", true);
73449 window.setInterval(function() {
73450 osm.reloadApiStatus();
73452 osm.reloadApiStatus();
73456 // modules/ui/version.js
73457 var sawVersion = null;
73458 var isNewVersion = false;
73459 var isNewUser = false;
73460 function uiVersion(context) {
73461 var currVersion = context.version;
73462 var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
73463 if (sawVersion === null && matchedVersion !== null) {
73464 if (corePreferences("sawVersion")) {
73466 isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
73469 isNewVersion = true;
73471 corePreferences("sawVersion", currVersion);
73472 sawVersion = currVersion;
73474 return function(selection2) {
73475 selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
73476 if (isNewVersion && !isNewUser) {
73477 selection2.append("a").attr("class", "badge").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/release/CHANGELOG.md#whats-new").call(svgIcon("#maki-gift")).call(
73478 uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
73484 // modules/ui/zoom.js
73485 function uiZoom(context) {
73488 icon: "iD-icon-plus",
73489 title: _t.append("zoom.in"),
73491 disabled: function() {
73492 return !context.map().canZoomIn();
73494 disabledTitle: _t.append("zoom.disabled.in"),
73498 icon: "iD-icon-minus",
73499 title: _t.append("zoom.out"),
73501 disabled: function() {
73502 return !context.map().canZoomOut();
73504 disabledTitle: _t.append("zoom.disabled.out"),
73507 function zoomIn(d3_event) {
73508 if (d3_event.shiftKey)
73510 d3_event.preventDefault();
73511 context.map().zoomIn();
73513 function zoomOut(d3_event) {
73514 if (d3_event.shiftKey)
73516 d3_event.preventDefault();
73517 context.map().zoomOut();
73519 function zoomInFurther(d3_event) {
73520 if (d3_event.shiftKey)
73522 d3_event.preventDefault();
73523 context.map().zoomInFurther();
73525 function zoomOutFurther(d3_event) {
73526 if (d3_event.shiftKey)
73528 d3_event.preventDefault();
73529 context.map().zoomOutFurther();
73531 return function(selection2) {
73532 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
73533 if (d2.disabled()) {
73534 return d2.disabledTitle;
73537 }).keys(function(d2) {
73540 var lastPointerUpType;
73541 var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
73543 }).on("pointerup.editor", function(d3_event) {
73544 lastPointerUpType = d3_event.pointerType;
73545 }).on("click.editor", function(d3_event, d2) {
73546 if (!d2.disabled()) {
73547 d2.action(d3_event);
73548 } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
73549 context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
73551 lastPointerUpType = null;
73552 }).call(tooltipBehavior);
73553 buttons.each(function(d2) {
73554 select_default2(this).call(svgIcon("#" + d2.icon, "light"));
73556 utilKeybinding.plusKeys.forEach(function(key) {
73557 context.keybinding().on([key], zoomIn);
73558 context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
73560 utilKeybinding.minusKeys.forEach(function(key) {
73561 context.keybinding().on([key], zoomOut);
73562 context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
73564 function updateButtonStates() {
73565 buttons.classed("disabled", function(d2) {
73566 return d2.disabled();
73567 }).each(function() {
73568 var selection3 = select_default2(this);
73569 if (!selection3.select(".tooltip.in").empty()) {
73570 selection3.call(tooltipBehavior.updateContent);
73574 updateButtonStates();
73575 context.map().on("move.uiZoom", updateButtonStates);
73579 // modules/ui/sections/raw_tag_editor.js
73580 function uiSectionRawTagEditor(id2, context) {
73581 var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
73582 var count = Object.keys(_tags).filter(function(d2) {
73585 return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
73586 }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
73587 var taginfo = services.taginfo;
73588 var dispatch14 = dispatch_default("change");
73589 var availableViews = [
73590 { id: "list", icon: "#fas-th-list" },
73591 { id: "text", icon: "#fas-i-cursor" }
73593 let _discardTags = {};
73594 _mainFileFetcher.get("discarded").then((d2) => {
73598 var _tagView = corePreferences("raw-tag-editor-view") || "list";
73599 var _readOnlyTags = [];
73600 var _orderedKeys = [];
73601 var _showBlank = false;
73602 var _pendingChange = null;
73607 var _didInteract = false;
73608 function interacted() {
73609 _didInteract = true;
73611 function renderDisclosureContent(wrap2) {
73612 _orderedKeys = _orderedKeys.filter(function(key) {
73613 return _tags[key] !== void 0;
73615 var all = Object.keys(_tags).sort();
73616 var missingKeys = utilArrayDifference(all, _orderedKeys);
73617 for (var i3 in missingKeys) {
73618 _orderedKeys.push(missingKeys[i3]);
73620 var rowData = _orderedKeys.map(function(key, i4) {
73621 return { index: i4, key, value: _tags[key] };
73623 if (!rowData.length || _showBlank) {
73624 _showBlank = false;
73625 rowData.push({ index: rowData.length, key: "", value: "" });
73627 var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
73628 options2.exit().remove();
73629 var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
73630 var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
73633 optionEnter.append("button").attr("class", function(d2) {
73634 return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
73635 }).attr("aria-selected", function(d2) {
73636 return _tagView === d2.id;
73637 }).attr("role", "tab").attr("title", function(d2) {
73638 return _t("icons." + d2.id);
73639 }).on("click", function(d3_event, d2) {
73641 corePreferences("raw-tag-editor-view", d2.id);
73642 wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
73643 return datum2 === d2;
73644 }).attr("aria-selected", function(datum2) {
73645 return datum2 === d2;
73647 wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
73648 wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
73649 }).each(function(d2) {
73650 select_default2(this).call(svgIcon(d2.icon));
73652 var textData = rowsToText(rowData);
73653 var textarea = wrap2.selectAll(".tag-text").data([0]);
73654 textarea = textarea.enter().append("textarea").attr("class", "tag-text" + (_tagView !== "text" ? " hide" : "")).call(utilNoAuto).attr("placeholder", _t("inspector.key_value")).attr("spellcheck", "false").merge(textarea);
73655 textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
73656 var list2 = wrap2.selectAll(".tag-list").data([0]);
73657 list2 = list2.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list2);
73658 var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
73659 addRowEnter.append("button").attr("class", "add-tag").attr("aria-label", _t("inspector.add_to_tag")).call(svgIcon("#iD-icon-plus", "light")).call(uiTooltip().title(() => _t.append("inspector.add_to_tag")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left")).on("click", addTag);
73660 addRowEnter.append("div").attr("class", "space-value");
73661 addRowEnter.append("div").attr("class", "space-buttons");
73662 var items = list2.selectAll(".tag-row").data(rowData, function(d2) {
73665 items.exit().each(unbind).remove();
73666 var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
73667 var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
73668 innerWrap.append("div").attr("class", "key-wrap").append("input").property("type", "text").attr("class", "key").call(utilNoAuto).on("focus", interacted).on("blur", keyChange).on("change", keyChange);
73669 innerWrap.append("div").attr("class", "value-wrap").append("input").property("type", "text").attr("class", "value").call(utilNoAuto).on("focus", interacted).on("blur", valueChange).on("change", valueChange).on("keydown.push-more", pushMore);
73670 innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73671 items = items.merge(itemsEnter).sort(function(a2, b2) {
73672 return a2.index - b2.index;
73674 items.each(function(d2) {
73675 var row = select_default2(this);
73676 var key = row.select("input.key");
73677 var value = row.select("input.value");
73678 if (_entityIDs && taginfo && _state !== "hover") {
73679 bindTypeahead(key, value);
73681 var referenceOptions = { key: d2.key };
73682 if (typeof d2.value === "string") {
73683 referenceOptions.value = d2.value;
73685 var reference = uiTagReference(referenceOptions, context);
73686 if (_state === "hover") {
73687 reference.showing(false);
73689 row.select(".inner-wrap").call(reference.button);
73690 row.call(reference.body);
73691 row.select("button.remove");
73693 items.selectAll("input.key").attr("title", function(d2) {
73695 }).call(utilGetSetValue, function(d2) {
73697 }).attr("readonly", function(d2) {
73698 return isReadOnly(d2) || null;
73700 items.selectAll("input.value").attr("title", function(d2) {
73701 return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
73702 }).classed("mixed", function(d2) {
73703 return Array.isArray(d2.value);
73704 }).attr("placeholder", function(d2) {
73705 return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
73706 }).call(utilGetSetValue, function(d2) {
73707 return typeof d2.value === "string" ? d2.value : "";
73708 }).attr("readonly", function(d2) {
73709 return isReadOnly(d2) || null;
73711 items.selectAll("button.remove").on(
73712 ("PointerEvent" in window ? "pointer" : "mouse") + "down",
73713 // 'click' fires too late - #5878
73714 (d3_event, d2) => {
73715 if (d3_event.button !== 0)
73717 removeTag(d3_event, d2);
73721 function isReadOnly(d2) {
73722 for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
73723 if (d2.key.match(_readOnlyTags[i3]) !== null) {
73729 function setTextareaHeight() {
73730 if (_tagView !== "text")
73732 var selection2 = select_default2(this);
73733 var matches = selection2.node().value.match(/\n/g);
73734 var lineCount = 2 + Number(matches && matches.length);
73735 var lineHeight = 20;
73736 selection2.style("height", lineCount * lineHeight + "px");
73738 function stringify3(s2) {
73739 return JSON.stringify(s2).slice(1, -1);
73741 function unstringify(s2) {
73744 if (s2.length < 1 || s2.charAt(0) !== '"') {
73747 if (s2.length < 2 || s2.charAt(s2.length - 1) !== '"' || s2.charAt(s2.length - 1) === '"' && s2.charAt(s2.length - 2) === "\\") {
73750 return JSON.parse(leading + s2 + trailing);
73752 function rowsToText(rows) {
73753 var str = rows.filter(function(row) {
73754 return row.key && row.key.trim() !== "";
73755 }).map(function(row) {
73756 var rawVal = row.value;
73757 if (typeof rawVal !== "string")
73759 var val = rawVal ? stringify3(rawVal) : "";
73760 return stringify3(row.key) + "=" + val;
73762 if (_state !== "hover" && str.length) {
73767 function textChanged() {
73768 var newText = this.value.trim();
73770 newText.split("\n").forEach(function(row) {
73771 var m2 = row.match(/^\s*([^=]+)=(.*)$/);
73773 var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
73774 var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
73778 var tagDiff = utilTagDiff(_tags, newTags);
73779 if (!tagDiff.length)
73781 _pendingChange = _pendingChange || {};
73782 tagDiff.forEach(function(change) {
73783 if (isReadOnly({ key: change.key }))
73785 if (change.newVal === "*" && typeof change.oldVal !== "string")
73787 if (change.type === "-") {
73788 _pendingChange[change.key] = void 0;
73789 } else if (change.type === "+") {
73790 _pendingChange[change.key] = change.newVal || "";
73793 if (Object.keys(_pendingChange).length === 0) {
73794 _pendingChange = null;
73799 function pushMore(d3_event) {
73800 if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
73804 function bindTypeahead(key, value) {
73805 if (isReadOnly(key.datum()))
73807 if (Array.isArray(value.datum().value)) {
73808 value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
73809 var keyString = utilGetSetValue(key);
73810 if (!_tags[keyString])
73812 var data = _tags[keyString].map(function(tagValue) {
73816 title: _t("inspector.empty"),
73817 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
73829 var geometry = context.graph().geometry(_entityIDs[0]);
73830 key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
73835 }, function(err, data) {
73837 const filtered = data.filter((d2) => _tags[d2.value] === void 0).filter((d2) => !(d2.value in _discardTags)).filter((d2) => !/_\d$/.test(d2)).filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
73838 callback(sort(value2, filtered));
73842 value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
73845 key: utilGetSetValue(key),
73848 }, function(err, data) {
73850 const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
73851 callback(sort(value2, filtered));
73854 }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
73855 function sort(value2, data) {
73856 var sameletter = [];
73858 for (var i3 = 0; i3 < data.length; i3++) {
73859 if (data[i3].value.substring(0, value2.length) === value2) {
73860 sameletter.push(data[i3]);
73862 other.push(data[i3]);
73865 return sameletter.concat(other);
73868 function unbind() {
73869 var row = select_default2(this);
73870 row.selectAll("input.key").call(uiCombobox.off, context);
73871 row.selectAll("input.value").call(uiCombobox.off, context);
73873 function keyChange(d3_event, d2) {
73874 if (select_default2(this).attr("readonly"))
73877 if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0)
73879 var kNew = context.cleanTagKey(this.value.trim());
73880 if (isReadOnly({ key: kNew })) {
73884 if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
73886 section.selection().selectAll(".tag-list input.value").each(function(d4) {
73887 if (d4.key === kNew) {
73888 var input = select_default2(this).node();
73895 _pendingChange = _pendingChange || {};
73899 _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
73900 _pendingChange[kOld] = void 0;
73902 let row = this.parentNode.parentNode;
73903 let inputVal = select_default2(row).selectAll("input.value");
73904 let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
73905 _pendingChange[kNew] = vNew;
73906 utilGetSetValue(inputVal, vNew);
73908 var existingKeyIndex = _orderedKeys.indexOf(kOld);
73909 if (existingKeyIndex !== -1)
73910 _orderedKeys[existingKeyIndex] = kNew;
73915 function valueChange(d3_event, d2) {
73916 if (isReadOnly(d2))
73918 if (typeof d2.value !== "string" && !this.value)
73920 if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0)
73922 _pendingChange = _pendingChange || {};
73923 _pendingChange[d2.key] = context.cleanTagValue(this.value);
73926 function removeTag(d3_event, d2) {
73927 if (isReadOnly(d2))
73929 if (d2.key === "") {
73930 _showBlank = false;
73931 section.reRender();
73933 _orderedKeys = _orderedKeys.filter(function(key) {
73934 return key !== d2.key;
73936 _pendingChange = _pendingChange || {};
73937 _pendingChange[d2.key] = void 0;
73941 function addTag() {
73942 window.setTimeout(function() {
73944 section.reRender();
73945 section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
73948 function scheduleChange() {
73949 var entityIDs = _entityIDs;
73950 window.setTimeout(function() {
73951 if (!_pendingChange)
73953 dispatch14.call("change", this, entityIDs, _pendingChange);
73954 _pendingChange = null;
73957 section.state = function(val) {
73958 if (!arguments.length)
73960 if (_state !== val) {
73966 section.presets = function(val) {
73967 if (!arguments.length)
73970 if (_presets && _presets.length && _presets[0].isFallback()) {
73971 section.disclosureExpanded(true);
73972 } else if (!_didInteract) {
73973 section.disclosureExpanded(null);
73977 section.tags = function(val) {
73978 if (!arguments.length)
73983 section.entityIDs = function(val) {
73984 if (!arguments.length)
73986 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
73992 section.readOnlyTags = function(val) {
73993 if (!arguments.length)
73994 return _readOnlyTags;
73995 _readOnlyTags = val;
73998 return utilRebind(section, dispatch14, "on");
74001 // modules/ui/data_editor.js
74002 function uiDataEditor(context) {
74003 var dataHeader = uiDataHeader();
74004 var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
74006 function dataEditor(selection2) {
74007 var header = selection2.selectAll(".header").data([0]);
74008 var headerEnter = header.enter().append("div").attr("class", "header fillL");
74009 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74010 context.enter(modeBrowse(context));
74011 }).call(svgIcon("#iD-icon-close"));
74012 headerEnter.append("h2").call(_t.append("map_data.title"));
74013 var body = selection2.selectAll(".body").data([0]);
74014 body = body.enter().append("div").attr("class", "body").merge(body);
74015 var editor = body.selectAll(".data-editor").data([0]);
74016 editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
74017 var rte = body.selectAll(".raw-tag-editor").data([0]);
74018 rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
74019 rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
74020 ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
74022 dataEditor.datum = function(val) {
74023 if (!arguments.length)
74031 // modules/ui/sidebar.js
74032 function uiSidebar(context) {
74033 var inspector = uiInspector(context);
74034 var dataEditor = uiDataEditor(context);
74035 var noteEditor = uiNoteEditor(context);
74036 var improveOsmEditor = uiImproveOsmEditor(context);
74037 var keepRightEditor = uiKeepRightEditor(context);
74038 var osmoseEditor = uiOsmoseEditor(context);
74040 var _wasData = false;
74041 var _wasNote = false;
74042 var _wasQaItem = false;
74043 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
74044 function sidebar(selection2) {
74045 var container = context.container();
74046 var minWidth = 240;
74048 var containerWidth;
74050 selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
74051 var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
74052 var downPointerId, lastClientX, containerLocGetter;
74053 function pointerdown(d3_event) {
74056 if ("button" in d3_event && d3_event.button !== 0)
74058 downPointerId = d3_event.pointerId || "mouse";
74059 lastClientX = d3_event.clientX;
74060 containerLocGetter = utilFastMouse(container.node());
74061 dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
74062 sidebarWidth = selection2.node().getBoundingClientRect().width;
74063 containerWidth = container.node().getBoundingClientRect().width;
74064 var widthPct = sidebarWidth / containerWidth * 100;
74065 selection2.style("width", widthPct + "%").style("max-width", "85%");
74066 resizer.classed("dragging", true);
74067 select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
74068 d3_event2.preventDefault();
74069 }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
74071 function pointermove(d3_event) {
74072 if (downPointerId !== (d3_event.pointerId || "mouse"))
74074 d3_event.preventDefault();
74075 var dx = d3_event.clientX - lastClientX;
74076 lastClientX = d3_event.clientX;
74077 var isRTL = _mainLocalizer.textDirection() === "rtl";
74078 var scaleX = isRTL ? 0 : 1;
74079 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
74080 var x2 = containerLocGetter(d3_event)[0] - dragOffset;
74081 sidebarWidth = isRTL ? containerWidth - x2 : x2;
74082 var isCollapsed = selection2.classed("collapsed");
74083 var shouldCollapse = sidebarWidth < minWidth;
74084 selection2.classed("collapsed", shouldCollapse);
74085 if (shouldCollapse) {
74086 if (!isCollapsed) {
74087 selection2.style(xMarginProperty, "-400px").style("width", "400px");
74088 context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
74091 var widthPct = sidebarWidth / containerWidth * 100;
74092 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
74094 context.ui().onResize([-sidebarWidth * scaleX, 0]);
74096 context.ui().onResize([-dx * scaleX, 0]);
74100 function pointerup(d3_event) {
74101 if (downPointerId !== (d3_event.pointerId || "mouse"))
74103 downPointerId = null;
74104 resizer.classed("dragging", false);
74105 select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
74107 var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
74108 var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
74109 var hoverModeSelect = function(targets) {
74110 context.container().selectAll(".feature-list-item button").classed("hover", false);
74111 if (context.selectedIDs().length > 1 && targets && targets.length) {
74112 var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
74113 return targets.indexOf(node) !== -1;
74115 if (!elements.empty()) {
74116 elements.classed("hover", true);
74120 sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
74121 function hover(targets) {
74122 var datum2 = targets && targets.length && targets[0];
74123 if (datum2 && datum2.__featurehash__) {
74125 sidebar.show(dataEditor.datum(datum2));
74126 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
74127 } else if (datum2 instanceof osmNote) {
74128 if (context.mode().id === "drag-note")
74131 var osm = services.osm;
74133 datum2 = osm.getNote(datum2.id);
74135 sidebar.show(noteEditor.note(datum2));
74136 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
74137 } else if (datum2 instanceof QAItem) {
74139 var errService = services[datum2.service];
74141 datum2 = errService.getError(datum2.id);
74144 if (datum2.service === "keepRight") {
74145 errEditor = keepRightEditor;
74146 } else if (datum2.service === "osmose") {
74147 errEditor = osmoseEditor;
74149 errEditor = improveOsmEditor;
74151 context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
74152 return d2.id === datum2.id;
74154 sidebar.show(errEditor.error(datum2));
74155 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
74156 } else if (!_current && datum2 instanceof osmEntity) {
74157 featureListWrap.classed("inspector-hidden", true);
74158 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
74159 if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
74160 inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
74161 inspectorWrap.call(inspector);
74163 } else if (!_current) {
74164 featureListWrap.classed("inspector-hidden", false);
74165 inspectorWrap.classed("inspector-hidden", true);
74166 inspector.state("hide");
74167 } else if (_wasData || _wasNote || _wasQaItem) {
74170 _wasQaItem = false;
74171 context.container().selectAll(".note").classed("hover", false);
74172 context.container().selectAll(".qaItem").classed("hover", false);
74176 sidebar.hover = throttle_default(hover, 200);
74177 sidebar.intersects = function(extent) {
74178 var rect = selection2.node().getBoundingClientRect();
74179 return extent.intersects([
74180 context.projection.invert([0, rect.height]),
74181 context.projection.invert([rect.width, 0])
74184 sidebar.select = function(ids, newFeature) {
74186 if (ids && ids.length) {
74187 var entity = ids.length === 1 && context.entity(ids[0]);
74188 if (entity && newFeature && selection2.classed("collapsed")) {
74189 var extent = entity.extent(context.graph());
74190 sidebar.expand(sidebar.intersects(extent));
74192 featureListWrap.classed("inspector-hidden", true);
74193 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
74194 inspector.state("select").entityIDs(ids).newFeature(newFeature);
74195 inspectorWrap.call(inspector);
74197 inspector.state("hide");
74200 sidebar.showPresetList = function() {
74201 inspector.showList();
74203 sidebar.show = function(component, element) {
74204 featureListWrap.classed("inspector-hidden", true);
74205 inspectorWrap.classed("inspector-hidden", true);
74208 _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
74210 sidebar.hide = function() {
74211 featureListWrap.classed("inspector-hidden", false);
74212 inspectorWrap.classed("inspector-hidden", true);
74217 sidebar.expand = function(moveMap) {
74218 if (selection2.classed("collapsed")) {
74219 sidebar.toggle(moveMap);
74222 sidebar.collapse = function(moveMap) {
74223 if (!selection2.classed("collapsed")) {
74224 sidebar.toggle(moveMap);
74227 sidebar.toggle = function(moveMap) {
74228 if (context.inIntro())
74230 var isCollapsed = selection2.classed("collapsed");
74231 var isCollapsing = !isCollapsed;
74232 var isRTL = _mainLocalizer.textDirection() === "rtl";
74233 var scaleX = isRTL ? 0 : 1;
74234 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
74235 sidebarWidth = selection2.node().getBoundingClientRect().width;
74236 selection2.style("width", sidebarWidth + "px");
74237 var startMargin, endMargin, lastMargin;
74238 if (isCollapsing) {
74239 startMargin = lastMargin = 0;
74240 endMargin = -sidebarWidth;
74242 startMargin = lastMargin = -sidebarWidth;
74245 if (!isCollapsing) {
74246 selection2.classed("collapsed", isCollapsing);
74248 selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
74249 var i3 = number_default(startMargin, endMargin);
74250 return function(t2) {
74251 var dx = lastMargin - Math.round(i3(t2));
74252 lastMargin = lastMargin - dx;
74253 context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
74255 }).on("end", function() {
74256 if (isCollapsing) {
74257 selection2.classed("collapsed", isCollapsing);
74259 if (!isCollapsing) {
74260 var containerWidth2 = container.node().getBoundingClientRect().width;
74261 var widthPct = sidebarWidth / containerWidth2 * 100;
74262 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
74266 resizer.on("dblclick", function(d3_event) {
74267 d3_event.preventDefault();
74268 if (d3_event.sourceEvent) {
74269 d3_event.sourceEvent.preventDefault();
74273 context.map().on("crossEditableZoom.sidebar", function(within) {
74274 if (!within && !selection2.select(".inspector-hover").empty()) {
74279 sidebar.showPresetList = function() {
74281 sidebar.hover = function() {
74283 sidebar.hover.cancel = function() {
74285 sidebar.intersects = function() {
74287 sidebar.select = function() {
74289 sidebar.show = function() {
74291 sidebar.hide = function() {
74293 sidebar.expand = function() {
74295 sidebar.collapse = function() {
74297 sidebar.toggle = function() {
74302 // modules/ui/tools/modes.js
74303 function uiToolDrawModes(context) {
74306 label: _t.append("toolbar.add_feature")
74309 modeAddPoint(context, {
74310 title: _t.append("modes.add_point.title"),
74312 description: _t.append("modes.add_point.description"),
74313 preset: _mainPresetIndex.item("point"),
74316 modeAddLine(context, {
74317 title: _t.append("modes.add_line.title"),
74319 description: _t.append("modes.add_line.description"),
74320 preset: _mainPresetIndex.item("line"),
74323 modeAddArea(context, {
74324 title: _t.append("modes.add_area.title"),
74326 description: _t.append("modes.add_area.description"),
74327 preset: _mainPresetIndex.item("area"),
74331 function enabled(_mode) {
74332 return osmEditable();
74334 function osmEditable() {
74335 return context.editable();
74337 modes.forEach(function(mode) {
74338 context.keybinding().on(mode.key, function() {
74339 if (!enabled(mode))
74341 if (mode.id === context.mode().id) {
74342 context.enter(modeBrowse(context));
74344 context.enter(mode);
74348 tool.render = function(selection2) {
74349 var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
74350 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
74351 context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
74352 context.on("enter.modes", update);
74354 function update() {
74355 var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
74358 buttons.exit().remove();
74359 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
74360 return d2.id + " add-button bar-button";
74361 }).on("click.mode-buttons", function(d3_event, d2) {
74364 var currMode = context.mode().id;
74365 if (/^draw/.test(currMode))
74367 if (d2.id === currMode) {
74368 context.enter(modeBrowse(context));
74373 uiTooltip().placement("bottom").title(function(d2) {
74374 return d2.description;
74375 }).keys(function(d2) {
74377 }).scrollContainer(context.container().select(".top-toolbar"))
74379 buttonsEnter.each(function(d2) {
74380 select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
74382 buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
74383 mode.title(select_default2(this));
74385 if (buttons.enter().size() || buttons.exit().size()) {
74386 context.ui().checkOverflow(".top-toolbar", true);
74388 buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
74389 return !enabled(d2);
74390 }).classed("disabled", function(d2) {
74391 return !enabled(d2);
74392 }).attr("aria-pressed", function(d2) {
74393 return context.mode() && context.mode().button === d2.button;
74394 }).classed("active", function(d2) {
74395 return context.mode() && context.mode().button === d2.button;
74402 // modules/ui/tools/notes.js
74403 function uiToolNotes(context) {
74406 label: _t.append("modes.add_note.label")
74408 var mode = modeAddNote(context);
74409 function enabled() {
74410 return notesEnabled() && notesEditable();
74412 function notesEnabled() {
74413 var noteLayer = context.layers().layer("notes");
74414 return noteLayer && noteLayer.enabled();
74416 function notesEditable() {
74417 var mode2 = context.mode();
74418 return context.map().notesEditable() && mode2 && mode2.id !== "save";
74420 context.keybinding().on(mode.key, function() {
74423 if (mode.id === context.mode().id) {
74424 context.enter(modeBrowse(context));
74426 context.enter(mode);
74429 tool.render = function(selection2) {
74430 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
74431 context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
74432 context.on("enter.notes", update);
74434 function update() {
74435 var showNotes = notesEnabled();
74436 var data = showNotes ? [mode] : [];
74437 var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
74440 buttons.exit().remove();
74441 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
74442 return d2.id + " add-button bar-button";
74443 }).on("click.notes", function(d3_event, d2) {
74446 var currMode = context.mode().id;
74447 if (/^draw/.test(currMode))
74449 if (d2.id === currMode) {
74450 context.enter(modeBrowse(context));
74455 uiTooltip().placement("bottom").title(function(d2) {
74456 return d2.description;
74457 }).keys(function(d2) {
74459 }).scrollContainer(context.container().select(".top-toolbar"))
74461 buttonsEnter.each(function(d2) {
74462 select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
74464 if (buttons.enter().size() || buttons.exit().size()) {
74465 context.ui().checkOverflow(".top-toolbar", true);
74467 buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
74469 }).attr("aria-disabled", function() {
74471 }).classed("active", function(d2) {
74472 return context.mode() && context.mode().button === d2.button;
74473 }).attr("aria-pressed", function(d2) {
74474 return context.mode() && context.mode().button === d2.button;
74478 tool.uninstall = function() {
74479 context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
74480 context.map().on("move.notes", null).on("drawn.notes", null);
74485 // modules/ui/tools/save.js
74486 function uiToolSave(context) {
74489 label: _t.append("save.title")
74492 var tooltipBehavior = null;
74493 var history = context.history();
74494 var key = uiCmd("\u2318S");
74495 var _numChanges = 0;
74496 function isSaving() {
74497 var mode = context.mode();
74498 return mode && mode.id === "save";
74500 function isDisabled() {
74501 return _numChanges === 0 || isSaving();
74503 function save(d3_event) {
74504 d3_event.preventDefault();
74505 if (!context.inIntro() && !isSaving() && history.hasChanges()) {
74506 context.enter(modeSave(context));
74509 function bgColor(numChanges) {
74511 if (numChanges === 0) {
74513 } else if (numChanges <= 50) {
74514 step = numChanges / 50;
74515 return rgb_default("#fff", "#ff8")(step);
74517 step = Math.min((numChanges - 50) / 50, 1);
74518 return rgb_default("#ff8", "#f88")(step);
74521 function updateCount() {
74522 var val = history.difference().summary().length;
74523 if (val === _numChanges)
74526 if (tooltipBehavior) {
74527 tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
74530 button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
74531 button.select("span.count").text(_numChanges);
74534 tool.render = function(selection2) {
74535 tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
74536 var lastPointerUpType;
74537 button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
74538 lastPointerUpType = d3_event.pointerType;
74539 }).on("click", function(d3_event) {
74541 if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
74542 context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
74544 lastPointerUpType = null;
74545 }).call(tooltipBehavior);
74546 button.call(svgIcon("#iD-icon-save"));
74547 button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
74549 context.keybinding().on(key, save, true);
74550 context.history().on("change.save", updateCount);
74551 context.on("enter.save", function() {
74553 button.classed("disabled", isDisabled());
74555 button.call(tooltipBehavior.hide);
74560 tool.uninstall = function() {
74561 context.keybinding().off(key, true);
74562 context.history().on("change.save", null);
74563 context.on("enter.save", null);
74565 tooltipBehavior = null;
74570 // modules/ui/tools/sidebar_toggle.js
74571 function uiToolSidebarToggle(context) {
74573 id: "sidebar_toggle",
74574 label: _t.append("toolbar.inspect")
74576 tool.render = function(selection2) {
74577 selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
74578 context.ui().sidebar.toggle();
74580 uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
74581 ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
74586 // modules/ui/tools/undo_redo.js
74587 function uiToolUndoRedo(context) {
74590 label: _t.append("toolbar.undo_redo")
74594 cmd: uiCmd("\u2318Z"),
74595 action: function() {
74598 annotation: function() {
74599 return context.history().undoAnnotation();
74601 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
74604 cmd: uiCmd("\u2318\u21E7Z"),
74605 action: function() {
74608 annotation: function() {
74609 return context.history().redoAnnotation();
74611 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
74613 function editable() {
74614 return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
74616 /* ignore min zoom */
74619 tool.render = function(selection2) {
74620 var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
74621 return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
74622 }).keys(function(d2) {
74624 }).scrollContainer(context.container().select(".top-toolbar"));
74625 var lastPointerUpType;
74626 var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
74627 return "disabled " + d2.id + "-button bar-button";
74628 }).on("pointerup", function(d3_event) {
74629 lastPointerUpType = d3_event.pointerType;
74630 }).on("click", function(d3_event, d2) {
74631 d3_event.preventDefault();
74632 var annotation = d2.annotation();
74633 if (editable() && annotation) {
74636 if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
74637 var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
74638 context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
74640 lastPointerUpType = null;
74641 }).call(tooltipBehavior);
74642 buttons.each(function(d2) {
74643 select_default2(this).call(svgIcon("#" + d2.icon));
74645 context.keybinding().on(commands[0].cmd, function(d3_event) {
74646 d3_event.preventDefault();
74648 commands[0].action();
74649 }).on(commands[1].cmd, function(d3_event) {
74650 d3_event.preventDefault();
74652 commands[1].action();
74654 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
74655 context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
74656 context.history().on("change.undo_redo", function(difference2) {
74660 context.on("enter.undo_redo", update);
74661 function update() {
74662 buttons.classed("disabled", function(d2) {
74663 return !editable() || !d2.annotation();
74664 }).each(function() {
74665 var selection3 = select_default2(this);
74666 if (!selection3.select(".tooltip.in").empty()) {
74667 selection3.call(tooltipBehavior.updateContent);
74672 tool.uninstall = function() {
74673 context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
74674 context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
74675 context.history().on("change.undo_redo", null);
74676 context.on("enter.undo_redo", null);
74681 // modules/ui/top_toolbar.js
74682 function uiTopToolbar(context) {
74683 var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
74684 function notesEnabled() {
74685 var noteLayer = context.layers().layer("notes");
74686 return noteLayer && noteLayer.enabled();
74688 function topToolbar(bar) {
74689 bar.on("wheel.topToolbar", function(d3_event) {
74690 if (!d3_event.deltaX) {
74691 bar.node().scrollLeft += d3_event.deltaY;
74694 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
74695 context.layers().on("change.topToolbar", debouncedUpdate);
74697 function update() {
74703 tools.push("spacer");
74704 if (notesEnabled()) {
74705 tools = tools.concat([notes, "spacer"]);
74707 tools = tools.concat([undoRedo, save]);
74708 var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
74709 return d2.id || d2;
74711 toolbarItems.exit().each(function(d2) {
74712 if (d2.uninstall) {
74716 var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
74717 var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
74719 classes += " " + d2.klass;
74722 var actionableItems = itemsEnter.filter(function(d2) {
74723 return d2 !== "spacer";
74725 actionableItems.append("div").attr("class", "item-content").each(function(d2) {
74726 select_default2(this).call(d2.render, bar);
74728 actionableItems.append("div").attr("class", "item-label").each(function(d2) {
74729 d2.label(select_default2(this));
74736 // modules/ui/zoom_to_selection.js
74737 function uiZoomToSelection(context) {
74738 function isDisabled() {
74739 var mode = context.mode();
74740 return !mode || !mode.zoomToSelected;
74742 var _lastPointerUpType;
74743 function pointerup(d3_event) {
74744 _lastPointerUpType = d3_event.pointerType;
74746 function click(d3_event) {
74747 d3_event.preventDefault();
74748 if (isDisabled()) {
74749 if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
74750 context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
74753 var mode = context.mode();
74754 if (mode && mode.zoomToSelected) {
74755 mode.zoomToSelected();
74758 _lastPointerUpType = null;
74760 return function(selection2) {
74761 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
74762 if (isDisabled()) {
74763 return _t.append("inspector.zoom_to.no_selection");
74765 return _t.append("inspector.zoom_to.title");
74766 }).keys([_t("inspector.zoom_to.key")]);
74767 var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
74768 function setEnabledState() {
74769 button.classed("disabled", isDisabled());
74770 if (!button.select(".tooltip.in").empty()) {
74771 button.call(tooltipBehavior.updateContent);
74774 context.on("enter.uiZoomToSelection", setEnabledState);
74779 // modules/ui/pane.js
74780 function uiPane(id2, context) {
74783 var _description = "";
74784 var _iconName = "";
74786 var _paneSelection = select_default2(null);
74791 pane.label = function(val) {
74792 if (!arguments.length)
74797 pane.key = function(val) {
74798 if (!arguments.length)
74803 pane.description = function(val) {
74804 if (!arguments.length)
74805 return _description;
74806 _description = val;
74809 pane.iconName = function(val) {
74810 if (!arguments.length)
74815 pane.sections = function(val) {
74816 if (!arguments.length)
74821 pane.selection = function() {
74822 return _paneSelection;
74824 function hidePane() {
74825 context.ui().togglePanes();
74827 pane.togglePane = function(d3_event) {
74829 d3_event.preventDefault();
74830 _paneTooltip.hide();
74831 context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
74833 pane.renderToggleButton = function(selection2) {
74834 if (!_paneTooltip) {
74835 _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
74837 selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
74839 pane.renderContent = function(selection2) {
74841 _sections.forEach(function(section) {
74842 selection2.call(section.render);
74846 pane.renderPane = function(selection2) {
74847 _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
74848 var heading2 = _paneSelection.append("div").attr("class", "pane-heading");
74849 heading2.append("h2").text("").call(_label);
74850 heading2.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
74851 _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
74853 context.keybinding().on(_key, pane.togglePane);
74859 // modules/ui/sections/background_display_options.js
74860 function uiSectionBackgroundDisplayOptions(context) {
74861 var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
74862 var _storedOpacity = corePreferences("background-opacity");
74865 var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
74867 brightness: _storedOpacity !== null ? +_storedOpacity : 1,
74872 function clamp3(x2, min3, max3) {
74873 return Math.max(min3, Math.min(x2, max3));
74875 function updateValue(d2, val) {
74876 val = clamp3(val, _minVal, _maxVal);
74877 _options[d2] = val;
74878 context.background()[d2](val);
74879 if (d2 === "brightness") {
74880 corePreferences("background-opacity", val);
74882 section.reRender();
74884 function renderDisclosureContent(selection2) {
74885 var container = selection2.selectAll(".display-options-container").data([0]);
74886 var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
74887 var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
74888 return "display-control display-control-" + d2;
74890 slidersEnter.html(function(d2) {
74891 return _t.html("background." + d2);
74892 }).append("span").attr("class", function(d2) {
74893 return "display-option-value display-option-value-" + d2;
74895 var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
74896 sildersControlEnter.append("input").attr("class", function(d2) {
74897 return "display-option-input display-option-input-" + d2;
74898 }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
74899 var val = select_default2(this).property("value");
74900 if (!val && d3_event && d3_event.target) {
74901 val = d3_event.target.value;
74903 updateValue(d2, val);
74905 sildersControlEnter.append("button").attr("title", function(d2) {
74906 return "".concat(_t("background.reset"), " ").concat(_t("background." + d2));
74907 }).attr("class", function(d2) {
74908 return "display-option-reset display-option-reset-" + d2;
74909 }).on("click", function(d3_event, d2) {
74910 if (d3_event.button !== 0)
74912 updateValue(d2, 1);
74913 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
74914 containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
74915 d3_event.preventDefault();
74916 for (var i3 = 0; i3 < _sliders.length; i3++) {
74917 updateValue(_sliders[i3], 1);
74920 container = containerEnter.merge(container);
74921 container.selectAll(".display-option-input").property("value", function(d2) {
74922 return _options[d2];
74924 container.selectAll(".display-option-value").text(function(d2) {
74925 return Math.floor(_options[d2] * 100) + "%";
74927 container.selectAll(".display-option-reset").classed("disabled", function(d2) {
74928 return _options[d2] === 1;
74930 if (containerEnter.size() && _options.brightness !== 1) {
74931 context.background().brightness(_options.brightness);
74937 // modules/ui/settings/custom_background.js
74938 function uiSettingsCustomBackground() {
74939 var dispatch14 = dispatch_default("change");
74940 function render(selection2) {
74941 var _origSettings = {
74942 template: corePreferences("background-custom-template")
74944 var _currSettings = {
74945 template: corePreferences("background-custom-template")
74947 var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
74948 var modal = uiConfirm(selection2).okButton();
74949 modal.classed("settings-modal settings-custom-background", true);
74950 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
74951 var textSection = modal.select(".modal-section.message-text");
74952 var instructions = "".concat(_t.html("settings.custom_background.instructions.info"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.wms.tokens_label"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.proj"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.wkid"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.dimensions"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.wms.tokens.bbox"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.tms.tokens_label"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.xyz"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.flipped_y"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.switch"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.quadtile"), "\n") + "* ".concat(_t.html("settings.custom_background.instructions.tms.tokens.scale_factor"), "\n") + "\n" + "#### ".concat(_t.html("settings.custom_background.instructions.example"), "\n") + "`".concat(example, "`");
74953 textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
74954 textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
74955 var buttonSection = modal.select(".modal-section.buttons");
74956 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
74957 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
74958 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
74959 function isSaveDisabled() {
74962 function clickCancel() {
74963 textSection.select(".field-template").property("value", _origSettings.template);
74964 corePreferences("background-custom-template", _origSettings.template);
74968 function clickSave() {
74969 _currSettings.template = textSection.select(".field-template").property("value");
74970 corePreferences("background-custom-template", _currSettings.template);
74973 dispatch14.call("change", this, _currSettings);
74976 return utilRebind(render, dispatch14, "on");
74979 // modules/ui/sections/background_list.js
74980 function uiSectionBackgroundList(context) {
74981 var _backgroundList = select_default2(null);
74982 var _customSource = context.background().findSource("custom");
74983 var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
74984 var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
74985 function previousBackgroundID() {
74986 return corePreferences("background-last-used-toggle");
74988 function renderDisclosureContent(selection2) {
74989 var container = selection2.selectAll(".layer-background-list").data([0]);
74990 _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
74991 var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
74992 var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
74993 uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
74995 minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
74996 d3_event.preventDefault();
74997 uiMapInMap.toggle();
74999 minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
75000 var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
75001 uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
75003 panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
75004 d3_event.preventDefault();
75005 context.ui().info.toggle("background");
75007 panelLabelEnter.append("span").call(_t.append("background.panel.description"));
75008 var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
75009 uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
75011 locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
75012 d3_event.preventDefault();
75013 context.ui().info.toggle("location");
75015 locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
75016 selection2.selectAll(".imagery-faq").data([0]).enter().append("div").attr("class", "imagery-faq").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/openstreetmap/iD/blob/develop/FAQ.md#how-can-i-report-an-issue-with-background-imagery").append("span").call(_t.append("background.imagery_problem_faq"));
75017 _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
75018 chooseBackground(d2);
75020 return !d2.isHidden() && !d2.overlay;
75023 function setTooltips(selection2) {
75024 selection2.each(function(d2, i3, nodes) {
75025 var item = select_default2(this).select("label");
75026 var span = item.select("span");
75027 var placement = i3 < nodes.length / 2 ? "bottom" : "top";
75028 var hasDescription = d2.hasDescription();
75029 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
75030 item.call(uiTooltip().destroyAny);
75031 if (d2.id === previousBackgroundID()) {
75033 uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
75035 } else if (hasDescription || isOverflowing) {
75037 uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
75042 function drawListItems(layerList, type2, change, filter2) {
75043 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
75044 return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
75046 var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
75047 return d2.id + "---" + i3;
75049 layerLinks.exit().remove();
75050 var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
75051 return d2.id === "custom";
75052 }).classed("best", function(d2) {
75055 var label = enter.append("label");
75056 label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
75058 }).on("change", change);
75059 label.append("span").each(function(d2) {
75060 d2.label()(select_default2(this));
75062 enter.filter(function(d2) {
75063 return d2.id === "custom";
75064 }).append("button").attr("class", "layer-browse").call(
75065 uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
75066 ).on("click", function(d3_event) {
75067 d3_event.preventDefault();
75069 }).call(svgIcon("#iD-icon-more"));
75070 enter.filter(function(d2) {
75072 }).append("div").attr("class", "best").call(
75073 uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
75074 ).append("span").text("\u2605");
75075 layerList.call(updateLayerSelections);
75077 function updateLayerSelections(selection2) {
75078 function active(d2) {
75079 return context.background().showsLayer(d2);
75081 selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
75082 return d2.id === previousBackgroundID();
75083 }).call(setTooltips).selectAll("input").property("checked", active);
75085 function chooseBackground(d2) {
75086 if (d2.id === "custom" && !d2.template()) {
75087 return editCustom();
75089 var previousBackground = context.background().baseLayerSource();
75090 corePreferences("background-last-used-toggle", previousBackground.id);
75091 corePreferences("background-last-used", d2.id);
75092 context.background().baseLayerSource(d2);
75094 function customChanged(d2) {
75095 if (d2 && d2.template) {
75096 _customSource.template(d2.template);
75097 chooseBackground(_customSource);
75099 _customSource.template("");
75100 chooseBackground(context.background().findSource("none"));
75103 function editCustom() {
75104 context.container().call(_settingsCustomBackground);
75106 context.background().on("change.background_list", function() {
75107 _backgroundList.call(updateLayerSelections);
75110 "move.background_list",
75111 debounce_default(function() {
75112 window.requestIdleCallback(section.reRender);
75118 // modules/ui/sections/background_offset.js
75119 function uiSectionBackgroundOffset(context) {
75120 var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
75121 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
75122 var _directions = [
75123 ["top", [0, -0.5]],
75124 ["left", [-0.5, 0]],
75125 ["right", [0.5, 0]],
75126 ["bottom", [0, 0.5]]
75128 function updateValue() {
75129 var meters = geoOffsetToMeters(context.background().offset());
75130 var x2 = +meters[0].toFixed(2);
75131 var y2 = +meters[1].toFixed(2);
75132 context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
75133 context.container().selectAll(".nudge-reset").classed("disabled", function() {
75134 return x2 === 0 && y2 === 0;
75137 function resetOffset() {
75138 context.background().offset([0, 0]);
75141 function nudge(d2) {
75142 context.background().nudge(d2, context.map().zoom());
75145 function inputOffset() {
75146 var input = select_default2(this);
75147 var d2 = input.node().value;
75149 return resetOffset();
75150 d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
75151 return !isNaN(n3) && n3;
75153 if (d2.length !== 2 || !d2[0] || !d2[1]) {
75154 input.classed("error", true);
75157 context.background().offset(geoMetersToOffset(d2));
75160 function dragOffset(d3_event) {
75161 if (d3_event.button !== 0)
75163 var origin = [d3_event.clientX, d3_event.clientY];
75164 var pointerId = d3_event.pointerId || "mouse";
75165 context.container().append("div").attr("class", "nudge-surface");
75166 select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
75167 if (_pointerPrefix === "pointer") {
75168 select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
75170 function pointermove(d3_event2) {
75171 if (pointerId !== (d3_event2.pointerId || "mouse"))
75173 var latest = [d3_event2.clientX, d3_event2.clientY];
75175 -(origin[0] - latest[0]) / 4,
75176 -(origin[1] - latest[1]) / 4
75181 function pointerup(d3_event2) {
75182 if (pointerId !== (d3_event2.pointerId || "mouse"))
75184 if (d3_event2.button !== 0)
75186 context.container().selectAll(".nudge-surface").remove();
75187 select_default2(window).on(".drag-bg-offset", null);
75190 function renderDisclosureContent(selection2) {
75191 var container = selection2.selectAll(".nudge-container").data([0]);
75192 var containerEnter = container.enter().append("div").attr("class", "nudge-container");
75193 containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
75194 var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
75195 var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
75196 nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
75197 nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
75198 return _t("background.nudge.".concat(d2[0]));
75199 }).attr("class", function(d2) {
75200 return d2[0] + " nudge";
75201 }).on("click", function(d3_event, d2) {
75204 nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
75205 d3_event.preventDefault();
75207 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
75210 context.background().on("change.backgroundOffset-update", updateValue);
75214 // modules/ui/sections/overlay_list.js
75215 function uiSectionOverlayList(context) {
75216 var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
75217 var _overlayList = select_default2(null);
75218 function setTooltips(selection2) {
75219 selection2.each(function(d2, i3, nodes) {
75220 var item = select_default2(this).select("label");
75221 var span = item.select("span");
75222 var placement = i3 < nodes.length / 2 ? "bottom" : "top";
75223 var description = d2.description();
75224 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
75225 item.call(uiTooltip().destroyAny);
75226 if (description || isOverflowing) {
75228 uiTooltip().placement(placement).title(() => description || d2.name())
75233 function updateLayerSelections(selection2) {
75234 function active(d2) {
75235 return context.background().showsLayer(d2);
75237 selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
75239 function chooseOverlay(d3_event, d2) {
75240 d3_event.preventDefault();
75241 context.background().toggleOverlayLayer(d2);
75242 _overlayList.call(updateLayerSelections);
75243 document.activeElement.blur();
75245 function drawListItems(layerList, type2, change, filter2) {
75246 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
75247 var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
75250 layerLinks.exit().remove();
75251 var enter = layerLinks.enter().append("li");
75252 var label = enter.append("label");
75253 label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
75254 label.append("span").each(function(d2) {
75255 d2.label()(select_default2(this));
75257 layerList.selectAll("li").sort(sortSources);
75258 layerList.call(updateLayerSelections);
75259 function sortSources(a2, b2) {
75260 return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
75263 function renderDisclosureContent(selection2) {
75264 var container = selection2.selectAll(".layer-overlay-list").data([0]);
75265 _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
75266 _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
75267 return !d2.isHidden() && d2.overlay;
75271 "move.overlay_list",
75272 debounce_default(function() {
75273 window.requestIdleCallback(section.reRender);
75279 // modules/ui/panes/background.js
75280 function uiPaneBackground(context) {
75281 var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
75282 uiSectionBackgroundList(context),
75283 uiSectionOverlayList(context),
75284 uiSectionBackgroundDisplayOptions(context),
75285 uiSectionBackgroundOffset(context)
75287 return backgroundPane;
75290 // modules/ui/panes/help.js
75291 function uiPaneHelp(context) {
75301 "open_source_attribution",
75314 "select_left_click",
75315 "select_right_click",
75319 "multiselect_shift_click",
75320 "multiselect_lasso",
75333 ["feature_editor", [
75340 "fields_all_fields",
75342 "fields_add_field",
75351 "add_point_finish",
75356 "delete_point_command"
75363 "add_line_continue",
75366 "modify_line_dragnode",
75367 "modify_line_addnode",
75370 "connect_line_display",
75371 "connect_line_drag",
75372 "connect_line_tag",
75373 "disconnect_line_h",
75374 "disconnect_line_command",
75376 "move_line_command",
75377 "move_line_connected",
75380 "delete_line_command"
75387 "add_area_command",
75389 "add_area_continue",
75392 "square_area_command",
75394 "modify_area_dragnode",
75395 "modify_area_addnode",
75398 "delete_area_command"
75404 "edit_relation_add",
75405 "edit_relation_delete",
75406 "maintain_relation_h",
75407 "maintain_relation",
75408 "relation_types_h",
75411 "multipolygon_create",
75412 "multipolygon_merge",
75413 "turn_restriction_h",
75414 "turn_restriction",
75415 "turn_restriction_field",
75416 "turn_restriction_editing",
75487 "help.help.open_data_h": 3,
75488 "help.help.before_start_h": 3,
75489 "help.help.open_source_h": 3,
75490 "help.overview.navigation_h": 3,
75491 "help.overview.features_h": 3,
75492 "help.editing.select_h": 3,
75493 "help.editing.multiselect_h": 3,
75494 "help.editing.undo_redo_h": 3,
75495 "help.editing.save_h": 3,
75496 "help.editing.upload_h": 3,
75497 "help.editing.backups_h": 3,
75498 "help.editing.keyboard_h": 3,
75499 "help.feature_editor.type_h": 3,
75500 "help.feature_editor.fields_h": 3,
75501 "help.feature_editor.tags_h": 3,
75502 "help.points.add_point_h": 3,
75503 "help.points.move_point_h": 3,
75504 "help.points.delete_point_h": 3,
75505 "help.lines.add_line_h": 3,
75506 "help.lines.modify_line_h": 3,
75507 "help.lines.connect_line_h": 3,
75508 "help.lines.disconnect_line_h": 3,
75509 "help.lines.move_line_h": 3,
75510 "help.lines.delete_line_h": 3,
75511 "help.areas.point_or_area_h": 3,
75512 "help.areas.add_area_h": 3,
75513 "help.areas.square_area_h": 3,
75514 "help.areas.modify_area_h": 3,
75515 "help.areas.delete_area_h": 3,
75516 "help.relations.edit_relation_h": 3,
75517 "help.relations.maintain_relation_h": 3,
75518 "help.relations.relation_types_h": 2,
75519 "help.relations.multipolygon_h": 3,
75520 "help.relations.turn_restriction_h": 3,
75521 "help.relations.route_h": 3,
75522 "help.relations.boundary_h": 3,
75523 "help.notes.add_note_h": 3,
75524 "help.notes.update_note_h": 3,
75525 "help.notes.save_note_h": 3,
75526 "help.imagery.sources_h": 3,
75527 "help.imagery.offsets_h": 3,
75528 "help.streetlevel.using_h": 3,
75529 "help.gps.using_h": 3,
75530 "help.qa.tools_h": 3,
75531 "help.qa.issues_h": 3
75533 var docs = docKeys.map(function(key) {
75534 var helpkey = "help." + key[0];
75535 var helpPaneReplacements = { version: context.version };
75536 var text = key[1].reduce(function(all, part) {
75537 var subkey = helpkey + "." + part;
75538 var depth = headings[subkey];
75539 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
75540 return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
75543 title: _t.html(helpkey + ".title"),
75544 content: marked(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
75547 var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
75548 helpPane.renderContent = function(content) {
75549 function clickHelp(d2, i3) {
75550 var rtl = _mainLocalizer.textDirection() === "rtl";
75551 content.property("scrollTop", 0);
75552 helpPane.selection().select(".pane-heading h2").html(d2.title);
75553 body.html(d2.content);
75554 body.selectAll("a").attr("target", "_blank");
75555 menuItems.classed("selected", function(m2) {
75556 return m2.title === d2.title;
75560 nav.call(drawNext).call(drawPrevious);
75562 nav.call(drawPrevious).call(drawNext);
75564 function drawNext(selection2) {
75565 if (i3 < docs.length - 1) {
75566 var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
75567 d3_event.preventDefault();
75568 clickHelp(docs[i3 + 1], i3 + 1);
75570 nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
75573 function drawPrevious(selection2) {
75575 var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
75576 d3_event.preventDefault();
75577 clickHelp(docs[i3 - 1], i3 - 1);
75579 prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
75583 function clickWalkthrough(d3_event) {
75584 d3_event.preventDefault();
75585 if (context.inIntro())
75587 context.container().call(uiIntro(context));
75588 context.ui().togglePanes();
75590 function clickShortcuts(d3_event) {
75591 d3_event.preventDefault();
75592 context.container().call(context.ui().shortcuts, true);
75594 var toc = content.append("ul").attr("class", "toc");
75595 var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
75597 }).on("click", function(d3_event, d2) {
75598 d3_event.preventDefault();
75599 clickHelp(d2, docs.indexOf(d2));
75601 var shortcuts = toc.append("li").attr("class", "shortcuts").call(
75602 uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
75603 ).append("a").attr("href", "#").on("click", clickShortcuts);
75604 shortcuts.append("div").call(_t.append("shortcuts.title"));
75605 var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
75606 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
75607 walkthrough.append("div").call(_t.append("splash.walkthrough"));
75608 var helpContent = content.append("div").attr("class", "left-content");
75609 var body = helpContent.append("div").attr("class", "body");
75610 var nav = helpContent.append("div").attr("class", "nav");
75611 clickHelp(docs[0], 0);
75616 // modules/ui/sections/validation_issues.js
75617 function uiSectionValidationIssues(id2, severity, context) {
75619 var section = uiSection(id2, context).label(function() {
75622 var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
75623 return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
75624 }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
75625 return _issues && _issues.length;
75627 function getOptions() {
75629 what: corePreferences("validate-what") || "edited",
75630 where: corePreferences("validate-where") || "all"
75633 function reloadIssues() {
75634 _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
75636 function renderDisclosureContent(selection2) {
75637 var center = context.map().center();
75638 var graph = context.graph();
75639 var issues = _issues.map(function withDistance(issue) {
75640 var extent = issue.extent(graph);
75641 var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
75642 return Object.assign(issue, { dist });
75643 }).sort(function byDistance(a2, b2) {
75644 return a2.dist - b2.dist;
75646 issues = issues.slice(0, 1e3);
75647 selection2.call(drawIssuesList, issues);
75649 function drawIssuesList(selection2, issues) {
75650 var list2 = selection2.selectAll(".issues-list").data([0]);
75651 list2 = list2.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list2);
75652 var items = list2.selectAll("li").data(issues, function(d2) {
75655 items.exit().remove();
75656 var itemsEnter = items.enter().append("li").attr("class", function(d2) {
75657 return "issue severity-" + d2.severity;
75659 var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
75660 context.validator().focusIssue(d2);
75661 }).on("mouseover", function(d3_event, d2) {
75662 utilHighlightEntities(d2.entityIds, true, context);
75663 }).on("mouseout", function(d3_event, d2) {
75664 utilHighlightEntities(d2.entityIds, false, context);
75666 var textEnter = labelsEnter.append("span").attr("class", "issue-text");
75667 textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
75668 var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
75669 select_default2(this).call(svgIcon(iconName));
75671 textEnter.append("span").attr("class", "issue-message");
75672 items = items.merge(itemsEnter).order();
75673 items.selectAll(".issue-message").text("").each(function(d2) {
75674 return d2.message(context)(select_default2(this));
75677 context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
75678 window.requestIdleCallback(function() {
75680 section.reRender();
75684 "move.uiSectionValidationIssues" + id2,
75685 debounce_default(function() {
75686 window.requestIdleCallback(function() {
75687 if (getOptions().where === "visible") {
75690 section.reRender();
75697 // modules/ui/sections/validation_options.js
75698 function uiSectionValidationOptions(context) {
75699 var section = uiSection("issues-options", context).content(renderContent);
75700 function renderContent(selection2) {
75701 var container = selection2.selectAll(".issues-options-container").data([0]);
75702 container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
75704 { key: "what", values: ["edited", "all"] },
75705 { key: "where", values: ["visible", "all"] }
75707 var options2 = container.selectAll(".issues-option").data(data, function(d2) {
75710 var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
75711 return "issues-option issues-option-" + d2.key;
75713 optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
75714 return _t.html("issues.options." + d2.key + ".title");
75716 var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
75717 return d2.values.map(function(val) {
75718 return { value: val, key: d2.key };
75720 }).enter().append("label");
75721 valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
75722 return "issues-option-" + d2.key;
75723 }).attr("value", function(d2) {
75725 }).property("checked", function(d2) {
75726 return getOptions()[d2.key] === d2.value;
75727 }).on("change", function(d3_event, d2) {
75728 updateOptionValue(d3_event, d2.key, d2.value);
75730 valuesEnter.append("span").html(function(d2) {
75731 return _t.html("issues.options." + d2.key + "." + d2.value);
75734 function getOptions() {
75736 what: corePreferences("validate-what") || "edited",
75738 where: corePreferences("validate-where") || "all"
75739 // 'all', 'visible'
75742 function updateOptionValue(d3_event, d2, val) {
75743 if (!val && d3_event && d3_event.target) {
75744 val = d3_event.target.value;
75746 corePreferences("validate-" + d2, val);
75747 context.validator().validate();
75752 // modules/ui/sections/validation_rules.js
75753 function uiSectionValidationRules(context) {
75755 var MAXSQUARE = 20;
75756 var DEFAULTSQUARE = 5;
75757 var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
75758 var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
75759 return key !== "maprules";
75760 }).sort(function(key1, key2) {
75761 return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
75763 function renderDisclosureContent(selection2) {
75764 var container = selection2.selectAll(".issues-rulelist-container").data([0]);
75765 var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
75766 containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
75767 var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
75768 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
75769 d3_event.preventDefault();
75770 context.validator().disableRules(_ruleKeys);
75772 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
75773 d3_event.preventDefault();
75774 context.validator().disableRules([]);
75776 container = container.merge(containerEnter);
75777 container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
75779 function drawListItems(selection2, data, type2, name, change, active) {
75780 var items = selection2.selectAll("li").data(data);
75781 items.exit().remove();
75782 var enter = items.enter().append("li");
75783 if (name === "rule") {
75785 uiTooltip().title(function(d2) {
75786 return _t.append("issues." + d2 + ".tip");
75787 }).placement("top")
75790 var label = enter.append("label");
75791 label.append("input").attr("type", type2).attr("name", name).on("change", change);
75792 label.append("span").html(function(d2) {
75794 if (d2 === "unsquare_way") {
75795 params.val = { html: '<span class="square-degrees"></span>' };
75797 return _t.html("issues." + d2 + ".title", params);
75799 items = items.merge(enter);
75800 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
75801 var degStr = corePreferences("validate-square-degrees");
75802 if (degStr === null) {
75803 degStr = DEFAULTSQUARE.toString();
75805 var span = items.selectAll(".square-degrees");
75806 var input = span.selectAll(".square-degrees-input").data([0]);
75807 input.enter().append("input").attr("type", "number").attr("min", MINSQUARE.toString()).attr("max", MAXSQUARE.toString()).attr("step", "0.5").attr("class", "square-degrees-input").call(utilNoAuto).on("click", function(d3_event) {
75808 d3_event.preventDefault();
75809 d3_event.stopPropagation();
75811 }).on("keyup", function(d3_event) {
75812 if (d3_event.keyCode === 13) {
75816 }).on("blur", changeSquare).merge(input).property("value", degStr);
75818 function changeSquare() {
75819 var input = select_default2(this);
75820 var degStr = utilGetSetValue(input).trim();
75821 var degNum = Number(degStr);
75822 if (!isFinite(degNum)) {
75823 degNum = DEFAULTSQUARE;
75824 } else if (degNum > MAXSQUARE) {
75825 degNum = MAXSQUARE;
75826 } else if (degNum < MINSQUARE) {
75827 degNum = MINSQUARE;
75829 degNum = Math.round(degNum * 10) / 10;
75830 degStr = degNum.toString();
75831 input.property("value", degStr);
75832 corePreferences("validate-square-degrees", degStr);
75833 context.validator().revalidateUnsquare();
75835 function isRuleEnabled(d2) {
75836 return context.validator().isRuleEnabled(d2);
75838 function toggleRule(d3_event, d2) {
75839 context.validator().toggleRule(d2);
75841 context.validator().on("validated.uiSectionValidationRules", function() {
75842 window.requestIdleCallback(section.reRender);
75847 // modules/ui/sections/validation_status.js
75848 function uiSectionValidationStatus(context) {
75849 var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
75850 var issues = context.validator().getIssues(getOptions());
75851 return issues.length === 0;
75853 function getOptions() {
75855 what: corePreferences("validate-what") || "edited",
75856 where: corePreferences("validate-where") || "all"
75859 function renderContent(selection2) {
75860 var box = selection2.selectAll(".box").data([0]);
75861 var boxEnter = box.enter().append("div").attr("class", "box");
75862 boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
75863 var noIssuesMessage = boxEnter.append("span");
75864 noIssuesMessage.append("strong").attr("class", "message");
75865 noIssuesMessage.append("br");
75866 noIssuesMessage.append("span").attr("class", "details");
75867 renderIgnoredIssuesReset(selection2);
75868 setNoIssuesText(selection2);
75870 function renderIgnoredIssuesReset(selection2) {
75871 var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
75872 var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
75873 resetIgnored.exit().remove();
75874 var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
75875 resetIgnoredEnter.append("a").attr("href", "#");
75876 resetIgnored = resetIgnored.merge(resetIgnoredEnter);
75877 resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
75878 resetIgnored.on("click", function(d3_event) {
75879 d3_event.preventDefault();
75880 context.validator().resetIgnoredIssues();
75883 function setNoIssuesText(selection2) {
75884 var opts = getOptions();
75885 function checkForHiddenIssues(cases) {
75886 for (var type2 in cases) {
75887 var hiddenOpts = cases[type2];
75888 var hiddenIssues = context.validator().getIssues(hiddenOpts);
75889 if (hiddenIssues.length) {
75890 selection2.select(".box .details").html("").call(_t.append(
75891 "issues.no_issues.hidden_issues." + type2,
75892 { count: hiddenIssues.length.toString() }
75897 selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
75900 if (opts.what === "edited" && opts.where === "visible") {
75901 messageType = "edits_in_view";
75902 checkForHiddenIssues({
75903 elsewhere: { what: "edited", where: "all" },
75904 everything_else: { what: "all", where: "visible" },
75905 disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
75906 everything_else_elsewhere: { what: "all", where: "all" },
75907 disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
75908 ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
75909 ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
75911 } else if (opts.what === "edited" && opts.where === "all") {
75912 messageType = "edits";
75913 checkForHiddenIssues({
75914 everything_else: { what: "all", where: "all" },
75915 disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
75916 ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
75918 } else if (opts.what === "all" && opts.where === "visible") {
75919 messageType = "everything_in_view";
75920 checkForHiddenIssues({
75921 elsewhere: { what: "all", where: "all" },
75922 disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
75923 disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
75924 ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
75925 ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
75927 } else if (opts.what === "all" && opts.where === "all") {
75928 messageType = "everything";
75929 checkForHiddenIssues({
75930 disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
75931 ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
75934 if (opts.what === "edited" && context.history().difference().summary().length === 0) {
75935 messageType = "no_edits";
75937 selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
75939 context.validator().on("validated.uiSectionValidationStatus", function() {
75940 window.requestIdleCallback(section.reRender);
75943 "move.uiSectionValidationStatus",
75944 debounce_default(function() {
75945 window.requestIdleCallback(section.reRender);
75951 // modules/ui/panes/issues.js
75952 function uiPaneIssues(context) {
75953 var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
75954 uiSectionValidationOptions(context),
75955 uiSectionValidationStatus(context),
75956 uiSectionValidationIssues("issues-errors", "error", context),
75957 uiSectionValidationIssues("issues-warnings", "warning", context),
75958 uiSectionValidationRules(context)
75963 // modules/ui/settings/custom_data.js
75964 function uiSettingsCustomData(context) {
75965 var dispatch14 = dispatch_default("change");
75966 function render(selection2) {
75967 var dataLayer = context.layers().layer("data");
75968 var _origSettings = {
75969 fileList: dataLayer && dataLayer.fileList() || null,
75970 url: corePreferences("settings-custom-data-url")
75972 var _currSettings = {
75973 fileList: dataLayer && dataLayer.fileList() || null
75974 // url: prefs('settings-custom-data-url')
75976 var modal = uiConfirm(selection2).okButton();
75977 modal.classed("settings-modal settings-custom-data", true);
75978 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
75979 var textSection = modal.select(".modal-section.message-text");
75980 textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
75981 textSection.append("input").attr("class", "field-file").attr("type", "file").attr("accept", ".gpx,.kml,.geojson,.json,application/gpx+xml,application/vnd.google-earth.kml+xml,application/geo+json,application/json").property("files", _currSettings.fileList).on("change", function(d3_event) {
75982 var files = d3_event.target.files;
75983 if (files && files.length) {
75984 _currSettings.url = "";
75985 textSection.select(".field-url").property("value", "");
75986 _currSettings.fileList = files;
75988 _currSettings.fileList = null;
75991 textSection.append("h4").call(_t.append("settings.custom_data.or"));
75992 textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
75993 textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
75994 var buttonSection = modal.select(".modal-section.buttons");
75995 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
75996 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
75997 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
75998 function isSaveDisabled() {
76001 function clickCancel() {
76002 textSection.select(".field-url").property("value", _origSettings.url);
76003 corePreferences("settings-custom-data-url", _origSettings.url);
76007 function clickSave() {
76008 _currSettings.url = textSection.select(".field-url").property("value").trim();
76009 if (_currSettings.url) {
76010 _currSettings.fileList = null;
76012 if (_currSettings.fileList) {
76013 _currSettings.url = "";
76015 corePreferences("settings-custom-data-url", _currSettings.url);
76018 dispatch14.call("change", this, _currSettings);
76021 return utilRebind(render, dispatch14, "on");
76024 // modules/ui/sections/data_layers.js
76025 function uiSectionDataLayers(context) {
76026 var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
76027 var layers = context.layers();
76028 var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
76029 function renderDisclosureContent(selection2) {
76030 var container = selection2.selectAll(".data-layer-container").data([0]);
76031 container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
76033 function showsLayer(which) {
76034 var layer = layers.layer(which);
76036 return layer.enabled();
76040 function setLayer(which, enabled) {
76041 var mode = context.mode();
76042 if (mode && /^draw/.test(mode.id))
76044 var layer = layers.layer(which);
76046 layer.enabled(enabled);
76047 if (!enabled && (which === "osm" || which === "notes")) {
76048 context.enter(modeBrowse(context));
76052 function toggleLayer(which) {
76053 setLayer(which, !showsLayer(which));
76055 function drawOsmItems(selection2) {
76056 var osmKeys = ["osm", "notes"];
76057 var osmLayers = layers.all().filter(function(obj) {
76058 return osmKeys.indexOf(obj.id) !== -1;
76060 var ul = selection2.selectAll(".layer-list-osm").data([0]);
76061 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
76062 var li = ul.selectAll(".list-item").data(osmLayers);
76063 li.exit().remove();
76064 var liEnter = li.enter().append("li").attr("class", function(d2) {
76065 return "list-item list-item-" + d2.id;
76067 var labelEnter = liEnter.append("label").each(function(d2) {
76068 if (d2.id === "osm") {
76069 select_default2(this).call(
76070 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
76073 select_default2(this).call(
76074 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
76078 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
76079 toggleLayer(d2.id);
76081 labelEnter.append("span").html(function(d2) {
76082 return _t.html("map_data.layers." + d2.id + ".title");
76084 li.merge(liEnter).classed("active", function(d2) {
76085 return d2.layer.enabled();
76086 }).selectAll("input").property("checked", function(d2) {
76087 return d2.layer.enabled();
76090 function drawQAItems(selection2) {
76091 var qaKeys = ["keepRight", "improveOSM", "osmose"];
76092 var qaLayers = layers.all().filter(function(obj) {
76093 return qaKeys.indexOf(obj.id) !== -1;
76095 var ul = selection2.selectAll(".layer-list-qa").data([0]);
76096 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
76097 var li = ul.selectAll(".list-item").data(qaLayers);
76098 li.exit().remove();
76099 var liEnter = li.enter().append("li").attr("class", function(d2) {
76100 return "list-item list-item-" + d2.id;
76102 var labelEnter = liEnter.append("label").each(function(d2) {
76103 select_default2(this).call(
76104 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
76107 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
76108 toggleLayer(d2.id);
76110 labelEnter.append("span").each(function(d2) {
76111 _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
76113 li.merge(liEnter).classed("active", function(d2) {
76114 return d2.layer.enabled();
76115 }).selectAll("input").property("checked", function(d2) {
76116 return d2.layer.enabled();
76119 function drawVectorItems(selection2) {
76120 var dataLayer = layers.layer("data");
76123 name: "Detroit Neighborhoods/Parks",
76124 src: "neighborhoods-parks",
76125 tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
76126 template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmur6x34562qp9iv1u3ksf-54hev,jonahadkins.cjksmqxdx33jj2wp90xd9x2md-4e5y2/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
76129 name: "Detroit Composite POIs",
76130 src: "composite-poi",
76131 tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
76132 template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmm6a02sli31myxhsr7zf3-2sw8h/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
76135 name: "Detroit All-The-Places POIs",
76136 src: "alltheplaces-poi",
76137 tooltip: "Public domain business location data created by web scrapers.",
76138 template: "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/jonahadkins.cjksmswgk340g2vo06p1w9w0j-8fjjc/{z}/{x}/{y}.vector.pbf?access_token=pk.eyJ1Ijoiam9uYWhhZGtpbnMiLCJhIjoiRlVVVkx3VSJ9.9sdVEK_B_VkEXPjssU5MqA"
76141 var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
76142 var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
76143 var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
76144 container.exit().remove();
76145 var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
76146 containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
76147 containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
76148 containerEnter.append("div").attr("class", "vectortile-footer").append("a").attr("target", "_blank").call(svgIcon("#iD-icon-out-link", "inline")).attr("href", "https://github.com/osmus/detroit-mapping-challenge").append("span").text("About these layers");
76149 container = container.merge(containerEnter);
76150 var ul = container.selectAll(".layer-list-vectortile");
76151 var li = ul.selectAll(".list-item").data(vtData);
76152 li.exit().remove();
76153 var liEnter = li.enter().append("li").attr("class", function(d2) {
76154 return "list-item list-item-" + d2.src;
76156 var labelEnter = liEnter.append("label").each(function(d2) {
76157 select_default2(this).call(
76158 uiTooltip().title(d2.tooltip).placement("top")
76161 labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
76162 labelEnter.append("span").text(function(d2) {
76165 li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
76166 function isVTLayerSelected(d2) {
76167 return dataLayer && dataLayer.template() === d2.template;
76169 function selectVTLayer(d3_event, d2) {
76170 corePreferences("settings-custom-data-url", d2.template);
76172 dataLayer.template(d2.template, d2.src);
76173 dataLayer.enabled(true);
76177 function drawCustomDataItems(selection2) {
76178 var dataLayer = layers.layer("data");
76179 var hasData = dataLayer && dataLayer.hasData();
76180 var showsData = hasData && dataLayer.enabled();
76181 var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
76182 ul.exit().remove();
76183 var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
76184 var liEnter = ulEnter.append("li").attr("class", "list-item-data");
76185 var labelEnter = liEnter.append("label").call(
76186 uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
76188 labelEnter.append("input").attr("type", "checkbox").on("change", function() {
76189 toggleLayer("data");
76191 labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
76192 liEnter.append("button").attr("class", "open-data-options").call(
76193 uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76194 ).on("click", function(d3_event) {
76195 d3_event.preventDefault();
76197 }).call(svgIcon("#iD-icon-more"));
76198 liEnter.append("button").attr("class", "zoom-to-data").call(
76199 uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76200 ).on("click", function(d3_event) {
76201 if (select_default2(this).classed("disabled"))
76203 d3_event.preventDefault();
76204 d3_event.stopPropagation();
76205 dataLayer.fitZoom();
76206 }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
76207 ul = ul.merge(ulEnter);
76208 ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
76209 ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
76211 function editCustom() {
76212 context.container().call(settingsCustomData);
76214 function customChanged(d2) {
76215 var dataLayer = layers.layer("data");
76216 if (d2 && d2.url) {
76217 dataLayer.url(d2.url);
76218 } else if (d2 && d2.fileList) {
76219 dataLayer.fileList(d2.fileList);
76222 function drawPanelItems(selection2) {
76223 var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
76224 var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
76225 uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
76227 historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76228 d3_event.preventDefault();
76229 context.ui().info.toggle("history");
76231 historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
76232 var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
76233 uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
76235 measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
76236 d3_event.preventDefault();
76237 context.ui().info.toggle("measurement");
76239 measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
76241 context.layers().on("change.uiSectionDataLayers", section.reRender);
76243 "move.uiSectionDataLayers",
76244 debounce_default(function() {
76245 window.requestIdleCallback(section.reRender);
76251 // modules/ui/sections/map_features.js
76252 function uiSectionMapFeatures(context) {
76253 var _features = context.features().keys();
76254 var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76255 function renderDisclosureContent(selection2) {
76256 var container = selection2.selectAll(".layer-feature-list-container").data([0]);
76257 var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
76258 containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
76259 var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
76260 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
76261 d3_event.preventDefault();
76262 context.features().disableAll();
76264 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
76265 d3_event.preventDefault();
76266 context.features().enableAll();
76268 container = container.merge(containerEnter);
76269 container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
76271 function drawListItems(selection2, data, type2, name, change, active) {
76272 var items = selection2.selectAll("li").data(data);
76273 items.exit().remove();
76274 var enter = items.enter().append("li").call(
76275 uiTooltip().title(function(d2) {
76276 var tip = _t.append(name + "." + d2 + ".tooltip");
76277 if (autoHiddenFeature(d2)) {
76278 var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
76279 return (selection3) => {
76280 selection3.call(tip);
76281 selection3.append("div").call(msg);
76285 }).placement("top")
76287 var label = enter.append("label");
76288 label.append("input").attr("type", type2).attr("name", name).on("change", change);
76289 label.append("span").html(function(d2) {
76290 return _t.html(name + "." + d2 + ".description");
76292 items = items.merge(enter);
76293 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
76295 function autoHiddenFeature(d2) {
76296 return context.features().autoHidden(d2);
76298 function showsFeature(d2) {
76299 return context.features().enabled(d2);
76301 function clickFeature(d3_event, d2) {
76302 context.features().toggle(d2);
76304 function showsLayer(id2) {
76305 var layer = context.layers().layer(id2);
76306 return layer && layer.enabled();
76308 context.features().on("change.map_features", section.reRender);
76312 // modules/ui/sections/map_style_options.js
76313 function uiSectionMapStyleOptions(context) {
76314 var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76315 function renderDisclosureContent(selection2) {
76316 var container = selection2.selectAll(".layer-fill-list").data([0]);
76317 container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
76318 var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
76319 container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
76320 return context.surface().classed("highlight-edited");
76323 function drawListItems(selection2, data, type2, name, change, active) {
76324 var items = selection2.selectAll("li").data(data);
76325 items.exit().remove();
76326 var enter = items.enter().append("li").call(
76327 uiTooltip().title(function(d2) {
76328 return _t.append(name + "." + d2 + ".tooltip");
76329 }).keys(function(d2) {
76330 var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
76331 if (d2 === "highlight_edits")
76332 key = _t("map_data.highlight_edits.key");
76333 return key ? [key] : null;
76334 }).placement("top")
76336 var label = enter.append("label");
76337 label.append("input").attr("type", type2).attr("name", name).on("change", change);
76338 label.append("span").html(function(d2) {
76339 return _t.html(name + "." + d2 + ".description");
76341 items = items.merge(enter);
76342 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
76344 function isActiveFill(d2) {
76345 return context.map().activeAreaFill() === d2;
76347 function toggleHighlightEdited(d3_event) {
76348 d3_event.preventDefault();
76349 context.map().toggleHighlightEdited();
76351 function setFill(d3_event, d2) {
76352 context.map().activeAreaFill(d2);
76354 context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
76358 // modules/ui/settings/local_photos.js
76359 function uiSettingsLocalPhotos(context) {
76360 var dispatch14 = dispatch_default("change");
76361 var photoLayer = context.layers().layer("local-photos");
76363 function render(selection2) {
76364 modal = uiConfirm(selection2).okButton();
76365 modal.classed("settings-modal settings-local-photos", true);
76366 modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
76367 modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
76368 var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
76369 instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
76370 instructionsSection.append("input").classed("field-file", true).attr("type", "file").attr("multiple", "multiple").attr("accept", ".jpg,.jpeg,.png,image/png,image/jpeg").style("visibility", "hidden").attr("id", "local-photo-files").on("change", function(d3_event) {
76371 var files = d3_event.target.files;
76372 if (files && files.length) {
76373 photoList.select("ul").append("li").classed("placeholder", true).append("div");
76374 dispatch14.call("change", this, files);
76376 d3_event.target.value = null;
76378 instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
76379 const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
76380 photoList.append("ul");
76381 updatePhotoList(photoList.select("ul"));
76382 context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
76384 function updatePhotoList(container) {
76386 function locationUnavailable(d2) {
76387 return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
76389 container.selectAll("li.placeholder").remove();
76390 let selection2 = container.selectAll("li").data((_a2 = photoLayer.getPhotos()) != null ? _a2 : [], (d2) => d2.id);
76391 selection2.exit().remove();
76392 const selectionEnter = selection2.enter().append("li");
76393 selectionEnter.append("span").classed("filename", true);
76394 selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
76395 selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
76396 uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
76398 selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
76399 selection2 = selection2.merge(selectionEnter);
76400 selection2.classed("invalid", locationUnavailable);
76401 selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
76402 selection2.select("span.filename").on("click", (d3_event, d2) => {
76403 photoLayer.openPhoto(d3_event, d2, false);
76405 selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
76406 photoLayer.openPhoto(d3_event, d2, true);
76408 selection2.select("button.remove").on("click", (d3_event, d2) => {
76409 photoLayer.removePhoto(d2.id);
76410 updatePhotoList(container);
76413 return utilRebind(render, dispatch14, "on");
76416 // modules/ui/sections/photo_overlays.js
76417 function uiSectionPhotoOverlays(context) {
76418 var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
76419 var layers = context.layers();
76420 var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
76421 function renderDisclosureContent(selection2) {
76422 var container = selection2.selectAll(".photo-overlay-container").data([0]);
76423 container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
76425 function drawPhotoItems(selection2) {
76426 var photoKeys = context.photos().overlayLayerIDs();
76427 var photoLayers = layers.all().filter(function(obj) {
76428 return photoKeys.indexOf(obj.id) !== -1;
76430 var data = photoLayers.filter(function(obj) {
76431 if (!obj.layer.supported())
76433 if (layerEnabled(obj))
76435 if (typeof obj.layer.validHere === "function") {
76436 return obj.layer.validHere(context.map().extent(), context.map().zoom());
76440 function layerSupported(d2) {
76441 return d2.layer && d2.layer.supported();
76443 function layerEnabled(d2) {
76444 return layerSupported(d2) && d2.layer.enabled();
76446 function layerRendered(d2) {
76448 return (_c = (_b = (_a2 = d2.layer).rendered) == null ? void 0 : _b.call(_a2, context.map().zoom())) != null ? _c : true;
76450 var ul = selection2.selectAll(".layer-list-photos").data([0]);
76451 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
76452 var li = ul.selectAll(".list-item-photos").data(data);
76453 li.exit().remove();
76454 var liEnter = li.enter().append("li").attr("class", function(d2) {
76455 var classes = "list-item-photos list-item-" + d2.id;
76456 if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
76457 classes += " indented";
76461 var labelEnter = liEnter.append("label").each(function(d2) {
76463 if (d2.id === "mapillary-signs")
76464 titleID = "mapillary.signs.tooltip";
76465 else if (d2.id === "mapillary")
76466 titleID = "mapillary_images.tooltip";
76467 else if (d2.id === "kartaview")
76468 titleID = "kartaview_images.tooltip";
76470 titleID = d2.id.replace(/-/g, "_") + ".tooltip";
76471 select_default2(this).call(
76472 uiTooltip().title(() => {
76473 if (!layerRendered(d2)) {
76474 return _t.append("street_side.minzoom_tooltip");
76476 return _t.append(titleID);
76478 }).placement("top")
76481 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
76482 toggleLayer(d2.id);
76484 labelEnter.append("span").html(function(d2) {
76486 if (id2 === "mapillary-signs")
76487 id2 = "photo_overlays.traffic_signs";
76488 return _t.html(id2.replace(/-/g, "_") + ".title");
76490 li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
76492 function drawPhotoTypeItems(selection2) {
76493 var data = context.photos().allPhotoTypes();
76494 function typeEnabled(d2) {
76495 return context.photos().showsPhotoType(d2);
76497 var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
76498 ul.exit().remove();
76499 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
76500 var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
76501 li.exit().remove();
76502 var liEnter = li.enter().append("li").attr("class", function(d2) {
76503 return "list-item-photo-types list-item-" + d2;
76505 var labelEnter = liEnter.append("label").each(function(d2) {
76506 select_default2(this).call(
76507 uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
76510 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
76511 context.photos().togglePhotoType(d2);
76513 labelEnter.append("span").html(function(d2) {
76514 return _t.html("photo_overlays.photo_type." + d2 + ".title");
76516 li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
76518 function drawDateFilter(selection2) {
76519 var data = context.photos().dateFilters();
76520 function filterEnabled(d2) {
76521 return context.photos().dateFilterValue(d2);
76523 var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
76524 ul.exit().remove();
76525 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
76526 var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
76527 li.exit().remove();
76528 var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
76529 var labelEnter = liEnter.append("label").each(function(d2) {
76530 select_default2(this).call(
76531 uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
76534 labelEnter.append("span").each(function(d2) {
76535 _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
76537 labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
76538 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
76539 }).on("change", function(d3_event, d2) {
76540 var value = utilGetSetValue(select_default2(this)).trim();
76541 context.photos().setDateFilter(d2, value, true);
76542 li.selectAll("input").each(function(d4) {
76543 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
76546 li = li.merge(liEnter).classed("active", filterEnabled);
76548 function drawUsernameFilter(selection2) {
76549 function filterEnabled() {
76550 return context.photos().usernames();
76552 var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
76553 ul.exit().remove();
76554 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
76555 var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
76556 li.exit().remove();
76557 var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
76558 var labelEnter = liEnter.append("label").each(function() {
76559 select_default2(this).call(
76560 uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
76563 labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
76564 labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
76565 var value = select_default2(this).property("value");
76566 context.photos().setUsernameFilter(value, true);
76567 select_default2(this).property("value", usernameValue);
76569 li.merge(liEnter).classed("active", filterEnabled);
76570 function usernameValue() {
76571 var usernames = context.photos().usernames();
76573 return usernames.join("; ");
76577 function toggleLayer(which) {
76578 setLayer(which, !showsLayer(which));
76580 function showsLayer(which) {
76581 var layer = layers.layer(which);
76583 return layer.enabled();
76587 function setLayer(which, enabled) {
76588 var layer = layers.layer(which);
76590 layer.enabled(enabled);
76593 function drawLocalPhotos(selection2) {
76594 var photoLayer = layers.layer("local-photos");
76595 var hasData = photoLayer && photoLayer.hasData();
76596 var showsData = hasData && photoLayer.enabled();
76597 var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
76598 ul.exit().remove();
76599 var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
76600 var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
76601 var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
76602 localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
76603 toggleLayer("local-photos");
76605 localPhotosLabelEnter.call(_t.append("local_photos.header"));
76606 localPhotosEnter.append("button").attr("class", "open-data-options").call(
76607 uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76608 ).on("click", function(d3_event) {
76609 d3_event.preventDefault();
76611 }).call(svgIcon("#iD-icon-more"));
76612 localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
76613 uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
76614 ).on("click", function(d3_event) {
76615 if (select_default2(this).classed("disabled"))
76617 d3_event.preventDefault();
76618 d3_event.stopPropagation();
76619 photoLayer.fitZoom();
76620 }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
76621 ul = ul.merge(ulEnter);
76622 ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
76623 ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
76625 function editLocalPhotos() {
76626 context.container().call(settingsLocalPhotos);
76628 function localPhotosChanged(d2) {
76629 var localPhotosLayer = layers.layer("local-photos");
76630 localPhotosLayer.fileList(d2);
76632 context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
76633 context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
76635 "move.photo_overlays",
76636 debounce_default(function() {
76637 window.requestIdleCallback(section.reRender);
76643 // modules/ui/panes/map_data.js
76644 function uiPaneMapData(context) {
76645 var mapDataPane = uiPane("map-data", context).key(_t("map_data.key")).label(_t.append("map_data.title")).description(_t.append("map_data.description")).iconName("iD-icon-data").sections([
76646 uiSectionDataLayers(context),
76647 uiSectionPhotoOverlays(context),
76648 uiSectionMapStyleOptions(context),
76649 uiSectionMapFeatures(context)
76651 return mapDataPane;
76654 // modules/ui/panes/preferences.js
76655 function uiPanePreferences(context) {
76656 let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
76657 uiSectionPrivacy(context)
76659 return preferencesPane;
76662 // modules/ui/init.js
76663 function uiInit(context) {
76664 var _initCounter = 0;
76665 var _needWidth = {};
76666 var _lastPointerType;
76667 function render(container) {
76668 container.on("click.ui", function(d3_event) {
76669 if (d3_event.button !== 0)
76671 if (!d3_event.composedPath)
76673 var isOkayTarget = d3_event.composedPath().some(function(node) {
76674 return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
76675 (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
76676 node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
76677 node.nodeName === "A");
76681 d3_event.preventDefault();
76683 var detected = utilDetect();
76684 if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
76685 // but we only need to do this on desktop Safari anyway. – #7694
76686 !detected.isMobileWebKit) {
76687 container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
76688 d3_event.preventDefault();
76691 if ("PointerEvent" in window) {
76692 select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
76693 var pointerType = d3_event.pointerType || "mouse";
76694 if (_lastPointerType !== pointerType) {
76695 _lastPointerType = pointerType;
76696 container.attr("pointer", pointerType);
76700 _lastPointerType = "mouse";
76701 container.attr("pointer", "mouse");
76703 container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
76704 container.call(uiFullScreen(context));
76705 var map2 = context.map();
76706 map2.redrawEnable(false);
76707 map2.on("hitMinZoom.ui", function() {
76708 ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
76710 container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
76711 container.append("div").attr("class", "sidebar").call(ui.sidebar);
76712 var content = container.append("div").attr("class", "main-content active");
76713 content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
76714 content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
76715 var overMap = content.append("div").attr("class", "over-map");
76716 overMap.append("div").attr("class", "select-trap").text("t");
76717 overMap.call(uiMapInMap(context)).call(uiNotice(context));
76718 overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
76719 var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
76720 var controls = controlsWrap.append("div").attr("class", "map-controls");
76721 controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
76722 controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
76723 controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
76724 controlsWrap.on("wheel.mapControls", function(d3_event) {
76725 if (!d3_event.deltaX) {
76726 controlsWrap.node().scrollTop += d3_event.deltaY;
76729 var panes = overMap.append("div").attr("class", "map-panes");
76731 uiPaneBackground(context),
76732 uiPaneMapData(context),
76733 uiPaneIssues(context),
76734 uiPanePreferences(context),
76735 uiPaneHelp(context)
76737 uiPanes.forEach(function(pane) {
76738 controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
76739 panes.call(pane.renderPane);
76741 ui.info = uiInfo(context);
76742 overMap.call(ui.info);
76743 overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
76744 overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
76745 var about = content.append("div").attr("class", "map-footer");
76746 about.append("div").attr("class", "api-status").call(uiStatus(context));
76747 var footer = about.append("div").attr("class", "map-footer-bar fillD");
76748 footer.append("div").attr("class", "flash-wrap footer-hide");
76749 var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
76750 footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
76751 var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
76752 aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
76753 var apiConnections = context.connection().apiConnections();
76754 if (apiConnections && apiConnections.length > 1) {
76755 aboutList.append("li").attr("class", "source-switch").call(
76756 uiSourceSwitch(context).keys(apiConnections)
76759 aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
76760 aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
76761 var issueLinks = aboutList.append("li");
76762 issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/issues").attr("aria-label", _t("report_a_bug")).call(svgIcon("#iD-icon-bug", "light")).call(uiTooltip().title(() => _t.append("report_a_bug")).placement("top"));
76763 issueLinks.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD/blob/develop/CONTRIBUTING.md#translating").attr("aria-label", _t("help_translate")).call(svgIcon("#iD-icon-translate", "light")).call(uiTooltip().title(() => _t.append("help_translate")).placement("top"));
76764 aboutList.append("li").attr("class", "version").call(uiVersion(context));
76765 if (!context.embed()) {
76766 aboutList.call(uiAccount(context));
76769 map2.redrawEnable(true);
76770 ui.hash = behaviorHash(context);
76772 if (!ui.hash.hadLocation) {
76773 map2.centerZoom([0, 0], 2);
76775 window.onbeforeunload = function() {
76776 return context.save();
76778 window.onunload = function() {
76779 context.history().unlock();
76781 select_default2(window).on("resize.editor", function() {
76784 var panPixels = 80;
76785 context.keybinding().on("\u232B", function(d3_event) {
76786 d3_event.preventDefault();
76787 }).on([_t("sidebar.key"), "`", "\xB2", "@"], ui.sidebar.toggle).on("\u2190", pan([panPixels, 0])).on("\u2191", pan([0, panPixels])).on("\u2192", pan([-panPixels, 0])).on("\u2193", pan([0, -panPixels])).on(uiCmd("\u2325\u2190"), pan([map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2191"), pan([0, map2.dimensions()[1]])).on(uiCmd("\u2325\u2192"), pan([-map2.dimensions()[0], 0])).on(uiCmd("\u2325\u2193"), pan([0, -map2.dimensions()[1]])).on(uiCmd("\u2318" + _t("background.key")), function quickSwitch(d3_event) {
76789 d3_event.stopImmediatePropagation();
76790 d3_event.preventDefault();
76792 var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
76793 if (previousBackground) {
76794 var currentBackground = context.background().baseLayerSource();
76795 corePreferences("background-last-used-toggle", currentBackground.id);
76796 corePreferences("background-last-used", previousBackground.id);
76797 context.background().baseLayerSource(previousBackground);
76799 }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
76800 d3_event.preventDefault();
76801 d3_event.stopPropagation();
76802 context.map().toggleWireframe();
76803 }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
76804 d3_event.preventDefault();
76805 d3_event.stopPropagation();
76806 var mode = context.mode();
76807 if (mode && /^draw/.test(mode.id))
76809 var layer = context.layers().layer("osm");
76811 layer.enabled(!layer.enabled());
76812 if (!layer.enabled()) {
76813 context.enter(modeBrowse(context));
76816 }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
76817 d3_event.preventDefault();
76818 context.map().toggleHighlightEdited();
76820 context.on("enter.editor", function(entered) {
76821 container.classed("mode-" + entered.id, true);
76822 }).on("exit.editor", function(exited) {
76823 container.classed("mode-" + exited.id, false);
76825 context.enter(modeBrowse(context));
76826 if (!_initCounter++) {
76827 if (!ui.hash.startWalkthrough) {
76828 context.container().call(uiSplash(context)).call(uiRestore(context));
76830 context.container().call(ui.shortcuts);
76832 var osm = context.connection();
76833 var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
76835 osm.on("authLoading.ui", function() {
76836 context.container().call(auth);
76837 }).on("authDone.ui", function() {
76842 if (ui.hash.startWalkthrough) {
76843 ui.hash.startWalkthrough = false;
76844 context.container().call(uiIntro(context));
76847 return function(d3_event) {
76848 if (d3_event.shiftKey)
76850 if (context.container().select(".combobox").size())
76852 d3_event.preventDefault();
76853 context.map().pan(d2, 100);
76859 ui.ensureLoaded = () => {
76861 return _loadPromise;
76862 return _loadPromise = Promise.all([
76863 // must have strings and presets before loading the UI
76864 _mainLocalizer.ensureLoaded(),
76865 _mainPresetIndex.ensureLoaded()
76867 if (!context.container().empty())
76868 render(context.container());
76869 }).catch((err) => console.error(err));
76871 ui.restart = function() {
76872 context.keybinding().clear();
76873 _loadPromise = null;
76874 context.container().selectAll("*").remove();
76877 ui.lastPointerType = function() {
76878 return _lastPointerType;
76880 ui.svgDefs = svgDefs(context);
76881 ui.flash = uiFlash(context);
76882 ui.sidebar = uiSidebar(context);
76883 ui.photoviewer = uiPhotoviewer(context);
76884 ui.shortcuts = uiShortcuts(context);
76885 ui.onResize = function(withPan) {
76886 var map2 = context.map();
76887 var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
76888 utilGetDimensions(context.container().select(".sidebar"), true);
76889 if (withPan !== void 0) {
76890 map2.redrawEnable(false);
76892 map2.redrawEnable(true);
76894 map2.dimensions(mapDimensions);
76895 ui.photoviewer.onMapResize();
76896 ui.checkOverflow(".top-toolbar");
76897 ui.checkOverflow(".map-footer-bar");
76898 var resizeWindowEvent = document.createEvent("Event");
76899 resizeWindowEvent.initEvent("resizeWindow", true, true);
76900 document.dispatchEvent(resizeWindowEvent);
76902 ui.checkOverflow = function(selector, reset) {
76904 delete _needWidth[selector];
76906 var selection2 = context.container().select(selector);
76907 if (selection2.empty())
76909 var scrollWidth = selection2.property("scrollWidth");
76910 var clientWidth = selection2.property("clientWidth");
76911 var needed = _needWidth[selector] || scrollWidth;
76912 if (scrollWidth > clientWidth) {
76913 selection2.classed("narrow", true);
76914 if (!_needWidth[selector]) {
76915 _needWidth[selector] = scrollWidth;
76917 } else if (scrollWidth >= needed) {
76918 selection2.classed("narrow", false);
76921 ui.togglePanes = function(showPane) {
76922 var hidePanes = context.container().selectAll(".map-pane.shown");
76923 var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
76924 hidePanes.classed("shown", false).classed("hide", true);
76925 context.container().selectAll(".map-pane-control button").classed("active", false);
76927 hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
76928 context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
76929 showPane.classed("shown", true).classed("hide", false);
76930 if (hidePanes.empty()) {
76931 showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
76933 showPane.style(side, "0px");
76936 hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
76937 select_default2(this).classed("shown", false).classed("hide", true);
76941 var _editMenu = uiEditMenu(context);
76942 ui.editMenu = function() {
76945 ui.showEditMenu = function(anchorPoint, triggerType, operations) {
76946 ui.closeEditMenu();
76947 if (!operations && context.mode().operations)
76948 operations = context.mode().operations();
76949 if (!operations || !operations.length)
76951 if (!context.map().editableDataEnabled())
76953 var surfaceNode = context.surface().node();
76954 if (surfaceNode.focus) {
76955 surfaceNode.focus();
76957 operations.forEach(function(operation2) {
76958 if (operation2.point)
76959 operation2.point(anchorPoint);
76961 _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
76962 context.map().supersurface.call(_editMenu);
76964 ui.closeEditMenu = function() {
76965 context.map().supersurface.select(".edit-menu").remove();
76967 var _saveLoading = select_default2(null);
76968 context.uploader().on("saveStarted.ui", function() {
76969 _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
76970 context.container().call(_saveLoading);
76971 }).on("saveEnded.ui", function() {
76972 _saveLoading.close();
76973 _saveLoading = select_default2(null);
76982 // modules/core/context.js
76983 function coreContext() {
76984 const dispatch14 = dispatch_default("enter", "exit", "change");
76985 let context = utilRebind({}, dispatch14, "on");
76986 let _deferred2 = /* @__PURE__ */ new Set();
76987 context.version = package_default.version;
76988 context.privacyVersion = "20201202";
76989 context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
76990 context.changeset = null;
76991 let _defaultChangesetComment = context.initialHashParams.comment;
76992 let _defaultChangesetSource = context.initialHashParams.source;
76993 let _defaultChangesetHashtags = context.initialHashParams.hashtags;
76994 context.defaultChangesetComment = function(val) {
76995 if (!arguments.length)
76996 return _defaultChangesetComment;
76997 _defaultChangesetComment = val;
77000 context.defaultChangesetSource = function(val) {
77001 if (!arguments.length)
77002 return _defaultChangesetSource;
77003 _defaultChangesetSource = val;
77006 context.defaultChangesetHashtags = function(val) {
77007 if (!arguments.length)
77008 return _defaultChangesetHashtags;
77009 _defaultChangesetHashtags = val;
77012 let _setsDocumentTitle = true;
77013 context.setsDocumentTitle = function(val) {
77014 if (!arguments.length)
77015 return _setsDocumentTitle;
77016 _setsDocumentTitle = val;
77019 let _documentTitleBase = document.title;
77020 context.documentTitleBase = function(val) {
77021 if (!arguments.length)
77022 return _documentTitleBase;
77023 _documentTitleBase = val;
77027 context.ui = () => _ui;
77028 context.lastPointerType = () => _ui.lastPointerType();
77029 let _keybinding = utilKeybinding("context");
77030 context.keybinding = () => _keybinding;
77031 select_default2(document).call(_keybinding);
77032 let _connection = services.osm;
77036 context.connection = () => _connection;
77037 context.history = () => _history;
77038 context.validator = () => _validator;
77039 context.uploader = () => _uploader;
77040 context.preauth = (options2) => {
77042 _connection.switch(options2);
77046 context.locale = function(locale2) {
77047 if (!arguments.length)
77048 return _mainLocalizer.localeCode();
77049 _mainLocalizer.preferredLocaleCodes(locale2);
77052 function afterLoad(cid, callback) {
77053 return (err, result) => {
77055 if (err.status === 400 || err.status === 401 || err.status === 403) {
77057 _connection.logout();
77060 if (typeof callback === "function") {
77064 } else if (_connection && _connection.getConnectionId() !== cid) {
77065 if (typeof callback === "function") {
77066 callback({ message: "Connection Switched", status: -1 });
77070 _history.merge(result.data, result.extent);
77071 if (typeof callback === "function") {
77072 callback(err, result);
77078 context.loadTiles = (projection2, callback) => {
77079 const handle = window.requestIdleCallback(() => {
77080 _deferred2.delete(handle);
77081 if (_connection && context.editableDataEnabled()) {
77082 const cid = _connection.getConnectionId();
77083 _connection.loadTiles(projection2, afterLoad(cid, callback));
77086 _deferred2.add(handle);
77088 context.loadTileAtLoc = (loc, callback) => {
77089 const handle = window.requestIdleCallback(() => {
77090 _deferred2.delete(handle);
77091 if (_connection && context.editableDataEnabled()) {
77092 const cid = _connection.getConnectionId();
77093 _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
77096 _deferred2.add(handle);
77098 context.loadEntity = (entityID, callback) => {
77100 const cid = _connection.getConnectionId();
77101 _connection.loadEntity(entityID, afterLoad(cid, callback));
77102 _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
77105 context.loadNote = (entityID, callback) => {
77107 const cid = _connection.getConnectionId();
77108 _connection.loadEntityNote(entityID, afterLoad(cid, callback));
77111 context.zoomToEntity = (entityID, zoomTo) => {
77112 context.loadEntity(entityID, (err, result) => {
77115 if (zoomTo !== false) {
77116 const entity = result.data.find((e3) => e3.id === entityID);
77118 _map.zoomTo(entity);
77122 _map.on("drawn.zoomToEntity", () => {
77123 if (!context.hasEntity(entityID))
77125 _map.on("drawn.zoomToEntity", null);
77126 context.on("enter.zoomToEntity", null);
77127 context.enter(modeSelect(context, [entityID]));
77129 context.on("enter.zoomToEntity", () => {
77130 if (_mode.id !== "browse") {
77131 _map.on("drawn.zoomToEntity", null);
77132 context.on("enter.zoomToEntity", null);
77136 let _minEditableZoom = 16;
77137 context.minEditableZoom = function(val) {
77138 if (!arguments.length)
77139 return _minEditableZoom;
77140 _minEditableZoom = val;
77142 _connection.tileZoom(val);
77146 context.maxCharsForTagKey = () => 255;
77147 context.maxCharsForTagValue = () => 255;
77148 context.maxCharsForRelationRole = () => 255;
77149 context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
77150 context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
77151 context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
77152 let _inIntro = false;
77153 context.inIntro = function(val) {
77154 if (!arguments.length)
77159 context.save = () => {
77160 if (_inIntro || context.container().select(".modal").size())
77163 if (_mode && _mode.id === "save") {
77165 if (services.osm && services.osm.isChangesetInflight()) {
77166 _history.clearSaved();
77170 canSave = context.selectedIDs().every((id2) => {
77171 const entity = context.hasEntity(id2);
77172 return entity && !entity.isDegenerate();
77178 if (_history.hasChanges()) {
77179 return _t("save.unsaved_changes");
77182 context.debouncedSave = debounce_default(context.save, 350);
77183 function withDebouncedSave(fn) {
77184 return function() {
77185 const result = fn.apply(_history, arguments);
77186 context.debouncedSave();
77190 context.hasEntity = (id2) => _history.graph().hasEntity(id2);
77191 context.entity = (id2) => _history.graph().entity(id2);
77193 context.mode = () => _mode;
77194 context.enter = (newMode) => {
77197 dispatch14.call("exit", this, _mode);
77201 dispatch14.call("enter", this, _mode);
77203 context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
77204 context.activeID = () => _mode && _mode.activeID && _mode.activeID();
77205 let _selectedNoteID;
77206 context.selectedNoteID = function(noteID) {
77207 if (!arguments.length)
77208 return _selectedNoteID;
77209 _selectedNoteID = noteID;
77212 let _selectedErrorID;
77213 context.selectedErrorID = function(errorID) {
77214 if (!arguments.length)
77215 return _selectedErrorID;
77216 _selectedErrorID = errorID;
77219 context.install = (behavior) => context.surface().call(behavior);
77220 context.uninstall = (behavior) => context.surface().call(behavior.off);
77222 context.copyGraph = () => _copyGraph;
77224 context.copyIDs = function(val) {
77225 if (!arguments.length)
77228 _copyGraph = _history.graph();
77232 context.copyLonLat = function(val) {
77233 if (!arguments.length)
77234 return _copyLonLat;
77239 context.background = () => _background;
77241 context.features = () => _features;
77242 context.hasHiddenConnections = (id2) => {
77243 const graph = _history.graph();
77244 const entity = graph.entity(id2);
77245 return _features.hasHiddenConnections(entity, graph);
77248 context.photos = () => _photos;
77250 context.map = () => _map;
77251 context.layers = () => _map.layers();
77252 context.surface = () => _map.surface;
77253 context.editableDataEnabled = () => _map.editableDataEnabled();
77254 context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
77255 context.editable = () => {
77256 const mode = context.mode();
77257 if (!mode || mode.id === "save")
77259 return _map.editableDataEnabled();
77261 let _debugFlags = {
77265 // label collision bounding boxes
77267 // imagery bounding polygons
77271 // downloaded data from osm
77273 context.debugFlags = () => _debugFlags;
77274 context.getDebug = (flag) => flag && _debugFlags[flag];
77275 context.setDebug = function(flag, val) {
77276 if (arguments.length === 1)
77278 _debugFlags[flag] = val;
77279 dispatch14.call("change");
77282 let _container = select_default2(null);
77283 context.container = function(val) {
77284 if (!arguments.length)
77287 _container.classed("ideditor", true);
77290 context.containerNode = function(val) {
77291 if (!arguments.length)
77292 return context.container().node();
77293 context.container(select_default2(val));
77297 context.embed = function(val) {
77298 if (!arguments.length)
77303 let _assetPath = "";
77304 context.assetPath = function(val) {
77305 if (!arguments.length)
77308 _mainFileFetcher.assetPath(val);
77311 let _assetMap = {};
77312 context.assetMap = function(val) {
77313 if (!arguments.length)
77316 _mainFileFetcher.assetMap(val);
77319 context.asset = (val) => {
77320 if (/^http(s)?:\/\//i.test(val))
77322 const filename = _assetPath + val;
77323 return _assetMap[filename] || filename;
77325 context.imagePath = (val) => context.asset("img/".concat(val));
77326 context.reset = context.flush = () => {
77327 context.debouncedSave.cancel();
77328 Array.from(_deferred2).forEach((handle) => {
77329 window.cancelIdleCallback(handle);
77330 _deferred2.delete(handle);
77332 Object.values(services).forEach((service) => {
77333 if (service && typeof service.reset === "function") {
77334 service.reset(context);
77337 context.changeset = null;
77338 _validator.reset();
77342 context.container().select(".inspector-wrap *").remove();
77345 context.projection = geoRawMercator();
77346 context.curtainProjection = geoRawMercator();
77347 context.init = () => {
77348 instantiateInternal();
77349 initializeDependents();
77351 function instantiateInternal() {
77352 _history = coreHistory(context);
77353 context.graph = _history.graph;
77354 context.pauseChangeDispatch = _history.pauseChangeDispatch;
77355 context.resumeChangeDispatch = _history.resumeChangeDispatch;
77356 context.perform = withDebouncedSave(_history.perform);
77357 context.replace = withDebouncedSave(_history.replace);
77358 context.pop = withDebouncedSave(_history.pop);
77359 context.overwrite = withDebouncedSave(_history.overwrite);
77360 context.undo = withDebouncedSave(_history.undo);
77361 context.redo = withDebouncedSave(_history.redo);
77362 _validator = coreValidator(context);
77363 _uploader = coreUploader(context);
77364 _background = rendererBackground(context);
77365 _features = rendererFeatures(context);
77366 _map = rendererMap(context);
77367 _photos = rendererPhotos(context);
77368 _ui = uiInit(context);
77370 function initializeDependents() {
77371 if (context.initialHashParams.presets) {
77372 _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
77374 if (context.initialHashParams.locale) {
77375 _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
77377 _mainLocalizer.ensureLoaded();
77378 _mainPresetIndex.ensureLoaded();
77379 _background.ensureLoaded();
77380 Object.values(services).forEach((service) => {
77381 if (service && typeof service.init === "function") {
77388 if (services.maprules && context.initialHashParams.maprules) {
77389 json_default(context.initialHashParams.maprules).then((mapcss) => {
77390 services.maprules.init();
77391 mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
77395 if (!context.container().empty()) {
77396 _ui.ensureLoaded().then(() => {
77397 _background.init();
77406 // modules/services/nominatim.js
77407 var apibase = nominatimApiUrl;
77408 var _inflight = {};
77409 var _nominatimCache;
77410 var nominatim_default = {
77413 _nominatimCache = new import_rbush7.default();
77415 reset: function() {
77416 Object.values(_inflight).forEach(function(controller) {
77417 controller.abort();
77420 _nominatimCache = new import_rbush7.default();
77422 countryCode: function(location, callback) {
77423 this.reverse(location, function(err, result) {
77425 return callback(err);
77426 } else if (result.address) {
77427 return callback(null, result.address.country_code);
77429 return callback("Unable to geocode", null);
77433 reverse: function(loc, callback) {
77434 var cached = _nominatimCache.search(
77435 { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
77437 if (cached.length > 0) {
77439 callback(null, cached[0].data);
77442 var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
77443 var url = apibase + "reverse?" + utilQsString(params);
77444 if (_inflight[url])
77446 var controller = new AbortController();
77447 _inflight[url] = controller;
77448 json_default(url, {
77449 signal: controller.signal,
77451 "Accept-Language": _mainLocalizer.localeCodes().join(",")
77453 }).then(function(result) {
77454 delete _inflight[url];
77455 if (result && result.error) {
77456 throw new Error(result.error);
77458 var extent = geoExtent(loc).padByMeters(200);
77459 _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
77461 callback(null, result);
77462 }).catch(function(err) {
77463 delete _inflight[url];
77464 if (err.name === "AbortError")
77467 callback(err.message);
77470 search: function(val, callback) {
77476 var url = apibase + "search?" + utilQsString(params);
77477 if (_inflight[url])
77479 var controller = new AbortController();
77480 _inflight[url] = controller;
77481 json_default(url, {
77482 signal: controller.signal,
77484 "Accept-Language": _mainLocalizer.localeCodes().join(",")
77486 }).then(function(result) {
77487 delete _inflight[url];
77488 if (result && result.error) {
77489 throw new Error(result.error);
77492 callback(null, result);
77493 }).catch(function(err) {
77494 delete _inflight[url];
77495 if (err.name === "AbortError")
77498 callback(err.message);
77503 // node_modules/name-suggestion-index/lib/matcher.js
77504 var import_which_polygon4 = __toESM(require_which_polygon(), 1);
77506 // node_modules/name-suggestion-index/lib/simplify.js
77507 var import_diacritics3 = __toESM(require_diacritics(), 1);
77508 function simplify2(str) {
77509 if (typeof str !== "string")
77511 return import_diacritics3.default.remove(
77512 str.replace(/&/g, "and").replace(/İ/ig, "i").replace(/[\s\-=_!"#%'*{},.\/:;?\(\)\[\]@\\$\^*+<>«»~`’\u00a1\u00a7\u00b6\u00b7\u00bf\u037e\u0387\u055a-\u055f\u0589\u05c0\u05c3\u05c6\u05f3\u05f4\u0609\u060a\u060c\u060d\u061b\u061e\u061f\u066a-\u066d\u06d4\u0700-\u070d\u07f7-\u07f9\u0830-\u083e\u085e\u0964\u0965\u0970\u0af0\u0df4\u0e4f\u0e5a\u0e5b\u0f04-\u0f12\u0f14\u0f85\u0fd0-\u0fd4\u0fd9\u0fda\u104a-\u104f\u10fb\u1360-\u1368\u166d\u166e\u16eb-\u16ed\u1735\u1736\u17d4-\u17d6\u17d8-\u17da\u1800-\u1805\u1807-\u180a\u1944\u1945\u1a1e\u1a1f\u1aa0-\u1aa6\u1aa8-\u1aad\u1b5a-\u1b60\u1bfc-\u1bff\u1c3b-\u1c3f\u1c7e\u1c7f\u1cc0-\u1cc7\u1cd3\u2000-\u206f\u2cf9-\u2cfc\u2cfe\u2cff\u2d70\u2e00-\u2e7f\u3001-\u3003\u303d\u30fb\ua4fe\ua4ff\ua60d-\ua60f\ua673\ua67e\ua6f2-\ua6f7\ua874-\ua877\ua8ce\ua8cf\ua8f8-\ua8fa\ua92e\ua92f\ua95f\ua9c1-\ua9cd\ua9de\ua9df\uaa5c-\uaa5f\uaade\uaadf\uaaf0\uaaf1\uabeb\ufe10-\ufe16\ufe19\ufe30\ufe45\ufe46\ufe49-\ufe4c\ufe50-\ufe52\ufe54-\ufe57\ufe5f-\ufe61\ufe68\ufe6a\ufe6b\ufeff\uff01-\uff03\uff05-\uff07\uff0a\uff0c\uff0e\uff0f\uff1a\uff1b\uff1f\uff20\uff3c\uff61\uff64\uff65]+/g, "").toLowerCase()
77516 // node_modules/name-suggestion-index/config/matchGroups.json
77517 var matchGroups_default = {
77519 adult_gaming_centre: [
77521 "amenity/gambling",
77522 "leisure/adult_gaming_centre"
77526 "shop/hairdresser_supply"
77540 "tourism/camp_site",
77541 "tourism/caravan_site"
77552 "healthcare/clinic",
77553 "healthcare/laboratory",
77554 "healthcare/physiotherapist",
77555 "healthcare/sample_collection",
77556 "healthcare/dialysis"
77561 "shop/convenience",
77569 "amenity/coworking_space",
77570 "office/coworking",
77571 "office/coworking_space"
77576 "healthcare/dentist"
77579 "office/telecommunication",
77581 "shop/electronics",
77585 "shop/mobile_phone",
77586 "shop/telecommunication"
77590 "shop/haberdashery",
77594 "shop/accessories",
77598 "shop/department_store",
77600 "shop/fashion_accessories",
77606 "office/accountant",
77607 "office/financial",
77608 "office/financial_advisor",
77609 "office/tax_advisor",
77613 "leisure/fitness_centre",
77614 "leisure/fitness_center",
77615 "leisure/sports_centre",
77616 "leisure/sports_center"
77621 "amenity/fast_food",
77622 "amenity/ice_cream",
77624 "amenity/restaurant",
77629 "shop/confectionary",
77630 "shop/confectionery",
77640 "shop/convenience;gas",
77641 "shop/gas;convenience"
77651 "shop/bathroom_furnishing",
77654 "shop/doityourself",
77659 "shop/hardware_store",
77660 "shop/power_tools",
77667 "shop/health_food",
77669 "shop/nutrition_supplements"
77672 "shop/electronics",
77679 "shop/video_games",
77684 "amenity/hospital",
77685 "healthcare/hospital"
77689 "shop/interior_decoration"
77691 lifeboat_station: [
77692 "amenity/lifeboat_station",
77693 "emergency/lifeboat_station",
77694 "emergency/marine_rescue"
77701 "amenity/money_transfer",
77702 "shop/money_transfer"
77705 "shop/office_supplies",
77715 "amenity/parcel_locker",
77716 "amenity/vending_machine"
77720 "amenity/pharmacy",
77721 "healthcare/pharmacy"
77724 "amenity/theme_park",
77725 "leisure/amusement_arcade",
77726 "leisure/playground"
77729 "amenity/bicycle_rental",
77730 "amenity/boat_rental",
77731 "amenity/car_rental",
77732 "amenity/truck_rental",
77733 "amenity/vehicle_rental",
77738 "amenity/childcare",
77740 "amenity/kindergarten",
77741 "amenity/language_school",
77742 "amenity/prep_school",
77744 "amenity/university"
77747 "shop/storage_units",
77748 "shop/storage_rental"
77752 "power/substation",
77753 "power/sub_station"
77757 "shop/frozen_food",
77758 "shop/greengrocer",
77760 "shop/supermarket",
77764 "shop/variety_store",
77769 "amenity/vending_machine",
77771 "shop/vending_machine"
77776 "amenity/weight_clinic",
77777 "healthcare/counselling",
77778 "leisure/fitness_centre",
77779 "office/therapist",
77783 "shop/health_food",
77786 "shop/nutrition_supplements",
77791 "shop/supermarket",
77792 "shop/department_store"
77797 // node_modules/name-suggestion-index/config/genericWords.json
77798 var genericWords_default = {
77800 "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
77801 "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
77802 "^(club|green|out|ware)\\s?house$",
77803 "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
77804 "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
77805 "^(hofladen|librairie|magazine?|maison)$",
77806 "^(mobile home|skate)?\\s?park$",
77807 "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
77810 "^tattoo( studio)?$",
77812 "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
77816 // node_modules/name-suggestion-index/config/trees.json
77817 var trees_default = {
77820 emoji: "\u{1F354}",
77821 mainTag: "brand:wikidata",
77822 sourceTags: ["brand", "name"],
77824 primary: "^(name|name:\\w+)$",
77825 alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
77829 emoji: "\u{1F6A9}",
77830 mainTag: "flag:wikidata",
77832 primary: "^(flag:name|flag:name:\\w+)$",
77833 alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
77837 emoji: "\u{1F4BC}",
77838 mainTag: "operator:wikidata",
77839 sourceTags: ["operator"],
77841 primary: "^(name|name:\\w+|operator|operator:\\w+)$",
77842 alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
77846 emoji: "\u{1F687}",
77847 mainTag: "network:wikidata",
77848 sourceTags: ["network"],
77850 primary: "^network$",
77851 alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
77857 // node_modules/name-suggestion-index/lib/matcher.js
77858 var matchGroups = matchGroups_default.matchGroups;
77859 var trees = trees_default.trees;
77860 var Matcher = class {
77863 // initialize the genericWords regexes
77865 this.matchIndex = void 0;
77866 this.genericWords = /* @__PURE__ */ new Map();
77867 (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
77868 this.itemLocation = void 0;
77869 this.locationSets = void 0;
77870 this.locationIndex = void 0;
77871 this.warnings = [];
77874 // `buildMatchIndex()`
77875 // Call this to prepare the matcher for use
77877 // `data` needs to be an Object indexed on a 'tree/key/value' path.
77878 // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
77880 // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
77881 // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] },
77885 buildMatchIndex(data) {
77887 if (that.matchIndex)
77889 that.matchIndex = /* @__PURE__ */ new Map();
77890 const seenTree = /* @__PURE__ */ new Map();
77891 Object.keys(data).forEach((tkv) => {
77892 const category = data[tkv];
77893 const parts = tkv.split("/", 3);
77894 const t2 = parts[0];
77895 const k2 = parts[1];
77896 const v2 = parts[2];
77897 const thiskv = "".concat(k2, "/").concat(v2);
77898 const tree = trees[t2];
77899 let branch = that.matchIndex.get(thiskv);
77902 primary: /* @__PURE__ */ new Map(),
77903 alternate: /* @__PURE__ */ new Map(),
77904 excludeGeneric: /* @__PURE__ */ new Map(),
77905 excludeNamed: /* @__PURE__ */ new Map()
77907 that.matchIndex.set(thiskv, branch);
77909 const properties = category.properties || {};
77910 const exclude = properties.exclude || {};
77911 (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
77912 (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
77913 const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
77914 let items = category.items;
77915 if (!Array.isArray(items) || !items.length)
77917 const primaryName = new RegExp(tree.nameTags.primary, "i");
77918 const alternateName = new RegExp(tree.nameTags.alternate, "i");
77919 const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
77920 const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
77921 const genericKV = /* @__PURE__ */ new Set(["".concat(k2, "/yes"), "building/yes"]);
77922 const matchGroupKV = /* @__PURE__ */ new Set();
77923 Object.values(matchGroups).forEach((matchGroup) => {
77924 const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
77927 matchGroup.forEach((otherkv) => {
77928 if (otherkv === thiskv)
77930 matchGroupKV.add(otherkv);
77931 const otherk = otherkv.split("/", 2)[0];
77932 genericKV.add("".concat(otherk, "/yes"));
77935 items.forEach((item) => {
77938 if (Array.isArray(item.matchTags) && item.matchTags.length) {
77939 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
77940 if (!item.matchTags.length)
77941 delete item.matchTags;
77943 let kvTags = ["".concat(thiskv)].concat(item.matchTags || []);
77944 if (!skipGenericKV) {
77945 kvTags = kvTags.concat(Array.from(genericKV));
77947 Object.keys(item.tags).forEach((osmkey) => {
77948 if (notName.test(osmkey))
77950 const osmvalue = item.tags[osmkey];
77951 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue)))
77953 if (primaryName.test(osmkey)) {
77954 kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
77955 } else if (alternateName.test(osmkey)) {
77956 kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
77959 let keepMatchNames = /* @__PURE__ */ new Set();
77960 (item.matchNames || []).forEach((matchName) => {
77961 const nsimple = simplify2(matchName);
77962 kvTags.forEach((kv) => {
77963 const branch2 = that.matchIndex.get(kv);
77964 const primaryLeaf = branch2 && branch2.primary.get(nsimple);
77965 const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
77966 const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
77967 const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
77968 if (!inPrimary && !inAlternate) {
77969 insertName("alternate", t2, kv, nsimple, item.id);
77970 keepMatchNames.add(matchName);
77974 if (keepMatchNames.size) {
77975 item.matchNames = Array.from(keepMatchNames);
77977 delete item.matchNames;
77981 function insertName(which, t2, kv, nsimple, itemID) {
77983 that.warnings.push("Warning: skipping empty ".concat(which, " name for item ").concat(t2, "/").concat(kv, ": ").concat(itemID));
77986 let branch = that.matchIndex.get(kv);
77989 primary: /* @__PURE__ */ new Map(),
77990 alternate: /* @__PURE__ */ new Map(),
77991 excludeGeneric: /* @__PURE__ */ new Map(),
77992 excludeNamed: /* @__PURE__ */ new Map()
77994 that.matchIndex.set(kv, branch);
77996 let leaf = branch[which].get(nsimple);
77998 leaf = /* @__PURE__ */ new Set();
77999 branch[which].set(nsimple, leaf);
78002 if (!/yes$/.test(kv)) {
78003 const kvnsimple = "".concat(kv, "/").concat(nsimple);
78004 const existing = seenTree.get(kvnsimple);
78005 if (existing && existing !== t2) {
78006 const items = Array.from(leaf);
78007 that.warnings.push('Duplicate cache key "'.concat(kvnsimple, '" in trees "').concat(t2, '" and "').concat(existing, '", check items: ').concat(items));
78010 seenTree.set(kvnsimple, t2);
78013 function skipGenericKVMatches(t2, k2, v2) {
78014 return t2 === "flags" || t2 === "transit" || k2 === "landuse" || v2 === "atm" || v2 === "bicycle_parking" || v2 === "car_sharing" || v2 === "caravan_site" || v2 === "charging_station" || v2 === "dog_park" || v2 === "parking" || v2 === "phone" || v2 === "playground" || v2 === "post_box" || v2 === "public_bookcase" || v2 === "recycling" || v2 === "vending_machine";
78018 // `buildLocationIndex()`
78019 // Call this to prepare a which-polygon location index.
78020 // This *resolves* all the locationSets into GeoJSON, which takes some time.
78021 // You can skip this step if you don't care about matching within a location.
78023 // `data` needs to be an Object indexed on a 'tree/key/value' path.
78024 // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
78026 // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
78027 // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] },
78031 buildLocationIndex(data, loco) {
78033 if (that.locationIndex)
78035 that.itemLocation = /* @__PURE__ */ new Map();
78036 that.locationSets = /* @__PURE__ */ new Map();
78037 Object.keys(data).forEach((tkv) => {
78038 const items = data[tkv].items;
78039 if (!Array.isArray(items) || !items.length)
78041 items.forEach((item) => {
78042 if (that.itemLocation.has(item.id))
78046 resolved = loco.resolveLocationSet(item.locationSet);
78048 console.warn("buildLocationIndex: ".concat(err.message));
78050 if (!resolved || !resolved.id)
78052 that.itemLocation.set(item.id, resolved.id);
78053 if (that.locationSets.has(resolved.id))
78055 let feature3 = _cloneDeep2(resolved.feature);
78056 feature3.id = resolved.id;
78057 feature3.properties.id = resolved.id;
78058 if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
78059 console.warn("buildLocationIndex: locationSet ".concat(resolved.id, " for ").concat(item.id, " resolves to an empty feature:"));
78060 console.warn(JSON.stringify(feature3));
78063 that.locationSets.set(resolved.id, feature3);
78066 that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
78067 function _cloneDeep2(obj) {
78068 return JSON.parse(JSON.stringify(obj));
78073 // Pass parts and return an Array of matches.
78077 // `loc` - optional - [lon,lat] location to search
78079 // 1. If the [k,v,n] tuple matches a canonical item…
78080 // Return an Array of match results.
78081 // Each result will include the area in km² that the item is valid.
78083 // Order of results:
78084 // Primary ordering will be on the "match" column:
78085 // "primary" - where the query matches the `name` tag, followed by
78086 // "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
78087 // Secondary ordering will be on the "area" column:
78088 // "area descending" if no location was provided, (worldwide before local)
78089 // "area ascending" if location was provided (local before worldwide)
78092 // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String },
78093 // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String },
78094 // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String },
78095 // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String },
78101 // 2. If the [k,v,n] tuple matches an exclude pattern…
78102 // Return an Array with a single exclude result, either
78104 // [ { match: 'excludeGeneric', pattern: String, kv: String } ] // "generic" e.g. "Food Court"
78106 // [ { match: 'excludeNamed', pattern: String, kv: String } ] // "named", e.g. "Kebabai"
78109 // "generic" - a generic word that is probably not really a name.
78110 // For these, iD should warn the user "Hey don't put 'food court' in the name tag".
78111 // "named" - a real name like "Kebabai" that is just common, but not a brand.
78112 // For these, iD should just let it be. We don't include these in NSI, but we don't want to nag users about it either.
78116 // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
78119 match(k2, v2, n3, loc) {
78121 if (!that.matchIndex) {
78122 throw new Error("match: matchIndex not built.");
78124 let matchLocations;
78125 if (Array.isArray(loc) && that.locationIndex) {
78126 matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
78128 const nsimple = simplify2(n3);
78129 let seen = /* @__PURE__ */ new Set();
78131 gatherResults("primary");
78132 gatherResults("alternate");
78133 if (results.length)
78135 gatherResults("exclude");
78136 return results.length ? results : null;
78137 function gatherResults(which) {
78138 const kv = "".concat(k2, "/").concat(v2);
78139 let didMatch = tryMatch(which, kv);
78142 for (let mg in matchGroups) {
78143 const matchGroup = matchGroups[mg];
78144 const inGroup = matchGroup.some((otherkv) => otherkv === kv);
78147 for (let i3 = 0; i3 < matchGroup.length; i3++) {
78148 const otherkv = matchGroup[i3];
78149 if (otherkv === kv)
78151 didMatch = tryMatch(which, otherkv);
78156 if (which === "exclude") {
78157 const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
78159 results.push({ match: "excludeGeneric", pattern: String(regex) });
78164 function tryMatch(which, kv) {
78165 const branch = that.matchIndex.get(kv);
78168 if (which === "exclude") {
78169 let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
78171 results.push({ match: "excludeNamed", pattern: String(regex), kv });
78174 regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
78176 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
78181 const leaf = branch[which].get(nsimple);
78182 if (!leaf || !leaf.size)
78184 let hits = Array.from(leaf).map((itemID) => {
78185 let area = Infinity;
78186 if (that.itemLocation && that.locationSets) {
78187 const location = that.locationSets.get(that.itemLocation.get(itemID));
78188 area = location && location.properties.area || Infinity;
78190 return { match: which, itemID, area, kv, nsimple };
78192 let sortFn = byAreaDescending;
78193 if (matchLocations) {
78194 hits = hits.filter(isValidLocation);
78195 sortFn = byAreaAscending;
78199 hits.sort(sortFn).forEach((hit) => {
78200 if (seen.has(hit.itemID))
78202 seen.add(hit.itemID);
78206 function isValidLocation(hit) {
78207 if (!that.itemLocation)
78209 return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
78211 function byAreaAscending(hitA, hitB) {
78212 return hitA.area - hitB.area;
78214 function byAreaDescending(hitA, hitB) {
78215 return hitB.area - hitA.area;
78221 // Return any warnings discovered when buiding the index.
78222 // (currently this does nothing)
78225 return this.warnings;
78229 // modules/services/nsi.js
78230 var import_vparse2 = __toESM(require_vparse());
78231 var _nsiStatus = "loading";
78233 var buildingPreset = {
78234 "building/commercial": true,
78235 "building/government": true,
78236 "building/hotel": true,
78237 "building/retail": true,
78238 "building/office": true,
78239 "building/supermarket": true,
78240 "building/yes": true
78242 var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
78243 var notBranches = /(coop|express|wireless|factory|outlet)/i;
78244 function setNsiSources() {
78245 const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
78246 const v2 = (0, import_vparse2.default)(nsiVersion);
78247 const vMinor = "".concat(v2.major, ".").concat(v2.minor);
78248 const cdn = nsiCdnUrl.replace("{version}", vMinor);
78250 "nsi_data": cdn + "dist/nsi.min.json",
78251 "nsi_dissolved": cdn + "dist/dissolved.min.json",
78252 "nsi_features": cdn + "dist/featureCollection.min.json",
78253 "nsi_generics": cdn + "dist/genericWords.min.json",
78254 "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
78255 "nsi_replacements": cdn + "dist/replacements.min.json",
78256 "nsi_trees": cdn + "dist/trees.min.json"
78258 let fileMap = _mainFileFetcher.fileMap();
78259 for (const k2 in sources) {
78261 fileMap[k2] = sources[k2];
78264 function loadNsiPresets() {
78265 return Promise.all([
78266 _mainFileFetcher.get("nsi_presets"),
78267 _mainFileFetcher.get("nsi_features")
78268 ]).then((vals) => {
78269 Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
78270 Object.values(vals[0].presets).forEach((preset) => {
78271 if (preset.tags["brand:wikidata"]) {
78272 preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
78274 if (preset.tags["operator:wikidata"]) {
78275 preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
78277 if (preset.tags["network:wikidata"]) {
78278 preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
78281 _mainPresetIndex.merge({
78282 presets: vals[0].presets,
78283 featureCollection: vals[1]
78287 function loadNsiData() {
78288 return Promise.all([
78289 _mainFileFetcher.get("nsi_data"),
78290 _mainFileFetcher.get("nsi_dissolved"),
78291 _mainFileFetcher.get("nsi_replacements"),
78292 _mainFileFetcher.get("nsi_trees")
78293 ]).then((vals) => {
78296 // the raw name-suggestion-index data
78297 dissolved: vals[1].dissolved,
78298 // list of dissolved items
78299 replacements: vals[2].replacements,
78300 // trivial old->new qid replacements
78301 trees: vals[3].trees,
78302 // metadata about trees, main tags
78303 kvt: /* @__PURE__ */ new Map(),
78304 // Map (k -> Map (v -> t) )
78305 qids: /* @__PURE__ */ new Map(),
78306 // Map (wd/wp tag values -> qids)
78307 ids: /* @__PURE__ */ new Map()
78308 // Map (id -> NSI item)
78310 const matcher = _nsi.matcher = new Matcher();
78311 matcher.buildMatchIndex(_nsi.data);
78312 matcher.itemLocation = /* @__PURE__ */ new Map();
78313 matcher.locationSets = /* @__PURE__ */ new Map();
78314 Object.keys(_nsi.data).forEach((tkv) => {
78315 const items = _nsi.data[tkv].items;
78316 if (!Array.isArray(items) || !items.length)
78318 items.forEach((item) => {
78319 if (matcher.itemLocation.has(item.id))
78321 const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
78322 matcher.itemLocation.set(item.id, locationSetID);
78323 if (matcher.locationSets.has(locationSetID))
78325 const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
78326 matcher.locationSets.set(locationSetID, fakeFeature);
78329 matcher.locationIndex = (bbox2) => {
78330 const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
78331 const results = [];
78332 for (const [locationSetID, area] of Object.entries(validHere)) {
78333 const fakeFeature = matcher.locationSets.get(locationSetID);
78335 fakeFeature.properties.area = area;
78336 results.push(fakeFeature);
78341 Object.keys(_nsi.data).forEach((tkv) => {
78342 const category = _nsi.data[tkv];
78343 const parts = tkv.split("/", 3);
78344 const t2 = parts[0];
78345 const k2 = parts[1];
78346 const v2 = parts[2];
78347 let vmap = _nsi.kvt.get(k2);
78349 vmap = /* @__PURE__ */ new Map();
78350 _nsi.kvt.set(k2, vmap);
78353 const tree = _nsi.trees[t2];
78354 const mainTag = tree.mainTag;
78355 const items = category.items || [];
78356 items.forEach((item) => {
78358 item.mainTag = mainTag;
78359 _nsi.ids.set(item.id, item);
78360 const wd = item.tags[mainTag];
78361 const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
78363 _nsi.qids.set(wd, wd);
78365 _nsi.qids.set(wp, wd);
78370 function gatherKVs(tags) {
78371 let primary = /* @__PURE__ */ new Set();
78372 let alternate = /* @__PURE__ */ new Set();
78373 Object.keys(tags).forEach((osmkey) => {
78374 const osmvalue = tags[osmkey];
78377 if (osmkey === "route_master")
78379 const vmap = _nsi.kvt.get(osmkey);
78382 if (vmap.get(osmvalue)) {
78383 primary.add("".concat(osmkey, "/").concat(osmvalue));
78384 } else if (osmvalue === "yes") {
78385 alternate.add("".concat(osmkey, "/").concat(osmvalue));
78388 const preset = _mainPresetIndex.matchTags(tags, "area");
78389 if (buildingPreset[preset.id]) {
78390 alternate.add("building/yes");
78392 return { primary, alternate };
78394 function identifyTree(tags) {
78397 Object.keys(tags).forEach((osmkey) => {
78400 const osmvalue = tags[osmkey];
78403 if (osmkey === "route_master")
78405 const vmap = _nsi.kvt.get(osmkey);
78408 if (osmvalue === "yes") {
78409 unknown = "unknown";
78411 t2 = vmap.get(osmvalue);
78414 return t2 || unknown || null;
78416 function gatherNames(tags) {
78417 const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
78418 let primary = /* @__PURE__ */ new Set();
78419 let alternate = /* @__PURE__ */ new Set();
78420 let foundSemi = false;
78421 let testNameFragments = false;
78423 let t2 = identifyTree(tags);
78426 if (t2 === "transit") {
78428 primary: /^network$/i,
78429 alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
78431 } else if (t2 === "flags") {
78433 primary: /^(flag:name|flag:name:\w+)$/i,
78434 alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
78435 // note: no `country`, we special-case it below
78437 } else if (t2 === "brands") {
78438 testNameFragments = true;
78440 primary: /^(name|name:\w+)$/i,
78441 alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
78443 } else if (t2 === "operators") {
78444 testNameFragments = true;
78446 primary: /^(name|name:\w+|operator|operator:\w+)$/i,
78447 alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
78450 testNameFragments = true;
78452 primary: /^(name|name:\w+)$/i,
78453 alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
78456 if (tags.name && testNameFragments) {
78457 const nameParts = tags.name.split(/[\s\-\/,.]/);
78458 for (let split = nameParts.length; split > 0; split--) {
78459 const name = nameParts.slice(0, split).join(" ");
78463 Object.keys(tags).forEach((osmkey) => {
78464 const osmvalue = tags[osmkey];
78467 if (isNamelike(osmkey, "primary")) {
78468 if (/;/.test(osmvalue)) {
78471 primary.add(osmvalue);
78472 alternate.delete(osmvalue);
78474 } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
78475 if (/;/.test(osmvalue)) {
78478 alternate.add(osmvalue);
78482 if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
78483 const osmvalue = tags.country;
78484 if (/;/.test(osmvalue)) {
78487 alternate.add(osmvalue);
78493 return { primary, alternate };
78495 function isNamelike(osmkey, which) {
78496 if (osmkey === "old_name")
78498 return patterns2[which].test(osmkey) && !notNames.test(osmkey);
78501 function gatherTuples(tryKVs, tryNames) {
78503 ["primary", "alternate"].forEach((whichName) => {
78504 const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
78505 arr.forEach((n3) => {
78506 ["primary", "alternate"].forEach((whichKV) => {
78507 tryKVs[whichKV].forEach((kv) => {
78508 const parts = kv.split("/", 2);
78509 const k2 = parts[0];
78510 const v2 = parts[1];
78511 tuples.push({ k: k2, v: v2, n: n3 });
78518 function _upgradeTags(tags, loc) {
78519 let newTags = Object.assign({}, tags);
78520 let changed = false;
78521 Object.keys(newTags).forEach((osmkey) => {
78522 const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
78524 const prefix = matchTag[1] || "";
78525 const wd = newTags[osmkey];
78526 const replace = _nsi.replacements[wd];
78527 if (replace && replace.wikidata !== void 0) {
78529 if (replace.wikidata) {
78530 newTags[osmkey] = replace.wikidata;
78532 delete newTags[osmkey];
78535 if (replace && replace.wikipedia !== void 0) {
78537 const wpkey = "".concat(prefix, "wikipedia");
78538 if (replace.wikipedia) {
78539 newTags[wpkey] = replace.wikipedia;
78541 delete newTags[wpkey];
78546 const isRouteMaster = tags.type === "route_master";
78547 const tryKVs = gatherKVs(tags);
78548 if (!tryKVs.primary.size && !tryKVs.alternate.size) {
78549 return changed ? { newTags, matched: null } : null;
78551 const tryNames = gatherNames(tags);
78552 const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
78554 tryNames.primary.add(foundQID);
78555 if (!tryNames.primary.size && !tryNames.alternate.size) {
78556 return changed ? { newTags, matched: null } : null;
78558 const tuples = gatherTuples(tryKVs, tryNames);
78559 for (let i3 = 0; i3 < tuples.length; i3++) {
78560 const tuple = tuples[i3];
78561 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
78562 if (!hits || !hits.length)
78564 if (hits[0].match !== "primary" && hits[0].match !== "alternate")
78567 for (let j2 = 0; j2 < hits.length; j2++) {
78568 const hit = hits[j2];
78569 itemID = hit.itemID;
78570 if (_nsi.dissolved[itemID])
78572 item = _nsi.ids.get(itemID);
78575 const mainTag = item.mainTag;
78576 const itemQID = item.tags[mainTag];
78577 const notQID = newTags["not:".concat(mainTag)];
78579 // Exceptions, skip this hit
78580 !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
78581 newTags.office && !item.tags.office
78591 item = JSON.parse(JSON.stringify(item));
78592 const tkv = item.tkv;
78593 const parts = tkv.split("/", 3);
78594 const k2 = parts[1];
78595 const v2 = parts[2];
78596 const category = _nsi.data[tkv];
78597 const properties = category.properties || {};
78598 let preserveTags = item.preserveTags || properties.preserveTags || [];
78599 ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
78601 preserveTags.push("^".concat(osmkey, "$"));
78603 const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
78605 Object.keys(newTags).forEach((osmkey) => {
78606 if (regexes.some((regex) => regex.test(osmkey))) {
78607 keepTags[osmkey] = newTags[osmkey];
78610 _nsi.kvt.forEach((vmap, k3) => {
78611 if (newTags[k3] === "yes")
78612 delete newTags[k3];
78615 delete newTags.wikipedia;
78616 delete newTags.wikidata;
78618 Object.assign(newTags, item.tags, keepTags);
78619 if (isRouteMaster) {
78620 newTags.route_master = newTags.route;
78621 delete newTags.route;
78623 const origName = tags.name;
78624 const newName = newTags.name;
78625 if (newName && origName && newName !== origName && !newTags.branch) {
78626 const newNames = gatherNames(newTags);
78627 const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
78628 const isMoved = newSet.has(origName);
78630 const nameParts = origName.split(/[\s\-\/,.]/);
78631 for (let split = nameParts.length; split > 0; split--) {
78632 const name = nameParts.slice(0, split).join(" ");
78633 const branch = nameParts.slice(split).join(" ");
78634 const nameHits = _nsi.matcher.match(k2, v2, name, loc);
78635 if (!nameHits || !nameHits.length)
78637 if (nameHits.some((hit) => hit.itemID === itemID)) {
78639 if (notBranches.test(branch)) {
78640 newTags.name = origName;
78642 const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
78643 if (branchHits && branchHits.length) {
78644 if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
78648 newTags.branch = branch;
78657 return { newTags, matched: item };
78659 return changed ? { newTags, matched: null } : null;
78661 function _isGenericName(tags) {
78662 const n3 = tags.name;
78665 const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
78666 const tryKVs = gatherKVs(tags);
78667 if (!tryKVs.primary.size && !tryKVs.alternate.size)
78669 const tuples = gatherTuples(tryKVs, tryNames);
78670 for (let i3 = 0; i3 < tuples.length; i3++) {
78671 const tuple = tuples[i3];
78672 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
78673 if (hits && hits.length && hits[0].match === "excludeGeneric")
78678 var nsi_default = {
78680 // On init, start preparing the name-suggestion-index
78684 _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
78687 // Reset is called when user saves data to OSM (does nothing here)
78692 // To let other code know how it's going...
78695 // `String`: 'loading', 'ok', 'failed'
78697 status: () => _nsiStatus,
78698 // `isGenericName()`
78699 // Is the `name` tag generic?
78702 // `tags`: `Object` containing the feature's OSM tags
78704 // `true` if it is generic, `false` if not
78706 isGenericName: (tags) => _isGenericName(tags),
78708 // Suggest tag upgrades.
78709 // This function will not modify the input tags, it makes a copy.
78712 // `tags`: `Object` containing the feature's OSM tags
78713 // `loc`: Location where this feature exists, as a [lon, lat]
78715 // `Object` containing the result, or `null` if no changes needed:
78717 // 'newTags': `Object` - The tags the the feature should have
78718 // 'matched': `Object` - The matched item
78721 upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
78723 // Direct access to the NSI cache, useful for testing or breaking things
78726 // `Object`: the internal NSI cache
78731 // modules/services/kartaview.js
78732 var import_rbush8 = __toESM(require_rbush_min());
78733 var apibase2 = "https://kartaview.org";
78734 var maxResults = 1e3;
78736 var tiler4 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
78737 var dispatch7 = dispatch_default("loadedImages");
78738 var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
78740 var _oscSelectedImage;
78741 var _loadViewerPromise2;
78742 function abortRequest4(controller) {
78743 controller.abort();
78745 function maxPageAtZoom(z2) {
78759 function loadTiles2(which, url, projection2) {
78760 var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
78761 var tiles = tiler4.getTiles(projection2);
78762 var cache = _oscCache[which];
78763 Object.keys(cache.inflight).forEach(function(k2) {
78764 var wanted = tiles.find(function(tile) {
78765 return k2.indexOf(tile.id + ",") === 0;
78768 abortRequest4(cache.inflight[k2]);
78769 delete cache.inflight[k2];
78772 tiles.forEach(function(tile) {
78773 loadNextTilePage(which, currZoom, url, tile);
78776 function loadNextTilePage(which, currZoom, url, tile) {
78777 var cache = _oscCache[which];
78778 var bbox2 = tile.extent.bbox();
78779 var maxPages = maxPageAtZoom(currZoom);
78780 var nextPage = cache.nextPage[tile.id] || 1;
78781 var params = utilQsString({
78784 // client_id: clientId,
78785 bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
78786 bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
78788 if (nextPage > maxPages)
78790 var id2 = tile.id + "," + String(nextPage);
78791 if (cache.loaded[id2] || cache.inflight[id2])
78793 var controller = new AbortController();
78794 cache.inflight[id2] = controller;
78797 signal: controller.signal,
78799 headers: { "Content-Type": "application/x-www-form-urlencoded" }
78801 json_default(url, options2).then(function(data) {
78802 cache.loaded[id2] = true;
78803 delete cache.inflight[id2];
78804 if (!data || !data.currentPageItems || !data.currentPageItems.length) {
78805 throw new Error("No Data");
78807 var features = data.currentPageItems.map(function(item) {
78808 var loc = [+item.lng, +item.lat];
78810 if (which === "images") {
78815 captured_at: item.shot_date || item.date_added,
78816 captured_by: item.username,
78817 imagePath: item.lth_name,
78818 sequence_id: item.sequence_id,
78819 sequence_index: +item.sequence_index
78821 var seq = _oscCache.sequences[d2.sequence_id];
78823 seq = { rotation: 0, images: [] };
78824 _oscCache.sequences[d2.sequence_id] = seq;
78826 seq.images[d2.sequence_index] = d2;
78827 _oscCache.images.forImageKey[d2.key] = d2;
78837 cache.rtree.load(features);
78838 if (data.currentPageItems.length === maxResults) {
78839 cache.nextPage[tile.id] = nextPage + 1;
78840 loadNextTilePage(which, currZoom, url, tile);
78842 cache.nextPage[tile.id] = Infinity;
78844 if (which === "images") {
78845 dispatch7.call("loadedImages");
78847 }).catch(function() {
78848 cache.loaded[id2] = true;
78849 delete cache.inflight[id2];
78852 function partitionViewport2(projection2) {
78853 var z2 = geoScaleToZoom(projection2.scale());
78854 var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
78855 var tiler9 = utilTiler().zoomExtent([z22, z22]);
78856 return tiler9.getTiles(projection2).map(function(tile) {
78857 return tile.extent;
78860 function searchLimited2(limit, projection2, rtree) {
78861 limit = limit || 5;
78862 return partitionViewport2(projection2).reduce(function(result, extent) {
78863 var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
78866 return found.length ? result.concat(found) : result;
78869 var kartaview_default = {
78874 this.event = utilRebind(this, dispatch7, "on");
78876 reset: function() {
78878 Object.values(_oscCache.images.inflight).forEach(abortRequest4);
78881 images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush8.default(), forImageKey: {} },
78884 _oscSelectedImage = null;
78886 images: function(projection2) {
78888 return searchLimited2(limit, projection2, _oscCache.images.rtree);
78890 sequences: function(projection2) {
78891 var viewport = projection2.clipExtent();
78892 var min3 = [viewport[0][0], viewport[1][1]];
78893 var max3 = [viewport[1][0], viewport[0][1]];
78894 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78895 var sequenceKeys = {};
78896 _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
78897 sequenceKeys[d2.data.sequence_id] = true;
78899 var lineStrings = [];
78900 Object.keys(sequenceKeys).forEach(function(sequenceKey) {
78901 var seq = _oscCache.sequences[sequenceKey];
78902 var images = seq && seq.images;
78905 type: "LineString",
78906 coordinates: images.map(function(d2) {
78908 }).filter(Boolean),
78910 captured_at: images[0] ? images[0].captured_at : null,
78911 captured_by: images[0] ? images[0].captured_by : null,
78917 return lineStrings;
78919 cachedImage: function(imageKey) {
78920 return _oscCache.images.forImageKey[imageKey];
78922 loadImages: function(projection2) {
78923 var url = apibase2 + "/1.0/list/nearby-photos/";
78924 loadTiles2("images", url, projection2);
78926 ensureViewerLoaded: function(context) {
78927 if (_loadViewerPromise2)
78928 return _loadViewerPromise2;
78929 var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
78931 var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
78932 wrapEnter.append("div").attr("class", "photo-attribution fillD");
78933 var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
78934 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
78935 controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
78936 controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
78937 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
78938 wrapEnter.append("div").attr("class", "kartaview-image-wrap");
78939 context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
78940 imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
78942 function zoomPan2(d3_event) {
78943 var t2 = d3_event.transform;
78944 context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
78946 function rotate(deg) {
78947 return function() {
78948 if (!_oscSelectedImage)
78950 var sequenceKey = _oscSelectedImage.sequence_id;
78951 var sequence = _oscCache.sequences[sequenceKey];
78954 var r2 = sequence.rotation || 0;
78960 sequence.rotation = r2;
78961 var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
78962 wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
78963 wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
78966 function step(stepBy) {
78967 return function() {
78968 if (!_oscSelectedImage)
78970 var sequenceKey = _oscSelectedImage.sequence_id;
78971 var sequence = _oscCache.sequences[sequenceKey];
78974 var nextIndex = _oscSelectedImage.sequence_index + stepBy;
78975 var nextImage = sequence.images[nextIndex];
78978 context.map().centerEase(nextImage.loc);
78979 that.selectImage(context, nextImage.key);
78982 _loadViewerPromise2 = Promise.resolve();
78983 return _loadViewerPromise2;
78985 showViewer: function(context) {
78986 var viewer = context.container().select(".photoviewer").classed("hide", false);
78987 var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
78989 viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
78990 viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
78994 hideViewer: function(context) {
78995 _oscSelectedImage = null;
78996 this.updateUrlImage(null);
78997 var viewer = context.container().select(".photoviewer");
78998 if (!viewer.empty())
78999 viewer.datum(null);
79000 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79001 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79002 return this.setStyles(context, null, true);
79004 selectImage: function(context, imageKey) {
79005 var d2 = this.cachedImage(imageKey);
79006 _oscSelectedImage = d2;
79007 this.updateUrlImage(imageKey);
79008 var viewer = context.container().select(".photoviewer");
79009 if (!viewer.empty())
79011 this.setStyles(context, null, true);
79012 context.container().selectAll(".icon-sign").classed("currentView", false);
79015 var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
79016 var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
79017 var attribution = wrap2.selectAll(".photo-attribution").text("");
79018 wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
79019 imageWrap.selectAll(".kartaview-image").remove();
79021 var sequence = _oscCache.sequences[d2.sequence_id];
79022 var r2 = sequence && sequence.rotation || 0;
79023 imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
79024 if (d2.captured_by) {
79025 attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
79026 attribution.append("span").text("|");
79028 if (d2.captured_at) {
79029 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
79030 attribution.append("span").text("|");
79032 attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://kartaview.org/details/" + d2.sequence_id + "/" + d2.sequence_index).text("kartaview.org");
79035 function localeDateString2(s2) {
79038 var options2 = { day: "numeric", month: "short", year: "numeric" };
79039 var d4 = new Date(s2);
79040 if (isNaN(d4.getTime()))
79042 return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
79045 getSelectedImage: function() {
79046 return _oscSelectedImage;
79048 getSequenceKeyForImage: function(d2) {
79049 return d2 && d2.sequence_id;
79051 // Updates the currently highlighted sequence and selected bubble.
79052 // Reset is only necessary when interacting with the viewport because
79053 // this implicitly changes the currently selected bubble/sequence
79054 setStyles: function(context, hovered, reset) {
79056 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79057 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79059 var hoveredImageKey = hovered && hovered.key;
79060 var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
79061 var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
79062 var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
79065 var viewer = context.container().select(".photoviewer");
79066 var selected = viewer.empty() ? void 0 : viewer.datum();
79067 var selectedImageKey = selected && selected.key;
79068 var selectedSequenceKey = this.getSequenceKeyForImage(selected);
79069 var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
79070 var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
79073 var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
79074 context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
79075 return highlightedImageKeys.indexOf(d2.key) !== -1;
79076 }).classed("hovered", function(d2) {
79077 return d2.key === hoveredImageKey;
79078 }).classed("currentView", function(d2) {
79079 return d2.key === selectedImageKey;
79081 context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
79082 return d2.properties.key === hoveredSequenceKey;
79083 }).classed("currentView", function(d2) {
79084 return d2.properties.key === selectedSequenceKey;
79086 context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
79087 function viewfieldPath() {
79088 var d2 = this.parentNode.__data__;
79089 if (d2.pano && d2.key !== selectedImageKey) {
79090 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79092 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79097 updateUrlImage: function(imageKey) {
79098 if (!window.mocha) {
79099 var hash = utilStringQs(window.location.hash);
79101 hash.photo = "kartaview/" + imageKey;
79105 window.location.replace("#" + utilQsString(hash, true));
79108 cache: function() {
79113 // modules/services/vegbilder.js
79114 var import_rbush9 = __toESM(require_rbush_min());
79116 // modules/services/pannellum_photo.js
79117 var pannellumViewerCSS = "pannellum/pannellum.css";
79118 var pannellumViewerJS = "pannellum/pannellum.js";
79119 var dispatch8 = dispatch_default("viewerChanged");
79120 var _currScenes = [];
79121 var _pannellumViewer;
79122 var pannellum_photo_default = {
79123 init: async function(context, selection2) {
79124 selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true);
79125 if (!window.pannellum) {
79126 await this.loadPannellum(context);
79129 "default": { firstScene: "" },
79132 _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
79133 _pannellumViewer.on("mousedown", () => {
79134 select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
79135 dispatch8.call("viewerChanged");
79137 }).on("mouseup", () => {
79138 select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
79139 }).on("animatefinished", () => {
79140 dispatch8.call("viewerChanged");
79142 context.ui().photoviewer.on("resize.pannellum", () => {
79143 _pannellumViewer.resize();
79145 this.event = utilRebind(this, dispatch8, "on");
79148 loadPannellum: function(context) {
79149 const head = select_default2("head");
79150 return Promise.all([
79151 new Promise((resolve, reject) => {
79152 head.selectAll("#ideditor-pannellum-viewercss").data([0]).enter().append("link").attr("id", "ideditor-pannellum-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS)).on("load.pannellum", resolve).on("error.pannellum", reject);
79154 new Promise((resolve, reject) => {
79155 head.selectAll("#ideditor-pannellum-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-pannellum-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS)).on("load.pannellum", resolve).on("error.pannellum", reject);
79159 showPhotoFrame: function(context) {
79160 const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
79162 context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
79163 context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
79167 hidePhotoFrame: function(viewerContext) {
79168 viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
79171 selectPhoto: function(data, keepOrientation) {
79172 const { key } = data;
79173 if (!(key in _currScenes)) {
79174 let newSceneOptions = {
79175 showFullscreenCtrl: false,
79179 type: "equirectangular",
79180 preview: data.preview_path,
79181 panorama: data.image_path,
79182 northOffset: data.ca
79184 _currScenes.push(key);
79185 _pannellumViewer.addScene(key, newSceneOptions);
79189 if (keepOrientation) {
79190 yaw = this.getYaw();
79191 pitch = _pannellumViewer.getPitch();
79193 _pannellumViewer.loadScene(key, pitch, yaw);
79194 dispatch8.call("viewerChanged");
79195 if (_currScenes.length > 3) {
79196 const old_key = _currScenes.shift();
79197 _pannellumViewer.removeScene(old_key);
79201 getYaw: function() {
79202 return _pannellumViewer.getYaw();
79206 // modules/services/vegbilder.js
79207 var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
79208 var tileZoom2 = 14;
79209 var tiler5 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
79210 var dispatch9 = dispatch_default("loadedImages", "viewerChanged");
79211 var directionEnum = Object.freeze({
79212 forward: Symbol(0),
79213 backward: Symbol(1)
79216 var _pannellumFrame;
79218 var _loadViewerPromise3;
79219 var _vegbilderCache;
79220 async function fetchAvailableLayers() {
79224 request: "GetCapabilities",
79227 const urlForRequest = owsEndpoint + utilQsString(params);
79228 const response = await xml_default(urlForRequest);
79229 const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
79230 const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
79231 const NSResolver = response.createNSResolver(response);
79232 const l2 = response.evaluate(
79236 XPathResult.ANY_TYPE
79239 const availableLayers = [];
79240 while ((node = l2.iterateNext()) !== null) {
79241 const match = (_a2 = node.textContent) == null ? void 0 : _a2.match(regexMatcher);
79243 availableLayers.push({
79245 is_sphere: !!((_b = match.groups) == null ? void 0 : _b.image_type),
79246 year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
79250 return availableLayers;
79252 function filterAvailableLayers(photoContex) {
79253 const fromDateString = photoContex.fromDate();
79254 const toDateString = photoContex.toDate();
79255 const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
79256 const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
79257 const showsFlat = photoContex.showsFlat();
79258 const showsPano = photoContex.showsPanoramic();
79259 return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
79261 function loadWFSLayers(projection2, margin, wfslayers) {
79262 const tiles = tiler5.margin(margin).getTiles(projection2);
79263 for (const cache of wfslayers) {
79264 loadWFSLayer(projection2, cache, tiles);
79267 function loadWFSLayer(projection2, cache, tiles) {
79268 for (const [key, controller] of cache.inflight.entries()) {
79269 const wanted = tiles.some((tile) => key === tile.id);
79271 controller.abort();
79272 cache.inflight.delete(key);
79275 Promise.all(tiles.map(
79276 (tile) => loadTile2(cache, cache.layerInfo.name, tile)
79277 )).then(() => orderSequences(projection2, cache));
79279 async function loadTile2(cache, typename, tile) {
79280 const bbox2 = tile.extent.bbox();
79281 const tileid = tile.id;
79282 if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid))
79286 request: "GetFeature",
79288 typenames: typename,
79289 bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
79290 outputFormat: "json"
79292 const controller = new AbortController();
79293 cache.inflight.set(tileid, controller);
79296 signal: controller.signal
79298 const urlForRequest = owsEndpoint + utilQsString(params);
79299 let featureCollection;
79301 featureCollection = await json_default(urlForRequest, options2);
79303 cache.loaded.set(tileid, false);
79306 cache.inflight.delete(tileid);
79308 cache.loaded.set(tileid, true);
79309 if (featureCollection.features.length === 0) {
79312 const features = featureCollection.features.map((feature3) => {
79313 const loc = feature3.geometry.coordinates;
79314 const key = feature3.id;
79315 const properties = feature3.properties;
79318 TIDSPUNKT: captured_at,
79320 URLPREVIEW: preview_path,
79321 BILDETYPE: image_type,
79323 FELTKODE: lane_code
79325 const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
79326 const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
79333 road_reference: roadReference(properties),
79337 captured_at: new Date(captured_at),
79338 is_sphere: image_type === "360"
79340 cache.points.set(key, data);
79349 _vegbilderCache.rtree.load(features);
79350 dispatch9.call("loadedImages");
79352 function orderSequences(projection2, cache) {
79353 const { points } = cache;
79354 const grouped = Array.from(points.values()).reduce((grouped2, image) => {
79355 const key = image.road_reference;
79356 if (grouped2.has(key)) {
79357 grouped2.get(key).push(image);
79359 grouped2.set(key, [image]);
79362 }, /* @__PURE__ */ new Map());
79363 const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
79364 imageGroup.sort((a2, b2) => {
79365 if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
79367 } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
79370 const { direction } = a2;
79371 if (direction === directionEnum.forward) {
79372 return a2.metering - b2.metering;
79374 return b2.metering - a2.metering;
79378 let imageSequence = [imageGroup[0]];
79380 for (const [lastImage, image] of pairs(imageGroup)) {
79381 if (lastImage.ca === null) {
79382 const b2 = projection2(lastImage.loc);
79383 const a2 = projection2(image.loc);
79384 if (!geoVecEqual(a2, b2)) {
79385 angle2 = geoVecAngle(a2, b2);
79386 angle2 *= 180 / Math.PI;
79388 angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
79390 lastImage.ca = angle2;
79392 if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
79393 imageSequence.push(image);
79395 imageSequences2.push(imageSequence);
79396 imageSequence = [image];
79399 imageSequences2.push(imageSequence);
79400 return imageSequences2;
79402 cache.sequences = imageSequences.map((images) => {
79405 key: images[0].key,
79407 type: "LineString",
79408 coordinates: images.map((image) => image.loc)
79411 for (const image of images) {
79412 _vegbilderCache.image2sequence_map.set(image.key, sequence);
79417 function roadReference(properties) {
79419 FYLKENUMMER: county_number,
79420 VEGKATEGORI: road_class,
79421 VEGSTATUS: road_status,
79422 VEGNUMMER: road_number,
79423 STREKNING: section,
79424 DELSTREKNING: subsection,
79426 KRYSSDEL: junction_part,
79427 SIDEANLEGGSDEL: services_part,
79428 ANKERPUNKT: anker_point,
79432 if (year >= 2020) {
79433 reference = "".concat(road_class).concat(road_status).concat(road_number, " S").concat(section, "D").concat(subsection);
79434 if (junction_part) {
79435 reference = "".concat(reference, " M").concat(anker_point, " KD").concat(junction_part);
79436 } else if (services_part) {
79437 reference = "".concat(reference, " M").concat(anker_point, " SD").concat(services_part);
79440 reference = "".concat(county_number).concat(road_class).concat(road_status).concat(road_number, " HP").concat(parcel);
79444 function localeTimestamp(date) {
79453 return date.toLocaleString(_mainLocalizer.localeCode(), options2);
79455 function partitionViewport3(projection2) {
79456 const zoom = geoScaleToZoom(projection2.scale());
79457 const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
79458 const tiler9 = utilTiler().zoomExtent([roundZoom, roundZoom]);
79459 return tiler9.getTiles(projection2).map((tile) => tile.extent);
79461 function searchLimited3(limit, projection2, rtree) {
79462 limit != null ? limit : limit = 5;
79463 return partitionViewport3(projection2).reduce((result, extent) => {
79464 const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79465 return result.concat(found);
79468 var vegbilder_default = {
79470 this.event = utilRebind(this, dispatch9, "on");
79472 reset: async function() {
79473 if (_vegbilderCache) {
79474 for (const layer of _vegbilderCache.wfslayers.values()) {
79475 for (const controller of layer.inflight.values()) {
79476 controller.abort();
79480 _vegbilderCache = {
79481 wfslayers: /* @__PURE__ */ new Map(),
79482 rtree: new import_rbush9.default(),
79483 image2sequence_map: /* @__PURE__ */ new Map()
79485 const availableLayers = await fetchAvailableLayers();
79486 const { wfslayers } = _vegbilderCache;
79487 for (const layerInfo of availableLayers) {
79490 loaded: /* @__PURE__ */ new Map(),
79491 inflight: /* @__PURE__ */ new Map(),
79492 points: /* @__PURE__ */ new Map(),
79495 wfslayers.set(layerInfo.name, cache);
79498 images: function(projection2) {
79500 return searchLimited3(limit, projection2, _vegbilderCache.rtree);
79502 sequences: function(projection2) {
79503 const viewport = projection2.clipExtent();
79504 const min3 = [viewport[0][0], viewport[1][1]];
79505 const max3 = [viewport[1][0], viewport[0][1]];
79506 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79507 const seen = /* @__PURE__ */ new Set();
79508 const line_strings = [];
79509 for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
79510 const sequence = _vegbilderCache.image2sequence_map.get(data.key);
79513 const { key, geometry, images } = sequence;
79518 type: "LineString",
79519 coordinates: geometry.coordinates,
79523 line_strings.push(line);
79525 return line_strings;
79527 cachedImage: function(key) {
79528 for (const { points } of _vegbilderCache.wfslayers.values()) {
79529 if (points.has(key))
79530 return points.get(key);
79533 getSequenceForImage: function(image) {
79534 return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
79536 loadImages: async function(context, margin) {
79537 if (!_vegbilderCache) {
79538 await this.reset();
79540 margin != null ? margin : margin = 1;
79541 const wfslayers = filterAvailableLayers(context.photos());
79542 loadWFSLayers(context.projection, margin, wfslayers);
79544 photoFrame: function() {
79545 return _currentFrame;
79547 ensureViewerLoaded: function(context) {
79548 if (_loadViewerPromise3)
79549 return _loadViewerPromise3;
79550 const step = (stepBy) => () => {
79551 const viewer = context.container().select(".photoviewer");
79552 const selected = viewer.empty() ? void 0 : viewer.datum();
79555 const sequence = this.getSequenceForImage(selected);
79556 const nextIndex = sequence.images.indexOf(selected) + stepBy;
79557 const nextImage = sequence.images[nextIndex];
79560 context.map().centerEase(nextImage.loc);
79561 this.selectImage(context, nextImage.key, true);
79563 const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
79564 const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
79565 wrapEnter.append("div").attr("class", "photo-attribution fillD");
79566 const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79567 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79568 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79569 _loadViewerPromise3 = Promise.all([
79570 pannellum_photo_default.init(context, wrapEnter),
79571 plane_photo_default.init(context, wrapEnter)
79572 ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
79573 _pannellumFrame = pannellumPhotoFrame;
79574 _pannellumFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
79575 _planeFrame = planePhotoFrame;
79576 _planeFrame.event.on("viewerChanged", () => dispatch9.call("viewerChanged"));
79578 return _loadViewerPromise3;
79580 selectImage: function(context, key, keepOrientation) {
79581 const d2 = this.cachedImage(key);
79582 this.updateUrlImage(key);
79583 const viewer = context.container().select(".photoviewer");
79584 if (!viewer.empty()) {
79587 this.setStyles(context, null, true);
79590 const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
79591 const attribution = wrap2.selectAll(".photo-attribution").text("");
79592 if (d2.captured_at) {
79593 attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
79595 attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
79596 attribution.append("a").attr("target", "_blank").attr("href", "https://vegbilder.atlas.vegvesen.no/?year=".concat(d2.captured_at.getFullYear(), "&lat=").concat(d2.loc[1], "&lng=").concat(d2.loc[0], "&view=image&imageId=").concat(d2.key)).call(_t.append("vegbilder.view_on"));
79597 _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
79598 _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
79601 showViewer: function(context) {
79602 const viewer = context.container().select(".photoviewer").classed("hide", false);
79603 const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
79605 viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
79606 viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
79610 hideViewer: function(context) {
79611 this.updateUrlImage(null);
79612 const viewer = context.container().select(".photoviewer");
79613 if (!viewer.empty())
79614 viewer.datum(null);
79615 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79616 context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
79617 return this.setStyles(context, null, true);
79619 // Updates the currently highlighted sequence and selected bubble.
79620 // Reset is only necessary when interacting with the viewport because
79621 // this implicitly changes the currently selected bubble/sequence
79622 setStyles: function(context, hovered, reset) {
79625 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79626 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79628 const hoveredImageKey = hovered == null ? void 0 : hovered.key;
79629 const hoveredSequence = this.getSequenceForImage(hovered);
79630 const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
79631 const hoveredImageKeys = (_a2 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a2 : [];
79632 const viewer = context.container().select(".photoviewer");
79633 const selected = viewer.empty() ? void 0 : viewer.datum();
79634 const selectedImageKey = selected == null ? void 0 : selected.key;
79635 const selectedSequence = this.getSequenceForImage(selected);
79636 const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
79637 const selectedImageKeys = (_b = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b : [];
79638 const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
79639 context.container().selectAll(".layer-vegbilder .viewfield-group").classed("highlighted", (d2) => highlightedImageKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredImageKey).classed("currentView", (d2) => d2.key === selectedImageKey);
79640 context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
79641 context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
79642 function viewfieldPath() {
79643 const d2 = this.parentNode.__data__;
79644 if (d2.is_sphere && d2.key !== selectedImageKey) {
79645 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79647 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79652 updateUrlImage: function(key) {
79653 if (!window.mocha) {
79654 const hash = utilStringQs(window.location.hash);
79656 hash.photo = "vegbilder/" + key;
79660 window.location.replace("#" + utilQsString(hash, true));
79663 validHere: function(extent) {
79664 const bbox2 = Object.values(extent.bbox());
79665 return iso1A2Codes(bbox2).includes("NO");
79667 cache: function() {
79668 return _vegbilderCache;
79672 // node_modules/osm-auth/src/osm-auth.mjs
79673 function osmAuth(o2) {
79677 _store = window.localStorage;
79679 var _mock = /* @__PURE__ */ new Map();
79682 hasItem: (k2) => _mock.has(k2),
79683 getItem: (k2) => _mock.get(k2),
79684 setItem: (k2, v2) => _mock.set(k2, v2),
79685 removeItem: (k2) => _mock.delete(k2),
79686 clear: () => _mock.clear()
79689 function token(k2, v2) {
79690 if (arguments.length === 1)
79691 return _store.getItem(o2.url + k2);
79692 else if (arguments.length === 2)
79693 return _store.setItem(o2.url + k2, v2);
79695 oauth2.authenticated = function() {
79696 return !!token("oauth2_access_token");
79698 oauth2.logout = function() {
79699 token("oauth2_access_token", "");
79700 token("oauth_token", "");
79701 token("oauth_token_secret", "");
79702 token("oauth_request_token_secret", "");
79705 oauth2.authenticate = function(callback) {
79706 if (oauth2.authenticated()) {
79707 callback(null, oauth2);
79711 _preopenPopup(function(error, popup) {
79715 _generatePkceChallenge(function(pkce) {
79716 _authenticate(pkce, popup, callback);
79721 oauth2.authenticateAsync = function() {
79722 if (oauth2.authenticated()) {
79723 return Promise.resolve(oauth2);
79726 return new Promise((resolve, reject) => {
79727 var errback = (err, result) => {
79734 _preopenPopup((error, popup) => {
79738 _generatePkceChallenge((pkce) => _authenticate(pkce, popup, errback));
79743 function _preopenPopup(callback) {
79744 if (o2.singlepage) {
79745 callback(null, void 0);
79753 ["left", window.screen.width / 2 - w2 / 2],
79754 ["top", window.screen.height / 2 - h2 / 2]
79755 ].map(function(x2) {
79756 return x2.join("=");
79758 var popup = window.open("about:blank", "oauth_window", settings);
79760 callback(null, popup);
79762 var error = new Error("Popup was blocked");
79763 error.status = "popup-blocked";
79767 function _authenticate(pkce, popup, callback) {
79768 var state = generateState();
79769 var url = o2.url + "/oauth2/authorize?" + utilQsString2({
79770 client_id: o2.client_id,
79771 redirect_uri: o2.redirect_uri,
79772 response_type: "code",
79775 code_challenge: pkce.code_challenge,
79776 code_challenge_method: pkce.code_challenge_method
79778 if (o2.singlepage) {
79779 if (_store.isMocked) {
79780 var error = new Error("localStorage unavailable, but required in singlepage mode");
79781 error.status = "pkce-localstorage-unavailable";
79785 var params = utilStringQs2(window.location.search.slice(1));
79787 oauth2.bootstrapToken(params.code, callback);
79789 token("oauth2_state", state);
79790 token("oauth2_pkce_code_verifier", pkce.code_verifier);
79791 window.location = url;
79794 oauth2.popupWindow = popup;
79795 popup.location = url;
79797 window.authComplete = function(url2) {
79798 var params2 = utilStringQs2(url2.split("?")[1]);
79799 if (params2.state !== state) {
79800 error = new Error("Invalid state");
79801 error.status = "invalid-state";
79805 _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
79806 delete window.authComplete;
79808 function accessTokenDone(err, xhr) {
79814 var access_token = JSON.parse(xhr.response);
79815 token("oauth2_access_token", access_token.access_token);
79816 callback(null, oauth2);
79819 function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
79820 var url = o2.url + "/oauth2/token?" + utilQsString2({
79821 client_id: o2.client_id,
79822 redirect_uri: o2.redirect_uri,
79823 grant_type: "authorization_code",
79827 oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
79830 oauth2.bringPopupWindowToFront = function() {
79831 var broughtPopupToFront = false;
79833 if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
79834 oauth2.popupWindow.focus();
79835 broughtPopupToFront = true;
79839 return broughtPopupToFront;
79841 oauth2.bootstrapToken = function(auth_code, callback) {
79842 var state = token("oauth2_state");
79843 token("oauth2_state", "");
79844 var params = utilStringQs2(window.location.search.slice(1));
79845 if (params.state !== state) {
79846 var error = new Error("Invalid state");
79847 error.status = "invalid-state";
79851 var code_verifier = token("oauth2_pkce_code_verifier");
79852 token("oauth2_pkce_code_verifier", "");
79853 _getAccessToken(auth_code, code_verifier, accessTokenDone);
79854 function accessTokenDone(err, xhr) {
79860 var access_token = JSON.parse(xhr.response);
79861 token("oauth2_access_token", access_token.access_token);
79862 callback(null, oauth2);
79865 oauth2.fetch = function(resource, options2) {
79866 if (oauth2.authenticated()) {
79870 return oauth2.authenticateAsync().then(_doFetch);
79872 return Promise.reject(new Error("not authenticated"));
79875 function _doFetch() {
79876 options2 = options2 || {};
79877 if (!options2.headers) {
79878 options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
79880 options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
79881 return fetch(resource, options2);
79884 oauth2.xhr = function(options2, callback) {
79885 if (oauth2.authenticated()) {
79889 oauth2.authenticate(_doXHR);
79892 callback("not authenticated", null);
79896 function _doXHR() {
79897 var url = options2.prefix !== false ? o2.apiUrl + options2.path : options2.path;
79898 return oauth2.rawxhr(
79901 token("oauth2_access_token"),
79907 function done(err, xhr) {
79910 } else if (xhr.responseXML) {
79911 callback(err, xhr.responseXML);
79913 callback(err, xhr.response);
79917 oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
79918 headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
79919 if (access_token) {
79920 headers.Authorization = "Bearer " + access_token;
79922 var xhr = new XMLHttpRequest();
79923 xhr.onreadystatechange = function() {
79924 if (4 === xhr.readyState && 0 !== xhr.status) {
79925 if (/^20\d$/.test(xhr.status)) {
79926 callback(null, xhr);
79928 callback(xhr, null);
79932 xhr.onerror = function(e3) {
79933 callback(e3, null);
79935 xhr.open(method, url, true);
79936 for (var h2 in headers)
79937 xhr.setRequestHeader(h2, headers[h2]);
79941 oauth2.preauth = function(val) {
79942 if (val && val.access_token) {
79943 token("oauth2_access_token", val.access_token);
79947 oauth2.options = function(val) {
79948 if (!arguments.length)
79951 o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
79952 o2.url = o2.url || "https://www.openstreetmap.org";
79953 o2.auto = o2.auto || false;
79954 o2.singlepage = o2.singlepage || false;
79955 o2.loading = o2.loading || function() {
79957 o2.done = o2.done || function() {
79959 return oauth2.preauth(o2);
79961 oauth2.options(o2);
79964 function utilQsString2(obj) {
79965 return Object.keys(obj).filter(function(key) {
79966 return obj[key] !== void 0;
79967 }).sort().map(function(key) {
79968 return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
79971 function utilStringQs2(str) {
79973 while (i3 < str.length && (str[i3] === "?" || str[i3] === "#"))
79975 str = str.slice(i3);
79976 return str.split("&").reduce(function(obj, pair3) {
79977 var parts = pair3.split("=");
79978 if (parts.length === 2) {
79979 obj[parts[0]] = decodeURIComponent(parts[1]);
79984 function supportsWebCryptoAPI() {
79985 return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
79987 function _generatePkceChallenge(callback) {
79989 if (supportsWebCryptoAPI()) {
79990 var random = window.crypto.getRandomValues(new Uint8Array(32));
79991 code_verifier = base64(random.buffer);
79992 var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
79993 return char.charCodeAt(0);
79995 window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
79996 var code_challenge = base64(hash);
80000 code_challenge_method: "S256"
80004 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
80005 code_verifier = "";
80006 for (var i3 = 0; i3 < 64; i3++) {
80007 code_verifier += chars[Math.floor(Math.random() * chars.length)];
80011 code_challenge: code_verifier,
80012 code_challenge_method: "plain"
80016 function generateState() {
80018 if (supportsWebCryptoAPI()) {
80019 var random = window.crypto.getRandomValues(new Uint8Array(32));
80020 state = base64(random.buffer);
80022 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
80024 for (var i3 = 0; i3 < 64; i3++) {
80025 state += chars[Math.floor(Math.random() * chars.length)];
80030 function base64(buffer) {
80031 return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
80034 // modules/services/osm.js
80035 var import_rbush10 = __toESM(require_rbush_min());
80036 var tiler6 = utilTiler();
80037 var dispatch10 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
80038 var urlroot = osmApiConnections[0].url;
80039 var apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
80040 var redirectPath = window.location.origin + window.location.pathname;
80041 var oauth = osmAuth({
80043 apiUrl: apiUrlroot,
80044 client_id: osmApiConnections[0].client_id,
80045 client_secret: osmApiConnections[0].client_secret,
80046 scope: "read_prefs write_prefs write_api read_gpx write_notes",
80047 redirect_uri: redirectPath + "land.html",
80048 loading: authLoading,
80051 var _apiConnections = osmApiConnections;
80052 var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
80053 var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
80054 var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
80055 var _userCache = { toLoad: {}, user: {} };
80056 var _cachedApiStatus;
80057 var _changeset = {};
80058 var _deferred = /* @__PURE__ */ new Set();
80059 var _connectionID = 1;
80060 var _tileZoom4 = 16;
80061 var _noteZoom = 12;
80062 var _rateLimitError;
80063 var _userChangesets;
80066 var _maxWayNodes = 2e3;
80067 function authLoading() {
80068 dispatch10.call("authLoading");
80070 function authDone() {
80071 dispatch10.call("authDone");
80073 function abortRequest5(controllerOrXHR) {
80074 if (controllerOrXHR) {
80075 controllerOrXHR.abort();
80078 function hasInflightRequests(cache) {
80079 return Object.keys(cache.inflight).length;
80081 function abortUnwantedRequests4(cache, visibleTiles) {
80082 Object.keys(cache.inflight).forEach(function(k2) {
80083 if (cache.toLoad[k2])
80085 if (visibleTiles.find(function(tile) {
80086 return k2 === tile.id;
80089 abortRequest5(cache.inflight[k2]);
80090 delete cache.inflight[k2];
80093 function getLoc(attrs) {
80094 var lon = attrs.lon && attrs.lon.value;
80095 var lat = attrs.lat && attrs.lat.value;
80096 return [Number(lon), Number(lat)];
80098 function getNodes(obj) {
80099 var elems = obj.getElementsByTagName("nd");
80100 var nodes = new Array(elems.length);
80101 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
80102 nodes[i3] = "n" + elems[i3].attributes.ref.value;
80106 function getNodesJSON(obj) {
80107 var elems = obj.nodes;
80108 var nodes = new Array(elems.length);
80109 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
80110 nodes[i3] = "n" + elems[i3];
80114 function getTags(obj) {
80115 var elems = obj.getElementsByTagName("tag");
80117 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
80118 var attrs = elems[i3].attributes;
80119 tags[attrs.k.value] = attrs.v.value;
80123 function getMembers(obj) {
80124 var elems = obj.getElementsByTagName("member");
80125 var members = new Array(elems.length);
80126 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
80127 var attrs = elems[i3].attributes;
80129 id: attrs.type.value[0] + attrs.ref.value,
80130 type: attrs.type.value,
80131 role: attrs.role.value
80136 function getMembersJSON(obj) {
80137 var elems = obj.members;
80138 var members = new Array(elems.length);
80139 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
80140 var attrs = elems[i3];
80142 id: attrs.type[0] + attrs.ref,
80149 function getVisible(attrs) {
80150 return !attrs.visible || attrs.visible.value !== "false";
80152 function parseComments(comments) {
80153 var parsedComments = [];
80154 for (var i3 = 0; i3 < comments.length; i3++) {
80155 var comment = comments[i3];
80156 if (comment.nodeName === "comment") {
80157 var childNodes = comment.childNodes;
80158 var parsedComment = {};
80159 for (var j2 = 0; j2 < childNodes.length; j2++) {
80160 var node = childNodes[j2];
80161 var nodeName = node.nodeName;
80162 if (nodeName === "#text")
80164 parsedComment[nodeName] = node.textContent;
80165 if (nodeName === "uid") {
80166 var uid = node.textContent;
80167 if (uid && !_userCache.user[uid]) {
80168 _userCache.toLoad[uid] = true;
80172 if (parsedComment) {
80173 parsedComments.push(parsedComment);
80177 return parsedComments;
80179 function encodeNoteRtree(note) {
80188 var jsonparsers = {
80189 node: function nodeData(obj, uid) {
80190 return new osmNode({
80192 visible: typeof obj.visible === "boolean" ? obj.visible : true,
80193 version: obj.version && obj.version.toString(),
80194 changeset: obj.changeset && obj.changeset.toString(),
80195 timestamp: obj.timestamp,
80197 uid: obj.uid && obj.uid.toString(),
80198 loc: [Number(obj.lon), Number(obj.lat)],
80202 way: function wayData(obj, uid) {
80203 return new osmWay({
80205 visible: typeof obj.visible === "boolean" ? obj.visible : true,
80206 version: obj.version && obj.version.toString(),
80207 changeset: obj.changeset && obj.changeset.toString(),
80208 timestamp: obj.timestamp,
80210 uid: obj.uid && obj.uid.toString(),
80212 nodes: getNodesJSON(obj)
80215 relation: function relationData(obj, uid) {
80216 return new osmRelation({
80218 visible: typeof obj.visible === "boolean" ? obj.visible : true,
80219 version: obj.version && obj.version.toString(),
80220 changeset: obj.changeset && obj.changeset.toString(),
80221 timestamp: obj.timestamp,
80223 uid: obj.uid && obj.uid.toString(),
80225 members: getMembersJSON(obj)
80228 user: function parseUser(obj, uid) {
80231 display_name: obj.display_name,
80232 account_created: obj.account_created,
80233 image_url: obj.img && obj.img.href,
80234 changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
80235 active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
80239 function parseJSON(payload, callback, options2) {
80240 options2 = Object.assign({ skipSeen: true }, options2);
80242 return callback({ message: "No JSON", status: -1 });
80244 var json = payload;
80245 if (typeof json !== "object")
80246 json = JSON.parse(payload);
80247 if (!json.elements)
80248 return callback({ message: "No JSON", status: -1 });
80249 var children2 = json.elements;
80250 var handle = window.requestIdleCallback(function() {
80251 _deferred.delete(handle);
80254 for (var i3 = 0; i3 < children2.length; i3++) {
80255 result = parseChild(children2[i3]);
80257 results.push(result);
80259 callback(null, results);
80261 _deferred.add(handle);
80262 function parseChild(child) {
80263 var parser3 = jsonparsers[child.type];
80267 uid = osmEntity.id.fromOSM(child.type, child.id);
80268 if (options2.skipSeen) {
80269 if (_tileCache.seen[uid])
80271 _tileCache.seen[uid] = true;
80273 return parser3(child, uid);
80276 function parseUserJSON(payload, callback, options2) {
80277 options2 = Object.assign({ skipSeen: true }, options2);
80279 return callback({ message: "No JSON", status: -1 });
80281 var json = payload;
80282 if (typeof json !== "object")
80283 json = JSON.parse(payload);
80284 if (!json.users && !json.user)
80285 return callback({ message: "No JSON", status: -1 });
80286 var objs = json.users || [json];
80287 var handle = window.requestIdleCallback(function() {
80288 _deferred.delete(handle);
80291 for (var i3 = 0; i3 < objs.length; i3++) {
80292 result = parseObj(objs[i3]);
80294 results.push(result);
80296 callback(null, results);
80298 _deferred.add(handle);
80299 function parseObj(obj) {
80300 var uid = obj.user.id && obj.user.id.toString();
80301 if (options2.skipSeen && _userCache.user[uid]) {
80302 delete _userCache.toLoad[uid];
80305 var user = jsonparsers.user(obj.user, uid);
80306 _userCache.user[uid] = user;
80307 delete _userCache.toLoad[uid];
80312 node: function nodeData2(obj, uid) {
80313 var attrs = obj.attributes;
80314 return new osmNode({
80316 visible: getVisible(attrs),
80317 version: attrs.version.value,
80318 changeset: attrs.changeset && attrs.changeset.value,
80319 timestamp: attrs.timestamp && attrs.timestamp.value,
80320 user: attrs.user && attrs.user.value,
80321 uid: attrs.uid && attrs.uid.value,
80322 loc: getLoc(attrs),
80326 way: function wayData2(obj, uid) {
80327 var attrs = obj.attributes;
80328 return new osmWay({
80330 visible: getVisible(attrs),
80331 version: attrs.version.value,
80332 changeset: attrs.changeset && attrs.changeset.value,
80333 timestamp: attrs.timestamp && attrs.timestamp.value,
80334 user: attrs.user && attrs.user.value,
80335 uid: attrs.uid && attrs.uid.value,
80336 tags: getTags(obj),
80337 nodes: getNodes(obj)
80340 relation: function relationData2(obj, uid) {
80341 var attrs = obj.attributes;
80342 return new osmRelation({
80344 visible: getVisible(attrs),
80345 version: attrs.version.value,
80346 changeset: attrs.changeset && attrs.changeset.value,
80347 timestamp: attrs.timestamp && attrs.timestamp.value,
80348 user: attrs.user && attrs.user.value,
80349 uid: attrs.uid && attrs.uid.value,
80350 tags: getTags(obj),
80351 members: getMembers(obj)
80354 note: function parseNote(obj, uid) {
80355 var attrs = obj.attributes;
80356 var childNodes = obj.childNodes;
80359 props.loc = getLoc(attrs);
80360 if (!_noteCache.note[uid]) {
80361 let coincident = false;
80362 const epsilon3 = 1e-5;
80365 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
80367 const bbox2 = geoExtent(props.loc).bbox();
80368 coincident = _noteCache.rtree.search(bbox2).length;
80369 } while (coincident);
80371 props.loc = _noteCache.note[uid].loc;
80373 for (var i3 = 0; i3 < childNodes.length; i3++) {
80374 var node = childNodes[i3];
80375 var nodeName = node.nodeName;
80376 if (nodeName === "#text")
80378 if (nodeName === "comments") {
80379 props[nodeName] = parseComments(node.childNodes);
80381 props[nodeName] = node.textContent;
80384 var note = new osmNote(props);
80385 var item = encodeNoteRtree(note);
80386 _noteCache.note[note.id] = note;
80387 updateRtree4(item, true);
80390 user: function parseUser2(obj, uid) {
80391 var attrs = obj.attributes;
80394 display_name: attrs.display_name && attrs.display_name.value,
80395 account_created: attrs.account_created && attrs.account_created.value,
80396 changesets_count: "0",
80399 var img = obj.getElementsByTagName("img");
80400 if (img && img[0] && img[0].getAttribute("href")) {
80401 user.image_url = img[0].getAttribute("href");
80403 var changesets = obj.getElementsByTagName("changesets");
80404 if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
80405 user.changesets_count = changesets[0].getAttribute("count");
80407 var blocks = obj.getElementsByTagName("blocks");
80408 if (blocks && blocks[0]) {
80409 var received = blocks[0].getElementsByTagName("received");
80410 if (received && received[0] && received[0].getAttribute("active")) {
80411 user.active_blocks = received[0].getAttribute("active");
80414 _userCache.user[uid] = user;
80415 delete _userCache.toLoad[uid];
80419 function parseXML(xml, callback, options2) {
80420 options2 = Object.assign({ skipSeen: true }, options2);
80421 if (!xml || !xml.childNodes) {
80422 return callback({ message: "No XML", status: -1 });
80424 var root3 = xml.childNodes[0];
80425 var children2 = root3.childNodes;
80426 var handle = window.requestIdleCallback(function() {
80427 _deferred.delete(handle);
80430 for (var i3 = 0; i3 < children2.length; i3++) {
80431 result = parseChild(children2[i3]);
80433 results.push(result);
80435 callback(null, results);
80437 _deferred.add(handle);
80438 function parseChild(child) {
80439 var parser3 = parsers[child.nodeName];
80443 if (child.nodeName === "user") {
80444 uid = child.attributes.id.value;
80445 if (options2.skipSeen && _userCache.user[uid]) {
80446 delete _userCache.toLoad[uid];
80449 } else if (child.nodeName === "note") {
80450 uid = child.getElementsByTagName("id")[0].textContent;
80452 uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
80453 if (options2.skipSeen) {
80454 if (_tileCache.seen[uid])
80456 _tileCache.seen[uid] = true;
80459 return parser3(child, uid);
80462 function updateRtree4(item, replace) {
80463 _noteCache.rtree.remove(item, function isEql(a2, b2) {
80464 return a2.data.id === b2.data.id;
80467 _noteCache.rtree.insert(item);
80470 function wrapcb(thisArg, callback, cid) {
80471 return function(err, result) {
80473 if (err.status === 400 || err.status === 401 || err.status === 403) {
80476 return callback.call(thisArg, err);
80477 } else if (thisArg.getConnectionId() !== cid) {
80478 return callback.call(thisArg, { message: "Connection Switched", status: -1 });
80480 return callback.call(thisArg, err, result);
80484 var osm_default = {
80486 utilRebind(this, dispatch10, "on");
80488 reset: function() {
80489 Array.from(_deferred).forEach(function(handle) {
80490 window.cancelIdleCallback(handle);
80491 _deferred.delete(handle);
80494 _userChangesets = void 0;
80495 _userDetails = void 0;
80496 _rateLimitError = void 0;
80497 Object.values(_tileCache.inflight).forEach(abortRequest5);
80498 Object.values(_noteCache.inflight).forEach(abortRequest5);
80499 Object.values(_noteCache.inflightPost).forEach(abortRequest5);
80500 if (_changeset.inflight)
80501 abortRequest5(_changeset.inflight);
80502 _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new import_rbush10.default() };
80503 _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new import_rbush10.default() };
80504 _userCache = { toLoad: {}, user: {} };
80505 _cachedApiStatus = void 0;
80509 getConnectionId: function() {
80510 return _connectionID;
80512 getUrlRoot: function() {
80515 getApiUrlRoot: function() {
80518 changesetURL: function(changesetID) {
80519 return urlroot + "/changeset/" + changesetID;
80521 changesetsURL: function(center, zoom) {
80522 var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
80523 return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
80525 entityURL: function(entity) {
80526 return urlroot + "/" + entity.type + "/" + entity.osmId();
80528 historyURL: function(entity) {
80529 return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
80531 userURL: function(username) {
80532 return urlroot + "/user/" + encodeURIComponent(username);
80534 noteURL: function(note) {
80535 return urlroot + "/note/" + note.id;
80537 noteReportURL: function(note) {
80538 return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
80540 // Generic method to load data from the OSM API
80541 // Can handle either auth or unauth calls.
80542 loadFromAPI: function(path, callback, options2) {
80543 options2 = Object.assign({ skipSeen: true }, options2);
80545 var cid = _connectionID;
80546 function done(err, payload) {
80547 if (that.getConnectionId() !== cid) {
80549 callback({ message: "Connection Switched", status: -1 });
80552 var isAuthenticated = that.authenticated();
80553 if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
80555 that.loadFromAPI(path, callback, options2);
80557 if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
80558 _rateLimitError = err;
80559 dispatch10.call("change");
80560 that.reloadApiStatus();
80561 } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
80562 that.reloadApiStatus();
80566 return callback(err);
80568 if (path.indexOf(".json") !== -1) {
80569 return parseJSON(payload, callback, options2);
80571 return parseXML(payload, callback, options2);
80577 if (this.authenticated()) {
80583 var url = apiUrlroot + path;
80584 var controller = new AbortController();
80586 if (path.indexOf(".json") !== -1) {
80591 fn(url, { signal: controller.signal }).then(function(data) {
80593 }).catch(function(err) {
80594 if (err.name === "AbortError")
80596 var match = err.message.match(/^\d{3}/);
80598 done({ status: +match[0], statusText: err.message });
80606 // Load a single entity by id (ways and relations use the `/full` call to include
80607 // nodes and members). Parent relations are not included, see `loadEntityRelations`.
80608 // GET /api/0.6/node/#id
80609 // GET /api/0.6/[way|relation]/#id/full
80610 loadEntity: function(id2, callback) {
80611 var type2 = osmEntity.id.type(id2);
80612 var osmID = osmEntity.id.toOSM(id2);
80613 var options2 = { skipSeen: false };
80615 "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
80616 function(err, entities) {
80618 callback(err, { data: entities });
80623 // Load a single note by id , XML format
80624 // GET /api/0.6/notes/#id
80625 loadEntityNote: function(id2, callback) {
80626 var options2 = { skipSeen: false };
80628 "/api/0.6/notes/" + id2,
80629 function(err, entities) {
80631 callback(err, { data: entities });
80636 // Load a single entity with a specific version
80637 // GET /api/0.6/[node|way|relation]/#id/#version
80638 loadEntityVersion: function(id2, version, callback) {
80639 var type2 = osmEntity.id.type(id2);
80640 var osmID = osmEntity.id.toOSM(id2);
80641 var options2 = { skipSeen: false };
80643 "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
80644 function(err, entities) {
80646 callback(err, { data: entities });
80651 // Load the relations of a single entity with the given.
80652 // GET /api/0.6/[node|way|relation]/#id/relations
80653 loadEntityRelations: function(id2, callback) {
80654 var type2 = osmEntity.id.type(id2);
80655 var osmID = osmEntity.id.toOSM(id2);
80656 var options2 = { skipSeen: false };
80658 "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
80659 function(err, entities) {
80661 callback(err, { data: entities });
80666 // Load multiple entities in chunks
80667 // (note: callback may be called multiple times)
80668 // Unlike `loadEntity`, child nodes and members are not fetched
80669 // GET /api/0.6/[nodes|ways|relations]?#parameters
80670 loadMultiple: function(ids, callback) {
80672 var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
80673 Object.keys(groups).forEach(function(k2) {
80674 var type2 = k2 + "s";
80675 var osmIDs = groups[k2].map(function(id2) {
80676 return osmEntity.id.toOSM(id2);
80678 var options2 = { skipSeen: false };
80679 utilArrayChunk(osmIDs, 150).forEach(function(arr) {
80681 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
80682 function(err, entities) {
80684 callback(err, { data: entities });
80691 // Create, upload, and close a changeset
80692 // PUT /api/0.6/changeset/create
80693 // POST /api/0.6/changeset/#id/upload
80694 // PUT /api/0.6/changeset/#id/close
80695 putChangeset: function(changeset, changes, callback) {
80696 var cid = _connectionID;
80697 if (_changeset.inflight) {
80698 return callback({ message: "Changeset already inflight", status: -2 }, changeset);
80699 } else if (_changeset.open) {
80700 return createdChangeset.call(this, null, _changeset.open);
80704 path: "/api/0.6/changeset/create",
80705 headers: { "Content-Type": "text/xml" },
80706 content: JXON.stringify(changeset.asJXON())
80708 _changeset.inflight = oauth.xhr(
80710 wrapcb(this, createdChangeset, cid)
80713 function createdChangeset(err, changesetID) {
80714 _changeset.inflight = null;
80716 return callback(err, changeset);
80718 _changeset.open = changesetID;
80719 changeset = changeset.update({ id: changesetID });
80722 path: "/api/0.6/changeset/" + changesetID + "/upload",
80723 headers: { "Content-Type": "text/xml" },
80724 content: JXON.stringify(changeset.osmChangeJXON(changes))
80726 _changeset.inflight = oauth.xhr(
80728 wrapcb(this, uploadedChangeset, cid)
80731 function uploadedChangeset(err) {
80732 _changeset.inflight = null;
80734 return callback(err, changeset);
80735 window.setTimeout(function() {
80736 callback(null, changeset);
80738 _changeset.open = null;
80739 if (this.getConnectionId() === cid) {
80742 path: "/api/0.6/changeset/" + changeset.id + "/close",
80743 headers: { "Content-Type": "text/xml" }
80750 // Load multiple users in chunks
80751 // (note: callback may be called multiple times)
80752 // GET /api/0.6/users?users=#id1,#id2,...,#idn
80753 loadUsers: function(uids, callback) {
80756 utilArrayUniq(uids).forEach(function(uid) {
80757 if (_userCache.user[uid]) {
80758 delete _userCache.toLoad[uid];
80759 cached.push(_userCache.user[uid]);
80764 if (cached.length || !this.authenticated()) {
80765 callback(void 0, cached);
80766 if (!this.authenticated())
80769 utilArrayChunk(toLoad, 150).forEach((function(arr) {
80772 path: "/api/0.6/users.json?users=" + arr.join()
80773 }, wrapcb(this, done, _connectionID));
80775 function done(err, payload) {
80777 return callback(err);
80778 var options2 = { skipSeen: true };
80779 return parseUserJSON(payload, function(err2, results) {
80781 return callback(err2);
80782 return callback(void 0, results);
80786 // Load a given user by id
80787 // GET /api/0.6/user/#id
80788 loadUser: function(uid, callback) {
80789 if (_userCache.user[uid] || !this.authenticated()) {
80790 delete _userCache.toLoad[uid];
80791 return callback(void 0, _userCache.user[uid]);
80795 path: "/api/0.6/user/" + uid + ".json"
80796 }, wrapcb(this, done, _connectionID));
80797 function done(err, payload) {
80799 return callback(err);
80800 var options2 = { skipSeen: true };
80801 return parseUserJSON(payload, function(err2, results) {
80803 return callback(err2);
80804 return callback(void 0, results[0]);
80808 // Load the details of the logged-in user
80809 // GET /api/0.6/user/details
80810 userDetails: function(callback) {
80811 if (_userDetails) {
80812 return callback(void 0, _userDetails);
80816 path: "/api/0.6/user/details.json"
80817 }, wrapcb(this, done, _connectionID));
80818 function done(err, payload) {
80820 return callback(err);
80821 var options2 = { skipSeen: false };
80822 return parseUserJSON(payload, function(err2, results) {
80824 return callback(err2);
80825 _userDetails = results[0];
80826 return callback(void 0, _userDetails);
80830 // Load previous changesets for the logged in user
80831 // GET /api/0.6/changesets?user=#id
80832 userChangesets: function(callback) {
80833 if (_userChangesets) {
80834 return callback(void 0, _userChangesets);
80837 wrapcb(this, gotDetails, _connectionID)
80839 function gotDetails(err, user) {
80841 return callback(err);
80845 path: "/api/0.6/changesets?user=" + user.id
80846 }, wrapcb(this, done, _connectionID));
80848 function done(err, xml) {
80850 return callback(err);
80852 _userChangesets = Array.prototype.map.call(
80853 xml.getElementsByTagName("changeset"),
80854 function(changeset) {
80855 return { tags: getTags(changeset) };
80857 ).filter(function(changeset) {
80858 var comment = changeset.tags.comment;
80859 return comment && comment !== "";
80861 return callback(void 0, _userChangesets);
80864 // Fetch the status of the OSM API
80865 // GET /api/capabilities
80866 status: function(callback) {
80867 var url = apiUrlroot + "/api/capabilities";
80868 var errback = wrapcb(this, done, _connectionID);
80869 xml_default(url).then(function(data) {
80870 errback(null, data);
80871 }).catch(function(err) {
80872 errback(err.message);
80874 function done(err, xml) {
80876 return callback(err, null);
80878 var elements = xml.getElementsByTagName("blacklist");
80880 for (var i3 = 0; i3 < elements.length; i3++) {
80881 var regexString = elements[i3].getAttribute("regex");
80884 var regex = new RegExp(regexString);
80885 regexes.push(regex);
80890 if (regexes.length) {
80891 _imageryBlocklists = regexes;
80893 if (_rateLimitError) {
80894 return callback(_rateLimitError, "rateLimited");
80896 var waynodes = xml.getElementsByTagName("waynodes");
80897 var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
80898 if (maxWayNodes && isFinite(maxWayNodes))
80899 _maxWayNodes = maxWayNodes;
80900 var apiStatus = xml.getElementsByTagName("status");
80901 var val = apiStatus[0].getAttribute("api");
80902 return callback(void 0, val);
80906 // Calls `status` and dispatches an `apiStatusChange` event if the returned
80907 // status differs from the cached status.
80908 reloadApiStatus: function() {
80909 if (!this.throttledReloadApiStatus) {
80911 this.throttledReloadApiStatus = throttle_default(function() {
80912 that.status(function(err, status) {
80913 if (status !== _cachedApiStatus) {
80914 _cachedApiStatus = status;
80915 dispatch10.call("apiStatusChange", that, err, status);
80920 this.throttledReloadApiStatus();
80922 // Returns the maximum number of nodes a single way can have
80923 maxWayNodes: function() {
80924 return _maxWayNodes;
80926 // Load data (entities) from the API in tiles
80927 // GET /api/0.6/map?bbox=
80928 loadTiles: function(projection2, callback) {
80931 var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
80932 var hadRequests = hasInflightRequests(_tileCache);
80933 abortUnwantedRequests4(_tileCache, tiles);
80934 if (hadRequests && !hasInflightRequests(_tileCache)) {
80935 dispatch10.call("loaded");
80937 tiles.forEach(function(tile) {
80938 this.loadTile(tile, callback);
80941 // Load a single data tile
80942 // GET /api/0.6/map?bbox=
80943 loadTile: function(tile, callback) {
80946 if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
80948 if (!hasInflightRequests(_tileCache)) {
80949 dispatch10.call("loading");
80951 var path = "/api/0.6/map.json?bbox=";
80952 var options2 = { skipSeen: true };
80953 _tileCache.inflight[tile.id] = this.loadFromAPI(
80954 path + tile.extent.toParam(),
80958 function tileCallback(err, parsed) {
80959 delete _tileCache.inflight[tile.id];
80961 delete _tileCache.toLoad[tile.id];
80962 _tileCache.loaded[tile.id] = true;
80963 var bbox2 = tile.extent.bbox();
80964 bbox2.id = tile.id;
80965 _tileCache.rtree.insert(bbox2);
80968 callback(err, Object.assign({ data: parsed }, tile));
80970 if (!hasInflightRequests(_tileCache)) {
80971 dispatch10.call("loaded");
80975 isDataLoaded: function(loc) {
80976 var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
80977 return _tileCache.rtree.collides(bbox2);
80979 // load the tile that covers the given `loc`
80980 loadTileAtLoc: function(loc, callback) {
80981 if (Object.keys(_tileCache.toLoad).length > 50)
80983 var k2 = geoZoomToScale(_tileZoom4 + 1);
80984 var offset = geoRawMercator().scale(k2)(loc);
80985 var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
80986 var tiles = tiler6.zoomExtent([_tileZoom4, _tileZoom4]).getTiles(projection2);
80987 tiles.forEach(function(tile) {
80988 if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id])
80990 _tileCache.toLoad[tile.id] = true;
80991 this.loadTile(tile, callback);
80994 // Load notes from the API in tiles
80995 // GET /api/0.6/notes?bbox=
80996 loadNotes: function(projection2, noteOptions) {
80997 noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
81001 var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
81002 var throttleLoadUsers = throttle_default(function() {
81003 var uids = Object.keys(_userCache.toLoad);
81006 that.loadUsers(uids, function() {
81009 var tiles = tiler6.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
81010 abortUnwantedRequests4(_noteCache, tiles);
81011 tiles.forEach(function(tile) {
81012 if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id])
81014 var options2 = { skipSeen: false };
81015 _noteCache.inflight[tile.id] = that.loadFromAPI(
81016 path + tile.extent.toParam(),
81018 delete _noteCache.inflight[tile.id];
81020 _noteCache.loaded[tile.id] = true;
81022 throttleLoadUsers();
81023 dispatch10.call("loadedNotes");
81030 // POST /api/0.6/notes?params
81031 postNoteCreate: function(note, callback) {
81032 if (!this.authenticated()) {
81033 return callback({ message: "Not Authenticated", status: -3 }, note);
81035 if (_noteCache.inflightPost[note.id]) {
81036 return callback({ message: "Note update already inflight", status: -2 }, note);
81038 if (!note.loc[0] || !note.loc[1] || !note.newComment)
81040 var comment = note.newComment;
81041 if (note.newCategory && note.newCategory !== "None") {
81042 comment += " #" + note.newCategory;
81044 var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
81045 _noteCache.inflightPost[note.id] = oauth.xhr({
81048 }, wrapcb(this, done, _connectionID));
81049 function done(err, xml) {
81050 delete _noteCache.inflightPost[note.id];
81052 return callback(err);
81054 this.removeNote(note);
81055 var options2 = { skipSeen: false };
81056 return parseXML(xml, function(err2, results) {
81058 return callback(err2);
81060 return callback(void 0, results[0]);
81066 // POST /api/0.6/notes/#id/comment?text=comment
81067 // POST /api/0.6/notes/#id/close?text=comment
81068 // POST /api/0.6/notes/#id/reopen?text=comment
81069 postNoteUpdate: function(note, newStatus, callback) {
81070 if (!this.authenticated()) {
81071 return callback({ message: "Not Authenticated", status: -3 }, note);
81073 if (_noteCache.inflightPost[note.id]) {
81074 return callback({ message: "Note update already inflight", status: -2 }, note);
81077 if (note.status !== "closed" && newStatus === "closed") {
81079 } else if (note.status !== "open" && newStatus === "open") {
81082 action = "comment";
81083 if (!note.newComment)
81086 var path = "/api/0.6/notes/" + note.id + "/" + action;
81087 if (note.newComment) {
81088 path += "?" + utilQsString({ text: note.newComment });
81090 _noteCache.inflightPost[note.id] = oauth.xhr({
81093 }, wrapcb(this, done, _connectionID));
81094 function done(err, xml) {
81095 delete _noteCache.inflightPost[note.id];
81097 return callback(err);
81099 this.removeNote(note);
81100 if (action === "close") {
81101 _noteCache.closed[note.id] = true;
81102 } else if (action === "reopen") {
81103 delete _noteCache.closed[note.id];
81105 var options2 = { skipSeen: false };
81106 return parseXML(xml, function(err2, results) {
81108 return callback(err2);
81110 return callback(void 0, results[0]);
81115 /* connection options for source switcher (optional) */
81116 apiConnections: function(val) {
81117 if (!arguments.length)
81118 return _apiConnections;
81119 _apiConnections = val;
81122 switch: function(newOptions) {
81123 urlroot = newOptions.url;
81124 apiUrlroot = newOptions.apiUrl || urlroot;
81125 if (newOptions.url && !newOptions.apiUrl) {
81128 apiUrl: newOptions.url
81131 const oldOptions = utilObjectOmit(oauth.options(), "access_token");
81132 oauth.options({ ...oldOptions, ...newOptions });
81134 this.userChangesets(function() {
81136 dispatch10.call("change");
81139 toggle: function(val) {
81143 isChangesetInflight: function() {
81144 return !!_changeset.inflight;
81146 // get/set cached data
81147 // This is used to save/restore the state when entering/exiting the walkthrough
81148 // Also used for testing purposes.
81149 caches: function(obj) {
81150 function cloneCache(source) {
81152 Object.keys(source).forEach(function(k2) {
81153 if (k2 === "rtree") {
81154 target.rtree = new import_rbush10.default().fromJSON(source.rtree.toJSON());
81155 } else if (k2 === "note") {
81157 Object.keys(source.note).forEach(function(id2) {
81158 target.note[id2] = osmNote(source.note[id2]);
81161 target[k2] = JSON.parse(JSON.stringify(source[k2]));
81166 if (!arguments.length) {
81168 tile: cloneCache(_tileCache),
81169 note: cloneCache(_noteCache),
81170 user: cloneCache(_userCache)
81173 if (obj === "get") {
81181 _tileCache = obj.tile;
81182 _tileCache.inflight = {};
81185 _noteCache = obj.note;
81186 _noteCache.inflight = {};
81187 _noteCache.inflightPost = {};
81190 _userCache = obj.user;
81194 logout: function() {
81195 _userChangesets = void 0;
81196 _userDetails = void 0;
81198 dispatch10.call("change");
81201 authenticated: function() {
81202 return oauth.authenticated();
81204 authenticate: function(callback) {
81206 var cid = _connectionID;
81207 _userChangesets = void 0;
81208 _userDetails = void 0;
81209 function done(err, res) {
81215 if (that.getConnectionId() !== cid) {
81217 callback({ message: "Connection Switched", status: -1 });
81220 _rateLimitError = void 0;
81221 dispatch10.call("change");
81223 callback(err, res);
81224 that.userChangesets(function() {
81227 oauth.authenticate(done);
81229 imageryBlocklists: function() {
81230 return _imageryBlocklists;
81232 tileZoom: function(val) {
81233 if (!arguments.length)
81238 // get all cached notes covering the viewport
81239 notes: function(projection2) {
81240 var viewport = projection2.clipExtent();
81241 var min3 = [viewport[0][0], viewport[1][1]];
81242 var max3 = [viewport[1][0], viewport[0][1]];
81243 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
81244 return _noteCache.rtree.search(bbox2).map(function(d2) {
81248 // get a single note from the cache
81249 getNote: function(id2) {
81250 return _noteCache.note[id2];
81252 // remove a single note from the cache
81253 removeNote: function(note) {
81254 if (!(note instanceof osmNote) || !note.id)
81256 delete _noteCache.note[note.id];
81257 updateRtree4(encodeNoteRtree(note), false);
81259 // replace a single note in the cache
81260 replaceNote: function(note) {
81261 if (!(note instanceof osmNote) || !note.id)
81263 _noteCache.note[note.id] = note;
81264 updateRtree4(encodeNoteRtree(note), true);
81267 // Get an array of note IDs closed during this session.
81268 // Used to populate `closed:note` changeset tag
81269 getClosedIDs: function() {
81270 return Object.keys(_noteCache.closed).sort();
81274 // modules/services/osm_wikibase.js
81275 var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
81276 var _inflight2 = {};
81277 var _wikibaseCache = {};
81278 var _localeIDs = { en: false };
81279 var debouncedRequest = debounce_default(request, 500, { leading: false });
81280 function request(url, callback) {
81281 if (_inflight2[url])
81283 var controller = new AbortController();
81284 _inflight2[url] = controller;
81285 json_default(url, { signal: controller.signal }).then(function(result) {
81286 delete _inflight2[url];
81288 callback(null, result);
81289 }).catch(function(err) {
81290 delete _inflight2[url];
81291 if (err.name === "AbortError")
81294 callback(err.message);
81297 var osm_wikibase_default = {
81300 _wikibaseCache = {};
81303 reset: function() {
81304 Object.values(_inflight2).forEach(function(controller) {
81305 controller.abort();
81310 * Get the best value for the property, or undefined if not found
81311 * @param entity object from wikibase
81312 * @param property string e.g. 'P4' for image
81313 * @param langCode string e.g. 'fr' for French
81315 claimToValue: function(entity, property, langCode) {
81316 if (!entity.claims[property])
81318 var locale2 = _localeIDs[langCode];
81319 var preferredPick, localePick;
81320 entity.claims[property].forEach(function(stmt) {
81321 if (!preferredPick && stmt.rank === "preferred") {
81322 preferredPick = stmt;
81324 if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
81328 var result = localePick || preferredPick;
81330 var datavalue = result.mainsnak.datavalue;
81331 return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
81337 * Convert monolingual property into a key-value object (language -> value)
81338 * @param entity object from wikibase
81339 * @param property string e.g. 'P31' for monolingual wiki page title
81341 monolingualClaimToValueObj: function(entity, property) {
81342 if (!entity || !entity.claims[property])
81344 return entity.claims[property].reduce(function(acc, obj) {
81345 var value = obj.mainsnak.datavalue.value;
81346 acc[value.language] = value.text;
81350 toSitelink: function(key, value) {
81351 var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
81352 return result.replace(/_/g, " ").trim();
81355 // Pass params object of the form:
81358 // value: 'string',
81359 // langCode: 'string'
81362 getEntity: function(params, callback) {
81363 var doRequest = params.debounce ? debouncedRequest : request;
81367 var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
81368 var keySitelink = params.key ? this.toSitelink(params.key) : false;
81369 var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
81370 var localeSitelink;
81371 if (params.langCodes) {
81372 params.langCodes.forEach(function(langCode) {
81373 if (_localeIDs[langCode] === void 0) {
81374 localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
81375 titles.push(localeSitelink);
81379 if (rtypeSitelink) {
81380 if (_wikibaseCache[rtypeSitelink]) {
81381 result.rtype = _wikibaseCache[rtypeSitelink];
81383 titles.push(rtypeSitelink);
81387 if (_wikibaseCache[keySitelink]) {
81388 result.key = _wikibaseCache[keySitelink];
81390 titles.push(keySitelink);
81394 if (_wikibaseCache[tagSitelink]) {
81395 result.tag = _wikibaseCache[tagSitelink];
81397 titles.push(tagSitelink);
81400 if (!titles.length) {
81401 return callback(null, result);
81404 action: "wbgetentities",
81406 titles: titles.join("|"),
81407 languages: params.langCodes.join("|"),
81408 languagefallback: 1,
81411 // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
81412 // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
81413 // formatversion: 2,
81415 var url = apibase3 + "?" + utilQsString(obj);
81416 doRequest(url, function(err, d2) {
81419 } else if (!d2.success || d2.error) {
81420 callback(d2.error.messages.map(function(v2) {
81421 return v2.html["*"];
81424 var localeID = false;
81425 Object.values(d2.entities).forEach(function(res) {
81426 if (res.missing !== "") {
81427 var title = res.sitelinks.wiki.title;
81428 if (title === rtypeSitelink) {
81429 _wikibaseCache[rtypeSitelink] = res;
81430 result.rtype = res;
81431 } else if (title === keySitelink) {
81432 _wikibaseCache[keySitelink] = res;
81434 } else if (title === tagSitelink) {
81435 _wikibaseCache[tagSitelink] = res;
81437 } else if (title === localeSitelink) {
81440 console.log("Unexpected title " + title);
81444 if (localeSitelink) {
81445 that.addLocale(params.langCodes[0], localeID);
81447 callback(null, result);
81452 // Pass params object of the form:
81454 // key: 'string', // required
81455 // value: 'string' // optional
81458 // Get an result object used to display tag documentation
81460 // title: 'string',
81461 // description: 'string',
81462 // editURL: 'string',
81463 // imageURL: 'string',
81464 // wiki: { title: 'string', text: 'string', url: 'string' }
81467 getDocs: function(params, callback) {
81469 var langCodes = _mainLocalizer.localeCodes().map(function(code) {
81470 return code.toLowerCase();
81472 params.langCodes = langCodes;
81473 this.getEntity(params, function(err, data) {
81478 var entity = data.rtype || data.tag || data.key;
81480 callback("No entity");
81485 for (i3 in langCodes) {
81486 let code2 = langCodes[i3];
81487 if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
81488 description = entity.descriptions[code2];
81492 if (!description && Object.values(entity.descriptions).length)
81493 description = Object.values(entity.descriptions)[0];
81495 title: entity.title,
81496 description: description ? description.value : "",
81497 descriptionLocaleCode: description ? description.language : "",
81498 editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
81500 if (entity.claims) {
81502 var image = that.claimToValue(entity, "P4", langCodes[0]);
81504 imageroot = "https://commons.wikimedia.org/w/index.php";
81506 image = that.claimToValue(entity, "P28", langCodes[0]);
81508 imageroot = "https://wiki.openstreetmap.org/w/index.php";
81511 if (imageroot && image) {
81512 result.imageURL = imageroot + "?" + utilQsString({
81513 title: "Special:Redirect/file/" + image,
81518 var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
81519 var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
81520 var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
81521 var wikis = [rtypeWiki, tagWiki, keyWiki];
81522 for (i3 in wikis) {
81523 var wiki = wikis[i3];
81524 for (var j2 in langCodes) {
81525 var code = langCodes[j2];
81526 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
81527 var info = getWikiInfo(wiki, code, referenceId);
81529 result.wiki = info;
81536 callback(null, result);
81537 function getWikiInfo(wiki2, langCode, tKey) {
81538 if (wiki2 && wiki2[langCode]) {
81540 title: wiki2[langCode],
81542 url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
81548 addLocale: function(langCode, qid) {
81549 _localeIDs[langCode] = qid;
81551 apibase: function(val) {
81552 if (!arguments.length)
81559 // modules/services/streetside.js
81560 var import_rbush11 = __toESM(require_rbush_min());
81561 var streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}";
81562 var maxResults2 = 500;
81563 var bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
81564 var pannellumViewerCSS2 = "pannellum/pannellum.css";
81565 var pannellumViewerJS2 = "pannellum/pannellum.js";
81566 var tileZoom3 = 16.5;
81567 var tiler7 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
81568 var dispatch11 = dispatch_default("loadedImages", "viewerChanged");
81571 var defaultHfov = 45;
81572 var _hires = false;
81573 var _resolution = 512;
81574 var _currScene = 0;
81576 var _pannellumViewer2;
81577 var _sceneOptions = {
81578 showFullscreenCtrl: false,
81588 var _loadViewerPromise4;
81589 function abortRequest6(i3) {
81592 function localeTimestamp2(s2) {
81595 const options2 = { day: "numeric", month: "short", year: "numeric" };
81596 const d2 = new Date(s2);
81597 if (isNaN(d2.getTime()))
81599 return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
81601 function loadTiles3(which, url, projection2, margin) {
81602 const tiles = tiler7.margin(margin).getTiles(projection2);
81603 const cache = _ssCache[which];
81604 Object.keys(cache.inflight).forEach((k2) => {
81605 const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
81607 abortRequest6(cache.inflight[k2]);
81608 delete cache.inflight[k2];
81611 tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
81613 function loadNextTilePage2(which, url, tile) {
81614 const cache = _ssCache[which];
81615 const nextPage = cache.nextPage[tile.id] || 0;
81616 const id2 = tile.id + "," + String(nextPage);
81617 if (cache.loaded[id2] || cache.inflight[id2])
81619 cache.inflight[id2] = getBubbles(url, tile, (response) => {
81620 cache.loaded[id2] = true;
81621 delete cache.inflight[id2];
81624 if (response.resourceSets[0].resources.length === maxResults2) {
81625 const split = tile.extent.split();
81626 loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
81627 loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
81628 loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
81629 loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
81631 const features = response.resourceSets[0].resources.map((bubble) => {
81632 const bubbleId = bubble.imageUrl;
81633 if (cache.points[bubbleId])
81635 const loc = [bubble.lon, bubble.lat];
81639 imageUrl: bubble.imageUrl.replace(
81641 bubble.imageUrlSubdomains[0]
81644 captured_at: bubble.vintageEnd,
81645 captured_by: "microsoft",
81649 cache.points[bubbleId] = d2;
81657 }).filter(Boolean);
81658 cache.rtree.load(features);
81659 if (which === "bubbles") {
81660 dispatch11.call("loadedImages");
81664 function getBubbles(url, tile, callback) {
81665 let rect = tile.extent.rectangle();
81666 let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
81667 const controller = new AbortController();
81668 fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
81669 if (!response.ok) {
81670 throw new Error(response.status + " " + response.statusText);
81672 return response.json();
81673 }).then(function(result) {
81677 return callback(result || []);
81678 }).catch(function(err) {
81679 if (err.name === "AbortError") {
81681 throw new Error(err);
81686 function partitionViewport4(projection2) {
81687 let z2 = geoScaleToZoom(projection2.scale());
81688 let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
81689 let tiler9 = utilTiler().zoomExtent([z22, z22]);
81690 return tiler9.getTiles(projection2).map((tile) => tile.extent);
81692 function searchLimited4(limit, projection2, rtree) {
81693 limit = limit || 5;
81694 return partitionViewport4(projection2).reduce((result, extent) => {
81695 let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
81696 return found.length ? result.concat(found) : result;
81699 function loadImage2(imgInfo) {
81700 return new Promise((resolve) => {
81701 let img = new Image();
81702 img.onload = () => {
81703 let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
81704 let ctx = canvas.getContext("2d");
81705 ctx.drawImage(img, imgInfo.x, imgInfo.y);
81706 resolve({ imgInfo, status: "ok" });
81708 img.onerror = () => {
81709 resolve({ data: imgInfo, status: "error" });
81711 img.setAttribute("crossorigin", "");
81712 img.src = imgInfo.url;
81715 function loadCanvas(imageGroup) {
81716 return Promise.all(imageGroup.map(loadImage2)).then((data) => {
81717 let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
81718 const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
81719 let face = data[0].imgInfo.face;
81720 _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
81721 return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
81724 function loadFaces(faceGroup) {
81725 return Promise.all(faceGroup.map(loadCanvas)).then(() => {
81726 return { status: "loadFaces done" };
81729 function setupCanvas(selection2, reset) {
81731 selection2.selectAll("#ideditor-stitcher-canvases").remove();
81733 selection2.selectAll("#ideditor-stitcher-canvases").data([0]).enter().append("div").attr("id", "ideditor-stitcher-canvases").attr("display", "none").selectAll("canvas").data(["canvas01", "canvas02", "canvas03", "canvas10", "canvas11", "canvas12"]).enter().append("canvas").attr("id", (d2) => "ideditor-" + d2).attr("width", _resolution).attr("height", _resolution);
81735 function qkToXY(qk) {
81739 for (let i3 = qk.length; i3 > 0; i3--) {
81740 const key = qk[i3 - 1];
81741 x2 += +(key === "1" || key === "3") * scale;
81742 y2 += +(key === "2" || key === "3") * scale;
81747 function getQuadKeys() {
81748 let dim = _resolution / 256;
82009 } else if (dim === 8) {
82076 } else if (dim === 4) {
82105 var streetside_default = {
82107 * init() initialize streetside.
82113 this.event = utilRebind(this, dispatch11, "on");
82116 * reset() reset the cache.
82118 reset: function() {
82120 Object.values(_ssCache.bubbles.inflight).forEach(abortRequest6);
82123 bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new import_rbush11.default(), points: {} },
82130 bubbles: function(projection2) {
82132 return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
82134 cachedImage: function(imageKey) {
82135 return _ssCache.bubbles.points[imageKey];
82137 sequences: function(projection2) {
82138 const viewport = projection2.clipExtent();
82139 const min3 = [viewport[0][0], viewport[1][1]];
82140 const max3 = [viewport[1][0], viewport[0][1]];
82141 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
82144 _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
82145 const key = d2.data.sequenceKey;
82146 if (key && !seen[key]) {
82148 results.push(_ssCache.sequences[key].geojson);
82156 loadBubbles: function(projection2, margin) {
82157 if (margin === void 0)
82159 loadTiles3("bubbles", streetsideApi, projection2, margin);
82161 viewer: function() {
82162 return _pannellumViewer2;
82164 initViewer: function() {
82165 if (!window.pannellum)
82167 if (_pannellumViewer2)
82170 const sceneID = _currScene.toString();
82172 "default": { firstScene: sceneID },
82175 options2.scenes[sceneID] = _sceneOptions;
82176 _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
82178 ensureViewerLoaded: function(context) {
82179 if (_loadViewerPromise4)
82180 return _loadViewerPromise4;
82181 let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
82182 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
82184 let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
82185 wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
82186 select_default2(window).on(pointerPrefix + "move.streetside", () => {
82187 dispatch11.call("viewerChanged");
82189 }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
82190 select_default2(window).on(pointerPrefix + "move.streetside", null);
82191 let t2 = timer((elapsed) => {
82192 dispatch11.call("viewerChanged");
82193 if (elapsed > 2e3) {
82197 }).append("div").attr("class", "photo-attribution fillD");
82198 let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
82199 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
82200 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
82201 wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
82202 context.ui().photoviewer.on("resize.streetside", () => {
82203 if (_pannellumViewer2) {
82204 _pannellumViewer2.resize();
82207 _loadViewerPromise4 = new Promise((resolve, reject) => {
82208 let loadedCount = 0;
82209 function loaded() {
82211 if (loadedCount === 2)
82214 const head = select_default2("head");
82215 head.selectAll("#ideditor-streetside-viewercss").data([0]).enter().append("link").attr("id", "ideditor-streetside-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
82218 head.selectAll("#ideditor-streetside-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-streetside-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS2)).on("load.serviceStreetside", loaded).on("error.serviceStreetside", function() {
82221 }).catch(function() {
82222 _loadViewerPromise4 = null;
82224 return _loadViewerPromise4;
82225 function step(stepBy) {
82227 let viewer = context.container().select(".photoviewer");
82228 let selected = viewer.empty() ? void 0 : viewer.datum();
82231 let nextID = stepBy === 1 ? selected.ne : selected.pr;
82232 let yaw = _pannellumViewer2.getYaw();
82233 let ca = selected.ca + yaw;
82234 let origin = selected.loc;
82237 origin[0] + geoMetersToLon(meters / 5, origin[1]),
82241 origin[0] + geoMetersToLon(meters / 2, origin[1]),
82242 origin[1] + geoMetersToLat(meters)
82245 origin[0] - geoMetersToLon(meters / 2, origin[1]),
82246 origin[1] + geoMetersToLat(meters)
82249 origin[0] - geoMetersToLon(meters / 5, origin[1]),
82252 let poly = [p1, p2, p3, p4, p1];
82253 let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
82254 poly = geoRotate(poly, -angle2, origin);
82255 let extent = poly.reduce((extent2, point2) => {
82256 return extent2.extend(geoExtent(point2));
82258 let minDist = Infinity;
82259 _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
82260 if (d2.data.key === selected.key)
82262 if (!geoPointInPolygon(d2.data.loc, poly))
82264 let dist = geoVecLength(d2.data.loc, selected.loc);
82265 let theta = selected.ca - d2.data.ca;
82266 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
82267 if (minTheta > 20) {
82270 if (dist < minDist) {
82271 nextID = d2.data.key;
82275 let nextBubble = nextID && that.cachedImage(nextID);
82278 context.map().centerEase(nextBubble.loc);
82279 that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
82283 yaw: function(yaw) {
82284 if (typeof yaw !== "number")
82286 _sceneOptions.yaw = yaw;
82292 showViewer: function(context) {
82293 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
82294 let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
82296 wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
82297 wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
82304 hideViewer: function(context) {
82305 let viewer = context.container().select(".photoviewer");
82306 if (!viewer.empty())
82307 viewer.datum(null);
82308 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
82309 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
82310 this.updateUrlImage(null);
82311 return this.setStyles(context, null, true);
82316 selectImage: function(context, key) {
82318 let d2 = this.cachedImage(key);
82319 let viewer = context.container().select(".photoviewer");
82320 if (!viewer.empty())
82322 this.setStyles(context, null, true);
82323 let wrap2 = context.container().select(".photoviewer .ms-wrapper");
82324 let attribution = wrap2.selectAll(".photo-attribution").html("");
82325 wrap2.selectAll(".pnlm-load-box").style("display", "block");
82328 this.updateUrlImage(key);
82329 _sceneOptions.northOffset = d2.ca;
82330 let line1 = attribution.append("div").attr("class", "attribution-row");
82331 const hiresDomId = utilUniqueDomId("streetside-hires");
82332 let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
82333 label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
82334 d3_event.stopPropagation();
82336 _resolution = _hires ? 1024 : 512;
82337 wrap2.call(setupCanvas, true);
82339 yaw: _pannellumViewer2.getYaw(),
82340 pitch: _pannellumViewer2.getPitch(),
82341 hfov: _pannellumViewer2.getHfov()
82343 _sceneOptions = Object.assign(_sceneOptions, viewstate);
82344 that.selectImage(context, d2.key).showViewer(context);
82346 label.append("span").call(_t.append("streetside.hires"));
82347 let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
82348 if (d2.captured_by) {
82349 const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
82350 captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
82351 captureInfo.append("span").text("|");
82353 if (d2.captured_at) {
82354 captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
82356 let line2 = attribution.append("div").attr("class", "attribution-row");
82357 line2.append("a").attr("class", "image-view-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps?cp=" + d2.loc[1] + "~" + d2.loc[0] + "&lvl=17&dir=" + d2.ca + "&style=x&v=2&sV=1").call(_t.append("streetside.view_on_bing"));
82358 line2.append("a").attr("class", "image-report-link").attr("target", "_blank").attr("href", "https://www.bing.com/maps/privacyreport/streetsideprivacyreport?bubbleid=" + encodeURIComponent(d2.key) + "&focus=photo&lat=" + d2.loc[1] + "&lng=" + d2.loc[0] + "&z=17").call(_t.append("streetside.report"));
82359 const faceKeys = ["01", "02", "03", "10", "11", "12"];
82360 let quadKeys = getQuadKeys();
82361 let faces = faceKeys.map((faceKey) => {
82362 return quadKeys.map((quadKey) => {
82363 const xy = qkToXY(quadKey);
82366 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
82372 loadFaces(faces).then(function() {
82373 if (!_pannellumViewer2) {
82377 let sceneID = _currScene.toString();
82378 _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
82379 if (_currScene > 2) {
82380 sceneID = (_currScene - 1).toString();
82381 _pannellumViewer2.removeScene(sceneID);
82387 getSequenceKeyForBubble: function(d2) {
82388 return d2 && d2.sequenceKey;
82390 // Updates the currently highlighted sequence and selected bubble.
82391 // Reset is only necessary when interacting with the viewport because
82392 // this implicitly changes the currently selected bubble/sequence
82393 setStyles: function(context, hovered, reset) {
82395 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
82396 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
82398 let hoveredBubbleKey = hovered && hovered.key;
82399 let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
82400 let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
82401 let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
82402 let viewer = context.container().select(".photoviewer");
82403 let selected = viewer.empty() ? void 0 : viewer.datum();
82404 let selectedBubbleKey = selected && selected.key;
82405 let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
82406 let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
82407 let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
82408 let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
82409 context.container().selectAll(".layer-streetside-images .viewfield-group").classed("highlighted", (d2) => highlightedBubbleKeys.indexOf(d2.key) !== -1).classed("hovered", (d2) => d2.key === hoveredBubbleKey).classed("currentView", (d2) => d2.key === selectedBubbleKey);
82410 context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
82411 context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
82412 function viewfieldPath() {
82413 let d2 = this.parentNode.__data__;
82414 if (d2.pano && d2.key !== selectedBubbleKey) {
82415 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
82417 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
82422 updateUrlImage: function(imageKey) {
82423 if (!window.mocha) {
82424 var hash = utilStringQs(window.location.hash);
82426 hash.photo = "streetside/" + imageKey;
82430 window.location.replace("#" + utilQsString(hash, true));
82436 cache: function() {
82441 // modules/services/taginfo.js
82442 var apibase4 = taginfoApiUrl;
82443 var _inflight3 = {};
82444 var _popularKeys = {};
82445 var _taginfoCache = {};
82447 point: "count_nodes",
82448 vertex: "count_nodes",
82449 area: "count_ways",
82452 var tag_sort_members = {
82453 point: "count_node_members",
82454 vertex: "count_node_members",
82455 area: "count_way_members",
82456 line: "count_way_members",
82457 relation: "count_relation_members"
82459 var tag_filters = {
82465 var tag_members_fractions = {
82466 point: "count_node_members_fraction",
82467 vertex: "count_node_members_fraction",
82468 area: "count_way_members_fraction",
82469 line: "count_way_members_fraction",
82470 relation: "count_relation_members_fraction"
82472 function sets(params, n3, o2) {
82473 if (params.geometry && o2[params.geometry]) {
82474 params[n3] = o2[params.geometry];
82478 function setFilter(params) {
82479 return sets(params, "filter", tag_filters);
82481 function setSort(params) {
82482 return sets(params, "sortname", tag_sorts);
82484 function setSortMembers(params) {
82485 return sets(params, "sortname", tag_sort_members);
82487 function clean(params) {
82488 return utilObjectOmit(params, ["geometry", "debounce"]);
82490 function filterKeys(type2) {
82491 var count_type = type2 ? "count_" + type2 : "count_all";
82492 return function(d2) {
82493 return Number(d2[count_type]) > 2500 || d2.in_wiki;
82496 function filterMultikeys(prefix) {
82497 return function(d2) {
82498 var re3 = new RegExp("^" + prefix + "(.*)$", "i");
82499 var matches = d2.key.match(re3) || [];
82500 return matches.length === 2 && matches[1].indexOf(":") === -1;
82503 function filterValues(allowUpperCase) {
82504 return function(d2) {
82505 if (d2.value.match(/[;,]/) !== null)
82507 if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null)
82509 return d2.count > 100 || d2.in_wiki;
82512 function filterRoles(geometry) {
82513 return function(d2) {
82514 if (d2.role === "")
82516 if (d2.role.match(/[A-Z*;,]/) !== null)
82518 return Number(d2[tag_members_fractions[geometry]]) > 0;
82521 function valKey(d2) {
82527 function valKeyDescription(d2) {
82530 title: d2.description || d2.value
82534 function roleKey(d2) {
82540 function sortKeys(a2, b2) {
82541 return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
82543 var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
82544 function request2(url, params, exactMatch, callback, loaded) {
82545 if (_inflight3[url])
82547 if (checkCache(url, params, exactMatch, callback))
82549 var controller = new AbortController();
82550 _inflight3[url] = controller;
82551 json_default(url, { signal: controller.signal }).then(function(result) {
82552 delete _inflight3[url];
82554 loaded(null, result);
82555 }).catch(function(err) {
82556 delete _inflight3[url];
82557 if (err.name === "AbortError")
82560 loaded(err.message);
82563 function checkCache(url, params, exactMatch, callback) {
82564 var rp = params.rp || 25;
82565 var testQuery = params.query || "";
82568 var hit = _taginfoCache[testUrl];
82569 if (hit && (url === testUrl || hit.length < rp)) {
82570 callback(null, hit);
82573 if (exactMatch || !testQuery.length)
82575 testQuery = testQuery.slice(0, -1);
82576 testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
82577 } while (testQuery.length >= 0);
82580 var taginfo_default = {
82583 _taginfoCache = {};
82585 // manually exclude some keys – #5377, #7485
82591 sorting_name: true,
82596 "bridge:name": true
82600 sortname: "values_all",
82604 lang: _mainLocalizer.languageCode()
82606 this.keys(params, function(err, data) {
82609 data.forEach(function(d2) {
82610 if (d2.value === "opening_hours")
82612 _popularKeys[d2.value] = true;
82616 reset: function() {
82617 Object.values(_inflight3).forEach(function(controller) {
82618 controller.abort();
82622 keys: function(params, callback) {
82623 var doRequest = params.debounce ? debouncedRequest2 : request2;
82624 params = clean(setSort(params));
82625 params = Object.assign({
82627 sortname: "count_all",
82630 lang: _mainLocalizer.languageCode()
82632 var url = apibase4 + "keys/all?" + utilQsString(params);
82633 doRequest(url, params, false, callback, function(err, d2) {
82637 var f2 = filterKeys(params.filter);
82638 var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
82639 _taginfoCache[url] = result;
82640 callback(null, result);
82644 multikeys: function(params, callback) {
82645 var doRequest = params.debounce ? debouncedRequest2 : request2;
82646 params = clean(setSort(params));
82647 params = Object.assign({
82649 sortname: "count_all",
82652 lang: _mainLocalizer.languageCode()
82654 var prefix = params.query;
82655 var url = apibase4 + "keys/all?" + utilQsString(params);
82656 doRequest(url, params, true, callback, function(err, d2) {
82660 var f2 = filterMultikeys(prefix);
82661 var result = d2.data.filter(f2).map(valKey);
82662 _taginfoCache[url] = result;
82663 callback(null, result);
82667 values: function(params, callback) {
82668 var key = params.key;
82669 if (key && _popularKeys[key]) {
82670 callback(null, []);
82673 var doRequest = params.debounce ? debouncedRequest2 : request2;
82674 params = clean(setSort(setFilter(params)));
82675 params = Object.assign({
82677 sortname: "count_all",
82680 lang: _mainLocalizer.languageCode()
82682 var url = apibase4 + "key/values?" + utilQsString(params);
82683 doRequest(url, params, false, callback, function(err, d2) {
82687 var allowUpperCase = allowUpperCaseTagValues.test(params.key);
82688 var f2 = filterValues(allowUpperCase);
82689 var result = d2.data.filter(f2).map(valKeyDescription);
82690 _taginfoCache[url] = result;
82691 callback(null, result);
82695 roles: function(params, callback) {
82696 var doRequest = params.debounce ? debouncedRequest2 : request2;
82697 var geometry = params.geometry;
82698 params = clean(setSortMembers(params));
82699 params = Object.assign({
82701 sortname: "count_all_members",
82704 lang: _mainLocalizer.languageCode()
82706 var url = apibase4 + "relation/roles?" + utilQsString(params);
82707 doRequest(url, params, true, callback, function(err, d2) {
82711 var f2 = filterRoles(geometry);
82712 var result = d2.data.filter(f2).map(roleKey);
82713 _taginfoCache[url] = result;
82714 callback(null, result);
82718 docs: function(params, callback) {
82719 var doRequest = params.debounce ? debouncedRequest2 : request2;
82720 params = clean(setSort(params));
82721 var path = "key/wiki_pages?";
82722 if (params.value) {
82723 path = "tag/wiki_pages?";
82724 } else if (params.rtype) {
82725 path = "relation/wiki_pages?";
82727 var url = apibase4 + path + utilQsString(params);
82728 doRequest(url, params, true, callback, function(err, d2) {
82732 _taginfoCache[url] = d2.data;
82733 callback(null, d2.data);
82737 apibase: function(_2) {
82738 if (!arguments.length)
82745 // modules/services/vector_tile.js
82746 var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
82747 var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
82748 var import_polygon_clipping = __toESM(require_polygon_clipping_umd());
82749 var import_pbf2 = __toESM(require_pbf());
82750 var import_vector_tile2 = __toESM(require_vector_tile());
82751 var tiler8 = utilTiler().tileSize(512).margin(1);
82752 var dispatch12 = dispatch_default("loadedData");
82754 function abortRequest7(controller) {
82755 controller.abort();
82757 function vtToGeoJSON(data, tile, mergeCache) {
82758 var vectorTile = new import_vector_tile2.default.VectorTile(new import_pbf2.default(data));
82759 var layers = Object.keys(vectorTile.layers);
82760 if (!Array.isArray(layers)) {
82764 layers.forEach(function(layerID) {
82765 var layer = vectorTile.layers[layerID];
82767 for (var i3 = 0; i3 < layer.length; i3++) {
82768 var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
82769 var geometry = feature3.geometry;
82770 if (geometry.type === "Polygon") {
82771 geometry.type = "MultiPolygon";
82772 geometry.coordinates = [geometry.coordinates];
82774 var isClipped = false;
82775 if (geometry.type === "MultiPolygon") {
82776 var featureClip = bboxClip(feature3, tile.extent.rectangle());
82777 if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
82780 if (!feature3.geometry.coordinates.length)
82782 if (!feature3.geometry.coordinates[0].length)
82785 var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
82786 var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
82787 feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
82788 feature3.__featurehash__ = featurehash;
82789 feature3.__propertyhash__ = propertyhash;
82790 features.push(feature3);
82791 if (isClipped && geometry.type === "MultiPolygon") {
82792 var merged = mergeCache[propertyhash];
82793 if (merged && merged.length) {
82794 var other = merged[0];
82795 var coords = import_polygon_clipping.default.union(
82796 feature3.geometry.coordinates,
82797 other.geometry.coordinates
82799 if (!coords || !coords.length) {
82802 merged.push(feature3);
82803 for (var j2 = 0; j2 < merged.length; j2++) {
82804 merged[j2].geometry.coordinates = coords;
82805 merged[j2].__featurehash__ = featurehash;
82808 mergeCache[propertyhash] = [feature3];
82816 function loadTile3(source, tile) {
82817 if (source.loaded[tile.id] || source.inflight[tile.id])
82819 var url = source.template.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace(/\{[t-]y\}/, Math.pow(2, tile.xyz[2]) - tile.xyz[1] - 1).replace(/\{z(oom)?\}/, tile.xyz[2]).replace(/\{switch:([^}]+)\}/, function(s2, r2) {
82820 var subdomains = r2.split(",");
82821 return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
82823 var controller = new AbortController();
82824 source.inflight[tile.id] = controller;
82825 fetch(url, { signal: controller.signal }).then(function(response) {
82826 if (!response.ok) {
82827 throw new Error(response.status + " " + response.statusText);
82829 source.loaded[tile.id] = [];
82830 delete source.inflight[tile.id];
82831 return response.arrayBuffer();
82832 }).then(function(data) {
82834 throw new Error("No Data");
82836 var z2 = tile.xyz[2];
82837 if (!source.canMerge[z2]) {
82838 source.canMerge[z2] = {};
82840 source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
82841 dispatch12.call("loadedData");
82842 }).catch(function() {
82843 source.loaded[tile.id] = [];
82844 delete source.inflight[tile.id];
82847 var vector_tile_default = {
82852 this.event = utilRebind(this, dispatch12, "on");
82854 reset: function() {
82855 for (var sourceID in _vtCache) {
82856 var source = _vtCache[sourceID];
82857 if (source && source.inflight) {
82858 Object.values(source.inflight).forEach(abortRequest7);
82863 addSource: function(sourceID, template) {
82864 _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
82865 return _vtCache[sourceID];
82867 data: function(sourceID, projection2) {
82868 var source = _vtCache[sourceID];
82871 var tiles = tiler8.getTiles(projection2);
82874 for (var i3 = 0; i3 < tiles.length; i3++) {
82875 var features = source.loaded[tiles[i3].id];
82876 if (!features || !features.length)
82878 for (var j2 = 0; j2 < features.length; j2++) {
82879 var feature3 = features[j2];
82880 var hash = feature3.__featurehash__;
82884 results.push(Object.assign({}, feature3));
82889 loadTiles: function(sourceID, template, projection2) {
82890 var source = _vtCache[sourceID];
82892 source = this.addSource(sourceID, template);
82894 var tiles = tiler8.getTiles(projection2);
82895 Object.keys(source.inflight).forEach(function(k2) {
82896 var wanted = tiles.find(function(tile) {
82897 return k2 === tile.id;
82900 abortRequest7(source.inflight[k2]);
82901 delete source.inflight[k2];
82904 tiles.forEach(function(tile) {
82905 loadTile3(source, tile);
82908 cache: function() {
82913 // modules/services/wikidata.js
82914 var apibase5 = "https://www.wikidata.org/w/api.php?";
82915 var _wikidataCache = {};
82916 var wikidata_default = {
82919 reset: function() {
82920 _wikidataCache = {};
82922 // Search for Wikidata items matching the query
82923 itemsForSearchQuery: function(query, callback, language) {
82926 callback("No query", {});
82929 var lang = this.languagesToQuery()[0];
82930 var url = apibase5 + utilQsString({
82931 action: "wbsearchentities",
82936 // the language to search
82937 language: language || lang,
82938 // the language for the label and description in the result
82943 json_default(url).then((result) => {
82944 if (result && result.error) {
82945 if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
82946 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
82949 throw new Error(result.error);
82953 callback(null, result.search || {});
82954 }).catch(function(err) {
82956 callback(err.message, {});
82959 // Given a Wikipedia language and article title,
82960 // return an array of corresponding Wikidata entities.
82961 itemsByTitle: function(lang, title, callback) {
82964 callback("No title", {});
82967 lang = lang || "en";
82968 var url = apibase5 + utilQsString({
82969 action: "wbgetentities",
82972 sites: lang.replace(/-/g, "_") + "wiki",
82975 // shrink response by filtering to one language
82978 json_default(url).then(function(result) {
82979 if (result && result.error) {
82980 throw new Error(result.error);
82983 callback(null, result.entities || {});
82984 }).catch(function(err) {
82986 callback(err.message, {});
82989 languagesToQuery: function() {
82990 return _mainLocalizer.localeCodes().map(function(code) {
82991 return code.toLowerCase();
82992 }).filter(function(code) {
82993 return code !== "en-us";
82996 entityByQID: function(qid, callback) {
82998 callback("No qid", {});
83001 if (_wikidataCache[qid]) {
83003 callback(null, _wikidataCache[qid]);
83006 var langs = this.languagesToQuery();
83007 var url = apibase5 + utilQsString({
83008 action: "wbgetentities",
83012 props: "labels|descriptions|claims|sitelinks",
83013 sitefilter: langs.map(function(d2) {
83014 return d2 + "wiki";
83016 languages: langs.join("|"),
83017 languagefallback: 1,
83020 json_default(url).then(function(result) {
83021 if (result && result.error) {
83022 throw new Error(result.error);
83025 callback(null, result.entities[qid] || {});
83026 }).catch(function(err) {
83028 callback(err.message, {});
83031 // Pass `params` object of the form:
83033 // qid: 'string' // brand wikidata (e.g. 'Q37158')
83036 // Get an result object used to display tag documentation
83038 // title: 'string',
83039 // description: 'string',
83040 // editURL: 'string',
83041 // imageURL: 'string',
83042 // wiki: { title: 'string', text: 'string', url: 'string' }
83045 getDocs: function(params, callback) {
83046 var langs = this.languagesToQuery();
83047 this.entityByQID(params.qid, function(err, entity) {
83048 if (err || !entity) {
83049 callback(err || "No entity");
83054 for (i3 in langs) {
83055 let code = langs[i3];
83056 if (entity.descriptions[code] && entity.descriptions[code].language === code) {
83057 description = entity.descriptions[code];
83061 if (!description && Object.values(entity.descriptions).length)
83062 description = Object.values(entity.descriptions)[0];
83065 description: description ? description.value : "",
83066 descriptionLocaleCode: description ? description.language : "",
83067 editURL: "https://www.wikidata.org/wiki/" + entity.id
83069 if (entity.claims) {
83070 var imageroot = "https://commons.wikimedia.org/w/index.php";
83071 var props = ["P154", "P18"];
83073 for (i3 = 0; i3 < props.length; i3++) {
83074 prop = entity.claims[props[i3]];
83075 if (prop && Object.keys(prop).length > 0) {
83076 image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
83078 result.imageURL = imageroot + "?" + utilQsString({
83079 title: "Special:Redirect/file/" + image,
83087 if (entity.sitelinks) {
83088 var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
83089 for (i3 = 0; i3 < langs.length; i3++) {
83090 var w2 = langs[i3] + "wiki";
83091 if (entity.sitelinks[w2]) {
83092 var title = entity.sitelinks[w2].title;
83093 var tKey = "inspector.wiki_reference";
83094 if (!englishLocale && langs[i3] === "en") {
83095 tKey = "inspector.wiki_en_reference";
83100 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
83106 callback(null, result);
83111 // modules/services/wikipedia.js
83112 var endpoint = "https://en.wikipedia.org/w/api.php?";
83113 var wikipedia_default = {
83116 reset: function() {
83118 search: function(lang, query, callback) {
83121 callback("No Query", []);
83124 lang = lang || "en";
83125 var url = endpoint.replace("en", lang) + utilQsString({
83129 srinfo: "suggestion",
83134 json_default(url).then(function(result) {
83135 if (result && result.error) {
83136 throw new Error(result.error);
83137 } else if (!result || !result.query || !result.query.search) {
83138 throw new Error("No Results");
83141 var titles = result.query.search.map(function(d2) {
83144 callback(null, titles);
83146 }).catch(function(err) {
83151 suggestions: function(lang, query, callback) {
83157 lang = lang || "en";
83158 var url = endpoint.replace("en", lang) + utilQsString({
83159 action: "opensearch",
83166 json_default(url).then(function(result) {
83167 if (result && result.error) {
83168 throw new Error(result.error);
83169 } else if (!result || result.length < 2) {
83170 throw new Error("No Results");
83173 callback(null, result[1] || []);
83174 }).catch(function(err) {
83176 callback(err.message, []);
83179 translations: function(lang, title, callback) {
83182 callback("No Title");
83185 var url = endpoint.replace("en", lang) + utilQsString({
83193 json_default(url).then(function(result) {
83194 if (result && result.error) {
83195 throw new Error(result.error);
83196 } else if (!result || !result.query || !result.query.pages) {
83197 throw new Error("No Results");
83200 var list2 = result.query.pages[Object.keys(result.query.pages)[0]];
83201 var translations = {};
83202 if (list2 && list2.langlinks) {
83203 list2.langlinks.forEach(function(d2) {
83204 translations[d2.lang] = d2["*"];
83207 callback(null, translations);
83209 }).catch(function(err) {
83211 callback(err.message);
83216 // modules/services/mapilio.js
83217 var import_pbf3 = __toESM(require_pbf());
83218 var import_rbush12 = __toESM(require_rbush_min());
83219 var import_vector_tile3 = __toESM(require_vector_tile());
83220 var apiUrl2 = "https://end.mapilio.com";
83221 var imageBaseUrl = "https://cdn.mapilio.com/im";
83222 var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
83223 var pointLayer = "map_points";
83224 var lineLayer = "map_roads_line";
83225 var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
83227 var dispatch13 = dispatch_default("loadedImages", "loadedLines");
83228 var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
83229 var pannellumViewerCSS3 = "pannellum/pannellum.css";
83230 var pannellumViewerJS3 = "pannellum/pannellum.js";
83231 var resolution = 1080;
83234 var _loadViewerPromise5;
83235 var _pannellumViewer3;
83236 var _sceneOptions2 = {
83237 showFullscreenCtrl: false,
83244 var _currScene2 = 0;
83245 function partitionViewport5(projection2) {
83246 const z2 = geoScaleToZoom(projection2.scale());
83247 const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
83248 const tiler9 = utilTiler().zoomExtent([z22, z22]);
83249 return tiler9.getTiles(projection2).map(function(tile) {
83250 return tile.extent;
83253 function searchLimited5(limit, projection2, rtree) {
83254 limit = limit || 5;
83255 return partitionViewport5(projection2).reduce(function(result, extent) {
83256 const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
83259 return found.length ? result.concat(found) : result;
83262 function loadTiles4(which, url, maxZoom2, projection2) {
83263 const tiler9 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
83264 const tiles = tiler9.getTiles(projection2);
83265 tiles.forEach(function(tile) {
83266 loadTile4(which, url, tile);
83269 function loadTile4(which, url, tile) {
83270 const cache = _cache4.requests;
83271 const tileId = "".concat(tile.id, "-").concat(which);
83272 if (cache.loaded[tileId] || cache.inflight[tileId])
83274 const controller = new AbortController();
83275 cache.inflight[tileId] = controller;
83276 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
83277 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
83278 if (!response.ok) {
83279 throw new Error(response.status + " " + response.statusText);
83281 cache.loaded[tileId] = true;
83282 delete cache.inflight[tileId];
83283 return response.arrayBuffer();
83284 }).then(function(data) {
83285 if (data.byteLength === 0) {
83286 throw new Error("No Data");
83288 loadTileDataToCache2(data, tile, which);
83289 if (which === "images") {
83290 dispatch13.call("loadedImages");
83292 dispatch13.call("loadedLines");
83294 }).catch(function(e3) {
83295 if (e3.message === "No Data") {
83296 cache.loaded[tileId] = true;
83302 function loadTileDataToCache2(data, tile) {
83303 const vectorTile = new import_vector_tile3.VectorTile(new import_pbf3.default(data));
83304 let features, cache, layer, i3, feature3, loc, d2;
83305 if (vectorTile.layers.hasOwnProperty(pointLayer)) {
83307 cache = _cache4.images;
83308 layer = vectorTile.layers[pointLayer];
83309 for (i3 = 0; i3 < layer.length; i3++) {
83310 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
83311 loc = feature3.geometry.coordinates;
83312 let resolutionArr = feature3.properties.resolution.split("x");
83313 let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
83314 let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
83315 let isPano = sourceWidth % sourceHeight === 0;
83318 capture_time: feature3.properties.capture_time,
83319 id: feature3.properties.id,
83320 sequence_id: feature3.properties.sequence_uuid,
83321 heading: feature3.properties.heading,
83322 resolution: feature3.properties.resolution,
83325 cache.forImageId[d2.id] = d2;
83335 cache.rtree.load(features);
83338 if (vectorTile.layers.hasOwnProperty(lineLayer)) {
83339 cache = _cache4.sequences;
83340 layer = vectorTile.layers[lineLayer];
83341 for (i3 = 0; i3 < layer.length; i3++) {
83342 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
83343 if (cache.lineString[feature3.properties.sequence_uuid]) {
83344 cache.lineString[feature3.properties.sequence_uuid].push(feature3);
83346 cache.lineString[feature3.properties.sequence_uuid] = [feature3];
83351 function getImageData(imageId, sequenceId) {
83352 return fetch(apiUrl2 + "/api/sequence-detail?sequence_uuid=".concat(sequenceId), { method: "GET" }).then(function(response) {
83353 if (!response.ok) {
83354 throw new Error(response.status + " " + response.statusText);
83356 return response.json();
83357 }).then(function(data) {
83358 let index = data.data.findIndex((feature3) => feature3.id === imageId);
83359 const { filename, uploaded_hash } = data.data[index];
83360 _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
83363 var mapilio_default = {
83364 // Initialize Mapilio
83369 this.event = utilRebind(this, dispatch13, "on");
83371 // Reset cache and state
83372 reset: function() {
83374 Object.values(_cache4.requests.inflight).forEach(function(request3) {
83379 images: { rtree: new import_rbush12.default(), forImageId: {} },
83380 sequences: { rtree: new import_rbush12.default(), lineString: {} },
83381 requests: { loaded: {}, inflight: {} }
83383 _activeImage = null;
83385 // Get visible images
83386 images: function(projection2) {
83388 return searchLimited5(limit, projection2, _cache4.images.rtree);
83390 cachedImage: function(imageKey) {
83391 return _cache4.images.forImageId[imageKey];
83393 // Load images in the visible area
83394 loadImages: function(projection2) {
83395 let url = baseTileUrl2 + pointLayer + tileStyle;
83396 loadTiles4("images", url, 14, projection2);
83398 // Load line in the visible area
83399 loadLines: function(projection2) {
83400 let url = baseTileUrl2 + lineLayer + tileStyle;
83401 loadTiles4("line", url, 14, projection2);
83403 // Get visible sequences
83404 sequences: function(projection2) {
83405 const viewport = projection2.clipExtent();
83406 const min3 = [viewport[0][0], viewport[1][1]];
83407 const max3 = [viewport[1][0], viewport[0][1]];
83408 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
83409 const sequenceIds = {};
83410 let lineStrings = [];
83411 _cache4.images.rtree.search(bbox2).forEach(function(d2) {
83412 if (d2.data.sequence_id) {
83413 sequenceIds[d2.data.sequence_id] = true;
83416 Object.keys(sequenceIds).forEach(function(sequenceId) {
83417 if (_cache4.sequences.lineString[sequenceId]) {
83418 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
83421 return lineStrings;
83423 // Set the currently visible image
83424 setActiveImage: function(image) {
83428 sequence_id: image.sequence_id
83431 _activeImage = null;
83434 // Update the currently highlighted sequence and selected bubble.
83435 setStyles: function(context, hovered) {
83436 const hoveredImageId = hovered && hovered.id;
83437 const hoveredSequenceId = hovered && hovered.sequence_id;
83438 const selectedSequenceId = _activeImage && _activeImage.sequence_id;
83439 const selectedImageId = _activeImage && _activeImage.id;
83440 const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
83441 const sequences = context.container().selectAll(".layer-mapilio .sequence");
83442 markers.classed("highlighted", function(d2) {
83443 return d2.id === hoveredImageId;
83444 }).classed("hovered", function(d2) {
83445 return d2.id === hoveredImageId;
83446 }).classed("currentView", function(d2) {
83447 return d2.id === selectedImageId;
83449 sequences.classed("highlighted", function(d2) {
83450 return d2.properties.sequence_uuid === hoveredSequenceId;
83451 }).classed("currentView", function(d2) {
83452 return d2.properties.sequence_uuid === selectedSequenceId;
83456 updateUrlImage: function(imageKey) {
83457 if (!window.mocha) {
83458 var hash = utilStringQs(window.location.hash);
83460 hash.photo = "mapilio/" + imageKey;
83464 window.location.replace("#" + utilQsString(hash, true));
83467 initViewer: function() {
83468 if (!window.pannellum)
83470 if (_pannellumViewer3)
83473 const sceneID = _currScene2.toString();
83475 "default": { firstScene: sceneID },
83478 options2.scenes[sceneID] = _sceneOptions2;
83479 _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
83481 selectImage: function(context, id2) {
83483 let d2 = this.cachedImage(id2);
83484 this.setActiveImage(d2);
83485 this.updateUrlImage(d2.id);
83486 let viewer = context.container().select(".photoviewer");
83487 if (!viewer.empty())
83489 this.setStyles(context, null);
83492 let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
83493 let attribution = wrap2.selectAll(".photo-attribution").text("");
83494 if (d2.capture_time) {
83495 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
83496 attribution.append("span").text("|");
83498 attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", "https://mapilio.com/app?lat=".concat(d2.loc[1], "&lng=").concat(d2.loc[0], "&zoom=17&pId=").concat(d2.id)).text("mapilio.com");
83499 wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
83500 wrap2.selectAll("img").remove();
83501 wrap2.selectAll("button.back").classed("hide", !_cache4.images.forImageId.hasOwnProperty(+id2 - 1));
83502 wrap2.selectAll("button.forward").classed("hide", !_cache4.images.forImageId.hasOwnProperty(+id2 + 1));
83503 getImageData(d2.id, d2.sequence_id).then(function() {
83505 if (!_pannellumViewer3) {
83509 let sceneID = _currScene2.toString();
83510 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
83511 if (_currScene2 > 2) {
83512 sceneID = (_currScene2 - 1).toString();
83513 _pannellumViewer3.removeScene(sceneID);
83517 that.initOnlyPhoto(context);
83520 function localeDateString2(s2) {
83523 var options2 = { day: "numeric", month: "short", year: "numeric" };
83524 var d4 = new Date(s2);
83525 if (isNaN(d4.getTime()))
83527 return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
83531 initOnlyPhoto: function(context) {
83532 if (_pannellumViewer3) {
83533 _pannellumViewer3.destroy();
83534 _pannellumViewer3 = null;
83536 let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
83537 let imgWrap = wrap2.select("img");
83538 if (!imgWrap.empty()) {
83539 imgWrap.attr("src", _sceneOptions2.panorama);
83541 wrap2.append("img").attr("src", _sceneOptions2.panorama);
83544 ensureViewerLoaded: function(context) {
83546 let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
83547 if (!imgWrap.empty()) {
83550 if (_loadViewerPromise5)
83551 return _loadViewerPromise5;
83552 let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
83553 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
83554 wrapEnter.append("div").attr("class", "photo-attribution fillD");
83555 const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
83556 controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
83557 controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
83558 wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
83559 wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
83560 context.ui().photoviewer.on("resize.mapilio", () => {
83561 if (_pannellumViewer3) {
83562 _pannellumViewer3.resize();
83565 _loadViewerPromise5 = new Promise((resolve, reject) => {
83566 let loadedCount = 0;
83567 function loaded() {
83569 if (loadedCount === 2)
83572 const head = select_default2("head");
83573 head.selectAll("#ideditor-mapilio-viewercss").data([0]).enter().append("link").attr("id", "ideditor-mapilio-viewercss").attr("rel", "stylesheet").attr("crossorigin", "anonymous").attr("href", context.asset(pannellumViewerCSS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
83576 head.selectAll("#ideditor-mapilio-viewerjs").data([0]).enter().append("script").attr("id", "ideditor-mapilio-viewerjs").attr("crossorigin", "anonymous").attr("src", context.asset(pannellumViewerJS3)).on("load.serviceMapilio", loaded).on("error.serviceMapilio", function() {
83579 }).catch(function() {
83580 _loadViewerPromise5 = null;
83582 function step(stepBy) {
83583 return function() {
83586 const imageId = _activeImage.id;
83587 const nextIndex = imageId + stepBy;
83590 const nextImage = _cache4.images.forImageId[nextIndex];
83591 context.map().centerEase(nextImage.loc);
83592 that.selectImage(context, nextImage.id);
83595 function zoomPan2(d3_event) {
83596 var t2 = d3_event.transform;
83597 context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
83599 return _loadViewerPromise5;
83601 showViewer: function(context) {
83602 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
83603 let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
83605 wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
83606 wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
83613 hideViewer: function(context) {
83614 let viewer = context.container().select(".photoviewer");
83615 if (!viewer.empty())
83616 viewer.datum(null);
83617 this.updateUrlImage(null);
83618 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
83619 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
83620 this.setActiveImage();
83621 return this.setStyles(context, null);
83623 // Return the current cache
83624 cache: function() {
83629 // modules/services/index.js
83631 geocoder: nominatim_default,
83632 keepRight: keepRight_default,
83633 improveOSM: improveOSM_default,
83634 osmose: osmose_default,
83635 mapillary: mapillary_default,
83637 kartaview: kartaview_default,
83638 vegbilder: vegbilder_default,
83640 osmWikibase: osm_wikibase_default,
83641 maprules: maprules_default,
83642 streetside: streetside_default,
83643 taginfo: taginfo_default,
83644 vectorTile: vector_tile_default,
83645 wikidata: wikidata_default,
83646 wikipedia: wikipedia_default,
83647 mapilio: mapilio_default
83650 // modules/modes/drag_note.js
83651 function modeDragNote(context) {
83656 var edit2 = behaviorEdit(context);
83657 var _nudgeInterval;
83660 function startNudge(d3_event, nudge) {
83661 if (_nudgeInterval)
83662 window.clearInterval(_nudgeInterval);
83663 _nudgeInterval = window.setInterval(function() {
83664 context.map().pan(nudge);
83665 doMove(d3_event, nudge);
83668 function stopNudge() {
83669 if (_nudgeInterval) {
83670 window.clearInterval(_nudgeInterval);
83671 _nudgeInterval = null;
83674 function origin(note) {
83675 return context.projection(note.loc);
83677 function start2(d3_event, note) {
83679 var osm = services.osm;
83681 _note = osm.getNote(_note.id);
83683 context.surface().selectAll(".note-" + _note.id).classed("active", true);
83684 context.perform(actionNoop());
83685 context.enter(mode);
83686 context.selectedNoteID(_note.id);
83688 function move(d3_event, entity, point2) {
83689 d3_event.stopPropagation();
83690 _lastLoc = context.projection.invert(point2);
83692 var nudge = geoViewportEdge(point2, context.map().dimensions());
83694 startNudge(d3_event, nudge);
83699 function doMove(d3_event, nudge) {
83700 nudge = nudge || [0, 0];
83701 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
83702 var currMouse = geoVecSubtract(currPoint, nudge);
83703 var loc = context.projection.invert(currMouse);
83704 _note = _note.move(loc);
83705 var osm = services.osm;
83707 osm.replaceNote(_note);
83709 context.replace(actionNoop());
83712 context.replace(actionNoop());
83713 context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
83715 var drag = behaviorDrag().selector(".layer-touch.markers .target.note.new").surface(context.container().select(".main-map").node()).origin(origin).on("start", start2).on("move", move).on("end", end);
83716 mode.enter = function() {
83717 context.install(edit2);
83719 mode.exit = function() {
83720 context.ui().sidebar.hover.cancel();
83721 context.uninstall(edit2);
83722 context.surface().selectAll(".active").classed("active", false);
83725 mode.behavior = drag;
83729 // modules/modes/select_data.js
83730 function modeSelectData(context, selectedDatum) {
83735 var keybinding = utilKeybinding("select-data");
83736 var dataEditor = uiDataEditor(context);
83738 behaviorBreathe(context),
83739 behaviorHover(context),
83740 behaviorSelect(context),
83741 behaviorLasso(context),
83742 modeDragNode(context).behavior,
83743 modeDragNote(context).behavior
83745 function selectData(d3_event, drawn) {
83746 var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
83747 if (selection2.empty()) {
83748 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
83749 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
83750 context.enter(modeBrowse(context));
83753 selection2.classed("selected", true);
83757 if (context.container().select(".combobox").size())
83759 context.enter(modeBrowse(context));
83761 mode.zoomToSelected = function() {
83762 var extent = geoExtent(bounds_default(selectedDatum));
83763 context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
83765 mode.enter = function() {
83766 behaviors.forEach(context.install);
83767 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
83768 select_default2(document).call(keybinding);
83770 var sidebar = context.ui().sidebar;
83771 sidebar.show(dataEditor.datum(selectedDatum));
83772 var extent = geoExtent(bounds_default(selectedDatum));
83773 sidebar.expand(sidebar.intersects(extent));
83774 context.map().on("drawn.select-data", selectData);
83776 mode.exit = function() {
83777 behaviors.forEach(context.uninstall);
83778 select_default2(document).call(keybinding.unbind);
83779 context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
83780 context.map().on("drawn.select-data", null);
83781 context.ui().sidebar.hide();
83786 // modules/behavior/select.js
83787 function behaviorSelect(context) {
83788 var _tolerancePx = 4;
83789 var _lastMouseEvent = null;
83790 var _showMenu = false;
83791 var _downPointers = {};
83792 var _longPressTimeout = null;
83793 var _lastInteractionType = null;
83794 var _multiselectionPointerId = null;
83795 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
83796 function keydown(d3_event) {
83797 if (d3_event.keyCode === 32) {
83798 var activeNode = document.activeElement;
83799 if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName))
83802 if (d3_event.keyCode === 93 || // context menu key
83803 d3_event.keyCode === 32) {
83804 d3_event.preventDefault();
83806 if (d3_event.repeat)
83809 if (d3_event.shiftKey) {
83810 context.surface().classed("behavior-multiselect", true);
83812 if (d3_event.keyCode === 32) {
83813 if (!_downPointers.spacebar && _lastMouseEvent) {
83815 _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
83816 _downPointers.spacebar = {
83817 firstEvent: _lastMouseEvent,
83818 lastEvent: _lastMouseEvent
83823 function keyup(d3_event) {
83825 if (!d3_event.shiftKey) {
83826 context.surface().classed("behavior-multiselect", false);
83828 if (d3_event.keyCode === 93) {
83829 d3_event.preventDefault();
83830 _lastInteractionType = "menukey";
83831 contextmenu(d3_event);
83832 } else if (d3_event.keyCode === 32) {
83833 var pointer = _downPointers.spacebar;
83835 delete _downPointers.spacebar;
83838 d3_event.preventDefault();
83839 _lastInteractionType = "spacebar";
83840 click(pointer.firstEvent, pointer.lastEvent, "spacebar");
83844 function pointerdown(d3_event) {
83845 var id2 = (d3_event.pointerId || "mouse").toString();
83847 if (d3_event.buttons && d3_event.buttons !== 1)
83849 context.ui().closeEditMenu();
83850 if (d3_event.pointerType !== "mouse") {
83851 _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
83853 _downPointers[id2] = {
83854 firstEvent: d3_event,
83855 lastEvent: d3_event
83858 function didLongPress(id2, interactionType) {
83859 var pointer = _downPointers[id2];
83862 for (var i3 in _downPointers) {
83863 _downPointers[i3].done = true;
83865 _longPressTimeout = null;
83866 _lastInteractionType = interactionType;
83868 click(pointer.firstEvent, pointer.lastEvent, id2);
83870 function pointermove(d3_event) {
83871 var id2 = (d3_event.pointerId || "mouse").toString();
83872 if (_downPointers[id2]) {
83873 _downPointers[id2].lastEvent = d3_event;
83875 if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
83876 _lastMouseEvent = d3_event;
83877 if (_downPointers.spacebar) {
83878 _downPointers.spacebar.lastEvent = d3_event;
83882 function pointerup(d3_event) {
83883 var id2 = (d3_event.pointerId || "mouse").toString();
83884 var pointer = _downPointers[id2];
83887 delete _downPointers[id2];
83888 if (_multiselectionPointerId === id2) {
83889 _multiselectionPointerId = null;
83893 click(pointer.firstEvent, d3_event, id2);
83895 function pointercancel(d3_event) {
83896 var id2 = (d3_event.pointerId || "mouse").toString();
83897 if (!_downPointers[id2])
83899 delete _downPointers[id2];
83900 if (_multiselectionPointerId === id2) {
83901 _multiselectionPointerId = null;
83904 function contextmenu(d3_event) {
83905 d3_event.preventDefault();
83906 if (!+d3_event.clientX && !+d3_event.clientY) {
83907 if (_lastMouseEvent) {
83908 d3_event = _lastMouseEvent;
83913 _lastMouseEvent = d3_event;
83914 if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
83915 (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
83916 _lastInteractionType = "touch";
83918 _lastInteractionType = "rightclick";
83922 click(d3_event, d3_event);
83924 function click(firstEvent, lastEvent, pointerId) {
83926 var mapNode = context.container().select(".main-map").node();
83927 var pointGetter = utilFastMouse(mapNode);
83928 var p1 = pointGetter(firstEvent);
83929 var p2 = pointGetter(lastEvent);
83930 var dist = geoVecLength(p1, p2);
83931 if (dist > _tolerancePx || !mapContains(lastEvent)) {
83935 var targetDatum = lastEvent.target.__data__;
83936 var multiselectEntityId;
83937 if (!_multiselectionPointerId) {
83938 var selectPointerInfo = pointerDownOnSelection(pointerId);
83939 if (selectPointerInfo) {
83940 _multiselectionPointerId = selectPointerInfo.pointerId;
83941 multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
83942 _downPointers[selectPointerInfo.pointerId].done = true;
83945 var isMultiselect = context.mode().id === "select" && // and shift key is down
83946 (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
83947 context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
83948 _multiselectionPointerId && !multiselectEntityId);
83949 processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
83950 function mapContains(event) {
83951 var rect = mapNode.getBoundingClientRect();
83952 return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
83954 function pointerDownOnSelection(skipPointerId) {
83955 var mode = context.mode();
83956 var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
83957 for (var pointerId2 in _downPointers) {
83958 if (pointerId2 === "spacebar" || pointerId2 === skipPointerId)
83960 var pointerInfo = _downPointers[pointerId2];
83961 var p12 = pointGetter(pointerInfo.firstEvent);
83962 var p22 = pointGetter(pointerInfo.lastEvent);
83963 if (geoVecLength(p12, p22) > _tolerancePx)
83965 var datum2 = pointerInfo.firstEvent.target.__data__;
83966 var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
83967 if (context.graph().hasEntity(entity.id)) {
83969 pointerId: pointerId2,
83970 entityId: entity.id,
83971 selected: selectedIDs.indexOf(entity.id) !== -1
83978 function processClick(datum2, isMultiselect, point2, alsoSelectId) {
83979 var mode = context.mode();
83980 var showMenu = _showMenu;
83981 var interactionType = _lastInteractionType;
83982 var entity = datum2 && datum2.properties && datum2.properties.entity;
83985 if (datum2 && datum2.type === "midpoint") {
83986 datum2 = datum2.parents[0];
83989 if (datum2 instanceof osmEntity) {
83990 var selectedIDs = context.selectedIDs();
83991 context.selectedNoteID(null);
83992 context.selectedErrorID(null);
83993 if (!isMultiselect) {
83994 if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
83995 if (alsoSelectId === datum2.id)
83996 alsoSelectId = null;
83997 selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
83998 newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
83999 context.enter(newMode);
84002 if (selectedIDs.indexOf(datum2.id) !== -1) {
84004 selectedIDs = selectedIDs.filter(function(id2) {
84005 return id2 !== datum2.id;
84007 newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
84008 context.enter(newMode);
84011 selectedIDs = selectedIDs.concat([datum2.id]);
84012 newMode = mode.selectedIDs(selectedIDs);
84013 context.enter(newMode);
84016 } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
84017 context.selectedNoteID(null).enter(modeSelectData(context, datum2));
84018 } else if (datum2 instanceof osmNote && !isMultiselect) {
84019 context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
84020 } else if (datum2 instanceof QAItem && !isMultiselect) {
84021 context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
84023 context.selectedNoteID(null);
84024 context.selectedErrorID(null);
84025 if (!isMultiselect && mode.id !== "browse") {
84026 context.enter(modeBrowse(context));
84029 context.ui().closeEditMenu();
84031 context.ui().showEditMenu(point2, interactionType);
84034 function cancelLongPress() {
84035 if (_longPressTimeout)
84036 window.clearTimeout(_longPressTimeout);
84037 _longPressTimeout = null;
84039 function resetProperties() {
84042 _lastInteractionType = null;
84044 function behavior(selection2) {
84046 _lastMouseEvent = context.map().lastPointerEvent();
84047 select_default2(window).on("keydown.select", keydown).on("keyup.select", keyup).on(_pointerPrefix + "move.select", pointermove, true).on(_pointerPrefix + "up.select", pointerup, true).on("pointercancel.select", pointercancel, true).on("contextmenu.select-window", function(d3_event) {
84049 if (+e3.clientX === 0 && +e3.clientY === 0) {
84050 d3_event.preventDefault();
84053 selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
84055 behavior.off = function(selection2) {
84057 select_default2(window).on("keydown.select", null).on("keyup.select", null).on("contextmenu.select-window", null).on(_pointerPrefix + "move.select", null, true).on(_pointerPrefix + "up.select", null, true).on("pointercancel.select", null, true);
84058 selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
84059 context.surface().classed("behavior-multiselect", false);
84064 // modules/operations/index.js
84065 var operations_exports = {};
84066 __export(operations_exports, {
84067 operationCircularize: () => operationCircularize,
84068 operationContinue: () => operationContinue,
84069 operationCopy: () => operationCopy,
84070 operationDelete: () => operationDelete,
84071 operationDisconnect: () => operationDisconnect,
84072 operationDowngrade: () => operationDowngrade,
84073 operationExtract: () => operationExtract,
84074 operationMerge: () => operationMerge,
84075 operationMove: () => operationMove,
84076 operationOrthogonalize: () => operationOrthogonalize,
84077 operationPaste: () => operationPaste,
84078 operationReflectLong: () => operationReflectLong,
84079 operationReflectShort: () => operationReflectShort,
84080 operationReverse: () => operationReverse,
84081 operationRotate: () => operationRotate,
84082 operationSplit: () => operationSplit,
84083 operationStraighten: () => operationStraighten
84086 // modules/operations/continue.js
84087 function operationContinue(context, selectedIDs) {
84088 var _entities = selectedIDs.map(function(id2) {
84089 return context.graph().entity(id2);
84091 var _geometries = Object.assign(
84092 { line: [], vertex: [] },
84093 utilArrayGroupBy(_entities, function(entity) {
84094 return entity.geometry(context.graph());
84097 var _vertex = _geometries.vertex.length && _geometries.vertex[0];
84098 function candidateWays() {
84099 return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
84100 return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
84103 var _candidates = candidateWays();
84104 var operation2 = function() {
84105 var candidate = _candidates[0];
84107 modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
84110 operation2.relatedEntityIds = function() {
84111 return _candidates.length ? [_candidates[0].id] : [];
84113 operation2.available = function() {
84114 return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
84116 operation2.disabled = function() {
84117 if (_candidates.length === 0) {
84118 return "not_eligible";
84119 } else if (_candidates.length > 1) {
84124 operation2.tooltip = function() {
84125 var disable = operation2.disabled();
84126 return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
84128 operation2.annotation = function() {
84129 return _t("operations.continue.annotation.line");
84131 operation2.id = "continue";
84132 operation2.keys = [_t("operations.continue.key")];
84133 operation2.title = _t.append("operations.continue.title");
84134 operation2.behavior = behaviorOperation(context).which(operation2);
84138 // modules/operations/copy.js
84139 function operationCopy(context, selectedIDs) {
84140 function getFilteredIdsToCopy() {
84141 return selectedIDs.filter(function(selectedID) {
84142 var entity = context.graph().hasEntity(selectedID);
84143 return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
84146 var operation2 = function() {
84147 var graph = context.graph();
84148 var selected = groupEntities(getFilteredIdsToCopy(), graph);
84153 for (i3 = 0; i3 < selected.relation.length; i3++) {
84154 entity = selected.relation[i3];
84155 if (!skip[entity.id] && entity.isComplete(graph)) {
84156 canCopy.push(entity.id);
84157 skip = getDescendants(entity.id, graph, skip);
84160 for (i3 = 0; i3 < selected.way.length; i3++) {
84161 entity = selected.way[i3];
84162 if (!skip[entity.id]) {
84163 canCopy.push(entity.id);
84164 skip = getDescendants(entity.id, graph, skip);
84167 for (i3 = 0; i3 < selected.node.length; i3++) {
84168 entity = selected.node[i3];
84169 if (!skip[entity.id]) {
84170 canCopy.push(entity.id);
84173 context.copyIDs(canCopy);
84174 if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
84175 context.copyLonLat(context.projection.invert(_point));
84177 context.copyLonLat(null);
84180 function groupEntities(ids, graph) {
84181 var entities = ids.map(function(id2) {
84182 return graph.entity(id2);
84184 return Object.assign(
84185 { relation: [], way: [], node: [] },
84186 utilArrayGroupBy(entities, "type")
84189 function getDescendants(id2, graph, descendants) {
84190 var entity = graph.entity(id2);
84192 descendants = descendants || {};
84193 if (entity.type === "relation") {
84194 children2 = entity.members.map(function(m2) {
84197 } else if (entity.type === "way") {
84198 children2 = entity.nodes;
84202 for (var i3 = 0; i3 < children2.length; i3++) {
84203 if (!descendants[children2[i3]]) {
84204 descendants[children2[i3]] = true;
84205 descendants = getDescendants(children2[i3], graph, descendants);
84208 return descendants;
84210 operation2.available = function() {
84211 return getFilteredIdsToCopy().length > 0;
84213 operation2.disabled = function() {
84214 var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
84215 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
84216 return "too_large";
84220 operation2.availableForKeypress = function() {
84221 var selection2 = window.getSelection && window.getSelection();
84222 return !selection2 || !selection2.toString();
84224 operation2.tooltip = function() {
84225 var disable = operation2.disabled();
84226 return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
84228 operation2.annotation = function() {
84229 return _t("operations.copy.annotation", { n: selectedIDs.length });
84232 operation2.point = function(val) {
84236 operation2.id = "copy";
84237 operation2.keys = [uiCmd("\u2318C")];
84238 operation2.title = _t.append("operations.copy.title");
84239 operation2.behavior = behaviorOperation(context).which(operation2);
84243 // modules/operations/disconnect.js
84244 function operationDisconnect(context, selectedIDs) {
84245 var _vertexIDs = [];
84247 var _otherIDs = [];
84249 selectedIDs.forEach(function(id2) {
84250 var entity = context.entity(id2);
84251 if (entity.type === "way") {
84253 } else if (entity.geometry(context.graph()) === "vertex") {
84254 _vertexIDs.push(id2);
84256 _otherIDs.push(id2);
84259 var _coords, _descriptionID = "", _annotationID = "features";
84260 var _disconnectingVertexIds = [];
84261 var _disconnectingWayIds = [];
84262 if (_vertexIDs.length > 0) {
84263 _disconnectingVertexIds = _vertexIDs;
84264 _vertexIDs.forEach(function(vertexID) {
84265 var action = actionDisconnect(vertexID);
84266 if (_wayIDs.length > 0) {
84267 var waysIDsForVertex = _wayIDs.filter(function(wayID) {
84268 var way = context.entity(wayID);
84269 return way.nodes.indexOf(vertexID) !== -1;
84271 action.limitWays(waysIDsForVertex);
84273 _actions.push(action);
84274 _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
84276 _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
84277 return _wayIDs.indexOf(id2) === -1;
84279 _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
84280 if (_wayIDs.length === 1) {
84281 _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
84283 _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
84285 } else if (_wayIDs.length > 0) {
84286 var ways = _wayIDs.map(function(id2) {
84287 return context.entity(id2);
84289 var nodes = utilGetAllNodes(_wayIDs, context.graph());
84290 _coords = nodes.map(function(n3) {
84293 var sharedActions = [];
84294 var sharedNodes = [];
84295 var unsharedActions = [];
84296 var unsharedNodes = [];
84297 nodes.forEach(function(node) {
84298 var action = actionDisconnect(node.id).limitWays(_wayIDs);
84299 if (action.disabled(context.graph()) !== "not_connected") {
84301 for (var i3 in ways) {
84302 var way = ways[i3];
84303 if (way.nodes.indexOf(node.id) !== -1) {
84310 sharedActions.push(action);
84311 sharedNodes.push(node);
84313 unsharedActions.push(action);
84314 unsharedNodes.push(node);
84318 _descriptionID += "no_points.";
84319 _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
84320 if (sharedActions.length) {
84321 _actions = sharedActions;
84322 _disconnectingVertexIds = sharedNodes.map((node) => node.id);
84323 _descriptionID += "conjoined";
84324 _annotationID = "from_each_other";
84326 _actions = unsharedActions;
84327 _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
84328 if (_wayIDs.length === 1) {
84329 _descriptionID += context.graph().geometry(_wayIDs[0]);
84331 _descriptionID += "separate";
84335 var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
84336 var operation2 = function() {
84337 context.perform(function(graph) {
84338 return _actions.reduce(function(graph2, action) {
84339 return action(graph2);
84341 }, operation2.annotation());
84342 context.validator().validate();
84344 operation2.relatedEntityIds = function() {
84345 if (_vertexIDs.length) {
84346 return _disconnectingWayIds;
84348 return _disconnectingVertexIds;
84350 operation2.available = function() {
84351 if (_actions.length === 0)
84353 if (_otherIDs.length !== 0)
84355 if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
84356 return _vertexIDs.some(function(vertexID) {
84357 var way = context.entity(wayID);
84358 return way.nodes.indexOf(vertexID) !== -1;
84364 operation2.disabled = function() {
84366 for (var actionIndex in _actions) {
84367 reason = _actions[actionIndex].disabled(context.graph());
84371 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
84372 return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
84373 } else if (_coords && someMissing()) {
84374 return "not_downloaded";
84375 } else if (selectedIDs.some(context.hasHiddenConnections)) {
84376 return "connected_to_hidden";
84379 function someMissing() {
84380 if (context.inIntro())
84382 var osm = context.connection();
84384 var missing = _coords.filter(function(loc) {
84385 return !osm.isDataLoaded(loc);
84387 if (missing.length) {
84388 missing.forEach(function(loc) {
84389 context.loadTileAtLoc(loc);
84397 operation2.tooltip = function() {
84398 var disable = operation2.disabled();
84399 return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
84401 operation2.annotation = function() {
84402 return _t("operations.disconnect.annotation." + _annotationID);
84404 operation2.id = "disconnect";
84405 operation2.keys = [_t("operations.disconnect.key")];
84406 operation2.title = _t.append("operations.disconnect.title");
84407 operation2.behavior = behaviorOperation(context).which(operation2);
84411 // modules/operations/downgrade.js
84412 function operationDowngrade(context, selectedIDs) {
84413 var _affectedFeatureCount = 0;
84414 var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
84415 var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
84416 function downgradeTypeForEntityIDs(entityIds) {
84418 _affectedFeatureCount = 0;
84419 for (var i3 in entityIds) {
84420 var entityID = entityIds[i3];
84421 var type2 = downgradeTypeForEntityID(entityID);
84423 _affectedFeatureCount += 1;
84424 if (downgradeType && type2 !== downgradeType) {
84425 if (downgradeType !== "generic" && type2 !== "generic") {
84426 downgradeType = "building_address";
84428 downgradeType = "generic";
84431 downgradeType = type2;
84435 return downgradeType;
84437 function downgradeTypeForEntityID(entityID) {
84438 var graph = context.graph();
84439 var entity = graph.entity(entityID);
84440 var preset = _mainPresetIndex.match(entity, graph);
84441 if (!preset || preset.isFallback())
84443 if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
84444 return key.match(/^addr:.{1,}/);
84448 var geometry = entity.geometry(graph);
84449 if (geometry === "area" && entity.tags.building && !preset.tags.building) {
84452 if (geometry === "vertex" && Object.keys(entity.tags).length) {
84457 var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
84458 var addressKeysToKeep = ["source"];
84459 var operation2 = function() {
84460 context.perform(function(graph) {
84461 for (var i3 in selectedIDs) {
84462 var entityID = selectedIDs[i3];
84463 var type2 = downgradeTypeForEntityID(entityID);
84466 var tags = Object.assign({}, graph.entity(entityID).tags);
84467 for (var key in tags) {
84468 if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1)
84470 if (type2 === "building") {
84471 if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/))
84474 if (type2 !== "generic") {
84475 if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/))
84480 graph = actionChangeTags(entityID, tags)(graph);
84483 }, operation2.annotation());
84484 context.validator().validate();
84485 context.enter(modeSelect(context, selectedIDs));
84487 operation2.available = function() {
84488 return _downgradeType;
84490 operation2.disabled = function() {
84491 if (selectedIDs.some(hasWikidataTag)) {
84492 return "has_wikidata_tag";
84495 function hasWikidataTag(id2) {
84496 var entity = context.entity(id2);
84497 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
84500 operation2.tooltip = function() {
84501 var disable = operation2.disabled();
84502 return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
84504 operation2.annotation = function() {
84506 if (_downgradeType === "building_address") {
84507 suffix = "generic";
84509 suffix = _downgradeType;
84511 return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
84513 operation2.id = "downgrade";
84514 operation2.keys = [uiCmd("\u232B")];
84515 operation2.title = _t.append("operations.downgrade.title");
84516 operation2.behavior = behaviorOperation(context).which(operation2);
84520 // modules/operations/extract.js
84521 function operationExtract(context, selectedIDs) {
84522 var _amount = selectedIDs.length === 1 ? "single" : "multiple";
84523 var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
84524 return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
84525 }).filter(Boolean));
84526 var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
84528 var _actions = selectedIDs.map(function(entityID) {
84529 var graph = context.graph();
84530 var entity = graph.hasEntity(entityID);
84531 if (!entity || !entity.hasInterestingTags())
84533 if (entity.type === "node" && graph.parentWays(entity).length === 0)
84535 if (entity.type !== "node") {
84536 var preset = _mainPresetIndex.match(entity, graph);
84537 if (preset.geometry.indexOf("point") === -1)
84540 _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
84541 return actionExtract(entityID, context.projection);
84542 }).filter(Boolean);
84543 var operation2 = function() {
84544 var combinedAction = function(graph) {
84545 _actions.forEach(function(action) {
84546 graph = action(graph);
84550 context.perform(combinedAction, operation2.annotation());
84551 var extractedNodeIDs = _actions.map(function(action) {
84552 return action.getExtractedNodeID();
84554 context.enter(modeSelect(context, extractedNodeIDs));
84556 operation2.available = function() {
84557 return _actions.length && selectedIDs.length === _actions.length;
84559 operation2.disabled = function() {
84560 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
84561 return "too_large";
84562 } else if (selectedIDs.some(function(entityID) {
84563 return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
84565 return "connected_to_hidden";
84569 operation2.tooltip = function() {
84570 var disableReason = operation2.disabled();
84571 if (disableReason) {
84572 return _t.append("operations.extract." + disableReason + "." + _amount);
84574 return _t.append("operations.extract.description." + _geometryID + "." + _amount);
84577 operation2.annotation = function() {
84578 return _t("operations.extract.annotation", { n: selectedIDs.length });
84580 operation2.id = "extract";
84581 operation2.keys = [_t("operations.extract.key")];
84582 operation2.title = _t.append("operations.extract.title");
84583 operation2.behavior = behaviorOperation(context).which(operation2);
84587 // modules/operations/merge.js
84588 function operationMerge(context, selectedIDs) {
84589 var _action = getAction();
84590 function getAction() {
84591 var join = actionJoin(selectedIDs);
84592 if (!join.disabled(context.graph()))
84594 var merge2 = actionMerge(selectedIDs);
84595 if (!merge2.disabled(context.graph()))
84597 var mergePolygon = actionMergePolygon(selectedIDs);
84598 if (!mergePolygon.disabled(context.graph()))
84599 return mergePolygon;
84600 var mergeNodes = actionMergeNodes(selectedIDs);
84601 if (!mergeNodes.disabled(context.graph()))
84603 if (join.disabled(context.graph()) !== "not_eligible")
84605 if (merge2.disabled(context.graph()) !== "not_eligible")
84607 if (mergePolygon.disabled(context.graph()) !== "not_eligible")
84608 return mergePolygon;
84611 var operation2 = function() {
84612 if (operation2.disabled())
84614 context.perform(_action, operation2.annotation());
84615 context.validator().validate();
84616 var resultIDs = selectedIDs.filter(context.hasEntity);
84617 if (resultIDs.length > 1) {
84618 var interestingIDs = resultIDs.filter(function(id2) {
84619 return context.entity(id2).hasInterestingTags();
84621 if (interestingIDs.length)
84622 resultIDs = interestingIDs;
84624 context.enter(modeSelect(context, resultIDs));
84626 operation2.available = function() {
84627 return selectedIDs.length >= 2;
84629 operation2.disabled = function() {
84630 var actionDisabled = _action.disabled(context.graph());
84631 if (actionDisabled)
84632 return actionDisabled;
84633 var osm = context.connection();
84634 if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
84635 return "too_many_vertices";
84639 operation2.tooltip = function() {
84640 var disabled = operation2.disabled();
84642 if (disabled === "conflicting_relations") {
84643 return _t.append("operations.merge.conflicting_relations");
84645 if (disabled === "restriction" || disabled === "connectivity") {
84647 "operations.merge.damage_relation",
84648 { relation: _mainPresetIndex.item("type/" + disabled).name() }
84651 return _t.append("operations.merge." + disabled);
84653 return _t.append("operations.merge.description");
84655 operation2.annotation = function() {
84656 return _t("operations.merge.annotation", { n: selectedIDs.length });
84658 operation2.id = "merge";
84659 operation2.keys = [_t("operations.merge.key")];
84660 operation2.title = _t.append("operations.merge.title");
84661 operation2.behavior = behaviorOperation(context).which(operation2);
84665 // modules/operations/paste.js
84666 function operationPaste(context) {
84668 var operation2 = function() {
84671 var oldIDs = context.copyIDs();
84672 if (!oldIDs.length)
84674 var projection2 = context.projection;
84675 var extent = geoExtent();
84676 var oldGraph = context.copyGraph();
84678 var action = actionCopyEntities(oldIDs, oldGraph);
84679 context.perform(action);
84680 var copies = action.copies();
84681 var originals = /* @__PURE__ */ new Set();
84682 Object.values(copies).forEach(function(entity) {
84683 originals.add(entity.id);
84685 for (var id2 in copies) {
84686 var oldEntity = oldGraph.entity(id2);
84687 var newEntity = copies[id2];
84688 extent._extend(oldEntity.extent(oldGraph));
84689 var parents = context.graph().parentWays(newEntity);
84690 var parentCopied = parents.some(function(parent) {
84691 return originals.has(parent.id);
84693 if (!parentCopied) {
84694 newIDs.push(newEntity.id);
84697 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
84698 var delta = geoVecSubtract(_pastePoint, copyPoint);
84699 context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
84700 context.enter(modeSelect(context, newIDs));
84702 operation2.point = function(val) {
84706 operation2.available = function() {
84707 return context.mode().id === "browse";
84709 operation2.disabled = function() {
84710 return !context.copyIDs().length;
84712 operation2.tooltip = function() {
84713 var oldGraph = context.copyGraph();
84714 var ids = context.copyIDs();
84716 return _t.append("operations.paste.nothing_copied");
84718 return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
84720 operation2.annotation = function() {
84721 var ids = context.copyIDs();
84722 return _t("operations.paste.annotation", { n: ids.length });
84724 operation2.id = "paste";
84725 operation2.keys = [uiCmd("\u2318V")];
84726 operation2.title = _t.append("operations.paste.title");
84730 // modules/operations/reverse.js
84731 function operationReverse(context, selectedIDs) {
84732 var operation2 = function() {
84733 context.perform(function combinedReverseAction(graph) {
84734 actions().forEach(function(action) {
84735 graph = action(graph);
84738 }, operation2.annotation());
84739 context.validator().validate();
84741 function actions(situation) {
84742 return selectedIDs.map(function(entityID) {
84743 var entity = context.hasEntity(entityID);
84746 if (situation === "toolbar") {
84747 if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided()))
84750 var geometry = entity.geometry(context.graph());
84751 if (entity.type !== "node" && geometry !== "line")
84753 var action = actionReverse(entityID);
84754 if (action.disabled(context.graph()))
84757 }).filter(Boolean);
84759 function reverseTypeID() {
84760 var acts = actions();
84761 var nodeActionCount = acts.filter(function(act) {
84762 var entity = context.hasEntity(act.entityID());
84763 return entity && entity.type === "node";
84765 if (nodeActionCount === 0)
84767 if (nodeActionCount === acts.length)
84771 operation2.available = function(situation) {
84772 return actions(situation).length > 0;
84774 operation2.disabled = function() {
84777 operation2.tooltip = function() {
84778 return _t.append("operations.reverse.description." + reverseTypeID());
84780 operation2.annotation = function() {
84781 var acts = actions();
84782 return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
84784 operation2.id = "reverse";
84785 operation2.keys = [_t("operations.reverse.key")];
84786 operation2.title = _t.append("operations.reverse.title");
84787 operation2.behavior = behaviorOperation(context).which(operation2);
84791 // modules/operations/split.js
84792 function operationSplit(context, selectedIDs) {
84793 var _vertexIds = selectedIDs.filter(function(id2) {
84794 return context.graph().geometry(id2) === "vertex";
84796 var _selectedWayIds = selectedIDs.filter(function(id2) {
84797 var entity = context.graph().hasEntity(id2);
84798 return entity && entity.type === "way";
84800 var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
84801 var _action = actionSplit(_vertexIds);
84803 var _geometry = "feature";
84804 var _waysAmount = "single";
84805 var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
84806 if (_isAvailable) {
84807 if (_selectedWayIds.length)
84808 _action.limitWays(_selectedWayIds);
84809 _ways = _action.ways(context.graph());
84810 var geometries = {};
84811 _ways.forEach(function(way) {
84812 geometries[way.geometry(context.graph())] = true;
84814 if (Object.keys(geometries).length === 1) {
84815 _geometry = Object.keys(geometries)[0];
84817 _waysAmount = _ways.length === 1 ? "single" : "multiple";
84819 var operation2 = function() {
84820 var difference2 = context.perform(_action, operation2.annotation());
84821 var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
84822 return context.entity(id2).type === "way";
84824 context.enter(modeSelect(context, idsToSelect));
84826 operation2.relatedEntityIds = function() {
84827 return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
84829 operation2.available = function() {
84830 return _isAvailable;
84832 operation2.disabled = function() {
84833 var reason = _action.disabled(context.graph());
84836 } else if (selectedIDs.some(context.hasHiddenConnections)) {
84837 return "connected_to_hidden";
84841 operation2.tooltip = function() {
84842 var disable = operation2.disabled();
84843 return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
84845 operation2.annotation = function() {
84846 return _t("operations.split.annotation." + _geometry, { n: _ways.length });
84848 operation2.icon = function() {
84849 if (_waysAmount === "multiple") {
84850 return "#iD-operation-split-multiple";
84852 return "#iD-operation-split";
84855 operation2.id = "split";
84856 operation2.keys = [_t("operations.split.key")];
84857 operation2.title = _t.append("operations.split.title");
84858 operation2.behavior = behaviorOperation(context).which(operation2);
84862 // modules/operations/straighten.js
84863 function operationStraighten(context, selectedIDs) {
84864 var _wayIDs = selectedIDs.filter(function(id2) {
84865 return id2.charAt(0) === "w";
84867 var _nodeIDs = selectedIDs.filter(function(id2) {
84868 return id2.charAt(0) === "n";
84870 var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
84871 var _nodes = utilGetAllNodes(selectedIDs, context.graph());
84872 var _coords = _nodes.map(function(n3) {
84875 var _extent = utilTotalExtent(selectedIDs, context.graph());
84876 var _action = chooseAction();
84878 function chooseAction() {
84879 if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
84880 _geometry = "point";
84881 return actionStraightenNodes(_nodeIDs, context.projection);
84882 } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
84883 var startNodeIDs = [];
84884 var endNodeIDs = [];
84885 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
84886 var entity = context.entity(selectedIDs[i3]);
84887 if (entity.type === "node") {
84889 } else if (entity.type !== "way" || entity.isClosed()) {
84892 startNodeIDs.push(entity.first());
84893 endNodeIDs.push(entity.last());
84895 startNodeIDs = startNodeIDs.filter(function(n3) {
84896 return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
84898 endNodeIDs = endNodeIDs.filter(function(n3) {
84899 return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
84901 if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2)
84903 var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
84906 if (wayNodeIDs.length <= 2)
84908 if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1))
84910 if (_nodeIDs.length) {
84911 _extent = utilTotalExtent(_nodeIDs, context.graph());
84913 _geometry = "line";
84914 return actionStraightenWay(selectedIDs, context.projection);
84918 function operation2() {
84921 context.perform(_action, operation2.annotation());
84922 window.setTimeout(function() {
84923 context.validator().validate();
84926 operation2.available = function() {
84927 return Boolean(_action);
84929 operation2.disabled = function() {
84930 var reason = _action.disabled(context.graph());
84933 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
84934 return "too_large";
84935 } else if (someMissing()) {
84936 return "not_downloaded";
84937 } else if (selectedIDs.some(context.hasHiddenConnections)) {
84938 return "connected_to_hidden";
84941 function someMissing() {
84942 if (context.inIntro())
84944 var osm = context.connection();
84946 var missing = _coords.filter(function(loc) {
84947 return !osm.isDataLoaded(loc);
84949 if (missing.length) {
84950 missing.forEach(function(loc) {
84951 context.loadTileAtLoc(loc);
84959 operation2.tooltip = function() {
84960 var disable = operation2.disabled();
84961 return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
84963 operation2.annotation = function() {
84964 return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
84966 operation2.id = "straighten";
84967 operation2.keys = [_t("operations.straighten.key")];
84968 operation2.title = _t.append("operations.straighten.title");
84969 operation2.behavior = behaviorOperation(context).which(operation2);
84973 // modules/modes/select.js
84974 function modeSelect(context, selectedIDs) {
84979 var keybinding = utilKeybinding("select");
84980 var _breatheBehavior = behaviorBreathe(context);
84981 var _modeDragNode = modeDragNode(context);
84982 var _selectBehavior;
84983 var _behaviors = [];
84984 var _operations = [];
84985 var _newFeature = false;
84986 var _follow = false;
84987 var _focusedParentWayId;
84988 var _focusedVertexIds;
84989 function singular() {
84990 if (selectedIDs && selectedIDs.length === 1) {
84991 return context.hasEntity(selectedIDs[0]);
84994 function selectedEntities() {
84995 return selectedIDs.map(function(id2) {
84996 return context.hasEntity(id2);
84997 }).filter(Boolean);
84999 function checkSelectedIDs() {
85001 if (Array.isArray(selectedIDs)) {
85002 ids = selectedIDs.filter(function(id2) {
85003 return context.hasEntity(id2);
85007 context.enter(modeBrowse(context));
85009 } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
85010 context.enter(modeSelect(context, ids));
85016 function parentWaysIdsOfSelection(onlyCommonParents) {
85017 var graph = context.graph();
85019 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85020 var entity = context.hasEntity(selectedIDs[i3]);
85021 if (!entity || entity.geometry(graph) !== "vertex") {
85024 var currParents = graph.parentWays(entity).map(function(w2) {
85027 if (!parents.length) {
85028 parents = currParents;
85031 parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
85032 if (!parents.length) {
85038 function childNodeIdsOfSelection(onlyCommon) {
85039 var graph = context.graph();
85041 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
85042 var entity = context.hasEntity(selectedIDs[i3]);
85043 if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
85046 var currChilds = graph.childNodes(entity).map(function(node) {
85049 if (!childs.length) {
85050 childs = currChilds;
85053 childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
85054 if (!childs.length) {
85060 function checkFocusedParent() {
85061 if (_focusedParentWayId) {
85062 var parents = parentWaysIdsOfSelection(true);
85063 if (parents.indexOf(_focusedParentWayId) === -1)
85064 _focusedParentWayId = null;
85067 function parentWayIdForVertexNavigation() {
85068 var parentIds = parentWaysIdsOfSelection(true);
85069 if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
85070 return _focusedParentWayId;
85072 return parentIds.length ? parentIds[0] : null;
85074 mode.selectedIDs = function(val) {
85075 if (!arguments.length)
85076 return selectedIDs;
85080 mode.zoomToSelected = function() {
85081 context.map().zoomToEase(selectedEntities());
85083 mode.newFeature = function(val) {
85084 if (!arguments.length)
85085 return _newFeature;
85089 mode.selectBehavior = function(val) {
85090 if (!arguments.length)
85091 return _selectBehavior;
85092 _selectBehavior = val;
85095 mode.follow = function(val) {
85096 if (!arguments.length)
85101 function loadOperations() {
85102 _operations.forEach(function(operation2) {
85103 if (operation2.behavior) {
85104 context.uninstall(operation2.behavior);
85107 _operations = Object.values(operations_exports).map(function(o2) {
85108 return o2(context, selectedIDs);
85109 }).filter(function(o2) {
85110 return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
85112 // group copy/downgrade/delete operation together at the end of the list
85113 operationCopy(context, selectedIDs),
85114 operationDowngrade(context, selectedIDs),
85115 operationDelete(context, selectedIDs)
85116 ]).filter(function(operation2) {
85117 return operation2.available();
85119 _operations.forEach(function(operation2) {
85120 if (operation2.behavior) {
85121 context.install(operation2.behavior);
85124 context.ui().closeEditMenu();
85126 mode.operations = function() {
85127 return _operations;
85129 mode.enter = function() {
85130 if (!checkSelectedIDs())
85132 context.features().forceVisible(selectedIDs);
85133 _modeDragNode.restoreSelectedIDs(selectedIDs);
85135 if (!_behaviors.length) {
85136 if (!_selectBehavior)
85137 _selectBehavior = behaviorSelect(context);
85139 behaviorPaste(context),
85141 behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
85143 behaviorLasso(context),
85144 _modeDragNode.behavior,
85145 modeDragNote(context).behavior
85148 _behaviors.forEach(context.install);
85149 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on(["[", "pgup"], previousVertex).on(["]", "pgdown"], nextVertex).on(["{", uiCmd("\u2318["), "home"], firstVertex).on(["}", uiCmd("\u2318]"), "end"], lastVertex).on(uiCmd("\u21E7\u2190"), nudgeSelection([-10, 0])).on(uiCmd("\u21E7\u2191"), nudgeSelection([0, -10])).on(uiCmd("\u21E7\u2192"), nudgeSelection([10, 0])).on(uiCmd("\u21E7\u2193"), nudgeSelection([0, 10])).on(uiCmd("\u21E7\u2325\u2190"), nudgeSelection([-100, 0])).on(uiCmd("\u21E7\u2325\u2191"), nudgeSelection([0, -100])).on(uiCmd("\u21E7\u2325\u2192"), nudgeSelection([100, 0])).on(uiCmd("\u21E7\u2325\u2193"), nudgeSelection([0, 100])).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1.05)).on(utilKeybinding.plusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(Math.pow(1.05, 5))).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7" + key)), scaleSelection(1 / 1.05)).on(utilKeybinding.minusKeys.map((key) => uiCmd("\u21E7\u2325" + key)), scaleSelection(1 / Math.pow(1.05, 5))).on(["\\", "pause"], focusNextParent).on(uiCmd("\u2318\u2191"), selectParent).on(uiCmd("\u2318\u2193"), selectChild).on("\u238B", esc, true);
85150 select_default2(document).call(keybinding);
85151 context.ui().sidebar.select(selectedIDs, _newFeature);
85152 context.history().on("change.select", function() {
85155 }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
85156 context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
85158 _breatheBehavior.restartIfNeeded(context.surface());
85160 context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
85163 var extent = geoExtent();
85164 var graph = context.graph();
85165 selectedIDs.forEach(function(id2) {
85166 var entity = context.entity(id2);
85167 extent._extend(entity.extent(graph));
85169 var loc = extent.center();
85170 context.map().centerEase(loc);
85173 function nudgeSelection(delta) {
85174 return function() {
85175 if (!context.map().withinEditableZoom())
85177 var moveOp = operationMove(context, selectedIDs);
85178 if (moveOp.disabled()) {
85179 context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
85181 context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
85182 context.validator().validate();
85186 function scaleSelection(factor) {
85187 return function() {
85188 if (!context.map().withinEditableZoom())
85190 let nodes = utilGetAllNodes(selectedIDs, context.graph());
85191 let isUp = factor > 1;
85192 if (nodes.length <= 1)
85194 let extent2 = utilTotalExtent(selectedIDs, context.graph());
85195 function scalingDisabled() {
85197 return "too_small";
85198 } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
85199 return "too_large";
85200 } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
85201 return "not_downloaded";
85202 } else if (selectedIDs.some(context.hasHiddenConnections)) {
85203 return "connected_to_hidden";
85206 function tooSmall() {
85209 let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
85210 let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
85211 return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
85213 function someMissing() {
85214 if (context.inIntro())
85216 let osm = context.connection();
85218 let missing = nodes.filter(function(n3) {
85219 return !osm.isDataLoaded(n3.loc);
85221 if (missing.length) {
85222 missing.forEach(function(loc2) {
85223 context.loadTileAtLoc(loc2);
85230 function incompleteRelation(id2) {
85231 let entity = context.entity(id2);
85232 return entity.type === "relation" && !entity.isComplete(context.graph());
85235 const disabled = scalingDisabled();
85237 let multi = selectedIDs.length === 1 ? "single" : "multiple";
85238 context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
85240 const pivot = context.projection(extent2.center());
85241 const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
85242 context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
85243 context.validator().validate();
85247 function didDoubleUp(d3_event, loc2) {
85248 if (!context.map().withinEditableZoom())
85250 var target = select_default2(d3_event.target);
85251 var datum2 = target.datum();
85252 var entity = datum2 && datum2.properties && datum2.properties.entity;
85255 if (entity instanceof osmWay && target.classed("target")) {
85256 var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
85257 var prev = entity.nodes[choice.index - 1];
85258 var next = entity.nodes[choice.index];
85260 actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
85261 _t("operations.add.annotation.vertex")
85263 context.validator().validate();
85264 } else if (entity.type === "midpoint") {
85266 actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
85267 _t("operations.add.annotation.vertex")
85269 context.validator().validate();
85272 function selectElements() {
85273 if (!checkSelectedIDs())
85275 var surface = context.surface();
85276 surface.selectAll(".selected-member").classed("selected-member", false);
85277 surface.selectAll(".selected").classed("selected", false);
85278 surface.selectAll(".related").classed("related", false);
85279 checkFocusedParent();
85280 if (_focusedParentWayId) {
85281 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85283 if (context.map().withinEditableZoom()) {
85284 surface.selectAll(utilDeepMemberSelector(
85288 /* skipMultipolgonMembers */
85289 )).classed("selected-member", true);
85290 surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
85294 if (context.container().select(".combobox").size())
85296 context.enter(modeBrowse(context));
85298 function firstVertex(d3_event) {
85299 d3_event.preventDefault();
85300 var entity = singular();
85301 var parentId = parentWayIdForVertexNavigation();
85303 if (entity && entity.type === "way") {
85305 } else if (parentId) {
85306 way = context.entity(parentId);
85308 _focusedParentWayId = way && way.id;
85311 mode.selectedIDs([way.first()]).follow(true)
85315 function lastVertex(d3_event) {
85316 d3_event.preventDefault();
85317 var entity = singular();
85318 var parentId = parentWayIdForVertexNavigation();
85320 if (entity && entity.type === "way") {
85322 } else if (parentId) {
85323 way = context.entity(parentId);
85325 _focusedParentWayId = way && way.id;
85328 mode.selectedIDs([way.last()]).follow(true)
85332 function previousVertex(d3_event) {
85333 d3_event.preventDefault();
85334 var parentId = parentWayIdForVertexNavigation();
85335 _focusedParentWayId = parentId;
85338 var way = context.entity(parentId);
85339 var length2 = way.nodes.length;
85340 var curr = way.nodes.indexOf(selectedIDs[0]);
85344 } else if (way.isClosed()) {
85345 index = length2 - 2;
85347 if (index !== -1) {
85349 mode.selectedIDs([way.nodes[index]]).follow(true)
85353 function nextVertex(d3_event) {
85354 d3_event.preventDefault();
85355 var parentId = parentWayIdForVertexNavigation();
85356 _focusedParentWayId = parentId;
85359 var way = context.entity(parentId);
85360 var length2 = way.nodes.length;
85361 var curr = way.nodes.indexOf(selectedIDs[0]);
85363 if (curr < length2 - 1) {
85365 } else if (way.isClosed()) {
85368 if (index !== -1) {
85370 mode.selectedIDs([way.nodes[index]]).follow(true)
85374 function focusNextParent(d3_event) {
85375 d3_event.preventDefault();
85376 var parents = parentWaysIdsOfSelection(true);
85377 if (!parents || parents.length < 2)
85379 var index = parents.indexOf(_focusedParentWayId);
85380 if (index < 0 || index > parents.length - 2) {
85381 _focusedParentWayId = parents[0];
85383 _focusedParentWayId = parents[index + 1];
85385 var surface = context.surface();
85386 surface.selectAll(".related").classed("related", false);
85387 if (_focusedParentWayId) {
85388 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
85391 function selectParent(d3_event) {
85392 d3_event.preventDefault();
85393 var currentSelectedIds = mode.selectedIDs();
85394 var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
85395 if (!parentIds.length)
85398 mode.selectedIDs(parentIds)
85400 _focusedVertexIds = currentSelectedIds;
85402 function selectChild(d3_event) {
85403 d3_event.preventDefault();
85404 var currentSelectedIds = mode.selectedIDs();
85405 var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
85406 if (!childIds || !childIds.length)
85408 if (currentSelectedIds.length === 1)
85409 _focusedParentWayId = currentSelectedIds[0];
85411 mode.selectedIDs(childIds)
85415 mode.exit = function() {
85416 _newFeature = false;
85417 _focusedVertexIds = null;
85418 _operations.forEach(function(operation2) {
85419 if (operation2.behavior) {
85420 context.uninstall(operation2.behavior);
85424 _behaviors.forEach(context.uninstall);
85425 select_default2(document).call(keybinding.unbind);
85426 context.ui().closeEditMenu();
85427 context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
85428 var surface = context.surface();
85429 surface.selectAll(".selected-member").classed("selected-member", false);
85430 surface.selectAll(".selected").classed("selected", false);
85431 surface.selectAll(".highlighted").classed("highlighted", false);
85432 surface.selectAll(".related").classed("related", false);
85433 context.map().on("drawn.select", null);
85434 context.ui().sidebar.hide();
85435 context.features().forceVisible([]);
85436 var entity = singular();
85437 if (_newFeature && entity && entity.type === "relation" && // no tags
85438 Object.keys(entity.tags).length === 0 && // no parent relations
85439 context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
85440 (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
85441 var deleteAction = actionDeleteRelation(
85444 /* don't delete untagged members */
85446 context.perform(deleteAction, _t("operations.delete.annotation.relation"));
85447 context.validator().validate();
85453 // modules/behavior/lasso.js
85454 function behaviorLasso(context) {
85455 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
85456 var behavior = function(selection2) {
85458 function pointerdown(d3_event) {
85460 if (d3_event.button === button && d3_event.shiftKey === true) {
85462 select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
85463 d3_event.stopPropagation();
85466 function pointermove() {
85468 lasso = uiLasso(context);
85469 context.surface().call(lasso);
85471 lasso.p(context.map().mouse());
85473 function normalize2(a2, b2) {
85475 [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
85476 [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
85479 function lassoed() {
85482 var graph = context.graph();
85484 if (context.map().editableDataEnabled(
85486 /* skipZoomCheck */
85487 ) && context.map().isInWideSelection()) {
85488 limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
85489 } else if (!context.map().editableDataEnabled()) {
85492 var bounds = lasso.extent().map(context.projection.invert);
85493 var extent = geoExtent(normalize2(bounds[0], bounds[1]));
85494 var intersects = context.history().intersects(extent).filter(function(entity) {
85495 return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
85497 intersects.sort(function(node1, node2) {
85498 var parents1 = graph.parentWays(node1);
85499 var parents2 = graph.parentWays(node2);
85500 if (parents1.length && parents2.length) {
85501 var sharedParents = utilArrayIntersection(parents1, parents2);
85502 if (sharedParents.length) {
85503 var sharedParentNodes = sharedParents[0].nodes;
85504 return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
85506 return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
85508 } else if (parents1.length || parents2.length) {
85509 return parents1.length - parents2.length;
85511 return node1.loc[0] - node2.loc[0];
85513 return intersects.map(function(entity) {
85517 function pointerup() {
85518 select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
85521 var ids = lassoed();
85524 context.enter(modeSelect(context, ids));
85527 selection2.on(_pointerPrefix + "down.lasso", pointerdown);
85529 behavior.off = function(selection2) {
85530 selection2.on(_pointerPrefix + "down.lasso", null);
85535 // modules/modes/browse.js
85536 function modeBrowse(context) {
85540 title: _t.append("modes.browse.title"),
85541 description: _t.append("modes.browse.description")
85544 var _selectBehavior;
85545 var _behaviors = [];
85546 mode.selectBehavior = function(val) {
85547 if (!arguments.length)
85548 return _selectBehavior;
85549 _selectBehavior = val;
85552 mode.enter = function() {
85553 if (!_behaviors.length) {
85554 if (!_selectBehavior)
85555 _selectBehavior = behaviorSelect(context);
85557 behaviorPaste(context),
85558 behaviorHover(context).on("hover", context.ui().sidebar.hover),
85560 behaviorLasso(context),
85561 modeDragNode(context).behavior,
85562 modeDragNote(context).behavior
85565 _behaviors.forEach(context.install);
85566 if (document.activeElement && document.activeElement.blur) {
85567 document.activeElement.blur();
85570 context.ui().sidebar.show(sidebar);
85572 context.ui().sidebar.select(null);
85575 mode.exit = function() {
85576 context.ui().sidebar.hover.cancel();
85577 _behaviors.forEach(context.uninstall);
85579 context.ui().sidebar.hide();
85582 mode.sidebar = function(_2) {
85583 if (!arguments.length)
85588 mode.operations = function() {
85589 return [operationPaste(context)];
85594 // modules/behavior/add_way.js
85595 function behaviorAddWay(context) {
85596 var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
85597 var draw = behaviorDraw(context);
85598 function behavior(surface) {
85599 draw.on("click", function() {
85600 dispatch14.apply("start", this, arguments);
85601 }).on("clickWay", function() {
85602 dispatch14.apply("startFromWay", this, arguments);
85603 }).on("clickNode", function() {
85604 dispatch14.apply("startFromNode", this, arguments);
85605 }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
85606 context.map().dblclickZoomEnable(false);
85607 surface.call(draw);
85609 behavior.off = function(surface) {
85610 surface.call(draw.off);
85612 behavior.cancel = function() {
85613 window.setTimeout(function() {
85614 context.map().dblclickZoomEnable(true);
85616 context.enter(modeBrowse(context));
85618 return utilRebind(behavior, dispatch14, "on");
85621 // modules/behavior/hash.js
85622 function behaviorHash(context) {
85623 var _cachedHash = null;
85624 var _latitudeLimit = 90 - 1e-8;
85625 function computedHashParameters() {
85626 var map2 = context.map();
85627 var center = map2.center();
85628 var zoom = map2.zoom();
85629 var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
85630 var oldParams = utilObjectOmit(
85631 utilStringQs(window.location.hash),
85632 ["comment", "source", "hashtags", "walkthrough"]
85634 var newParams = {};
85635 delete oldParams.id;
85636 var selected = context.selectedIDs().filter(function(id2) {
85637 return context.hasEntity(id2);
85639 if (selected.length) {
85640 newParams.id = selected.join(",");
85642 newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
85643 return Object.assign(oldParams, newParams);
85645 function computedHash() {
85646 return "#" + utilQsString(computedHashParameters(), true);
85648 function computedTitle(includeChangeCount) {
85649 var baseTitle = context.documentTitleBase() || "iD";
85653 var selected = context.selectedIDs().filter(function(id2) {
85654 return context.hasEntity(id2);
85656 if (selected.length) {
85657 var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
85658 if (selected.length > 1) {
85659 contextual = _t("title.labeled_and_more", {
85660 labeled: firstLabel,
85661 count: selected.length - 1
85664 contextual = firstLabel;
85666 titleID = "context";
85668 if (includeChangeCount) {
85669 changeCount = context.history().difference().summary().length;
85670 if (changeCount > 0) {
85671 titleID = contextual ? "changes_context" : "changes";
85675 return _t("title.format." + titleID, {
85676 changes: changeCount,
85678 context: contextual
85683 function updateTitle(includeChangeCount) {
85684 if (!context.setsDocumentTitle())
85686 var newTitle = computedTitle(includeChangeCount);
85687 if (document.title !== newTitle) {
85688 document.title = newTitle;
85691 function updateHashIfNeeded() {
85692 if (context.inIntro())
85694 var latestHash = computedHash();
85695 if (_cachedHash !== latestHash) {
85696 _cachedHash = latestHash;
85697 window.history.replaceState(null, computedTitle(
85699 /* includeChangeCount */
85703 /* includeChangeCount */
85705 const q2 = utilStringQs(latestHash);
85707 corePreferences("map-location", q2.map);
85711 var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
85712 var _throttledUpdateTitle = throttle_default(function() {
85715 /* includeChangeCount */
85718 function hashchange() {
85719 if (window.location.hash === _cachedHash)
85721 _cachedHash = window.location.hash;
85722 var q2 = utilStringQs(_cachedHash);
85723 var mapArgs = (q2.map || "").split("/").map(Number);
85724 if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
85725 updateHashIfNeeded();
85727 if (_cachedHash === computedHash())
85729 var mode = context.mode();
85730 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
85731 if (q2.id && mode) {
85732 var ids = q2.id.split(",").filter(function(id2) {
85733 return context.hasEntity(id2);
85735 if (ids.length && (mode.id === "browse" || mode.id === "select" && !utilArrayIdentical(mode.selectedIDs(), ids))) {
85736 context.enter(modeSelect(context, ids));
85740 var center = context.map().center();
85741 var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
85743 if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
85744 context.enter(modeBrowse(context));
85749 function behavior() {
85750 context.map().on("move.behaviorHash", _throttledUpdate);
85751 context.history().on("change.behaviorHash", _throttledUpdateTitle);
85752 context.on("enter.behaviorHash", _throttledUpdate);
85753 select_default2(window).on("hashchange.behaviorHash", hashchange);
85754 var q2 = utilStringQs(window.location.hash);
85756 context.zoomToEntity(q2.id.split(",")[0], !q2.map);
85758 if (q2.walkthrough === "true") {
85759 behavior.startWalkthrough = true;
85762 behavior.hadLocation = true;
85763 } else if (!q2.id && corePreferences("map-location")) {
85764 const mapArgs = corePreferences("map-location").split("/").map(Number);
85765 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
85766 updateHashIfNeeded();
85767 behavior.hadLocation = true;
85770 updateTitle(false);
85772 behavior.off = function() {
85773 _throttledUpdate.cancel();
85774 _throttledUpdateTitle.cancel();
85775 context.map().on("move.behaviorHash", null);
85776 context.on("enter.behaviorHash", null);
85777 select_default2(window).on("hashchange.behaviorHash", null);
85778 window.location.hash = "";
85783 // node_modules/d3-brush/src/brush.js
85784 var { abs: abs2, max: max2, min: min2 } = Math;
85785 function number1(e3) {
85786 return [+e3[0], +e3[1]];
85788 function number22(e3) {
85789 return [number1(e3[0]), number1(e3[1])];
85793 handles: ["w", "e"].map(type),
85794 input: function(x2, e3) {
85795 return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
85797 output: function(xy) {
85798 return xy && [xy[0][0], xy[1][0]];
85803 handles: ["n", "s"].map(type),
85804 input: function(y2, e3) {
85805 return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
85807 output: function(xy) {
85808 return xy && [xy[0][1], xy[1][1]];
85813 handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
85814 input: function(xy) {
85815 return xy == null ? null : number22(xy);
85817 output: function(xy) {
85821 function type(t2) {
85822 return { type: t2 };
85825 // modules/index.js
85828 dispatch: dispatch_default,
85829 geoMercator: mercator_default,
85830 geoProjection: projection,
85831 polygonArea: area_default3,
85832 polygonCentroid: centroid_default2,
85833 select: select_default2,
85834 selectAll: selectAll_default2,
85839 window.requestIdleCallback = window.requestIdleCallback || function(cb) {
85840 var start2 = Date.now();
85841 return window.requestAnimationFrame(function() {
85844 timeRemaining: function() {
85845 return Math.max(0, 50 - (Date.now() - start2));
85850 window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
85851 window.cancelAnimationFrame(id2);
85853 window.iD = modules_exports;
85855 //# sourceMappingURL=iD.js.map