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") return require.apply(this, arguments);
13 throw Error('Dynamic require of "' + x2 + '" is not supported');
15 var __commonJS = (cb, mod) => function __require2() {
16 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18 var __export = (target, all) => {
20 __defProp(target, name, { get: all[name], enumerable: true });
22 var __copyProps = (to, from, except, desc) => {
23 if (from && typeof from === "object" || typeof from === "function") {
24 for (let key of __getOwnPropNames(from))
25 if (!__hasOwnProp.call(to, key) && key !== except)
26 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
31 // If the importer is in node compatibility mode or this is not an ESM
32 // file that has been converted to a CommonJS file using a Babel-
33 // compatible transform (i.e. "__esModule" has not been set), then set
34 // "default" to the CommonJS "module.exports" for node compatibility.
35 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
38 var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
40 // node_modules/diacritics/index.js
41 var require_diacritics = __commonJS({
42 "node_modules/diacritics/index.js"(exports2) {
43 exports2.remove = removeDiacritics2;
44 var replacementList = [
55 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"
63 chars: "\xC6\u01FC\u01E2"
83 chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181"
87 chars: "\u24B8\uFF23\uA73E\u1E08\u0106C\u0108\u010A\u010C\xC7\u0187\u023B"
91 chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779"
103 chars: "\u01F2\u01C5"
107 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"
111 chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B"
115 chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262"
119 chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D"
123 chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197"
127 chars: "\u24BF\uFF2A\u0134\u0248\u0237"
131 chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2"
135 chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780"
147 chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB"
151 chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E"
163 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"
183 chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754"
187 chars: "\u24C6\uFF31\uA756\uA758\u024A"
191 chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782"
195 chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784"
199 chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786"
211 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"
215 chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245"
223 chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72"
227 chars: "\u24CD\uFF38\u1E8A\u1E8C"
231 chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE"
235 chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762"
239 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"
247 chars: "\xE6\u01FD\u01E3"
259 chars: "\uA739\uA73B"
267 chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182"
271 chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\xE7\u1E09\u0188\u023C\uA73F\u2184"
275 chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA"
283 chars: "\u01F3\u01C6"
287 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"
291 chars: "\u24D5\uFF46\u1E1F\u0192"
315 chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79"
319 chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265"
327 chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131"
331 chars: "\u24D9\uFF4A\u0135\u01F0\u0249"
335 chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3"
339 chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D"
347 chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F"
351 chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509"
359 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"
379 chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1"
383 chars: "\u24E0\uFF51\u024B\uA757\uA759"
387 chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783"
391 chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282"
399 chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787"
411 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"
415 chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C"
423 chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73"
427 chars: "\u24E7\uFF58\u1E8B\u1E8D"
431 chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF"
435 chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763"
438 var diacriticsMap = {};
439 for (i3 = 0; i3 < replacementList.length; i3 += 1) {
440 chars = replacementList[i3].chars;
441 for (j2 = 0; j2 < chars.length; j2 += 1) {
442 diacriticsMap[chars[j2]] = replacementList[i3].base;
448 function removeDiacritics2(str) {
449 return str.replace(/[^\u0000-\u007e]/g, function(c2) {
450 return diacriticsMap[c2] || c2;
453 exports2.replacementList = replacementList;
454 exports2.diacriticsMap = diacriticsMap;
458 // node_modules/alif-toolkit/lib/isArabic.js
459 var require_isArabic = __commonJS({
460 "node_modules/alif-toolkit/lib/isArabic.js"(exports2) {
462 Object.defineProperty(exports2, "__esModule", { value: true });
463 exports2.isArabic = isArabic;
464 exports2.isMath = isMath;
467 // Arabic https://www.unicode.org/charts/PDF/U0600.pdf
469 // supplement https://www.unicode.org/charts/PDF/U0750.pdf
471 // Extended-A https://www.unicode.org/charts/PDF/U08A0.pdf
473 // Presentation Forms-A https://www.unicode.org/charts/PDF/UFB50.pdf
475 // Presentation Forms-B https://www.unicode.org/charts/PDF/UFE70.pdf
477 // Rumi numerals https://www.unicode.org/charts/PDF/U10E60.pdf
479 // Indic Siyaq numerals https://www.unicode.org/charts/PDF/U1EC70.pdf
481 // Mathematical Alphabetic symbols https://www.unicode.org/charts/PDF/U1EE00.pdf
483 function isArabic(char) {
484 if (char.length > 1) {
485 throw new Error("isArabic works on only one-character strings");
487 let code = char.charCodeAt(0);
488 for (let i3 = 0; i3 < arabicBlocks.length; i3++) {
489 let block2 = arabicBlocks[i3];
490 if (code >= block2[0] && code <= block2[1]) {
496 function isMath(char) {
497 if (char.length > 2) {
498 throw new Error("isMath works on only one-character strings");
500 let code = char.charCodeAt(0);
501 return code >= 1632 && code <= 1644 || code >= 1776 && code <= 1785;
506 // node_modules/alif-toolkit/lib/unicode-arabic.js
507 var require_unicode_arabic = __commonJS({
508 "node_modules/alif-toolkit/lib/unicode-arabic.js"(exports2) {
510 Object.defineProperty(exports2, "__esModule", { value: true });
511 var arabicReference = {
521 "isolated": "\uFE81",
529 "isolated": "\uFE83",
537 "isolated": "\uFE87",
542 "isolated": "\uFB50",
545 "wavy_hamza_above": [
548 "wavy_hamza_below": [
559 "indic_three_above": [
569 "isolated": "\uFE8D",
579 "three_dots_horizontally_below": [
582 "dot_below_three_dots_above": [
585 "three_dots_pointing_upwards_below": [
588 "three_dots_pointing_upwards_below_two_dots_above": [
591 "two_dots_below_dot_above": [
594 "inverted_small_v_below": [
606 "small_meem_above": [
609 "isolated": "\uFE8F",
618 "isolated": "\uFE93",
628 "three_dots_above_downwards": [
634 "isolated": "\uFE95",
643 "isolated": "\uFE99",
655 "isolated": "\uFE9D",
667 "two_dots_vertical_above": [
670 "three_dots_above": [
676 "three_dots_pointing_upwards_below": [
682 "small_tah_two_dots": [
688 "indic_four_below": [
691 "isolated": "\uFEA1",
700 "isolated": "\uFEA5",
715 "dot_below_small_tah": [
718 "three_dots_above_downwards": [
727 "two_dots_vertically_below_small_tah": [
730 "inverted_small_v_below": [
733 "three_dots_below": [
736 "isolated": "\uFEA9",
743 "isolated": "\uFEAB",
762 "dot_below_dot_above": [
777 "two_dots_vertically_above": [
783 "small_tah_two_dots": [
789 "small_noon_above": [
792 "isolated": "\uFEAD",
799 "inverted_v_above": [
802 "isolated": "\uFEAF",
809 "dot_below_dot_above": [
812 "three_dots_below": [
815 "three_dots_below_three_dots_above": [
821 "two_dots_vertically_above": [
824 "small_tah_two_dots": [
827 "indic_four_above": [
833 "isolated": "\uFEB1",
845 "isolated": "\uFEB5",
857 "three_dots_above": [
860 "three_dots_below": [
863 "isolated": "\uFEB9",
875 "isolated": "\uFEBD",
884 "three_dots_above": [
890 "isolated": "\uFEC1",
899 "isolated": "\uFEC5",
908 "three_dots_above": [
914 "three_dots_pointing_downwards_above": [
917 "two_dots_vertically_above": [
920 "three_dots_below": [
923 "isolated": "\uFEC9",
935 "isolated": "\uFECD",
953 "three_dots_below": [
959 "three_dots_pointing_upwards_below": [
962 "dot_below_three_dots_above": [
965 "isolated": "\uFED1",
980 "three_dots_above": [
986 "isolated": "\uFED5",
1004 "three_dots_below": [
1013 "isolated": "\uFED9",
1015 "initial": "\uFEDB",
1028 "three_dots_above": [
1031 "three_dots_below": [
1040 "isolated": "\uFEDD",
1042 "initial": "\uFEDF",
1055 "three_dots_above": [
1058 "isolated": "\uFEE1",
1060 "initial": "\uFEE3",
1073 "three_dots_above": [
1085 "isolated": "\uFEE5",
1087 "initial": "\uFEE7",
1094 "isolated": "\uFEE9",
1096 "initial": "\uFEEB",
1108 "isolated": "\uFE85",
1124 "indic_two_above": [
1127 "indic_three_above": [
1133 "isolated": "\uFEED",
1144 "initial": "\uFBE8",
1146 "isolated": "\uFEEF",
1158 "isolated": "\uFE89",
1160 "initial": "\uFE8B",
1163 "two_dots_below_hamza_above": [
1176 "three_dots_below": [
1179 "two_dots_below_dot_above": [
1182 "two_dots_below_small_noon_above": [
1185 "isolated": "\uFEF1",
1187 "initial": "\uFEF3",
1194 "isolated": "\uFB66",
1196 "initial": "\uFB68",
1203 "isolated": "\uFB5E",
1205 "initial": "\uFB60",
1212 "isolated": "\uFB52",
1214 "initial": "\uFB54",
1221 "small_meem_above": [
1224 "isolated": "\uFB56",
1226 "initial": "\uFB58",
1233 "isolated": "\uFB62",
1235 "initial": "\uFB64",
1242 "isolated": "\uFB5A",
1244 "initial": "\uFB5C",
1251 "isolated": "\uFB76",
1253 "initial": "\uFB78",
1260 "isolated": "\uFB72",
1262 "initial": "\uFB74",
1272 "isolated": "\uFB7A",
1274 "initial": "\uFB7C",
1281 "isolated": "\uFB7E",
1283 "initial": "\uFB80",
1290 "isolated": "\uFB88",
1297 "isolated": "\uFB84",
1304 "isolated": "\uFB82",
1312 "isolated": "\uFB86",
1319 "isolated": "\uFB8C",
1326 "isolated": "\uFB8A",
1333 "isolated": "\uFB6A",
1335 "initial": "\uFB6C",
1342 "isolated": "\uFB6E",
1344 "initial": "\uFB70",
1354 "three_dots_above": [
1357 "three_dots_pointing_upwards_below": [
1360 "isolated": "\uFB8E",
1362 "initial": "\uFB90",
1369 "isolated": "\uFBD3",
1371 "initial": "\uFBD5",
1384 "three_dots_above": [
1387 "inverted_stroke": [
1390 "isolated": "\uFB92",
1392 "initial": "\uFB94",
1399 "isolated": "\uFB9A",
1401 "initial": "\uFB9C",
1408 "isolated": "\uFB96",
1410 "initial": "\uFB98",
1417 "isolated": "\uFB9E",
1424 "isolated": "\uFBA0",
1426 "initial": "\uFBA2",
1429 "heh doachashmee": {
1433 "isolated": "\uFBAA",
1435 "initial": "\uFBAC",
1446 "isolated": "\uFBA6",
1448 "initial": "\uFBA8",
1451 "teh marbuta goal": {
1460 "isolated": "\uFBE0",
1467 "isolated": "\uFBD9",
1479 "isolated": "\uFBDD"
1481 "isolated": "\uFBD7",
1488 "isolated": "\uFBDB",
1495 "isolated": "\uFBE2",
1502 "isolated": "\uFBDE",
1509 "indic_two_above": [
1512 "indic_three_above": [
1515 "indic_four_above": [
1518 "isolated": "\uFBFC",
1520 "initial": "\uFBFE",
1527 "isolated": "\uFBE4",
1529 "initial": "\uFBE6",
1541 "isolated": "\uFBB0",
1544 "indic_two_above": [
1547 "indic_three_above": [
1550 "isolated": "\uFBAE",
1557 "isolated": "\u06D5",
1564 "isolated": "\uFBA4",
1599 exports2.default = arabicReference;
1603 // node_modules/alif-toolkit/lib/unicode-ligatures.js
1604 var require_unicode_ligatures = __commonJS({
1605 "node_modules/alif-toolkit/lib/unicode-ligatures.js"(exports2) {
1607 Object.defineProperty(exports2, "__esModule", { value: true });
1608 var ligatureReference = {
1610 "isolated": "\uFBEA",
1614 "isolated": "\uFBEC",
1618 "isolated": "\uFBEE",
1622 "isolated": "\uFBF0",
1626 "isolated": "\uFBF2",
1630 "isolated": "\uFBF4",
1634 "isolated": "\uFBF6",
1640 "isolated": "\uFBF9",
1644 "isolated": "\uFC03",
1648 "isolated": "\uFC00",
1652 "isolated": "\uFC01",
1656 "isolated": "\uFC02",
1658 "initial": "\uFC9A",
1662 "isolated": "\uFC04",
1666 "isolated": "\uFC05",
1670 "isolated": "\uFC06",
1674 "isolated": "\uFC07",
1678 "isolated": "\uFC08",
1680 "initial": "\uFC9F",
1684 "isolated": "\uFC09",
1688 "isolated": "\uFC0A",
1692 "isolated": "\uFC0B",
1696 "isolated": "\uFC0C",
1700 "isolated": "\uFC0D",
1704 "isolated": "\uFC0E",
1706 "initial": "\uFCA4",
1710 "isolated": "\uFC0F",
1714 "isolated": "\uFC10",
1718 "isolated": "\uFC11"
1721 "isolated": "\uFC12",
1723 "initial": "\uFCA6",
1727 "isolated": "\uFC13",
1731 "isolated": "\uFC14"
1734 "isolated": "\uFC15",
1738 "isolated": "\uFC16",
1742 "isolated": "\uFC17",
1746 "isolated": "\uFC18",
1750 "isolated": "\uFC19",
1754 "isolated": "\uFC1A"
1757 "isolated": "\uFC1B",
1761 "isolated": "\uFC1C",
1762 "initial": "\uFCAD",
1766 "isolated": "\uFC1D",
1767 "initial": "\uFCAE",
1771 "isolated": "\uFC1E",
1772 "initial": "\uFCAF",
1776 "isolated": "\uFC1F",
1777 "initial": "\uFCB0",
1781 "isolated": "\uFC20",
1785 "isolated": "\uFC21",
1789 "isolated": "\uFC22",
1793 "isolated": "\uFC23",
1797 "isolated": "\uFC24",
1801 "isolated": "\uFC25",
1805 "isolated": "\uFC26",
1809 "isolated": "\uFC27",
1810 "initial": "\uFD33",
1814 "isolated": "\uFC28",
1815 "initial": "\uFCB9",
1819 "isolated": "\uFC29",
1823 "isolated": "\uFC2A",
1827 "isolated": "\uFC2B",
1831 "isolated": "\uFC2C",
1835 "isolated": "\uFC2D",
1839 "isolated": "\uFC2E",
1843 "isolated": "\uFC2F",
1847 "isolated": "\uFC30",
1851 "isolated": "\uFC31",
1855 "isolated": "\uFC32",
1859 "isolated": "\uFC33",
1863 "isolated": "\uFC34",
1867 "isolated": "\uFC35",
1871 "isolated": "\uFC36",
1875 "isolated": "\uFC37",
1879 "isolated": "\uFC38",
1883 "isolated": "\uFC39",
1887 "isolated": "\uFC3A",
1891 "isolated": "\uFC3B",
1893 "initial": "\uFCC7",
1897 "isolated": "\uFC3C",
1899 "initial": "\uFCC8",
1903 "isolated": "\uFC3D",
1907 "isolated": "\uFC3E",
1911 "isolated": "\uFC3F",
1915 "isolated": "\uFC40",
1919 "isolated": "\uFC41",
1923 "isolated": "\uFC42",
1925 "initial": "\uFCCC",
1929 "isolated": "\uFC43",
1933 "isolated": "\uFC44",
1937 "isolated": "\uFC45",
1941 "isolated": "\uFC46",
1945 "isolated": "\uFC47",
1949 "isolated": "\uFC48",
1954 "isolated": "\uFC49"
1957 "isolated": "\uFC4A"
1960 "isolated": "\uFC4B",
1964 "isolated": "\uFC4C",
1968 "isolated": "\uFC4D",
1972 "isolated": "\uFC4E",
1974 "initial": "\uFCD5",
1978 "isolated": "\uFC4F",
1982 "isolated": "\uFC50",
1986 "isolated": "\uFC51",
1990 "isolated": "\uFC52",
1994 "isolated": "\uFC53"
1997 "isolated": "\uFC54"
2000 "isolated": "\uFC55",
2004 "isolated": "\uFC56",
2008 "isolated": "\uFC57",
2012 "isolated": "\uFC58",
2014 "initial": "\uFCDD",
2018 "isolated": "\uFC59",
2022 "isolated": "\uFC5A",
2026 "isolated": "\uFC5B"
2029 "isolated": "\uFC5C"
2032 "isolated": "\uFC5D",
2036 "isolated": "\uFC5E"
2039 "isolated": "\uFC5F"
2042 "isolated": "\uFC60"
2045 "isolated": "\uFC61"
2048 "isolated": "\uFC62"
2051 "isolated": "\uFC63"
2117 "initial": "\uFC9B",
2121 "initial": "\uFCA0",
2125 "initial": "\uFCA5",
2135 "initial": "\uFCD6",
2142 "initial": "\uFCDE",
2154 "isolated": "\uFD0C",
2162 "\u0640\u064E\u0651": {
2165 "\u0640\u064F\u0651": {
2168 "\u0640\u0650\u0651": {
2172 "isolated": "\uFCF5",
2176 "isolated": "\uFCF6",
2180 "isolated": "\uFCF7",
2184 "isolated": "\uFCF8",
2188 "isolated": "\uFCF9",
2192 "isolated": "\uFCFA",
2196 "isolated": "\uFCFB"
2199 "isolated": "\uFCFC",
2203 "isolated": "\uFCFD",
2207 "isolated": "\uFCFE",
2211 "isolated": "\uFCFF",
2215 "isolated": "\uFD00",
2219 "isolated": "\uFD01",
2223 "isolated": "\uFD02",
2227 "isolated": "\uFD03",
2231 "isolated": "\uFD04",
2235 "isolated": "\uFD05",
2239 "isolated": "\uFD06",
2243 "isolated": "\uFD07",
2247 "isolated": "\uFD08",
2251 "isolated": "\uFD09",
2253 "initial": "\uFD2D",
2257 "isolated": "\uFD0A",
2259 "initial": "\uFD2E",
2263 "isolated": "\uFD0B",
2265 "initial": "\uFD2F",
2269 "isolated": "\uFD0D",
2273 "isolated": "\uFD0E",
2277 "isolated": "\uFD0F",
2281 "isolated": "\uFD10",
2287 "\u062A\u062C\u0645": {
2290 "\u062A\u062D\u062C": {
2294 "\u062A\u062D\u0645": {
2297 "\u062A\u062E\u0645": {
2300 "\u062A\u0645\u062C": {
2303 "\u062A\u0645\u062D": {
2306 "\u062A\u0645\u062E": {
2309 "\u062C\u0645\u062D": {
2313 "\u062D\u0645\u064A": {
2316 "\u062D\u0645\u0649": {
2319 "\u0633\u062D\u062C": {
2322 "\u0633\u062C\u062D": {
2325 "\u0633\u062C\u0649": {
2328 "\u0633\u0645\u062D": {
2332 "\u0633\u0645\u062C": {
2335 "\u0633\u0645\u0645": {
2339 "\u0635\u062D\u062D": {
2343 "\u0635\u0645\u0645": {
2347 "\u0634\u062D\u0645": {
2351 "\u0634\u062C\u064A": {
2354 "\u0634\u0645\u062E": {
2358 "\u0634\u0645\u0645": {
2362 "\u0636\u062D\u0649": {
2365 "\u0636\u062E\u0645": {
2369 "\u0636\u0645\u062D": {
2372 "\u0637\u0645\u062D": {
2375 "\u0637\u0645\u0645": {
2378 "\u0637\u0645\u064A": {
2381 "\u0639\u062C\u0645": {
2385 "\u0639\u0645\u0645": {
2389 "\u0639\u0645\u0649": {
2392 "\u063A\u0645\u0645": {
2395 "\u063A\u0645\u064A": {
2398 "\u063A\u0645\u0649": {
2401 "\u0641\u062E\u0645": {
2405 "\u0642\u0645\u062D": {
2409 "\u0642\u0645\u0645": {
2412 "\u0644\u062D\u0645": {
2416 "\u0644\u062D\u064A": {
2419 "\u0644\u062D\u0649": {
2422 "\u0644\u062C\u062C": {
2423 "initial": "\uFD83",
2426 "\u0644\u062E\u0645": {
2430 "\u0644\u0645\u062D": {
2434 "\u0645\u062D\u062C": {
2437 "\u0645\u062D\u0645": {
2440 "\u0645\u062D\u064A": {
2443 "\u0645\u062C\u062D": {
2446 "\u0645\u062C\u0645": {
2449 "\u0645\u062E\u062C": {
2452 "\u0645\u062E\u0645": {
2455 "\u0645\u062C\u062E": {
2458 "\u0647\u0645\u062C": {
2461 "\u0647\u0645\u0645": {
2464 "\u0646\u062D\u0645": {
2467 "\u0646\u062D\u0649": {
2470 "\u0646\u062C\u0645": {
2474 "\u0646\u062C\u0649": {
2477 "\u0646\u0645\u064A": {
2480 "\u0646\u0645\u0649": {
2483 "\u064A\u0645\u0645": {
2487 "\u0628\u062E\u064A": {
2490 "\u062A\u062C\u064A": {
2493 "\u062A\u062C\u0649": {
2496 "\u062A\u062E\u064A": {
2499 "\u062A\u062E\u0649": {
2502 "\u062A\u0645\u064A": {
2505 "\u062A\u0645\u0649": {
2508 "\u062C\u0645\u064A": {
2511 "\u062C\u062D\u0649": {
2514 "\u062C\u0645\u0649": {
2517 "\u0633\u062E\u0649": {
2520 "\u0635\u062D\u064A": {
2523 "\u0634\u062D\u064A": {
2526 "\u0636\u062D\u064A": {
2529 "\u0644\u062C\u064A": {
2532 "\u0644\u0645\u064A": {
2535 "\u064A\u062D\u064A": {
2538 "\u064A\u062C\u064A": {
2541 "\u064A\u0645\u064A": {
2544 "\u0645\u0645\u064A": {
2547 "\u0642\u0645\u064A": {
2550 "\u0646\u062D\u064A": {
2553 "\u0639\u0645\u064A": {
2556 "\u0643\u0645\u064A": {
2559 "\u0646\u062C\u062D": {
2560 "initial": "\uFDB8",
2563 "\u0645\u062E\u064A": {
2566 "\u0644\u062C\u0645": {
2567 "initial": "\uFDBA",
2570 "\u0643\u0645\u0645": {
2574 "\u062C\u062D\u064A": {
2577 "\u062D\u062C\u064A": {
2580 "\u0645\u062C\u064A": {
2583 "\u0641\u0645\u064A": {
2586 "\u0628\u062D\u064A": {
2589 "\u0633\u062E\u064A": {
2592 "\u0646\u062C\u064A": {
2596 "isolated": "\uFEF5",
2600 "isolated": "\uFEF7",
2604 "isolated": "\uFEF9",
2608 "isolated": "\uFEFB",
2612 "\u0635\u0644\u06D2": "\uFDF0",
2613 "\u0642\u0644\u06D2": "\uFDF1",
2614 "\u0627\u0644\u0644\u0647": "\uFDF2",
2615 "\u0627\u0643\u0628\u0631": "\uFDF3",
2616 "\u0645\u062D\u0645\u062F": "\uFDF4",
2617 "\u0635\u0644\u0639\u0645": "\uFDF5",
2618 "\u0631\u0633\u0648\u0644": "\uFDF6",
2619 "\u0639\u0644\u064A\u0647": "\uFDF7",
2620 "\u0648\u0633\u0644\u0645": "\uFDF8",
2621 "\u0635\u0644\u0649": "\uFDF9",
2622 "\u0635\u0644\u0649\u0627\u0644\u0644\u0647\u0639\u0644\u064A\u0647\u0648\u0633\u0644\u0645": "\uFDFA",
2623 "\u062C\u0644\u062C\u0644\u0627\u0644\u0647": "\uFDFB",
2624 "\u0631\u06CC\u0627\u0644": "\uFDFC"
2627 exports2.default = ligatureReference;
2631 // node_modules/alif-toolkit/lib/reference.js
2632 var require_reference = __commonJS({
2633 "node_modules/alif-toolkit/lib/reference.js"(exports2) {
2635 Object.defineProperty(exports2, "__esModule", { value: true });
2636 exports2.ligatureWordList = exports2.ligatureList = exports2.letterList = exports2.alefs = exports2.lams = exports2.lineBreakers = exports2.tashkeel = void 0;
2637 var unicode_arabic_1 = require_unicode_arabic();
2638 var unicode_ligatures_1 = require_unicode_ligatures();
2639 var letterList = Object.keys(unicode_arabic_1.default);
2640 exports2.letterList = letterList;
2641 var ligatureList = Object.keys(unicode_ligatures_1.default);
2642 exports2.ligatureList = ligatureList;
2643 var ligatureWordList = Object.keys(unicode_ligatures_1.default.words);
2644 exports2.ligatureWordList = ligatureWordList;
2645 var lams = "\u0644\u06B5\u06B6\u06B7\u06B8";
2646 exports2.lams = lams;
2647 var alefs = "\u0627\u0622\u0623\u0625\u0671\u0672\u0673\u0675\u0773\u0774";
2648 exports2.alefs = alefs;
2649 var tashkeel = "\u0605\u0640\u0670\u0674\u06DF\u06E7\u06E8";
2650 exports2.tashkeel = tashkeel;
2651 function addToTashkeel(start2, finish) {
2652 for (var i3 = start2; i3 <= finish; i3++) {
2653 exports2.tashkeel = tashkeel += String.fromCharCode(i3);
2656 addToTashkeel(1552, 1562);
2657 addToTashkeel(1611, 1631);
2658 addToTashkeel(1750, 1756);
2659 addToTashkeel(1760, 1764);
2660 addToTashkeel(1770, 1773);
2661 addToTashkeel(2259, 2273);
2662 addToTashkeel(2275, 2303);
2663 addToTashkeel(65136, 65151);
2664 var lineBreakers = "\u0627\u0629\u0648\u06C0\u06CF\u06FD\u06FE\u076B\u076C\u0771\u0773\u0774\u0778\u0779\u08E2\u08B1\u08B2\u08B9";
2665 exports2.lineBreakers = lineBreakers;
2666 function addToLineBreakers(start2, finish) {
2667 for (var i3 = start2; i3 <= finish; i3++) {
2668 exports2.lineBreakers = lineBreakers += String.fromCharCode(i3);
2671 addToLineBreakers(1536, 1567);
2672 addToLineBreakers(1569, 1573);
2673 addToLineBreakers(1583, 1586);
2674 addToLineBreakers(1632, 1645);
2675 addToLineBreakers(1649, 1655);
2676 addToLineBreakers(1672, 1689);
2677 addToLineBreakers(1731, 1739);
2678 addToLineBreakers(1746, 1785);
2679 addToLineBreakers(1881, 1883);
2680 addToLineBreakers(2218, 2222);
2681 addToLineBreakers(64336, 65021);
2682 addToLineBreakers(65152, 65276);
2683 addToLineBreakers(69216, 69247);
2684 addToLineBreakers(126064, 126143);
2685 addToLineBreakers(126464, 126719);
2689 // node_modules/alif-toolkit/lib/GlyphSplitter.js
2690 var require_GlyphSplitter = __commonJS({
2691 "node_modules/alif-toolkit/lib/GlyphSplitter.js"(exports2) {
2693 Object.defineProperty(exports2, "__esModule", { value: true });
2694 exports2.GlyphSplitter = GlyphSplitter;
2695 var isArabic_1 = require_isArabic();
2696 var reference_1 = require_reference();
2697 function GlyphSplitter(word) {
2699 let lastLetter = "";
2700 word.split("").forEach((letter) => {
2701 if ((0, isArabic_1.isArabic)(letter)) {
2702 if (reference_1.tashkeel.indexOf(letter) > -1) {
2703 letters[letters.length - 1] += letter;
2704 } 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)) {
2705 letters[letters.length - 1] += letter;
2707 letters.push(letter);
2710 letters.push(letter);
2712 if (reference_1.tashkeel.indexOf(letter) === -1) {
2713 lastLetter = letter;
2721 // node_modules/alif-toolkit/lib/BaselineSplitter.js
2722 var require_BaselineSplitter = __commonJS({
2723 "node_modules/alif-toolkit/lib/BaselineSplitter.js"(exports2) {
2725 Object.defineProperty(exports2, "__esModule", { value: true });
2726 exports2.BaselineSplitter = BaselineSplitter;
2727 var isArabic_1 = require_isArabic();
2728 var reference_1 = require_reference();
2729 function BaselineSplitter(word) {
2731 let lastLetter = "";
2732 word.split("").forEach((letter) => {
2733 if ((0, isArabic_1.isArabic)(letter) && (0, isArabic_1.isArabic)(lastLetter)) {
2734 if (lastLetter.length && reference_1.tashkeel.indexOf(letter) > -1) {
2735 letters[letters.length - 1] += letter;
2736 } else if (reference_1.lineBreakers.indexOf(lastLetter) > -1) {
2737 letters.push(letter);
2739 letters[letters.length - 1] += letter;
2742 letters.push(letter);
2744 if (reference_1.tashkeel.indexOf(letter) === -1) {
2745 lastLetter = letter;
2753 // node_modules/alif-toolkit/lib/Normalization.js
2754 var require_Normalization = __commonJS({
2755 "node_modules/alif-toolkit/lib/Normalization.js"(exports2) {
2757 Object.defineProperty(exports2, "__esModule", { value: true });
2758 exports2.Normal = Normal;
2759 var unicode_arabic_1 = require_unicode_arabic();
2760 var unicode_ligatures_1 = require_unicode_ligatures();
2761 var isArabic_1 = require_isArabic();
2762 var reference_1 = require_reference();
2763 function Normal(word, breakPresentationForm) {
2764 if (typeof breakPresentationForm === "undefined") {
2765 breakPresentationForm = true;
2767 let returnable = "";
2768 word.split("").forEach((letter) => {
2769 if (!(0, isArabic_1.isArabic)(letter)) {
2770 returnable += letter;
2773 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2774 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2775 let versions = Object.keys(letterForms);
2776 for (let v2 = 0; v2 < versions.length; v2++) {
2777 let localVersion = letterForms[versions[v2]];
2778 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2779 let embeddedForms = Object.keys(localVersion);
2780 for (let ef = 0; ef < embeddedForms.length; ef++) {
2781 let form = localVersion[embeddedForms[ef]];
2782 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2783 if (form === letter) {
2784 if (breakPresentationForm && localVersion["normal"] && ["isolated", "initial", "medial", "final"].indexOf(embeddedForms[ef]) > -1) {
2785 if (typeof localVersion["normal"] === "object") {
2786 returnable += localVersion["normal"][0];
2788 returnable += localVersion["normal"];
2792 returnable += letter;
2794 } else if (typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2795 returnable += form[0];
2800 } else if (localVersion === letter) {
2801 if (breakPresentationForm && letterForms["normal"] && ["isolated", "initial", "medial", "final"].indexOf(versions[v2]) > -1) {
2802 if (typeof letterForms["normal"] === "object") {
2803 returnable += letterForms["normal"][0];
2805 returnable += letterForms["normal"];
2809 returnable += letter;
2811 } else if (typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2812 returnable += localVersion[0];
2817 for (let v2 = 0; v2 < reference_1.ligatureList.length; v2++) {
2818 let normalForm = reference_1.ligatureList[v2];
2819 if (normalForm !== "words") {
2820 let ligForms = Object.keys(unicode_ligatures_1.default[normalForm]);
2821 for (let f2 = 0; f2 < ligForms.length; f2++) {
2822 if (unicode_ligatures_1.default[normalForm][ligForms[f2]] === letter) {
2823 returnable += normalForm;
2829 for (let v3 = 0; v3 < reference_1.ligatureWordList.length; v3++) {
2830 let normalForm = reference_1.ligatureWordList[v3];
2831 if (unicode_ligatures_1.default.words[normalForm] === letter) {
2832 returnable += normalForm;
2836 returnable += letter;
2843 // node_modules/alif-toolkit/lib/CharShaper.js
2844 var require_CharShaper = __commonJS({
2845 "node_modules/alif-toolkit/lib/CharShaper.js"(exports2) {
2847 Object.defineProperty(exports2, "__esModule", { value: true });
2848 exports2.CharShaper = CharShaper;
2849 var unicode_arabic_1 = require_unicode_arabic();
2850 var isArabic_1 = require_isArabic();
2851 var reference_1 = require_reference();
2852 function CharShaper(letter, form) {
2853 if (!(0, isArabic_1.isArabic)(letter)) {
2854 throw new Error("Not Arabic");
2856 if (letter === "\u0621") {
2859 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2860 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2861 let versions = Object.keys(letterForms);
2862 for (let v2 = 0; v2 < versions.length; v2++) {
2863 let localVersion = letterForms[versions[v2]];
2864 if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2865 if (versions.indexOf(form) > -1) {
2866 return letterForms[form];
2868 } else if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2869 let embeddedVersions = Object.keys(localVersion);
2870 for (let ev = 0; ev < embeddedVersions.length; ev++) {
2871 if (localVersion[embeddedVersions[ev]] === letter || typeof localVersion[embeddedVersions[ev]] === "object" && localVersion[embeddedVersions[ev]].indexOf && localVersion[embeddedVersions[ev]].indexOf(letter) > -1) {
2872 if (embeddedVersions.indexOf(form) > -1) {
2873 return localVersion[form];
2884 // node_modules/alif-toolkit/lib/WordShaper.js
2885 var require_WordShaper = __commonJS({
2886 "node_modules/alif-toolkit/lib/WordShaper.js"(exports2) {
2888 Object.defineProperty(exports2, "__esModule", { value: true });
2889 exports2.WordShaper = WordShaper2;
2890 var isArabic_1 = require_isArabic();
2891 var reference_1 = require_reference();
2892 var CharShaper_1 = require_CharShaper();
2893 var unicode_ligatures_1 = require_unicode_ligatures();
2894 function WordShaper2(word) {
2895 let state = "initial";
2897 for (let w2 = 0; w2 < word.length; w2++) {
2898 let nextLetter = " ";
2899 for (let nxw = w2 + 1; nxw < word.length; nxw++) {
2900 if (!(0, isArabic_1.isArabic)(word[nxw])) {
2903 if (reference_1.tashkeel.indexOf(word[nxw]) === -1) {
2904 nextLetter = word[nxw];
2908 if (!(0, isArabic_1.isArabic)(word[w2]) || (0, isArabic_1.isMath)(word[w2])) {
2911 } else if (reference_1.tashkeel.indexOf(word[w2]) > -1) {
2913 } else if (nextLetter === " " || reference_1.lineBreakers.indexOf(word[w2]) > -1) {
2914 output += (0, CharShaper_1.CharShaper)(word[w2], state === "initial" ? "isolated" : "final");
2916 } else if (reference_1.lams.indexOf(word[w2]) > -1 && reference_1.alefs.indexOf(nextLetter) > -1) {
2917 output += unicode_ligatures_1.default[word[w2] + nextLetter][state === "initial" ? "isolated" : "final"];
2918 while (word[w2] !== nextLetter) {
2923 output += (0, CharShaper_1.CharShaper)(word[w2], state);
2932 // node_modules/alif-toolkit/lib/ParentLetter.js
2933 var require_ParentLetter = __commonJS({
2934 "node_modules/alif-toolkit/lib/ParentLetter.js"(exports2) {
2936 Object.defineProperty(exports2, "__esModule", { value: true });
2937 exports2.ParentLetter = ParentLetter;
2938 exports2.GrandparentLetter = GrandparentLetter;
2939 var unicode_arabic_1 = require_unicode_arabic();
2940 var isArabic_1 = require_isArabic();
2941 var reference_1 = require_reference();
2942 function ParentLetter(letter) {
2943 if (!(0, isArabic_1.isArabic)(letter)) {
2944 throw new Error("Not an Arabic letter");
2946 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2947 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2948 let versions = Object.keys(letterForms);
2949 for (let v2 = 0; v2 < versions.length; v2++) {
2950 let localVersion = letterForms[versions[v2]];
2951 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2952 let embeddedForms = Object.keys(localVersion);
2953 for (let ef = 0; ef < embeddedForms.length; ef++) {
2954 let form = localVersion[embeddedForms[ef]];
2955 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2956 return localVersion;
2959 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2966 function GrandparentLetter(letter) {
2967 if (!(0, isArabic_1.isArabic)(letter)) {
2968 throw new Error("Not an Arabic letter");
2970 for (let w2 = 0; w2 < reference_1.letterList.length; w2++) {
2971 let letterForms = unicode_arabic_1.default[reference_1.letterList[w2]];
2972 let versions = Object.keys(letterForms);
2973 for (let v2 = 0; v2 < versions.length; v2++) {
2974 let localVersion = letterForms[versions[v2]];
2975 if (typeof localVersion === "object" && typeof localVersion.indexOf === "undefined") {
2976 let embeddedForms = Object.keys(localVersion);
2977 for (let ef = 0; ef < embeddedForms.length; ef++) {
2978 let form = localVersion[embeddedForms[ef]];
2979 if (form === letter || typeof form === "object" && form.indexOf && form.indexOf(letter) > -1) {
2983 } else if (localVersion === letter || typeof localVersion === "object" && localVersion.indexOf && localVersion.indexOf(letter) > -1) {
2993 // node_modules/alif-toolkit/lib/index.js
2994 var require_lib = __commonJS({
2995 "node_modules/alif-toolkit/lib/index.js"(exports2) {
2997 Object.defineProperty(exports2, "__esModule", { value: true });
2998 exports2.GrandparentLetter = exports2.ParentLetter = exports2.WordShaper = exports2.CharShaper = exports2.Normal = exports2.BaselineSplitter = exports2.GlyphSplitter = exports2.isArabic = void 0;
2999 var isArabic_1 = require_isArabic();
3000 Object.defineProperty(exports2, "isArabic", { enumerable: true, get: function() {
3001 return isArabic_1.isArabic;
3003 var GlyphSplitter_1 = require_GlyphSplitter();
3004 Object.defineProperty(exports2, "GlyphSplitter", { enumerable: true, get: function() {
3005 return GlyphSplitter_1.GlyphSplitter;
3007 var BaselineSplitter_1 = require_BaselineSplitter();
3008 Object.defineProperty(exports2, "BaselineSplitter", { enumerable: true, get: function() {
3009 return BaselineSplitter_1.BaselineSplitter;
3011 var Normalization_1 = require_Normalization();
3012 Object.defineProperty(exports2, "Normal", { enumerable: true, get: function() {
3013 return Normalization_1.Normal;
3015 var CharShaper_1 = require_CharShaper();
3016 Object.defineProperty(exports2, "CharShaper", { enumerable: true, get: function() {
3017 return CharShaper_1.CharShaper;
3019 var WordShaper_1 = require_WordShaper();
3020 Object.defineProperty(exports2, "WordShaper", { enumerable: true, get: function() {
3021 return WordShaper_1.WordShaper;
3023 var ParentLetter_1 = require_ParentLetter();
3024 Object.defineProperty(exports2, "ParentLetter", { enumerable: true, get: function() {
3025 return ParentLetter_1.ParentLetter;
3027 Object.defineProperty(exports2, "GrandparentLetter", { enumerable: true, get: function() {
3028 return ParentLetter_1.GrandparentLetter;
3033 // node_modules/vparse/index.js
3034 var require_vparse = __commonJS({
3035 "node_modules/vparse/index.js"(exports2, module2) {
3036 (function(window2) {
3038 function parseVersion3(v2) {
3039 var m2 = v2.replace(/[^0-9.]/g, "").match(/[0-9]*\.|[0-9]+/g) || [];
3046 v2.isEmpty = !v2.major && !v2.minor && !v2.patch && !v2.build;
3047 v2.parsed = [v2.major, v2.minor, v2.patch, v2.build];
3048 v2.text = v2.parsed.join(".");
3049 v2.compare = compare2;
3052 function compare2(v2) {
3053 if (typeof v2 === "string") {
3054 v2 = parseVersion3(v2);
3056 for (var i3 = 0; i3 < 4; i3++) {
3057 if (this.parsed[i3] !== v2.parsed[i3]) {
3058 return this.parsed[i3] > v2.parsed[i3] ? 1 : -1;
3063 if (typeof module2 === "object" && module2 && typeof module2.exports === "object") {
3064 module2.exports = parseVersion3;
3066 window2.parseVersion = parseVersion3;
3072 // node_modules/which-polygon/node_modules/quickselect/quickselect.js
3073 var require_quickselect = __commonJS({
3074 "node_modules/which-polygon/node_modules/quickselect/quickselect.js"(exports2, module2) {
3075 (function(global2, factory) {
3076 typeof exports2 === "object" && typeof module2 !== "undefined" ? module2.exports = factory() : typeof define === "function" && define.amd ? define(factory) : global2.quickselect = factory();
3077 })(exports2, function() {
3079 function quickselect3(arr, k2, left, right, compare2) {
3080 quickselectStep2(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare2);
3082 function quickselectStep2(arr, k2, left, right, compare2) {
3083 while (right > left) {
3084 if (right - left > 600) {
3085 var n3 = right - left + 1;
3086 var m2 = k2 - left + 1;
3087 var z2 = Math.log(n3);
3088 var s2 = 0.5 * Math.exp(2 * z2 / 3);
3089 var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
3090 var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
3091 var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
3092 quickselectStep2(arr, k2, newLeft, newRight, compare2);
3097 swap3(arr, left, k2);
3098 if (compare2(arr[right], t2) > 0) swap3(arr, left, right);
3103 while (compare2(arr[i3], t2) < 0) i3++;
3104 while (compare2(arr[j2], t2) > 0) j2--;
3106 if (compare2(arr[left], t2) === 0) swap3(arr, left, j2);
3109 swap3(arr, j2, right);
3111 if (j2 <= k2) left = j2 + 1;
3112 if (k2 <= j2) right = j2 - 1;
3115 function swap3(arr, i3, j2) {
3120 function defaultCompare2(a2, b2) {
3121 return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
3123 return quickselect3;
3128 // node_modules/which-polygon/node_modules/rbush/index.js
3129 var require_rbush = __commonJS({
3130 "node_modules/which-polygon/node_modules/rbush/index.js"(exports2, module2) {
3132 module2.exports = rbush;
3133 module2.exports.default = rbush;
3134 var quickselect3 = require_quickselect();
3135 function rbush(maxEntries, format2) {
3136 if (!(this instanceof rbush)) return new rbush(maxEntries, format2);
3137 this._maxEntries = Math.max(4, maxEntries || 9);
3138 this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
3140 this._initFormat(format2);
3146 return this._all(this.data, []);
3148 search: function(bbox2) {
3149 var node = this.data, result = [], toBBox = this.toBBox;
3150 if (!intersects2(bbox2, node)) return result;
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 (intersects2(bbox2, childBBox)) {
3157 if (node.leaf) result.push(child);
3158 else if (contains2(bbox2, childBBox)) this._all(child, result);
3159 else nodesToSearch.push(child);
3162 node = nodesToSearch.pop();
3166 collides: function(bbox2) {
3167 var node = this.data, toBBox = this.toBBox;
3168 if (!intersects2(bbox2, node)) return false;
3169 var nodesToSearch = [], i3, len, child, childBBox;
3171 for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3172 child = node.children[i3];
3173 childBBox = node.leaf ? toBBox(child) : child;
3174 if (intersects2(bbox2, childBBox)) {
3175 if (node.leaf || contains2(bbox2, childBBox)) return true;
3176 nodesToSearch.push(child);
3179 node = nodesToSearch.pop();
3183 load: function(data) {
3184 if (!(data && data.length)) return this;
3185 if (data.length < this._minEntries) {
3186 for (var i3 = 0, len = data.length; i3 < len; i3++) {
3187 this.insert(data[i3]);
3191 var node = this._build(data.slice(), 0, data.length - 1, 0);
3192 if (!this.data.children.length) {
3194 } else if (this.data.height === node.height) {
3195 this._splitRoot(this.data, node);
3197 if (this.data.height < node.height) {
3198 var tmpNode = this.data;
3202 this._insert(node, this.data.height - node.height - 1, true);
3206 insert: function(item) {
3207 if (item) this._insert(item, this.data.height - 1);
3211 this.data = createNode2([]);
3214 remove: function(item, equalsFn) {
3215 if (!item) return this;
3216 var node = this.data, bbox2 = this.toBBox(item), path = [], indexes = [], i3, parent, index, goingUp;
3217 while (node || path.length) {
3220 parent = path[path.length - 1];
3225 index = findItem2(item, node.children, equalsFn);
3227 node.children.splice(index, 1);
3229 this._condense(path);
3233 if (!goingUp && !node.leaf && contains2(node, bbox2)) {
3238 node = node.children[0];
3239 } else if (parent) {
3241 node = parent.children[i3];
3247 toBBox: function(item) {
3250 compareMinX: compareNodeMinX2,
3251 compareMinY: compareNodeMinY2,
3252 toJSON: function() {
3255 fromJSON: function(data) {
3259 _all: function(node, result) {
3260 var nodesToSearch = [];
3262 if (node.leaf) result.push.apply(result, node.children);
3263 else nodesToSearch.push.apply(nodesToSearch, node.children);
3264 node = nodesToSearch.pop();
3268 _build: function(items, left, right, height) {
3269 var N2 = right - left + 1, M2 = this._maxEntries, node;
3271 node = createNode2(items.slice(left, right + 1));
3272 calcBBox2(node, this.toBBox);
3276 height = Math.ceil(Math.log(N2) / Math.log(M2));
3277 M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
3279 node = createNode2([]);
3281 node.height = height;
3282 var N22 = Math.ceil(N2 / M2), N1 = N22 * Math.ceil(Math.sqrt(M2)), i3, j2, right2, right3;
3283 multiSelect2(items, left, right, N1, this.compareMinX);
3284 for (i3 = left; i3 <= right; i3 += N1) {
3285 right2 = Math.min(i3 + N1 - 1, right);
3286 multiSelect2(items, i3, right2, N22, this.compareMinY);
3287 for (j2 = i3; j2 <= right2; j2 += N22) {
3288 right3 = Math.min(j2 + N22 - 1, right2);
3289 node.children.push(this._build(items, j2, right3, height - 1));
3292 calcBBox2(node, this.toBBox);
3295 _chooseSubtree: function(bbox2, node, level, path) {
3296 var i3, len, child, targetNode, area, enlargement, minArea, minEnlargement;
3299 if (node.leaf || path.length - 1 === level) break;
3300 minArea = minEnlargement = Infinity;
3301 for (i3 = 0, len = node.children.length; i3 < len; i3++) {
3302 child = node.children[i3];
3303 area = bboxArea2(child);
3304 enlargement = enlargedArea2(bbox2, child) - area;
3305 if (enlargement < minEnlargement) {
3306 minEnlargement = enlargement;
3307 minArea = area < minArea ? area : minArea;
3309 } else if (enlargement === minEnlargement) {
3310 if (area < minArea) {
3316 node = targetNode || node.children[0];
3320 _insert: function(item, level, isNode) {
3321 var toBBox = this.toBBox, bbox2 = isNode ? item : toBBox(item), insertPath = [];
3322 var node = this._chooseSubtree(bbox2, this.data, level, insertPath);
3323 node.children.push(item);
3324 extend3(node, bbox2);
3325 while (level >= 0) {
3326 if (insertPath[level].children.length > this._maxEntries) {
3327 this._split(insertPath, level);
3331 this._adjustParentBBoxes(bbox2, insertPath, level);
3333 // split overflowed node into two
3334 _split: function(insertPath, level) {
3335 var node = insertPath[level], M2 = node.children.length, m2 = this._minEntries;
3336 this._chooseSplitAxis(node, m2, M2);
3337 var splitIndex = this._chooseSplitIndex(node, m2, M2);
3338 var newNode = createNode2(node.children.splice(splitIndex, node.children.length - splitIndex));
3339 newNode.height = node.height;
3340 newNode.leaf = node.leaf;
3341 calcBBox2(node, this.toBBox);
3342 calcBBox2(newNode, this.toBBox);
3343 if (level) insertPath[level - 1].children.push(newNode);
3344 else this._splitRoot(node, newNode);
3346 _splitRoot: function(node, newNode) {
3347 this.data = createNode2([node, newNode]);
3348 this.data.height = node.height + 1;
3349 this.data.leaf = false;
3350 calcBBox2(this.data, this.toBBox);
3352 _chooseSplitIndex: function(node, m2, M2) {
3353 var i3, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
3354 minOverlap = minArea = Infinity;
3355 for (i3 = m2; i3 <= M2 - m2; i3++) {
3356 bbox1 = distBBox2(node, 0, i3, this.toBBox);
3357 bbox2 = distBBox2(node, i3, M2, this.toBBox);
3358 overlap = intersectionArea2(bbox1, bbox2);
3359 area = bboxArea2(bbox1) + bboxArea2(bbox2);
3360 if (overlap < minOverlap) {
3361 minOverlap = overlap;
3363 minArea = area < minArea ? area : minArea;
3364 } else if (overlap === minOverlap) {
3365 if (area < minArea) {
3373 // sorts node children by the best axis for split
3374 _chooseSplitAxis: function(node, m2, M2) {
3375 var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX2, compareMinY = node.leaf ? this.compareMinY : compareNodeMinY2, xMargin = this._allDistMargin(node, m2, M2, compareMinX), yMargin = this._allDistMargin(node, m2, M2, compareMinY);
3376 if (xMargin < yMargin) node.children.sort(compareMinX);
3378 // total margin of all possible split distributions where each node is at least m full
3379 _allDistMargin: function(node, m2, M2, compare2) {
3380 node.children.sort(compare2);
3381 var toBBox = this.toBBox, leftBBox = distBBox2(node, 0, m2, toBBox), rightBBox = distBBox2(node, M2 - m2, M2, toBBox), margin = bboxMargin2(leftBBox) + bboxMargin2(rightBBox), i3, child;
3382 for (i3 = m2; i3 < M2 - m2; i3++) {
3383 child = node.children[i3];
3384 extend3(leftBBox, node.leaf ? toBBox(child) : child);
3385 margin += bboxMargin2(leftBBox);
3387 for (i3 = M2 - m2 - 1; i3 >= m2; i3--) {
3388 child = node.children[i3];
3389 extend3(rightBBox, node.leaf ? toBBox(child) : child);
3390 margin += bboxMargin2(rightBBox);
3394 _adjustParentBBoxes: function(bbox2, path, level) {
3395 for (var i3 = level; i3 >= 0; i3--) {
3396 extend3(path[i3], bbox2);
3399 _condense: function(path) {
3400 for (var i3 = path.length - 1, siblings; i3 >= 0; i3--) {
3401 if (path[i3].children.length === 0) {
3403 siblings = path[i3 - 1].children;
3404 siblings.splice(siblings.indexOf(path[i3]), 1);
3405 } else this.clear();
3406 } else calcBBox2(path[i3], this.toBBox);
3409 _initFormat: function(format2) {
3410 var compareArr = ["return a", " - b", ";"];
3411 this.compareMinX = new Function("a", "b", compareArr.join(format2[0]));
3412 this.compareMinY = new Function("a", "b", compareArr.join(format2[1]));
3413 this.toBBox = new Function(
3415 "return {minX: a" + format2[0] + ", minY: a" + format2[1] + ", maxX: a" + format2[2] + ", maxY: a" + format2[3] + "};"
3419 function findItem2(item, items, equalsFn) {
3420 if (!equalsFn) return items.indexOf(item);
3421 for (var i3 = 0; i3 < items.length; i3++) {
3422 if (equalsFn(item, items[i3])) return i3;
3426 function calcBBox2(node, toBBox) {
3427 distBBox2(node, 0, node.children.length, toBBox, node);
3429 function distBBox2(node, k2, p2, toBBox, destNode) {
3430 if (!destNode) destNode = createNode2(null);
3431 destNode.minX = Infinity;
3432 destNode.minY = Infinity;
3433 destNode.maxX = -Infinity;
3434 destNode.maxY = -Infinity;
3435 for (var i3 = k2, child; i3 < p2; i3++) {
3436 child = node.children[i3];
3437 extend3(destNode, node.leaf ? toBBox(child) : child);
3441 function extend3(a2, b2) {
3442 a2.minX = Math.min(a2.minX, b2.minX);
3443 a2.minY = Math.min(a2.minY, b2.minY);
3444 a2.maxX = Math.max(a2.maxX, b2.maxX);
3445 a2.maxY = Math.max(a2.maxY, b2.maxY);
3448 function compareNodeMinX2(a2, b2) {
3449 return a2.minX - b2.minX;
3451 function compareNodeMinY2(a2, b2) {
3452 return a2.minY - b2.minY;
3454 function bboxArea2(a2) {
3455 return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
3457 function bboxMargin2(a2) {
3458 return a2.maxX - a2.minX + (a2.maxY - a2.minY);
3460 function enlargedArea2(a2, b2) {
3461 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));
3463 function intersectionArea2(a2, b2) {
3464 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);
3465 return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
3467 function contains2(a2, b2) {
3468 return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
3470 function intersects2(a2, b2) {
3471 return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
3473 function createNode2(children2) {
3475 children: children2,
3484 function multiSelect2(arr, left, right, n3, compare2) {
3485 var stack = [left, right], mid;
3486 while (stack.length) {
3487 right = stack.pop();
3489 if (right - left <= n3) continue;
3490 mid = left + Math.ceil((right - left) / n3 / 2) * n3;
3491 quickselect3(arr, mid, left, right, compare2);
3492 stack.push(left, mid, mid, right);
3498 // node_modules/lineclip/index.js
3499 var require_lineclip = __commonJS({
3500 "node_modules/lineclip/index.js"(exports2, module2) {
3502 module2.exports = lineclip2;
3503 lineclip2.polyline = lineclip2;
3504 lineclip2.polygon = polygonclip2;
3505 function lineclip2(points, bbox2, result) {
3506 var len = points.length, codeA = bitCode2(points[0], bbox2), part = [], i3, a2, b2, codeB, lastCode;
3507 if (!result) result = [];
3508 for (i3 = 1; i3 < len; i3++) {
3509 a2 = points[i3 - 1];
3511 codeB = lastCode = bitCode2(b2, bbox2);
3513 if (!(codeA | codeB)) {
3515 if (codeB !== lastCode) {
3521 } else if (i3 === len - 1) {
3525 } else if (codeA & codeB) {
3528 a2 = intersect2(a2, b2, codeA, bbox2);
3529 codeA = bitCode2(a2, bbox2);
3531 b2 = intersect2(a2, b2, codeB, bbox2);
3532 codeB = bitCode2(b2, bbox2);
3537 if (part.length) result.push(part);
3540 function polygonclip2(points, bbox2) {
3541 var result, edge, prev, prevInside, i3, p2, inside;
3542 for (edge = 1; edge <= 8; edge *= 2) {
3544 prev = points[points.length - 1];
3545 prevInside = !(bitCode2(prev, bbox2) & edge);
3546 for (i3 = 0; i3 < points.length; i3++) {
3548 inside = !(bitCode2(p2, bbox2) & edge);
3549 if (inside !== prevInside) result.push(intersect2(prev, p2, edge, bbox2));
3550 if (inside) result.push(p2);
3552 prevInside = inside;
3555 if (!points.length) break;
3559 function intersect2(a2, b2, edge, bbox2) {
3560 return edge & 8 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[3] - a2[1]) / (b2[1] - a2[1]), bbox2[3]] : (
3562 edge & 4 ? [a2[0] + (b2[0] - a2[0]) * (bbox2[1] - a2[1]) / (b2[1] - a2[1]), bbox2[1]] : (
3564 edge & 2 ? [bbox2[2], a2[1] + (b2[1] - a2[1]) * (bbox2[2] - a2[0]) / (b2[0] - a2[0])] : (
3566 edge & 1 ? [bbox2[0], a2[1] + (b2[1] - a2[1]) * (bbox2[0] - a2[0]) / (b2[0] - a2[0])] : (
3574 function bitCode2(p2, bbox2) {
3576 if (p2[0] < bbox2[0]) code |= 1;
3577 else if (p2[0] > bbox2[2]) code |= 2;
3578 if (p2[1] < bbox2[1]) code |= 4;
3579 else if (p2[1] > bbox2[3]) code |= 8;
3585 // node_modules/which-polygon/index.js
3586 var require_which_polygon = __commonJS({
3587 "node_modules/which-polygon/index.js"(exports2, module2) {
3589 var rbush = require_rbush();
3590 var lineclip2 = require_lineclip();
3591 module2.exports = whichPolygon5;
3592 function whichPolygon5(data) {
3594 for (var i3 = 0; i3 < data.features.length; i3++) {
3595 var feature3 = data.features[i3];
3596 if (!feature3.geometry) continue;
3597 var coords = feature3.geometry.coordinates;
3598 if (feature3.geometry.type === "Polygon") {
3599 bboxes.push(treeItem(coords, feature3.properties));
3600 } else if (feature3.geometry.type === "MultiPolygon") {
3601 for (var j2 = 0; j2 < coords.length; j2++) {
3602 bboxes.push(treeItem(coords[j2], feature3.properties));
3606 var tree = rbush().load(bboxes);
3607 function query(p2, multi) {
3608 var output = [], result = tree.search({
3614 for (var i4 = 0; i4 < result.length; i4++) {
3615 if (insidePolygon(result[i4].coords, p2)) {
3617 output.push(result[i4].props);
3619 return result[i4].props;
3622 return multi && output.length ? output : null;
3625 query.bbox = function queryBBox(bbox2) {
3627 var result = tree.search({
3633 for (var i4 = 0; i4 < result.length; i4++) {
3634 if (polygonIntersectsBBox(result[i4].coords, bbox2)) {
3635 output.push(result[i4].props);
3642 function polygonIntersectsBBox(polygon2, bbox2) {
3644 (bbox2[0] + bbox2[2]) / 2,
3645 (bbox2[1] + bbox2[3]) / 2
3647 if (insidePolygon(polygon2, bboxCenter)) return true;
3648 for (var i3 = 0; i3 < polygon2.length; i3++) {
3649 if (lineclip2(polygon2[i3], bbox2).length > 0) return true;
3653 function insidePolygon(rings, p2) {
3655 for (var i3 = 0, len = rings.length; i3 < len; i3++) {
3656 var ring = rings[i3];
3657 for (var j2 = 0, len2 = ring.length, k2 = len2 - 1; j2 < len2; k2 = j2++) {
3658 if (rayIntersect(p2, ring[j2], ring[k2])) inside = !inside;
3663 function rayIntersect(p2, p1, p22) {
3664 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];
3666 function treeItem(coords, props) {
3675 for (var i3 = 0; i3 < coords[0].length; i3++) {
3676 var p2 = coords[0][i3];
3677 item.minX = Math.min(item.minX, p2[0]);
3678 item.minY = Math.min(item.minY, p2[1]);
3679 item.maxX = Math.max(item.maxX, p2[0]);
3680 item.maxY = Math.max(item.maxY, p2[1]);
3687 // node_modules/wgs84/index.js
3688 var require_wgs84 = __commonJS({
3689 "node_modules/wgs84/index.js"(exports2, module2) {
3690 module2.exports.RADIUS = 6378137;
3691 module2.exports.FLATTENING = 1 / 298.257223563;
3692 module2.exports.POLAR_RADIUS = 63567523142e-4;
3696 // node_modules/@mapbox/geojson-area/index.js
3697 var require_geojson_area = __commonJS({
3698 "node_modules/@mapbox/geojson-area/index.js"(exports2, module2) {
3699 var wgs84 = require_wgs84();
3700 module2.exports.geometry = geometry;
3701 module2.exports.ring = ringArea;
3702 function geometry(_2) {
3706 return polygonArea(_2.coordinates);
3707 case "MultiPolygon":
3708 for (i3 = 0; i3 < _2.coordinates.length; i3++) {
3709 area += polygonArea(_2.coordinates[i3]);
3715 case "MultiLineString":
3717 case "GeometryCollection":
3718 for (i3 = 0; i3 < _2.geometries.length; i3++) {
3719 area += geometry(_2.geometries[i3]);
3724 function polygonArea(coords) {
3726 if (coords && coords.length > 0) {
3727 area += Math.abs(ringArea(coords[0]));
3728 for (var i3 = 1; i3 < coords.length; i3++) {
3729 area -= Math.abs(ringArea(coords[i3]));
3734 function ringArea(coords) {
3735 var p1, p2, p3, lowerIndex, middleIndex, upperIndex, i3, area = 0, coordsLength = coords.length;
3736 if (coordsLength > 2) {
3737 for (i3 = 0; i3 < coordsLength; i3++) {
3738 if (i3 === coordsLength - 2) {
3739 lowerIndex = coordsLength - 2;
3740 middleIndex = coordsLength - 1;
3742 } else if (i3 === coordsLength - 1) {
3743 lowerIndex = coordsLength - 1;
3748 middleIndex = i3 + 1;
3749 upperIndex = i3 + 2;
3751 p1 = coords[lowerIndex];
3752 p2 = coords[middleIndex];
3753 p3 = coords[upperIndex];
3754 area += (rad(p3[0]) - rad(p1[0])) * Math.sin(rad(p2[1]));
3756 area = area * wgs84.RADIUS * wgs84.RADIUS / 2;
3761 return _2 * Math.PI / 180;
3766 // node_modules/circle-to-polygon/input-validation/validateCenter.js
3767 var require_validateCenter = __commonJS({
3768 "node_modules/circle-to-polygon/input-validation/validateCenter.js"(exports2) {
3769 exports2.validateCenter = function validateCenter(center) {
3770 var validCenterLengths = [2, 3];
3771 if (!Array.isArray(center) || !validCenterLengths.includes(center.length)) {
3772 throw new Error("ERROR! Center has to be an array of length two or three");
3774 var [lng, lat] = center;
3775 if (typeof lng !== "number" || typeof lat !== "number") {
3777 "ERROR! Longitude and Latitude has to be numbers but where ".concat(typeof lng, " and ").concat(typeof lat)
3780 if (lng > 180 || lng < -180) {
3781 throw new Error("ERROR! Longitude has to be between -180 and 180 but was ".concat(lng));
3783 if (lat > 90 || lat < -90) {
3784 throw new Error("ERROR! Latitude has to be between -90 and 90 but was ".concat(lat));
3790 // node_modules/circle-to-polygon/input-validation/validateRadius.js
3791 var require_validateRadius = __commonJS({
3792 "node_modules/circle-to-polygon/input-validation/validateRadius.js"(exports2) {
3793 exports2.validateRadius = function validateRadius(radius) {
3794 if (typeof radius !== "number") {
3795 throw new Error("ERROR! Radius has to be a positive number but was: ".concat(typeof radius));
3798 throw new Error("ERROR! Radius has to be a positive number but was: ".concat(radius));
3804 // node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js
3805 var require_validateNumberOfEdges = __commonJS({
3806 "node_modules/circle-to-polygon/input-validation/validateNumberOfEdges.js"(exports2) {
3807 exports2.validateNumberOfEdges = function validateNumberOfEdges(numberOfEdges) {
3808 if (typeof numberOfEdges !== "number") {
3809 const ARGUMENT_TYPE = Array.isArray(numberOfEdges) ? "array" : typeof numberOfEdges;
3810 throw new Error("ERROR! Number of edges has to be a number but was: ".concat(ARGUMENT_TYPE));
3812 if (numberOfEdges < 3) {
3813 throw new Error("ERROR! Number of edges has to be at least 3 but was: ".concat(numberOfEdges));
3819 // node_modules/circle-to-polygon/input-validation/validateEarthRadius.js
3820 var require_validateEarthRadius = __commonJS({
3821 "node_modules/circle-to-polygon/input-validation/validateEarthRadius.js"(exports2) {
3822 exports2.validateEarthRadius = function validateEarthRadius(earthRadius2) {
3823 if (typeof earthRadius2 !== "number") {
3824 const ARGUMENT_TYPE = Array.isArray(earthRadius2) ? "array" : typeof earthRadius2;
3825 throw new Error("ERROR! Earth radius has to be a number but was: ".concat(ARGUMENT_TYPE));
3827 if (earthRadius2 <= 0) {
3828 throw new Error("ERROR! Earth radius has to be a positive number but was: ".concat(earthRadius2));
3834 // node_modules/circle-to-polygon/input-validation/validateBearing.js
3835 var require_validateBearing = __commonJS({
3836 "node_modules/circle-to-polygon/input-validation/validateBearing.js"(exports2) {
3837 exports2.validateBearing = function validateBearing(bearing) {
3838 if (typeof bearing !== "number") {
3839 const ARGUMENT_TYPE = Array.isArray(bearing) ? "array" : typeof bearing;
3840 throw new Error("ERROR! Bearing has to be a number but was: ".concat(ARGUMENT_TYPE));
3846 // node_modules/circle-to-polygon/input-validation/index.js
3847 var require_input_validation = __commonJS({
3848 "node_modules/circle-to-polygon/input-validation/index.js"(exports2) {
3849 var validateCenter = require_validateCenter().validateCenter;
3850 var validateRadius = require_validateRadius().validateRadius;
3851 var validateNumberOfEdges = require_validateNumberOfEdges().validateNumberOfEdges;
3852 var validateEarthRadius = require_validateEarthRadius().validateEarthRadius;
3853 var validateBearing = require_validateBearing().validateBearing;
3854 function validateInput({ center, radius, numberOfEdges, earthRadius: earthRadius2, bearing }) {
3855 validateCenter(center);
3856 validateRadius(radius);
3857 validateNumberOfEdges(numberOfEdges);
3858 validateEarthRadius(earthRadius2);
3859 validateBearing(bearing);
3861 exports2.validateCenter = validateCenter;
3862 exports2.validateRadius = validateRadius;
3863 exports2.validateNumberOfEdges = validateNumberOfEdges;
3864 exports2.validateEarthRadius = validateEarthRadius;
3865 exports2.validateBearing = validateBearing;
3866 exports2.validateInput = validateInput;
3870 // node_modules/circle-to-polygon/index.js
3871 var require_circle_to_polygon = __commonJS({
3872 "node_modules/circle-to-polygon/index.js"(exports2, module2) {
3874 var { validateInput } = require_input_validation();
3875 var defaultEarthRadius = 6378137;
3876 function toRadians(angleInDegrees) {
3877 return angleInDegrees * Math.PI / 180;
3879 function toDegrees(angleInRadians) {
3880 return angleInRadians * 180 / Math.PI;
3882 function offset(c1, distance, earthRadius2, bearing) {
3883 var lat1 = toRadians(c1[1]);
3884 var lon1 = toRadians(c1[0]);
3885 var dByR = distance / earthRadius2;
3886 var lat = Math.asin(
3887 Math.sin(lat1) * Math.cos(dByR) + Math.cos(lat1) * Math.sin(dByR) * Math.cos(bearing)
3889 var lon = lon1 + Math.atan2(
3890 Math.sin(bearing) * Math.sin(dByR) * Math.cos(lat1),
3891 Math.cos(dByR) - Math.sin(lat1) * Math.sin(lat)
3893 return [toDegrees(lon), toDegrees(lat)];
3895 module2.exports = function circleToPolygon2(center, radius, options2) {
3896 var n3 = getNumberOfEdges(options2);
3897 var earthRadius2 = getEarthRadius(options2);
3898 var bearing = getBearing(options2);
3899 var direction = getDirection(options2);
3900 validateInput({ center, radius, numberOfEdges: n3, earthRadius: earthRadius2, bearing });
3901 var start2 = toRadians(bearing);
3902 var coordinates = [];
3903 for (var i3 = 0; i3 < n3; ++i3) {
3909 start2 + direction * 2 * Math.PI * -i3 / n3
3913 coordinates.push(coordinates[0]);
3916 coordinates: [coordinates]
3919 function getNumberOfEdges(options2) {
3920 if (isUndefinedOrNull(options2)) {
3922 } else if (isObjectNotArray(options2)) {
3923 var numberOfEdges = options2.numberOfEdges;
3924 return numberOfEdges === void 0 ? 32 : numberOfEdges;
3928 function getEarthRadius(options2) {
3929 if (isUndefinedOrNull(options2)) {
3930 return defaultEarthRadius;
3931 } else if (isObjectNotArray(options2)) {
3932 var earthRadius2 = options2.earthRadius;
3933 return earthRadius2 === void 0 ? defaultEarthRadius : earthRadius2;
3935 return defaultEarthRadius;
3937 function getDirection(options2) {
3938 if (isObjectNotArray(options2) && options2.rightHandRule) {
3943 function getBearing(options2) {
3944 if (isUndefinedOrNull(options2)) {
3946 } else if (isObjectNotArray(options2)) {
3947 var bearing = options2.bearing;
3948 return bearing === void 0 ? 0 : bearing;
3952 function isObjectNotArray(argument) {
3953 return argument !== null && typeof argument === "object" && !Array.isArray(argument);
3955 function isUndefinedOrNull(argument) {
3956 return argument === null || argument === void 0;
3961 // node_modules/geojson-precision/index.js
3962 var require_geojson_precision = __commonJS({
3963 "node_modules/geojson-precision/index.js"(exports2, module2) {
3965 function parse(t2, coordinatePrecision, extrasPrecision) {
3966 function point(p2) {
3967 return p2.map(function(e3, index) {
3969 return 1 * e3.toFixed(coordinatePrecision);
3971 return 1 * e3.toFixed(extrasPrecision);
3975 function multi(l2) {
3976 return l2.map(point);
3979 return p2.map(multi);
3981 function multiPoly(m2) {
3982 return m2.map(poly);
3984 function geometry(obj) {
3990 obj.coordinates = point(obj.coordinates);
3994 obj.coordinates = multi(obj.coordinates);
3997 case "MultiLineString":
3998 obj.coordinates = poly(obj.coordinates);
4000 case "MultiPolygon":
4001 obj.coordinates = multiPoly(obj.coordinates);
4003 case "GeometryCollection":
4004 obj.geometries = obj.geometries.map(geometry);
4010 function feature3(obj) {
4011 obj.geometry = geometry(obj.geometry);
4014 function featureCollection(f2) {
4015 f2.features = f2.features.map(feature3);
4018 function geometryCollection(g3) {
4019 g3.geometries = g3.geometries.map(geometry);
4027 return feature3(t2);
4028 case "GeometryCollection":
4029 return geometryCollection(t2);
4030 case "FeatureCollection":
4031 return featureCollection(t2);
4036 case "MultiPolygon":
4037 case "MultiLineString":
4038 return geometry(t2);
4043 module2.exports = parse;
4044 module2.exports.parse = parse;
4049 // node_modules/@aitodotai/json-stringify-pretty-compact/index.js
4050 var require_json_stringify_pretty_compact = __commonJS({
4051 "node_modules/@aitodotai/json-stringify-pretty-compact/index.js"(exports2, module2) {
4052 function isObject2(obj) {
4053 return typeof obj === "object" && obj !== null;
4055 function forEach(obj, cb) {
4056 if (Array.isArray(obj)) {
4058 } else if (isObject2(obj)) {
4059 Object.keys(obj).forEach(function(key) {
4065 function getTreeDepth(obj) {
4067 if (Array.isArray(obj) || isObject2(obj)) {
4068 forEach(obj, function(val) {
4069 if (Array.isArray(val) || isObject2(val)) {
4070 var tmpDepth = getTreeDepth(val);
4071 if (tmpDepth > depth) {
4080 function stringify3(obj, options2) {
4081 options2 = options2 || {};
4082 var indent = JSON.stringify([1], null, get4(options2, "indent", 2)).slice(2, -3);
4083 var addMargin = get4(options2, "margins", false);
4084 var addArrayMargin = get4(options2, "arrayMargins", false);
4085 var addObjectMargin = get4(options2, "objectMargins", false);
4086 var maxLength = indent === "" ? Infinity : get4(options2, "maxLength", 80);
4087 var maxNesting = get4(options2, "maxNesting", Infinity);
4088 return function _stringify(obj2, currentIndent, reserved) {
4089 if (obj2 && typeof obj2.toJSON === "function") {
4090 obj2 = obj2.toJSON();
4092 var string = JSON.stringify(obj2);
4093 if (string === void 0) {
4096 var length2 = maxLength - currentIndent.length - reserved;
4097 var treeDepth = getTreeDepth(obj2);
4098 if (treeDepth <= maxNesting && string.length <= length2) {
4099 var prettified = prettify(string, {
4104 if (prettified.length <= length2) {
4108 if (isObject2(obj2)) {
4109 var nextIndent = currentIndent + indent;
4112 var comma = function(array2, index2) {
4113 return index2 === array2.length - 1 ? 0 : 1;
4115 if (Array.isArray(obj2)) {
4116 for (var index = 0; index < obj2.length; index++) {
4118 _stringify(obj2[index], nextIndent, comma(obj2, index)) || "null"
4123 Object.keys(obj2).forEach(function(key, index2, array2) {
4124 var keyPart = JSON.stringify(key) + ": ";
4125 var value = _stringify(
4128 keyPart.length + comma(array2, index2)
4130 if (value !== void 0) {
4131 items.push(keyPart + value);
4136 if (items.length > 0) {
4139 indent + items.join(",\n" + nextIndent),
4141 ].join("\n" + currentIndent);
4147 var stringOrChar = /("(?:[^\\"]|\\.)*")|[:,\][}{]/g;
4148 function prettify(string, options2) {
4149 options2 = options2 || {};
4158 if (options2.addMargin || options2.addObjectMargin) {
4162 if (options2.addMargin || options2.addArrayMargin) {
4166 return string.replace(stringOrChar, function(match, string2) {
4167 return string2 ? match : tokens[match];
4170 function get4(options2, name, defaultValue) {
4171 return name in options2 ? options2[name] : defaultValue;
4173 module2.exports = stringify3;
4177 // node_modules/aes-js/index.js
4178 var require_aes_js = __commonJS({
4179 "node_modules/aes-js/index.js"(exports2, module2) {
4182 function checkInt(value) {
4183 return parseInt(value) === value;
4185 function checkInts(arrayish) {
4186 if (!checkInt(arrayish.length)) {
4189 for (var i3 = 0; i3 < arrayish.length; i3++) {
4190 if (!checkInt(arrayish[i3]) || arrayish[i3] < 0 || arrayish[i3] > 255) {
4196 function coerceArray(arg, copy2) {
4197 if (arg.buffer && arg.name === "Uint8Array") {
4202 arg = Array.prototype.slice.call(arg);
4207 if (Array.isArray(arg)) {
4208 if (!checkInts(arg)) {
4209 throw new Error("Array contains invalid value: " + arg);
4211 return new Uint8Array(arg);
4213 if (checkInt(arg.length) && checkInts(arg)) {
4214 return new Uint8Array(arg);
4216 throw new Error("unsupported array-like object");
4218 function createArray(length2) {
4219 return new Uint8Array(length2);
4221 function copyArray(sourceArray, targetArray, targetStart, sourceStart, sourceEnd) {
4222 if (sourceStart != null || sourceEnd != null) {
4223 if (sourceArray.slice) {
4224 sourceArray = sourceArray.slice(sourceStart, sourceEnd);
4226 sourceArray = Array.prototype.slice.call(sourceArray, sourceStart, sourceEnd);
4229 targetArray.set(sourceArray, targetStart);
4231 var convertUtf8 = /* @__PURE__ */ function() {
4232 function toBytes(text) {
4233 var result = [], i3 = 0;
4234 text = encodeURI(text);
4235 while (i3 < text.length) {
4236 var c2 = text.charCodeAt(i3++);
4238 result.push(parseInt(text.substr(i3, 2), 16));
4244 return coerceArray(result);
4246 function fromBytes(bytes) {
4247 var result = [], i3 = 0;
4248 while (i3 < bytes.length) {
4251 result.push(String.fromCharCode(c2));
4253 } else if (c2 > 191 && c2 < 224) {
4254 result.push(String.fromCharCode((c2 & 31) << 6 | bytes[i3 + 1] & 63));
4257 result.push(String.fromCharCode((c2 & 15) << 12 | (bytes[i3 + 1] & 63) << 6 | bytes[i3 + 2] & 63));
4261 return result.join("");
4268 var convertHex = /* @__PURE__ */ function() {
4269 function toBytes(text) {
4271 for (var i3 = 0; i3 < text.length; i3 += 2) {
4272 result.push(parseInt(text.substr(i3, 2), 16));
4276 var Hex = "0123456789abcdef";
4277 function fromBytes(bytes) {
4279 for (var i3 = 0; i3 < bytes.length; i3++) {
4281 result.push(Hex[(v2 & 240) >> 4] + Hex[v2 & 15]);
4283 return result.join("");
4290 var numberOfRounds = { 16: 10, 24: 12, 32: 14 };
4291 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];
4292 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];
4293 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];
4294 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];
4295 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];
4296 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];
4297 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];
4298 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];
4299 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];
4300 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];
4301 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];
4302 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];
4303 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];
4304 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];
4305 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];
4306 function convertToInt32(bytes) {
4308 for (var i3 = 0; i3 < bytes.length; i3 += 4) {
4310 bytes[i3] << 24 | bytes[i3 + 1] << 16 | bytes[i3 + 2] << 8 | bytes[i3 + 3]
4315 var AES = function(key) {
4316 if (!(this instanceof AES)) {
4317 throw Error("AES must be instanitated with `new`");
4319 Object.defineProperty(this, "key", {
4320 value: coerceArray(key, true)
4324 AES.prototype._prepare = function() {
4325 var rounds = numberOfRounds[this.key.length];
4326 if (rounds == null) {
4327 throw new Error("invalid key size (must be 16, 24 or 32 bytes)");
4331 for (var i3 = 0; i3 <= rounds; i3++) {
4332 this._Ke.push([0, 0, 0, 0]);
4333 this._Kd.push([0, 0, 0, 0]);
4335 var roundKeyCount = (rounds + 1) * 4;
4336 var KC = this.key.length / 4;
4337 var tk = convertToInt32(this.key);
4339 for (var i3 = 0; i3 < KC; i3++) {
4341 this._Ke[index][i3 % 4] = tk[i3];
4342 this._Kd[rounds - index][i3 % 4] = tk[i3];
4344 var rconpointer = 0;
4346 while (t2 < roundKeyCount) {
4348 tk[0] ^= S2[tt2 >> 16 & 255] << 24 ^ S2[tt2 >> 8 & 255] << 16 ^ S2[tt2 & 255] << 8 ^ S2[tt2 >> 24 & 255] ^ rcon[rconpointer] << 24;
4351 for (var i3 = 1; i3 < KC; i3++) {
4352 tk[i3] ^= tk[i3 - 1];
4355 for (var i3 = 1; i3 < KC / 2; i3++) {
4356 tk[i3] ^= tk[i3 - 1];
4358 tt2 = tk[KC / 2 - 1];
4359 tk[KC / 2] ^= S2[tt2 & 255] ^ S2[tt2 >> 8 & 255] << 8 ^ S2[tt2 >> 16 & 255] << 16 ^ S2[tt2 >> 24 & 255] << 24;
4360 for (var i3 = KC / 2 + 1; i3 < KC; i3++) {
4361 tk[i3] ^= tk[i3 - 1];
4365 while (i3 < KC && t2 < roundKeyCount) {
4368 this._Ke[r2][c2] = tk[i3];
4369 this._Kd[rounds - r2][c2] = tk[i3++];
4373 for (var r2 = 1; r2 < rounds; r2++) {
4374 for (var c2 = 0; c2 < 4; c2++) {
4375 tt2 = this._Kd[r2][c2];
4376 this._Kd[r2][c2] = U1[tt2 >> 24 & 255] ^ U2[tt2 >> 16 & 255] ^ U3[tt2 >> 8 & 255] ^ U4[tt2 & 255];
4380 AES.prototype.encrypt = function(plaintext) {
4381 if (plaintext.length != 16) {
4382 throw new Error("invalid plaintext size (must be 16 bytes)");
4384 var rounds = this._Ke.length - 1;
4385 var a2 = [0, 0, 0, 0];
4386 var t2 = convertToInt32(plaintext);
4387 for (var i3 = 0; i3 < 4; i3++) {
4388 t2[i3] ^= this._Ke[0][i3];
4390 for (var r2 = 1; r2 < rounds; r2++) {
4391 for (var i3 = 0; i3 < 4; i3++) {
4392 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];
4396 var result = createArray(16), tt2;
4397 for (var i3 = 0; i3 < 4; i3++) {
4398 tt2 = this._Ke[rounds][i3];
4399 result[4 * i3] = (S2[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4400 result[4 * i3 + 1] = (S2[t2[(i3 + 1) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4401 result[4 * i3 + 2] = (S2[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4402 result[4 * i3 + 3] = (S2[t2[(i3 + 3) % 4] & 255] ^ tt2) & 255;
4406 AES.prototype.decrypt = function(ciphertext) {
4407 if (ciphertext.length != 16) {
4408 throw new Error("invalid ciphertext size (must be 16 bytes)");
4410 var rounds = this._Kd.length - 1;
4411 var a2 = [0, 0, 0, 0];
4412 var t2 = convertToInt32(ciphertext);
4413 for (var i3 = 0; i3 < 4; i3++) {
4414 t2[i3] ^= this._Kd[0][i3];
4416 for (var r2 = 1; r2 < rounds; r2++) {
4417 for (var i3 = 0; i3 < 4; i3++) {
4418 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];
4422 var result = createArray(16), tt2;
4423 for (var i3 = 0; i3 < 4; i3++) {
4424 tt2 = this._Kd[rounds][i3];
4425 result[4 * i3] = (Si[t2[i3] >> 24 & 255] ^ tt2 >> 24) & 255;
4426 result[4 * i3 + 1] = (Si[t2[(i3 + 3) % 4] >> 16 & 255] ^ tt2 >> 16) & 255;
4427 result[4 * i3 + 2] = (Si[t2[(i3 + 2) % 4] >> 8 & 255] ^ tt2 >> 8) & 255;
4428 result[4 * i3 + 3] = (Si[t2[(i3 + 1) % 4] & 255] ^ tt2) & 255;
4432 var ModeOfOperationECB = function(key) {
4433 if (!(this instanceof ModeOfOperationECB)) {
4434 throw Error("AES must be instanitated with `new`");
4436 this.description = "Electronic Code Block";
4438 this._aes = new AES(key);
4440 ModeOfOperationECB.prototype.encrypt = function(plaintext) {
4441 plaintext = coerceArray(plaintext);
4442 if (plaintext.length % 16 !== 0) {
4443 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4445 var ciphertext = createArray(plaintext.length);
4446 var block2 = createArray(16);
4447 for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4448 copyArray(plaintext, block2, 0, i3, i3 + 16);
4449 block2 = this._aes.encrypt(block2);
4450 copyArray(block2, ciphertext, i3);
4454 ModeOfOperationECB.prototype.decrypt = function(ciphertext) {
4455 ciphertext = coerceArray(ciphertext);
4456 if (ciphertext.length % 16 !== 0) {
4457 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4459 var plaintext = createArray(ciphertext.length);
4460 var block2 = createArray(16);
4461 for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4462 copyArray(ciphertext, block2, 0, i3, i3 + 16);
4463 block2 = this._aes.decrypt(block2);
4464 copyArray(block2, plaintext, i3);
4468 var ModeOfOperationCBC = function(key, iv) {
4469 if (!(this instanceof ModeOfOperationCBC)) {
4470 throw Error("AES must be instanitated with `new`");
4472 this.description = "Cipher Block Chaining";
4475 iv = createArray(16);
4476 } else if (iv.length != 16) {
4477 throw new Error("invalid initialation vector size (must be 16 bytes)");
4479 this._lastCipherblock = coerceArray(iv, true);
4480 this._aes = new AES(key);
4482 ModeOfOperationCBC.prototype.encrypt = function(plaintext) {
4483 plaintext = coerceArray(plaintext);
4484 if (plaintext.length % 16 !== 0) {
4485 throw new Error("invalid plaintext size (must be multiple of 16 bytes)");
4487 var ciphertext = createArray(plaintext.length);
4488 var block2 = createArray(16);
4489 for (var i3 = 0; i3 < plaintext.length; i3 += 16) {
4490 copyArray(plaintext, block2, 0, i3, i3 + 16);
4491 for (var j2 = 0; j2 < 16; j2++) {
4492 block2[j2] ^= this._lastCipherblock[j2];
4494 this._lastCipherblock = this._aes.encrypt(block2);
4495 copyArray(this._lastCipherblock, ciphertext, i3);
4499 ModeOfOperationCBC.prototype.decrypt = function(ciphertext) {
4500 ciphertext = coerceArray(ciphertext);
4501 if (ciphertext.length % 16 !== 0) {
4502 throw new Error("invalid ciphertext size (must be multiple of 16 bytes)");
4504 var plaintext = createArray(ciphertext.length);
4505 var block2 = createArray(16);
4506 for (var i3 = 0; i3 < ciphertext.length; i3 += 16) {
4507 copyArray(ciphertext, block2, 0, i3, i3 + 16);
4508 block2 = this._aes.decrypt(block2);
4509 for (var j2 = 0; j2 < 16; j2++) {
4510 plaintext[i3 + j2] = block2[j2] ^ this._lastCipherblock[j2];
4512 copyArray(ciphertext, this._lastCipherblock, 0, i3, i3 + 16);
4516 var ModeOfOperationCFB = function(key, iv, segmentSize) {
4517 if (!(this instanceof ModeOfOperationCFB)) {
4518 throw Error("AES must be instanitated with `new`");
4520 this.description = "Cipher Feedback";
4523 iv = createArray(16);
4524 } else if (iv.length != 16) {
4525 throw new Error("invalid initialation vector size (must be 16 size)");
4530 this.segmentSize = segmentSize;
4531 this._shiftRegister = coerceArray(iv, true);
4532 this._aes = new AES(key);
4534 ModeOfOperationCFB.prototype.encrypt = function(plaintext) {
4535 if (plaintext.length % this.segmentSize != 0) {
4536 throw new Error("invalid plaintext size (must be segmentSize bytes)");
4538 var encrypted = coerceArray(plaintext, true);
4540 for (var i3 = 0; i3 < encrypted.length; i3 += this.segmentSize) {
4541 xorSegment = this._aes.encrypt(this._shiftRegister);
4542 for (var j2 = 0; j2 < this.segmentSize; j2++) {
4543 encrypted[i3 + j2] ^= xorSegment[j2];
4545 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4546 copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4550 ModeOfOperationCFB.prototype.decrypt = function(ciphertext) {
4551 if (ciphertext.length % this.segmentSize != 0) {
4552 throw new Error("invalid ciphertext size (must be segmentSize bytes)");
4554 var plaintext = coerceArray(ciphertext, true);
4556 for (var i3 = 0; i3 < plaintext.length; i3 += this.segmentSize) {
4557 xorSegment = this._aes.encrypt(this._shiftRegister);
4558 for (var j2 = 0; j2 < this.segmentSize; j2++) {
4559 plaintext[i3 + j2] ^= xorSegment[j2];
4561 copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize);
4562 copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i3, i3 + this.segmentSize);
4566 var ModeOfOperationOFB = function(key, iv) {
4567 if (!(this instanceof ModeOfOperationOFB)) {
4568 throw Error("AES must be instanitated with `new`");
4570 this.description = "Output Feedback";
4573 iv = createArray(16);
4574 } else if (iv.length != 16) {
4575 throw new Error("invalid initialation vector size (must be 16 bytes)");
4577 this._lastPrecipher = coerceArray(iv, true);
4578 this._lastPrecipherIndex = 16;
4579 this._aes = new AES(key);
4581 ModeOfOperationOFB.prototype.encrypt = function(plaintext) {
4582 var encrypted = coerceArray(plaintext, true);
4583 for (var i3 = 0; i3 < encrypted.length; i3++) {
4584 if (this._lastPrecipherIndex === 16) {
4585 this._lastPrecipher = this._aes.encrypt(this._lastPrecipher);
4586 this._lastPrecipherIndex = 0;
4588 encrypted[i3] ^= this._lastPrecipher[this._lastPrecipherIndex++];
4592 ModeOfOperationOFB.prototype.decrypt = ModeOfOperationOFB.prototype.encrypt;
4593 var Counter = function(initialValue) {
4594 if (!(this instanceof Counter)) {
4595 throw Error("Counter must be instanitated with `new`");
4597 if (initialValue !== 0 && !initialValue) {
4600 if (typeof initialValue === "number") {
4601 this._counter = createArray(16);
4602 this.setValue(initialValue);
4604 this.setBytes(initialValue);
4607 Counter.prototype.setValue = function(value) {
4608 if (typeof value !== "number" || parseInt(value) != value) {
4609 throw new Error("invalid counter value (must be an integer)");
4611 if (value > Number.MAX_SAFE_INTEGER) {
4612 throw new Error("integer value out of safe range");
4614 for (var index = 15; index >= 0; --index) {
4615 this._counter[index] = value % 256;
4616 value = parseInt(value / 256);
4619 Counter.prototype.setBytes = function(bytes) {
4620 bytes = coerceArray(bytes, true);
4621 if (bytes.length != 16) {
4622 throw new Error("invalid counter bytes size (must be 16 bytes)");
4624 this._counter = bytes;
4626 Counter.prototype.increment = function() {
4627 for (var i3 = 15; i3 >= 0; i3--) {
4628 if (this._counter[i3] === 255) {
4629 this._counter[i3] = 0;
4631 this._counter[i3]++;
4636 var ModeOfOperationCTR = function(key, counter) {
4637 if (!(this instanceof ModeOfOperationCTR)) {
4638 throw Error("AES must be instanitated with `new`");
4640 this.description = "Counter";
4642 if (!(counter instanceof Counter)) {
4643 counter = new Counter(counter);
4645 this._counter = counter;
4646 this._remainingCounter = null;
4647 this._remainingCounterIndex = 16;
4648 this._aes = new AES(key);
4650 ModeOfOperationCTR.prototype.encrypt = function(plaintext) {
4651 var encrypted = coerceArray(plaintext, true);
4652 for (var i3 = 0; i3 < encrypted.length; i3++) {
4653 if (this._remainingCounterIndex === 16) {
4654 this._remainingCounter = this._aes.encrypt(this._counter._counter);
4655 this._remainingCounterIndex = 0;
4656 this._counter.increment();
4658 encrypted[i3] ^= this._remainingCounter[this._remainingCounterIndex++];
4662 ModeOfOperationCTR.prototype.decrypt = ModeOfOperationCTR.prototype.encrypt;
4663 function pkcs7pad(data) {
4664 data = coerceArray(data, true);
4665 var padder = 16 - data.length % 16;
4666 var result = createArray(data.length + padder);
4667 copyArray(data, result);
4668 for (var i3 = data.length; i3 < result.length; i3++) {
4669 result[i3] = padder;
4673 function pkcs7strip(data) {
4674 data = coerceArray(data, true);
4675 if (data.length < 16) {
4676 throw new Error("PKCS#7 invalid length");
4678 var padder = data[data.length - 1];
4680 throw new Error("PKCS#7 padding byte out of range");
4682 var length2 = data.length - padder;
4683 for (var i3 = 0; i3 < padder; i3++) {
4684 if (data[length2 + i3] !== padder) {
4685 throw new Error("PKCS#7 invalid padding byte");
4688 var result = createArray(length2);
4689 copyArray(data, result, 0, 0, length2);
4696 ecb: ModeOfOperationECB,
4697 cbc: ModeOfOperationCBC,
4698 cfb: ModeOfOperationCFB,
4699 ofb: ModeOfOperationOFB,
4700 ctr: ModeOfOperationCTR
4718 if (typeof exports2 !== "undefined") {
4719 module2.exports = aesjs2;
4720 } else if (typeof define === "function" && define.amd) {
4721 define([], function() {
4726 aesjs2._aesjs = root3.aesjs;
4728 root3.aesjs = aesjs2;
4734 // node_modules/lodash/lodash.js
4735 var require_lodash = __commonJS({
4736 "node_modules/lodash/lodash.js"(exports2, module2) {
4739 var VERSION = "4.17.21";
4740 var LARGE_ARRAY_SIZE2 = 200;
4741 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`";
4742 var HASH_UNDEFINED4 = "__lodash_hash_undefined__";
4743 var MAX_MEMOIZE_SIZE = 500;
4744 var PLACEHOLDER = "__lodash_placeholder__";
4745 var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
4746 var COMPARE_PARTIAL_FLAG5 = 1, COMPARE_UNORDERED_FLAG3 = 2;
4747 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;
4748 var DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...";
4749 var HOT_COUNT = 800, HOT_SPAN = 16;
4750 var LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, LAZY_WHILE_FLAG = 3;
4751 var INFINITY2 = 1 / 0, MAX_SAFE_INTEGER4 = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN2 = 0 / 0;
4752 var MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
4754 ["ary", WRAP_ARY_FLAG],
4755 ["bind", WRAP_BIND_FLAG],
4756 ["bindKey", WRAP_BIND_KEY_FLAG],
4757 ["curry", WRAP_CURRY_FLAG],
4758 ["curryRight", WRAP_CURRY_RIGHT_FLAG],
4759 ["flip", WRAP_FLIP_FLAG],
4760 ["partial", WRAP_PARTIAL_FLAG],
4761 ["partialRight", WRAP_PARTIAL_RIGHT_FLAG],
4762 ["rearg", WRAP_REARG_FLAG]
4764 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]";
4765 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]";
4766 var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
4767 var reEscapedHtml2 = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml2 = /[&<>"']/g, reHasEscapedHtml2 = RegExp(reEscapedHtml2.source), reHasUnescapedHtml2 = RegExp(reUnescapedHtml2.source);
4768 var reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g;
4769 var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
4770 var reRegExpChar2 = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar2.source);
4771 var reTrimStart2 = /^\s+/;
4772 var reWhitespace2 = /\s/;
4773 var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /;
4774 var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
4775 var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
4776 var reEscapeChar = /\\(\\)?/g;
4777 var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
4778 var reFlags = /\w*$/;
4779 var reIsBadHex2 = /^[-+]0x[0-9a-f]+$/i;
4780 var reIsBinary2 = /^0b[01]+$/i;
4781 var reIsHostCtor2 = /^\[object .+?Constructor\]$/;
4782 var reIsOctal2 = /^0o[0-7]+$/i;
4783 var reIsUint2 = /^(?:0|[1-9]\d*)$/;
4784 var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
4785 var reNoMatch = /($^)/;
4786 var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
4787 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;
4788 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";
4789 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("|") + ")";
4790 var reApos = RegExp(rsApos, "g");
4791 var reComboMark = RegExp(rsCombo, "g");
4792 var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
4793 var reUnicodeWord = RegExp([
4794 rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
4795 rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
4796 rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
4797 rsUpper + "+" + rsOptContrUpper,
4803 var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
4804 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 ]/;
4805 var contextProps = [
4827 "Uint8ClampedArray",
4837 var templateCounter = -1;
4838 var typedArrayTags2 = {};
4839 typedArrayTags2[float32Tag2] = typedArrayTags2[float64Tag2] = typedArrayTags2[int8Tag2] = typedArrayTags2[int16Tag2] = typedArrayTags2[int32Tag2] = typedArrayTags2[uint8Tag2] = typedArrayTags2[uint8ClampedTag2] = typedArrayTags2[uint16Tag2] = typedArrayTags2[uint32Tag2] = true;
4840 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;
4841 var cloneableTags = {};
4842 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;
4843 cloneableTags[errorTag3] = cloneableTags[funcTag3] = cloneableTags[weakMapTag3] = false;
4844 var deburredLetters = {
4845 // Latin-1 Supplement block.
4908 // Latin Extended-A block.
5038 var htmlEscapes2 = {
5045 var htmlUnescapes2 = {
5052 var stringEscapes = {
5060 var freeParseFloat = parseFloat, freeParseInt2 = parseInt;
5061 var freeGlobal2 = typeof global == "object" && global && global.Object === Object && global;
5062 var freeSelf2 = typeof self == "object" && self && self.Object === Object && self;
5063 var root3 = freeGlobal2 || freeSelf2 || Function("return this")();
5064 var freeExports3 = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
5065 var freeModule3 = freeExports3 && typeof module2 == "object" && module2 && !module2.nodeType && module2;
5066 var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3;
5067 var freeProcess2 = moduleExports3 && freeGlobal2.process;
5068 var nodeUtil2 = function() {
5070 var types = freeModule3 && freeModule3.require && freeModule3.require("util").types;
5074 return freeProcess2 && freeProcess2.binding && freeProcess2.binding("util");
5078 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;
5079 function apply(func, thisArg, args) {
5080 switch (args.length) {
5082 return func.call(thisArg);
5084 return func.call(thisArg, args[0]);
5086 return func.call(thisArg, args[0], args[1]);
5088 return func.call(thisArg, args[0], args[1], args[2]);
5090 return func.apply(thisArg, args);
5092 function arrayAggregator(array2, setter, iteratee, accumulator) {
5093 var index = -1, length2 = array2 == null ? 0 : array2.length;
5094 while (++index < length2) {
5095 var value = array2[index];
5096 setter(accumulator, value, iteratee(value), array2);
5100 function arrayEach(array2, iteratee) {
5101 var index = -1, length2 = array2 == null ? 0 : array2.length;
5102 while (++index < length2) {
5103 if (iteratee(array2[index], index, array2) === false) {
5109 function arrayEachRight(array2, iteratee) {
5110 var length2 = array2 == null ? 0 : array2.length;
5112 if (iteratee(array2[length2], length2, array2) === false) {
5118 function arrayEvery(array2, predicate) {
5119 var index = -1, length2 = array2 == null ? 0 : array2.length;
5120 while (++index < length2) {
5121 if (!predicate(array2[index], index, array2)) {
5127 function arrayFilter2(array2, predicate) {
5128 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
5129 while (++index < length2) {
5130 var value = array2[index];
5131 if (predicate(value, index, array2)) {
5132 result[resIndex++] = value;
5137 function arrayIncludes(array2, value) {
5138 var length2 = array2 == null ? 0 : array2.length;
5139 return !!length2 && baseIndexOf(array2, value, 0) > -1;
5141 function arrayIncludesWith(array2, value, comparator) {
5142 var index = -1, length2 = array2 == null ? 0 : array2.length;
5143 while (++index < length2) {
5144 if (comparator(value, array2[index])) {
5150 function arrayMap2(array2, iteratee) {
5151 var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
5152 while (++index < length2) {
5153 result[index] = iteratee(array2[index], index, array2);
5157 function arrayPush2(array2, values) {
5158 var index = -1, length2 = values.length, offset = array2.length;
5159 while (++index < length2) {
5160 array2[offset + index] = values[index];
5164 function arrayReduce(array2, iteratee, accumulator, initAccum) {
5165 var index = -1, length2 = array2 == null ? 0 : array2.length;
5166 if (initAccum && length2) {
5167 accumulator = array2[++index];
5169 while (++index < length2) {
5170 accumulator = iteratee(accumulator, array2[index], index, array2);
5174 function arrayReduceRight(array2, iteratee, accumulator, initAccum) {
5175 var length2 = array2 == null ? 0 : array2.length;
5176 if (initAccum && length2) {
5177 accumulator = array2[--length2];
5180 accumulator = iteratee(accumulator, array2[length2], length2, array2);
5184 function arraySome2(array2, predicate) {
5185 var index = -1, length2 = array2 == null ? 0 : array2.length;
5186 while (++index < length2) {
5187 if (predicate(array2[index], index, array2)) {
5193 var asciiSize = baseProperty("length");
5194 function asciiToArray(string) {
5195 return string.split("");
5197 function asciiWords(string) {
5198 return string.match(reAsciiWord) || [];
5200 function baseFindKey(collection, predicate, eachFunc) {
5202 eachFunc(collection, function(value, key, collection2) {
5203 if (predicate(value, key, collection2)) {
5210 function baseFindIndex(array2, predicate, fromIndex, fromRight) {
5211 var length2 = array2.length, index = fromIndex + (fromRight ? 1 : -1);
5212 while (fromRight ? index-- : ++index < length2) {
5213 if (predicate(array2[index], index, array2)) {
5219 function baseIndexOf(array2, value, fromIndex) {
5220 return value === value ? strictIndexOf(array2, value, fromIndex) : baseFindIndex(array2, baseIsNaN, fromIndex);
5222 function baseIndexOfWith(array2, value, fromIndex, comparator) {
5223 var index = fromIndex - 1, length2 = array2.length;
5224 while (++index < length2) {
5225 if (comparator(array2[index], value)) {
5231 function baseIsNaN(value) {
5232 return value !== value;
5234 function baseMean(array2, iteratee) {
5235 var length2 = array2 == null ? 0 : array2.length;
5236 return length2 ? baseSum(array2, iteratee) / length2 : NAN2;
5238 function baseProperty(key) {
5239 return function(object) {
5240 return object == null ? undefined2 : object[key];
5243 function basePropertyOf2(object) {
5244 return function(key) {
5245 return object == null ? undefined2 : object[key];
5248 function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
5249 eachFunc(collection, function(value, index, collection2) {
5250 accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
5254 function baseSortBy(array2, comparer) {
5255 var length2 = array2.length;
5256 array2.sort(comparer);
5258 array2[length2] = array2[length2].value;
5262 function baseSum(array2, iteratee) {
5263 var result, index = -1, length2 = array2.length;
5264 while (++index < length2) {
5265 var current = iteratee(array2[index]);
5266 if (current !== undefined2) {
5267 result = result === undefined2 ? current : result + current;
5272 function baseTimes2(n3, iteratee) {
5273 var index = -1, result = Array(n3);
5274 while (++index < n3) {
5275 result[index] = iteratee(index);
5279 function baseToPairs(object, props) {
5280 return arrayMap2(props, function(key) {
5281 return [key, object[key]];
5284 function baseTrim2(string) {
5285 return string ? string.slice(0, trimmedEndIndex2(string) + 1).replace(reTrimStart2, "") : string;
5287 function baseUnary2(func) {
5288 return function(value) {
5292 function baseValues(object, props) {
5293 return arrayMap2(props, function(key) {
5297 function cacheHas2(cache, key) {
5298 return cache.has(key);
5300 function charsStartIndex(strSymbols, chrSymbols) {
5301 var index = -1, length2 = strSymbols.length;
5302 while (++index < length2 && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5306 function charsEndIndex(strSymbols, chrSymbols) {
5307 var index = strSymbols.length;
5308 while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
5312 function countHolders(array2, placeholder) {
5313 var length2 = array2.length, result = 0;
5315 if (array2[length2] === placeholder) {
5321 var deburrLetter = basePropertyOf2(deburredLetters);
5322 var escapeHtmlChar2 = basePropertyOf2(htmlEscapes2);
5323 function escapeStringChar(chr) {
5324 return "\\" + stringEscapes[chr];
5326 function getValue2(object, key) {
5327 return object == null ? undefined2 : object[key];
5329 function hasUnicode(string) {
5330 return reHasUnicode.test(string);
5332 function hasUnicodeWord(string) {
5333 return reHasUnicodeWord.test(string);
5335 function iteratorToArray(iterator) {
5336 var data, result = [];
5337 while (!(data = iterator.next()).done) {
5338 result.push(data.value);
5342 function mapToArray2(map2) {
5343 var index = -1, result = Array(map2.size);
5344 map2.forEach(function(value, key) {
5345 result[++index] = [key, value];
5349 function overArg2(func, transform2) {
5350 return function(arg) {
5351 return func(transform2(arg));
5354 function replaceHolders(array2, placeholder) {
5355 var index = -1, length2 = array2.length, resIndex = 0, result = [];
5356 while (++index < length2) {
5357 var value = array2[index];
5358 if (value === placeholder || value === PLACEHOLDER) {
5359 array2[index] = PLACEHOLDER;
5360 result[resIndex++] = index;
5365 function setToArray2(set4) {
5366 var index = -1, result = Array(set4.size);
5367 set4.forEach(function(value) {
5368 result[++index] = value;
5372 function setToPairs(set4) {
5373 var index = -1, result = Array(set4.size);
5374 set4.forEach(function(value) {
5375 result[++index] = [value, value];
5379 function strictIndexOf(array2, value, fromIndex) {
5380 var index = fromIndex - 1, length2 = array2.length;
5381 while (++index < length2) {
5382 if (array2[index] === value) {
5388 function strictLastIndexOf(array2, value, fromIndex) {
5389 var index = fromIndex + 1;
5391 if (array2[index] === value) {
5397 function stringSize(string) {
5398 return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
5400 function stringToArray(string) {
5401 return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
5403 function trimmedEndIndex2(string) {
5404 var index = string.length;
5405 while (index-- && reWhitespace2.test(string.charAt(index))) {
5409 var unescapeHtmlChar2 = basePropertyOf2(htmlUnescapes2);
5410 function unicodeSize(string) {
5411 var result = reUnicode.lastIndex = 0;
5412 while (reUnicode.test(string)) {
5417 function unicodeToArray(string) {
5418 return string.match(reUnicode) || [];
5420 function unicodeWords(string) {
5421 return string.match(reUnicodeWord) || [];
5423 var runInContext = function runInContext2(context) {
5424 context = context == null ? root3 : _2.defaults(root3.Object(), context, _2.pick(root3, contextProps));
5425 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;
5426 var arrayProto2 = Array2.prototype, funcProto3 = Function2.prototype, objectProto13 = Object2.prototype;
5427 var coreJsData2 = context["__core-js_shared__"];
5428 var funcToString3 = funcProto3.toString;
5429 var hasOwnProperty10 = objectProto13.hasOwnProperty;
5431 var maskSrcKey2 = function() {
5432 var uid = /[^.]+$/.exec(coreJsData2 && coreJsData2.keys && coreJsData2.keys.IE_PROTO || "");
5433 return uid ? "Symbol(src)_1." + uid : "";
5435 var nativeObjectToString3 = objectProto13.toString;
5436 var objectCtorString = funcToString3.call(Object2);
5437 var oldDash = root3._;
5438 var reIsNative2 = RegExp2(
5439 "^" + funcToString3.call(hasOwnProperty10).replace(reRegExpChar2, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5441 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;
5442 var defineProperty = function() {
5444 var func = getNative2(Object2, "defineProperty");
5450 var ctxClearTimeout = context.clearTimeout !== root3.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root3.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root3.setTimeout && context.setTimeout;
5451 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;
5452 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");
5453 var metaMap = WeakMap2 && new WeakMap2();
5455 var dataViewCtorString2 = toSource2(DataView3), mapCtorString2 = toSource2(Map3), promiseCtorString2 = toSource2(Promise3), setCtorString2 = toSource2(Set3), weakMapCtorString2 = toSource2(WeakMap2);
5456 var symbolProto3 = Symbol3 ? Symbol3.prototype : undefined2, symbolValueOf2 = symbolProto3 ? symbolProto3.valueOf : undefined2, symbolToString2 = symbolProto3 ? symbolProto3.toString : undefined2;
5457 function lodash(value) {
5458 if (isObjectLike2(value) && !isArray2(value) && !(value instanceof LazyWrapper)) {
5459 if (value instanceof LodashWrapper) {
5462 if (hasOwnProperty10.call(value, "__wrapped__")) {
5463 return wrapperClone(value);
5466 return new LodashWrapper(value);
5468 var baseCreate = /* @__PURE__ */ function() {
5471 return function(proto) {
5472 if (!isObject2(proto)) {
5476 return objectCreate(proto);
5478 object.prototype = proto;
5479 var result2 = new object();
5480 object.prototype = undefined2;
5484 function baseLodash() {
5486 function LodashWrapper(value, chainAll) {
5487 this.__wrapped__ = value;
5488 this.__actions__ = [];
5489 this.__chain__ = !!chainAll;
5491 this.__values__ = undefined2;
5493 lodash.templateSettings = {
5495 * Used to detect `data` property values to be HTML-escaped.
5497 * @memberOf _.templateSettings
5502 * Used to detect code to be evaluated.
5504 * @memberOf _.templateSettings
5507 "evaluate": reEvaluate,
5509 * Used to detect `data` property values to inject.
5511 * @memberOf _.templateSettings
5514 "interpolate": reInterpolate,
5516 * Used to reference the data object in the template text.
5518 * @memberOf _.templateSettings
5523 * Used to import variables into the compiled template.
5525 * @memberOf _.templateSettings
5530 * A reference to the `lodash` function.
5532 * @memberOf _.templateSettings.imports
5538 lodash.prototype = baseLodash.prototype;
5539 lodash.prototype.constructor = lodash;
5540 LodashWrapper.prototype = baseCreate(baseLodash.prototype);
5541 LodashWrapper.prototype.constructor = LodashWrapper;
5542 function LazyWrapper(value) {
5543 this.__wrapped__ = value;
5544 this.__actions__ = [];
5546 this.__filtered__ = false;
5547 this.__iteratees__ = [];
5548 this.__takeCount__ = MAX_ARRAY_LENGTH;
5549 this.__views__ = [];
5551 function lazyClone() {
5552 var result2 = new LazyWrapper(this.__wrapped__);
5553 result2.__actions__ = copyArray(this.__actions__);
5554 result2.__dir__ = this.__dir__;
5555 result2.__filtered__ = this.__filtered__;
5556 result2.__iteratees__ = copyArray(this.__iteratees__);
5557 result2.__takeCount__ = this.__takeCount__;
5558 result2.__views__ = copyArray(this.__views__);
5561 function lazyReverse() {
5562 if (this.__filtered__) {
5563 var result2 = new LazyWrapper(this);
5564 result2.__dir__ = -1;
5565 result2.__filtered__ = true;
5567 result2 = this.clone();
5568 result2.__dir__ *= -1;
5572 function lazyValue() {
5573 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__);
5574 if (!isArr || !isRight && arrLength == length2 && takeCount == length2) {
5575 return baseWrapperValue(array2, this.__actions__);
5579 while (length2-- && resIndex < takeCount) {
5581 var iterIndex = -1, value = array2[index];
5582 while (++iterIndex < iterLength) {
5583 var data = iteratees[iterIndex], iteratee2 = data.iteratee, type2 = data.type, computed = iteratee2(value);
5584 if (type2 == LAZY_MAP_FLAG) {
5586 } else if (!computed) {
5587 if (type2 == LAZY_FILTER_FLAG) {
5594 result2[resIndex++] = value;
5598 LazyWrapper.prototype = baseCreate(baseLodash.prototype);
5599 LazyWrapper.prototype.constructor = LazyWrapper;
5600 function Hash2(entries) {
5601 var index = -1, length2 = entries == null ? 0 : entries.length;
5603 while (++index < length2) {
5604 var entry = entries[index];
5605 this.set(entry[0], entry[1]);
5608 function hashClear2() {
5609 this.__data__ = nativeCreate2 ? nativeCreate2(null) : {};
5612 function hashDelete2(key) {
5613 var result2 = this.has(key) && delete this.__data__[key];
5614 this.size -= result2 ? 1 : 0;
5617 function hashGet2(key) {
5618 var data = this.__data__;
5619 if (nativeCreate2) {
5620 var result2 = data[key];
5621 return result2 === HASH_UNDEFINED4 ? undefined2 : result2;
5623 return hasOwnProperty10.call(data, key) ? data[key] : undefined2;
5625 function hashHas2(key) {
5626 var data = this.__data__;
5627 return nativeCreate2 ? data[key] !== undefined2 : hasOwnProperty10.call(data, key);
5629 function hashSet2(key, value) {
5630 var data = this.__data__;
5631 this.size += this.has(key) ? 0 : 1;
5632 data[key] = nativeCreate2 && value === undefined2 ? HASH_UNDEFINED4 : value;
5635 Hash2.prototype.clear = hashClear2;
5636 Hash2.prototype["delete"] = hashDelete2;
5637 Hash2.prototype.get = hashGet2;
5638 Hash2.prototype.has = hashHas2;
5639 Hash2.prototype.set = hashSet2;
5640 function ListCache2(entries) {
5641 var index = -1, length2 = entries == null ? 0 : entries.length;
5643 while (++index < length2) {
5644 var entry = entries[index];
5645 this.set(entry[0], entry[1]);
5648 function listCacheClear2() {
5652 function listCacheDelete2(key) {
5653 var data = this.__data__, index = assocIndexOf2(data, key);
5657 var lastIndex = data.length - 1;
5658 if (index == lastIndex) {
5661 splice2.call(data, index, 1);
5666 function listCacheGet2(key) {
5667 var data = this.__data__, index = assocIndexOf2(data, key);
5668 return index < 0 ? undefined2 : data[index][1];
5670 function listCacheHas2(key) {
5671 return assocIndexOf2(this.__data__, key) > -1;
5673 function listCacheSet2(key, value) {
5674 var data = this.__data__, index = assocIndexOf2(data, key);
5677 data.push([key, value]);
5679 data[index][1] = value;
5683 ListCache2.prototype.clear = listCacheClear2;
5684 ListCache2.prototype["delete"] = listCacheDelete2;
5685 ListCache2.prototype.get = listCacheGet2;
5686 ListCache2.prototype.has = listCacheHas2;
5687 ListCache2.prototype.set = listCacheSet2;
5688 function MapCache2(entries) {
5689 var index = -1, length2 = entries == null ? 0 : entries.length;
5691 while (++index < length2) {
5692 var entry = entries[index];
5693 this.set(entry[0], entry[1]);
5696 function mapCacheClear2() {
5699 "hash": new Hash2(),
5700 "map": new (Map3 || ListCache2)(),
5701 "string": new Hash2()
5704 function mapCacheDelete2(key) {
5705 var result2 = getMapData2(this, key)["delete"](key);
5706 this.size -= result2 ? 1 : 0;
5709 function mapCacheGet2(key) {
5710 return getMapData2(this, key).get(key);
5712 function mapCacheHas2(key) {
5713 return getMapData2(this, key).has(key);
5715 function mapCacheSet2(key, value) {
5716 var data = getMapData2(this, key), size2 = data.size;
5717 data.set(key, value);
5718 this.size += data.size == size2 ? 0 : 1;
5721 MapCache2.prototype.clear = mapCacheClear2;
5722 MapCache2.prototype["delete"] = mapCacheDelete2;
5723 MapCache2.prototype.get = mapCacheGet2;
5724 MapCache2.prototype.has = mapCacheHas2;
5725 MapCache2.prototype.set = mapCacheSet2;
5726 function SetCache2(values2) {
5727 var index = -1, length2 = values2 == null ? 0 : values2.length;
5728 this.__data__ = new MapCache2();
5729 while (++index < length2) {
5730 this.add(values2[index]);
5733 function setCacheAdd2(value) {
5734 this.__data__.set(value, HASH_UNDEFINED4);
5737 function setCacheHas2(value) {
5738 return this.__data__.has(value);
5740 SetCache2.prototype.add = SetCache2.prototype.push = setCacheAdd2;
5741 SetCache2.prototype.has = setCacheHas2;
5742 function Stack2(entries) {
5743 var data = this.__data__ = new ListCache2(entries);
5744 this.size = data.size;
5746 function stackClear2() {
5747 this.__data__ = new ListCache2();
5750 function stackDelete2(key) {
5751 var data = this.__data__, result2 = data["delete"](key);
5752 this.size = data.size;
5755 function stackGet2(key) {
5756 return this.__data__.get(key);
5758 function stackHas2(key) {
5759 return this.__data__.has(key);
5761 function stackSet2(key, value) {
5762 var data = this.__data__;
5763 if (data instanceof ListCache2) {
5764 var pairs2 = data.__data__;
5765 if (!Map3 || pairs2.length < LARGE_ARRAY_SIZE2 - 1) {
5766 pairs2.push([key, value]);
5767 this.size = ++data.size;
5770 data = this.__data__ = new MapCache2(pairs2);
5772 data.set(key, value);
5773 this.size = data.size;
5776 Stack2.prototype.clear = stackClear2;
5777 Stack2.prototype["delete"] = stackDelete2;
5778 Stack2.prototype.get = stackGet2;
5779 Stack2.prototype.has = stackHas2;
5780 Stack2.prototype.set = stackSet2;
5781 function arrayLikeKeys2(value, inherited) {
5782 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;
5783 for (var key in value) {
5784 if ((inherited || hasOwnProperty10.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
5785 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
5786 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
5787 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
5788 isIndex2(key, length2)))) {
5794 function arraySample(array2) {
5795 var length2 = array2.length;
5796 return length2 ? array2[baseRandom(0, length2 - 1)] : undefined2;
5798 function arraySampleSize(array2, n3) {
5799 return shuffleSelf(copyArray(array2), baseClamp(n3, 0, array2.length));
5801 function arrayShuffle(array2) {
5802 return shuffleSelf(copyArray(array2));
5804 function assignMergeValue(object, key, value) {
5805 if (value !== undefined2 && !eq2(object[key], value) || value === undefined2 && !(key in object)) {
5806 baseAssignValue(object, key, value);
5809 function assignValue(object, key, value) {
5810 var objValue = object[key];
5811 if (!(hasOwnProperty10.call(object, key) && eq2(objValue, value)) || value === undefined2 && !(key in object)) {
5812 baseAssignValue(object, key, value);
5815 function assocIndexOf2(array2, key) {
5816 var length2 = array2.length;
5818 if (eq2(array2[length2][0], key)) {
5824 function baseAggregator(collection, setter, iteratee2, accumulator) {
5825 baseEach(collection, function(value, key, collection2) {
5826 setter(accumulator, value, iteratee2(value), collection2);
5830 function baseAssign(object, source) {
5831 return object && copyObject(source, keys2(source), object);
5833 function baseAssignIn(object, source) {
5834 return object && copyObject(source, keysIn(source), object);
5836 function baseAssignValue(object, key, value) {
5837 if (key == "__proto__" && defineProperty) {
5838 defineProperty(object, key, {
5839 "configurable": true,
5845 object[key] = value;
5848 function baseAt(object, paths) {
5849 var index = -1, length2 = paths.length, result2 = Array2(length2), skip = object == null;
5850 while (++index < length2) {
5851 result2[index] = skip ? undefined2 : get4(object, paths[index]);
5855 function baseClamp(number3, lower2, upper) {
5856 if (number3 === number3) {
5857 if (upper !== undefined2) {
5858 number3 = number3 <= upper ? number3 : upper;
5860 if (lower2 !== undefined2) {
5861 number3 = number3 >= lower2 ? number3 : lower2;
5866 function baseClone(value, bitmask, customizer, key, object, stack) {
5867 var result2, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
5869 result2 = object ? customizer(value, key, object, stack) : customizer(value);
5871 if (result2 !== undefined2) {
5874 if (!isObject2(value)) {
5877 var isArr = isArray2(value);
5879 result2 = initCloneArray(value);
5881 return copyArray(value, result2);
5884 var tag2 = getTag2(value), isFunc = tag2 == funcTag3 || tag2 == genTag2;
5885 if (isBuffer2(value)) {
5886 return cloneBuffer(value, isDeep);
5888 if (tag2 == objectTag4 || tag2 == argsTag4 || isFunc && !object) {
5889 result2 = isFlat || isFunc ? {} : initCloneObject(value);
5891 return isFlat ? copySymbolsIn(value, baseAssignIn(result2, value)) : copySymbols(value, baseAssign(result2, value));
5894 if (!cloneableTags[tag2]) {
5895 return object ? value : {};
5897 result2 = initCloneByTag(value, tag2, isDeep);
5900 stack || (stack = new Stack2());
5901 var stacked = stack.get(value);
5905 stack.set(value, result2);
5907 value.forEach(function(subValue) {
5908 result2.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
5910 } else if (isMap(value)) {
5911 value.forEach(function(subValue, key2) {
5912 result2.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5915 var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys2 : isFlat ? keysIn : keys2;
5916 var props = isArr ? undefined2 : keysFunc(value);
5917 arrayEach(props || value, function(subValue, key2) {
5920 subValue = value[key2];
5922 assignValue(result2, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
5926 function baseConforms(source) {
5927 var props = keys2(source);
5928 return function(object) {
5929 return baseConformsTo(object, source, props);
5932 function baseConformsTo(object, source, props) {
5933 var length2 = props.length;
5934 if (object == null) {
5937 object = Object2(object);
5939 var key = props[length2], predicate = source[key], value = object[key];
5940 if (value === undefined2 && !(key in object) || !predicate(value)) {
5946 function baseDelay(func, wait, args) {
5947 if (typeof func != "function") {
5948 throw new TypeError2(FUNC_ERROR_TEXT3);
5950 return setTimeout2(function() {
5951 func.apply(undefined2, args);
5954 function baseDifference(array2, values2, iteratee2, comparator) {
5955 var index = -1, includes2 = arrayIncludes, isCommon = true, length2 = array2.length, result2 = [], valuesLength = values2.length;
5960 values2 = arrayMap2(values2, baseUnary2(iteratee2));
5963 includes2 = arrayIncludesWith;
5965 } else if (values2.length >= LARGE_ARRAY_SIZE2) {
5966 includes2 = cacheHas2;
5968 values2 = new SetCache2(values2);
5971 while (++index < length2) {
5972 var value = array2[index], computed = iteratee2 == null ? value : iteratee2(value);
5973 value = comparator || value !== 0 ? value : 0;
5974 if (isCommon && computed === computed) {
5975 var valuesIndex = valuesLength;
5976 while (valuesIndex--) {
5977 if (values2[valuesIndex] === computed) {
5981 result2.push(value);
5982 } else if (!includes2(values2, computed, comparator)) {
5983 result2.push(value);
5988 var baseEach = createBaseEach(baseForOwn);
5989 var baseEachRight = createBaseEach(baseForOwnRight, true);
5990 function baseEvery(collection, predicate) {
5992 baseEach(collection, function(value, index, collection2) {
5993 result2 = !!predicate(value, index, collection2);
5998 function baseExtremum(array2, iteratee2, comparator) {
5999 var index = -1, length2 = array2.length;
6000 while (++index < length2) {
6001 var value = array2[index], current = iteratee2(value);
6002 if (current != null && (computed === undefined2 ? current === current && !isSymbol2(current) : comparator(current, computed))) {
6003 var computed = current, result2 = value;
6008 function baseFill(array2, value, start2, end) {
6009 var length2 = array2.length;
6010 start2 = toInteger(start2);
6012 start2 = -start2 > length2 ? 0 : length2 + start2;
6014 end = end === undefined2 || end > length2 ? length2 : toInteger(end);
6018 end = start2 > end ? 0 : toLength(end);
6019 while (start2 < end) {
6020 array2[start2++] = value;
6024 function baseFilter(collection, predicate) {
6026 baseEach(collection, function(value, index, collection2) {
6027 if (predicate(value, index, collection2)) {
6028 result2.push(value);
6033 function baseFlatten(array2, depth, predicate, isStrict, result2) {
6034 var index = -1, length2 = array2.length;
6035 predicate || (predicate = isFlattenable);
6036 result2 || (result2 = []);
6037 while (++index < length2) {
6038 var value = array2[index];
6039 if (depth > 0 && predicate(value)) {
6041 baseFlatten(value, depth - 1, predicate, isStrict, result2);
6043 arrayPush2(result2, value);
6045 } else if (!isStrict) {
6046 result2[result2.length] = value;
6051 var baseFor = createBaseFor();
6052 var baseForRight = createBaseFor(true);
6053 function baseForOwn(object, iteratee2) {
6054 return object && baseFor(object, iteratee2, keys2);
6056 function baseForOwnRight(object, iteratee2) {
6057 return object && baseForRight(object, iteratee2, keys2);
6059 function baseFunctions(object, props) {
6060 return arrayFilter2(props, function(key) {
6061 return isFunction2(object[key]);
6064 function baseGet(object, path) {
6065 path = castPath(path, object);
6066 var index = 0, length2 = path.length;
6067 while (object != null && index < length2) {
6068 object = object[toKey(path[index++])];
6070 return index && index == length2 ? object : undefined2;
6072 function baseGetAllKeys2(object, keysFunc, symbolsFunc) {
6073 var result2 = keysFunc(object);
6074 return isArray2(object) ? result2 : arrayPush2(result2, symbolsFunc(object));
6076 function baseGetTag2(value) {
6077 if (value == null) {
6078 return value === undefined2 ? undefinedTag2 : nullTag2;
6080 return symToStringTag3 && symToStringTag3 in Object2(value) ? getRawTag2(value) : objectToString2(value);
6082 function baseGt(value, other) {
6083 return value > other;
6085 function baseHas(object, key) {
6086 return object != null && hasOwnProperty10.call(object, key);
6088 function baseHasIn(object, key) {
6089 return object != null && key in Object2(object);
6091 function baseInRange(number3, start2, end) {
6092 return number3 >= nativeMin2(start2, end) && number3 < nativeMax2(start2, end);
6094 function baseIntersection(arrays, iteratee2, comparator) {
6095 var includes2 = comparator ? arrayIncludesWith : arrayIncludes, length2 = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array2(othLength), maxLength = Infinity, result2 = [];
6096 while (othIndex--) {
6097 var array2 = arrays[othIndex];
6098 if (othIndex && iteratee2) {
6099 array2 = arrayMap2(array2, baseUnary2(iteratee2));
6101 maxLength = nativeMin2(array2.length, maxLength);
6102 caches[othIndex] = !comparator && (iteratee2 || length2 >= 120 && array2.length >= 120) ? new SetCache2(othIndex && array2) : undefined2;
6105 var index = -1, seen = caches[0];
6107 while (++index < length2 && result2.length < maxLength) {
6108 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6109 value = comparator || value !== 0 ? value : 0;
6110 if (!(seen ? cacheHas2(seen, computed) : includes2(result2, computed, comparator))) {
6111 othIndex = othLength;
6112 while (--othIndex) {
6113 var cache = caches[othIndex];
6114 if (!(cache ? cacheHas2(cache, computed) : includes2(arrays[othIndex], computed, comparator))) {
6119 seen.push(computed);
6121 result2.push(value);
6126 function baseInverter(object, setter, iteratee2, accumulator) {
6127 baseForOwn(object, function(value, key, object2) {
6128 setter(accumulator, iteratee2(value), key, object2);
6132 function baseInvoke(object, path, args) {
6133 path = castPath(path, object);
6134 object = parent(object, path);
6135 var func = object == null ? object : object[toKey(last(path))];
6136 return func == null ? undefined2 : apply(func, object, args);
6138 function baseIsArguments2(value) {
6139 return isObjectLike2(value) && baseGetTag2(value) == argsTag4;
6141 function baseIsArrayBuffer(value) {
6142 return isObjectLike2(value) && baseGetTag2(value) == arrayBufferTag3;
6144 function baseIsDate(value) {
6145 return isObjectLike2(value) && baseGetTag2(value) == dateTag3;
6147 function baseIsEqual2(value, other, bitmask, customizer, stack) {
6148 if (value === other) {
6151 if (value == null || other == null || !isObjectLike2(value) && !isObjectLike2(other)) {
6152 return value !== value && other !== other;
6154 return baseIsEqualDeep2(value, other, bitmask, customizer, baseIsEqual2, stack);
6156 function baseIsEqualDeep2(object, other, bitmask, customizer, equalFunc, stack) {
6157 var objIsArr = isArray2(object), othIsArr = isArray2(other), objTag = objIsArr ? arrayTag3 : getTag2(object), othTag = othIsArr ? arrayTag3 : getTag2(other);
6158 objTag = objTag == argsTag4 ? objectTag4 : objTag;
6159 othTag = othTag == argsTag4 ? objectTag4 : othTag;
6160 var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag;
6161 if (isSameTag && isBuffer2(object)) {
6162 if (!isBuffer2(other)) {
6168 if (isSameTag && !objIsObj) {
6169 stack || (stack = new Stack2());
6170 return objIsArr || isTypedArray2(object) ? equalArrays2(object, other, bitmask, customizer, equalFunc, stack) : equalByTag2(object, other, objTag, bitmask, customizer, equalFunc, stack);
6172 if (!(bitmask & COMPARE_PARTIAL_FLAG5)) {
6173 var objIsWrapped = objIsObj && hasOwnProperty10.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty10.call(other, "__wrapped__");
6174 if (objIsWrapped || othIsWrapped) {
6175 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
6176 stack || (stack = new Stack2());
6177 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
6183 stack || (stack = new Stack2());
6184 return equalObjects2(object, other, bitmask, customizer, equalFunc, stack);
6186 function baseIsMap(value) {
6187 return isObjectLike2(value) && getTag2(value) == mapTag4;
6189 function baseIsMatch(object, source, matchData, customizer) {
6190 var index = matchData.length, length2 = index, noCustomizer = !customizer;
6191 if (object == null) {
6194 object = Object2(object);
6196 var data = matchData[index];
6197 if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
6201 while (++index < length2) {
6202 data = matchData[index];
6203 var key = data[0], objValue = object[key], srcValue = data[1];
6204 if (noCustomizer && data[2]) {
6205 if (objValue === undefined2 && !(key in object)) {
6209 var stack = new Stack2();
6211 var result2 = customizer(objValue, srcValue, key, object, source, stack);
6213 if (!(result2 === undefined2 ? baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3, customizer, stack) : result2)) {
6220 function baseIsNative2(value) {
6221 if (!isObject2(value) || isMasked2(value)) {
6224 var pattern = isFunction2(value) ? reIsNative2 : reIsHostCtor2;
6225 return pattern.test(toSource2(value));
6227 function baseIsRegExp(value) {
6228 return isObjectLike2(value) && baseGetTag2(value) == regexpTag3;
6230 function baseIsSet(value) {
6231 return isObjectLike2(value) && getTag2(value) == setTag4;
6233 function baseIsTypedArray2(value) {
6234 return isObjectLike2(value) && isLength2(value.length) && !!typedArrayTags2[baseGetTag2(value)];
6236 function baseIteratee(value) {
6237 if (typeof value == "function") {
6240 if (value == null) {
6243 if (typeof value == "object") {
6244 return isArray2(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
6246 return property(value);
6248 function baseKeys2(object) {
6249 if (!isPrototype2(object)) {
6250 return nativeKeys2(object);
6253 for (var key in Object2(object)) {
6254 if (hasOwnProperty10.call(object, key) && key != "constructor") {
6260 function baseKeysIn(object) {
6261 if (!isObject2(object)) {
6262 return nativeKeysIn(object);
6264 var isProto = isPrototype2(object), result2 = [];
6265 for (var key in object) {
6266 if (!(key == "constructor" && (isProto || !hasOwnProperty10.call(object, key)))) {
6272 function baseLt(value, other) {
6273 return value < other;
6275 function baseMap(collection, iteratee2) {
6276 var index = -1, result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
6277 baseEach(collection, function(value, key, collection2) {
6278 result2[++index] = iteratee2(value, key, collection2);
6282 function baseMatches(source) {
6283 var matchData = getMatchData(source);
6284 if (matchData.length == 1 && matchData[0][2]) {
6285 return matchesStrictComparable(matchData[0][0], matchData[0][1]);
6287 return function(object) {
6288 return object === source || baseIsMatch(object, source, matchData);
6291 function baseMatchesProperty(path, srcValue) {
6292 if (isKey(path) && isStrictComparable(srcValue)) {
6293 return matchesStrictComparable(toKey(path), srcValue);
6295 return function(object) {
6296 var objValue = get4(object, path);
6297 return objValue === undefined2 && objValue === srcValue ? hasIn(object, path) : baseIsEqual2(srcValue, objValue, COMPARE_PARTIAL_FLAG5 | COMPARE_UNORDERED_FLAG3);
6300 function baseMerge(object, source, srcIndex, customizer, stack) {
6301 if (object === source) {
6304 baseFor(source, function(srcValue, key) {
6305 stack || (stack = new Stack2());
6306 if (isObject2(srcValue)) {
6307 baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
6309 var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined2;
6310 if (newValue === undefined2) {
6311 newValue = srcValue;
6313 assignMergeValue(object, key, newValue);
6317 function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
6318 var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
6320 assignMergeValue(object, key, stacked);
6323 var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined2;
6324 var isCommon = newValue === undefined2;
6326 var isArr = isArray2(srcValue), isBuff = !isArr && isBuffer2(srcValue), isTyped = !isArr && !isBuff && isTypedArray2(srcValue);
6327 newValue = srcValue;
6328 if (isArr || isBuff || isTyped) {
6329 if (isArray2(objValue)) {
6330 newValue = objValue;
6331 } else if (isArrayLikeObject(objValue)) {
6332 newValue = copyArray(objValue);
6333 } else if (isBuff) {
6335 newValue = cloneBuffer(srcValue, true);
6336 } else if (isTyped) {
6338 newValue = cloneTypedArray(srcValue, true);
6342 } else if (isPlainObject(srcValue) || isArguments2(srcValue)) {
6343 newValue = objValue;
6344 if (isArguments2(objValue)) {
6345 newValue = toPlainObject(objValue);
6346 } else if (!isObject2(objValue) || isFunction2(objValue)) {
6347 newValue = initCloneObject(srcValue);
6354 stack.set(srcValue, newValue);
6355 mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
6356 stack["delete"](srcValue);
6358 assignMergeValue(object, key, newValue);
6360 function baseNth(array2, n3) {
6361 var length2 = array2.length;
6365 n3 += n3 < 0 ? length2 : 0;
6366 return isIndex2(n3, length2) ? array2[n3] : undefined2;
6368 function baseOrderBy(collection, iteratees, orders) {
6369 if (iteratees.length) {
6370 iteratees = arrayMap2(iteratees, function(iteratee2) {
6371 if (isArray2(iteratee2)) {
6372 return function(value) {
6373 return baseGet(value, iteratee2.length === 1 ? iteratee2[0] : iteratee2);
6379 iteratees = [identity4];
6382 iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
6383 var result2 = baseMap(collection, function(value, key, collection2) {
6384 var criteria = arrayMap2(iteratees, function(iteratee2) {
6385 return iteratee2(value);
6387 return { "criteria": criteria, "index": ++index, "value": value };
6389 return baseSortBy(result2, function(object, other) {
6390 return compareMultiple(object, other, orders);
6393 function basePick(object, paths) {
6394 return basePickBy(object, paths, function(value, path) {
6395 return hasIn(object, path);
6398 function basePickBy(object, paths, predicate) {
6399 var index = -1, length2 = paths.length, result2 = {};
6400 while (++index < length2) {
6401 var path = paths[index], value = baseGet(object, path);
6402 if (predicate(value, path)) {
6403 baseSet(result2, castPath(path, object), value);
6408 function basePropertyDeep(path) {
6409 return function(object) {
6410 return baseGet(object, path);
6413 function basePullAll(array2, values2, iteratee2, comparator) {
6414 var indexOf2 = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length2 = values2.length, seen = array2;
6415 if (array2 === values2) {
6416 values2 = copyArray(values2);
6419 seen = arrayMap2(array2, baseUnary2(iteratee2));
6421 while (++index < length2) {
6422 var fromIndex = 0, value = values2[index], computed = iteratee2 ? iteratee2(value) : value;
6423 while ((fromIndex = indexOf2(seen, computed, fromIndex, comparator)) > -1) {
6424 if (seen !== array2) {
6425 splice2.call(seen, fromIndex, 1);
6427 splice2.call(array2, fromIndex, 1);
6432 function basePullAt(array2, indexes) {
6433 var length2 = array2 ? indexes.length : 0, lastIndex = length2 - 1;
6435 var index = indexes[length2];
6436 if (length2 == lastIndex || index !== previous) {
6437 var previous = index;
6438 if (isIndex2(index)) {
6439 splice2.call(array2, index, 1);
6441 baseUnset(array2, index);
6447 function baseRandom(lower2, upper) {
6448 return lower2 + nativeFloor(nativeRandom() * (upper - lower2 + 1));
6450 function baseRange(start2, end, step, fromRight) {
6451 var index = -1, length2 = nativeMax2(nativeCeil((end - start2) / (step || 1)), 0), result2 = Array2(length2);
6453 result2[fromRight ? length2 : ++index] = start2;
6458 function baseRepeat(string, n3) {
6460 if (!string || n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
6467 n3 = nativeFloor(n3 / 2);
6474 function baseRest(func, start2) {
6475 return setToString(overRest(func, start2, identity4), func + "");
6477 function baseSample(collection) {
6478 return arraySample(values(collection));
6480 function baseSampleSize(collection, n3) {
6481 var array2 = values(collection);
6482 return shuffleSelf(array2, baseClamp(n3, 0, array2.length));
6484 function baseSet(object, path, value, customizer) {
6485 if (!isObject2(object)) {
6488 path = castPath(path, object);
6489 var index = -1, length2 = path.length, lastIndex = length2 - 1, nested = object;
6490 while (nested != null && ++index < length2) {
6491 var key = toKey(path[index]), newValue = value;
6492 if (key === "__proto__" || key === "constructor" || key === "prototype") {
6495 if (index != lastIndex) {
6496 var objValue = nested[key];
6497 newValue = customizer ? customizer(objValue, key, nested) : undefined2;
6498 if (newValue === undefined2) {
6499 newValue = isObject2(objValue) ? objValue : isIndex2(path[index + 1]) ? [] : {};
6502 assignValue(nested, key, newValue);
6503 nested = nested[key];
6507 var baseSetData = !metaMap ? identity4 : function(func, data) {
6508 metaMap.set(func, data);
6511 var baseSetToString = !defineProperty ? identity4 : function(func, string) {
6512 return defineProperty(func, "toString", {
6513 "configurable": true,
6514 "enumerable": false,
6515 "value": constant(string),
6519 function baseShuffle(collection) {
6520 return shuffleSelf(values(collection));
6522 function baseSlice(array2, start2, end) {
6523 var index = -1, length2 = array2.length;
6525 start2 = -start2 > length2 ? 0 : length2 + start2;
6527 end = end > length2 ? length2 : end;
6531 length2 = start2 > end ? 0 : end - start2 >>> 0;
6533 var result2 = Array2(length2);
6534 while (++index < length2) {
6535 result2[index] = array2[index + start2];
6539 function baseSome(collection, predicate) {
6541 baseEach(collection, function(value, index, collection2) {
6542 result2 = predicate(value, index, collection2);
6547 function baseSortedIndex(array2, value, retHighest) {
6548 var low = 0, high = array2 == null ? low : array2.length;
6549 if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
6550 while (low < high) {
6551 var mid = low + high >>> 1, computed = array2[mid];
6552 if (computed !== null && !isSymbol2(computed) && (retHighest ? computed <= value : computed < value)) {
6560 return baseSortedIndexBy(array2, value, identity4, retHighest);
6562 function baseSortedIndexBy(array2, value, iteratee2, retHighest) {
6563 var low = 0, high = array2 == null ? 0 : array2.length;
6567 value = iteratee2(value);
6568 var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol2(value), valIsUndefined = value === undefined2;
6569 while (low < high) {
6570 var mid = nativeFloor((low + high) / 2), computed = iteratee2(array2[mid]), othIsDefined = computed !== undefined2, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol2(computed);
6572 var setLow = retHighest || othIsReflexive;
6573 } else if (valIsUndefined) {
6574 setLow = othIsReflexive && (retHighest || othIsDefined);
6575 } else if (valIsNull) {
6576 setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
6577 } else if (valIsSymbol) {
6578 setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
6579 } else if (othIsNull || othIsSymbol) {
6582 setLow = retHighest ? computed <= value : computed < value;
6590 return nativeMin2(high, MAX_ARRAY_INDEX);
6592 function baseSortedUniq(array2, iteratee2) {
6593 var index = -1, length2 = array2.length, resIndex = 0, result2 = [];
6594 while (++index < length2) {
6595 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6596 if (!index || !eq2(computed, seen)) {
6597 var seen = computed;
6598 result2[resIndex++] = value === 0 ? 0 : value;
6603 function baseToNumber(value) {
6604 if (typeof value == "number") {
6607 if (isSymbol2(value)) {
6612 function baseToString2(value) {
6613 if (typeof value == "string") {
6616 if (isArray2(value)) {
6617 return arrayMap2(value, baseToString2) + "";
6619 if (isSymbol2(value)) {
6620 return symbolToString2 ? symbolToString2.call(value) : "";
6622 var result2 = value + "";
6623 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
6625 function baseUniq(array2, iteratee2, comparator) {
6626 var index = -1, includes2 = arrayIncludes, length2 = array2.length, isCommon = true, result2 = [], seen = result2;
6629 includes2 = arrayIncludesWith;
6630 } else if (length2 >= LARGE_ARRAY_SIZE2) {
6631 var set5 = iteratee2 ? null : createSet(array2);
6633 return setToArray2(set5);
6636 includes2 = cacheHas2;
6637 seen = new SetCache2();
6639 seen = iteratee2 ? [] : result2;
6642 while (++index < length2) {
6643 var value = array2[index], computed = iteratee2 ? iteratee2(value) : value;
6644 value = comparator || value !== 0 ? value : 0;
6645 if (isCommon && computed === computed) {
6646 var seenIndex = seen.length;
6647 while (seenIndex--) {
6648 if (seen[seenIndex] === computed) {
6653 seen.push(computed);
6655 result2.push(value);
6656 } else if (!includes2(seen, computed, comparator)) {
6657 if (seen !== result2) {
6658 seen.push(computed);
6660 result2.push(value);
6665 function baseUnset(object, path) {
6666 path = castPath(path, object);
6667 object = parent(object, path);
6668 return object == null || delete object[toKey(last(path))];
6670 function baseUpdate(object, path, updater, customizer) {
6671 return baseSet(object, path, updater(baseGet(object, path)), customizer);
6673 function baseWhile(array2, predicate, isDrop, fromRight) {
6674 var length2 = array2.length, index = fromRight ? length2 : -1;
6675 while ((fromRight ? index-- : ++index < length2) && predicate(array2[index], index, array2)) {
6677 return isDrop ? baseSlice(array2, fromRight ? 0 : index, fromRight ? index + 1 : length2) : baseSlice(array2, fromRight ? index + 1 : 0, fromRight ? length2 : index);
6679 function baseWrapperValue(value, actions) {
6680 var result2 = value;
6681 if (result2 instanceof LazyWrapper) {
6682 result2 = result2.value();
6684 return arrayReduce(actions, function(result3, action) {
6685 return action.func.apply(action.thisArg, arrayPush2([result3], action.args));
6688 function baseXor(arrays, iteratee2, comparator) {
6689 var length2 = arrays.length;
6691 return length2 ? baseUniq(arrays[0]) : [];
6693 var index = -1, result2 = Array2(length2);
6694 while (++index < length2) {
6695 var array2 = arrays[index], othIndex = -1;
6696 while (++othIndex < length2) {
6697 if (othIndex != index) {
6698 result2[index] = baseDifference(result2[index] || array2, arrays[othIndex], iteratee2, comparator);
6702 return baseUniq(baseFlatten(result2, 1), iteratee2, comparator);
6704 function baseZipObject(props, values2, assignFunc) {
6705 var index = -1, length2 = props.length, valsLength = values2.length, result2 = {};
6706 while (++index < length2) {
6707 var value = index < valsLength ? values2[index] : undefined2;
6708 assignFunc(result2, props[index], value);
6712 function castArrayLikeObject(value) {
6713 return isArrayLikeObject(value) ? value : [];
6715 function castFunction(value) {
6716 return typeof value == "function" ? value : identity4;
6718 function castPath(value, object) {
6719 if (isArray2(value)) {
6722 return isKey(value, object) ? [value] : stringToPath(toString2(value));
6724 var castRest = baseRest;
6725 function castSlice(array2, start2, end) {
6726 var length2 = array2.length;
6727 end = end === undefined2 ? length2 : end;
6728 return !start2 && end >= length2 ? array2 : baseSlice(array2, start2, end);
6730 var clearTimeout2 = ctxClearTimeout || function(id2) {
6731 return root3.clearTimeout(id2);
6733 function cloneBuffer(buffer, isDeep) {
6735 return buffer.slice();
6737 var length2 = buffer.length, result2 = allocUnsafe ? allocUnsafe(length2) : new buffer.constructor(length2);
6738 buffer.copy(result2);
6741 function cloneArrayBuffer(arrayBuffer) {
6742 var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
6743 new Uint8Array3(result2).set(new Uint8Array3(arrayBuffer));
6746 function cloneDataView(dataView, isDeep) {
6747 var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
6748 return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
6750 function cloneRegExp(regexp) {
6751 var result2 = new regexp.constructor(regexp.source, reFlags.exec(regexp));
6752 result2.lastIndex = regexp.lastIndex;
6755 function cloneSymbol(symbol) {
6756 return symbolValueOf2 ? Object2(symbolValueOf2.call(symbol)) : {};
6758 function cloneTypedArray(typedArray, isDeep) {
6759 var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
6760 return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
6762 function compareAscending(value, other) {
6763 if (value !== other) {
6764 var valIsDefined = value !== undefined2, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol2(value);
6765 var othIsDefined = other !== undefined2, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol2(other);
6766 if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
6769 if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
6775 function compareMultiple(object, other, orders) {
6776 var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length2 = objCriteria.length, ordersLength = orders.length;
6777 while (++index < length2) {
6778 var result2 = compareAscending(objCriteria[index], othCriteria[index]);
6780 if (index >= ordersLength) {
6783 var order = orders[index];
6784 return result2 * (order == "desc" ? -1 : 1);
6787 return object.index - other.index;
6789 function composeArgs(args, partials, holders, isCurried) {
6790 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;
6791 while (++leftIndex < leftLength) {
6792 result2[leftIndex] = partials[leftIndex];
6794 while (++argsIndex < holdersLength) {
6795 if (isUncurried || argsIndex < argsLength) {
6796 result2[holders[argsIndex]] = args[argsIndex];
6799 while (rangeLength--) {
6800 result2[leftIndex++] = args[argsIndex++];
6804 function composeArgsRight(args, partials, holders, isCurried) {
6805 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;
6806 while (++argsIndex < rangeLength) {
6807 result2[argsIndex] = args[argsIndex];
6809 var offset = argsIndex;
6810 while (++rightIndex < rightLength) {
6811 result2[offset + rightIndex] = partials[rightIndex];
6813 while (++holdersIndex < holdersLength) {
6814 if (isUncurried || argsIndex < argsLength) {
6815 result2[offset + holders[holdersIndex]] = args[argsIndex++];
6820 function copyArray(source, array2) {
6821 var index = -1, length2 = source.length;
6822 array2 || (array2 = Array2(length2));
6823 while (++index < length2) {
6824 array2[index] = source[index];
6828 function copyObject(source, props, object, customizer) {
6829 var isNew = !object;
6830 object || (object = {});
6831 var index = -1, length2 = props.length;
6832 while (++index < length2) {
6833 var key = props[index];
6834 var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined2;
6835 if (newValue === undefined2) {
6836 newValue = source[key];
6839 baseAssignValue(object, key, newValue);
6841 assignValue(object, key, newValue);
6846 function copySymbols(source, object) {
6847 return copyObject(source, getSymbols2(source), object);
6849 function copySymbolsIn(source, object) {
6850 return copyObject(source, getSymbolsIn(source), object);
6852 function createAggregator(setter, initializer) {
6853 return function(collection, iteratee2) {
6854 var func = isArray2(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
6855 return func(collection, setter, getIteratee(iteratee2, 2), accumulator);
6858 function createAssigner(assigner) {
6859 return baseRest(function(object, sources) {
6860 var index = -1, length2 = sources.length, customizer = length2 > 1 ? sources[length2 - 1] : undefined2, guard = length2 > 2 ? sources[2] : undefined2;
6861 customizer = assigner.length > 3 && typeof customizer == "function" ? (length2--, customizer) : undefined2;
6862 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
6863 customizer = length2 < 3 ? undefined2 : customizer;
6866 object = Object2(object);
6867 while (++index < length2) {
6868 var source = sources[index];
6870 assigner(object, source, index, customizer);
6876 function createBaseEach(eachFunc, fromRight) {
6877 return function(collection, iteratee2) {
6878 if (collection == null) {
6881 if (!isArrayLike2(collection)) {
6882 return eachFunc(collection, iteratee2);
6884 var length2 = collection.length, index = fromRight ? length2 : -1, iterable = Object2(collection);
6885 while (fromRight ? index-- : ++index < length2) {
6886 if (iteratee2(iterable[index], index, iterable) === false) {
6893 function createBaseFor(fromRight) {
6894 return function(object, iteratee2, keysFunc) {
6895 var index = -1, iterable = Object2(object), props = keysFunc(object), length2 = props.length;
6897 var key = props[fromRight ? length2 : ++index];
6898 if (iteratee2(iterable[key], key, iterable) === false) {
6905 function createBind(func, bitmask, thisArg) {
6906 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
6907 function wrapper() {
6908 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
6909 return fn.apply(isBind ? thisArg : this, arguments);
6913 function createCaseFirst(methodName) {
6914 return function(string) {
6915 string = toString2(string);
6916 var strSymbols = hasUnicode(string) ? stringToArray(string) : undefined2;
6917 var chr = strSymbols ? strSymbols[0] : string.charAt(0);
6918 var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
6919 return chr[methodName]() + trailing;
6922 function createCompounder(callback) {
6923 return function(string) {
6924 return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
6927 function createCtor(Ctor) {
6929 var args = arguments;
6930 switch (args.length) {
6934 return new Ctor(args[0]);
6936 return new Ctor(args[0], args[1]);
6938 return new Ctor(args[0], args[1], args[2]);
6940 return new Ctor(args[0], args[1], args[2], args[3]);
6942 return new Ctor(args[0], args[1], args[2], args[3], args[4]);
6944 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
6946 return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
6948 var thisBinding = baseCreate(Ctor.prototype), result2 = Ctor.apply(thisBinding, args);
6949 return isObject2(result2) ? result2 : thisBinding;
6952 function createCurry(func, bitmask, arity) {
6953 var Ctor = createCtor(func);
6954 function wrapper() {
6955 var length2 = arguments.length, args = Array2(length2), index = length2, placeholder = getHolder(wrapper);
6957 args[index] = arguments[index];
6959 var holders = length2 < 3 && args[0] !== placeholder && args[length2 - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
6960 length2 -= holders.length;
6961 if (length2 < arity) {
6962 return createRecurry(
6966 wrapper.placeholder,
6975 var fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
6976 return apply(fn, this, args);
6980 function createFind(findIndexFunc) {
6981 return function(collection, predicate, fromIndex) {
6982 var iterable = Object2(collection);
6983 if (!isArrayLike2(collection)) {
6984 var iteratee2 = getIteratee(predicate, 3);
6985 collection = keys2(collection);
6986 predicate = function(key) {
6987 return iteratee2(iterable[key], key, iterable);
6990 var index = findIndexFunc(collection, predicate, fromIndex);
6991 return index > -1 ? iterable[iteratee2 ? collection[index] : index] : undefined2;
6994 function createFlow(fromRight) {
6995 return flatRest(function(funcs) {
6996 var length2 = funcs.length, index = length2, prereq = LodashWrapper.prototype.thru;
7001 var func = funcs[index];
7002 if (typeof func != "function") {
7003 throw new TypeError2(FUNC_ERROR_TEXT3);
7005 if (prereq && !wrapper && getFuncName(func) == "wrapper") {
7006 var wrapper = new LodashWrapper([], true);
7009 index = wrapper ? index : length2;
7010 while (++index < length2) {
7011 func = funcs[index];
7012 var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : undefined2;
7013 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) {
7014 wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
7016 wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
7020 var args = arguments, value = args[0];
7021 if (wrapper && args.length == 1 && isArray2(value)) {
7022 return wrapper.plant(value).value();
7024 var index2 = 0, result2 = length2 ? funcs[index2].apply(this, args) : value;
7025 while (++index2 < length2) {
7026 result2 = funcs[index2].call(this, result2);
7032 function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary2, arity) {
7033 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);
7034 function wrapper() {
7035 var length2 = arguments.length, args = Array2(length2), index = length2;
7037 args[index] = arguments[index];
7040 var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
7043 args = composeArgs(args, partials, holders, isCurried);
7045 if (partialsRight) {
7046 args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
7048 length2 -= holdersCount;
7049 if (isCurried && length2 < arity) {
7050 var newHolders = replaceHolders(args, placeholder);
7051 return createRecurry(
7055 wrapper.placeholder,
7064 var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
7065 length2 = args.length;
7067 args = reorder(args, argPos);
7068 } else if (isFlip && length2 > 1) {
7071 if (isAry && ary2 < length2) {
7074 if (this && this !== root3 && this instanceof wrapper) {
7075 fn = Ctor || createCtor(fn);
7077 return fn.apply(thisBinding, args);
7081 function createInverter(setter, toIteratee) {
7082 return function(object, iteratee2) {
7083 return baseInverter(object, setter, toIteratee(iteratee2), {});
7086 function createMathOperation(operator, defaultValue) {
7087 return function(value, other) {
7089 if (value === undefined2 && other === undefined2) {
7090 return defaultValue;
7092 if (value !== undefined2) {
7095 if (other !== undefined2) {
7096 if (result2 === undefined2) {
7099 if (typeof value == "string" || typeof other == "string") {
7100 value = baseToString2(value);
7101 other = baseToString2(other);
7103 value = baseToNumber(value);
7104 other = baseToNumber(other);
7106 result2 = operator(value, other);
7111 function createOver(arrayFunc) {
7112 return flatRest(function(iteratees) {
7113 iteratees = arrayMap2(iteratees, baseUnary2(getIteratee()));
7114 return baseRest(function(args) {
7116 return arrayFunc(iteratees, function(iteratee2) {
7117 return apply(iteratee2, thisArg, args);
7122 function createPadding(length2, chars) {
7123 chars = chars === undefined2 ? " " : baseToString2(chars);
7124 var charsLength = chars.length;
7125 if (charsLength < 2) {
7126 return charsLength ? baseRepeat(chars, length2) : chars;
7128 var result2 = baseRepeat(chars, nativeCeil(length2 / stringSize(chars)));
7129 return hasUnicode(chars) ? castSlice(stringToArray(result2), 0, length2).join("") : result2.slice(0, length2);
7131 function createPartial(func, bitmask, thisArg, partials) {
7132 var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
7133 function wrapper() {
7134 var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array2(leftLength + argsLength), fn = this && this !== root3 && this instanceof wrapper ? Ctor : func;
7135 while (++leftIndex < leftLength) {
7136 args[leftIndex] = partials[leftIndex];
7138 while (argsLength--) {
7139 args[leftIndex++] = arguments[++argsIndex];
7141 return apply(fn, isBind ? thisArg : this, args);
7145 function createRange(fromRight) {
7146 return function(start2, end, step) {
7147 if (step && typeof step != "number" && isIterateeCall(start2, end, step)) {
7148 end = step = undefined2;
7150 start2 = toFinite(start2);
7151 if (end === undefined2) {
7155 end = toFinite(end);
7157 step = step === undefined2 ? start2 < end ? 1 : -1 : toFinite(step);
7158 return baseRange(start2, end, step, fromRight);
7161 function createRelationalOperation(operator) {
7162 return function(value, other) {
7163 if (!(typeof value == "string" && typeof other == "string")) {
7164 value = toNumber3(value);
7165 other = toNumber3(other);
7167 return operator(value, other);
7170 function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary2, arity) {
7171 var isCurry = bitmask & WRAP_CURRY_FLAG, newHolders = isCurry ? holders : undefined2, newHoldersRight = isCurry ? undefined2 : holders, newPartials = isCurry ? partials : undefined2, newPartialsRight = isCurry ? undefined2 : partials;
7172 bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG;
7173 bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG);
7174 if (!(bitmask & WRAP_CURRY_BOUND_FLAG)) {
7175 bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG);
7189 var result2 = wrapFunc.apply(undefined2, newData);
7190 if (isLaziable(func)) {
7191 setData(result2, newData);
7193 result2.placeholder = placeholder;
7194 return setWrapToString(result2, func, bitmask);
7196 function createRound(methodName) {
7197 var func = Math2[methodName];
7198 return function(number3, precision3) {
7199 number3 = toNumber3(number3);
7200 precision3 = precision3 == null ? 0 : nativeMin2(toInteger(precision3), 292);
7201 if (precision3 && nativeIsFinite(number3)) {
7202 var pair3 = (toString2(number3) + "e").split("e"), value = func(pair3[0] + "e" + (+pair3[1] + precision3));
7203 pair3 = (toString2(value) + "e").split("e");
7204 return +(pair3[0] + "e" + (+pair3[1] - precision3));
7206 return func(number3);
7209 var createSet = !(Set3 && 1 / setToArray2(new Set3([, -0]))[1] == INFINITY2) ? noop3 : function(values2) {
7210 return new Set3(values2);
7212 function createToPairs(keysFunc) {
7213 return function(object) {
7214 var tag2 = getTag2(object);
7215 if (tag2 == mapTag4) {
7216 return mapToArray2(object);
7218 if (tag2 == setTag4) {
7219 return setToPairs(object);
7221 return baseToPairs(object, keysFunc(object));
7224 function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
7225 var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
7226 if (!isBindKey && typeof func != "function") {
7227 throw new TypeError2(FUNC_ERROR_TEXT3);
7229 var length2 = partials ? partials.length : 0;
7231 bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG);
7232 partials = holders = undefined2;
7234 ary2 = ary2 === undefined2 ? ary2 : nativeMax2(toInteger(ary2), 0);
7235 arity = arity === undefined2 ? arity : toInteger(arity);
7236 length2 -= holders ? holders.length : 0;
7237 if (bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
7238 var partialsRight = partials, holdersRight = holders;
7239 partials = holders = undefined2;
7241 var data = isBindKey ? undefined2 : getData(func);
7255 mergeData(newData, data);
7258 bitmask = newData[1];
7259 thisArg = newData[2];
7260 partials = newData[3];
7261 holders = newData[4];
7262 arity = newData[9] = newData[9] === undefined2 ? isBindKey ? 0 : func.length : nativeMax2(newData[9] - length2, 0);
7263 if (!arity && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)) {
7264 bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG);
7266 if (!bitmask || bitmask == WRAP_BIND_FLAG) {
7267 var result2 = createBind(func, bitmask, thisArg);
7268 } else if (bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG) {
7269 result2 = createCurry(func, bitmask, arity);
7270 } else if ((bitmask == WRAP_PARTIAL_FLAG || bitmask == (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG)) && !holders.length) {
7271 result2 = createPartial(func, bitmask, thisArg, partials);
7273 result2 = createHybrid.apply(undefined2, newData);
7275 var setter = data ? baseSetData : setData;
7276 return setWrapToString(setter(result2, newData), func, bitmask);
7278 function customDefaultsAssignIn(objValue, srcValue, key, object) {
7279 if (objValue === undefined2 || eq2(objValue, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
7284 function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
7285 if (isObject2(objValue) && isObject2(srcValue)) {
7286 stack.set(srcValue, objValue);
7287 baseMerge(objValue, srcValue, undefined2, customDefaultsMerge, stack);
7288 stack["delete"](srcValue);
7292 function customOmitClone(value) {
7293 return isPlainObject(value) ? undefined2 : value;
7295 function equalArrays2(array2, other, bitmask, customizer, equalFunc, stack) {
7296 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, arrLength = array2.length, othLength = other.length;
7297 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
7300 var arrStacked = stack.get(array2);
7301 var othStacked = stack.get(other);
7302 if (arrStacked && othStacked) {
7303 return arrStacked == other && othStacked == array2;
7305 var index = -1, result2 = true, seen = bitmask & COMPARE_UNORDERED_FLAG3 ? new SetCache2() : undefined2;
7306 stack.set(array2, other);
7307 stack.set(other, array2);
7308 while (++index < arrLength) {
7309 var arrValue = array2[index], othValue = other[index];
7311 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
7313 if (compared !== undefined2) {
7321 if (!arraySome2(other, function(othValue2, othIndex) {
7322 if (!cacheHas2(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
7323 return seen.push(othIndex);
7329 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
7334 stack["delete"](array2);
7335 stack["delete"](other);
7338 function equalByTag2(object, other, tag2, bitmask, customizer, equalFunc, stack) {
7341 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
7344 object = object.buffer;
7345 other = other.buffer;
7346 case arrayBufferTag3:
7347 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array3(object), new Uint8Array3(other))) {
7354 return eq2(+object, +other);
7356 return object.name == other.name && object.message == other.message;
7359 return object == other + "";
7361 var convert = mapToArray2;
7363 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5;
7364 convert || (convert = setToArray2);
7365 if (object.size != other.size && !isPartial) {
7368 var stacked = stack.get(object);
7370 return stacked == other;
7372 bitmask |= COMPARE_UNORDERED_FLAG3;
7373 stack.set(object, other);
7374 var result2 = equalArrays2(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
7375 stack["delete"](object);
7378 if (symbolValueOf2) {
7379 return symbolValueOf2.call(object) == symbolValueOf2.call(other);
7384 function equalObjects2(object, other, bitmask, customizer, equalFunc, stack) {
7385 var isPartial = bitmask & COMPARE_PARTIAL_FLAG5, objProps = getAllKeys2(object), objLength = objProps.length, othProps = getAllKeys2(other), othLength = othProps.length;
7386 if (objLength != othLength && !isPartial) {
7389 var index = objLength;
7391 var key = objProps[index];
7392 if (!(isPartial ? key in other : hasOwnProperty10.call(other, key))) {
7396 var objStacked = stack.get(object);
7397 var othStacked = stack.get(other);
7398 if (objStacked && othStacked) {
7399 return objStacked == other && othStacked == object;
7402 stack.set(object, other);
7403 stack.set(other, object);
7404 var skipCtor = isPartial;
7405 while (++index < objLength) {
7406 key = objProps[index];
7407 var objValue = object[key], othValue = other[key];
7409 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
7411 if (!(compared === undefined2 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
7415 skipCtor || (skipCtor = key == "constructor");
7417 if (result2 && !skipCtor) {
7418 var objCtor = object.constructor, othCtor = other.constructor;
7419 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
7423 stack["delete"](object);
7424 stack["delete"](other);
7427 function flatRest(func) {
7428 return setToString(overRest(func, undefined2, flatten2), func + "");
7430 function getAllKeys2(object) {
7431 return baseGetAllKeys2(object, keys2, getSymbols2);
7433 function getAllKeysIn(object) {
7434 return baseGetAllKeys2(object, keysIn, getSymbolsIn);
7436 var getData = !metaMap ? noop3 : function(func) {
7437 return metaMap.get(func);
7439 function getFuncName(func) {
7440 var result2 = func.name + "", array2 = realNames[result2], length2 = hasOwnProperty10.call(realNames, result2) ? array2.length : 0;
7442 var data = array2[length2], otherFunc = data.func;
7443 if (otherFunc == null || otherFunc == func) {
7449 function getHolder(func) {
7450 var object = hasOwnProperty10.call(lodash, "placeholder") ? lodash : func;
7451 return object.placeholder;
7453 function getIteratee() {
7454 var result2 = lodash.iteratee || iteratee;
7455 result2 = result2 === iteratee ? baseIteratee : result2;
7456 return arguments.length ? result2(arguments[0], arguments[1]) : result2;
7458 function getMapData2(map3, key) {
7459 var data = map3.__data__;
7460 return isKeyable2(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
7462 function getMatchData(object) {
7463 var result2 = keys2(object), length2 = result2.length;
7465 var key = result2[length2], value = object[key];
7466 result2[length2] = [key, value, isStrictComparable(value)];
7470 function getNative2(object, key) {
7471 var value = getValue2(object, key);
7472 return baseIsNative2(value) ? value : undefined2;
7474 function getRawTag2(value) {
7475 var isOwn = hasOwnProperty10.call(value, symToStringTag3), tag2 = value[symToStringTag3];
7477 value[symToStringTag3] = undefined2;
7478 var unmasked = true;
7481 var result2 = nativeObjectToString3.call(value);
7484 value[symToStringTag3] = tag2;
7486 delete value[symToStringTag3];
7491 var getSymbols2 = !nativeGetSymbols2 ? stubArray2 : function(object) {
7492 if (object == null) {
7495 object = Object2(object);
7496 return arrayFilter2(nativeGetSymbols2(object), function(symbol) {
7497 return propertyIsEnumerable3.call(object, symbol);
7500 var getSymbolsIn = !nativeGetSymbols2 ? stubArray2 : function(object) {
7503 arrayPush2(result2, getSymbols2(object));
7504 object = getPrototype(object);
7508 var getTag2 = baseGetTag2;
7509 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) {
7510 getTag2 = function(value) {
7511 var result2 = baseGetTag2(value), Ctor = result2 == objectTag4 ? value.constructor : undefined2, ctorString = Ctor ? toSource2(Ctor) : "";
7513 switch (ctorString) {
7514 case dataViewCtorString2:
7515 return dataViewTag4;
7516 case mapCtorString2:
7518 case promiseCtorString2:
7520 case setCtorString2:
7522 case weakMapCtorString2:
7529 function getView(start2, end, transforms) {
7530 var index = -1, length2 = transforms.length;
7531 while (++index < length2) {
7532 var data = transforms[index], size2 = data.size;
7533 switch (data.type) {
7541 end = nativeMin2(end, start2 + size2);
7544 start2 = nativeMax2(start2, end - size2);
7548 return { "start": start2, "end": end };
7550 function getWrapDetails(source) {
7551 var match = source.match(reWrapDetails);
7552 return match ? match[1].split(reSplitDetails) : [];
7554 function hasPath(object, path, hasFunc) {
7555 path = castPath(path, object);
7556 var index = -1, length2 = path.length, result2 = false;
7557 while (++index < length2) {
7558 var key = toKey(path[index]);
7559 if (!(result2 = object != null && hasFunc(object, key))) {
7562 object = object[key];
7564 if (result2 || ++index != length2) {
7567 length2 = object == null ? 0 : object.length;
7568 return !!length2 && isLength2(length2) && isIndex2(key, length2) && (isArray2(object) || isArguments2(object));
7570 function initCloneArray(array2) {
7571 var length2 = array2.length, result2 = new array2.constructor(length2);
7572 if (length2 && typeof array2[0] == "string" && hasOwnProperty10.call(array2, "index")) {
7573 result2.index = array2.index;
7574 result2.input = array2.input;
7578 function initCloneObject(object) {
7579 return typeof object.constructor == "function" && !isPrototype2(object) ? baseCreate(getPrototype(object)) : {};
7581 function initCloneByTag(object, tag2, isDeep) {
7582 var Ctor = object.constructor;
7584 case arrayBufferTag3:
7585 return cloneArrayBuffer(object);
7588 return new Ctor(+object);
7590 return cloneDataView(object, isDeep);
7597 case uint8ClampedTag2:
7600 return cloneTypedArray(object, isDeep);
7605 return new Ctor(object);
7607 return cloneRegExp(object);
7611 return cloneSymbol(object);
7614 function insertWrapDetails(source, details) {
7615 var length2 = details.length;
7619 var lastIndex = length2 - 1;
7620 details[lastIndex] = (length2 > 1 ? "& " : "") + details[lastIndex];
7621 details = details.join(length2 > 2 ? ", " : " ");
7622 return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
7624 function isFlattenable(value) {
7625 return isArray2(value) || isArguments2(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
7627 function isIndex2(value, length2) {
7628 var type2 = typeof value;
7629 length2 = length2 == null ? MAX_SAFE_INTEGER4 : length2;
7630 return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint2.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
7632 function isIterateeCall(value, index, object) {
7633 if (!isObject2(object)) {
7636 var type2 = typeof index;
7637 if (type2 == "number" ? isArrayLike2(object) && isIndex2(index, object.length) : type2 == "string" && index in object) {
7638 return eq2(object[index], value);
7642 function isKey(value, object) {
7643 if (isArray2(value)) {
7646 var type2 = typeof value;
7647 if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol2(value)) {
7650 return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object2(object);
7652 function isKeyable2(value) {
7653 var type2 = typeof value;
7654 return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
7656 function isLaziable(func) {
7657 var funcName = getFuncName(func), other = lodash[funcName];
7658 if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
7661 if (func === other) {
7664 var data = getData(other);
7665 return !!data && func === data[0];
7667 function isMasked2(func) {
7668 return !!maskSrcKey2 && maskSrcKey2 in func;
7670 var isMaskable = coreJsData2 ? isFunction2 : stubFalse2;
7671 function isPrototype2(value) {
7672 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto13;
7673 return value === proto;
7675 function isStrictComparable(value) {
7676 return value === value && !isObject2(value);
7678 function matchesStrictComparable(key, srcValue) {
7679 return function(object) {
7680 if (object == null) {
7683 return object[key] === srcValue && (srcValue !== undefined2 || key in Object2(object));
7686 function memoizeCapped(func) {
7687 var result2 = memoize(func, function(key) {
7688 if (cache.size === MAX_MEMOIZE_SIZE) {
7693 var cache = result2.cache;
7696 function mergeData(data, source) {
7697 var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG);
7698 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;
7699 if (!(isCommon || isCombo)) {
7702 if (srcBitmask & WRAP_BIND_FLAG) {
7703 data[2] = source[2];
7704 newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG;
7706 var value = source[3];
7708 var partials = data[3];
7709 data[3] = partials ? composeArgs(partials, value, source[4]) : value;
7710 data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
7715 data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
7716 data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
7722 if (srcBitmask & WRAP_ARY_FLAG) {
7723 data[8] = data[8] == null ? source[8] : nativeMin2(data[8], source[8]);
7725 if (data[9] == null) {
7726 data[9] = source[9];
7728 data[0] = source[0];
7729 data[1] = newBitmask;
7732 function nativeKeysIn(object) {
7734 if (object != null) {
7735 for (var key in Object2(object)) {
7741 function objectToString2(value) {
7742 return nativeObjectToString3.call(value);
7744 function overRest(func, start2, transform3) {
7745 start2 = nativeMax2(start2 === undefined2 ? func.length - 1 : start2, 0);
7747 var args = arguments, index = -1, length2 = nativeMax2(args.length - start2, 0), array2 = Array2(length2);
7748 while (++index < length2) {
7749 array2[index] = args[start2 + index];
7752 var otherArgs = Array2(start2 + 1);
7753 while (++index < start2) {
7754 otherArgs[index] = args[index];
7756 otherArgs[start2] = transform3(array2);
7757 return apply(func, this, otherArgs);
7760 function parent(object, path) {
7761 return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
7763 function reorder(array2, indexes) {
7764 var arrLength = array2.length, length2 = nativeMin2(indexes.length, arrLength), oldArray = copyArray(array2);
7766 var index = indexes[length2];
7767 array2[length2] = isIndex2(index, arrLength) ? oldArray[index] : undefined2;
7771 function safeGet(object, key) {
7772 if (key === "constructor" && typeof object[key] === "function") {
7775 if (key == "__proto__") {
7780 var setData = shortOut(baseSetData);
7781 var setTimeout2 = ctxSetTimeout || function(func, wait) {
7782 return root3.setTimeout(func, wait);
7784 var setToString = shortOut(baseSetToString);
7785 function setWrapToString(wrapper, reference, bitmask) {
7786 var source = reference + "";
7787 return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
7789 function shortOut(func) {
7790 var count = 0, lastCalled = 0;
7792 var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
7794 if (remaining > 0) {
7795 if (++count >= HOT_COUNT) {
7796 return arguments[0];
7801 return func.apply(undefined2, arguments);
7804 function shuffleSelf(array2, size2) {
7805 var index = -1, length2 = array2.length, lastIndex = length2 - 1;
7806 size2 = size2 === undefined2 ? length2 : size2;
7807 while (++index < size2) {
7808 var rand = baseRandom(index, lastIndex), value = array2[rand];
7809 array2[rand] = array2[index];
7810 array2[index] = value;
7812 array2.length = size2;
7815 var stringToPath = memoizeCapped(function(string) {
7817 if (string.charCodeAt(0) === 46) {
7820 string.replace(rePropName, function(match, number3, quote, subString) {
7821 result2.push(quote ? subString.replace(reEscapeChar, "$1") : number3 || match);
7825 function toKey(value) {
7826 if (typeof value == "string" || isSymbol2(value)) {
7829 var result2 = value + "";
7830 return result2 == "0" && 1 / value == -INFINITY2 ? "-0" : result2;
7832 function toSource2(func) {
7835 return funcToString3.call(func);
7845 function updateWrapDetails(details, bitmask) {
7846 arrayEach(wrapFlags, function(pair3) {
7847 var value = "_." + pair3[0];
7848 if (bitmask & pair3[1] && !arrayIncludes(details, value)) {
7849 details.push(value);
7852 return details.sort();
7854 function wrapperClone(wrapper) {
7855 if (wrapper instanceof LazyWrapper) {
7856 return wrapper.clone();
7858 var result2 = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
7859 result2.__actions__ = copyArray(wrapper.__actions__);
7860 result2.__index__ = wrapper.__index__;
7861 result2.__values__ = wrapper.__values__;
7864 function chunk(array2, size2, guard) {
7865 if (guard ? isIterateeCall(array2, size2, guard) : size2 === undefined2) {
7868 size2 = nativeMax2(toInteger(size2), 0);
7870 var length2 = array2 == null ? 0 : array2.length;
7871 if (!length2 || size2 < 1) {
7874 var index = 0, resIndex = 0, result2 = Array2(nativeCeil(length2 / size2));
7875 while (index < length2) {
7876 result2[resIndex++] = baseSlice(array2, index, index += size2);
7880 function compact(array2) {
7881 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result2 = [];
7882 while (++index < length2) {
7883 var value = array2[index];
7885 result2[resIndex++] = value;
7891 var length2 = arguments.length;
7895 var args = Array2(length2 - 1), array2 = arguments[0], index = length2;
7897 args[index - 1] = arguments[index];
7899 return arrayPush2(isArray2(array2) ? copyArray(array2) : [array2], baseFlatten(args, 1));
7901 var difference2 = baseRest(function(array2, values2) {
7902 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true)) : [];
7904 var differenceBy = baseRest(function(array2, values2) {
7905 var iteratee2 = last(values2);
7906 if (isArrayLikeObject(iteratee2)) {
7907 iteratee2 = undefined2;
7909 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2)) : [];
7911 var differenceWith = baseRest(function(array2, values2) {
7912 var comparator = last(values2);
7913 if (isArrayLikeObject(comparator)) {
7914 comparator = undefined2;
7916 return isArrayLikeObject(array2) ? baseDifference(array2, baseFlatten(values2, 1, isArrayLikeObject, true), undefined2, comparator) : [];
7918 function drop(array2, n3, guard) {
7919 var length2 = array2 == null ? 0 : array2.length;
7923 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7924 return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
7926 function dropRight(array2, n3, guard) {
7927 var length2 = array2 == null ? 0 : array2.length;
7931 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
7933 return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
7935 function dropRightWhile(array2, predicate) {
7936 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true, true) : [];
7938 function dropWhile(array2, predicate) {
7939 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), true) : [];
7941 function fill(array2, value, start2, end) {
7942 var length2 = array2 == null ? 0 : array2.length;
7946 if (start2 && typeof start2 != "number" && isIterateeCall(array2, value, start2)) {
7950 return baseFill(array2, value, start2, end);
7952 function findIndex(array2, predicate, fromIndex) {
7953 var length2 = array2 == null ? 0 : array2.length;
7957 var index = fromIndex == null ? 0 : toInteger(fromIndex);
7959 index = nativeMax2(length2 + index, 0);
7961 return baseFindIndex(array2, getIteratee(predicate, 3), index);
7963 function findLastIndex(array2, predicate, fromIndex) {
7964 var length2 = array2 == null ? 0 : array2.length;
7968 var index = length2 - 1;
7969 if (fromIndex !== undefined2) {
7970 index = toInteger(fromIndex);
7971 index = fromIndex < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
7973 return baseFindIndex(array2, getIteratee(predicate, 3), index, true);
7975 function flatten2(array2) {
7976 var length2 = array2 == null ? 0 : array2.length;
7977 return length2 ? baseFlatten(array2, 1) : [];
7979 function flattenDeep(array2) {
7980 var length2 = array2 == null ? 0 : array2.length;
7981 return length2 ? baseFlatten(array2, INFINITY2) : [];
7983 function flattenDepth(array2, depth) {
7984 var length2 = array2 == null ? 0 : array2.length;
7988 depth = depth === undefined2 ? 1 : toInteger(depth);
7989 return baseFlatten(array2, depth);
7991 function fromPairs(pairs2) {
7992 var index = -1, length2 = pairs2 == null ? 0 : pairs2.length, result2 = {};
7993 while (++index < length2) {
7994 var pair3 = pairs2[index];
7995 result2[pair3[0]] = pair3[1];
7999 function head(array2) {
8000 return array2 && array2.length ? array2[0] : undefined2;
8002 function indexOf(array2, value, fromIndex) {
8003 var length2 = array2 == null ? 0 : array2.length;
8007 var index = fromIndex == null ? 0 : toInteger(fromIndex);
8009 index = nativeMax2(length2 + index, 0);
8011 return baseIndexOf(array2, value, index);
8013 function initial(array2) {
8014 var length2 = array2 == null ? 0 : array2.length;
8015 return length2 ? baseSlice(array2, 0, -1) : [];
8017 var intersection2 = baseRest(function(arrays) {
8018 var mapped = arrayMap2(arrays, castArrayLikeObject);
8019 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
8021 var intersectionBy = baseRest(function(arrays) {
8022 var iteratee2 = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8023 if (iteratee2 === last(mapped)) {
8024 iteratee2 = undefined2;
8028 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee2, 2)) : [];
8030 var intersectionWith = baseRest(function(arrays) {
8031 var comparator = last(arrays), mapped = arrayMap2(arrays, castArrayLikeObject);
8032 comparator = typeof comparator == "function" ? comparator : undefined2;
8036 return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
8038 function join(array2, separator) {
8039 return array2 == null ? "" : nativeJoin.call(array2, separator);
8041 function last(array2) {
8042 var length2 = array2 == null ? 0 : array2.length;
8043 return length2 ? array2[length2 - 1] : undefined2;
8045 function lastIndexOf(array2, value, fromIndex) {
8046 var length2 = array2 == null ? 0 : array2.length;
8050 var index = length2;
8051 if (fromIndex !== undefined2) {
8052 index = toInteger(fromIndex);
8053 index = index < 0 ? nativeMax2(length2 + index, 0) : nativeMin2(index, length2 - 1);
8055 return value === value ? strictLastIndexOf(array2, value, index) : baseFindIndex(array2, baseIsNaN, index, true);
8057 function nth(array2, n3) {
8058 return array2 && array2.length ? baseNth(array2, toInteger(n3)) : undefined2;
8060 var pull = baseRest(pullAll);
8061 function pullAll(array2, values2) {
8062 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2) : array2;
8064 function pullAllBy(array2, values2, iteratee2) {
8065 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, getIteratee(iteratee2, 2)) : array2;
8067 function pullAllWith(array2, values2, comparator) {
8068 return array2 && array2.length && values2 && values2.length ? basePullAll(array2, values2, undefined2, comparator) : array2;
8070 var pullAt = flatRest(function(array2, indexes) {
8071 var length2 = array2 == null ? 0 : array2.length, result2 = baseAt(array2, indexes);
8072 basePullAt(array2, arrayMap2(indexes, function(index) {
8073 return isIndex2(index, length2) ? +index : index;
8074 }).sort(compareAscending));
8077 function remove2(array2, predicate) {
8079 if (!(array2 && array2.length)) {
8082 var index = -1, indexes = [], length2 = array2.length;
8083 predicate = getIteratee(predicate, 3);
8084 while (++index < length2) {
8085 var value = array2[index];
8086 if (predicate(value, index, array2)) {
8087 result2.push(value);
8088 indexes.push(index);
8091 basePullAt(array2, indexes);
8094 function reverse(array2) {
8095 return array2 == null ? array2 : nativeReverse.call(array2);
8097 function slice(array2, start2, end) {
8098 var length2 = array2 == null ? 0 : array2.length;
8102 if (end && typeof end != "number" && isIterateeCall(array2, start2, end)) {
8106 start2 = start2 == null ? 0 : toInteger(start2);
8107 end = end === undefined2 ? length2 : toInteger(end);
8109 return baseSlice(array2, start2, end);
8111 function sortedIndex(array2, value) {
8112 return baseSortedIndex(array2, value);
8114 function sortedIndexBy(array2, value, iteratee2) {
8115 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2));
8117 function sortedIndexOf(array2, value) {
8118 var length2 = array2 == null ? 0 : array2.length;
8120 var index = baseSortedIndex(array2, value);
8121 if (index < length2 && eq2(array2[index], value)) {
8127 function sortedLastIndex(array2, value) {
8128 return baseSortedIndex(array2, value, true);
8130 function sortedLastIndexBy(array2, value, iteratee2) {
8131 return baseSortedIndexBy(array2, value, getIteratee(iteratee2, 2), true);
8133 function sortedLastIndexOf(array2, value) {
8134 var length2 = array2 == null ? 0 : array2.length;
8136 var index = baseSortedIndex(array2, value, true) - 1;
8137 if (eq2(array2[index], value)) {
8143 function sortedUniq(array2) {
8144 return array2 && array2.length ? baseSortedUniq(array2) : [];
8146 function sortedUniqBy(array2, iteratee2) {
8147 return array2 && array2.length ? baseSortedUniq(array2, getIteratee(iteratee2, 2)) : [];
8149 function tail(array2) {
8150 var length2 = array2 == null ? 0 : array2.length;
8151 return length2 ? baseSlice(array2, 1, length2) : [];
8153 function take(array2, n3, guard) {
8154 if (!(array2 && array2.length)) {
8157 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8158 return baseSlice(array2, 0, n3 < 0 ? 0 : n3);
8160 function takeRight(array2, n3, guard) {
8161 var length2 = array2 == null ? 0 : array2.length;
8165 n3 = guard || n3 === undefined2 ? 1 : toInteger(n3);
8167 return baseSlice(array2, n3 < 0 ? 0 : n3, length2);
8169 function takeRightWhile(array2, predicate) {
8170 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3), false, true) : [];
8172 function takeWhile(array2, predicate) {
8173 return array2 && array2.length ? baseWhile(array2, getIteratee(predicate, 3)) : [];
8175 var union2 = baseRest(function(arrays) {
8176 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
8178 var unionBy = baseRest(function(arrays) {
8179 var iteratee2 = last(arrays);
8180 if (isArrayLikeObject(iteratee2)) {
8181 iteratee2 = undefined2;
8183 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), getIteratee(iteratee2, 2));
8185 var unionWith = baseRest(function(arrays) {
8186 var comparator = last(arrays);
8187 comparator = typeof comparator == "function" ? comparator : undefined2;
8188 return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), undefined2, comparator);
8190 function uniq(array2) {
8191 return array2 && array2.length ? baseUniq(array2) : [];
8193 function uniqBy(array2, iteratee2) {
8194 return array2 && array2.length ? baseUniq(array2, getIteratee(iteratee2, 2)) : [];
8196 function uniqWith(array2, comparator) {
8197 comparator = typeof comparator == "function" ? comparator : undefined2;
8198 return array2 && array2.length ? baseUniq(array2, undefined2, comparator) : [];
8200 function unzip(array2) {
8201 if (!(array2 && array2.length)) {
8205 array2 = arrayFilter2(array2, function(group) {
8206 if (isArrayLikeObject(group)) {
8207 length2 = nativeMax2(group.length, length2);
8211 return baseTimes2(length2, function(index) {
8212 return arrayMap2(array2, baseProperty(index));
8215 function unzipWith(array2, iteratee2) {
8216 if (!(array2 && array2.length)) {
8219 var result2 = unzip(array2);
8220 if (iteratee2 == null) {
8223 return arrayMap2(result2, function(group) {
8224 return apply(iteratee2, undefined2, group);
8227 var without = baseRest(function(array2, values2) {
8228 return isArrayLikeObject(array2) ? baseDifference(array2, values2) : [];
8230 var xor = baseRest(function(arrays) {
8231 return baseXor(arrayFilter2(arrays, isArrayLikeObject));
8233 var xorBy = baseRest(function(arrays) {
8234 var iteratee2 = last(arrays);
8235 if (isArrayLikeObject(iteratee2)) {
8236 iteratee2 = undefined2;
8238 return baseXor(arrayFilter2(arrays, isArrayLikeObject), getIteratee(iteratee2, 2));
8240 var xorWith = baseRest(function(arrays) {
8241 var comparator = last(arrays);
8242 comparator = typeof comparator == "function" ? comparator : undefined2;
8243 return baseXor(arrayFilter2(arrays, isArrayLikeObject), undefined2, comparator);
8245 var zip = baseRest(unzip);
8246 function zipObject(props, values2) {
8247 return baseZipObject(props || [], values2 || [], assignValue);
8249 function zipObjectDeep(props, values2) {
8250 return baseZipObject(props || [], values2 || [], baseSet);
8252 var zipWith = baseRest(function(arrays) {
8253 var length2 = arrays.length, iteratee2 = length2 > 1 ? arrays[length2 - 1] : undefined2;
8254 iteratee2 = typeof iteratee2 == "function" ? (arrays.pop(), iteratee2) : undefined2;
8255 return unzipWith(arrays, iteratee2);
8257 function chain(value) {
8258 var result2 = lodash(value);
8259 result2.__chain__ = true;
8262 function tap(value, interceptor) {
8266 function thru(value, interceptor) {
8267 return interceptor(value);
8269 var wrapperAt = flatRest(function(paths) {
8270 var length2 = paths.length, start2 = length2 ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
8271 return baseAt(object, paths);
8273 if (length2 > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex2(start2)) {
8274 return this.thru(interceptor);
8276 value = value.slice(start2, +start2 + (length2 ? 1 : 0));
8277 value.__actions__.push({
8279 "args": [interceptor],
8280 "thisArg": undefined2
8282 return new LodashWrapper(value, this.__chain__).thru(function(array2) {
8283 if (length2 && !array2.length) {
8284 array2.push(undefined2);
8289 function wrapperChain() {
8292 function wrapperCommit() {
8293 return new LodashWrapper(this.value(), this.__chain__);
8295 function wrapperNext() {
8296 if (this.__values__ === undefined2) {
8297 this.__values__ = toArray(this.value());
8299 var done = this.__index__ >= this.__values__.length, value = done ? undefined2 : this.__values__[this.__index__++];
8300 return { "done": done, "value": value };
8302 function wrapperToIterator() {
8305 function wrapperPlant(value) {
8306 var result2, parent2 = this;
8307 while (parent2 instanceof baseLodash) {
8308 var clone3 = wrapperClone(parent2);
8309 clone3.__index__ = 0;
8310 clone3.__values__ = undefined2;
8312 previous.__wrapped__ = clone3;
8316 var previous = clone3;
8317 parent2 = parent2.__wrapped__;
8319 previous.__wrapped__ = value;
8322 function wrapperReverse() {
8323 var value = this.__wrapped__;
8324 if (value instanceof LazyWrapper) {
8325 var wrapped = value;
8326 if (this.__actions__.length) {
8327 wrapped = new LazyWrapper(this);
8329 wrapped = wrapped.reverse();
8330 wrapped.__actions__.push({
8333 "thisArg": undefined2
8335 return new LodashWrapper(wrapped, this.__chain__);
8337 return this.thru(reverse);
8339 function wrapperValue() {
8340 return baseWrapperValue(this.__wrapped__, this.__actions__);
8342 var countBy = createAggregator(function(result2, value, key) {
8343 if (hasOwnProperty10.call(result2, key)) {
8346 baseAssignValue(result2, key, 1);
8349 function every(collection, predicate, guard) {
8350 var func = isArray2(collection) ? arrayEvery : baseEvery;
8351 if (guard && isIterateeCall(collection, predicate, guard)) {
8352 predicate = undefined2;
8354 return func(collection, getIteratee(predicate, 3));
8356 function filter2(collection, predicate) {
8357 var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8358 return func(collection, getIteratee(predicate, 3));
8360 var find2 = createFind(findIndex);
8361 var findLast = createFind(findLastIndex);
8362 function flatMap(collection, iteratee2) {
8363 return baseFlatten(map2(collection, iteratee2), 1);
8365 function flatMapDeep(collection, iteratee2) {
8366 return baseFlatten(map2(collection, iteratee2), INFINITY2);
8368 function flatMapDepth(collection, iteratee2, depth) {
8369 depth = depth === undefined2 ? 1 : toInteger(depth);
8370 return baseFlatten(map2(collection, iteratee2), depth);
8372 function forEach(collection, iteratee2) {
8373 var func = isArray2(collection) ? arrayEach : baseEach;
8374 return func(collection, getIteratee(iteratee2, 3));
8376 function forEachRight(collection, iteratee2) {
8377 var func = isArray2(collection) ? arrayEachRight : baseEachRight;
8378 return func(collection, getIteratee(iteratee2, 3));
8380 var groupBy = createAggregator(function(result2, value, key) {
8381 if (hasOwnProperty10.call(result2, key)) {
8382 result2[key].push(value);
8384 baseAssignValue(result2, key, [value]);
8387 function includes(collection, value, fromIndex, guard) {
8388 collection = isArrayLike2(collection) ? collection : values(collection);
8389 fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
8390 var length2 = collection.length;
8391 if (fromIndex < 0) {
8392 fromIndex = nativeMax2(length2 + fromIndex, 0);
8394 return isString(collection) ? fromIndex <= length2 && collection.indexOf(value, fromIndex) > -1 : !!length2 && baseIndexOf(collection, value, fromIndex) > -1;
8396 var invokeMap = baseRest(function(collection, path, args) {
8397 var index = -1, isFunc = typeof path == "function", result2 = isArrayLike2(collection) ? Array2(collection.length) : [];
8398 baseEach(collection, function(value) {
8399 result2[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
8403 var keyBy = createAggregator(function(result2, value, key) {
8404 baseAssignValue(result2, key, value);
8406 function map2(collection, iteratee2) {
8407 var func = isArray2(collection) ? arrayMap2 : baseMap;
8408 return func(collection, getIteratee(iteratee2, 3));
8410 function orderBy(collection, iteratees, orders, guard) {
8411 if (collection == null) {
8414 if (!isArray2(iteratees)) {
8415 iteratees = iteratees == null ? [] : [iteratees];
8417 orders = guard ? undefined2 : orders;
8418 if (!isArray2(orders)) {
8419 orders = orders == null ? [] : [orders];
8421 return baseOrderBy(collection, iteratees, orders);
8423 var partition = createAggregator(function(result2, value, key) {
8424 result2[key ? 0 : 1].push(value);
8428 function reduce(collection, iteratee2, accumulator) {
8429 var func = isArray2(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
8430 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEach);
8432 function reduceRight(collection, iteratee2, accumulator) {
8433 var func = isArray2(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
8434 return func(collection, getIteratee(iteratee2, 4), accumulator, initAccum, baseEachRight);
8436 function reject(collection, predicate) {
8437 var func = isArray2(collection) ? arrayFilter2 : baseFilter;
8438 return func(collection, negate(getIteratee(predicate, 3)));
8440 function sample(collection) {
8441 var func = isArray2(collection) ? arraySample : baseSample;
8442 return func(collection);
8444 function sampleSize(collection, n3, guard) {
8445 if (guard ? isIterateeCall(collection, n3, guard) : n3 === undefined2) {
8450 var func = isArray2(collection) ? arraySampleSize : baseSampleSize;
8451 return func(collection, n3);
8453 function shuffle(collection) {
8454 var func = isArray2(collection) ? arrayShuffle : baseShuffle;
8455 return func(collection);
8457 function size(collection) {
8458 if (collection == null) {
8461 if (isArrayLike2(collection)) {
8462 return isString(collection) ? stringSize(collection) : collection.length;
8464 var tag2 = getTag2(collection);
8465 if (tag2 == mapTag4 || tag2 == setTag4) {
8466 return collection.size;
8468 return baseKeys2(collection).length;
8470 function some(collection, predicate, guard) {
8471 var func = isArray2(collection) ? arraySome2 : baseSome;
8472 if (guard && isIterateeCall(collection, predicate, guard)) {
8473 predicate = undefined2;
8475 return func(collection, getIteratee(predicate, 3));
8477 var sortBy = baseRest(function(collection, iteratees) {
8478 if (collection == null) {
8481 var length2 = iteratees.length;
8482 if (length2 > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
8484 } else if (length2 > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
8485 iteratees = [iteratees[0]];
8487 return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
8489 var now3 = ctxNow || function() {
8490 return root3.Date.now();
8492 function after(n3, func) {
8493 if (typeof func != "function") {
8494 throw new TypeError2(FUNC_ERROR_TEXT3);
8499 return func.apply(this, arguments);
8503 function ary(func, n3, guard) {
8504 n3 = guard ? undefined2 : n3;
8505 n3 = func && n3 == null ? func.length : n3;
8506 return createWrap(func, WRAP_ARY_FLAG, undefined2, undefined2, undefined2, undefined2, n3);
8508 function before(n3, func) {
8510 if (typeof func != "function") {
8511 throw new TypeError2(FUNC_ERROR_TEXT3);
8516 result2 = func.apply(this, arguments);
8524 var bind = baseRest(function(func, thisArg, partials) {
8525 var bitmask = WRAP_BIND_FLAG;
8526 if (partials.length) {
8527 var holders = replaceHolders(partials, getHolder(bind));
8528 bitmask |= WRAP_PARTIAL_FLAG;
8530 return createWrap(func, bitmask, thisArg, partials, holders);
8532 var bindKey2 = baseRest(function(object, key, partials) {
8533 var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
8534 if (partials.length) {
8535 var holders = replaceHolders(partials, getHolder(bindKey2));
8536 bitmask |= WRAP_PARTIAL_FLAG;
8538 return createWrap(key, bitmask, object, partials, holders);
8540 function curry(func, arity, guard) {
8541 arity = guard ? undefined2 : arity;
8542 var result2 = createWrap(func, WRAP_CURRY_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8543 result2.placeholder = curry.placeholder;
8546 function curryRight(func, arity, guard) {
8547 arity = guard ? undefined2 : arity;
8548 var result2 = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined2, undefined2, undefined2, undefined2, undefined2, arity);
8549 result2.placeholder = curryRight.placeholder;
8552 function debounce2(func, wait, options2) {
8553 var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
8554 if (typeof func != "function") {
8555 throw new TypeError2(FUNC_ERROR_TEXT3);
8557 wait = toNumber3(wait) || 0;
8558 if (isObject2(options2)) {
8559 leading = !!options2.leading;
8560 maxing = "maxWait" in options2;
8561 maxWait = maxing ? nativeMax2(toNumber3(options2.maxWait) || 0, wait) : maxWait;
8562 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8564 function invokeFunc(time) {
8565 var args = lastArgs, thisArg = lastThis;
8566 lastArgs = lastThis = undefined2;
8567 lastInvokeTime = time;
8568 result2 = func.apply(thisArg, args);
8571 function leadingEdge(time) {
8572 lastInvokeTime = time;
8573 timerId = setTimeout2(timerExpired, wait);
8574 return leading ? invokeFunc(time) : result2;
8576 function remainingWait(time) {
8577 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
8578 return maxing ? nativeMin2(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
8580 function shouldInvoke(time) {
8581 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
8582 return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
8584 function timerExpired() {
8586 if (shouldInvoke(time)) {
8587 return trailingEdge(time);
8589 timerId = setTimeout2(timerExpired, remainingWait(time));
8591 function trailingEdge(time) {
8592 timerId = undefined2;
8593 if (trailing && lastArgs) {
8594 return invokeFunc(time);
8596 lastArgs = lastThis = undefined2;
8600 if (timerId !== undefined2) {
8601 clearTimeout2(timerId);
8604 lastArgs = lastCallTime = lastThis = timerId = undefined2;
8607 return timerId === undefined2 ? result2 : trailingEdge(now3());
8609 function debounced() {
8610 var time = now3(), isInvoking = shouldInvoke(time);
8611 lastArgs = arguments;
8613 lastCallTime = time;
8615 if (timerId === undefined2) {
8616 return leadingEdge(lastCallTime);
8619 clearTimeout2(timerId);
8620 timerId = setTimeout2(timerExpired, wait);
8621 return invokeFunc(lastCallTime);
8624 if (timerId === undefined2) {
8625 timerId = setTimeout2(timerExpired, wait);
8629 debounced.cancel = cancel;
8630 debounced.flush = flush;
8633 var defer = baseRest(function(func, args) {
8634 return baseDelay(func, 1, args);
8636 var delay = baseRest(function(func, wait, args) {
8637 return baseDelay(func, toNumber3(wait) || 0, args);
8639 function flip(func) {
8640 return createWrap(func, WRAP_FLIP_FLAG);
8642 function memoize(func, resolver) {
8643 if (typeof func != "function" || resolver != null && typeof resolver != "function") {
8644 throw new TypeError2(FUNC_ERROR_TEXT3);
8646 var memoized = function() {
8647 var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
8648 if (cache.has(key)) {
8649 return cache.get(key);
8651 var result2 = func.apply(this, args);
8652 memoized.cache = cache.set(key, result2) || cache;
8655 memoized.cache = new (memoize.Cache || MapCache2)();
8658 memoize.Cache = MapCache2;
8659 function negate(predicate) {
8660 if (typeof predicate != "function") {
8661 throw new TypeError2(FUNC_ERROR_TEXT3);
8664 var args = arguments;
8665 switch (args.length) {
8667 return !predicate.call(this);
8669 return !predicate.call(this, args[0]);
8671 return !predicate.call(this, args[0], args[1]);
8673 return !predicate.call(this, args[0], args[1], args[2]);
8675 return !predicate.apply(this, args);
8678 function once(func) {
8679 return before(2, func);
8681 var overArgs = castRest(function(func, transforms) {
8682 transforms = transforms.length == 1 && isArray2(transforms[0]) ? arrayMap2(transforms[0], baseUnary2(getIteratee())) : arrayMap2(baseFlatten(transforms, 1), baseUnary2(getIteratee()));
8683 var funcsLength = transforms.length;
8684 return baseRest(function(args) {
8685 var index = -1, length2 = nativeMin2(args.length, funcsLength);
8686 while (++index < length2) {
8687 args[index] = transforms[index].call(this, args[index]);
8689 return apply(func, this, args);
8692 var partial = baseRest(function(func, partials) {
8693 var holders = replaceHolders(partials, getHolder(partial));
8694 return createWrap(func, WRAP_PARTIAL_FLAG, undefined2, partials, holders);
8696 var partialRight = baseRest(function(func, partials) {
8697 var holders = replaceHolders(partials, getHolder(partialRight));
8698 return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined2, partials, holders);
8700 var rearg = flatRest(function(func, indexes) {
8701 return createWrap(func, WRAP_REARG_FLAG, undefined2, undefined2, undefined2, indexes);
8703 function rest(func, start2) {
8704 if (typeof func != "function") {
8705 throw new TypeError2(FUNC_ERROR_TEXT3);
8707 start2 = start2 === undefined2 ? start2 : toInteger(start2);
8708 return baseRest(func, start2);
8710 function spread(func, start2) {
8711 if (typeof func != "function") {
8712 throw new TypeError2(FUNC_ERROR_TEXT3);
8714 start2 = start2 == null ? 0 : nativeMax2(toInteger(start2), 0);
8715 return baseRest(function(args) {
8716 var array2 = args[start2], otherArgs = castSlice(args, 0, start2);
8718 arrayPush2(otherArgs, array2);
8720 return apply(func, this, otherArgs);
8723 function throttle2(func, wait, options2) {
8724 var leading = true, trailing = true;
8725 if (typeof func != "function") {
8726 throw new TypeError2(FUNC_ERROR_TEXT3);
8728 if (isObject2(options2)) {
8729 leading = "leading" in options2 ? !!options2.leading : leading;
8730 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
8732 return debounce2(func, wait, {
8735 "trailing": trailing
8738 function unary(func) {
8739 return ary(func, 1);
8741 function wrap2(value, wrapper) {
8742 return partial(castFunction(wrapper), value);
8744 function castArray() {
8745 if (!arguments.length) {
8748 var value = arguments[0];
8749 return isArray2(value) ? value : [value];
8751 function clone2(value) {
8752 return baseClone(value, CLONE_SYMBOLS_FLAG);
8754 function cloneWith(value, customizer) {
8755 customizer = typeof customizer == "function" ? customizer : undefined2;
8756 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
8758 function cloneDeep(value) {
8759 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
8761 function cloneDeepWith(value, customizer) {
8762 customizer = typeof customizer == "function" ? customizer : undefined2;
8763 return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
8765 function conformsTo(object, source) {
8766 return source == null || baseConformsTo(object, source, keys2(source));
8768 function eq2(value, other) {
8769 return value === other || value !== value && other !== other;
8771 var gt2 = createRelationalOperation(baseGt);
8772 var gte = createRelationalOperation(function(value, other) {
8773 return value >= other;
8775 var isArguments2 = baseIsArguments2(/* @__PURE__ */ function() {
8777 }()) ? baseIsArguments2 : function(value) {
8778 return isObjectLike2(value) && hasOwnProperty10.call(value, "callee") && !propertyIsEnumerable3.call(value, "callee");
8780 var isArray2 = Array2.isArray;
8781 var isArrayBuffer = nodeIsArrayBuffer ? baseUnary2(nodeIsArrayBuffer) : baseIsArrayBuffer;
8782 function isArrayLike2(value) {
8783 return value != null && isLength2(value.length) && !isFunction2(value);
8785 function isArrayLikeObject(value) {
8786 return isObjectLike2(value) && isArrayLike2(value);
8788 function isBoolean(value) {
8789 return value === true || value === false || isObjectLike2(value) && baseGetTag2(value) == boolTag3;
8791 var isBuffer2 = nativeIsBuffer2 || stubFalse2;
8792 var isDate = nodeIsDate ? baseUnary2(nodeIsDate) : baseIsDate;
8793 function isElement2(value) {
8794 return isObjectLike2(value) && value.nodeType === 1 && !isPlainObject(value);
8796 function isEmpty(value) {
8797 if (value == null) {
8800 if (isArrayLike2(value) && (isArray2(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer2(value) || isTypedArray2(value) || isArguments2(value))) {
8801 return !value.length;
8803 var tag2 = getTag2(value);
8804 if (tag2 == mapTag4 || tag2 == setTag4) {
8807 if (isPrototype2(value)) {
8808 return !baseKeys2(value).length;
8810 for (var key in value) {
8811 if (hasOwnProperty10.call(value, key)) {
8817 function isEqual4(value, other) {
8818 return baseIsEqual2(value, other);
8820 function isEqualWith(value, other, customizer) {
8821 customizer = typeof customizer == "function" ? customizer : undefined2;
8822 var result2 = customizer ? customizer(value, other) : undefined2;
8823 return result2 === undefined2 ? baseIsEqual2(value, other, undefined2, customizer) : !!result2;
8825 function isError(value) {
8826 if (!isObjectLike2(value)) {
8829 var tag2 = baseGetTag2(value);
8830 return tag2 == errorTag3 || tag2 == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
8832 function isFinite2(value) {
8833 return typeof value == "number" && nativeIsFinite(value);
8835 function isFunction2(value) {
8836 if (!isObject2(value)) {
8839 var tag2 = baseGetTag2(value);
8840 return tag2 == funcTag3 || tag2 == genTag2 || tag2 == asyncTag2 || tag2 == proxyTag2;
8842 function isInteger(value) {
8843 return typeof value == "number" && value == toInteger(value);
8845 function isLength2(value) {
8846 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER4;
8848 function isObject2(value) {
8849 var type2 = typeof value;
8850 return value != null && (type2 == "object" || type2 == "function");
8852 function isObjectLike2(value) {
8853 return value != null && typeof value == "object";
8855 var isMap = nodeIsMap ? baseUnary2(nodeIsMap) : baseIsMap;
8856 function isMatch(object, source) {
8857 return object === source || baseIsMatch(object, source, getMatchData(source));
8859 function isMatchWith(object, source, customizer) {
8860 customizer = typeof customizer == "function" ? customizer : undefined2;
8861 return baseIsMatch(object, source, getMatchData(source), customizer);
8863 function isNaN2(value) {
8864 return isNumber2(value) && value != +value;
8866 function isNative(value) {
8867 if (isMaskable(value)) {
8868 throw new Error2(CORE_ERROR_TEXT);
8870 return baseIsNative2(value);
8872 function isNull(value) {
8873 return value === null;
8875 function isNil(value) {
8876 return value == null;
8878 function isNumber2(value) {
8879 return typeof value == "number" || isObjectLike2(value) && baseGetTag2(value) == numberTag4;
8881 function isPlainObject(value) {
8882 if (!isObjectLike2(value) || baseGetTag2(value) != objectTag4) {
8885 var proto = getPrototype(value);
8886 if (proto === null) {
8889 var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor;
8890 return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString;
8892 var isRegExp = nodeIsRegExp ? baseUnary2(nodeIsRegExp) : baseIsRegExp;
8893 function isSafeInteger(value) {
8894 return isInteger(value) && value >= -MAX_SAFE_INTEGER4 && value <= MAX_SAFE_INTEGER4;
8896 var isSet = nodeIsSet ? baseUnary2(nodeIsSet) : baseIsSet;
8897 function isString(value) {
8898 return typeof value == "string" || !isArray2(value) && isObjectLike2(value) && baseGetTag2(value) == stringTag3;
8900 function isSymbol2(value) {
8901 return typeof value == "symbol" || isObjectLike2(value) && baseGetTag2(value) == symbolTag3;
8903 var isTypedArray2 = nodeIsTypedArray2 ? baseUnary2(nodeIsTypedArray2) : baseIsTypedArray2;
8904 function isUndefined(value) {
8905 return value === undefined2;
8907 function isWeakMap(value) {
8908 return isObjectLike2(value) && getTag2(value) == weakMapTag3;
8910 function isWeakSet(value) {
8911 return isObjectLike2(value) && baseGetTag2(value) == weakSetTag;
8913 var lt2 = createRelationalOperation(baseLt);
8914 var lte = createRelationalOperation(function(value, other) {
8915 return value <= other;
8917 function toArray(value) {
8921 if (isArrayLike2(value)) {
8922 return isString(value) ? stringToArray(value) : copyArray(value);
8924 if (symIterator && value[symIterator]) {
8925 return iteratorToArray(value[symIterator]());
8927 var tag2 = getTag2(value), func = tag2 == mapTag4 ? mapToArray2 : tag2 == setTag4 ? setToArray2 : values;
8930 function toFinite(value) {
8932 return value === 0 ? value : 0;
8934 value = toNumber3(value);
8935 if (value === INFINITY2 || value === -INFINITY2) {
8936 var sign2 = value < 0 ? -1 : 1;
8937 return sign2 * MAX_INTEGER;
8939 return value === value ? value : 0;
8941 function toInteger(value) {
8942 var result2 = toFinite(value), remainder = result2 % 1;
8943 return result2 === result2 ? remainder ? result2 - remainder : result2 : 0;
8945 function toLength(value) {
8946 return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
8948 function toNumber3(value) {
8949 if (typeof value == "number") {
8952 if (isSymbol2(value)) {
8955 if (isObject2(value)) {
8956 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
8957 value = isObject2(other) ? other + "" : other;
8959 if (typeof value != "string") {
8960 return value === 0 ? value : +value;
8962 value = baseTrim2(value);
8963 var isBinary = reIsBinary2.test(value);
8964 return isBinary || reIsOctal2.test(value) ? freeParseInt2(value.slice(2), isBinary ? 2 : 8) : reIsBadHex2.test(value) ? NAN2 : +value;
8966 function toPlainObject(value) {
8967 return copyObject(value, keysIn(value));
8969 function toSafeInteger(value) {
8970 return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER4, MAX_SAFE_INTEGER4) : value === 0 ? value : 0;
8972 function toString2(value) {
8973 return value == null ? "" : baseToString2(value);
8975 var assign = createAssigner(function(object, source) {
8976 if (isPrototype2(source) || isArrayLike2(source)) {
8977 copyObject(source, keys2(source), object);
8980 for (var key in source) {
8981 if (hasOwnProperty10.call(source, key)) {
8982 assignValue(object, key, source[key]);
8986 var assignIn = createAssigner(function(object, source) {
8987 copyObject(source, keysIn(source), object);
8989 var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
8990 copyObject(source, keysIn(source), object, customizer);
8992 var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
8993 copyObject(source, keys2(source), object, customizer);
8995 var at2 = flatRest(baseAt);
8996 function create2(prototype, properties) {
8997 var result2 = baseCreate(prototype);
8998 return properties == null ? result2 : baseAssign(result2, properties);
9000 var defaults = baseRest(function(object, sources) {
9001 object = Object2(object);
9003 var length2 = sources.length;
9004 var guard = length2 > 2 ? sources[2] : undefined2;
9005 if (guard && isIterateeCall(sources[0], sources[1], guard)) {
9008 while (++index < length2) {
9009 var source = sources[index];
9010 var props = keysIn(source);
9011 var propsIndex = -1;
9012 var propsLength = props.length;
9013 while (++propsIndex < propsLength) {
9014 var key = props[propsIndex];
9015 var value = object[key];
9016 if (value === undefined2 || eq2(value, objectProto13[key]) && !hasOwnProperty10.call(object, key)) {
9017 object[key] = source[key];
9023 var defaultsDeep = baseRest(function(args) {
9024 args.push(undefined2, customDefaultsMerge);
9025 return apply(mergeWith, undefined2, args);
9027 function findKey(object, predicate) {
9028 return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
9030 function findLastKey(object, predicate) {
9031 return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
9033 function forIn(object, iteratee2) {
9034 return object == null ? object : baseFor(object, getIteratee(iteratee2, 3), keysIn);
9036 function forInRight(object, iteratee2) {
9037 return object == null ? object : baseForRight(object, getIteratee(iteratee2, 3), keysIn);
9039 function forOwn(object, iteratee2) {
9040 return object && baseForOwn(object, getIteratee(iteratee2, 3));
9042 function forOwnRight(object, iteratee2) {
9043 return object && baseForOwnRight(object, getIteratee(iteratee2, 3));
9045 function functions(object) {
9046 return object == null ? [] : baseFunctions(object, keys2(object));
9048 function functionsIn(object) {
9049 return object == null ? [] : baseFunctions(object, keysIn(object));
9051 function get4(object, path, defaultValue) {
9052 var result2 = object == null ? undefined2 : baseGet(object, path);
9053 return result2 === undefined2 ? defaultValue : result2;
9055 function has(object, path) {
9056 return object != null && hasPath(object, path, baseHas);
9058 function hasIn(object, path) {
9059 return object != null && hasPath(object, path, baseHasIn);
9061 var invert = createInverter(function(result2, value, key) {
9062 if (value != null && typeof value.toString != "function") {
9063 value = nativeObjectToString3.call(value);
9065 result2[value] = key;
9066 }, constant(identity4));
9067 var invertBy = createInverter(function(result2, value, key) {
9068 if (value != null && typeof value.toString != "function") {
9069 value = nativeObjectToString3.call(value);
9071 if (hasOwnProperty10.call(result2, value)) {
9072 result2[value].push(key);
9074 result2[value] = [key];
9077 var invoke = baseRest(baseInvoke);
9078 function keys2(object) {
9079 return isArrayLike2(object) ? arrayLikeKeys2(object) : baseKeys2(object);
9081 function keysIn(object) {
9082 return isArrayLike2(object) ? arrayLikeKeys2(object, true) : baseKeysIn(object);
9084 function mapKeys(object, iteratee2) {
9086 iteratee2 = getIteratee(iteratee2, 3);
9087 baseForOwn(object, function(value, key, object2) {
9088 baseAssignValue(result2, iteratee2(value, key, object2), value);
9092 function mapValues(object, iteratee2) {
9094 iteratee2 = getIteratee(iteratee2, 3);
9095 baseForOwn(object, function(value, key, object2) {
9096 baseAssignValue(result2, key, iteratee2(value, key, object2));
9100 var merge2 = createAssigner(function(object, source, srcIndex) {
9101 baseMerge(object, source, srcIndex);
9103 var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
9104 baseMerge(object, source, srcIndex, customizer);
9106 var omit = flatRest(function(object, paths) {
9108 if (object == null) {
9112 paths = arrayMap2(paths, function(path) {
9113 path = castPath(path, object);
9114 isDeep || (isDeep = path.length > 1);
9117 copyObject(object, getAllKeysIn(object), result2);
9119 result2 = baseClone(result2, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
9121 var length2 = paths.length;
9123 baseUnset(result2, paths[length2]);
9127 function omitBy(object, predicate) {
9128 return pickBy(object, negate(getIteratee(predicate)));
9130 var pick = flatRest(function(object, paths) {
9131 return object == null ? {} : basePick(object, paths);
9133 function pickBy(object, predicate) {
9134 if (object == null) {
9137 var props = arrayMap2(getAllKeysIn(object), function(prop) {
9140 predicate = getIteratee(predicate);
9141 return basePickBy(object, props, function(value, path) {
9142 return predicate(value, path[0]);
9145 function result(object, path, defaultValue) {
9146 path = castPath(path, object);
9147 var index = -1, length2 = path.length;
9150 object = undefined2;
9152 while (++index < length2) {
9153 var value = object == null ? undefined2 : object[toKey(path[index])];
9154 if (value === undefined2) {
9156 value = defaultValue;
9158 object = isFunction2(value) ? value.call(object) : value;
9162 function set4(object, path, value) {
9163 return object == null ? object : baseSet(object, path, value);
9165 function setWith(object, path, value, customizer) {
9166 customizer = typeof customizer == "function" ? customizer : undefined2;
9167 return object == null ? object : baseSet(object, path, value, customizer);
9169 var toPairs = createToPairs(keys2);
9170 var toPairsIn = createToPairs(keysIn);
9171 function transform2(object, iteratee2, accumulator) {
9172 var isArr = isArray2(object), isArrLike = isArr || isBuffer2(object) || isTypedArray2(object);
9173 iteratee2 = getIteratee(iteratee2, 4);
9174 if (accumulator == null) {
9175 var Ctor = object && object.constructor;
9177 accumulator = isArr ? new Ctor() : [];
9178 } else if (isObject2(object)) {
9179 accumulator = isFunction2(Ctor) ? baseCreate(getPrototype(object)) : {};
9184 (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
9185 return iteratee2(accumulator, value, index, object2);
9189 function unset(object, path) {
9190 return object == null ? true : baseUnset(object, path);
9192 function update(object, path, updater) {
9193 return object == null ? object : baseUpdate(object, path, castFunction(updater));
9195 function updateWith(object, path, updater, customizer) {
9196 customizer = typeof customizer == "function" ? customizer : undefined2;
9197 return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
9199 function values(object) {
9200 return object == null ? [] : baseValues(object, keys2(object));
9202 function valuesIn(object) {
9203 return object == null ? [] : baseValues(object, keysIn(object));
9205 function clamp3(number3, lower2, upper) {
9206 if (upper === undefined2) {
9208 lower2 = undefined2;
9210 if (upper !== undefined2) {
9211 upper = toNumber3(upper);
9212 upper = upper === upper ? upper : 0;
9214 if (lower2 !== undefined2) {
9215 lower2 = toNumber3(lower2);
9216 lower2 = lower2 === lower2 ? lower2 : 0;
9218 return baseClamp(toNumber3(number3), lower2, upper);
9220 function inRange(number3, start2, end) {
9221 start2 = toFinite(start2);
9222 if (end === undefined2) {
9226 end = toFinite(end);
9228 number3 = toNumber3(number3);
9229 return baseInRange(number3, start2, end);
9231 function random(lower2, upper, floating) {
9232 if (floating && typeof floating != "boolean" && isIterateeCall(lower2, upper, floating)) {
9233 upper = floating = undefined2;
9235 if (floating === undefined2) {
9236 if (typeof upper == "boolean") {
9239 } else if (typeof lower2 == "boolean") {
9241 lower2 = undefined2;
9244 if (lower2 === undefined2 && upper === undefined2) {
9248 lower2 = toFinite(lower2);
9249 if (upper === undefined2) {
9253 upper = toFinite(upper);
9256 if (lower2 > upper) {
9261 if (floating || lower2 % 1 || upper % 1) {
9262 var rand = nativeRandom();
9263 return nativeMin2(lower2 + rand * (upper - lower2 + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
9265 return baseRandom(lower2, upper);
9267 var camelCase = createCompounder(function(result2, word, index) {
9268 word = word.toLowerCase();
9269 return result2 + (index ? capitalize(word) : word);
9271 function capitalize(string) {
9272 return upperFirst(toString2(string).toLowerCase());
9274 function deburr(string) {
9275 string = toString2(string);
9276 return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
9278 function endsWith(string, target, position) {
9279 string = toString2(string);
9280 target = baseToString2(target);
9281 var length2 = string.length;
9282 position = position === undefined2 ? length2 : baseClamp(toInteger(position), 0, length2);
9284 position -= target.length;
9285 return position >= 0 && string.slice(position, end) == target;
9287 function escape6(string) {
9288 string = toString2(string);
9289 return string && reHasUnescapedHtml2.test(string) ? string.replace(reUnescapedHtml2, escapeHtmlChar2) : string;
9291 function escapeRegExp(string) {
9292 string = toString2(string);
9293 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar2, "\\$&") : string;
9295 var kebabCase = createCompounder(function(result2, word, index) {
9296 return result2 + (index ? "-" : "") + word.toLowerCase();
9298 var lowerCase = createCompounder(function(result2, word, index) {
9299 return result2 + (index ? " " : "") + word.toLowerCase();
9301 var lowerFirst = createCaseFirst("toLowerCase");
9302 function pad2(string, length2, chars) {
9303 string = toString2(string);
9304 length2 = toInteger(length2);
9305 var strLength = length2 ? stringSize(string) : 0;
9306 if (!length2 || strLength >= length2) {
9309 var mid = (length2 - strLength) / 2;
9310 return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
9312 function padEnd(string, length2, chars) {
9313 string = toString2(string);
9314 length2 = toInteger(length2);
9315 var strLength = length2 ? stringSize(string) : 0;
9316 return length2 && strLength < length2 ? string + createPadding(length2 - strLength, chars) : string;
9318 function padStart(string, length2, chars) {
9319 string = toString2(string);
9320 length2 = toInteger(length2);
9321 var strLength = length2 ? stringSize(string) : 0;
9322 return length2 && strLength < length2 ? createPadding(length2 - strLength, chars) + string : string;
9324 function parseInt2(string, radix, guard) {
9325 if (guard || radix == null) {
9330 return nativeParseInt(toString2(string).replace(reTrimStart2, ""), radix || 0);
9332 function repeat(string, n3, guard) {
9333 if (guard ? isIterateeCall(string, n3, guard) : n3 === undefined2) {
9338 return baseRepeat(toString2(string), n3);
9340 function replace() {
9341 var args = arguments, string = toString2(args[0]);
9342 return args.length < 3 ? string : string.replace(args[1], args[2]);
9344 var snakeCase = createCompounder(function(result2, word, index) {
9345 return result2 + (index ? "_" : "") + word.toLowerCase();
9347 function split(string, separator, limit) {
9348 if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
9349 separator = limit = undefined2;
9351 limit = limit === undefined2 ? MAX_ARRAY_LENGTH : limit >>> 0;
9355 string = toString2(string);
9356 if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
9357 separator = baseToString2(separator);
9358 if (!separator && hasUnicode(string)) {
9359 return castSlice(stringToArray(string), 0, limit);
9362 return string.split(separator, limit);
9364 var startCase = createCompounder(function(result2, word, index) {
9365 return result2 + (index ? " " : "") + upperFirst(word);
9367 function startsWith(string, target, position) {
9368 string = toString2(string);
9369 position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
9370 target = baseToString2(target);
9371 return string.slice(position, position + target.length) == target;
9373 function template(string, options2, guard) {
9374 var settings = lodash.templateSettings;
9375 if (guard && isIterateeCall(string, options2, guard)) {
9376 options2 = undefined2;
9378 string = toString2(string);
9379 options2 = assignInWith({}, options2, settings, customDefaultsAssignIn);
9380 var imports = assignInWith({}, options2.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys2(imports), importsValues = baseValues(imports, importsKeys);
9381 var isEscaping, isEvaluating, index = 0, interpolate = options2.interpolate || reNoMatch, source = "__p += '";
9382 var reDelimiters = RegExp2(
9383 (options2.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options2.evaluate || reNoMatch).source + "|$",
9386 var sourceURL = "//# sourceURL=" + (hasOwnProperty10.call(options2, "sourceURL") ? (options2.sourceURL + "").replace(/\s/g, " ") : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
9387 string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
9388 interpolateValue || (interpolateValue = esTemplateValue);
9389 source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
9392 source += "' +\n__e(" + escapeValue + ") +\n'";
9394 if (evaluateValue) {
9395 isEvaluating = true;
9396 source += "';\n" + evaluateValue + ";\n__p += '";
9398 if (interpolateValue) {
9399 source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
9401 index = offset + match.length;
9405 var variable = hasOwnProperty10.call(options2, "variable") && options2.variable;
9407 source = "with (obj) {\n" + source + "\n}\n";
9408 } else if (reForbiddenIdentifierChars.test(variable)) {
9409 throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
9411 source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
9412 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}";
9413 var result2 = attempt(function() {
9414 return Function2(importsKeys, sourceURL + "return " + source).apply(undefined2, importsValues);
9416 result2.source = source;
9417 if (isError(result2)) {
9422 function toLower(value) {
9423 return toString2(value).toLowerCase();
9425 function toUpper(value) {
9426 return toString2(value).toUpperCase();
9428 function trim(string, chars, guard) {
9429 string = toString2(string);
9430 if (string && (guard || chars === undefined2)) {
9431 return baseTrim2(string);
9433 if (!string || !(chars = baseToString2(chars))) {
9436 var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start2 = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
9437 return castSlice(strSymbols, start2, end).join("");
9439 function trimEnd(string, chars, guard) {
9440 string = toString2(string);
9441 if (string && (guard || chars === undefined2)) {
9442 return string.slice(0, trimmedEndIndex2(string) + 1);
9444 if (!string || !(chars = baseToString2(chars))) {
9447 var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
9448 return castSlice(strSymbols, 0, end).join("");
9450 function trimStart(string, chars, guard) {
9451 string = toString2(string);
9452 if (string && (guard || chars === undefined2)) {
9453 return string.replace(reTrimStart2, "");
9455 if (!string || !(chars = baseToString2(chars))) {
9458 var strSymbols = stringToArray(string), start2 = charsStartIndex(strSymbols, stringToArray(chars));
9459 return castSlice(strSymbols, start2).join("");
9461 function truncate(string, options2) {
9462 var length2 = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
9463 if (isObject2(options2)) {
9464 var separator = "separator" in options2 ? options2.separator : separator;
9465 length2 = "length" in options2 ? toInteger(options2.length) : length2;
9466 omission = "omission" in options2 ? baseToString2(options2.omission) : omission;
9468 string = toString2(string);
9469 var strLength = string.length;
9470 if (hasUnicode(string)) {
9471 var strSymbols = stringToArray(string);
9472 strLength = strSymbols.length;
9474 if (length2 >= strLength) {
9477 var end = length2 - stringSize(omission);
9481 var result2 = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
9482 if (separator === undefined2) {
9483 return result2 + omission;
9486 end += result2.length - end;
9488 if (isRegExp(separator)) {
9489 if (string.slice(end).search(separator)) {
9490 var match, substring = result2;
9491 if (!separator.global) {
9492 separator = RegExp2(separator.source, toString2(reFlags.exec(separator)) + "g");
9494 separator.lastIndex = 0;
9495 while (match = separator.exec(substring)) {
9496 var newEnd = match.index;
9498 result2 = result2.slice(0, newEnd === undefined2 ? end : newEnd);
9500 } else if (string.indexOf(baseToString2(separator), end) != end) {
9501 var index = result2.lastIndexOf(separator);
9503 result2 = result2.slice(0, index);
9506 return result2 + omission;
9508 function unescape2(string) {
9509 string = toString2(string);
9510 return string && reHasEscapedHtml2.test(string) ? string.replace(reEscapedHtml2, unescapeHtmlChar2) : string;
9512 var upperCase = createCompounder(function(result2, word, index) {
9513 return result2 + (index ? " " : "") + word.toUpperCase();
9515 var upperFirst = createCaseFirst("toUpperCase");
9516 function words(string, pattern, guard) {
9517 string = toString2(string);
9518 pattern = guard ? undefined2 : pattern;
9519 if (pattern === undefined2) {
9520 return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
9522 return string.match(pattern) || [];
9524 var attempt = baseRest(function(func, args) {
9526 return apply(func, undefined2, args);
9528 return isError(e3) ? e3 : new Error2(e3);
9531 var bindAll = flatRest(function(object, methodNames) {
9532 arrayEach(methodNames, function(key) {
9534 baseAssignValue(object, key, bind(object[key], object));
9538 function cond(pairs2) {
9539 var length2 = pairs2 == null ? 0 : pairs2.length, toIteratee = getIteratee();
9540 pairs2 = !length2 ? [] : arrayMap2(pairs2, function(pair3) {
9541 if (typeof pair3[1] != "function") {
9542 throw new TypeError2(FUNC_ERROR_TEXT3);
9544 return [toIteratee(pair3[0]), pair3[1]];
9546 return baseRest(function(args) {
9548 while (++index < length2) {
9549 var pair3 = pairs2[index];
9550 if (apply(pair3[0], this, args)) {
9551 return apply(pair3[1], this, args);
9556 function conforms(source) {
9557 return baseConforms(baseClone(source, CLONE_DEEP_FLAG));
9559 function constant(value) {
9564 function defaultTo(value, defaultValue) {
9565 return value == null || value !== value ? defaultValue : value;
9567 var flow = createFlow();
9568 var flowRight = createFlow(true);
9569 function identity4(value) {
9572 function iteratee(func) {
9573 return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG));
9575 function matches(source) {
9576 return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
9578 function matchesProperty(path, srcValue) {
9579 return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
9581 var method = baseRest(function(path, args) {
9582 return function(object) {
9583 return baseInvoke(object, path, args);
9586 var methodOf = baseRest(function(object, args) {
9587 return function(path) {
9588 return baseInvoke(object, path, args);
9591 function mixin(object, source, options2) {
9592 var props = keys2(source), methodNames = baseFunctions(source, props);
9593 if (options2 == null && !(isObject2(source) && (methodNames.length || !props.length))) {
9597 methodNames = baseFunctions(source, keys2(source));
9599 var chain2 = !(isObject2(options2) && "chain" in options2) || !!options2.chain, isFunc = isFunction2(object);
9600 arrayEach(methodNames, function(methodName) {
9601 var func = source[methodName];
9602 object[methodName] = func;
9604 object.prototype[methodName] = function() {
9605 var chainAll = this.__chain__;
9606 if (chain2 || chainAll) {
9607 var result2 = object(this.__wrapped__), actions = result2.__actions__ = copyArray(this.__actions__);
9608 actions.push({ "func": func, "args": arguments, "thisArg": object });
9609 result2.__chain__ = chainAll;
9612 return func.apply(object, arrayPush2([this.value()], arguments));
9618 function noConflict() {
9619 if (root3._ === this) {
9626 function nthArg(n3) {
9628 return baseRest(function(args) {
9629 return baseNth(args, n3);
9632 var over = createOver(arrayMap2);
9633 var overEvery = createOver(arrayEvery);
9634 var overSome = createOver(arraySome2);
9635 function property(path) {
9636 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
9638 function propertyOf(object) {
9639 return function(path) {
9640 return object == null ? undefined2 : baseGet(object, path);
9643 var range3 = createRange();
9644 var rangeRight = createRange(true);
9645 function stubArray2() {
9648 function stubFalse2() {
9651 function stubObject() {
9654 function stubString() {
9657 function stubTrue() {
9660 function times(n3, iteratee2) {
9662 if (n3 < 1 || n3 > MAX_SAFE_INTEGER4) {
9665 var index = MAX_ARRAY_LENGTH, length2 = nativeMin2(n3, MAX_ARRAY_LENGTH);
9666 iteratee2 = getIteratee(iteratee2);
9667 n3 -= MAX_ARRAY_LENGTH;
9668 var result2 = baseTimes2(length2, iteratee2);
9669 while (++index < n3) {
9674 function toPath(value) {
9675 if (isArray2(value)) {
9676 return arrayMap2(value, toKey);
9678 return isSymbol2(value) ? [value] : copyArray(stringToPath(toString2(value)));
9680 function uniqueId(prefix) {
9681 var id2 = ++idCounter;
9682 return toString2(prefix) + id2;
9684 var add = createMathOperation(function(augend, addend) {
9685 return augend + addend;
9687 var ceil = createRound("ceil");
9688 var divide = createMathOperation(function(dividend, divisor) {
9689 return dividend / divisor;
9691 var floor = createRound("floor");
9692 function max3(array2) {
9693 return array2 && array2.length ? baseExtremum(array2, identity4, baseGt) : undefined2;
9695 function maxBy(array2, iteratee2) {
9696 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseGt) : undefined2;
9698 function mean(array2) {
9699 return baseMean(array2, identity4);
9701 function meanBy(array2, iteratee2) {
9702 return baseMean(array2, getIteratee(iteratee2, 2));
9704 function min3(array2) {
9705 return array2 && array2.length ? baseExtremum(array2, identity4, baseLt) : undefined2;
9707 function minBy(array2, iteratee2) {
9708 return array2 && array2.length ? baseExtremum(array2, getIteratee(iteratee2, 2), baseLt) : undefined2;
9710 var multiply = createMathOperation(function(multiplier, multiplicand) {
9711 return multiplier * multiplicand;
9713 var round = createRound("round");
9714 var subtract = createMathOperation(function(minuend, subtrahend) {
9715 return minuend - subtrahend;
9717 function sum(array2) {
9718 return array2 && array2.length ? baseSum(array2, identity4) : 0;
9720 function sumBy(array2, iteratee2) {
9721 return array2 && array2.length ? baseSum(array2, getIteratee(iteratee2, 2)) : 0;
9723 lodash.after = after;
9725 lodash.assign = assign;
9726 lodash.assignIn = assignIn;
9727 lodash.assignInWith = assignInWith;
9728 lodash.assignWith = assignWith;
9730 lodash.before = before;
9732 lodash.bindAll = bindAll;
9733 lodash.bindKey = bindKey2;
9734 lodash.castArray = castArray;
9735 lodash.chain = chain;
9736 lodash.chunk = chunk;
9737 lodash.compact = compact;
9738 lodash.concat = concat;
9740 lodash.conforms = conforms;
9741 lodash.constant = constant;
9742 lodash.countBy = countBy;
9743 lodash.create = create2;
9744 lodash.curry = curry;
9745 lodash.curryRight = curryRight;
9746 lodash.debounce = debounce2;
9747 lodash.defaults = defaults;
9748 lodash.defaultsDeep = defaultsDeep;
9749 lodash.defer = defer;
9750 lodash.delay = delay;
9751 lodash.difference = difference2;
9752 lodash.differenceBy = differenceBy;
9753 lodash.differenceWith = differenceWith;
9755 lodash.dropRight = dropRight;
9756 lodash.dropRightWhile = dropRightWhile;
9757 lodash.dropWhile = dropWhile;
9759 lodash.filter = filter2;
9760 lodash.flatMap = flatMap;
9761 lodash.flatMapDeep = flatMapDeep;
9762 lodash.flatMapDepth = flatMapDepth;
9763 lodash.flatten = flatten2;
9764 lodash.flattenDeep = flattenDeep;
9765 lodash.flattenDepth = flattenDepth;
9768 lodash.flowRight = flowRight;
9769 lodash.fromPairs = fromPairs;
9770 lodash.functions = functions;
9771 lodash.functionsIn = functionsIn;
9772 lodash.groupBy = groupBy;
9773 lodash.initial = initial;
9774 lodash.intersection = intersection2;
9775 lodash.intersectionBy = intersectionBy;
9776 lodash.intersectionWith = intersectionWith;
9777 lodash.invert = invert;
9778 lodash.invertBy = invertBy;
9779 lodash.invokeMap = invokeMap;
9780 lodash.iteratee = iteratee;
9781 lodash.keyBy = keyBy;
9782 lodash.keys = keys2;
9783 lodash.keysIn = keysIn;
9785 lodash.mapKeys = mapKeys;
9786 lodash.mapValues = mapValues;
9787 lodash.matches = matches;
9788 lodash.matchesProperty = matchesProperty;
9789 lodash.memoize = memoize;
9790 lodash.merge = merge2;
9791 lodash.mergeWith = mergeWith;
9792 lodash.method = method;
9793 lodash.methodOf = methodOf;
9794 lodash.mixin = mixin;
9795 lodash.negate = negate;
9796 lodash.nthArg = nthArg;
9798 lodash.omitBy = omitBy;
9800 lodash.orderBy = orderBy;
9802 lodash.overArgs = overArgs;
9803 lodash.overEvery = overEvery;
9804 lodash.overSome = overSome;
9805 lodash.partial = partial;
9806 lodash.partialRight = partialRight;
9807 lodash.partition = partition;
9809 lodash.pickBy = pickBy;
9810 lodash.property = property;
9811 lodash.propertyOf = propertyOf;
9813 lodash.pullAll = pullAll;
9814 lodash.pullAllBy = pullAllBy;
9815 lodash.pullAllWith = pullAllWith;
9816 lodash.pullAt = pullAt;
9817 lodash.range = range3;
9818 lodash.rangeRight = rangeRight;
9819 lodash.rearg = rearg;
9820 lodash.reject = reject;
9821 lodash.remove = remove2;
9823 lodash.reverse = reverse;
9824 lodash.sampleSize = sampleSize;
9826 lodash.setWith = setWith;
9827 lodash.shuffle = shuffle;
9828 lodash.slice = slice;
9829 lodash.sortBy = sortBy;
9830 lodash.sortedUniq = sortedUniq;
9831 lodash.sortedUniqBy = sortedUniqBy;
9832 lodash.split = split;
9833 lodash.spread = spread;
9836 lodash.takeRight = takeRight;
9837 lodash.takeRightWhile = takeRightWhile;
9838 lodash.takeWhile = takeWhile;
9840 lodash.throttle = throttle2;
9842 lodash.toArray = toArray;
9843 lodash.toPairs = toPairs;
9844 lodash.toPairsIn = toPairsIn;
9845 lodash.toPath = toPath;
9846 lodash.toPlainObject = toPlainObject;
9847 lodash.transform = transform2;
9848 lodash.unary = unary;
9849 lodash.union = union2;
9850 lodash.unionBy = unionBy;
9851 lodash.unionWith = unionWith;
9853 lodash.uniqBy = uniqBy;
9854 lodash.uniqWith = uniqWith;
9855 lodash.unset = unset;
9856 lodash.unzip = unzip;
9857 lodash.unzipWith = unzipWith;
9858 lodash.update = update;
9859 lodash.updateWith = updateWith;
9860 lodash.values = values;
9861 lodash.valuesIn = valuesIn;
9862 lodash.without = without;
9863 lodash.words = words;
9864 lodash.wrap = wrap2;
9866 lodash.xorBy = xorBy;
9867 lodash.xorWith = xorWith;
9869 lodash.zipObject = zipObject;
9870 lodash.zipObjectDeep = zipObjectDeep;
9871 lodash.zipWith = zipWith;
9872 lodash.entries = toPairs;
9873 lodash.entriesIn = toPairsIn;
9874 lodash.extend = assignIn;
9875 lodash.extendWith = assignInWith;
9876 mixin(lodash, lodash);
9878 lodash.attempt = attempt;
9879 lodash.camelCase = camelCase;
9880 lodash.capitalize = capitalize;
9882 lodash.clamp = clamp3;
9883 lodash.clone = clone2;
9884 lodash.cloneDeep = cloneDeep;
9885 lodash.cloneDeepWith = cloneDeepWith;
9886 lodash.cloneWith = cloneWith;
9887 lodash.conformsTo = conformsTo;
9888 lodash.deburr = deburr;
9889 lodash.defaultTo = defaultTo;
9890 lodash.divide = divide;
9891 lodash.endsWith = endsWith;
9893 lodash.escape = escape6;
9894 lodash.escapeRegExp = escapeRegExp;
9895 lodash.every = every;
9896 lodash.find = find2;
9897 lodash.findIndex = findIndex;
9898 lodash.findKey = findKey;
9899 lodash.findLast = findLast;
9900 lodash.findLastIndex = findLastIndex;
9901 lodash.findLastKey = findLastKey;
9902 lodash.floor = floor;
9903 lodash.forEach = forEach;
9904 lodash.forEachRight = forEachRight;
9905 lodash.forIn = forIn;
9906 lodash.forInRight = forInRight;
9907 lodash.forOwn = forOwn;
9908 lodash.forOwnRight = forOwnRight;
9913 lodash.hasIn = hasIn;
9915 lodash.identity = identity4;
9916 lodash.includes = includes;
9917 lodash.indexOf = indexOf;
9918 lodash.inRange = inRange;
9919 lodash.invoke = invoke;
9920 lodash.isArguments = isArguments2;
9921 lodash.isArray = isArray2;
9922 lodash.isArrayBuffer = isArrayBuffer;
9923 lodash.isArrayLike = isArrayLike2;
9924 lodash.isArrayLikeObject = isArrayLikeObject;
9925 lodash.isBoolean = isBoolean;
9926 lodash.isBuffer = isBuffer2;
9927 lodash.isDate = isDate;
9928 lodash.isElement = isElement2;
9929 lodash.isEmpty = isEmpty;
9930 lodash.isEqual = isEqual4;
9931 lodash.isEqualWith = isEqualWith;
9932 lodash.isError = isError;
9933 lodash.isFinite = isFinite2;
9934 lodash.isFunction = isFunction2;
9935 lodash.isInteger = isInteger;
9936 lodash.isLength = isLength2;
9937 lodash.isMap = isMap;
9938 lodash.isMatch = isMatch;
9939 lodash.isMatchWith = isMatchWith;
9940 lodash.isNaN = isNaN2;
9941 lodash.isNative = isNative;
9942 lodash.isNil = isNil;
9943 lodash.isNull = isNull;
9944 lodash.isNumber = isNumber2;
9945 lodash.isObject = isObject2;
9946 lodash.isObjectLike = isObjectLike2;
9947 lodash.isPlainObject = isPlainObject;
9948 lodash.isRegExp = isRegExp;
9949 lodash.isSafeInteger = isSafeInteger;
9950 lodash.isSet = isSet;
9951 lodash.isString = isString;
9952 lodash.isSymbol = isSymbol2;
9953 lodash.isTypedArray = isTypedArray2;
9954 lodash.isUndefined = isUndefined;
9955 lodash.isWeakMap = isWeakMap;
9956 lodash.isWeakSet = isWeakSet;
9958 lodash.kebabCase = kebabCase;
9960 lodash.lastIndexOf = lastIndexOf;
9961 lodash.lowerCase = lowerCase;
9962 lodash.lowerFirst = lowerFirst;
9966 lodash.maxBy = maxBy;
9968 lodash.meanBy = meanBy;
9970 lodash.minBy = minBy;
9971 lodash.stubArray = stubArray2;
9972 lodash.stubFalse = stubFalse2;
9973 lodash.stubObject = stubObject;
9974 lodash.stubString = stubString;
9975 lodash.stubTrue = stubTrue;
9976 lodash.multiply = multiply;
9978 lodash.noConflict = noConflict;
9979 lodash.noop = noop3;
9982 lodash.padEnd = padEnd;
9983 lodash.padStart = padStart;
9984 lodash.parseInt = parseInt2;
9985 lodash.random = random;
9986 lodash.reduce = reduce;
9987 lodash.reduceRight = reduceRight;
9988 lodash.repeat = repeat;
9989 lodash.replace = replace;
9990 lodash.result = result;
9991 lodash.round = round;
9992 lodash.runInContext = runInContext2;
9993 lodash.sample = sample;
9995 lodash.snakeCase = snakeCase;
9997 lodash.sortedIndex = sortedIndex;
9998 lodash.sortedIndexBy = sortedIndexBy;
9999 lodash.sortedIndexOf = sortedIndexOf;
10000 lodash.sortedLastIndex = sortedLastIndex;
10001 lodash.sortedLastIndexBy = sortedLastIndexBy;
10002 lodash.sortedLastIndexOf = sortedLastIndexOf;
10003 lodash.startCase = startCase;
10004 lodash.startsWith = startsWith;
10005 lodash.subtract = subtract;
10007 lodash.sumBy = sumBy;
10008 lodash.template = template;
10009 lodash.times = times;
10010 lodash.toFinite = toFinite;
10011 lodash.toInteger = toInteger;
10012 lodash.toLength = toLength;
10013 lodash.toLower = toLower;
10014 lodash.toNumber = toNumber3;
10015 lodash.toSafeInteger = toSafeInteger;
10016 lodash.toString = toString2;
10017 lodash.toUpper = toUpper;
10018 lodash.trim = trim;
10019 lodash.trimEnd = trimEnd;
10020 lodash.trimStart = trimStart;
10021 lodash.truncate = truncate;
10022 lodash.unescape = unescape2;
10023 lodash.uniqueId = uniqueId;
10024 lodash.upperCase = upperCase;
10025 lodash.upperFirst = upperFirst;
10026 lodash.each = forEach;
10027 lodash.eachRight = forEachRight;
10028 lodash.first = head;
10029 mixin(lodash, function() {
10031 baseForOwn(lodash, function(func, methodName) {
10032 if (!hasOwnProperty10.call(lodash.prototype, methodName)) {
10033 source[methodName] = func;
10037 }(), { "chain": false });
10038 lodash.VERSION = VERSION;
10039 arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
10040 lodash[methodName].placeholder = lodash;
10042 arrayEach(["drop", "take"], function(methodName, index) {
10043 LazyWrapper.prototype[methodName] = function(n3) {
10044 n3 = n3 === undefined2 ? 1 : nativeMax2(toInteger(n3), 0);
10045 var result2 = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
10046 if (result2.__filtered__) {
10047 result2.__takeCount__ = nativeMin2(n3, result2.__takeCount__);
10049 result2.__views__.push({
10050 "size": nativeMin2(n3, MAX_ARRAY_LENGTH),
10051 "type": methodName + (result2.__dir__ < 0 ? "Right" : "")
10056 LazyWrapper.prototype[methodName + "Right"] = function(n3) {
10057 return this.reverse()[methodName](n3).reverse();
10060 arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
10061 var type2 = index + 1, isFilter = type2 == LAZY_FILTER_FLAG || type2 == LAZY_WHILE_FLAG;
10062 LazyWrapper.prototype[methodName] = function(iteratee2) {
10063 var result2 = this.clone();
10064 result2.__iteratees__.push({
10065 "iteratee": getIteratee(iteratee2, 3),
10068 result2.__filtered__ = result2.__filtered__ || isFilter;
10072 arrayEach(["head", "last"], function(methodName, index) {
10073 var takeName = "take" + (index ? "Right" : "");
10074 LazyWrapper.prototype[methodName] = function() {
10075 return this[takeName](1).value()[0];
10078 arrayEach(["initial", "tail"], function(methodName, index) {
10079 var dropName = "drop" + (index ? "" : "Right");
10080 LazyWrapper.prototype[methodName] = function() {
10081 return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
10084 LazyWrapper.prototype.compact = function() {
10085 return this.filter(identity4);
10087 LazyWrapper.prototype.find = function(predicate) {
10088 return this.filter(predicate).head();
10090 LazyWrapper.prototype.findLast = function(predicate) {
10091 return this.reverse().find(predicate);
10093 LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
10094 if (typeof path == "function") {
10095 return new LazyWrapper(this);
10097 return this.map(function(value) {
10098 return baseInvoke(value, path, args);
10101 LazyWrapper.prototype.reject = function(predicate) {
10102 return this.filter(negate(getIteratee(predicate)));
10104 LazyWrapper.prototype.slice = function(start2, end) {
10105 start2 = toInteger(start2);
10106 var result2 = this;
10107 if (result2.__filtered__ && (start2 > 0 || end < 0)) {
10108 return new LazyWrapper(result2);
10111 result2 = result2.takeRight(-start2);
10112 } else if (start2) {
10113 result2 = result2.drop(start2);
10115 if (end !== undefined2) {
10116 end = toInteger(end);
10117 result2 = end < 0 ? result2.dropRight(-end) : result2.take(end - start2);
10121 LazyWrapper.prototype.takeRightWhile = function(predicate) {
10122 return this.reverse().takeWhile(predicate).reverse();
10124 LazyWrapper.prototype.toArray = function() {
10125 return this.take(MAX_ARRAY_LENGTH);
10127 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10128 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);
10132 lodash.prototype[methodName] = function() {
10133 var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee2 = args[0], useLazy = isLazy || isArray2(value);
10134 var interceptor = function(value2) {
10135 var result3 = lodashFunc.apply(lodash, arrayPush2([value2], args));
10136 return isTaker && chainAll ? result3[0] : result3;
10138 if (useLazy && checkIteratee && typeof iteratee2 == "function" && iteratee2.length != 1) {
10139 isLazy = useLazy = false;
10141 var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
10142 if (!retUnwrapped && useLazy) {
10143 value = onlyLazy ? value : new LazyWrapper(this);
10144 var result2 = func.apply(value, args);
10145 result2.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": undefined2 });
10146 return new LodashWrapper(result2, chainAll);
10148 if (isUnwrapped && onlyLazy) {
10149 return func.apply(this, args);
10151 result2 = this.thru(interceptor);
10152 return isUnwrapped ? isTaker ? result2.value()[0] : result2.value() : result2;
10155 arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
10156 var func = arrayProto2[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
10157 lodash.prototype[methodName] = function() {
10158 var args = arguments;
10159 if (retUnwrapped && !this.__chain__) {
10160 var value = this.value();
10161 return func.apply(isArray2(value) ? value : [], args);
10163 return this[chainName](function(value2) {
10164 return func.apply(isArray2(value2) ? value2 : [], args);
10168 baseForOwn(LazyWrapper.prototype, function(func, methodName) {
10169 var lodashFunc = lodash[methodName];
10171 var key = lodashFunc.name + "";
10172 if (!hasOwnProperty10.call(realNames, key)) {
10173 realNames[key] = [];
10175 realNames[key].push({ "name": methodName, "func": lodashFunc });
10178 realNames[createHybrid(undefined2, WRAP_BIND_KEY_FLAG).name] = [{
10182 LazyWrapper.prototype.clone = lazyClone;
10183 LazyWrapper.prototype.reverse = lazyReverse;
10184 LazyWrapper.prototype.value = lazyValue;
10185 lodash.prototype.at = wrapperAt;
10186 lodash.prototype.chain = wrapperChain;
10187 lodash.prototype.commit = wrapperCommit;
10188 lodash.prototype.next = wrapperNext;
10189 lodash.prototype.plant = wrapperPlant;
10190 lodash.prototype.reverse = wrapperReverse;
10191 lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = wrapperValue;
10192 lodash.prototype.first = lodash.prototype.head;
10194 lodash.prototype[symIterator] = wrapperToIterator;
10198 var _2 = runInContext();
10199 if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
10201 define(function() {
10204 } else if (freeModule3) {
10205 (freeModule3.exports = _2)._ = _2;
10206 freeExports3._ = _2;
10214 // node_modules/fast-deep-equal/index.js
10215 var require_fast_deep_equal = __commonJS({
10216 "node_modules/fast-deep-equal/index.js"(exports2, module2) {
10218 module2.exports = function equal(a2, b2) {
10219 if (a2 === b2) return true;
10220 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") {
10221 if (a2.constructor !== b2.constructor) return false;
10222 var length2, i3, keys2;
10223 if (Array.isArray(a2)) {
10224 length2 = a2.length;
10225 if (length2 != b2.length) return false;
10226 for (i3 = length2; i3-- !== 0; )
10227 if (!equal(a2[i3], b2[i3])) return false;
10230 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags;
10231 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf();
10232 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString();
10233 keys2 = Object.keys(a2);
10234 length2 = keys2.length;
10235 if (length2 !== Object.keys(b2).length) return false;
10236 for (i3 = length2; i3-- !== 0; )
10237 if (!Object.prototype.hasOwnProperty.call(b2, keys2[i3])) return false;
10238 for (i3 = length2; i3-- !== 0; ) {
10239 var key = keys2[i3];
10240 if (!equal(a2[key], b2[key])) return false;
10244 return a2 !== a2 && b2 !== b2;
10249 // node_modules/fast-json-stable-stringify/index.js
10250 var require_fast_json_stable_stringify = __commonJS({
10251 "node_modules/fast-json-stable-stringify/index.js"(exports2, module2) {
10253 module2.exports = function(data, opts) {
10254 if (!opts) opts = {};
10255 if (typeof opts === "function") opts = { cmp: opts };
10256 var cycles = typeof opts.cycles === "boolean" ? opts.cycles : false;
10257 var cmp = opts.cmp && /* @__PURE__ */ function(f2) {
10258 return function(node) {
10259 return function(a2, b2) {
10260 var aobj = { key: a2, value: node[a2] };
10261 var bobj = { key: b2, value: node[b2] };
10262 return f2(aobj, bobj);
10267 return function stringify3(node) {
10268 if (node && node.toJSON && typeof node.toJSON === "function") {
10269 node = node.toJSON();
10271 if (node === void 0) return;
10272 if (typeof node == "number") return isFinite(node) ? "" + node : "null";
10273 if (typeof node !== "object") return JSON.stringify(node);
10275 if (Array.isArray(node)) {
10277 for (i3 = 0; i3 < node.length; i3++) {
10278 if (i3) out += ",";
10279 out += stringify3(node[i3]) || "null";
10283 if (node === null) return "null";
10284 if (seen.indexOf(node) !== -1) {
10285 if (cycles) return JSON.stringify("__cycle__");
10286 throw new TypeError("Converting circular structure to JSON");
10288 var seenIndex = seen.push(node) - 1;
10289 var keys2 = Object.keys(node).sort(cmp && cmp(node));
10291 for (i3 = 0; i3 < keys2.length; i3++) {
10292 var key = keys2[i3];
10293 var value = stringify3(node[key]);
10294 if (!value) continue;
10295 if (out) out += ",";
10296 out += JSON.stringify(key) + ":" + value;
10298 seen.splice(seenIndex, 1);
10299 return "{" + out + "}";
10305 // node_modules/@mapbox/sexagesimal/index.js
10306 var require_sexagesimal = __commonJS({
10307 "node_modules/@mapbox/sexagesimal/index.js"(exports2, module2) {
10308 module2.exports = element;
10309 module2.exports.pair = pair3;
10310 module2.exports.format = format2;
10311 module2.exports.formatPair = formatPair;
10312 module2.exports.coordToDMS = coordToDMS;
10313 function element(input, dims) {
10314 var result = search(input, dims);
10315 return result === null ? null : result.val;
10317 function formatPair(input) {
10318 return format2(input.lat, "lat") + " " + format2(input.lon, "lon");
10320 function format2(input, dim) {
10321 var dms = coordToDMS(input, dim);
10322 return dms.whole + "\xB0 " + (dms.minutes ? dms.minutes + "' " : "") + (dms.seconds ? dms.seconds + '" ' : "") + dms.dir;
10324 function coordToDMS(input, dim) {
10325 var dirs = { lat: ["N", "S"], lon: ["E", "W"] }[dim] || "";
10326 var dir = dirs[input >= 0 ? 0 : 1];
10327 var abs3 = Math.abs(input);
10328 var whole = Math.floor(abs3);
10329 var fraction = abs3 - whole;
10330 var fractionMinutes = fraction * 60;
10331 var minutes = Math.floor(fractionMinutes);
10332 var seconds = Math.floor((fractionMinutes - minutes) * 60);
10340 function search(input, dims) {
10341 if (!dims) dims = "NSEW";
10342 if (typeof input !== "string") return null;
10343 input = input.toUpperCase();
10344 var regex = /^[\s\,]*([NSEW])?\s*([\-|\—|\―]?[0-9.]+)[°º˚]?\s*(?:([0-9.]+)['’′‘]\s*)?(?:([0-9.]+)(?:''|"|”|″)\s*)?([NSEW])?/;
10345 var m2 = input.match(regex);
10346 if (!m2) return null;
10347 var matched = m2[0];
10349 if (m2[1] && m2[5]) {
10351 matched = matched.slice(0, -1);
10353 dim = m2[1] || m2[5];
10355 if (dim && dims.indexOf(dim) === -1) return null;
10356 var deg = m2[2] ? parseFloat(m2[2]) : 0;
10357 var min3 = m2[3] ? parseFloat(m2[3]) / 60 : 0;
10358 var sec = m2[4] ? parseFloat(m2[4]) / 3600 : 0;
10359 var sign2 = deg < 0 ? -1 : 1;
10360 if (dim === "S" || dim === "W") sign2 *= -1;
10362 val: (Math.abs(deg) + min3 + sec) * sign2,
10365 remain: input.slice(matched.length)
10368 function pair3(input, dims) {
10369 input = input.trim();
10370 var one2 = search(input, dims);
10371 if (!one2) return null;
10372 input = one2.remain.trim();
10373 var two = search(input, dims);
10374 if (!two || two.remain) return null;
10376 return swapdim(one2.val, two.val, one2.dim);
10378 return [one2.val, two.val];
10381 function swapdim(a2, b2, dim) {
10382 if (dim === "N" || dim === "S") return [a2, b2];
10383 if (dim === "W" || dim === "E") return [b2, a2];
10388 // node_modules/polygon-clipping/dist/polygon-clipping.umd.js
10389 var require_polygon_clipping_umd = __commonJS({
10390 "node_modules/polygon-clipping/dist/polygon-clipping.umd.js"(exports2, module2) {
10391 (function(global2, factory) {
10392 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());
10393 })(exports2, function() {
10395 function __generator(thisArg, body) {
10399 if (t2[0] & 1) throw t2[1];
10409 }, typeof Symbol === "function" && (g3[Symbol.iterator] = function() {
10412 function verb(n3) {
10413 return function(v2) {
10414 return step([n3, v2]);
10417 function step(op) {
10418 if (f2) throw new TypeError("Generator is already executing.");
10420 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) return t2;
10421 if (y2 = 0, t2) op = [op[0] & 2, t2.value];
10443 if (!(t2 = _2.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) {
10447 if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) {
10451 if (op[0] === 6 && _2.label < t2[1]) {
10456 if (t2 && _2.label < t2[2]) {
10461 if (t2[2]) _2.ops.pop();
10465 op = body.call(thisArg, _2);
10472 if (op[0] & 5) throw op[1];
10474 value: op[0] ? op[1] : void 0,
10481 /* @__PURE__ */ function() {
10482 function Node2(key, data) {
10492 function DEFAULT_COMPARE(a2, b2) {
10493 return a2 > b2 ? 1 : a2 < b2 ? -1 : 0;
10495 function splay(i3, t2, comparator) {
10496 var N2 = new Node(null, null);
10500 var cmp2 = comparator(i3, t2.key);
10502 if (t2.left === null) break;
10503 if (comparator(i3, t2.left.key) < 0) {
10505 t2.left = y2.right;
10508 if (t2.left === null) break;
10513 } else if (cmp2 > 0) {
10514 if (t2.right === null) break;
10515 if (comparator(i3, t2.right.key) > 0) {
10517 t2.right = y2.left;
10520 if (t2.right === null) break;
10527 l2.right = t2.left;
10528 r2.left = t2.right;
10529 t2.left = N2.right;
10530 t2.right = N2.left;
10533 function insert(i3, data, t2, comparator) {
10534 var node = new Node(i3, data);
10536 node.left = node.right = null;
10539 t2 = splay(i3, t2, comparator);
10540 var cmp2 = comparator(i3, t2.key);
10542 node.left = t2.left;
10545 } else if (cmp2 >= 0) {
10546 node.right = t2.right;
10552 function split(key, v2, comparator) {
10556 v2 = splay(key, v2, comparator);
10557 var cmp2 = comparator(v2.key, key);
10561 } else if (cmp2 < 0) {
10576 function merge2(left, right, comparator) {
10577 if (right === null) return left;
10578 if (left === null) return right;
10579 right = splay(left.key, right, comparator);
10583 function printRow(root3, prefix, isTail, out, printNode) {
10585 out("" + prefix + (isTail ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ") + printNode(root3) + "\n");
10586 var indent = prefix + (isTail ? " " : "\u2502 ");
10587 if (root3.left) printRow(root3.left, indent, false, out, printNode);
10588 if (root3.right) printRow(root3.right, indent, true, out, printNode);
10594 function Tree2(comparator) {
10595 if (comparator === void 0) {
10596 comparator = DEFAULT_COMPARE;
10600 this._comparator = comparator;
10602 Tree2.prototype.insert = function(key, data) {
10604 return this._root = insert(key, data, this._root, this._comparator);
10606 Tree2.prototype.add = function(key, data) {
10607 var node = new Node(key, data);
10608 if (this._root === null) {
10609 node.left = node.right = null;
10613 var comparator = this._comparator;
10614 var t2 = splay(key, this._root, comparator);
10615 var cmp2 = comparator(key, t2.key);
10616 if (cmp2 === 0) this._root = t2;
10619 node.left = t2.left;
10622 } else if (cmp2 > 0) {
10623 node.right = t2.right;
10632 Tree2.prototype.remove = function(key) {
10633 this._root = this._remove(key, this._root, this._comparator);
10635 Tree2.prototype._remove = function(i3, t2, comparator) {
10637 if (t2 === null) return null;
10638 t2 = splay(i3, t2, comparator);
10639 var cmp2 = comparator(i3, t2.key);
10641 if (t2.left === null) {
10644 x2 = splay(i3, t2.left, comparator);
10645 x2.right = t2.right;
10652 Tree2.prototype.pop = function() {
10653 var node = this._root;
10655 while (node.left) node = node.left;
10656 this._root = splay(node.key, this._root, this._comparator);
10657 this._root = this._remove(node.key, this._root, this._comparator);
10665 Tree2.prototype.findStatic = function(key) {
10666 var current = this._root;
10667 var compare2 = this._comparator;
10669 var cmp2 = compare2(key, current.key);
10670 if (cmp2 === 0) return current;
10671 else if (cmp2 < 0) current = current.left;
10672 else current = current.right;
10676 Tree2.prototype.find = function(key) {
10678 this._root = splay(key, this._root, this._comparator);
10679 if (this._comparator(key, this._root.key) !== 0) return null;
10683 Tree2.prototype.contains = function(key) {
10684 var current = this._root;
10685 var compare2 = this._comparator;
10687 var cmp2 = compare2(key, current.key);
10688 if (cmp2 === 0) return true;
10689 else if (cmp2 < 0) current = current.left;
10690 else current = current.right;
10694 Tree2.prototype.forEach = function(visitor, ctx) {
10695 var current = this._root;
10699 if (current !== null) {
10701 current = current.left;
10703 if (Q2.length !== 0) {
10704 current = Q2.pop();
10705 visitor.call(ctx, current);
10706 current = current.right;
10707 } else done = true;
10712 Tree2.prototype.range = function(low, high, fn, ctx) {
10714 var compare2 = this._comparator;
10715 var node = this._root;
10717 while (Q2.length !== 0 || node) {
10723 cmp2 = compare2(node.key, high);
10726 } else if (compare2(node.key, low) >= 0) {
10727 if (fn.call(ctx, node)) return this;
10734 Tree2.prototype.keys = function() {
10736 this.forEach(function(_a3) {
10738 return keys2.push(key);
10742 Tree2.prototype.values = function() {
10744 this.forEach(function(_a3) {
10745 var data = _a3.data;
10746 return values.push(data);
10750 Tree2.prototype.min = function() {
10751 if (this._root) return this.minNode(this._root).key;
10754 Tree2.prototype.max = function() {
10755 if (this._root) return this.maxNode(this._root).key;
10758 Tree2.prototype.minNode = function(t2) {
10759 if (t2 === void 0) {
10762 if (t2) while (t2.left) t2 = t2.left;
10765 Tree2.prototype.maxNode = function(t2) {
10766 if (t2 === void 0) {
10769 if (t2) while (t2.right) t2 = t2.right;
10772 Tree2.prototype.at = function(index2) {
10773 var current = this._root;
10780 current = current.left;
10782 if (Q2.length > 0) {
10783 current = Q2.pop();
10784 if (i3 === index2) return current;
10786 current = current.right;
10787 } else done = true;
10792 Tree2.prototype.next = function(d2) {
10793 var root3 = this._root;
10794 var successor = null;
10796 successor = d2.right;
10797 while (successor.left) successor = successor.left;
10800 var comparator = this._comparator;
10802 var cmp2 = comparator(d2.key, root3.key);
10803 if (cmp2 === 0) break;
10804 else if (cmp2 < 0) {
10806 root3 = root3.left;
10807 } else root3 = root3.right;
10811 Tree2.prototype.prev = function(d2) {
10812 var root3 = this._root;
10813 var predecessor = null;
10814 if (d2.left !== null) {
10815 predecessor = d2.left;
10816 while (predecessor.right) predecessor = predecessor.right;
10817 return predecessor;
10819 var comparator = this._comparator;
10821 var cmp2 = comparator(d2.key, root3.key);
10822 if (cmp2 === 0) break;
10823 else if (cmp2 < 0) root3 = root3.left;
10825 predecessor = root3;
10826 root3 = root3.right;
10829 return predecessor;
10831 Tree2.prototype.clear = function() {
10836 Tree2.prototype.toList = function() {
10837 return toList(this._root);
10839 Tree2.prototype.load = function(keys2, values, presort) {
10840 if (values === void 0) {
10843 if (presort === void 0) {
10846 var size = keys2.length;
10847 var comparator = this._comparator;
10848 if (presort) sort(keys2, values, 0, size - 1, comparator);
10849 if (this._root === null) {
10850 this._root = loadRecursive(keys2, values, 0, size);
10853 var mergedList = mergeLists(this.toList(), createList(keys2, values), comparator);
10854 size = this._size + size;
10855 this._root = sortedListToBST({
10861 Tree2.prototype.isEmpty = function() {
10862 return this._root === null;
10864 Object.defineProperty(Tree2.prototype, "size", {
10871 Object.defineProperty(Tree2.prototype, "root", {
10878 Tree2.prototype.toString = function(printNode) {
10879 if (printNode === void 0) {
10880 printNode = function(n3) {
10881 return String(n3.key);
10885 printRow(this._root, "", true, function(v2) {
10886 return out.push(v2);
10888 return out.join("");
10890 Tree2.prototype.update = function(key, newKey, newData) {
10891 var comparator = this._comparator;
10892 var _a3 = split(key, this._root, comparator), left = _a3.left, right = _a3.right;
10893 if (comparator(key, newKey) < 0) {
10894 right = insert(newKey, newData, right, comparator);
10896 left = insert(newKey, newData, left, comparator);
10898 this._root = merge2(left, right, comparator);
10900 Tree2.prototype.split = function(key) {
10901 return split(key, this._root, this._comparator);
10903 Tree2.prototype[Symbol.iterator] = function() {
10904 var current, Q2, done;
10905 return __generator(this, function(_a3) {
10906 switch (_a3.label) {
10908 current = this._root;
10913 if (!!done) return [3, 6];
10914 if (!(current !== null)) return [3, 2];
10916 current = current.left;
10919 if (!(Q2.length !== 0)) return [3, 4];
10920 current = Q2.pop();
10921 return [4, current];
10924 current = current.right;
10942 function loadRecursive(keys2, values, start2, end) {
10943 var size = end - start2;
10945 var middle = start2 + Math.floor(size / 2);
10946 var key = keys2[middle];
10947 var data = values[middle];
10948 var node = new Node(key, data);
10949 node.left = loadRecursive(keys2, values, start2, middle);
10950 node.right = loadRecursive(keys2, values, middle + 1, end);
10955 function createList(keys2, values) {
10956 var head = new Node(null, null);
10958 for (var i3 = 0; i3 < keys2.length; i3++) {
10959 p2 = p2.next = new Node(keys2[i3], values[i3]);
10964 function toList(root3) {
10965 var current = root3;
10968 var head = new Node(null, null);
10973 current = current.left;
10975 if (Q2.length > 0) {
10976 current = p2 = p2.next = Q2.pop();
10977 current = current.right;
10978 } else done = true;
10984 function sortedListToBST(list2, start2, end) {
10985 var size = end - start2;
10987 var middle = start2 + Math.floor(size / 2);
10988 var left = sortedListToBST(list2, start2, middle);
10989 var root3 = list2.head;
10991 list2.head = list2.head.next;
10992 root3.right = sortedListToBST(list2, middle + 1, end);
10997 function mergeLists(l1, l2, compare2) {
10998 var head = new Node(null, null);
11002 while (p1 !== null && p22 !== null) {
11003 if (compare2(p1.key, p22.key) < 0) {
11014 } else if (p22 !== null) {
11019 function sort(keys2, values, left, right, compare2) {
11020 if (left >= right) return;
11021 var pivot = keys2[left + right >> 1];
11023 var j2 = right + 1;
11027 while (compare2(keys2[i3], pivot) < 0);
11030 while (compare2(keys2[j2], pivot) > 0);
11031 if (i3 >= j2) break;
11032 var tmp = keys2[i3];
11033 keys2[i3] = keys2[j2];
11036 values[i3] = values[j2];
11039 sort(keys2, values, left, j2, compare2);
11040 sort(keys2, values, j2 + 1, right, compare2);
11042 const isInBbox2 = (bbox2, point) => {
11043 return bbox2.ll.x <= point.x && point.x <= bbox2.ur.x && bbox2.ll.y <= point.y && point.y <= bbox2.ur.y;
11045 const getBboxOverlap2 = (b1, b2) => {
11046 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) return null;
11047 const lowerX = b1.ll.x < b2.ll.x ? b2.ll.x : b1.ll.x;
11048 const upperX = b1.ur.x < b2.ur.x ? b1.ur.x : b2.ur.x;
11049 const lowerY = b1.ll.y < b2.ll.y ? b2.ll.y : b1.ll.y;
11050 const upperY = b1.ur.y < b2.ur.y ? b1.ur.y : b2.ur.y;
11062 let epsilon$1 = Number.EPSILON;
11063 if (epsilon$1 === void 0) epsilon$1 = Math.pow(2, -52);
11064 const EPSILON_SQ = epsilon$1 * epsilon$1;
11065 const cmp = (a2, b2) => {
11066 if (-epsilon$1 < a2 && a2 < epsilon$1) {
11067 if (-epsilon$1 < b2 && b2 < epsilon$1) {
11071 const ab = a2 - b2;
11072 if (ab * ab < EPSILON_SQ * a2 * b2) {
11075 return a2 < b2 ? -1 : 1;
11082 this.xRounder = new CoordRounder();
11083 this.yRounder = new CoordRounder();
11087 x: this.xRounder.round(x2),
11088 y: this.yRounder.round(y2)
11092 class CoordRounder {
11094 this.tree = new Tree();
11097 // Note: this can rounds input values backwards or forwards.
11098 // You might ask, why not restrict this to just rounding
11099 // forwards? Wouldn't that allow left endpoints to always
11100 // remain left endpoints during splitting (never change to
11101 // right). No - it wouldn't, because we snap intersections
11102 // to endpoints (to establish independence from the segment
11103 // angle for t-intersections).
11105 const node = this.tree.add(coord2);
11106 const prevNode = this.tree.prev(node);
11107 if (prevNode !== null && cmp(node.key, prevNode.key) === 0) {
11108 this.tree.remove(coord2);
11109 return prevNode.key;
11111 const nextNode = this.tree.next(node);
11112 if (nextNode !== null && cmp(node.key, nextNode.key) === 0) {
11113 this.tree.remove(coord2);
11114 return nextNode.key;
11119 const rounder = new PtRounder();
11120 const epsilon3 = 11102230246251565e-32;
11121 const splitter = 134217729;
11122 const resulterrbound = (3 + 8 * epsilon3) * epsilon3;
11123 function sum(elen, e3, flen, f2, h2) {
11124 let Q2, Qnew, hh, bvirt;
11129 if (fnow > enow === fnow > -enow) {
11131 enow = e3[++eindex];
11134 fnow = f2[++findex];
11137 if (eindex < elen && findex < flen) {
11138 if (fnow > enow === fnow > -enow) {
11140 hh = Q2 - (Qnew - enow);
11141 enow = e3[++eindex];
11144 hh = Q2 - (Qnew - fnow);
11145 fnow = f2[++findex];
11151 while (eindex < elen && findex < flen) {
11152 if (fnow > enow === fnow > -enow) {
11155 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
11156 enow = e3[++eindex];
11160 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
11161 fnow = f2[++findex];
11169 while (eindex < elen) {
11172 hh = Q2 - (Qnew - bvirt) + (enow - bvirt);
11173 enow = e3[++eindex];
11179 while (findex < flen) {
11182 hh = Q2 - (Qnew - bvirt) + (fnow - bvirt);
11183 fnow = f2[++findex];
11189 if (Q2 !== 0 || hindex === 0) {
11194 function estimate(elen, e3) {
11196 for (let i3 = 1; i3 < elen; i3++) Q2 += e3[i3];
11200 return new Float64Array(n3);
11202 const ccwerrboundA = (3 + 16 * epsilon3) * epsilon3;
11203 const ccwerrboundB = (2 + 12 * epsilon3) * epsilon3;
11204 const ccwerrboundC = (9 + 64 * epsilon3) * epsilon3 * epsilon3;
11207 const C2 = vec(12);
11208 const D2 = vec(16);
11210 function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
11211 let acxtail, acytail, bcxtail, bcytail;
11212 let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t1, t0, u3;
11213 const acx = ax - cx;
11214 const bcx = bx - cx;
11215 const acy = ay - cy;
11216 const bcy = by - cy;
11218 c2 = splitter * acx;
11219 ahi = c2 - (c2 - acx);
11221 c2 = splitter * bcy;
11222 bhi = c2 - (c2 - bcy);
11224 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11226 c2 = splitter * acy;
11227 ahi = c2 - (c2 - acy);
11229 c2 = splitter * bcx;
11230 bhi = c2 - (c2 - bcx);
11232 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11235 B2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11238 _0 = s1 - (_j - bvirt) + (_i - bvirt);
11241 B2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11244 B2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11246 let det = estimate(4, B2);
11247 let errbound = ccwerrboundB * detsum;
11248 if (det >= errbound || -det >= errbound) {
11252 acxtail = ax - (acx + bvirt) + (bvirt - cx);
11254 bcxtail = bx - (bcx + bvirt) + (bvirt - cx);
11256 acytail = ay - (acy + bvirt) + (bvirt - cy);
11258 bcytail = by - (bcy + bvirt) + (bvirt - cy);
11259 if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) {
11262 errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det);
11263 det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail);
11264 if (det >= errbound || -det >= errbound) return det;
11265 s1 = acxtail * bcy;
11266 c2 = splitter * acxtail;
11267 ahi = c2 - (c2 - acxtail);
11268 alo = acxtail - ahi;
11269 c2 = splitter * bcy;
11270 bhi = c2 - (c2 - bcy);
11272 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11273 t1 = acytail * bcx;
11274 c2 = splitter * acytail;
11275 ahi = c2 - (c2 - acytail);
11276 alo = acytail - ahi;
11277 c2 = splitter * bcx;
11278 bhi = c2 - (c2 - bcx);
11280 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11283 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11286 _0 = s1 - (_j - bvirt) + (_i - bvirt);
11289 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11292 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11294 const C1len = sum(4, B2, 4, u2, C1);
11295 s1 = acx * bcytail;
11296 c2 = splitter * acx;
11297 ahi = c2 - (c2 - acx);
11299 c2 = splitter * bcytail;
11300 bhi = c2 - (c2 - bcytail);
11301 blo = bcytail - bhi;
11302 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11303 t1 = acy * bcxtail;
11304 c2 = splitter * acy;
11305 ahi = c2 - (c2 - acy);
11307 c2 = splitter * bcxtail;
11308 bhi = c2 - (c2 - bcxtail);
11309 blo = bcxtail - bhi;
11310 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11313 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11316 _0 = s1 - (_j - bvirt) + (_i - bvirt);
11319 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11322 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11324 const C2len = sum(C1len, C1, 4, u2, C2);
11325 s1 = acxtail * bcytail;
11326 c2 = splitter * acxtail;
11327 ahi = c2 - (c2 - acxtail);
11328 alo = acxtail - ahi;
11329 c2 = splitter * bcytail;
11330 bhi = c2 - (c2 - bcytail);
11331 blo = bcytail - bhi;
11332 s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo);
11333 t1 = acytail * bcxtail;
11334 c2 = splitter * acytail;
11335 ahi = c2 - (c2 - acytail);
11336 alo = acytail - ahi;
11337 c2 = splitter * bcxtail;
11338 bhi = c2 - (c2 - bcxtail);
11339 blo = bcxtail - bhi;
11340 t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
11343 u2[0] = s0 - (_i + bvirt) + (bvirt - t0);
11346 _0 = s1 - (_j - bvirt) + (_i - bvirt);
11349 u2[1] = _0 - (_i + bvirt) + (bvirt - t1);
11352 u2[2] = _j - (u3 - bvirt) + (_i - bvirt);
11354 const Dlen = sum(C2len, C2, 4, u2, D2);
11355 return D2[Dlen - 1];
11357 function orient2d(ax, ay, bx, by, cx, cy) {
11358 const detleft = (ay - cy) * (bx - cx);
11359 const detright = (ax - cx) * (by - cy);
11360 const det = detleft - detright;
11361 const detsum = Math.abs(detleft + detright);
11362 if (Math.abs(det) >= ccwerrboundA * detsum) return det;
11363 return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum);
11365 const crossProduct2 = (a2, b2) => a2.x * b2.y - a2.y * b2.x;
11366 const dotProduct2 = (a2, b2) => a2.x * b2.x + a2.y * b2.y;
11367 const compareVectorAngles = (basePt, endPt1, endPt2) => {
11368 const res = orient2d(basePt.x, basePt.y, endPt1.x, endPt1.y, endPt2.x, endPt2.y);
11369 if (res > 0) return -1;
11370 if (res < 0) return 1;
11373 const length2 = (v2) => Math.sqrt(dotProduct2(v2, v2));
11374 const sineOfAngle2 = (pShared, pBase, pAngle) => {
11376 x: pBase.x - pShared.x,
11377 y: pBase.y - pShared.y
11380 x: pAngle.x - pShared.x,
11381 y: pAngle.y - pShared.y
11383 return crossProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
11385 const cosineOfAngle2 = (pShared, pBase, pAngle) => {
11387 x: pBase.x - pShared.x,
11388 y: pBase.y - pShared.y
11391 x: pAngle.x - pShared.x,
11392 y: pAngle.y - pShared.y
11394 return dotProduct2(vAngle, vBase) / length2(vAngle) / length2(vBase);
11396 const horizontalIntersection2 = (pt2, v2, y2) => {
11397 if (v2.y === 0) return null;
11399 x: pt2.x + v2.x / v2.y * (y2 - pt2.y),
11403 const verticalIntersection2 = (pt2, v2, x2) => {
11404 if (v2.x === 0) return null;
11407 y: pt2.y + v2.y / v2.x * (x2 - pt2.x)
11410 const intersection$1 = (pt1, v1, pt2, v2) => {
11411 if (v1.x === 0) return verticalIntersection2(pt2, v2, pt1.x);
11412 if (v2.x === 0) return verticalIntersection2(pt1, v1, pt2.x);
11413 if (v1.y === 0) return horizontalIntersection2(pt2, v2, pt1.y);
11414 if (v2.y === 0) return horizontalIntersection2(pt1, v1, pt2.y);
11415 const kross = crossProduct2(v1, v2);
11416 if (kross == 0) return null;
11421 const d1 = crossProduct2(ve2, v1) / kross;
11422 const d2 = crossProduct2(ve2, v2) / kross;
11423 const x12 = pt1.x + d2 * v1.x, x2 = pt2.x + d1 * v2.x;
11424 const y12 = pt1.y + d2 * v1.y, y2 = pt2.y + d1 * v2.y;
11425 const x3 = (x12 + x2) / 2;
11426 const y3 = (y12 + y2) / 2;
11432 class SweepEvent2 {
11433 // for ordering sweep events in the sweep event queue
11434 static compare(a2, b2) {
11435 const ptCmp = SweepEvent2.comparePoints(a2.point, b2.point);
11436 if (ptCmp !== 0) return ptCmp;
11437 if (a2.point !== b2.point) a2.link(b2);
11438 if (a2.isLeft !== b2.isLeft) return a2.isLeft ? 1 : -1;
11439 return Segment2.compare(a2.segment, b2.segment);
11441 // for ordering points in sweep line order
11442 static comparePoints(aPt, bPt) {
11443 if (aPt.x < bPt.x) return -1;
11444 if (aPt.x > bPt.x) return 1;
11445 if (aPt.y < bPt.y) return -1;
11446 if (aPt.y > bPt.y) return 1;
11449 // Warning: 'point' input will be modified and re-used (for performance)
11450 constructor(point, isLeft) {
11451 if (point.events === void 0) point.events = [this];
11452 else point.events.push(this);
11453 this.point = point;
11454 this.isLeft = isLeft;
11457 if (other.point === this.point) {
11458 throw new Error("Tried to link already linked events");
11460 const otherEvents = other.point.events;
11461 for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
11462 const evt = otherEvents[i3];
11463 this.point.events.push(evt);
11464 evt.point = this.point;
11466 this.checkForConsuming();
11468 /* Do a pass over our linked events and check to see if any pair
11469 * of segments match, and should be consumed. */
11470 checkForConsuming() {
11471 const numEvents = this.point.events.length;
11472 for (let i3 = 0; i3 < numEvents; i3++) {
11473 const evt1 = this.point.events[i3];
11474 if (evt1.segment.consumedBy !== void 0) continue;
11475 for (let j2 = i3 + 1; j2 < numEvents; j2++) {
11476 const evt2 = this.point.events[j2];
11477 if (evt2.consumedBy !== void 0) continue;
11478 if (evt1.otherSE.point.events !== evt2.otherSE.point.events) continue;
11479 evt1.segment.consume(evt2.segment);
11483 getAvailableLinkedEvents() {
11485 for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
11486 const evt = this.point.events[i3];
11487 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
11494 * Returns a comparator function for sorting linked events that will
11495 * favor the event that will give us the smallest left-side angle.
11496 * All ring construction starts as low as possible heading to the right,
11497 * so by always turning left as sharp as possible we'll get polygons
11498 * without uncessary loops & holes.
11500 * The comparator function has a compute cache such that it avoids
11501 * re-computing already-computed values.
11503 getLeftmostComparator(baseEvent) {
11504 const cache = /* @__PURE__ */ new Map();
11505 const fillCache = (linkedEvent) => {
11506 const nextEvent = linkedEvent.otherSE;
11507 cache.set(linkedEvent, {
11508 sine: sineOfAngle2(this.point, baseEvent.point, nextEvent.point),
11509 cosine: cosineOfAngle2(this.point, baseEvent.point, nextEvent.point)
11512 return (a2, b2) => {
11513 if (!cache.has(a2)) fillCache(a2);
11514 if (!cache.has(b2)) fillCache(b2);
11523 if (asine >= 0 && bsine >= 0) {
11524 if (acosine < bcosine) return 1;
11525 if (acosine > bcosine) return -1;
11528 if (asine < 0 && bsine < 0) {
11529 if (acosine < bcosine) return -1;
11530 if (acosine > bcosine) return 1;
11533 if (bsine < asine) return -1;
11534 if (bsine > asine) return 1;
11539 let segmentId2 = 0;
11541 /* This compare() function is for ordering segments in the sweep
11542 * line tree, and does so according to the following criteria:
11544 * Consider the vertical line that lies an infinestimal step to the
11545 * right of the right-more of the two left endpoints of the input
11546 * segments. Imagine slowly moving a point up from negative infinity
11547 * in the increasing y direction. Which of the two segments will that
11548 * point intersect first? That segment comes 'before' the other one.
11550 * If neither segment would be intersected by such a line, (if one
11551 * or more of the segments are vertical) then the line to be considered
11552 * is directly on the right-more of the two left inputs.
11554 static compare(a2, b2) {
11555 const alx = a2.leftSE.point.x;
11556 const blx = b2.leftSE.point.x;
11557 const arx = a2.rightSE.point.x;
11558 const brx = b2.rightSE.point.x;
11559 if (brx < alx) return 1;
11560 if (arx < blx) return -1;
11561 const aly = a2.leftSE.point.y;
11562 const bly = b2.leftSE.point.y;
11563 const ary = a2.rightSE.point.y;
11564 const bry = b2.rightSE.point.y;
11566 if (bly < aly && bly < ary) return 1;
11567 if (bly > aly && bly > ary) return -1;
11568 const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
11569 if (aCmpBLeft < 0) return 1;
11570 if (aCmpBLeft > 0) return -1;
11571 const bCmpARight = b2.comparePoint(a2.rightSE.point);
11572 if (bCmpARight !== 0) return bCmpARight;
11576 if (aly < bly && aly < bry) return -1;
11577 if (aly > bly && aly > bry) return 1;
11578 const bCmpALeft = b2.comparePoint(a2.leftSE.point);
11579 if (bCmpALeft !== 0) return bCmpALeft;
11580 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
11581 if (aCmpBRight < 0) return 1;
11582 if (aCmpBRight > 0) return -1;
11585 if (aly < bly) return -1;
11586 if (aly > bly) return 1;
11588 const bCmpARight = b2.comparePoint(a2.rightSE.point);
11589 if (bCmpARight !== 0) return bCmpARight;
11592 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
11593 if (aCmpBRight < 0) return 1;
11594 if (aCmpBRight > 0) return -1;
11597 const ay = ary - aly;
11598 const ax = arx - alx;
11599 const by = bry - bly;
11600 const bx = brx - blx;
11601 if (ay > ax && by < bx) return 1;
11602 if (ay < ax && by > bx) return -1;
11604 if (arx > brx) return 1;
11605 if (arx < brx) return -1;
11606 if (ary < bry) return -1;
11607 if (ary > bry) return 1;
11608 if (a2.id < b2.id) return -1;
11609 if (a2.id > b2.id) return 1;
11612 /* Warning: a reference to ringWindings input will be stored,
11613 * and possibly will be later modified */
11614 constructor(leftSE, rightSE, rings, windings) {
11615 this.id = ++segmentId2;
11616 this.leftSE = leftSE;
11617 leftSE.segment = this;
11618 leftSE.otherSE = rightSE;
11619 this.rightSE = rightSE;
11620 rightSE.segment = this;
11621 rightSE.otherSE = leftSE;
11622 this.rings = rings;
11623 this.windings = windings;
11625 static fromRing(pt1, pt2, ring) {
11626 let leftPt, rightPt, winding;
11627 const cmpPts = SweepEvent2.comparePoints(pt1, pt2);
11632 } else if (cmpPts > 0) {
11636 } else throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
11637 const leftSE = new SweepEvent2(leftPt, true);
11638 const rightSE = new SweepEvent2(rightPt, false);
11639 return new Segment2(leftSE, rightSE, [ring], [winding]);
11641 /* When a segment is split, the rightSE is replaced with a new sweep event */
11642 replaceRightSE(newRightSE) {
11643 this.rightSE = newRightSE;
11644 this.rightSE.segment = this;
11645 this.rightSE.otherSE = this.leftSE;
11646 this.leftSE.otherSE = this.rightSE;
11649 const y12 = this.leftSE.point.y;
11650 const y2 = this.rightSE.point.y;
11653 x: this.leftSE.point.x,
11654 y: y12 < y2 ? y12 : y2
11657 x: this.rightSE.point.x,
11658 y: y12 > y2 ? y12 : y2
11662 /* A vector from the left point to the right */
11665 x: this.rightSE.point.x - this.leftSE.point.x,
11666 y: this.rightSE.point.y - this.leftSE.point.y
11669 isAnEndpoint(pt2) {
11670 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;
11672 /* Compare this segment with a point.
11674 * A point P is considered to be colinear to a segment if there
11675 * exists a distance D such that if we travel along the segment
11676 * from one * endpoint towards the other a distance D, we find
11677 * ourselves at point P.
11679 * Return value indicates:
11681 * 1: point lies above the segment (to the left of vertical)
11682 * 0: point is colinear to segment
11683 * -1: point lies below the segment (to the right of vertical)
11685 comparePoint(point) {
11686 if (this.isAnEndpoint(point)) return 0;
11687 const lPt = this.leftSE.point;
11688 const rPt = this.rightSE.point;
11689 const v2 = this.vector();
11690 if (lPt.x === rPt.x) {
11691 if (point.x === lPt.x) return 0;
11692 return point.x < lPt.x ? 1 : -1;
11694 const yDist = (point.y - lPt.y) / v2.y;
11695 const xFromYDist = lPt.x + yDist * v2.x;
11696 if (point.x === xFromYDist) return 0;
11697 const xDist = (point.x - lPt.x) / v2.x;
11698 const yFromXDist = lPt.y + xDist * v2.y;
11699 if (point.y === yFromXDist) return 0;
11700 return point.y < yFromXDist ? -1 : 1;
11703 * Given another segment, returns the first non-trivial intersection
11704 * between the two segments (in terms of sweep line ordering), if it exists.
11706 * A 'non-trivial' intersection is one that will cause one or both of the
11707 * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
11709 * * endpoint of segA with endpoint of segB --> trivial
11710 * * endpoint of segA with point along segB --> non-trivial
11711 * * endpoint of segB with point along segA --> non-trivial
11712 * * point along segA with point along segB --> non-trivial
11714 * If no non-trivial intersection exists, return null
11715 * Else, return null.
11717 getIntersection(other) {
11718 const tBbox = this.bbox();
11719 const oBbox = other.bbox();
11720 const bboxOverlap = getBboxOverlap2(tBbox, oBbox);
11721 if (bboxOverlap === null) return null;
11722 const tlp = this.leftSE.point;
11723 const trp = this.rightSE.point;
11724 const olp = other.leftSE.point;
11725 const orp = other.rightSE.point;
11726 const touchesOtherLSE = isInBbox2(tBbox, olp) && this.comparePoint(olp) === 0;
11727 const touchesThisLSE = isInBbox2(oBbox, tlp) && other.comparePoint(tlp) === 0;
11728 const touchesOtherRSE = isInBbox2(tBbox, orp) && this.comparePoint(orp) === 0;
11729 const touchesThisRSE = isInBbox2(oBbox, trp) && other.comparePoint(trp) === 0;
11730 if (touchesThisLSE && touchesOtherLSE) {
11731 if (touchesThisRSE && !touchesOtherRSE) return trp;
11732 if (!touchesThisRSE && touchesOtherRSE) return orp;
11735 if (touchesThisLSE) {
11736 if (touchesOtherRSE) {
11737 if (tlp.x === orp.x && tlp.y === orp.y) return null;
11741 if (touchesOtherLSE) {
11742 if (touchesThisRSE) {
11743 if (trp.x === olp.x && trp.y === olp.y) return null;
11747 if (touchesThisRSE && touchesOtherRSE) return null;
11748 if (touchesThisRSE) return trp;
11749 if (touchesOtherRSE) return orp;
11750 const pt2 = intersection$1(tlp, this.vector(), olp, other.vector());
11751 if (pt2 === null) return null;
11752 if (!isInBbox2(bboxOverlap, pt2)) return null;
11753 return rounder.round(pt2.x, pt2.y);
11756 * Split the given segment into multiple segments on the given points.
11757 * * Each existing segment will retain its leftSE and a new rightSE will be
11758 * generated for it.
11759 * * A new segment will be generated which will adopt the original segment's
11760 * rightSE, and a new leftSE will be generated for it.
11761 * * If there are more than two points given to split on, new segments
11762 * in the middle will be generated with new leftSE and rightSE's.
11763 * * An array of the newly generated SweepEvents will be returned.
11765 * Warning: input array of points is modified
11768 const newEvents = [];
11769 const alreadyLinked = point.events !== void 0;
11770 const newLeftSE = new SweepEvent2(point, true);
11771 const newRightSE = new SweepEvent2(point, false);
11772 const oldRightSE = this.rightSE;
11773 this.replaceRightSE(newRightSE);
11774 newEvents.push(newRightSE);
11775 newEvents.push(newLeftSE);
11776 const newSeg = new Segment2(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
11777 if (SweepEvent2.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
11778 newSeg.swapEvents();
11780 if (SweepEvent2.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
11783 if (alreadyLinked) {
11784 newLeftSE.checkForConsuming();
11785 newRightSE.checkForConsuming();
11789 /* Swap which event is left and right */
11791 const tmpEvt = this.rightSE;
11792 this.rightSE = this.leftSE;
11793 this.leftSE = tmpEvt;
11794 this.leftSE.isLeft = true;
11795 this.rightSE.isLeft = false;
11796 for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
11797 this.windings[i3] *= -1;
11800 /* Consume another segment. We take their rings under our wing
11801 * and mark them as consumed. Use for perfectly overlapping segments */
11803 let consumer = this;
11804 let consumee = other;
11805 while (consumer.consumedBy) consumer = consumer.consumedBy;
11806 while (consumee.consumedBy) consumee = consumee.consumedBy;
11807 const cmp2 = Segment2.compare(consumer, consumee);
11808 if (cmp2 === 0) return;
11810 const tmp = consumer;
11811 consumer = consumee;
11814 if (consumer.prev === consumee) {
11815 const tmp = consumer;
11816 consumer = consumee;
11819 for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
11820 const ring = consumee.rings[i3];
11821 const winding = consumee.windings[i3];
11822 const index2 = consumer.rings.indexOf(ring);
11823 if (index2 === -1) {
11824 consumer.rings.push(ring);
11825 consumer.windings.push(winding);
11826 } else consumer.windings[index2] += winding;
11828 consumee.rings = null;
11829 consumee.windings = null;
11830 consumee.consumedBy = consumer;
11831 consumee.leftSE.consumedBy = consumer.leftSE;
11832 consumee.rightSE.consumedBy = consumer.rightSE;
11834 /* The first segment previous segment chain that is in the result */
11836 if (this._prevInResult !== void 0) return this._prevInResult;
11837 if (!this.prev) this._prevInResult = null;
11838 else if (this.prev.isInResult()) this._prevInResult = this.prev;
11839 else this._prevInResult = this.prev.prevInResult();
11840 return this._prevInResult;
11843 if (this._beforeState !== void 0) return this._beforeState;
11844 if (!this.prev) this._beforeState = {
11850 const seg = this.prev.consumedBy || this.prev;
11851 this._beforeState = seg.afterState();
11853 return this._beforeState;
11856 if (this._afterState !== void 0) return this._afterState;
11857 const beforeState = this.beforeState();
11858 this._afterState = {
11859 rings: beforeState.rings.slice(0),
11860 windings: beforeState.windings.slice(0),
11863 const ringsAfter = this._afterState.rings;
11864 const windingsAfter = this._afterState.windings;
11865 const mpsAfter = this._afterState.multiPolys;
11866 for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
11867 const ring = this.rings[i3];
11868 const winding = this.windings[i3];
11869 const index2 = ringsAfter.indexOf(ring);
11870 if (index2 === -1) {
11871 ringsAfter.push(ring);
11872 windingsAfter.push(winding);
11873 } else windingsAfter[index2] += winding;
11875 const polysAfter = [];
11876 const polysExclude = [];
11877 for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
11878 if (windingsAfter[i3] === 0) continue;
11879 const ring = ringsAfter[i3];
11880 const poly = ring.poly;
11881 if (polysExclude.indexOf(poly) !== -1) continue;
11882 if (ring.isExterior) polysAfter.push(poly);
11884 if (polysExclude.indexOf(poly) === -1) polysExclude.push(poly);
11885 const index2 = polysAfter.indexOf(ring.poly);
11886 if (index2 !== -1) polysAfter.splice(index2, 1);
11889 for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
11890 const mp = polysAfter[i3].multiPoly;
11891 if (mpsAfter.indexOf(mp) === -1) mpsAfter.push(mp);
11893 return this._afterState;
11895 /* Is this segment part of the final result? */
11897 if (this.consumedBy) return false;
11898 if (this._isInResult !== void 0) return this._isInResult;
11899 const mpsBefore = this.beforeState().multiPolys;
11900 const mpsAfter = this.afterState().multiPolys;
11901 switch (operation2.type) {
11903 const noBefores = mpsBefore.length === 0;
11904 const noAfters = mpsAfter.length === 0;
11905 this._isInResult = noBefores !== noAfters;
11908 case "intersection": {
11911 if (mpsBefore.length < mpsAfter.length) {
11912 least = mpsBefore.length;
11913 most = mpsAfter.length;
11915 least = mpsAfter.length;
11916 most = mpsBefore.length;
11918 this._isInResult = most === operation2.numMultiPolys && least < most;
11922 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
11923 this._isInResult = diff % 2 === 1;
11926 case "difference": {
11927 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
11928 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
11932 throw new Error("Unrecognized operation type found ".concat(operation2.type));
11934 return this._isInResult;
11938 constructor(geomRing, poly, isExterior) {
11939 if (!Array.isArray(geomRing) || geomRing.length === 0) {
11940 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11943 this.isExterior = isExterior;
11944 this.segments = [];
11945 if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
11946 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11948 const firstPoint = rounder.round(geomRing[0][0], geomRing[0][1]);
11959 let prevPoint = firstPoint;
11960 for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
11961 if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
11962 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11964 let point = rounder.round(geomRing[i3][0], geomRing[i3][1]);
11965 if (point.x === prevPoint.x && point.y === prevPoint.y) continue;
11966 this.segments.push(Segment2.fromRing(prevPoint, point, this));
11967 if (point.x < this.bbox.ll.x) this.bbox.ll.x = point.x;
11968 if (point.y < this.bbox.ll.y) this.bbox.ll.y = point.y;
11969 if (point.x > this.bbox.ur.x) this.bbox.ur.x = point.x;
11970 if (point.y > this.bbox.ur.y) this.bbox.ur.y = point.y;
11973 if (firstPoint.x !== prevPoint.x || firstPoint.y !== prevPoint.y) {
11974 this.segments.push(Segment2.fromRing(prevPoint, firstPoint, this));
11978 const sweepEvents = [];
11979 for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
11980 const segment = this.segments[i3];
11981 sweepEvents.push(segment.leftSE);
11982 sweepEvents.push(segment.rightSE);
11984 return sweepEvents;
11988 constructor(geomPoly, multiPoly) {
11989 if (!Array.isArray(geomPoly)) {
11990 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
11992 this.exteriorRing = new RingIn2(geomPoly[0], this, true);
11995 x: this.exteriorRing.bbox.ll.x,
11996 y: this.exteriorRing.bbox.ll.y
11999 x: this.exteriorRing.bbox.ur.x,
12000 y: this.exteriorRing.bbox.ur.y
12003 this.interiorRings = [];
12004 for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
12005 const ring = new RingIn2(geomPoly[i3], this, false);
12006 if (ring.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = ring.bbox.ll.x;
12007 if (ring.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = ring.bbox.ll.y;
12008 if (ring.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = ring.bbox.ur.x;
12009 if (ring.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = ring.bbox.ur.y;
12010 this.interiorRings.push(ring);
12012 this.multiPoly = multiPoly;
12015 const sweepEvents = this.exteriorRing.getSweepEvents();
12016 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
12017 const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
12018 for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
12019 sweepEvents.push(ringSweepEvents[j2]);
12022 return sweepEvents;
12025 class MultiPolyIn2 {
12026 constructor(geom, isSubject) {
12027 if (!Array.isArray(geom)) {
12028 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
12031 if (typeof geom[0][0][0] === "number") geom = [geom];
12037 x: Number.POSITIVE_INFINITY,
12038 y: Number.POSITIVE_INFINITY
12041 x: Number.NEGATIVE_INFINITY,
12042 y: Number.NEGATIVE_INFINITY
12045 for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
12046 const poly = new PolyIn2(geom[i3], this);
12047 if (poly.bbox.ll.x < this.bbox.ll.x) this.bbox.ll.x = poly.bbox.ll.x;
12048 if (poly.bbox.ll.y < this.bbox.ll.y) this.bbox.ll.y = poly.bbox.ll.y;
12049 if (poly.bbox.ur.x > this.bbox.ur.x) this.bbox.ur.x = poly.bbox.ur.x;
12050 if (poly.bbox.ur.y > this.bbox.ur.y) this.bbox.ur.y = poly.bbox.ur.y;
12051 this.polys.push(poly);
12053 this.isSubject = isSubject;
12056 const sweepEvents = [];
12057 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
12058 const polySweepEvents = this.polys[i3].getSweepEvents();
12059 for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
12060 sweepEvents.push(polySweepEvents[j2]);
12063 return sweepEvents;
12067 /* Given the segments from the sweep line pass, compute & return a series
12068 * of closed rings from all the segments marked to be part of the result */
12069 static factory(allSegments) {
12070 const ringsOut = [];
12071 for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
12072 const segment = allSegments[i3];
12073 if (!segment.isInResult() || segment.ringOut) continue;
12074 let prevEvent = null;
12075 let event = segment.leftSE;
12076 let nextEvent = segment.rightSE;
12077 const events = [event];
12078 const startingPoint = event.point;
12079 const intersectionLEs = [];
12083 events.push(event);
12084 if (event.point === startingPoint) break;
12086 const availableLEs = event.getAvailableLinkedEvents();
12087 if (availableLEs.length === 0) {
12088 const firstPt = events[0].point;
12089 const lastPt = events[events.length - 1].point;
12090 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, "]."));
12092 if (availableLEs.length === 1) {
12093 nextEvent = availableLEs[0].otherSE;
12096 let indexLE = null;
12097 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
12098 if (intersectionLEs[j2].point === event.point) {
12103 if (indexLE !== null) {
12104 const intersectionLE = intersectionLEs.splice(indexLE)[0];
12105 const ringEvents = events.splice(intersectionLE.index);
12106 ringEvents.unshift(ringEvents[0].otherSE);
12107 ringsOut.push(new RingOut2(ringEvents.reverse()));
12110 intersectionLEs.push({
12111 index: events.length,
12114 const comparator = event.getLeftmostComparator(prevEvent);
12115 nextEvent = availableLEs.sort(comparator)[0].otherSE;
12119 ringsOut.push(new RingOut2(events));
12123 constructor(events) {
12124 this.events = events;
12125 for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
12126 events[i3].segment.ringOut = this;
12131 let prevPt = this.events[0].point;
12132 const points = [prevPt];
12133 for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
12134 const pt3 = this.events[i3].point;
12135 const nextPt2 = this.events[i3 + 1].point;
12136 if (compareVectorAngles(pt3, prevPt, nextPt2) === 0) continue;
12140 if (points.length === 1) return null;
12141 const pt2 = points[0];
12142 const nextPt = points[1];
12143 if (compareVectorAngles(pt2, prevPt, nextPt) === 0) points.shift();
12144 points.push(points[0]);
12145 const step = this.isExteriorRing() ? 1 : -1;
12146 const iStart = this.isExteriorRing() ? 0 : points.length - 1;
12147 const iEnd = this.isExteriorRing() ? points.length : -1;
12148 const orderedPoints = [];
12149 for (let i3 = iStart; i3 != iEnd; i3 += step) orderedPoints.push([points[i3].x, points[i3].y]);
12150 return orderedPoints;
12153 if (this._isExteriorRing === void 0) {
12154 const enclosing = this.enclosingRing();
12155 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
12157 return this._isExteriorRing;
12160 if (this._enclosingRing === void 0) {
12161 this._enclosingRing = this._calcEnclosingRing();
12163 return this._enclosingRing;
12165 /* Returns the ring that encloses this one, if any */
12166 _calcEnclosingRing() {
12167 let leftMostEvt = this.events[0];
12168 for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
12169 const evt = this.events[i3];
12170 if (SweepEvent2.compare(leftMostEvt, evt) > 0) leftMostEvt = evt;
12172 let prevSeg = leftMostEvt.segment.prevInResult();
12173 let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
12175 if (!prevSeg) return null;
12176 if (!prevPrevSeg) return prevSeg.ringOut;
12177 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
12178 if (prevPrevSeg.ringOut.enclosingRing() !== prevSeg.ringOut) {
12179 return prevSeg.ringOut;
12180 } else return prevSeg.ringOut.enclosingRing();
12182 prevSeg = prevPrevSeg.prevInResult();
12183 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
12188 constructor(exteriorRing) {
12189 this.exteriorRing = exteriorRing;
12190 exteriorRing.poly = this;
12191 this.interiorRings = [];
12193 addInterior(ring) {
12194 this.interiorRings.push(ring);
12198 const geom = [this.exteriorRing.getGeom()];
12199 if (geom[0] === null) return null;
12200 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
12201 const ringGeom = this.interiorRings[i3].getGeom();
12202 if (ringGeom === null) continue;
12203 geom.push(ringGeom);
12208 class MultiPolyOut2 {
12209 constructor(rings) {
12210 this.rings = rings;
12211 this.polys = this._composePolys(rings);
12215 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
12216 const polyGeom = this.polys[i3].getGeom();
12217 if (polyGeom === null) continue;
12218 geom.push(polyGeom);
12222 _composePolys(rings) {
12224 for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
12225 const ring = rings[i3];
12226 if (ring.poly) continue;
12227 if (ring.isExteriorRing()) polys.push(new PolyOut2(ring));
12229 const enclosingRing = ring.enclosingRing();
12230 if (!enclosingRing.poly) polys.push(new PolyOut2(enclosingRing));
12231 enclosingRing.poly.addInterior(ring);
12238 constructor(queue) {
12239 let comparator = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Segment2.compare;
12240 this.queue = queue;
12241 this.tree = new Tree(comparator);
12242 this.segments = [];
12245 const segment = event.segment;
12246 const newEvents = [];
12247 if (event.consumedBy) {
12248 if (event.isLeft) this.queue.remove(event.otherSE);
12249 else this.tree.remove(segment);
12252 const node = event.isLeft ? this.tree.add(segment) : this.tree.find(segment);
12253 if (!node) 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.");
12254 let prevNode = node;
12255 let nextNode = node;
12256 let prevSeg = void 0;
12257 let nextSeg = void 0;
12258 while (prevSeg === void 0) {
12259 prevNode = this.tree.prev(prevNode);
12260 if (prevNode === null) prevSeg = null;
12261 else if (prevNode.key.consumedBy === void 0) prevSeg = prevNode.key;
12263 while (nextSeg === void 0) {
12264 nextNode = this.tree.next(nextNode);
12265 if (nextNode === null) nextSeg = null;
12266 else if (nextNode.key.consumedBy === void 0) nextSeg = nextNode.key;
12268 if (event.isLeft) {
12269 let prevMySplitter = null;
12271 const prevInter = prevSeg.getIntersection(segment);
12272 if (prevInter !== null) {
12273 if (!segment.isAnEndpoint(prevInter)) prevMySplitter = prevInter;
12274 if (!prevSeg.isAnEndpoint(prevInter)) {
12275 const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
12276 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12277 newEvents.push(newEventsFromSplit[i3]);
12282 let nextMySplitter = null;
12284 const nextInter = nextSeg.getIntersection(segment);
12285 if (nextInter !== null) {
12286 if (!segment.isAnEndpoint(nextInter)) nextMySplitter = nextInter;
12287 if (!nextSeg.isAnEndpoint(nextInter)) {
12288 const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
12289 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12290 newEvents.push(newEventsFromSplit[i3]);
12295 if (prevMySplitter !== null || nextMySplitter !== null) {
12296 let mySplitter = null;
12297 if (prevMySplitter === null) mySplitter = nextMySplitter;
12298 else if (nextMySplitter === null) mySplitter = prevMySplitter;
12300 const cmpSplitters = SweepEvent2.comparePoints(prevMySplitter, nextMySplitter);
12301 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
12303 this.queue.remove(segment.rightSE);
12304 newEvents.push(segment.rightSE);
12305 const newEventsFromSplit = segment.split(mySplitter);
12306 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12307 newEvents.push(newEventsFromSplit[i3]);
12310 if (newEvents.length > 0) {
12311 this.tree.remove(segment);
12312 newEvents.push(event);
12314 this.segments.push(segment);
12315 segment.prev = prevSeg;
12318 if (prevSeg && nextSeg) {
12319 const inter = prevSeg.getIntersection(nextSeg);
12320 if (inter !== null) {
12321 if (!prevSeg.isAnEndpoint(inter)) {
12322 const newEventsFromSplit = this._splitSafely(prevSeg, inter);
12323 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12324 newEvents.push(newEventsFromSplit[i3]);
12327 if (!nextSeg.isAnEndpoint(inter)) {
12328 const newEventsFromSplit = this._splitSafely(nextSeg, inter);
12329 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
12330 newEvents.push(newEventsFromSplit[i3]);
12335 this.tree.remove(segment);
12339 /* Safely split a segment that is currently in the datastructures
12340 * IE - a segment other than the one that is currently being processed. */
12341 _splitSafely(seg, pt2) {
12342 this.tree.remove(seg);
12343 const rightSE = seg.rightSE;
12344 this.queue.remove(rightSE);
12345 const newEvents = seg.split(pt2);
12346 newEvents.push(rightSE);
12347 if (seg.consumedBy === void 0) this.tree.add(seg);
12351 const POLYGON_CLIPPING_MAX_QUEUE_SIZE = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE || 1e6;
12352 const POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS = typeof process !== "undefined" && process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS || 1e6;
12354 run(type2, geom, moreGeoms) {
12355 operation2.type = type2;
12357 const multipolys = [new MultiPolyIn2(geom, true)];
12358 for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
12359 multipolys.push(new MultiPolyIn2(moreGeoms[i3], false));
12361 operation2.numMultiPolys = multipolys.length;
12362 if (operation2.type === "difference") {
12363 const subject = multipolys[0];
12365 while (i3 < multipolys.length) {
12366 if (getBboxOverlap2(multipolys[i3].bbox, subject.bbox) !== null) i3++;
12367 else multipolys.splice(i3, 1);
12370 if (operation2.type === "intersection") {
12371 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
12372 const mpA = multipolys[i3];
12373 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
12374 if (getBboxOverlap2(mpA.bbox, multipolys[j2].bbox) === null) return [];
12378 const queue = new Tree(SweepEvent2.compare);
12379 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
12380 const sweepEvents = multipolys[i3].getSweepEvents();
12381 for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
12382 queue.insert(sweepEvents[j2]);
12383 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
12384 throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).");
12388 const sweepLine = new SweepLine2(queue);
12389 let prevQueueSize = queue.size;
12390 let node = queue.pop();
12392 const evt = node.key;
12393 if (queue.size === prevQueueSize) {
12394 const seg = evt.segment;
12395 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."));
12397 if (queue.size > POLYGON_CLIPPING_MAX_QUEUE_SIZE) {
12398 throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");
12400 if (sweepLine.segments.length > POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS) {
12401 throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");
12403 const newEvents = sweepLine.process(evt);
12404 for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
12405 const evt2 = newEvents[i3];
12406 if (evt2.consumedBy === void 0) queue.insert(evt2);
12408 prevQueueSize = queue.size;
12409 node = queue.pop();
12412 const ringsOut = RingOut2.factory(sweepLine.segments);
12413 const result = new MultiPolyOut2(ringsOut);
12414 return result.getGeom();
12417 const operation2 = new Operation2();
12418 const union2 = function(geom) {
12419 for (var _len = arguments.length, moreGeoms = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
12420 moreGeoms[_key - 1] = arguments[_key];
12422 return operation2.run("union", geom, moreGeoms);
12424 const intersection2 = function(geom) {
12425 for (var _len2 = arguments.length, moreGeoms = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
12426 moreGeoms[_key2 - 1] = arguments[_key2];
12428 return operation2.run("intersection", geom, moreGeoms);
12430 const xor = function(geom) {
12431 for (var _len3 = arguments.length, moreGeoms = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
12432 moreGeoms[_key3 - 1] = arguments[_key3];
12434 return operation2.run("xor", geom, moreGeoms);
12436 const difference2 = function(subjectGeom) {
12437 for (var _len4 = arguments.length, clippingGeoms = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
12438 clippingGeoms[_key4 - 1] = arguments[_key4];
12440 return operation2.run("difference", subjectGeom, clippingGeoms);
12444 intersection: intersection2,
12446 difference: difference2
12453 // node_modules/whatwg-fetch/fetch.js
12454 var g = typeof globalThis !== "undefined" && globalThis || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
12455 typeof global !== "undefined" && global || {};
12457 searchParams: "URLSearchParams" in g,
12458 iterable: "Symbol" in g && "iterator" in Symbol,
12459 blob: "FileReader" in g && "Blob" in g && function() {
12467 formData: "FormData" in g,
12468 arrayBuffer: "ArrayBuffer" in g
12470 function isDataView(obj) {
12471 return obj && DataView.prototype.isPrototypeOf(obj);
12473 if (support.arrayBuffer) {
12475 "[object Int8Array]",
12476 "[object Uint8Array]",
12477 "[object Uint8ClampedArray]",
12478 "[object Int16Array]",
12479 "[object Uint16Array]",
12480 "[object Int32Array]",
12481 "[object Uint32Array]",
12482 "[object Float32Array]",
12483 "[object Float64Array]"
12485 isArrayBufferView = ArrayBuffer.isView || function(obj) {
12486 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1;
12490 var isArrayBufferView;
12491 function normalizeName(name) {
12492 if (typeof name !== "string") {
12493 name = String(name);
12495 if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === "") {
12496 throw new TypeError('Invalid character in header field name: "' + name + '"');
12498 return name.toLowerCase();
12500 function normalizeValue(value) {
12501 if (typeof value !== "string") {
12502 value = String(value);
12506 function iteratorFor(items) {
12509 var value = items.shift();
12510 return { done: value === void 0, value };
12513 if (support.iterable) {
12514 iterator[Symbol.iterator] = function() {
12520 function Headers(headers) {
12522 if (headers instanceof Headers) {
12523 headers.forEach(function(value, name) {
12524 this.append(name, value);
12526 } else if (Array.isArray(headers)) {
12527 headers.forEach(function(header) {
12528 if (header.length != 2) {
12529 throw new TypeError("Headers constructor: expected name/value pair to be length 2, found" + header.length);
12531 this.append(header[0], header[1]);
12533 } else if (headers) {
12534 Object.getOwnPropertyNames(headers).forEach(function(name) {
12535 this.append(name, headers[name]);
12539 Headers.prototype.append = function(name, value) {
12540 name = normalizeName(name);
12541 value = normalizeValue(value);
12542 var oldValue = this.map[name];
12543 this.map[name] = oldValue ? oldValue + ", " + value : value;
12545 Headers.prototype["delete"] = function(name) {
12546 delete this.map[normalizeName(name)];
12548 Headers.prototype.get = function(name) {
12549 name = normalizeName(name);
12550 return this.has(name) ? this.map[name] : null;
12552 Headers.prototype.has = function(name) {
12553 return this.map.hasOwnProperty(normalizeName(name));
12555 Headers.prototype.set = function(name, value) {
12556 this.map[normalizeName(name)] = normalizeValue(value);
12558 Headers.prototype.forEach = function(callback, thisArg) {
12559 for (var name in this.map) {
12560 if (this.map.hasOwnProperty(name)) {
12561 callback.call(thisArg, this.map[name], name, this);
12565 Headers.prototype.keys = function() {
12567 this.forEach(function(value, name) {
12570 return iteratorFor(items);
12572 Headers.prototype.values = function() {
12574 this.forEach(function(value) {
12577 return iteratorFor(items);
12579 Headers.prototype.entries = function() {
12581 this.forEach(function(value, name) {
12582 items.push([name, value]);
12584 return iteratorFor(items);
12586 if (support.iterable) {
12587 Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
12589 function consumed(body) {
12590 if (body._noBody) return;
12591 if (body.bodyUsed) {
12592 return Promise.reject(new TypeError("Already read"));
12594 body.bodyUsed = true;
12596 function fileReaderReady(reader) {
12597 return new Promise(function(resolve, reject) {
12598 reader.onload = function() {
12599 resolve(reader.result);
12601 reader.onerror = function() {
12602 reject(reader.error);
12606 function readBlobAsArrayBuffer(blob) {
12607 var reader = new FileReader();
12608 var promise = fileReaderReady(reader);
12609 reader.readAsArrayBuffer(blob);
12612 function readBlobAsText(blob) {
12613 var reader = new FileReader();
12614 var promise = fileReaderReady(reader);
12615 var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
12616 var encoding = match ? match[1] : "utf-8";
12617 reader.readAsText(blob, encoding);
12620 function readArrayBufferAsText(buf) {
12621 var view = new Uint8Array(buf);
12622 var chars = new Array(view.length);
12623 for (var i3 = 0; i3 < view.length; i3++) {
12624 chars[i3] = String.fromCharCode(view[i3]);
12626 return chars.join("");
12628 function bufferClone(buf) {
12630 return buf.slice(0);
12632 var view = new Uint8Array(buf.byteLength);
12633 view.set(new Uint8Array(buf));
12634 return view.buffer;
12638 this.bodyUsed = false;
12639 this._initBody = function(body) {
12640 this.bodyUsed = this.bodyUsed;
12641 this._bodyInit = body;
12643 this._noBody = true;
12644 this._bodyText = "";
12645 } else if (typeof body === "string") {
12646 this._bodyText = body;
12647 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
12648 this._bodyBlob = body;
12649 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
12650 this._bodyFormData = body;
12651 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
12652 this._bodyText = body.toString();
12653 } else if (support.arrayBuffer && support.blob && isDataView(body)) {
12654 this._bodyArrayBuffer = bufferClone(body.buffer);
12655 this._bodyInit = new Blob([this._bodyArrayBuffer]);
12656 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
12657 this._bodyArrayBuffer = bufferClone(body);
12659 this._bodyText = body = Object.prototype.toString.call(body);
12661 if (!this.headers.get("content-type")) {
12662 if (typeof body === "string") {
12663 this.headers.set("content-type", "text/plain;charset=UTF-8");
12664 } else if (this._bodyBlob && this._bodyBlob.type) {
12665 this.headers.set("content-type", this._bodyBlob.type);
12666 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
12667 this.headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
12671 if (support.blob) {
12672 this.blob = function() {
12673 var rejected = consumed(this);
12677 if (this._bodyBlob) {
12678 return Promise.resolve(this._bodyBlob);
12679 } else if (this._bodyArrayBuffer) {
12680 return Promise.resolve(new Blob([this._bodyArrayBuffer]));
12681 } else if (this._bodyFormData) {
12682 throw new Error("could not read FormData body as blob");
12684 return Promise.resolve(new Blob([this._bodyText]));
12688 this.arrayBuffer = function() {
12689 if (this._bodyArrayBuffer) {
12690 var isConsumed = consumed(this);
12693 } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
12694 return Promise.resolve(
12695 this._bodyArrayBuffer.buffer.slice(
12696 this._bodyArrayBuffer.byteOffset,
12697 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
12701 return Promise.resolve(this._bodyArrayBuffer);
12703 } else if (support.blob) {
12704 return this.blob().then(readBlobAsArrayBuffer);
12706 throw new Error("could not read as ArrayBuffer");
12709 this.text = function() {
12710 var rejected = consumed(this);
12714 if (this._bodyBlob) {
12715 return readBlobAsText(this._bodyBlob);
12716 } else if (this._bodyArrayBuffer) {
12717 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer));
12718 } else if (this._bodyFormData) {
12719 throw new Error("could not read FormData body as text");
12721 return Promise.resolve(this._bodyText);
12724 if (support.formData) {
12725 this.formData = function() {
12726 return this.text().then(decode);
12729 this.json = function() {
12730 return this.text().then(JSON.parse);
12734 var methods = ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"];
12735 function normalizeMethod(method) {
12736 var upcased = method.toUpperCase();
12737 return methods.indexOf(upcased) > -1 ? upcased : method;
12739 function Request(input, options2) {
12740 if (!(this instanceof Request)) {
12741 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
12743 options2 = options2 || {};
12744 var body = options2.body;
12745 if (input instanceof Request) {
12746 if (input.bodyUsed) {
12747 throw new TypeError("Already read");
12749 this.url = input.url;
12750 this.credentials = input.credentials;
12751 if (!options2.headers) {
12752 this.headers = new Headers(input.headers);
12754 this.method = input.method;
12755 this.mode = input.mode;
12756 this.signal = input.signal;
12757 if (!body && input._bodyInit != null) {
12758 body = input._bodyInit;
12759 input.bodyUsed = true;
12762 this.url = String(input);
12764 this.credentials = options2.credentials || this.credentials || "same-origin";
12765 if (options2.headers || !this.headers) {
12766 this.headers = new Headers(options2.headers);
12768 this.method = normalizeMethod(options2.method || this.method || "GET");
12769 this.mode = options2.mode || this.mode || null;
12770 this.signal = options2.signal || this.signal || function() {
12771 if ("AbortController" in g) {
12772 var ctrl = new AbortController();
12773 return ctrl.signal;
12776 this.referrer = null;
12777 if ((this.method === "GET" || this.method === "HEAD") && body) {
12778 throw new TypeError("Body not allowed for GET or HEAD requests");
12780 this._initBody(body);
12781 if (this.method === "GET" || this.method === "HEAD") {
12782 if (options2.cache === "no-store" || options2.cache === "no-cache") {
12783 var reParamSearch = /([?&])_=[^&]*/;
12784 if (reParamSearch.test(this.url)) {
12785 this.url = this.url.replace(reParamSearch, "$1_=" + (/* @__PURE__ */ new Date()).getTime());
12787 var reQueryString = /\?/;
12788 this.url += (reQueryString.test(this.url) ? "&" : "?") + "_=" + (/* @__PURE__ */ new Date()).getTime();
12793 Request.prototype.clone = function() {
12794 return new Request(this, { body: this._bodyInit });
12796 function decode(body) {
12797 var form = new FormData();
12798 body.trim().split("&").forEach(function(bytes) {
12800 var split = bytes.split("=");
12801 var name = split.shift().replace(/\+/g, " ");
12802 var value = split.join("=").replace(/\+/g, " ");
12803 form.append(decodeURIComponent(name), decodeURIComponent(value));
12808 function parseHeaders(rawHeaders) {
12809 var headers = new Headers();
12810 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, " ");
12811 preProcessedHeaders.split("\r").map(function(header) {
12812 return header.indexOf("\n") === 0 ? header.substr(1, header.length) : header;
12813 }).forEach(function(line) {
12814 var parts = line.split(":");
12815 var key = parts.shift().trim();
12817 var value = parts.join(":").trim();
12819 headers.append(key, value);
12821 console.warn("Response " + error.message);
12827 Body.call(Request.prototype);
12828 function Response(bodyInit, options2) {
12829 if (!(this instanceof Response)) {
12830 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');
12835 this.type = "default";
12836 this.status = options2.status === void 0 ? 200 : options2.status;
12837 if (this.status < 200 || this.status > 599) {
12838 throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");
12840 this.ok = this.status >= 200 && this.status < 300;
12841 this.statusText = options2.statusText === void 0 ? "" : "" + options2.statusText;
12842 this.headers = new Headers(options2.headers);
12843 this.url = options2.url || "";
12844 this._initBody(bodyInit);
12846 Body.call(Response.prototype);
12847 Response.prototype.clone = function() {
12848 return new Response(this._bodyInit, {
12849 status: this.status,
12850 statusText: this.statusText,
12851 headers: new Headers(this.headers),
12855 Response.error = function() {
12856 var response = new Response(null, { status: 200, statusText: "" });
12857 response.ok = false;
12858 response.status = 0;
12859 response.type = "error";
12862 var redirectStatuses = [301, 302, 303, 307, 308];
12863 Response.redirect = function(url, status) {
12864 if (redirectStatuses.indexOf(status) === -1) {
12865 throw new RangeError("Invalid status code");
12867 return new Response(null, { status, headers: { location: url } });
12869 var DOMException2 = g.DOMException;
12871 new DOMException2();
12873 DOMException2 = function(message, name) {
12874 this.message = message;
12876 var error = Error(message);
12877 this.stack = error.stack;
12879 DOMException2.prototype = Object.create(Error.prototype);
12880 DOMException2.prototype.constructor = DOMException2;
12882 function fetch2(input, init2) {
12883 return new Promise(function(resolve, reject) {
12884 var request3 = new Request(input, init2);
12885 if (request3.signal && request3.signal.aborted) {
12886 return reject(new DOMException2("Aborted", "AbortError"));
12888 var xhr = new XMLHttpRequest();
12889 function abortXhr() {
12892 xhr.onload = function() {
12894 statusText: xhr.statusText,
12895 headers: parseHeaders(xhr.getAllResponseHeaders() || "")
12897 if (request3.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
12898 options2.status = 200;
12900 options2.status = xhr.status;
12902 options2.url = "responseURL" in xhr ? xhr.responseURL : options2.headers.get("X-Request-URL");
12903 var body = "response" in xhr ? xhr.response : xhr.responseText;
12904 setTimeout(function() {
12905 resolve(new Response(body, options2));
12908 xhr.onerror = function() {
12909 setTimeout(function() {
12910 reject(new TypeError("Network request failed"));
12913 xhr.ontimeout = function() {
12914 setTimeout(function() {
12915 reject(new TypeError("Network request timed out"));
12918 xhr.onabort = function() {
12919 setTimeout(function() {
12920 reject(new DOMException2("Aborted", "AbortError"));
12923 function fixUrl(url) {
12925 return url === "" && g.location.href ? g.location.href : url;
12930 xhr.open(request3.method, fixUrl(request3.url), true);
12931 if (request3.credentials === "include") {
12932 xhr.withCredentials = true;
12933 } else if (request3.credentials === "omit") {
12934 xhr.withCredentials = false;
12936 if ("responseType" in xhr) {
12937 if (support.blob) {
12938 xhr.responseType = "blob";
12939 } else if (support.arrayBuffer) {
12940 xhr.responseType = "arraybuffer";
12943 if (init2 && typeof init2.headers === "object" && !(init2.headers instanceof Headers || g.Headers && init2.headers instanceof g.Headers)) {
12945 Object.getOwnPropertyNames(init2.headers).forEach(function(name) {
12946 names.push(normalizeName(name));
12947 xhr.setRequestHeader(name, normalizeValue(init2.headers[name]));
12949 request3.headers.forEach(function(value, name) {
12950 if (names.indexOf(name) === -1) {
12951 xhr.setRequestHeader(name, value);
12955 request3.headers.forEach(function(value, name) {
12956 xhr.setRequestHeader(name, value);
12959 if (request3.signal) {
12960 request3.signal.addEventListener("abort", abortXhr);
12961 xhr.onreadystatechange = function() {
12962 if (xhr.readyState === 4) {
12963 request3.signal.removeEventListener("abort", abortXhr);
12967 xhr.send(typeof request3._bodyInit === "undefined" ? null : request3._bodyInit);
12970 fetch2.polyfill = true;
12973 g.Headers = Headers;
12974 g.Request = Request;
12975 g.Response = Response;
12978 // node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js
12979 (function(factory) {
12980 typeof define === "function" && define.amd ? define(factory) : factory();
12983 function _classCallCheck(instance, Constructor) {
12984 if (!(instance instanceof Constructor)) {
12985 throw new TypeError("Cannot call a class as a function");
12988 function _defineProperties(target, props) {
12989 for (var i3 = 0; i3 < props.length; i3++) {
12990 var descriptor = props[i3];
12991 descriptor.enumerable = descriptor.enumerable || false;
12992 descriptor.configurable = true;
12993 if ("value" in descriptor) descriptor.writable = true;
12994 Object.defineProperty(target, descriptor.key, descriptor);
12997 function _createClass(Constructor, protoProps, staticProps) {
12998 if (protoProps) _defineProperties(Constructor.prototype, protoProps);
12999 if (staticProps) _defineProperties(Constructor, staticProps);
13000 Object.defineProperty(Constructor, "prototype", {
13003 return Constructor;
13005 function _inherits(subClass, superClass) {
13006 if (typeof superClass !== "function" && superClass !== null) {
13007 throw new TypeError("Super expression must either be null or a function");
13009 subClass.prototype = Object.create(superClass && superClass.prototype, {
13016 Object.defineProperty(subClass, "prototype", {
13019 if (superClass) _setPrototypeOf(subClass, superClass);
13021 function _getPrototypeOf(o2) {
13022 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o3) {
13023 return o3.__proto__ || Object.getPrototypeOf(o3);
13025 return _getPrototypeOf(o2);
13027 function _setPrototypeOf(o2, p2) {
13028 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o3, p3) {
13032 return _setPrototypeOf(o2, p2);
13034 function _isNativeReflectConstruct() {
13035 if (typeof Reflect === "undefined" || !Reflect.construct) return false;
13036 if (Reflect.construct.sham) return false;
13037 if (typeof Proxy === "function") return true;
13039 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
13046 function _assertThisInitialized(self2) {
13047 if (self2 === void 0) {
13048 throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
13052 function _possibleConstructorReturn(self2, call) {
13053 if (call && (typeof call === "object" || typeof call === "function")) {
13055 } else if (call !== void 0) {
13056 throw new TypeError("Derived constructors may only return object or undefined");
13058 return _assertThisInitialized(self2);
13060 function _createSuper(Derived) {
13061 var hasNativeReflectConstruct = _isNativeReflectConstruct();
13062 return function _createSuperInternal() {
13063 var Super = _getPrototypeOf(Derived), result;
13064 if (hasNativeReflectConstruct) {
13065 var NewTarget = _getPrototypeOf(this).constructor;
13066 result = Reflect.construct(Super, arguments, NewTarget);
13068 result = Super.apply(this, arguments);
13070 return _possibleConstructorReturn(this, result);
13073 function _superPropBase(object, property) {
13074 while (!Object.prototype.hasOwnProperty.call(object, property)) {
13075 object = _getPrototypeOf(object);
13076 if (object === null) break;
13081 if (typeof Reflect !== "undefined" && Reflect.get) {
13082 _get = Reflect.get.bind();
13084 _get = function _get2(target, property, receiver) {
13085 var base = _superPropBase(target, property);
13087 var desc = Object.getOwnPropertyDescriptor(base, property);
13089 return desc.get.call(arguments.length < 3 ? target : receiver);
13094 return _get.apply(this, arguments);
13096 var Emitter = /* @__PURE__ */ function() {
13097 function Emitter2() {
13098 _classCallCheck(this, Emitter2);
13099 Object.defineProperty(this, "listeners", {
13105 _createClass(Emitter2, [{
13106 key: "addEventListener",
13107 value: function addEventListener(type2, callback, options2) {
13108 if (!(type2 in this.listeners)) {
13109 this.listeners[type2] = [];
13111 this.listeners[type2].push({
13117 key: "removeEventListener",
13118 value: function removeEventListener(type2, callback) {
13119 if (!(type2 in this.listeners)) {
13122 var stack = this.listeners[type2];
13123 for (var i3 = 0, l2 = stack.length; i3 < l2; i3++) {
13124 if (stack[i3].callback === callback) {
13125 stack.splice(i3, 1);
13131 key: "dispatchEvent",
13132 value: function dispatchEvent2(event) {
13133 if (!(event.type in this.listeners)) {
13136 var stack = this.listeners[event.type];
13137 var stackToCall = stack.slice();
13138 for (var i3 = 0, l2 = stackToCall.length; i3 < l2; i3++) {
13139 var listener = stackToCall[i3];
13141 listener.callback.call(this, event);
13143 Promise.resolve().then(function() {
13147 if (listener.options && listener.options.once) {
13148 this.removeEventListener(event.type, listener.callback);
13151 return !event.defaultPrevented;
13156 var AbortSignal = /* @__PURE__ */ function(_Emitter) {
13157 _inherits(AbortSignal2, _Emitter);
13158 var _super = _createSuper(AbortSignal2);
13159 function AbortSignal2() {
13161 _classCallCheck(this, AbortSignal2);
13162 _this = _super.call(this);
13163 if (!_this.listeners) {
13164 Emitter.call(_assertThisInitialized(_this));
13166 Object.defineProperty(_assertThisInitialized(_this), "aborted", {
13171 Object.defineProperty(_assertThisInitialized(_this), "onabort", {
13176 Object.defineProperty(_assertThisInitialized(_this), "reason", {
13183 _createClass(AbortSignal2, [{
13185 value: function toString2() {
13186 return "[object AbortSignal]";
13189 key: "dispatchEvent",
13190 value: function dispatchEvent2(event) {
13191 if (event.type === "abort") {
13192 this.aborted = true;
13193 if (typeof this.onabort === "function") {
13194 this.onabort.call(this, event);
13197 _get(_getPrototypeOf(AbortSignal2.prototype), "dispatchEvent", this).call(this, event);
13200 return AbortSignal2;
13202 var AbortController2 = /* @__PURE__ */ function() {
13203 function AbortController3() {
13204 _classCallCheck(this, AbortController3);
13205 Object.defineProperty(this, "signal", {
13206 value: new AbortSignal(),
13211 _createClass(AbortController3, [{
13213 value: function abort(reason) {
13216 event = new Event("abort");
13218 if (typeof document !== "undefined") {
13219 if (!document.createEvent) {
13220 event = document.createEventObject();
13221 event.type = "abort";
13223 event = document.createEvent("Event");
13224 event.initEvent("abort", false, false);
13234 var signalReason = reason;
13235 if (signalReason === void 0) {
13236 if (typeof document === "undefined") {
13237 signalReason = new Error("This operation was aborted");
13238 signalReason.name = "AbortError";
13241 signalReason = new DOMException("signal is aborted without reason");
13243 signalReason = new Error("This operation was aborted");
13244 signalReason.name = "AbortError";
13248 this.signal.reason = signalReason;
13249 this.signal.dispatchEvent(event);
13253 value: function toString2() {
13254 return "[object AbortController]";
13257 return AbortController3;
13259 if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
13260 AbortController2.prototype[Symbol.toStringTag] = "AbortController";
13261 AbortSignal.prototype[Symbol.toStringTag] = "AbortSignal";
13263 function polyfillNeeded(self2) {
13264 if (self2.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
13265 console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill");
13268 return typeof self2.Request === "function" && !self2.Request.prototype.hasOwnProperty("signal") || !self2.AbortController;
13270 function abortableFetchDecorator(patchTargets) {
13271 if ("function" === typeof patchTargets) {
13273 fetch: patchTargets
13276 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;
13277 if (!polyfillNeeded({
13279 Request: NativeRequest,
13280 AbortController: NativeAbortController,
13281 __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL
13288 var Request2 = NativeRequest;
13289 if (Request2 && !Request2.prototype.hasOwnProperty("signal") || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {
13290 Request2 = function Request3(input, init2) {
13292 if (init2 && init2.signal) {
13293 signal = init2.signal;
13294 delete init2.signal;
13296 var request3 = new NativeRequest(input, init2);
13298 Object.defineProperty(request3, "signal", {
13301 configurable: true,
13307 Request2.prototype = NativeRequest.prototype;
13309 var realFetch = fetch3;
13310 var abortableFetch = function abortableFetch2(input, init2) {
13311 var signal = Request2 && Request2.prototype.isPrototypeOf(input) ? input.signal : init2 ? init2.signal : void 0;
13315 abortError = new DOMException("Aborted", "AbortError");
13317 abortError = new Error("Aborted");
13318 abortError.name = "AbortError";
13320 if (signal.aborted) {
13321 return Promise.reject(abortError);
13323 var cancellation = new Promise(function(_2, reject) {
13324 signal.addEventListener("abort", function() {
13325 return reject(abortError);
13330 if (init2 && init2.signal) {
13331 delete init2.signal;
13333 return Promise.race([cancellation, realFetch(input, init2)]);
13335 return realFetch(input, init2);
13338 fetch: abortableFetch,
13343 if (!polyfillNeeded(self2)) {
13346 if (!self2.fetch) {
13347 console.warn("fetch() is not available, cannot install abortcontroller-polyfill");
13350 var _abortableFetch = abortableFetchDecorator(self2), fetch3 = _abortableFetch.fetch, Request2 = _abortableFetch.Request;
13351 self2.fetch = fetch3;
13352 self2.Request = Request2;
13353 Object.defineProperty(self2, "AbortController", {
13356 configurable: true,
13357 value: AbortController2
13359 Object.defineProperty(self2, "AbortSignal", {
13362 configurable: true,
13365 })(typeof self !== "undefined" ? self : global);
13368 // modules/index.js
13369 var modules_exports = {};
13370 __export(modules_exports, {
13371 LANGUAGE_SUFFIX_REGEX: () => LANGUAGE_SUFFIX_REGEX,
13372 LocationManager: () => LocationManager,
13373 QAItem: () => QAItem,
13374 actionAddEntity: () => actionAddEntity,
13375 actionAddMember: () => actionAddMember,
13376 actionAddMidpoint: () => actionAddMidpoint,
13377 actionAddVertex: () => actionAddVertex,
13378 actionChangeMember: () => actionChangeMember,
13379 actionChangePreset: () => actionChangePreset,
13380 actionChangeTags: () => actionChangeTags,
13381 actionCircularize: () => actionCircularize,
13382 actionConnect: () => actionConnect,
13383 actionCopyEntities: () => actionCopyEntities,
13384 actionDeleteMember: () => actionDeleteMember,
13385 actionDeleteMultiple: () => actionDeleteMultiple,
13386 actionDeleteNode: () => actionDeleteNode,
13387 actionDeleteRelation: () => actionDeleteRelation,
13388 actionDeleteWay: () => actionDeleteWay,
13389 actionDiscardTags: () => actionDiscardTags,
13390 actionDisconnect: () => actionDisconnect,
13391 actionExtract: () => actionExtract,
13392 actionJoin: () => actionJoin,
13393 actionMerge: () => actionMerge,
13394 actionMergeNodes: () => actionMergeNodes,
13395 actionMergePolygon: () => actionMergePolygon,
13396 actionMergeRemoteChanges: () => actionMergeRemoteChanges,
13397 actionMove: () => actionMove,
13398 actionMoveMember: () => actionMoveMember,
13399 actionMoveNode: () => actionMoveNode,
13400 actionNoop: () => actionNoop,
13401 actionOrthogonalize: () => actionOrthogonalize,
13402 actionReflect: () => actionReflect,
13403 actionRestrictTurn: () => actionRestrictTurn,
13404 actionReverse: () => actionReverse,
13405 actionRevert: () => actionRevert,
13406 actionRotate: () => actionRotate,
13407 actionScale: () => actionScale,
13408 actionSplit: () => actionSplit,
13409 actionStraightenNodes: () => actionStraightenNodes,
13410 actionStraightenWay: () => actionStraightenWay,
13411 actionUnrestrictTurn: () => actionUnrestrictTurn,
13412 actionUpgradeTags: () => actionUpgradeTags,
13413 behaviorAddWay: () => behaviorAddWay,
13414 behaviorBreathe: () => behaviorBreathe,
13415 behaviorDrag: () => behaviorDrag,
13416 behaviorDraw: () => behaviorDraw,
13417 behaviorDrawWay: () => behaviorDrawWay,
13418 behaviorEdit: () => behaviorEdit,
13419 behaviorHash: () => behaviorHash,
13420 behaviorHover: () => behaviorHover,
13421 behaviorLasso: () => behaviorLasso,
13422 behaviorOperation: () => behaviorOperation,
13423 behaviorPaste: () => behaviorPaste,
13424 behaviorSelect: () => behaviorSelect,
13425 coreContext: () => coreContext,
13426 coreDifference: () => coreDifference,
13427 coreFileFetcher: () => coreFileFetcher,
13428 coreGraph: () => coreGraph,
13429 coreHistory: () => coreHistory,
13430 coreLocalizer: () => coreLocalizer,
13431 coreTree: () => coreTree,
13432 coreUploader: () => coreUploader,
13433 coreValidator: () => coreValidator,
13435 debug: () => debug,
13436 dmsCoordinatePair: () => dmsCoordinatePair,
13437 dmsMatcher: () => dmsMatcher,
13438 fileFetcher: () => _mainFileFetcher,
13439 geoAngle: () => geoAngle,
13440 geoChooseEdge: () => geoChooseEdge,
13441 geoEdgeEqual: () => geoEdgeEqual,
13442 geoExtent: () => geoExtent,
13443 geoGetSmallestSurroundingRectangle: () => geoGetSmallestSurroundingRectangle,
13444 geoHasLineIntersections: () => geoHasLineIntersections,
13445 geoHasSelfIntersections: () => geoHasSelfIntersections,
13446 geoLatToMeters: () => geoLatToMeters,
13447 geoLineIntersection: () => geoLineIntersection,
13448 geoLonToMeters: () => geoLonToMeters,
13449 geoMetersToLat: () => geoMetersToLat,
13450 geoMetersToLon: () => geoMetersToLon,
13451 geoMetersToOffset: () => geoMetersToOffset,
13452 geoOffsetToMeters: () => geoOffsetToMeters,
13453 geoOrthoCalcScore: () => geoOrthoCalcScore,
13454 geoOrthoCanOrthogonalize: () => geoOrthoCanOrthogonalize,
13455 geoOrthoMaxOffsetAngle: () => geoOrthoMaxOffsetAngle,
13456 geoOrthoNormalizedDotProduct: () => geoOrthoNormalizedDotProduct,
13457 geoPathHasIntersections: () => geoPathHasIntersections,
13458 geoPathIntersections: () => geoPathIntersections,
13459 geoPathLength: () => geoPathLength,
13460 geoPointInPolygon: () => geoPointInPolygon,
13461 geoPolygonContainsPolygon: () => geoPolygonContainsPolygon,
13462 geoPolygonIntersectsPolygon: () => geoPolygonIntersectsPolygon,
13463 geoRawMercator: () => geoRawMercator,
13464 geoRotate: () => geoRotate,
13465 geoScaleToZoom: () => geoScaleToZoom,
13466 geoSphericalClosestNode: () => geoSphericalClosestNode,
13467 geoSphericalDistance: () => geoSphericalDistance,
13468 geoVecAdd: () => geoVecAdd,
13469 geoVecAngle: () => geoVecAngle,
13470 geoVecCross: () => geoVecCross,
13471 geoVecDot: () => geoVecDot,
13472 geoVecEqual: () => geoVecEqual,
13473 geoVecFloor: () => geoVecFloor,
13474 geoVecInterp: () => geoVecInterp,
13475 geoVecLength: () => geoVecLength,
13476 geoVecLengthSquare: () => geoVecLengthSquare,
13477 geoVecNormalize: () => geoVecNormalize,
13478 geoVecNormalizedDot: () => geoVecNormalizedDot,
13479 geoVecProject: () => geoVecProject,
13480 geoVecScale: () => geoVecScale,
13481 geoVecSubtract: () => geoVecSubtract,
13482 geoViewportEdge: () => geoViewportEdge,
13483 geoZoomToScale: () => geoZoomToScale,
13484 likelyRawNumberFormat: () => likelyRawNumberFormat,
13485 localizer: () => _mainLocalizer,
13486 locationManager: () => _sharedLocationManager,
13487 modeAddArea: () => modeAddArea,
13488 modeAddLine: () => modeAddLine,
13489 modeAddNote: () => modeAddNote,
13490 modeAddPoint: () => modeAddPoint,
13491 modeBrowse: () => modeBrowse,
13492 modeDragNode: () => modeDragNode,
13493 modeDragNote: () => modeDragNote,
13494 modeDrawArea: () => modeDrawArea,
13495 modeDrawLine: () => modeDrawLine,
13496 modeMove: () => modeMove,
13497 modeRotate: () => modeRotate,
13498 modeSave: () => modeSave,
13499 modeSelect: () => modeSelect,
13500 modeSelectData: () => modeSelectData,
13501 modeSelectError: () => modeSelectError,
13502 modeSelectNote: () => modeSelectNote,
13503 operationCircularize: () => operationCircularize,
13504 operationContinue: () => operationContinue,
13505 operationCopy: () => operationCopy,
13506 operationDelete: () => operationDelete,
13507 operationDisconnect: () => operationDisconnect,
13508 operationDowngrade: () => operationDowngrade,
13509 operationExtract: () => operationExtract,
13510 operationMerge: () => operationMerge,
13511 operationMove: () => operationMove,
13512 operationOrthogonalize: () => operationOrthogonalize,
13513 operationPaste: () => operationPaste,
13514 operationReflectLong: () => operationReflectLong,
13515 operationReflectShort: () => operationReflectShort,
13516 operationReverse: () => operationReverse,
13517 operationRotate: () => operationRotate,
13518 operationSplit: () => operationSplit,
13519 operationStraighten: () => operationStraighten,
13520 osmAreaKeys: () => osmAreaKeys,
13521 osmChangeset: () => osmChangeset,
13522 osmEntity: () => osmEntity,
13523 osmFlowingWaterwayTagValues: () => osmFlowingWaterwayTagValues,
13524 osmInferRestriction: () => osmInferRestriction,
13525 osmIntersection: () => osmIntersection,
13526 osmIsInterestingTag: () => osmIsInterestingTag,
13527 osmJoinWays: () => osmJoinWays,
13528 osmLanes: () => osmLanes,
13529 osmLifecyclePrefixes: () => osmLifecyclePrefixes,
13530 osmNode: () => osmNode,
13531 osmNodeGeometriesForTags: () => osmNodeGeometriesForTags,
13532 osmNote: () => osmNote,
13533 osmOneWayTags: () => osmOneWayTags,
13534 osmPavedTags: () => osmPavedTags,
13535 osmPointTags: () => osmPointTags,
13536 osmRailwayTrackTagValues: () => osmRailwayTrackTagValues,
13537 osmRelation: () => osmRelation,
13538 osmRemoveLifecyclePrefix: () => osmRemoveLifecyclePrefix,
13539 osmRoutableHighwayTagValues: () => osmRoutableHighwayTagValues,
13540 osmSetAreaKeys: () => osmSetAreaKeys,
13541 osmSetPointTags: () => osmSetPointTags,
13542 osmSetVertexTags: () => osmSetVertexTags,
13543 osmTagSuggestingArea: () => osmTagSuggestingArea,
13544 osmTurn: () => osmTurn,
13545 osmVertexTags: () => osmVertexTags,
13546 osmWay: () => osmWay,
13547 prefs: () => corePreferences,
13548 presetCategory: () => presetCategory,
13549 presetCollection: () => presetCollection,
13550 presetField: () => presetField,
13551 presetIndex: () => presetIndex,
13552 presetManager: () => _mainPresetIndex,
13553 presetPreset: () => presetPreset,
13554 rendererBackground: () => rendererBackground,
13555 rendererBackgroundSource: () => rendererBackgroundSource,
13556 rendererFeatures: () => rendererFeatures,
13557 rendererMap: () => rendererMap,
13558 rendererPhotos: () => rendererPhotos,
13559 rendererTileLayer: () => rendererTileLayer,
13560 serviceKartaview: () => kartaview_default,
13561 serviceKeepRight: () => keepRight_default,
13562 serviceMapRules: () => maprules_default,
13563 serviceMapilio: () => mapilio_default,
13564 serviceMapillary: () => mapillary_default,
13565 serviceNominatim: () => nominatim_default,
13566 serviceNsi: () => nsi_default,
13567 serviceOsm: () => osm_default,
13568 serviceOsmWikibase: () => osm_wikibase_default,
13569 serviceOsmose: () => osmose_default,
13570 servicePanoramax: () => panoramax_default,
13571 serviceStreetside: () => streetside_default,
13572 serviceTaginfo: () => taginfo_default,
13573 serviceVectorTile: () => vector_tile_default,
13574 serviceVegbilder: () => vegbilder_default,
13575 serviceWikidata: () => wikidata_default,
13576 serviceWikipedia: () => wikipedia_default,
13577 services: () => services,
13578 svgAreas: () => svgAreas,
13579 svgData: () => svgData,
13580 svgDebug: () => svgDebug,
13581 svgDefs: () => svgDefs,
13582 svgGeolocate: () => svgGeolocate,
13583 svgIcon: () => svgIcon,
13584 svgKartaviewImages: () => svgKartaviewImages,
13585 svgKeepRight: () => svgKeepRight,
13586 svgLabels: () => svgLabels,
13587 svgLayers: () => svgLayers,
13588 svgLines: () => svgLines,
13589 svgMapilioImages: () => svgMapilioImages,
13590 svgMapillaryImages: () => svgMapillaryImages,
13591 svgMapillarySigns: () => svgMapillarySigns,
13592 svgMarkerSegments: () => svgMarkerSegments,
13593 svgMidpoints: () => svgMidpoints,
13594 svgNotes: () => svgNotes,
13595 svgOsm: () => svgOsm,
13596 svgPanoramaxImages: () => svgPanoramaxImages,
13597 svgPassiveVertex: () => svgPassiveVertex,
13598 svgPath: () => svgPath,
13599 svgPointTransform: () => svgPointTransform,
13600 svgPoints: () => svgPoints,
13601 svgRelationMemberTags: () => svgRelationMemberTags,
13602 svgSegmentWay: () => svgSegmentWay,
13603 svgStreetside: () => svgStreetside,
13604 svgTagClasses: () => svgTagClasses,
13605 svgTagPattern: () => svgTagPattern,
13606 svgTouch: () => svgTouch,
13607 svgTurns: () => svgTurns,
13608 svgVegbilder: () => svgVegbilder,
13609 svgVertices: () => svgVertices,
13611 uiAccount: () => uiAccount,
13612 uiAttribution: () => uiAttribution,
13613 uiChangesetEditor: () => uiChangesetEditor,
13614 uiCmd: () => uiCmd,
13615 uiCombobox: () => uiCombobox,
13616 uiCommit: () => uiCommit,
13617 uiCommitWarnings: () => uiCommitWarnings,
13618 uiConfirm: () => uiConfirm,
13619 uiConflicts: () => uiConflicts,
13620 uiContributors: () => uiContributors,
13621 uiCurtain: () => uiCurtain,
13622 uiDataEditor: () => uiDataEditor,
13623 uiDataHeader: () => uiDataHeader,
13624 uiDisclosure: () => uiDisclosure,
13625 uiEditMenu: () => uiEditMenu,
13626 uiEntityEditor: () => uiEntityEditor,
13627 uiFeatureInfo: () => uiFeatureInfo,
13628 uiFeatureList: () => uiFeatureList,
13629 uiField: () => uiField,
13630 uiFieldAccess: () => uiFieldAccess,
13631 uiFieldAddress: () => uiFieldAddress,
13632 uiFieldCheck: () => uiFieldCheck,
13633 uiFieldColour: () => uiFieldText,
13634 uiFieldCombo: () => uiFieldCombo,
13635 uiFieldDefaultCheck: () => uiFieldCheck,
13636 uiFieldDirectionalCombo: () => uiFieldDirectionalCombo,
13637 uiFieldEmail: () => uiFieldText,
13638 uiFieldHelp: () => uiFieldHelp,
13639 uiFieldIdentifier: () => uiFieldText,
13640 uiFieldLanes: () => uiFieldLanes,
13641 uiFieldLocalized: () => uiFieldLocalized,
13642 uiFieldManyCombo: () => uiFieldCombo,
13643 uiFieldMultiCombo: () => uiFieldCombo,
13644 uiFieldNetworkCombo: () => uiFieldCombo,
13645 uiFieldNumber: () => uiFieldText,
13646 uiFieldOnewayCheck: () => uiFieldCheck,
13647 uiFieldRadio: () => uiFieldRadio,
13648 uiFieldRestrictions: () => uiFieldRestrictions,
13649 uiFieldRoadheight: () => uiFieldRoadheight,
13650 uiFieldRoadspeed: () => uiFieldRoadspeed,
13651 uiFieldSemiCombo: () => uiFieldCombo,
13652 uiFieldStructureRadio: () => uiFieldRadio,
13653 uiFieldTel: () => uiFieldText,
13654 uiFieldText: () => uiFieldText,
13655 uiFieldTextarea: () => uiFieldTextarea,
13656 uiFieldTypeCombo: () => uiFieldCombo,
13657 uiFieldUrl: () => uiFieldText,
13658 uiFieldWikidata: () => uiFieldWikidata,
13659 uiFieldWikipedia: () => uiFieldWikipedia,
13660 uiFields: () => uiFields,
13661 uiFlash: () => uiFlash,
13662 uiFormFields: () => uiFormFields,
13663 uiFullScreen: () => uiFullScreen,
13664 uiGeolocate: () => uiGeolocate,
13665 uiInfo: () => uiInfo,
13666 uiInfoPanels: () => uiInfoPanels,
13667 uiInit: () => uiInit,
13668 uiInspector: () => uiInspector,
13669 uiIntro: () => uiIntro,
13670 uiIssuesInfo: () => uiIssuesInfo,
13671 uiKeepRightDetails: () => uiKeepRightDetails,
13672 uiKeepRightEditor: () => uiKeepRightEditor,
13673 uiKeepRightHeader: () => uiKeepRightHeader,
13674 uiLasso: () => uiLasso,
13675 uiLengthIndicator: () => uiLengthIndicator,
13676 uiLoading: () => uiLoading,
13677 uiMapInMap: () => uiMapInMap,
13678 uiModal: () => uiModal,
13679 uiNoteComments: () => uiNoteComments,
13680 uiNoteEditor: () => uiNoteEditor,
13681 uiNoteHeader: () => uiNoteHeader,
13682 uiNoteReport: () => uiNoteReport,
13683 uiNotice: () => uiNotice,
13684 uiPaneBackground: () => uiPaneBackground,
13685 uiPaneHelp: () => uiPaneHelp,
13686 uiPaneIssues: () => uiPaneIssues,
13687 uiPaneMapData: () => uiPaneMapData,
13688 uiPanePreferences: () => uiPanePreferences,
13689 uiPanelBackground: () => uiPanelBackground,
13690 uiPanelHistory: () => uiPanelHistory,
13691 uiPanelLocation: () => uiPanelLocation,
13692 uiPanelMeasurement: () => uiPanelMeasurement,
13693 uiPopover: () => uiPopover,
13694 uiPresetIcon: () => uiPresetIcon,
13695 uiPresetList: () => uiPresetList,
13696 uiRestore: () => uiRestore,
13697 uiScale: () => uiScale,
13698 uiSectionBackgroundDisplayOptions: () => uiSectionBackgroundDisplayOptions,
13699 uiSectionBackgroundList: () => uiSectionBackgroundList,
13700 uiSectionBackgroundOffset: () => uiSectionBackgroundOffset,
13701 uiSectionChanges: () => uiSectionChanges,
13702 uiSectionDataLayers: () => uiSectionDataLayers,
13703 uiSectionEntityIssues: () => uiSectionEntityIssues,
13704 uiSectionFeatureType: () => uiSectionFeatureType,
13705 uiSectionMapFeatures: () => uiSectionMapFeatures,
13706 uiSectionMapStyleOptions: () => uiSectionMapStyleOptions,
13707 uiSectionOverlayList: () => uiSectionOverlayList,
13708 uiSectionPhotoOverlays: () => uiSectionPhotoOverlays,
13709 uiSectionPresetFields: () => uiSectionPresetFields,
13710 uiSectionPrivacy: () => uiSectionPrivacy,
13711 uiSectionRawMemberEditor: () => uiSectionRawMemberEditor,
13712 uiSectionRawMembershipEditor: () => uiSectionRawMembershipEditor,
13713 uiSectionRawTagEditor: () => uiSectionRawTagEditor,
13714 uiSectionSelectionList: () => uiSectionSelectionList,
13715 uiSectionValidationIssues: () => uiSectionValidationIssues,
13716 uiSectionValidationOptions: () => uiSectionValidationOptions,
13717 uiSectionValidationRules: () => uiSectionValidationRules,
13718 uiSectionValidationStatus: () => uiSectionValidationStatus,
13719 uiSettingsCustomBackground: () => uiSettingsCustomBackground,
13720 uiSettingsCustomData: () => uiSettingsCustomData,
13721 uiSidebar: () => uiSidebar,
13722 uiSourceSwitch: () => uiSourceSwitch,
13723 uiSpinner: () => uiSpinner,
13724 uiSplash: () => uiSplash,
13725 uiStatus: () => uiStatus,
13726 uiSuccess: () => uiSuccess,
13727 uiTagReference: () => uiTagReference,
13728 uiToggle: () => uiToggle,
13729 uiTooltip: () => uiTooltip,
13730 uiVersion: () => uiVersion,
13731 uiViewOnKeepRight: () => uiViewOnKeepRight,
13732 uiViewOnOSM: () => uiViewOnOSM,
13733 uiZoom: () => uiZoom,
13734 utilAesDecrypt: () => utilAesDecrypt,
13735 utilAesEncrypt: () => utilAesEncrypt,
13736 utilArrayChunk: () => utilArrayChunk,
13737 utilArrayDifference: () => utilArrayDifference,
13738 utilArrayFlatten: () => utilArrayFlatten,
13739 utilArrayGroupBy: () => utilArrayGroupBy,
13740 utilArrayIdentical: () => utilArrayIdentical,
13741 utilArrayIntersection: () => utilArrayIntersection,
13742 utilArrayUnion: () => utilArrayUnion,
13743 utilArrayUniq: () => utilArrayUniq,
13744 utilArrayUniqBy: () => utilArrayUniqBy,
13745 utilAsyncMap: () => utilAsyncMap,
13746 utilCleanOsmString: () => utilCleanOsmString,
13747 utilCleanTags: () => utilCleanTags,
13748 utilCombinedTags: () => utilCombinedTags,
13749 utilCompareIDs: () => utilCompareIDs,
13750 utilDeepMemberSelector: () => utilDeepMemberSelector,
13751 utilDetect: () => utilDetect,
13752 utilDisplayLabel: () => utilDisplayLabel,
13753 utilDisplayName: () => utilDisplayName,
13754 utilDisplayNameForPath: () => utilDisplayNameForPath,
13755 utilDisplayType: () => utilDisplayType,
13756 utilEditDistance: () => utilEditDistance,
13757 utilEntityAndDeepMemberIDs: () => utilEntityAndDeepMemberIDs,
13758 utilEntityOrDeepMemberSelector: () => utilEntityOrDeepMemberSelector,
13759 utilEntityOrMemberSelector: () => utilEntityOrMemberSelector,
13760 utilEntityRoot: () => utilEntityRoot,
13761 utilEntitySelector: () => utilEntitySelector,
13762 utilFastMouse: () => utilFastMouse,
13763 utilFunctor: () => utilFunctor,
13764 utilGetAllNodes: () => utilGetAllNodes,
13765 utilGetSetValue: () => utilGetSetValue,
13766 utilHashcode: () => utilHashcode,
13767 utilHighlightEntities: () => utilHighlightEntities,
13768 utilKeybinding: () => utilKeybinding,
13769 utilNoAuto: () => utilNoAuto,
13770 utilObjectOmit: () => utilObjectOmit,
13771 utilOldestID: () => utilOldestID,
13772 utilPrefixCSSProperty: () => utilPrefixCSSProperty,
13773 utilPrefixDOMProperty: () => utilPrefixDOMProperty,
13774 utilQsString: () => utilQsString,
13775 utilRebind: () => utilRebind,
13776 utilSafeClassName: () => utilSafeClassName,
13777 utilSessionMutex: () => utilSessionMutex,
13778 utilSetTransform: () => utilSetTransform,
13779 utilStringQs: () => utilStringQs,
13780 utilTagDiff: () => utilTagDiff,
13781 utilTagText: () => utilTagText,
13782 utilTiler: () => utilTiler,
13783 utilTotalExtent: () => utilTotalExtent,
13784 utilTriggerEvent: () => utilTriggerEvent,
13785 utilUnicodeCharsCount: () => utilUnicodeCharsCount,
13786 utilUnicodeCharsTruncated: () => utilUnicodeCharsTruncated,
13787 utilUniqueDomId: () => utilUniqueDomId,
13788 utilWrap: () => utilWrap,
13789 validationAlmostJunction: () => validationAlmostJunction,
13790 validationCloseNodes: () => validationCloseNodes,
13791 validationCrossingWays: () => validationCrossingWays,
13792 validationDisconnectedWay: () => validationDisconnectedWay,
13793 validationFormatting: () => validationFormatting,
13794 validationHelpRequest: () => validationHelpRequest,
13795 validationImpossibleOneway: () => validationImpossibleOneway,
13796 validationIncompatibleSource: () => validationIncompatibleSource,
13797 validationMaprules: () => validationMaprules,
13798 validationMismatchedGeometry: () => validationMismatchedGeometry,
13799 validationMissingRole: () => validationMissingRole,
13800 validationMissingTag: () => validationMissingTag,
13801 validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
13802 validationOutdatedTags: () => validationOutdatedTags,
13803 validationPrivateData: () => validationPrivateData,
13804 validationSuspiciousName: () => validationSuspiciousName,
13805 validationUnsquareWay: () => validationUnsquareWay
13808 // modules/actions/add_entity.js
13809 function actionAddEntity(way) {
13810 return function(graph) {
13811 return graph.replace(way);
13815 // modules/actions/reverse.js
13816 function actionReverse(entityID, options2) {
13817 var ignoreKey = /^.*(_|:)?(description|name|note|website|ref|source|comment|watch|attribution)(_|:)?/;
13818 var numeric = /^([+\-]?)(?=[\d.])/;
13819 var directionKey = /direction$/;
13820 var turn_lanes = /^turn:lanes:?/;
13821 var keyReplacements = [
13822 [/:right$/, ":left"],
13823 [/:left$/, ":right"],
13824 [/:forward$/, ":backward"],
13825 [/:backward$/, ":forward"],
13826 [/:right:/, ":left:"],
13827 [/:left:/, ":right:"],
13828 [/:forward:/, ":backward:"],
13829 [/:backward:/, ":forward:"]
13831 var valueReplacements = {
13836 forward: "backward",
13837 backward: "forward",
13838 forwards: "backward",
13839 backwards: "forward"
13841 const valueReplacementsExceptions = {
13843 { highway: "cyclist_waiting_aid" }
13846 var roleReplacements = {
13847 forward: "backward",
13848 backward: "forward",
13849 forwards: "backward",
13850 backwards: "forward"
13852 var onewayReplacements = {
13857 var compassReplacements = {
13875 function reverseKey(key) {
13876 for (var i3 = 0; i3 < keyReplacements.length; ++i3) {
13877 var replacement = keyReplacements[i3];
13878 if (replacement[0].test(key)) {
13879 return key.replace(replacement[0], replacement[1]);
13884 function reverseValue(key, value, includeAbsolute, allTags) {
13885 if (ignoreKey.test(key)) return value;
13886 if (turn_lanes.test(key)) {
13888 } else if (key === "incline" && numeric.test(value)) {
13889 return value.replace(numeric, function(_2, sign2) {
13890 return sign2 === "-" ? "" : "-";
13892 } else if (options2 && options2.reverseOneway && key === "oneway") {
13893 return onewayReplacements[value] || value;
13894 } else if (includeAbsolute && directionKey.test(key)) {
13895 return value.split(";").map((value2) => {
13896 if (compassReplacements[value2]) return compassReplacements[value2];
13897 var degrees3 = Number(value2);
13898 if (isFinite(degrees3)) {
13899 if (degrees3 < 180) {
13904 return degrees3.toString();
13906 return valueReplacements[value2] || value2;
13910 if (valueReplacementsExceptions[key] && valueReplacementsExceptions[key].some(
13911 (exceptionTags) => Object.keys(exceptionTags).every((k2) => {
13912 const v2 = exceptionTags[k2];
13913 return allTags[k2] && (v2 === "*" || allTags[k2] === v2);
13918 return valueReplacements[value] || value;
13920 function reverseNodeTags(graph, nodeIDs) {
13921 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
13922 var node = graph.hasEntity(nodeIDs[i3]);
13923 if (!node || !Object.keys(node.tags).length) continue;
13925 for (var key in node.tags) {
13926 tags[reverseKey(key)] = reverseValue(key, node.tags[key], node.id === entityID, node.tags);
13928 graph = graph.replace(node.update({ tags }));
13932 function reverseWay(graph, way) {
13933 var nodes = way.nodes.slice().reverse();
13936 for (var key in way.tags) {
13937 tags[reverseKey(key)] = reverseValue(key, way.tags[key], false, way.tags);
13939 graph.parentRelations(way).forEach(function(relation) {
13940 relation.members.forEach(function(member, index) {
13941 if (member.id === way.id && (role = roleReplacements[member.role])) {
13942 relation = relation.updateMember({ role }, index);
13943 graph = graph.replace(relation);
13947 return reverseNodeTags(graph, nodes).replace(way.update({ nodes, tags }));
13949 var action = function(graph) {
13950 var entity = graph.entity(entityID);
13951 if (entity.type === "way") {
13952 return reverseWay(graph, entity);
13954 return reverseNodeTags(graph, [entityID]);
13956 action.disabled = function(graph) {
13957 var entity = graph.hasEntity(entityID);
13958 if (!entity || entity.type === "way") return false;
13959 for (var key in entity.tags) {
13960 var value = entity.tags[key];
13961 if (reverseKey(key) !== key || reverseValue(key, value, true, entity.tags) !== value) {
13965 return "nondirectional_node";
13967 action.entityID = function() {
13973 // node_modules/d3-array/src/ascending.js
13974 function ascending(a2, b2) {
13975 return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
13978 // node_modules/d3-array/src/descending.js
13979 function descending(a2, b2) {
13980 return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
13983 // node_modules/d3-array/src/bisector.js
13984 function bisector(f2) {
13985 let compare1, compare2, delta;
13986 if (f2.length !== 2) {
13987 compare1 = ascending;
13988 compare2 = (d2, x2) => ascending(f2(d2), x2);
13989 delta = (d2, x2) => f2(d2) - x2;
13991 compare1 = f2 === ascending || f2 === descending ? f2 : zero;
13995 function left(a2, x2, lo = 0, hi = a2.length) {
13997 if (compare1(x2, x2) !== 0) return hi;
13999 const mid = lo + hi >>> 1;
14000 if (compare2(a2[mid], x2) < 0) lo = mid + 1;
14006 function right(a2, x2, lo = 0, hi = a2.length) {
14008 if (compare1(x2, x2) !== 0) return hi;
14010 const mid = lo + hi >>> 1;
14011 if (compare2(a2[mid], x2) <= 0) lo = mid + 1;
14017 function center(a2, x2, lo = 0, hi = a2.length) {
14018 const i3 = left(a2, x2, lo, hi - 1);
14019 return i3 > lo && delta(a2[i3 - 1], x2) > -delta(a2[i3], x2) ? i3 - 1 : i3;
14021 return { left, center, right };
14027 // node_modules/d3-array/src/number.js
14028 function number(x2) {
14029 return x2 === null ? NaN : +x2;
14031 function* numbers(values, valueof) {
14032 if (valueof === void 0) {
14033 for (let value of values) {
14034 if (value != null && (value = +value) >= value) {
14040 for (let value of values) {
14041 if ((value = valueof(value, ++index, values)) != null && (value = +value) >= value) {
14048 // node_modules/d3-array/src/bisect.js
14049 var ascendingBisect = bisector(ascending);
14050 var bisectRight = ascendingBisect.right;
14051 var bisectLeft = ascendingBisect.left;
14052 var bisectCenter = bisector(number).center;
14053 var bisect_default = bisectRight;
14055 // node_modules/d3-array/src/fsum.js
14056 var Adder = class {
14058 this._partials = new Float64Array(32);
14062 const p2 = this._partials;
14064 for (let j2 = 0; j2 < this._n && j2 < 32; j2++) {
14065 const y2 = p2[j2], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2);
14066 if (lo) p2[i3++] = lo;
14074 const p2 = this._partials;
14075 let n3 = this._n, x2, y2, lo, hi = 0;
14082 lo = y2 - (hi - x2);
14085 if (n3 > 0 && (lo < 0 && p2[n3 - 1] < 0 || lo > 0 && p2[n3 - 1] > 0)) {
14088 if (y2 == x2 - hi) hi = x2;
14095 // node_modules/d3-array/src/sort.js
14096 function compareDefined(compare2 = ascending) {
14097 if (compare2 === ascending) return ascendingDefined;
14098 if (typeof compare2 !== "function") throw new TypeError("compare is not a function");
14099 return (a2, b2) => {
14100 const x2 = compare2(a2, b2);
14101 if (x2 || x2 === 0) return x2;
14102 return (compare2(b2, b2) === 0) - (compare2(a2, a2) === 0);
14105 function ascendingDefined(a2, b2) {
14106 return (a2 == null || !(a2 >= a2)) - (b2 == null || !(b2 >= b2)) || (a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
14109 // node_modules/d3-array/src/ticks.js
14110 var e10 = Math.sqrt(50);
14111 var e5 = Math.sqrt(10);
14112 var e2 = Math.sqrt(2);
14113 function ticks(start2, stop, count) {
14114 var reverse, i3 = -1, n3, ticks2, step;
14115 stop = +stop, start2 = +start2, count = +count;
14116 if (start2 === stop && count > 0) return [start2];
14117 if (reverse = stop < start2) n3 = start2, start2 = stop, stop = n3;
14118 if ((step = tickIncrement(start2, stop, count)) === 0 || !isFinite(step)) return [];
14120 let r0 = Math.round(start2 / step), r1 = Math.round(stop / step);
14121 if (r0 * step < start2) ++r0;
14122 if (r1 * step > stop) --r1;
14123 ticks2 = new Array(n3 = r1 - r0 + 1);
14124 while (++i3 < n3) ticks2[i3] = (r0 + i3) * step;
14127 let r0 = Math.round(start2 * step), r1 = Math.round(stop * step);
14128 if (r0 / step < start2) ++r0;
14129 if (r1 / step > stop) --r1;
14130 ticks2 = new Array(n3 = r1 - r0 + 1);
14131 while (++i3 < n3) ticks2[i3] = (r0 + i3) / step;
14133 if (reverse) ticks2.reverse();
14136 function tickIncrement(start2, stop, count) {
14137 var step = (stop - start2) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
14138 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);
14140 function tickStep(start2, stop, count) {
14141 var step0 = Math.abs(stop - start2) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
14142 if (error >= e10) step1 *= 10;
14143 else if (error >= e5) step1 *= 5;
14144 else if (error >= e2) step1 *= 2;
14145 return stop < start2 ? -step1 : step1;
14148 // node_modules/d3-array/src/max.js
14149 function max(values, valueof) {
14151 if (valueof === void 0) {
14152 for (const value of values) {
14153 if (value != null && (max3 < value || max3 === void 0 && value >= value)) {
14159 for (let value of values) {
14160 if ((value = valueof(value, ++index, values)) != null && (max3 < value || max3 === void 0 && value >= value)) {
14168 // node_modules/d3-array/src/min.js
14169 function min(values, valueof) {
14171 if (valueof === void 0) {
14172 for (const value of values) {
14173 if (value != null && (min3 > value || min3 === void 0 && value >= value)) {
14179 for (let value of values) {
14180 if ((value = valueof(value, ++index, values)) != null && (min3 > value || min3 === void 0 && value >= value)) {
14188 // node_modules/d3-array/src/quickselect.js
14189 function quickselect(array2, k2, left = 0, right = array2.length - 1, compare2) {
14190 compare2 = compare2 === void 0 ? ascendingDefined : compareDefined(compare2);
14191 while (right > left) {
14192 if (right - left > 600) {
14193 const n3 = right - left + 1;
14194 const m2 = k2 - left + 1;
14195 const z2 = Math.log(n3);
14196 const s2 = 0.5 * Math.exp(2 * z2 / 3);
14197 const sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
14198 const newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
14199 const newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
14200 quickselect(array2, k2, newLeft, newRight, compare2);
14202 const t2 = array2[k2];
14205 swap(array2, left, k2);
14206 if (compare2(array2[right], t2) > 0) swap(array2, left, right);
14208 swap(array2, i3, j2), ++i3, --j2;
14209 while (compare2(array2[i3], t2) < 0) ++i3;
14210 while (compare2(array2[j2], t2) > 0) --j2;
14212 if (compare2(array2[left], t2) === 0) swap(array2, left, j2);
14213 else ++j2, swap(array2, j2, right);
14214 if (j2 <= k2) left = j2 + 1;
14215 if (k2 <= j2) right = j2 - 1;
14219 function swap(array2, i3, j2) {
14220 const t2 = array2[i3];
14221 array2[i3] = array2[j2];
14225 // node_modules/d3-array/src/quantile.js
14226 function quantile(values, p2, valueof) {
14227 values = Float64Array.from(numbers(values, valueof));
14228 if (!(n3 = values.length)) return;
14229 if ((p2 = +p2) <= 0 || n3 < 2) return min(values);
14230 if (p2 >= 1) return max(values);
14231 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));
14232 return value0 + (value1 - value0) * (i3 - i0);
14235 // node_modules/d3-array/src/median.js
14236 function median(values, valueof) {
14237 return quantile(values, 0.5, valueof);
14240 // node_modules/d3-array/src/merge.js
14241 function* flatten(arrays) {
14242 for (const array2 of arrays) {
14246 function merge(arrays) {
14247 return Array.from(flatten(arrays));
14250 // node_modules/d3-array/src/pairs.js
14251 function pairs(values, pairof = pair) {
14255 for (const value of values) {
14256 if (first) pairs2.push(pairof(previous, value));
14262 function pair(a2, b2) {
14266 // node_modules/d3-array/src/range.js
14267 function range(start2, stop, step) {
14268 start2 = +start2, stop = +stop, step = (n3 = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n3 < 3 ? 1 : +step;
14269 var i3 = -1, n3 = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range3 = new Array(n3);
14270 while (++i3 < n3) {
14271 range3[i3] = start2 + i3 * step;
14276 // node_modules/d3-geo/src/math.js
14277 var epsilon = 1e-6;
14278 var epsilon2 = 1e-12;
14280 var halfPi = pi / 2;
14281 var quarterPi = pi / 4;
14283 var degrees = 180 / pi;
14284 var radians = pi / 180;
14285 var abs = Math.abs;
14286 var atan = Math.atan;
14287 var atan2 = Math.atan2;
14288 var cos = Math.cos;
14289 var exp = Math.exp;
14290 var log = Math.log;
14291 var sin = Math.sin;
14292 var sign = Math.sign || function(x2) {
14293 return x2 > 0 ? 1 : x2 < 0 ? -1 : 0;
14295 var sqrt = Math.sqrt;
14296 var tan = Math.tan;
14297 function acos(x2) {
14298 return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
14300 function asin(x2) {
14301 return x2 > 1 ? halfPi : x2 < -1 ? -halfPi : Math.asin(x2);
14304 // node_modules/d3-geo/src/noop.js
14308 // node_modules/d3-geo/src/stream.js
14309 function streamGeometry(geometry, stream) {
14310 if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) {
14311 streamGeometryType[geometry.type](geometry, stream);
14314 var streamObjectType = {
14315 Feature: function(object, stream) {
14316 streamGeometry(object.geometry, stream);
14318 FeatureCollection: function(object, stream) {
14319 var features = object.features, i3 = -1, n3 = features.length;
14320 while (++i3 < n3) streamGeometry(features[i3].geometry, stream);
14323 var streamGeometryType = {
14324 Sphere: function(object, stream) {
14327 Point: function(object, stream) {
14328 object = object.coordinates;
14329 stream.point(object[0], object[1], object[2]);
14331 MultiPoint: function(object, stream) {
14332 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14333 while (++i3 < n3) object = coordinates[i3], stream.point(object[0], object[1], object[2]);
14335 LineString: function(object, stream) {
14336 streamLine(object.coordinates, stream, 0);
14338 MultiLineString: function(object, stream) {
14339 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14340 while (++i3 < n3) streamLine(coordinates[i3], stream, 0);
14342 Polygon: function(object, stream) {
14343 streamPolygon(object.coordinates, stream);
14345 MultiPolygon: function(object, stream) {
14346 var coordinates = object.coordinates, i3 = -1, n3 = coordinates.length;
14347 while (++i3 < n3) streamPolygon(coordinates[i3], stream);
14349 GeometryCollection: function(object, stream) {
14350 var geometries = object.geometries, i3 = -1, n3 = geometries.length;
14351 while (++i3 < n3) streamGeometry(geometries[i3], stream);
14354 function streamLine(coordinates, stream, closed) {
14355 var i3 = -1, n3 = coordinates.length - closed, coordinate;
14356 stream.lineStart();
14357 while (++i3 < n3) coordinate = coordinates[i3], stream.point(coordinate[0], coordinate[1], coordinate[2]);
14360 function streamPolygon(coordinates, stream) {
14361 var i3 = -1, n3 = coordinates.length;
14362 stream.polygonStart();
14363 while (++i3 < n3) streamLine(coordinates[i3], stream, 1);
14364 stream.polygonEnd();
14366 function stream_default(object, stream) {
14367 if (object && streamObjectType.hasOwnProperty(object.type)) {
14368 streamObjectType[object.type](object, stream);
14370 streamGeometry(object, stream);
14374 // node_modules/d3-geo/src/area.js
14375 var areaRingSum = new Adder();
14376 var areaSum = new Adder();
14386 polygonStart: function() {
14387 areaRingSum = new Adder();
14388 areaStream.lineStart = areaRingStart;
14389 areaStream.lineEnd = areaRingEnd;
14391 polygonEnd: function() {
14392 var areaRing = +areaRingSum;
14393 areaSum.add(areaRing < 0 ? tau + areaRing : areaRing);
14394 this.lineStart = this.lineEnd = this.point = noop;
14396 sphere: function() {
14400 function areaRingStart() {
14401 areaStream.point = areaPointFirst;
14403 function areaRingEnd() {
14404 areaPoint(lambda00, phi00);
14406 function areaPointFirst(lambda, phi) {
14407 areaStream.point = areaPoint;
14408 lambda00 = lambda, phi00 = phi;
14409 lambda *= radians, phi *= radians;
14410 lambda0 = lambda, cosPhi0 = cos(phi = phi / 2 + quarterPi), sinPhi0 = sin(phi);
14412 function areaPoint(lambda, phi) {
14413 lambda *= radians, phi *= radians;
14414 phi = phi / 2 + quarterPi;
14415 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);
14416 areaRingSum.add(atan2(v2, u2));
14417 lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
14419 function area_default(object) {
14420 areaSum = new Adder();
14421 stream_default(object, areaStream);
14422 return areaSum * 2;
14425 // node_modules/d3-geo/src/cartesian.js
14426 function spherical(cartesian2) {
14427 return [atan2(cartesian2[1], cartesian2[0]), asin(cartesian2[2])];
14429 function cartesian(spherical2) {
14430 var lambda = spherical2[0], phi = spherical2[1], cosPhi = cos(phi);
14431 return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)];
14433 function cartesianDot(a2, b2) {
14434 return a2[0] * b2[0] + a2[1] * b2[1] + a2[2] * b2[2];
14436 function cartesianCross(a2, b2) {
14437 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]];
14439 function cartesianAddInPlace(a2, b2) {
14440 a2[0] += b2[0], a2[1] += b2[1], a2[2] += b2[2];
14442 function cartesianScale(vector, k2) {
14443 return [vector[0] * k2, vector[1] * k2, vector[2] * k2];
14445 function cartesianNormalizeInPlace(d2) {
14446 var l2 = sqrt(d2[0] * d2[0] + d2[1] * d2[1] + d2[2] * d2[2]);
14447 d2[0] /= l2, d2[1] /= l2, d2[2] /= l2;
14450 // node_modules/d3-geo/src/bounds.js
14462 var boundsStream = {
14463 point: boundsPoint,
14464 lineStart: boundsLineStart,
14465 lineEnd: boundsLineEnd,
14466 polygonStart: function() {
14467 boundsStream.point = boundsRingPoint;
14468 boundsStream.lineStart = boundsRingStart;
14469 boundsStream.lineEnd = boundsRingEnd;
14470 deltaSum = new Adder();
14471 areaStream.polygonStart();
14473 polygonEnd: function() {
14474 areaStream.polygonEnd();
14475 boundsStream.point = boundsPoint;
14476 boundsStream.lineStart = boundsLineStart;
14477 boundsStream.lineEnd = boundsLineEnd;
14478 if (areaRingSum < 0) lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
14479 else if (deltaSum > epsilon) phi1 = 90;
14480 else if (deltaSum < -epsilon) phi0 = -90;
14481 range2[0] = lambda02, range2[1] = lambda1;
14483 sphere: function() {
14484 lambda02 = -(lambda1 = 180), phi0 = -(phi1 = 90);
14487 function boundsPoint(lambda, phi) {
14488 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
14489 if (phi < phi0) phi0 = phi;
14490 if (phi > phi1) phi1 = phi;
14492 function linePoint(lambda, phi) {
14493 var p2 = cartesian([lambda * radians, phi * radians]);
14495 var normal = cartesianCross(p0, p2), equatorial = [normal[1], -normal[0], 0], inflection = cartesianCross(equatorial, normal);
14496 cartesianNormalizeInPlace(inflection);
14497 inflection = spherical(inflection);
14498 var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs(delta) > 180;
14499 if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
14500 phii = inflection[1] * degrees;
14501 if (phii > phi1) phi1 = phii;
14502 } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) {
14503 phii = -inflection[1] * degrees;
14504 if (phii < phi0) phi0 = phii;
14506 if (phi < phi0) phi0 = phi;
14507 if (phi > phi1) phi1 = phi;
14509 if (antimeridian) {
14510 if (lambda < lambda2) {
14511 if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
14513 if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
14516 if (lambda1 >= lambda02) {
14517 if (lambda < lambda02) lambda02 = lambda;
14518 if (lambda > lambda1) lambda1 = lambda;
14520 if (lambda > lambda2) {
14521 if (angle(lambda02, lambda) > angle(lambda02, lambda1)) lambda1 = lambda;
14523 if (angle(lambda, lambda1) > angle(lambda02, lambda1)) lambda02 = lambda;
14528 ranges.push(range2 = [lambda02 = lambda, lambda1 = lambda]);
14530 if (phi < phi0) phi0 = phi;
14531 if (phi > phi1) phi1 = phi;
14532 p0 = p2, lambda2 = lambda;
14534 function boundsLineStart() {
14535 boundsStream.point = linePoint;
14537 function boundsLineEnd() {
14538 range2[0] = lambda02, range2[1] = lambda1;
14539 boundsStream.point = boundsPoint;
14542 function boundsRingPoint(lambda, phi) {
14544 var delta = lambda - lambda2;
14545 deltaSum.add(abs(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta);
14547 lambda002 = lambda, phi002 = phi;
14549 areaStream.point(lambda, phi);
14550 linePoint(lambda, phi);
14552 function boundsRingStart() {
14553 areaStream.lineStart();
14555 function boundsRingEnd() {
14556 boundsRingPoint(lambda002, phi002);
14557 areaStream.lineEnd();
14558 if (abs(deltaSum) > epsilon) lambda02 = -(lambda1 = 180);
14559 range2[0] = lambda02, range2[1] = lambda1;
14562 function angle(lambda04, lambda12) {
14563 return (lambda12 -= lambda04) < 0 ? lambda12 + 360 : lambda12;
14565 function rangeCompare(a2, b2) {
14566 return a2[0] - b2[0];
14568 function rangeContains(range3, x2) {
14569 return range3[0] <= range3[1] ? range3[0] <= x2 && x2 <= range3[1] : x2 < range3[0] || range3[1] < x2;
14571 function bounds_default(feature3) {
14572 var i3, n3, a2, b2, merged, deltaMax, delta;
14573 phi1 = lambda1 = -(lambda02 = phi0 = Infinity);
14575 stream_default(feature3, boundsStream);
14576 if (n3 = ranges.length) {
14577 ranges.sort(rangeCompare);
14578 for (i3 = 1, a2 = ranges[0], merged = [a2]; i3 < n3; ++i3) {
14580 if (rangeContains(a2, b2[0]) || rangeContains(a2, b2[1])) {
14581 if (angle(a2[0], b2[1]) > angle(a2[0], a2[1])) a2[1] = b2[1];
14582 if (angle(b2[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b2[0];
14584 merged.push(a2 = b2);
14587 for (deltaMax = -Infinity, n3 = merged.length - 1, i3 = 0, a2 = merged[n3]; i3 <= n3; a2 = b2, ++i3) {
14589 if ((delta = angle(a2[1], b2[0])) > deltaMax) deltaMax = delta, lambda02 = b2[0], lambda1 = a2[1];
14592 ranges = range2 = null;
14593 return lambda02 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda02, phi0], [lambda1, phi1]];
14596 // node_modules/d3-geo/src/compose.js
14597 function compose_default(a2, b2) {
14598 function compose(x2, y2) {
14599 return x2 = a2(x2, y2), b2(x2[0], x2[1]);
14601 if (a2.invert && b2.invert) compose.invert = function(x2, y2) {
14602 return x2 = b2.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]);
14607 // node_modules/d3-geo/src/rotation.js
14608 function rotationIdentity(lambda, phi) {
14609 return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi];
14611 rotationIdentity.invert = rotationIdentity;
14612 function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
14613 return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose_default(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
14615 function forwardRotationLambda(deltaLambda) {
14616 return function(lambda, phi) {
14617 return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi];
14620 function rotationLambda(deltaLambda) {
14621 var rotation = forwardRotationLambda(deltaLambda);
14622 rotation.invert = forwardRotationLambda(-deltaLambda);
14625 function rotationPhiGamma(deltaPhi, deltaGamma) {
14626 var cosDeltaPhi = cos(deltaPhi), sinDeltaPhi = sin(deltaPhi), cosDeltaGamma = cos(deltaGamma), sinDeltaGamma = sin(deltaGamma);
14627 function rotation(lambda, phi) {
14628 var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaPhi + x2 * sinDeltaPhi;
14630 atan2(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z2 * sinDeltaPhi),
14631 asin(k2 * cosDeltaGamma + y2 * sinDeltaGamma)
14634 rotation.invert = function(lambda, phi) {
14635 var cosPhi = cos(phi), x2 = cos(lambda) * cosPhi, y2 = sin(lambda) * cosPhi, z2 = sin(phi), k2 = z2 * cosDeltaGamma - y2 * sinDeltaGamma;
14637 atan2(y2 * cosDeltaGamma + z2 * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi),
14638 asin(k2 * cosDeltaPhi - x2 * sinDeltaPhi)
14643 function rotation_default(rotate) {
14644 rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0);
14645 function forward(coordinates) {
14646 coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians);
14647 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
14649 forward.invert = function(coordinates) {
14650 coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians);
14651 return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates;
14656 // node_modules/d3-geo/src/circle.js
14657 function circleStream(stream, radius, delta, direction, t0, t1) {
14658 if (!delta) return;
14659 var cosRadius = cos(radius), sinRadius = sin(radius), step = direction * delta;
14661 t0 = radius + direction * tau;
14662 t1 = radius - step / 2;
14664 t0 = circleRadius(cosRadius, t0);
14665 t1 = circleRadius(cosRadius, t1);
14666 if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau;
14668 for (var point, t2 = t0; direction > 0 ? t2 > t1 : t2 < t1; t2 -= step) {
14669 point = spherical([cosRadius, -sinRadius * cos(t2), -sinRadius * sin(t2)]);
14670 stream.point(point[0], point[1]);
14673 function circleRadius(cosRadius, point) {
14674 point = cartesian(point), point[0] -= cosRadius;
14675 cartesianNormalizeInPlace(point);
14676 var radius = acos(-point[1]);
14677 return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau;
14680 // node_modules/d3-geo/src/clip/buffer.js
14681 function buffer_default() {
14682 var lines = [], line;
14684 point: function(x2, y2, m2) {
14685 line.push([x2, y2, m2]);
14687 lineStart: function() {
14688 lines.push(line = []);
14691 rejoin: function() {
14692 if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
14694 result: function() {
14695 var result = lines;
14703 // node_modules/d3-geo/src/pointEqual.js
14704 function pointEqual_default(a2, b2) {
14705 return abs(a2[0] - b2[0]) < epsilon && abs(a2[1] - b2[1]) < epsilon;
14708 // node_modules/d3-geo/src/clip/rejoin.js
14709 function Intersection(point, points, other, entry) {
14715 this.n = this.p = null;
14717 function rejoin_default(segments, compareIntersection2, startInside, interpolate, stream) {
14718 var subject = [], clip = [], i3, n3;
14719 segments.forEach(function(segment) {
14720 if ((n4 = segment.length - 1) <= 0) return;
14721 var n4, p02 = segment[0], p1 = segment[n4], x2;
14722 if (pointEqual_default(p02, p1)) {
14723 if (!p02[2] && !p1[2]) {
14724 stream.lineStart();
14725 for (i3 = 0; i3 < n4; ++i3) stream.point((p02 = segment[i3])[0], p02[1]);
14729 p1[0] += 2 * epsilon;
14731 subject.push(x2 = new Intersection(p02, segment, null, true));
14732 clip.push(x2.o = new Intersection(p02, null, x2, false));
14733 subject.push(x2 = new Intersection(p1, segment, null, false));
14734 clip.push(x2.o = new Intersection(p1, null, x2, true));
14736 if (!subject.length) return;
14737 clip.sort(compareIntersection2);
14740 for (i3 = 0, n3 = clip.length; i3 < n3; ++i3) {
14741 clip[i3].e = startInside = !startInside;
14743 var start2 = subject[0], points, point;
14745 var current = start2, isSubject = true;
14746 while (current.v) if ((current = current.n) === start2) return;
14747 points = current.z;
14748 stream.lineStart();
14750 current.v = current.o.v = true;
14753 for (i3 = 0, n3 = points.length; i3 < n3; ++i3) stream.point((point = points[i3])[0], point[1]);
14755 interpolate(current.x, current.n.x, 1, stream);
14757 current = current.n;
14760 points = current.p.z;
14761 for (i3 = points.length - 1; i3 >= 0; --i3) stream.point((point = points[i3])[0], point[1]);
14763 interpolate(current.x, current.p.x, -1, stream);
14765 current = current.p;
14767 current = current.o;
14768 points = current.z;
14769 isSubject = !isSubject;
14770 } while (!current.v);
14774 function link(array2) {
14775 if (!(n3 = array2.length)) return;
14776 var n3, i3 = 0, a2 = array2[0], b2;
14777 while (++i3 < n3) {
14778 a2.n = b2 = array2[i3];
14782 a2.n = b2 = array2[0];
14786 // node_modules/d3-geo/src/polygonContains.js
14787 function longitude(point) {
14788 return abs(point[0]) <= pi ? point[0] : sign(point[0]) * ((abs(point[0]) + pi) % tau - pi);
14790 function polygonContains_default(polygon2, point) {
14791 var lambda = longitude(point), phi = point[1], sinPhi = sin(phi), normal = [sin(lambda), -cos(lambda), 0], angle2 = 0, winding = 0;
14792 var sum = new Adder();
14793 if (sinPhi === 1) phi = halfPi + epsilon;
14794 else if (sinPhi === -1) phi = -halfPi - epsilon;
14795 for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
14796 if (!(m2 = (ring = polygon2[i3]).length)) continue;
14797 var ring, m2, point0 = ring[m2 - 1], lambda04 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi03 = sin(phi02), cosPhi03 = cos(phi02);
14798 for (var j2 = 0; j2 < m2; ++j2, lambda04 = lambda12, sinPhi03 = sinPhi1, cosPhi03 = cosPhi1, point0 = point1) {
14799 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;
14800 sum.add(atan2(k2 * sign2 * sin(absDelta), cosPhi03 * cosPhi1 + k2 * cos(absDelta)));
14801 angle2 += antimeridian ? delta + sign2 * tau : delta;
14802 if (antimeridian ^ lambda04 >= lambda ^ lambda12 >= lambda) {
14803 var arc = cartesianCross(cartesian(point0), cartesian(point1));
14804 cartesianNormalizeInPlace(arc);
14805 var intersection2 = cartesianCross(normal, arc);
14806 cartesianNormalizeInPlace(intersection2);
14807 var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection2[2]);
14808 if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
14809 winding += antimeridian ^ delta >= 0 ? 1 : -1;
14814 return (angle2 < -epsilon || angle2 < epsilon && sum < -epsilon2) ^ winding & 1;
14817 // node_modules/d3-geo/src/clip/index.js
14818 function clip_default(pointVisible, clipLine, interpolate, start2) {
14819 return function(sink) {
14820 var line = clipLine(sink), ringBuffer = buffer_default(), ringSink = clipLine(ringBuffer), polygonStarted = false, polygon2, segments, ring;
14825 polygonStart: function() {
14826 clip.point = pointRing;
14827 clip.lineStart = ringStart;
14828 clip.lineEnd = ringEnd;
14832 polygonEnd: function() {
14833 clip.point = point;
14834 clip.lineStart = lineStart;
14835 clip.lineEnd = lineEnd;
14836 segments = merge(segments);
14837 var startInside = polygonContains_default(polygon2, start2);
14838 if (segments.length) {
14839 if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14840 rejoin_default(segments, compareIntersection, startInside, interpolate, sink);
14841 } else if (startInside) {
14842 if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14844 interpolate(null, null, 1, sink);
14847 if (polygonStarted) sink.polygonEnd(), polygonStarted = false;
14848 segments = polygon2 = null;
14850 sphere: function() {
14851 sink.polygonStart();
14853 interpolate(null, null, 1, sink);
14858 function point(lambda, phi) {
14859 if (pointVisible(lambda, phi)) sink.point(lambda, phi);
14861 function pointLine(lambda, phi) {
14862 line.point(lambda, phi);
14864 function lineStart() {
14865 clip.point = pointLine;
14868 function lineEnd() {
14869 clip.point = point;
14872 function pointRing(lambda, phi) {
14873 ring.push([lambda, phi]);
14874 ringSink.point(lambda, phi);
14876 function ringStart() {
14877 ringSink.lineStart();
14880 function ringEnd() {
14881 pointRing(ring[0][0], ring[0][1]);
14882 ringSink.lineEnd();
14883 var clean2 = ringSink.clean(), ringSegments = ringBuffer.result(), i3, n3 = ringSegments.length, m2, segment, point2;
14885 polygon2.push(ring);
14889 segment = ringSegments[0];
14890 if ((m2 = segment.length - 1) > 0) {
14891 if (!polygonStarted) sink.polygonStart(), polygonStarted = true;
14893 for (i3 = 0; i3 < m2; ++i3) sink.point((point2 = segment[i3])[0], point2[1]);
14898 if (n3 > 1 && clean2 & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift()));
14899 segments.push(ringSegments.filter(validSegment));
14904 function validSegment(segment) {
14905 return segment.length > 1;
14907 function compareIntersection(a2, b2) {
14908 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]);
14911 // node_modules/d3-geo/src/clip/antimeridian.js
14912 var antimeridian_default = clip_default(
14916 clipAntimeridianLine,
14917 clipAntimeridianInterpolate,
14920 function clipAntimeridianLine(stream) {
14921 var lambda04 = NaN, phi02 = NaN, sign0 = NaN, clean2;
14923 lineStart: function() {
14924 stream.lineStart();
14927 point: function(lambda12, phi12) {
14928 var sign1 = lambda12 > 0 ? pi : -pi, delta = abs(lambda12 - lambda04);
14929 if (abs(delta - pi) < epsilon) {
14930 stream.point(lambda04, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi : -halfPi);
14931 stream.point(sign0, phi02);
14933 stream.lineStart();
14934 stream.point(sign1, phi02);
14935 stream.point(lambda12, phi02);
14937 } else if (sign0 !== sign1 && delta >= pi) {
14938 if (abs(lambda04 - sign0) < epsilon) lambda04 -= sign0 * epsilon;
14939 if (abs(lambda12 - sign1) < epsilon) lambda12 -= sign1 * epsilon;
14940 phi02 = clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12);
14941 stream.point(sign0, phi02);
14943 stream.lineStart();
14944 stream.point(sign1, phi02);
14947 stream.point(lambda04 = lambda12, phi02 = phi12);
14950 lineEnd: function() {
14952 lambda04 = phi02 = NaN;
14954 clean: function() {
14959 function clipAntimeridianIntersect(lambda04, phi02, lambda12, phi12) {
14960 var cosPhi03, cosPhi1, sinLambda0Lambda1 = sin(lambda04 - lambda12);
14961 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;
14963 function clipAntimeridianInterpolate(from, to, direction, stream) {
14965 if (from == null) {
14966 phi = direction * halfPi;
14967 stream.point(-pi, phi);
14968 stream.point(0, phi);
14969 stream.point(pi, phi);
14970 stream.point(pi, 0);
14971 stream.point(pi, -phi);
14972 stream.point(0, -phi);
14973 stream.point(-pi, -phi);
14974 stream.point(-pi, 0);
14975 stream.point(-pi, phi);
14976 } else if (abs(from[0] - to[0]) > epsilon) {
14977 var lambda = from[0] < to[0] ? pi : -pi;
14978 phi = direction * lambda / 2;
14979 stream.point(-lambda, phi);
14980 stream.point(0, phi);
14981 stream.point(lambda, phi);
14983 stream.point(to[0], to[1]);
14987 // node_modules/d3-geo/src/clip/circle.js
14988 function circle_default(radius) {
14989 var cr = cos(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs(cr) > epsilon;
14990 function interpolate(from, to, direction, stream) {
14991 circleStream(stream, radius, delta, direction, from, to);
14993 function visible(lambda, phi) {
14994 return cos(lambda) * cos(phi) > cr;
14996 function clipLine(stream) {
14997 var point0, c0, v0, v00, clean2;
14999 lineStart: function() {
15003 point: function(lambda, phi) {
15004 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;
15005 if (!point0 && (v00 = v0 = v2)) stream.lineStart();
15007 point2 = intersect2(point0, point1);
15008 if (!point2 || pointEqual_default(point0, point2) || pointEqual_default(point1, point2))
15014 stream.lineStart();
15015 point2 = intersect2(point1, point0);
15016 stream.point(point2[0], point2[1]);
15018 point2 = intersect2(point0, point1);
15019 stream.point(point2[0], point2[1], 2);
15023 } else if (notHemisphere && point0 && smallRadius ^ v2) {
15025 if (!(c2 & c0) && (t2 = intersect2(point1, point0, true))) {
15028 stream.lineStart();
15029 stream.point(t2[0][0], t2[0][1]);
15030 stream.point(t2[1][0], t2[1][1]);
15033 stream.point(t2[1][0], t2[1][1]);
15035 stream.lineStart();
15036 stream.point(t2[0][0], t2[0][1], 3);
15040 if (v2 && (!point0 || !pointEqual_default(point0, point1))) {
15041 stream.point(point1[0], point1[1]);
15043 point0 = point1, v0 = v2, c0 = c2;
15045 lineEnd: function() {
15046 if (v0) stream.lineEnd();
15049 // Rejoin first and last segments if there were intersections and the first
15050 // and last points were visible.
15051 clean: function() {
15052 return clean2 | (v00 && v0) << 1;
15056 function intersect2(a2, b2, two) {
15057 var pa = cartesian(a2), pb = cartesian(b2);
15058 var n1 = [1, 0, 0], n22 = cartesianCross(pa, pb), n2n2 = cartesianDot(n22, n22), n1n2 = n22[0], determinant = n2n2 - n1n2 * n1n2;
15059 if (!determinant) return !two && a2;
15060 var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n22), A2 = cartesianScale(n1, c1), B2 = cartesianScale(n22, c2);
15061 cartesianAddInPlace(A2, B2);
15062 var u2 = n1xn2, w2 = cartesianDot(A2, u2), uu = cartesianDot(u2, u2), t2 = w2 * w2 - uu * (cartesianDot(A2, A2) - 1);
15063 if (t2 < 0) return;
15064 var t3 = sqrt(t2), q2 = cartesianScale(u2, (-w2 - t3) / uu);
15065 cartesianAddInPlace(q2, A2);
15066 q2 = spherical(q2);
15067 if (!two) return q2;
15068 var lambda04 = a2[0], lambda12 = b2[0], phi02 = a2[1], phi12 = b2[1], z2;
15069 if (lambda12 < lambda04) z2 = lambda04, lambda04 = lambda12, lambda12 = z2;
15070 var delta2 = lambda12 - lambda04, polar = abs(delta2 - pi) < epsilon, meridian = polar || delta2 < epsilon;
15071 if (!polar && phi12 < phi02) z2 = phi02, phi02 = phi12, phi12 = z2;
15072 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)) {
15073 var q1 = cartesianScale(u2, (-w2 + t3) / uu);
15074 cartesianAddInPlace(q1, A2);
15075 return [q2, spherical(q1)];
15078 function code(lambda, phi) {
15079 var r2 = smallRadius ? radius : pi - radius, code2 = 0;
15080 if (lambda < -r2) code2 |= 1;
15081 else if (lambda > r2) code2 |= 2;
15082 if (phi < -r2) code2 |= 4;
15083 else if (phi > r2) code2 |= 8;
15086 return clip_default(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]);
15089 // node_modules/d3-geo/src/clip/line.js
15090 function line_default(a2, b2, x05, y05, x12, y12) {
15091 var ax = a2[0], ay = a2[1], bx = b2[0], by = b2[1], t0 = 0, t1 = 1, dx = bx - ax, dy = by - ay, r2;
15093 if (!dx && r2 > 0) return;
15096 if (r2 < t0) return;
15097 if (r2 < t1) t1 = r2;
15098 } else if (dx > 0) {
15099 if (r2 > t1) return;
15100 if (r2 > t0) t0 = r2;
15103 if (!dx && r2 < 0) return;
15106 if (r2 > t1) return;
15107 if (r2 > t0) t0 = r2;
15108 } else if (dx > 0) {
15109 if (r2 < t0) return;
15110 if (r2 < t1) t1 = r2;
15113 if (!dy && r2 > 0) return;
15116 if (r2 < t0) return;
15117 if (r2 < t1) t1 = r2;
15118 } else if (dy > 0) {
15119 if (r2 > t1) return;
15120 if (r2 > t0) t0 = r2;
15123 if (!dy && r2 < 0) return;
15126 if (r2 > t1) return;
15127 if (r2 > t0) t0 = r2;
15128 } else if (dy > 0) {
15129 if (r2 < t0) return;
15130 if (r2 < t1) t1 = r2;
15132 if (t0 > 0) a2[0] = ax + t0 * dx, a2[1] = ay + t0 * dy;
15133 if (t1 < 1) b2[0] = ax + t1 * dx, b2[1] = ay + t1 * dy;
15137 // node_modules/d3-geo/src/clip/rectangle.js
15139 var clipMin = -clipMax;
15140 function clipRectangle(x05, y05, x12, y12) {
15141 function visible(x2, y2) {
15142 return x05 <= x2 && x2 <= x12 && y05 <= y2 && y2 <= y12;
15144 function interpolate(from, to, direction, stream) {
15145 var a2 = 0, a1 = 0;
15146 if (from == null || (a2 = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) {
15148 stream.point(a2 === 0 || a2 === 3 ? x05 : x12, a2 > 1 ? y12 : y05);
15149 while ((a2 = (a2 + direction + 4) % 4) !== a1);
15151 stream.point(to[0], to[1]);
15154 function corner(p2, direction) {
15155 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;
15157 function compareIntersection2(a2, b2) {
15158 return comparePoint(a2.x, b2.x);
15160 function comparePoint(a2, b2) {
15161 var ca = corner(a2, 1), cb = corner(b2, 1);
15162 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];
15164 return function(stream) {
15165 var activeStream = stream, bufferStream = buffer_default(), segments, polygon2, ring, x__, y__, v__, x_, y_, v_, first, clean2;
15173 function point(x2, y2) {
15174 if (visible(x2, y2)) activeStream.point(x2, y2);
15176 function polygonInside() {
15178 for (var i3 = 0, n3 = polygon2.length; i3 < n3; ++i3) {
15179 for (var ring2 = polygon2[i3], j2 = 1, m2 = ring2.length, point2 = ring2[0], a0, a1, b0 = point2[0], b1 = point2[1]; j2 < m2; ++j2) {
15180 a0 = b0, a1 = b1, point2 = ring2[j2], b0 = point2[0], b1 = point2[1];
15182 if (b1 > y12 && (b0 - a0) * (y12 - a1) > (b1 - a1) * (x05 - a0)) ++winding;
15184 if (b1 <= y12 && (b0 - a0) * (y12 - a1) < (b1 - a1) * (x05 - a0)) --winding;
15190 function polygonStart() {
15191 activeStream = bufferStream, segments = [], polygon2 = [], clean2 = true;
15193 function polygonEnd() {
15194 var startInside = polygonInside(), cleanInside = clean2 && startInside, visible2 = (segments = merge(segments)).length;
15195 if (cleanInside || visible2) {
15196 stream.polygonStart();
15198 stream.lineStart();
15199 interpolate(null, null, 1, stream);
15203 rejoin_default(segments, compareIntersection2, startInside, interpolate, stream);
15205 stream.polygonEnd();
15207 activeStream = stream, segments = polygon2 = ring = null;
15209 function lineStart() {
15210 clipStream.point = linePoint2;
15211 if (polygon2) polygon2.push(ring = []);
15216 function lineEnd() {
15218 linePoint2(x__, y__);
15219 if (v__ && v_) bufferStream.rejoin();
15220 segments.push(bufferStream.result());
15222 clipStream.point = point;
15223 if (v_) activeStream.lineEnd();
15225 function linePoint2(x2, y2) {
15226 var v2 = visible(x2, y2);
15227 if (polygon2) ring.push([x2, y2]);
15229 x__ = x2, y__ = y2, v__ = v2;
15232 activeStream.lineStart();
15233 activeStream.point(x2, y2);
15236 if (v2 && v_) activeStream.point(x2, y2);
15238 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))];
15239 if (line_default(a2, b2, x05, y05, x12, y12)) {
15241 activeStream.lineStart();
15242 activeStream.point(a2[0], a2[1]);
15244 activeStream.point(b2[0], b2[1]);
15245 if (!v2) activeStream.lineEnd();
15248 activeStream.lineStart();
15249 activeStream.point(x2, y2);
15254 x_ = x2, y_ = y2, v_ = v2;
15260 // node_modules/d3-geo/src/length.js
15265 var lengthStream = {
15268 lineStart: lengthLineStart,
15270 polygonStart: noop,
15273 function lengthLineStart() {
15274 lengthStream.point = lengthPointFirst;
15275 lengthStream.lineEnd = lengthLineEnd;
15277 function lengthLineEnd() {
15278 lengthStream.point = lengthStream.lineEnd = noop;
15280 function lengthPointFirst(lambda, phi) {
15281 lambda *= radians, phi *= radians;
15282 lambda03 = lambda, sinPhi02 = sin(phi), cosPhi02 = cos(phi);
15283 lengthStream.point = lengthPoint;
15285 function lengthPoint(lambda, phi) {
15286 lambda *= radians, phi *= radians;
15287 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;
15288 lengthSum.add(atan2(sqrt(x2 * x2 + y2 * y2), z2));
15289 lambda03 = lambda, sinPhi02 = sinPhi, cosPhi02 = cosPhi;
15291 function length_default(object) {
15292 lengthSum = new Adder();
15293 stream_default(object, lengthStream);
15297 // node_modules/d3-geo/src/identity.js
15298 var identity_default = (x2) => x2;
15300 // node_modules/d3-geo/src/path/area.js
15301 var areaSum2 = new Adder();
15302 var areaRingSum2 = new Adder();
15307 var areaStream2 = {
15311 polygonStart: function() {
15312 areaStream2.lineStart = areaRingStart2;
15313 areaStream2.lineEnd = areaRingEnd2;
15315 polygonEnd: function() {
15316 areaStream2.lineStart = areaStream2.lineEnd = areaStream2.point = noop;
15317 areaSum2.add(abs(areaRingSum2));
15318 areaRingSum2 = new Adder();
15320 result: function() {
15321 var area = areaSum2 / 2;
15322 areaSum2 = new Adder();
15326 function areaRingStart2() {
15327 areaStream2.point = areaPointFirst2;
15329 function areaPointFirst2(x2, y2) {
15330 areaStream2.point = areaPoint2;
15331 x00 = x0 = x2, y00 = y0 = y2;
15333 function areaPoint2(x2, y2) {
15334 areaRingSum2.add(y0 * x2 - x0 * y2);
15337 function areaRingEnd2() {
15338 areaPoint2(x00, y00);
15340 var area_default2 = areaStream2;
15342 // node_modules/d3-geo/src/path/bounds.js
15343 var x02 = Infinity;
15347 var boundsStream2 = {
15348 point: boundsPoint2,
15351 polygonStart: noop,
15353 result: function() {
15354 var bounds = [[x02, y02], [x1, y1]];
15355 x1 = y1 = -(y02 = x02 = Infinity);
15359 function boundsPoint2(x2, y2) {
15360 if (x2 < x02) x02 = x2;
15361 if (x2 > x1) x1 = x2;
15362 if (y2 < y02) y02 = y2;
15363 if (y2 > y1) y1 = y2;
15365 var bounds_default2 = boundsStream2;
15367 // node_modules/d3-geo/src/path/centroid.js
15381 var centroidStream = {
15382 point: centroidPoint,
15383 lineStart: centroidLineStart,
15384 lineEnd: centroidLineEnd,
15385 polygonStart: function() {
15386 centroidStream.lineStart = centroidRingStart;
15387 centroidStream.lineEnd = centroidRingEnd;
15389 polygonEnd: function() {
15390 centroidStream.point = centroidPoint;
15391 centroidStream.lineStart = centroidLineStart;
15392 centroidStream.lineEnd = centroidLineEnd;
15394 result: function() {
15395 var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
15396 X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
15400 function centroidPoint(x2, y2) {
15405 function centroidLineStart() {
15406 centroidStream.point = centroidPointFirstLine;
15408 function centroidPointFirstLine(x2, y2) {
15409 centroidStream.point = centroidPointLine;
15410 centroidPoint(x03 = x2, y03 = y2);
15412 function centroidPointLine(x2, y2) {
15413 var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
15414 X1 += z2 * (x03 + x2) / 2;
15415 Y1 += z2 * (y03 + y2) / 2;
15417 centroidPoint(x03 = x2, y03 = y2);
15419 function centroidLineEnd() {
15420 centroidStream.point = centroidPoint;
15422 function centroidRingStart() {
15423 centroidStream.point = centroidPointFirstRing;
15425 function centroidRingEnd() {
15426 centroidPointRing(x002, y002);
15428 function centroidPointFirstRing(x2, y2) {
15429 centroidStream.point = centroidPointRing;
15430 centroidPoint(x002 = x03 = x2, y002 = y03 = y2);
15432 function centroidPointRing(x2, y2) {
15433 var dx = x2 - x03, dy = y2 - y03, z2 = sqrt(dx * dx + dy * dy);
15434 X1 += z2 * (x03 + x2) / 2;
15435 Y1 += z2 * (y03 + y2) / 2;
15437 z2 = y03 * x2 - x03 * y2;
15438 X2 += z2 * (x03 + x2);
15439 Y2 += z2 * (y03 + y2);
15441 centroidPoint(x03 = x2, y03 = y2);
15443 var centroid_default = centroidStream;
15445 // node_modules/d3-geo/src/path/context.js
15446 function PathContext(context) {
15447 this._context = context;
15449 PathContext.prototype = {
15451 pointRadius: function(_2) {
15452 return this._radius = _2, this;
15454 polygonStart: function() {
15457 polygonEnd: function() {
15460 lineStart: function() {
15463 lineEnd: function() {
15464 if (this._line === 0) this._context.closePath();
15467 point: function(x2, y2) {
15468 switch (this._point) {
15470 this._context.moveTo(x2, y2);
15475 this._context.lineTo(x2, y2);
15479 this._context.moveTo(x2 + this._radius, y2);
15480 this._context.arc(x2, y2, this._radius, 0, tau);
15488 // node_modules/d3-geo/src/path/measure.js
15489 var lengthSum2 = new Adder();
15495 var lengthStream2 = {
15497 lineStart: function() {
15498 lengthStream2.point = lengthPointFirst2;
15500 lineEnd: function() {
15501 if (lengthRing) lengthPoint2(x003, y003);
15502 lengthStream2.point = noop;
15504 polygonStart: function() {
15507 polygonEnd: function() {
15510 result: function() {
15511 var length2 = +lengthSum2;
15512 lengthSum2 = new Adder();
15516 function lengthPointFirst2(x2, y2) {
15517 lengthStream2.point = lengthPoint2;
15518 x003 = x04 = x2, y003 = y04 = y2;
15520 function lengthPoint2(x2, y2) {
15521 x04 -= x2, y04 -= y2;
15522 lengthSum2.add(sqrt(x04 * x04 + y04 * y04));
15523 x04 = x2, y04 = y2;
15525 var measure_default = lengthStream2;
15527 // node_modules/d3-geo/src/path/string.js
15528 function PathString() {
15531 PathString.prototype = {
15533 _circle: circle(4.5),
15534 pointRadius: function(_2) {
15535 if ((_2 = +_2) !== this._radius) this._radius = _2, this._circle = null;
15538 polygonStart: function() {
15541 polygonEnd: function() {
15544 lineStart: function() {
15547 lineEnd: function() {
15548 if (this._line === 0) this._string.push("Z");
15551 point: function(x2, y2) {
15552 switch (this._point) {
15554 this._string.push("M", x2, ",", y2);
15559 this._string.push("L", x2, ",", y2);
15563 if (this._circle == null) this._circle = circle(this._radius);
15564 this._string.push("M", x2, ",", y2, this._circle);
15569 result: function() {
15570 if (this._string.length) {
15571 var result = this._string.join("");
15579 function circle(radius) {
15580 return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
15583 // node_modules/d3-geo/src/path/index.js
15584 function path_default(projection2, context) {
15585 var pointRadius = 4.5, projectionStream, contextStream;
15586 function path(object) {
15588 if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
15589 stream_default(object, projectionStream(contextStream));
15591 return contextStream.result();
15593 path.area = function(object) {
15594 stream_default(object, projectionStream(area_default2));
15595 return area_default2.result();
15597 path.measure = function(object) {
15598 stream_default(object, projectionStream(measure_default));
15599 return measure_default.result();
15601 path.bounds = function(object) {
15602 stream_default(object, projectionStream(bounds_default2));
15603 return bounds_default2.result();
15605 path.centroid = function(object) {
15606 stream_default(object, projectionStream(centroid_default));
15607 return centroid_default.result();
15609 path.projection = function(_2) {
15610 return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity_default) : (projection2 = _2).stream, path) : projection2;
15612 path.context = function(_2) {
15613 if (!arguments.length) return context;
15614 contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2);
15615 if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
15618 path.pointRadius = function(_2) {
15619 if (!arguments.length) return pointRadius;
15620 pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2);
15623 return path.projection(projection2).context(context);
15626 // node_modules/d3-geo/src/transform.js
15627 function transform_default(methods2) {
15629 stream: transformer(methods2)
15632 function transformer(methods2) {
15633 return function(stream) {
15634 var s2 = new TransformStream();
15635 for (var key in methods2) s2[key] = methods2[key];
15636 s2.stream = stream;
15640 function TransformStream() {
15642 TransformStream.prototype = {
15643 constructor: TransformStream,
15644 point: function(x2, y2) {
15645 this.stream.point(x2, y2);
15647 sphere: function() {
15648 this.stream.sphere();
15650 lineStart: function() {
15651 this.stream.lineStart();
15653 lineEnd: function() {
15654 this.stream.lineEnd();
15656 polygonStart: function() {
15657 this.stream.polygonStart();
15659 polygonEnd: function() {
15660 this.stream.polygonEnd();
15664 // node_modules/d3-geo/src/projection/fit.js
15665 function fit(projection2, fitBounds, object) {
15666 var clip = projection2.clipExtent && projection2.clipExtent();
15667 projection2.scale(150).translate([0, 0]);
15668 if (clip != null) projection2.clipExtent(null);
15669 stream_default(object, projection2.stream(bounds_default2));
15670 fitBounds(bounds_default2.result());
15671 if (clip != null) projection2.clipExtent(clip);
15672 return projection2;
15674 function fitExtent(projection2, extent, object) {
15675 return fit(projection2, function(b2) {
15676 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;
15677 projection2.scale(150 * k2).translate([x2, y2]);
15680 function fitSize(projection2, size, object) {
15681 return fitExtent(projection2, [[0, 0], size], object);
15683 function fitWidth(projection2, width, object) {
15684 return fit(projection2, function(b2) {
15685 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];
15686 projection2.scale(150 * k2).translate([x2, y2]);
15689 function fitHeight(projection2, height, object) {
15690 return fit(projection2, function(b2) {
15691 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;
15692 projection2.scale(150 * k2).translate([x2, y2]);
15696 // node_modules/d3-geo/src/projection/resample.js
15698 var cosMinDistance = cos(30 * radians);
15699 function resample_default(project, delta2) {
15700 return +delta2 ? resample(project, delta2) : resampleNone(project);
15702 function resampleNone(project) {
15703 return transformer({
15704 point: function(x2, y2) {
15705 x2 = project(x2, y2);
15706 this.stream.point(x2[0], x2[1]);
15710 function resample(project, delta2) {
15711 function resampleLineTo(x05, y05, lambda04, a0, b0, c0, x12, y12, lambda12, a1, b1, c1, depth, stream) {
15712 var dx = x12 - x05, dy = y12 - y05, d2 = dx * dx + dy * dy;
15713 if (d2 > 4 * delta2 && depth--) {
15714 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;
15715 if (dz * dz / d2 > delta2 || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) {
15716 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x2, y2, lambda22, a2 /= m2, b2 /= m2, c2, depth, stream);
15717 stream.point(x2, y2);
15718 resampleLineTo(x2, y2, lambda22, a2, b2, c2, x12, y12, lambda12, a1, b1, c1, depth, stream);
15722 return function(stream) {
15723 var lambda003, x004, y004, a00, b00, c00, lambda04, x05, y05, a0, b0, c0;
15724 var resampleStream = {
15728 polygonStart: function() {
15729 stream.polygonStart();
15730 resampleStream.lineStart = ringStart;
15732 polygonEnd: function() {
15733 stream.polygonEnd();
15734 resampleStream.lineStart = lineStart;
15737 function point(x2, y2) {
15738 x2 = project(x2, y2);
15739 stream.point(x2[0], x2[1]);
15741 function lineStart() {
15743 resampleStream.point = linePoint2;
15744 stream.lineStart();
15746 function linePoint2(lambda, phi) {
15747 var c2 = cartesian([lambda, phi]), p2 = project(lambda, phi);
15748 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);
15749 stream.point(x05, y05);
15751 function lineEnd() {
15752 resampleStream.point = point;
15755 function ringStart() {
15757 resampleStream.point = ringPoint;
15758 resampleStream.lineEnd = ringEnd;
15760 function ringPoint(lambda, phi) {
15761 linePoint2(lambda003 = lambda, phi), x004 = x05, y004 = y05, a00 = a0, b00 = b0, c00 = c0;
15762 resampleStream.point = linePoint2;
15764 function ringEnd() {
15765 resampleLineTo(x05, y05, lambda04, a0, b0, c0, x004, y004, lambda003, a00, b00, c00, maxDepth, stream);
15766 resampleStream.lineEnd = lineEnd;
15769 return resampleStream;
15773 // node_modules/d3-geo/src/projection/index.js
15774 var transformRadians = transformer({
15775 point: function(x2, y2) {
15776 this.stream.point(x2 * radians, y2 * radians);
15779 function transformRotate(rotate) {
15780 return transformer({
15781 point: function(x2, y2) {
15782 var r2 = rotate(x2, y2);
15783 return this.stream.point(r2[0], r2[1]);
15787 function scaleTranslate(k2, dx, dy, sx, sy) {
15788 function transform2(x2, y2) {
15791 return [dx + k2 * x2, dy - k2 * y2];
15793 transform2.invert = function(x2, y2) {
15794 return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy];
15798 function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) {
15799 if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy);
15800 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;
15801 function transform2(x2, y2) {
15804 return [a2 * x2 - b2 * y2 + dx, dy - b2 * x2 - a2 * y2];
15806 transform2.invert = function(x2, y2) {
15807 return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)];
15811 function projection(project) {
15812 return projectionMutator(function() {
15816 function projectionMutator(projectAt) {
15817 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;
15818 function projection2(point) {
15819 return projectRotateTransform(point[0] * radians, point[1] * radians);
15821 function invert(point) {
15822 point = projectRotateTransform.invert(point[0], point[1]);
15823 return point && [point[0] * degrees, point[1] * degrees];
15825 projection2.stream = function(stream) {
15826 return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
15828 projection2.preclip = function(_2) {
15829 return arguments.length ? (preclip = _2, theta = void 0, reset()) : preclip;
15831 projection2.postclip = function(_2) {
15832 return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
15834 projection2.clipAngle = function(_2) {
15835 return arguments.length ? (preclip = +_2 ? circle_default(theta = _2 * radians) : (theta = null, antimeridian_default), reset()) : theta * degrees;
15837 projection2.clipExtent = function(_2) {
15838 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]];
15840 projection2.scale = function(_2) {
15841 return arguments.length ? (k2 = +_2, recenter()) : k2;
15843 projection2.translate = function(_2) {
15844 return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2];
15846 projection2.center = function(_2) {
15847 return arguments.length ? (lambda = _2[0] % 360 * radians, phi = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees];
15849 projection2.rotate = function(_2) {
15850 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];
15852 projection2.angle = function(_2) {
15853 return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees;
15855 projection2.reflectX = function(_2) {
15856 return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0;
15858 projection2.reflectY = function(_2) {
15859 return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0;
15861 projection2.precision = function(_2) {
15862 return arguments.length ? (projectResample = resample_default(projectTransform, delta2 = _2 * _2), reset()) : sqrt(delta2);
15864 projection2.fitExtent = function(extent, object) {
15865 return fitExtent(projection2, extent, object);
15867 projection2.fitSize = function(size, object) {
15868 return fitSize(projection2, size, object);
15870 projection2.fitWidth = function(width, object) {
15871 return fitWidth(projection2, width, object);
15873 projection2.fitHeight = function(height, object) {
15874 return fitHeight(projection2, height, object);
15876 function recenter() {
15877 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);
15878 rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma);
15879 projectTransform = compose_default(project, transform2);
15880 projectRotateTransform = compose_default(rotate, projectTransform);
15881 projectResample = resample_default(projectTransform, delta2);
15885 cache = cacheStream = null;
15886 return projection2;
15888 return function() {
15889 project = projectAt.apply(this, arguments);
15890 projection2.invert = project.invert && invert;
15895 // node_modules/d3-geo/src/projection/mercator.js
15896 function mercatorRaw(lambda, phi) {
15897 return [lambda, log(tan((halfPi + phi) / 2))];
15899 mercatorRaw.invert = function(x2, y2) {
15900 return [x2, 2 * atan(exp(y2)) - halfPi];
15902 function mercator_default() {
15903 return mercatorProjection(mercatorRaw).scale(961 / tau);
15905 function mercatorProjection(project) {
15906 var m2 = projection(project), center = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x05 = null, y05, x12, y12;
15907 m2.scale = function(_2) {
15908 return arguments.length ? (scale(_2), reclip()) : scale();
15910 m2.translate = function(_2) {
15911 return arguments.length ? (translate(_2), reclip()) : translate();
15913 m2.center = function(_2) {
15914 return arguments.length ? (center(_2), reclip()) : center();
15916 m2.clipExtent = function(_2) {
15917 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]];
15919 function reclip() {
15920 var k2 = pi * scale(), t2 = m2(rotation_default(m2.rotate()).invert([0, 0]));
15921 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)]]);
15926 // node_modules/d3-geo/src/projection/identity.js
15927 function identity_default2() {
15928 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({
15929 point: function(x2, y2) {
15930 var p2 = projection2([x2, y2]);
15931 this.stream.point(p2[0], p2[1]);
15933 }), postclip = identity_default, cache, cacheStream;
15937 cache = cacheStream = null;
15938 return projection2;
15940 function projection2(p2) {
15941 var x2 = p2[0] * kx, y2 = p2[1] * ky;
15943 var t2 = y2 * ca - x2 * sa;
15944 x2 = x2 * ca + y2 * sa;
15947 return [x2 + tx, y2 + ty];
15949 projection2.invert = function(p2) {
15950 var x2 = p2[0] - tx, y2 = p2[1] - ty;
15952 var t2 = y2 * ca + x2 * sa;
15953 x2 = x2 * ca - y2 * sa;
15956 return [x2 / kx, y2 / ky];
15958 projection2.stream = function(stream) {
15959 return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream));
15961 projection2.postclip = function(_2) {
15962 return arguments.length ? (postclip = _2, x05 = y05 = x12 = y12 = null, reset()) : postclip;
15964 projection2.clipExtent = function(_2) {
15965 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]];
15967 projection2.scale = function(_2) {
15968 return arguments.length ? (k2 = +_2, reset()) : k2;
15970 projection2.translate = function(_2) {
15971 return arguments.length ? (tx = +_2[0], ty = +_2[1], reset()) : [tx, ty];
15973 projection2.angle = function(_2) {
15974 return arguments.length ? (alpha = _2 % 360 * radians, sa = sin(alpha), ca = cos(alpha), reset()) : alpha * degrees;
15976 projection2.reflectX = function(_2) {
15977 return arguments.length ? (sx = _2 ? -1 : 1, reset()) : sx < 0;
15979 projection2.reflectY = function(_2) {
15980 return arguments.length ? (sy = _2 ? -1 : 1, reset()) : sy < 0;
15982 projection2.fitExtent = function(extent, object) {
15983 return fitExtent(projection2, extent, object);
15985 projection2.fitSize = function(size, object) {
15986 return fitSize(projection2, size, object);
15988 projection2.fitWidth = function(width, object) {
15989 return fitWidth(projection2, width, object);
15991 projection2.fitHeight = function(height, object) {
15992 return fitHeight(projection2, height, object);
15994 return projection2;
15997 // modules/geo/geo.js
15998 var TAU = 2 * Math.PI;
15999 var EQUATORIAL_RADIUS = 6378137;
16000 var POLAR_RADIUS = 63567523e-1;
16001 function geoLatToMeters(dLat) {
16002 return dLat * (TAU * POLAR_RADIUS / 360);
16004 function geoLonToMeters(dLon, atLat) {
16005 return Math.abs(atLat) >= 90 ? 0 : dLon * (TAU * EQUATORIAL_RADIUS / 360) * Math.abs(Math.cos(atLat * (Math.PI / 180)));
16007 function geoMetersToLat(m2) {
16008 return m2 / (TAU * POLAR_RADIUS / 360);
16010 function geoMetersToLon(m2, atLat) {
16011 return Math.abs(atLat) >= 90 ? 0 : m2 / (TAU * EQUATORIAL_RADIUS / 360) / Math.abs(Math.cos(atLat * (Math.PI / 180)));
16013 function geoMetersToOffset(meters, tileSize) {
16014 tileSize = tileSize || 256;
16016 meters[0] * tileSize / (TAU * EQUATORIAL_RADIUS),
16017 -meters[1] * tileSize / (TAU * POLAR_RADIUS)
16020 function geoOffsetToMeters(offset, tileSize) {
16021 tileSize = tileSize || 256;
16023 offset[0] * TAU * EQUATORIAL_RADIUS / tileSize,
16024 -offset[1] * TAU * POLAR_RADIUS / tileSize
16027 function geoSphericalDistance(a2, b2) {
16028 var x2 = geoLonToMeters(a2[0] - b2[0], (a2[1] + b2[1]) / 2);
16029 var y2 = geoLatToMeters(a2[1] - b2[1]);
16030 return Math.sqrt(x2 * x2 + y2 * y2);
16032 function geoScaleToZoom(k2, tileSize) {
16033 tileSize = tileSize || 256;
16034 var log2ts = Math.log(tileSize) * Math.LOG2E;
16035 return Math.log(k2 * TAU) / Math.LN2 - log2ts;
16037 function geoZoomToScale(z2, tileSize) {
16038 tileSize = tileSize || 256;
16039 return tileSize * Math.pow(2, z2) / TAU;
16041 function geoSphericalClosestNode(nodes, point) {
16042 var minDistance = Infinity, distance;
16044 for (var i3 in nodes) {
16045 distance = geoSphericalDistance(nodes[i3].loc, point);
16046 if (distance < minDistance) {
16047 minDistance = distance;
16051 if (indexOfMin !== void 0) {
16052 return { index: indexOfMin, distance: minDistance, node: nodes[indexOfMin] };
16058 // modules/geo/extent.js
16059 function geoExtent(min3, max3) {
16060 if (!(this instanceof geoExtent)) {
16061 return new geoExtent(min3, max3);
16062 } else if (min3 instanceof geoExtent) {
16064 } else if (min3 && min3.length === 2 && min3[0].length === 2 && min3[1].length === 2) {
16068 this[0] = min3 || [Infinity, Infinity];
16069 this[1] = max3 || min3 || [-Infinity, -Infinity];
16072 geoExtent.prototype = new Array(2);
16073 Object.assign(geoExtent.prototype, {
16074 equals: function(obj) {
16075 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];
16077 extend: function(obj) {
16078 if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16080 [Math.min(obj[0][0], this[0][0]), Math.min(obj[0][1], this[0][1])],
16081 [Math.max(obj[1][0], this[1][0]), Math.max(obj[1][1], this[1][1])]
16084 _extend: function(extent) {
16085 this[0][0] = Math.min(extent[0][0], this[0][0]);
16086 this[0][1] = Math.min(extent[0][1], this[0][1]);
16087 this[1][0] = Math.max(extent[1][0], this[1][0]);
16088 this[1][1] = Math.max(extent[1][1], this[1][1]);
16091 return Math.abs((this[1][0] - this[0][0]) * (this[1][1] - this[0][1]));
16093 center: function() {
16094 return [(this[0][0] + this[1][0]) / 2, (this[0][1] + this[1][1]) / 2];
16096 rectangle: function() {
16097 return [this[0][0], this[0][1], this[1][0], this[1][1]];
16100 return { minX: this[0][0], minY: this[0][1], maxX: this[1][0], maxY: this[1][1] };
16102 polygon: function() {
16104 [this[0][0], this[0][1]],
16105 [this[0][0], this[1][1]],
16106 [this[1][0], this[1][1]],
16107 [this[1][0], this[0][1]],
16108 [this[0][0], this[0][1]]
16111 contains: function(obj) {
16112 if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16113 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];
16115 intersects: function(obj) {
16116 if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16117 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];
16119 intersection: function(obj) {
16120 if (!this.intersects(obj)) return new geoExtent();
16121 return new geoExtent(
16122 [Math.max(obj[0][0], this[0][0]), Math.max(obj[0][1], this[0][1])],
16123 [Math.min(obj[1][0], this[1][0]), Math.min(obj[1][1], this[1][1])]
16126 percentContainedIn: function(obj) {
16127 if (!(obj instanceof geoExtent)) obj = new geoExtent(obj);
16128 var a1 = this.intersection(obj).area();
16129 var a2 = this.area();
16130 if (a1 === Infinity || a2 === Infinity) {
16132 } else if (a1 === 0 || a2 === 0) {
16133 if (obj.contains(this)) {
16141 padByMeters: function(meters) {
16142 var dLat = geoMetersToLat(meters);
16143 var dLon = geoMetersToLon(meters, this.center()[1]);
16145 [this[0][0] - dLon, this[0][1] - dLat],
16146 [this[1][0] + dLon, this[1][1] + dLat]
16149 toParam: function() {
16150 return this.rectangle().join(",");
16152 split: function() {
16153 const center = this.center();
16155 geoExtent(this[0], center),
16156 geoExtent([center[0], this[0][1]], [this[1][0], center[1]]),
16157 geoExtent(center, this[1]),
16158 geoExtent([this[0][0], center[1]], [center[0], this[1][1]])
16163 // node_modules/d3-polygon/src/area.js
16164 function area_default3(polygon2) {
16165 var i3 = -1, n3 = polygon2.length, a2, b2 = polygon2[n3 - 1], area = 0;
16166 while (++i3 < n3) {
16169 area += a2[1] * b2[0] - a2[0] * b2[1];
16174 // node_modules/d3-polygon/src/centroid.js
16175 function centroid_default2(polygon2) {
16176 var i3 = -1, n3 = polygon2.length, x2 = 0, y2 = 0, a2, b2 = polygon2[n3 - 1], c2, k2 = 0;
16177 while (++i3 < n3) {
16180 k2 += c2 = a2[0] * b2[1] - b2[0] * a2[1];
16181 x2 += (a2[0] + b2[0]) * c2;
16182 y2 += (a2[1] + b2[1]) * c2;
16184 return k2 *= 3, [x2 / k2, y2 / k2];
16187 // node_modules/d3-polygon/src/cross.js
16188 function cross_default(a2, b2, c2) {
16189 return (b2[0] - a2[0]) * (c2[1] - a2[1]) - (b2[1] - a2[1]) * (c2[0] - a2[0]);
16192 // node_modules/d3-polygon/src/hull.js
16193 function lexicographicOrder(a2, b2) {
16194 return a2[0] - b2[0] || a2[1] - b2[1];
16196 function computeUpperHullIndexes(points) {
16197 const n3 = points.length, indexes = [0, 1];
16199 for (i3 = 2; i3 < n3; ++i3) {
16200 while (size > 1 && cross_default(points[indexes[size - 2]], points[indexes[size - 1]], points[i3]) <= 0) --size;
16201 indexes[size++] = i3;
16203 return indexes.slice(0, size);
16205 function hull_default(points) {
16206 if ((n3 = points.length) < 3) return null;
16207 var i3, n3, sortedPoints = new Array(n3), flippedPoints = new Array(n3);
16208 for (i3 = 0; i3 < n3; ++i3) sortedPoints[i3] = [+points[i3][0], +points[i3][1], i3];
16209 sortedPoints.sort(lexicographicOrder);
16210 for (i3 = 0; i3 < n3; ++i3) flippedPoints[i3] = [sortedPoints[i3][0], -sortedPoints[i3][1]];
16211 var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints);
16212 var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
16213 for (i3 = upperIndexes.length - 1; i3 >= 0; --i3) hull.push(points[sortedPoints[upperIndexes[i3]][2]]);
16214 for (i3 = +skipLeft; i3 < lowerIndexes.length - skipRight; ++i3) hull.push(points[sortedPoints[lowerIndexes[i3]][2]]);
16218 // modules/geo/vector.js
16219 function geoVecEqual(a2, b2, epsilon3) {
16221 return Math.abs(a2[0] - b2[0]) <= epsilon3 && Math.abs(a2[1] - b2[1]) <= epsilon3;
16223 return a2[0] === b2[0] && a2[1] === b2[1];
16226 function geoVecAdd(a2, b2) {
16227 return [a2[0] + b2[0], a2[1] + b2[1]];
16229 function geoVecSubtract(a2, b2) {
16230 return [a2[0] - b2[0], a2[1] - b2[1]];
16232 function geoVecScale(a2, mag) {
16233 return [a2[0] * mag, a2[1] * mag];
16235 function geoVecFloor(a2) {
16236 return [Math.floor(a2[0]), Math.floor(a2[1])];
16238 function geoVecInterp(a2, b2, t2) {
16240 a2[0] + (b2[0] - a2[0]) * t2,
16241 a2[1] + (b2[1] - a2[1]) * t2
16244 function geoVecLength(a2, b2) {
16245 return Math.sqrt(geoVecLengthSquare(a2, b2));
16247 function geoVecLengthSquare(a2, b2) {
16249 var x2 = a2[0] - b2[0];
16250 var y2 = a2[1] - b2[1];
16251 return x2 * x2 + y2 * y2;
16253 function geoVecNormalize(a2) {
16254 var length2 = Math.sqrt(a2[0] * a2[0] + a2[1] * a2[1]);
16255 if (length2 !== 0) {
16256 return geoVecScale(a2, 1 / length2);
16260 function geoVecAngle(a2, b2) {
16261 return Math.atan2(b2[1] - a2[1], b2[0] - a2[0]);
16263 function geoVecDot(a2, b2, origin) {
16264 origin = origin || [0, 0];
16265 var p2 = geoVecSubtract(a2, origin);
16266 var q2 = geoVecSubtract(b2, origin);
16267 return p2[0] * q2[0] + p2[1] * q2[1];
16269 function geoVecNormalizedDot(a2, b2, origin) {
16270 origin = origin || [0, 0];
16271 var p2 = geoVecNormalize(geoVecSubtract(a2, origin));
16272 var q2 = geoVecNormalize(geoVecSubtract(b2, origin));
16273 return geoVecDot(p2, q2);
16275 function geoVecCross(a2, b2, origin) {
16276 origin = origin || [0, 0];
16277 var p2 = geoVecSubtract(a2, origin);
16278 var q2 = geoVecSubtract(b2, origin);
16279 return p2[0] * q2[1] - p2[1] * q2[0];
16281 function geoVecProject(a2, points) {
16282 var min3 = Infinity;
16285 for (var i3 = 0; i3 < points.length - 1; i3++) {
16286 var o2 = points[i3];
16287 var s2 = geoVecSubtract(points[i3 + 1], o2);
16288 var v2 = geoVecSubtract(a2, o2);
16289 var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
16293 } else if (proj > 1) {
16294 p2 = points[i3 + 1];
16296 p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
16298 var dist = geoVecLength(p2, a2);
16305 if (idx !== void 0) {
16306 return { index: idx, distance: min3, target };
16312 // modules/geo/geom.js
16313 function geoAngle(a2, b2, projection2) {
16314 return geoVecAngle(projection2(a2.loc), projection2(b2.loc));
16316 function geoEdgeEqual(a2, b2) {
16317 return a2[0] === b2[0] && a2[1] === b2[1] || a2[0] === b2[1] && a2[1] === b2[0];
16319 function geoRotate(points, angle2, around) {
16320 return points.map(function(point) {
16321 var radial = geoVecSubtract(point, around);
16323 radial[0] * Math.cos(angle2) - radial[1] * Math.sin(angle2) + around[0],
16324 radial[0] * Math.sin(angle2) + radial[1] * Math.cos(angle2) + around[1]
16328 function geoChooseEdge(nodes, point, projection2, activeID) {
16329 var dist = geoVecLength;
16330 var points = nodes.map(function(n3) {
16331 return projection2(n3.loc);
16333 var ids = nodes.map(function(n3) {
16336 var min3 = Infinity;
16339 for (var i3 = 0; i3 < points.length - 1; i3++) {
16340 if (ids[i3] === activeID || ids[i3 + 1] === activeID) continue;
16341 var o2 = points[i3];
16342 var s2 = geoVecSubtract(points[i3 + 1], o2);
16343 var v2 = geoVecSubtract(point, o2);
16344 var proj = geoVecDot(v2, s2) / geoVecDot(s2, s2);
16348 } else if (proj > 1) {
16349 p2 = points[i3 + 1];
16351 p2 = [o2[0] + proj * s2[0], o2[1] + proj * s2[1]];
16353 var d2 = dist(p2, point);
16357 loc = projection2.invert(p2);
16360 if (idx !== void 0) {
16361 return { index: idx, distance: min3, loc };
16366 function geoHasLineIntersections(activeNodes, inactiveNodes, activeID) {
16368 var inactives = [];
16369 var j2, k2, n1, n22, segment;
16370 for (j2 = 0; j2 < activeNodes.length - 1; j2++) {
16371 n1 = activeNodes[j2];
16372 n22 = activeNodes[j2 + 1];
16373 segment = [n1.loc, n22.loc];
16374 if (n1.id === activeID || n22.id === activeID) {
16375 actives.push(segment);
16378 for (j2 = 0; j2 < inactiveNodes.length - 1; j2++) {
16379 n1 = inactiveNodes[j2];
16380 n22 = inactiveNodes[j2 + 1];
16381 segment = [n1.loc, n22.loc];
16382 inactives.push(segment);
16384 for (j2 = 0; j2 < actives.length; j2++) {
16385 for (k2 = 0; k2 < inactives.length; k2++) {
16386 var p2 = actives[j2];
16387 var q2 = inactives[k2];
16388 var hit = geoLineIntersection(p2, q2);
16396 function geoHasSelfIntersections(nodes, activeID) {
16398 var inactives = [];
16400 for (j2 = 0; j2 < nodes.length - 1; j2++) {
16401 var n1 = nodes[j2];
16402 var n22 = nodes[j2 + 1];
16403 var segment = [n1.loc, n22.loc];
16404 if (n1.id === activeID || n22.id === activeID) {
16405 actives.push(segment);
16407 inactives.push(segment);
16410 for (j2 = 0; j2 < actives.length; j2++) {
16411 for (k2 = 0; k2 < inactives.length; k2++) {
16412 var p2 = actives[j2];
16413 var q2 = inactives[k2];
16414 if (geoVecEqual(p2[1], q2[0]) || geoVecEqual(p2[0], q2[1]) || geoVecEqual(p2[0], q2[0]) || geoVecEqual(p2[1], q2[1])) {
16417 var hit = geoLineIntersection(p2, q2);
16419 var epsilon3 = 1e-8;
16420 if (geoVecEqual(p2[1], hit, epsilon3) || geoVecEqual(p2[0], hit, epsilon3) || geoVecEqual(q2[1], hit, epsilon3) || geoVecEqual(q2[0], hit, epsilon3)) {
16430 function geoLineIntersection(a2, b2) {
16431 var p2 = [a2[0][0], a2[0][1]];
16432 var p22 = [a2[1][0], a2[1][1]];
16433 var q2 = [b2[0][0], b2[0][1]];
16434 var q22 = [b2[1][0], b2[1][1]];
16435 var r2 = geoVecSubtract(p22, p2);
16436 var s2 = geoVecSubtract(q22, q2);
16437 var uNumerator = geoVecCross(geoVecSubtract(q2, p2), r2);
16438 var denominator = geoVecCross(r2, s2);
16439 if (uNumerator && denominator) {
16440 var u2 = uNumerator / denominator;
16441 var t2 = geoVecCross(geoVecSubtract(q2, p2), s2) / denominator;
16442 if (t2 >= 0 && t2 <= 1 && u2 >= 0 && u2 <= 1) {
16443 return geoVecInterp(p2, p22, t2);
16448 function geoPathIntersections(path1, path2) {
16449 var intersections = [];
16450 for (var i3 = 0; i3 < path1.length - 1; i3++) {
16451 for (var j2 = 0; j2 < path2.length - 1; j2++) {
16452 var a2 = [path1[i3], path1[i3 + 1]];
16453 var b2 = [path2[j2], path2[j2 + 1]];
16454 var hit = geoLineIntersection(a2, b2);
16456 intersections.push(hit);
16460 return intersections;
16462 function geoPathHasIntersections(path1, path2) {
16463 for (var i3 = 0; i3 < path1.length - 1; i3++) {
16464 for (var j2 = 0; j2 < path2.length - 1; j2++) {
16465 var a2 = [path1[i3], path1[i3 + 1]];
16466 var b2 = [path2[j2], path2[j2 + 1]];
16467 var hit = geoLineIntersection(a2, b2);
16475 function geoPointInPolygon(point, polygon2) {
16478 var inside = false;
16479 for (var i3 = 0, j2 = polygon2.length - 1; i3 < polygon2.length; j2 = i3++) {
16480 var xi = polygon2[i3][0];
16481 var yi = polygon2[i3][1];
16482 var xj = polygon2[j2][0];
16483 var yj = polygon2[j2][1];
16484 var intersect2 = yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi;
16485 if (intersect2) inside = !inside;
16489 function geoPolygonContainsPolygon(outer, inner) {
16490 return inner.every(function(point) {
16491 return geoPointInPolygon(point, outer);
16494 function geoPolygonIntersectsPolygon(outer, inner, checkSegments) {
16495 function testPoints(outer2, inner2) {
16496 return inner2.some(function(point) {
16497 return geoPointInPolygon(point, outer2);
16500 return testPoints(outer, inner) || !!checkSegments && geoPathHasIntersections(outer, inner);
16502 function geoGetSmallestSurroundingRectangle(points) {
16503 var hull = hull_default(points);
16504 var centroid = centroid_default2(hull);
16505 var minArea = Infinity;
16506 var ssrExtent = [];
16509 for (var i3 = 0; i3 <= hull.length - 1; i3++) {
16510 var c2 = i3 === hull.length - 1 ? hull[0] : hull[i3 + 1];
16511 var angle2 = Math.atan2(c2[1] - c1[1], c2[0] - c1[0]);
16512 var poly = geoRotate(hull, -angle2, centroid);
16513 var extent = poly.reduce(function(extent2, point) {
16514 return extent2.extend(geoExtent(point));
16516 var area = extent.area();
16517 if (area < minArea) {
16519 ssrExtent = extent;
16525 poly: geoRotate(ssrExtent.polygon(), ssrAngle, centroid),
16529 function geoPathLength(path) {
16531 for (var i3 = 0; i3 < path.length - 1; i3++) {
16532 length2 += geoVecLength(path[i3], path[i3 + 1]);
16536 function geoViewportEdge(point, dimensions) {
16537 var pad2 = [80, 20, 50, 20];
16540 if (point[0] > dimensions[0] - pad2[1]) {
16543 if (point[0] < pad2[3]) {
16546 if (point[1] > dimensions[1] - pad2[2]) {
16549 if (point[1] < pad2[0]) {
16559 // node_modules/d3-dispatch/src/dispatch.js
16560 var noop2 = { value: () => {
16562 function dispatch() {
16563 for (var i3 = 0, n3 = arguments.length, _2 = {}, t2; i3 < n3; ++i3) {
16564 if (!(t2 = arguments[i3] + "") || t2 in _2 || /[\s.]/.test(t2)) throw new Error("illegal type: " + t2);
16567 return new Dispatch(_2);
16569 function Dispatch(_2) {
16572 function parseTypenames(typenames, types) {
16573 return typenames.trim().split(/^|\s+/).map(function(t2) {
16574 var name = "", i3 = t2.indexOf(".");
16575 if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
16576 if (t2 && !types.hasOwnProperty(t2)) throw new Error("unknown type: " + t2);
16577 return { type: t2, name };
16580 Dispatch.prototype = dispatch.prototype = {
16581 constructor: Dispatch,
16582 on: function(typename, callback) {
16583 var _2 = this._, T2 = parseTypenames(typename + "", _2), t2, i3 = -1, n3 = T2.length;
16584 if (arguments.length < 2) {
16585 while (++i3 < n3) if ((t2 = (typename = T2[i3]).type) && (t2 = get(_2[t2], typename.name))) return t2;
16588 if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback);
16589 while (++i3 < n3) {
16590 if (t2 = (typename = T2[i3]).type) _2[t2] = set(_2[t2], typename.name, callback);
16591 else if (callback == null) for (t2 in _2) _2[t2] = set(_2[t2], typename.name, null);
16596 var copy2 = {}, _2 = this._;
16597 for (var t2 in _2) copy2[t2] = _2[t2].slice();
16598 return new Dispatch(copy2);
16600 call: function(type2, that) {
16601 if ((n3 = arguments.length - 2) > 0) for (var args = new Array(n3), i3 = 0, n3, t2; i3 < n3; ++i3) args[i3] = arguments[i3 + 2];
16602 if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
16603 for (t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
16605 apply: function(type2, that, args) {
16606 if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2);
16607 for (var t2 = this._[type2], i3 = 0, n3 = t2.length; i3 < n3; ++i3) t2[i3].value.apply(that, args);
16610 function get(type2, name) {
16611 for (var i3 = 0, n3 = type2.length, c2; i3 < n3; ++i3) {
16612 if ((c2 = type2[i3]).name === name) {
16617 function set(type2, name, callback) {
16618 for (var i3 = 0, n3 = type2.length; i3 < n3; ++i3) {
16619 if (type2[i3].name === name) {
16620 type2[i3] = noop2, type2 = type2.slice(0, i3).concat(type2.slice(i3 + 1));
16624 if (callback != null) type2.push({ name, value: callback });
16627 var dispatch_default = dispatch;
16629 // node_modules/d3-selection/src/namespaces.js
16630 var xhtml = "http://www.w3.org/1999/xhtml";
16631 var namespaces_default = {
16632 svg: "http://www.w3.org/2000/svg",
16634 xlink: "http://www.w3.org/1999/xlink",
16635 xml: "http://www.w3.org/XML/1998/namespace",
16636 xmlns: "http://www.w3.org/2000/xmlns/"
16639 // node_modules/d3-selection/src/namespace.js
16640 function namespace_default(name) {
16641 var prefix = name += "", i3 = prefix.indexOf(":");
16642 if (i3 >= 0 && (prefix = name.slice(0, i3)) !== "xmlns") name = name.slice(i3 + 1);
16643 return namespaces_default.hasOwnProperty(prefix) ? { space: namespaces_default[prefix], local: name } : name;
16646 // node_modules/d3-selection/src/creator.js
16647 function creatorInherit(name) {
16648 return function() {
16649 var document2 = this.ownerDocument, uri = this.namespaceURI;
16650 return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name) : document2.createElementNS(uri, name);
16653 function creatorFixed(fullname) {
16654 return function() {
16655 return this.ownerDocument.createElementNS(fullname.space, fullname.local);
16658 function creator_default(name) {
16659 var fullname = namespace_default(name);
16660 return (fullname.local ? creatorFixed : creatorInherit)(fullname);
16663 // node_modules/d3-selection/src/selector.js
16666 function selector_default(selector) {
16667 return selector == null ? none : function() {
16668 return this.querySelector(selector);
16672 // node_modules/d3-selection/src/selection/select.js
16673 function select_default(select) {
16674 if (typeof select !== "function") select = selector_default(select);
16675 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16676 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
16677 if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
16678 if ("__data__" in node) subnode.__data__ = node.__data__;
16679 subgroup[i3] = subnode;
16683 return new Selection(subgroups, this._parents);
16686 // node_modules/d3-selection/src/array.js
16687 function array(x2) {
16688 return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2);
16691 // node_modules/d3-selection/src/selectorAll.js
16695 function selectorAll_default(selector) {
16696 return selector == null ? empty : function() {
16697 return this.querySelectorAll(selector);
16701 // node_modules/d3-selection/src/selection/selectAll.js
16702 function arrayAll(select) {
16703 return function() {
16704 return array(select.apply(this, arguments));
16707 function selectAll_default(select) {
16708 if (typeof select === "function") select = arrayAll(select);
16709 else select = selectorAll_default(select);
16710 for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
16711 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
16712 if (node = group[i3]) {
16713 subgroups.push(select.call(node, node.__data__, i3, group));
16714 parents.push(node);
16718 return new Selection(subgroups, parents);
16721 // node_modules/d3-selection/src/matcher.js
16722 function matcher_default(selector) {
16723 return function() {
16724 return this.matches(selector);
16727 function childMatcher(selector) {
16728 return function(node) {
16729 return node.matches(selector);
16733 // node_modules/d3-selection/src/selection/selectChild.js
16734 var find = Array.prototype.find;
16735 function childFind(match) {
16736 return function() {
16737 return find.call(this.children, match);
16740 function childFirst() {
16741 return this.firstElementChild;
16743 function selectChild_default(match) {
16744 return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match)));
16747 // node_modules/d3-selection/src/selection/selectChildren.js
16748 var filter = Array.prototype.filter;
16749 function children() {
16750 return Array.from(this.children);
16752 function childrenFilter(match) {
16753 return function() {
16754 return filter.call(this.children, match);
16757 function selectChildren_default(match) {
16758 return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match)));
16761 // node_modules/d3-selection/src/selection/filter.js
16762 function filter_default(match) {
16763 if (typeof match !== "function") match = matcher_default(match);
16764 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16765 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
16766 if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
16767 subgroup.push(node);
16771 return new Selection(subgroups, this._parents);
16774 // node_modules/d3-selection/src/selection/sparse.js
16775 function sparse_default(update) {
16776 return new Array(update.length);
16779 // node_modules/d3-selection/src/selection/enter.js
16780 function enter_default() {
16781 return new Selection(this._enter || this._groups.map(sparse_default), this._parents);
16783 function EnterNode(parent, datum2) {
16784 this.ownerDocument = parent.ownerDocument;
16785 this.namespaceURI = parent.namespaceURI;
16787 this._parent = parent;
16788 this.__data__ = datum2;
16790 EnterNode.prototype = {
16791 constructor: EnterNode,
16792 appendChild: function(child) {
16793 return this._parent.insertBefore(child, this._next);
16795 insertBefore: function(child, next) {
16796 return this._parent.insertBefore(child, next);
16798 querySelector: function(selector) {
16799 return this._parent.querySelector(selector);
16801 querySelectorAll: function(selector) {
16802 return this._parent.querySelectorAll(selector);
16806 // node_modules/d3-selection/src/constant.js
16807 function constant_default(x2) {
16808 return function() {
16813 // node_modules/d3-selection/src/selection/data.js
16814 function bindIndex(parent, group, enter, update, exit, data) {
16815 var i3 = 0, node, groupLength = group.length, dataLength = data.length;
16816 for (; i3 < dataLength; ++i3) {
16817 if (node = group[i3]) {
16818 node.__data__ = data[i3];
16821 enter[i3] = new EnterNode(parent, data[i3]);
16824 for (; i3 < groupLength; ++i3) {
16825 if (node = group[i3]) {
16830 function bindKey(parent, group, enter, update, exit, data, key) {
16831 var i3, node, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue;
16832 for (i3 = 0; i3 < groupLength; ++i3) {
16833 if (node = group[i3]) {
16834 keyValues[i3] = keyValue = key.call(node, node.__data__, i3, group) + "";
16835 if (nodeByKeyValue.has(keyValue)) {
16838 nodeByKeyValue.set(keyValue, node);
16842 for (i3 = 0; i3 < dataLength; ++i3) {
16843 keyValue = key.call(parent, data[i3], i3, data) + "";
16844 if (node = nodeByKeyValue.get(keyValue)) {
16846 node.__data__ = data[i3];
16847 nodeByKeyValue.delete(keyValue);
16849 enter[i3] = new EnterNode(parent, data[i3]);
16852 for (i3 = 0; i3 < groupLength; ++i3) {
16853 if ((node = group[i3]) && nodeByKeyValue.get(keyValues[i3]) === node) {
16858 function datum(node) {
16859 return node.__data__;
16861 function data_default(value, key) {
16862 if (!arguments.length) return Array.from(this, datum);
16863 var bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
16864 if (typeof value !== "function") value = constant_default(value);
16865 for (var m2 = groups.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16866 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);
16867 bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);
16868 for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {
16869 if (previous = enterGroup[i0]) {
16870 if (i0 >= i1) i1 = i0 + 1;
16871 while (!(next = updateGroup[i1]) && ++i1 < dataLength) ;
16872 previous._next = next || null;
16876 update = new Selection(update, parents);
16877 update._enter = enter;
16878 update._exit = exit;
16881 function arraylike(data) {
16882 return typeof data === "object" && "length" in data ? data : Array.from(data);
16885 // node_modules/d3-selection/src/selection/exit.js
16886 function exit_default() {
16887 return new Selection(this._exit || this._groups.map(sparse_default), this._parents);
16890 // node_modules/d3-selection/src/selection/join.js
16891 function join_default(onenter, onupdate, onexit) {
16892 var enter = this.enter(), update = this, exit = this.exit();
16893 if (typeof onenter === "function") {
16894 enter = onenter(enter);
16895 if (enter) enter = enter.selection();
16897 enter = enter.append(onenter + "");
16899 if (onupdate != null) {
16900 update = onupdate(update);
16901 if (update) update = update.selection();
16903 if (onexit == null) exit.remove();
16905 return enter && update ? enter.merge(update).order() : update;
16908 // node_modules/d3-selection/src/selection/merge.js
16909 function merge_default(context) {
16910 var selection2 = context.selection ? context.selection() : context;
16911 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) {
16912 for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
16913 if (node = group0[i3] || group1[i3]) {
16918 for (; j2 < m0; ++j2) {
16919 merges[j2] = groups0[j2];
16921 return new Selection(merges, this._parents);
16924 // node_modules/d3-selection/src/selection/order.js
16925 function order_default() {
16926 for (var groups = this._groups, j2 = -1, m2 = groups.length; ++j2 < m2; ) {
16927 for (var group = groups[j2], i3 = group.length - 1, next = group[i3], node; --i3 >= 0; ) {
16928 if (node = group[i3]) {
16929 if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);
16937 // node_modules/d3-selection/src/selection/sort.js
16938 function sort_default(compare2) {
16939 if (!compare2) compare2 = ascending2;
16940 function compareNode(a2, b2) {
16941 return a2 && b2 ? compare2(a2.__data__, b2.__data__) : !a2 - !b2;
16943 for (var groups = this._groups, m2 = groups.length, sortgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
16944 for (var group = groups[j2], n3 = group.length, sortgroup = sortgroups[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
16945 if (node = group[i3]) {
16946 sortgroup[i3] = node;
16949 sortgroup.sort(compareNode);
16951 return new Selection(sortgroups, this._parents).order();
16953 function ascending2(a2, b2) {
16954 return a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
16957 // node_modules/d3-selection/src/selection/call.js
16958 function call_default() {
16959 var callback = arguments[0];
16960 arguments[0] = this;
16961 callback.apply(null, arguments);
16965 // node_modules/d3-selection/src/selection/nodes.js
16966 function nodes_default() {
16967 return Array.from(this);
16970 // node_modules/d3-selection/src/selection/node.js
16971 function node_default() {
16972 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
16973 for (var group = groups[j2], i3 = 0, n3 = group.length; i3 < n3; ++i3) {
16974 var node = group[i3];
16975 if (node) return node;
16981 // node_modules/d3-selection/src/selection/size.js
16982 function size_default() {
16984 for (const node of this) ++size;
16988 // node_modules/d3-selection/src/selection/empty.js
16989 function empty_default() {
16990 return !this.node();
16993 // node_modules/d3-selection/src/selection/each.js
16994 function each_default(callback) {
16995 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
16996 for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
16997 if (node = group[i3]) callback.call(node, node.__data__, i3, group);
17003 // node_modules/d3-selection/src/selection/attr.js
17004 function attrRemove(name) {
17005 return function() {
17006 this.removeAttribute(name);
17009 function attrRemoveNS(fullname) {
17010 return function() {
17011 this.removeAttributeNS(fullname.space, fullname.local);
17014 function attrConstant(name, value) {
17015 return function() {
17016 this.setAttribute(name, value);
17019 function attrConstantNS(fullname, value) {
17020 return function() {
17021 this.setAttributeNS(fullname.space, fullname.local, value);
17024 function attrFunction(name, value) {
17025 return function() {
17026 var v2 = value.apply(this, arguments);
17027 if (v2 == null) this.removeAttribute(name);
17028 else this.setAttribute(name, v2);
17031 function attrFunctionNS(fullname, value) {
17032 return function() {
17033 var v2 = value.apply(this, arguments);
17034 if (v2 == null) this.removeAttributeNS(fullname.space, fullname.local);
17035 else this.setAttributeNS(fullname.space, fullname.local, v2);
17038 function attr_default(name, value) {
17039 var fullname = namespace_default(name);
17040 if (arguments.length < 2) {
17041 var node = this.node();
17042 return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
17044 return this.each((value == null ? fullname.local ? attrRemoveNS : attrRemove : typeof value === "function" ? fullname.local ? attrFunctionNS : attrFunction : fullname.local ? attrConstantNS : attrConstant)(fullname, value));
17047 // node_modules/d3-selection/src/window.js
17048 function window_default(node) {
17049 return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
17052 // node_modules/d3-selection/src/selection/style.js
17053 function styleRemove(name) {
17054 return function() {
17055 this.style.removeProperty(name);
17058 function styleConstant(name, value, priority) {
17059 return function() {
17060 this.style.setProperty(name, value, priority);
17063 function styleFunction(name, value, priority) {
17064 return function() {
17065 var v2 = value.apply(this, arguments);
17066 if (v2 == null) this.style.removeProperty(name);
17067 else this.style.setProperty(name, v2, priority);
17070 function style_default(name, value, priority) {
17071 return arguments.length > 1 ? this.each((value == null ? styleRemove : typeof value === "function" ? styleFunction : styleConstant)(name, value, priority == null ? "" : priority)) : styleValue(this.node(), name);
17073 function styleValue(node, name) {
17074 return node.style.getPropertyValue(name) || window_default(node).getComputedStyle(node, null).getPropertyValue(name);
17077 // node_modules/d3-selection/src/selection/property.js
17078 function propertyRemove(name) {
17079 return function() {
17083 function propertyConstant(name, value) {
17084 return function() {
17085 this[name] = value;
17088 function propertyFunction(name, value) {
17089 return function() {
17090 var v2 = value.apply(this, arguments);
17091 if (v2 == null) delete this[name];
17092 else this[name] = v2;
17095 function property_default(name, value) {
17096 return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name, value)) : this.node()[name];
17099 // node_modules/d3-selection/src/selection/classed.js
17100 function classArray(string) {
17101 return string.trim().split(/^|\s+/);
17103 function classList(node) {
17104 return node.classList || new ClassList(node);
17106 function ClassList(node) {
17108 this._names = classArray(node.getAttribute("class") || "");
17110 ClassList.prototype = {
17111 add: function(name) {
17112 var i3 = this._names.indexOf(name);
17114 this._names.push(name);
17115 this._node.setAttribute("class", this._names.join(" "));
17118 remove: function(name) {
17119 var i3 = this._names.indexOf(name);
17121 this._names.splice(i3, 1);
17122 this._node.setAttribute("class", this._names.join(" "));
17125 contains: function(name) {
17126 return this._names.indexOf(name) >= 0;
17129 function classedAdd(node, names) {
17130 var list2 = classList(node), i3 = -1, n3 = names.length;
17131 while (++i3 < n3) list2.add(names[i3]);
17133 function classedRemove(node, names) {
17134 var list2 = classList(node), i3 = -1, n3 = names.length;
17135 while (++i3 < n3) list2.remove(names[i3]);
17137 function classedTrue(names) {
17138 return function() {
17139 classedAdd(this, names);
17142 function classedFalse(names) {
17143 return function() {
17144 classedRemove(this, names);
17147 function classedFunction(names, value) {
17148 return function() {
17149 (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
17152 function classed_default(name, value) {
17153 var names = classArray(name + "");
17154 if (arguments.length < 2) {
17155 var list2 = classList(this.node()), i3 = -1, n3 = names.length;
17156 while (++i3 < n3) if (!list2.contains(names[i3])) return false;
17159 return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value));
17162 // node_modules/d3-selection/src/selection/text.js
17163 function textRemove() {
17164 this.textContent = "";
17166 function textConstant(value) {
17167 return function() {
17168 this.textContent = value;
17171 function textFunction(value) {
17172 return function() {
17173 var v2 = value.apply(this, arguments);
17174 this.textContent = v2 == null ? "" : v2;
17177 function text_default(value) {
17178 return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction : textConstant)(value)) : this.node().textContent;
17181 // node_modules/d3-selection/src/selection/html.js
17182 function htmlRemove() {
17183 this.innerHTML = "";
17185 function htmlConstant(value) {
17186 return function() {
17187 this.innerHTML = value;
17190 function htmlFunction(value) {
17191 return function() {
17192 var v2 = value.apply(this, arguments);
17193 this.innerHTML = v2 == null ? "" : v2;
17196 function html_default(value) {
17197 return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML;
17200 // node_modules/d3-selection/src/selection/raise.js
17202 if (this.nextSibling) this.parentNode.appendChild(this);
17204 function raise_default() {
17205 return this.each(raise);
17208 // node_modules/d3-selection/src/selection/lower.js
17210 if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);
17212 function lower_default() {
17213 return this.each(lower);
17216 // node_modules/d3-selection/src/selection/append.js
17217 function append_default(name) {
17218 var create2 = typeof name === "function" ? name : creator_default(name);
17219 return this.select(function() {
17220 return this.appendChild(create2.apply(this, arguments));
17224 // node_modules/d3-selection/src/selection/insert.js
17225 function constantNull() {
17228 function insert_default(name, before) {
17229 var create2 = typeof name === "function" ? name : creator_default(name), select = before == null ? constantNull : typeof before === "function" ? before : selector_default(before);
17230 return this.select(function() {
17231 return this.insertBefore(create2.apply(this, arguments), select.apply(this, arguments) || null);
17235 // node_modules/d3-selection/src/selection/remove.js
17236 function remove() {
17237 var parent = this.parentNode;
17238 if (parent) parent.removeChild(this);
17240 function remove_default() {
17241 return this.each(remove);
17244 // node_modules/d3-selection/src/selection/clone.js
17245 function selection_cloneShallow() {
17246 var clone2 = this.cloneNode(false), parent = this.parentNode;
17247 return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
17249 function selection_cloneDeep() {
17250 var clone2 = this.cloneNode(true), parent = this.parentNode;
17251 return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2;
17253 function clone_default(deep) {
17254 return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
17257 // node_modules/d3-selection/src/selection/datum.js
17258 function datum_default(value) {
17259 return arguments.length ? this.property("__data__", value) : this.node().__data__;
17262 // node_modules/d3-selection/src/selection/on.js
17263 function contextListener(listener) {
17264 return function(event) {
17265 listener.call(this, event, this.__data__);
17268 function parseTypenames2(typenames) {
17269 return typenames.trim().split(/^|\s+/).map(function(t2) {
17270 var name = "", i3 = t2.indexOf(".");
17271 if (i3 >= 0) name = t2.slice(i3 + 1), t2 = t2.slice(0, i3);
17272 return { type: t2, name };
17275 function onRemove(typename) {
17276 return function() {
17277 var on = this.__on;
17279 for (var j2 = 0, i3 = -1, m2 = on.length, o2; j2 < m2; ++j2) {
17280 if (o2 = on[j2], (!typename.type || o2.type === typename.type) && o2.name === typename.name) {
17281 this.removeEventListener(o2.type, o2.listener, o2.options);
17286 if (++i3) on.length = i3;
17287 else delete this.__on;
17290 function onAdd(typename, value, options2) {
17291 return function() {
17292 var on = this.__on, o2, listener = contextListener(value);
17293 if (on) for (var j2 = 0, m2 = on.length; j2 < m2; ++j2) {
17294 if ((o2 = on[j2]).type === typename.type && o2.name === typename.name) {
17295 this.removeEventListener(o2.type, o2.listener, o2.options);
17296 this.addEventListener(o2.type, o2.listener = listener, o2.options = options2);
17301 this.addEventListener(typename.type, listener, options2);
17302 o2 = { type: typename.type, name: typename.name, value, listener, options: options2 };
17303 if (!on) this.__on = [o2];
17307 function on_default(typename, value, options2) {
17308 var typenames = parseTypenames2(typename + ""), i3, n3 = typenames.length, t2;
17309 if (arguments.length < 2) {
17310 var on = this.node().__on;
17311 if (on) for (var j2 = 0, m2 = on.length, o2; j2 < m2; ++j2) {
17312 for (i3 = 0, o2 = on[j2]; i3 < n3; ++i3) {
17313 if ((t2 = typenames[i3]).type === o2.type && t2.name === o2.name) {
17320 on = value ? onAdd : onRemove;
17321 for (i3 = 0; i3 < n3; ++i3) this.each(on(typenames[i3], value, options2));
17325 // node_modules/d3-selection/src/selection/dispatch.js
17326 function dispatchEvent(node, type2, params) {
17327 var window2 = window_default(node), event = window2.CustomEvent;
17328 if (typeof event === "function") {
17329 event = new event(type2, params);
17331 event = window2.document.createEvent("Event");
17332 if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail;
17333 else event.initEvent(type2, false, false);
17335 node.dispatchEvent(event);
17337 function dispatchConstant(type2, params) {
17338 return function() {
17339 return dispatchEvent(this, type2, params);
17342 function dispatchFunction(type2, params) {
17343 return function() {
17344 return dispatchEvent(this, type2, params.apply(this, arguments));
17347 function dispatch_default2(type2, params) {
17348 return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params));
17351 // node_modules/d3-selection/src/selection/iterator.js
17352 function* iterator_default() {
17353 for (var groups = this._groups, j2 = 0, m2 = groups.length; j2 < m2; ++j2) {
17354 for (var group = groups[j2], i3 = 0, n3 = group.length, node; i3 < n3; ++i3) {
17355 if (node = group[i3]) yield node;
17360 // node_modules/d3-selection/src/selection/index.js
17362 function Selection(groups, parents) {
17363 this._groups = groups;
17364 this._parents = parents;
17366 function selection() {
17367 return new Selection([[document.documentElement]], root);
17369 function selection_selection() {
17372 Selection.prototype = selection.prototype = {
17373 constructor: Selection,
17374 select: select_default,
17375 selectAll: selectAll_default,
17376 selectChild: selectChild_default,
17377 selectChildren: selectChildren_default,
17378 filter: filter_default,
17379 data: data_default,
17380 enter: enter_default,
17381 exit: exit_default,
17382 join: join_default,
17383 merge: merge_default,
17384 selection: selection_selection,
17385 order: order_default,
17386 sort: sort_default,
17387 call: call_default,
17388 nodes: nodes_default,
17389 node: node_default,
17390 size: size_default,
17391 empty: empty_default,
17392 each: each_default,
17393 attr: attr_default,
17394 style: style_default,
17395 property: property_default,
17396 classed: classed_default,
17397 text: text_default,
17398 html: html_default,
17399 raise: raise_default,
17400 lower: lower_default,
17401 append: append_default,
17402 insert: insert_default,
17403 remove: remove_default,
17404 clone: clone_default,
17405 datum: datum_default,
17407 dispatch: dispatch_default2,
17408 [Symbol.iterator]: iterator_default
17410 var selection_default = selection;
17412 // node_modules/d3-selection/src/select.js
17413 function select_default2(selector) {
17414 return typeof selector === "string" ? new Selection([[document.querySelector(selector)]], [document.documentElement]) : new Selection([[selector]], root);
17417 // node_modules/d3-selection/src/sourceEvent.js
17418 function sourceEvent_default(event) {
17420 while (sourceEvent = event.sourceEvent) event = sourceEvent;
17424 // node_modules/d3-selection/src/pointer.js
17425 function pointer_default(event, node) {
17426 event = sourceEvent_default(event);
17427 if (node === void 0) node = event.currentTarget;
17429 var svg2 = node.ownerSVGElement || node;
17430 if (svg2.createSVGPoint) {
17431 var point = svg2.createSVGPoint();
17432 point.x = event.clientX, point.y = event.clientY;
17433 point = point.matrixTransform(node.getScreenCTM().inverse());
17434 return [point.x, point.y];
17436 if (node.getBoundingClientRect) {
17437 var rect = node.getBoundingClientRect();
17438 return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
17441 return [event.pageX, event.pageY];
17444 // node_modules/d3-selection/src/selectAll.js
17445 function selectAll_default2(selector) {
17446 return typeof selector === "string" ? new Selection([document.querySelectorAll(selector)], [document.documentElement]) : new Selection([array(selector)], root);
17449 // node_modules/d3-drag/src/noevent.js
17450 var nonpassive = { passive: false };
17451 var nonpassivecapture = { capture: true, passive: false };
17452 function nopropagation(event) {
17453 event.stopImmediatePropagation();
17455 function noevent_default(event) {
17456 event.preventDefault();
17457 event.stopImmediatePropagation();
17460 // node_modules/d3-drag/src/nodrag.js
17461 function nodrag_default(view) {
17462 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", noevent_default, nonpassivecapture);
17463 if ("onselectstart" in root3) {
17464 selection2.on("selectstart.drag", noevent_default, nonpassivecapture);
17466 root3.__noselect = root3.style.MozUserSelect;
17467 root3.style.MozUserSelect = "none";
17470 function yesdrag(view, noclick) {
17471 var root3 = view.document.documentElement, selection2 = select_default2(view).on("dragstart.drag", null);
17473 selection2.on("click.drag", noevent_default, nonpassivecapture);
17474 setTimeout(function() {
17475 selection2.on("click.drag", null);
17478 if ("onselectstart" in root3) {
17479 selection2.on("selectstart.drag", null);
17481 root3.style.MozUserSelect = root3.__noselect;
17482 delete root3.__noselect;
17486 // node_modules/d3-drag/src/constant.js
17487 var constant_default2 = (x2) => () => x2;
17489 // node_modules/d3-drag/src/event.js
17490 function DragEvent(type2, {
17500 dispatch: dispatch14
17502 Object.defineProperties(this, {
17503 type: { value: type2, enumerable: true, configurable: true },
17504 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
17505 subject: { value: subject, enumerable: true, configurable: true },
17506 target: { value: target, enumerable: true, configurable: true },
17507 identifier: { value: identifier, enumerable: true, configurable: true },
17508 active: { value: active, enumerable: true, configurable: true },
17509 x: { value: x2, enumerable: true, configurable: true },
17510 y: { value: y2, enumerable: true, configurable: true },
17511 dx: { value: dx, enumerable: true, configurable: true },
17512 dy: { value: dy, enumerable: true, configurable: true },
17513 _: { value: dispatch14 }
17516 DragEvent.prototype.on = function() {
17517 var value = this._.on.apply(this._, arguments);
17518 return value === this._ ? this : value;
17521 // node_modules/d3-drag/src/drag.js
17522 function defaultFilter(event) {
17523 return !event.ctrlKey && !event.button;
17525 function defaultContainer() {
17526 return this.parentNode;
17528 function defaultSubject(event, d2) {
17529 return d2 == null ? { x: event.x, y: event.y } : d2;
17531 function defaultTouchable() {
17532 return navigator.maxTouchPoints || "ontouchstart" in this;
17534 function drag_default() {
17535 var filter2 = defaultFilter, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch_default("start", "drag", "end"), active = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0;
17536 function drag(selection2) {
17537 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)");
17539 function mousedowned(event, d2) {
17540 if (touchending || !filter2.call(this, event, d2)) return;
17541 var gesture = beforestart(this, container.call(this, event, d2), event, d2, "mouse");
17542 if (!gesture) return;
17543 select_default2(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture);
17544 nodrag_default(event.view);
17545 nopropagation(event);
17546 mousemoving = false;
17547 mousedownx = event.clientX;
17548 mousedowny = event.clientY;
17549 gesture("start", event);
17551 function mousemoved(event) {
17552 noevent_default(event);
17553 if (!mousemoving) {
17554 var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
17555 mousemoving = dx * dx + dy * dy > clickDistance2;
17557 gestures.mouse("drag", event);
17559 function mouseupped(event) {
17560 select_default2(event.view).on("mousemove.drag mouseup.drag", null);
17561 yesdrag(event.view, mousemoving);
17562 noevent_default(event);
17563 gestures.mouse("end", event);
17565 function touchstarted(event, d2) {
17566 if (!filter2.call(this, event, d2)) return;
17567 var touches = event.changedTouches, c2 = container.call(this, event, d2), n3 = touches.length, i3, gesture;
17568 for (i3 = 0; i3 < n3; ++i3) {
17569 if (gesture = beforestart(this, c2, event, d2, touches[i3].identifier, touches[i3])) {
17570 nopropagation(event);
17571 gesture("start", event, touches[i3]);
17575 function touchmoved(event) {
17576 var touches = event.changedTouches, n3 = touches.length, i3, gesture;
17577 for (i3 = 0; i3 < n3; ++i3) {
17578 if (gesture = gestures[touches[i3].identifier]) {
17579 noevent_default(event);
17580 gesture("drag", event, touches[i3]);
17584 function touchended(event) {
17585 var touches = event.changedTouches, n3 = touches.length, i3, gesture;
17586 if (touchending) clearTimeout(touchending);
17587 touchending = setTimeout(function() {
17588 touchending = null;
17590 for (i3 = 0; i3 < n3; ++i3) {
17591 if (gesture = gestures[touches[i3].identifier]) {
17592 nopropagation(event);
17593 gesture("end", event, touches[i3]);
17597 function beforestart(that, container2, event, d2, identifier, touch) {
17598 var dispatch14 = listeners.copy(), p2 = pointer_default(touch || event, container2), dx, dy, s2;
17599 if ((s2 = subject.call(that, new DragEvent("beforestart", {
17600 sourceEvent: event,
17608 dispatch: dispatch14
17609 }), d2)) == null) return;
17610 dx = s2.x - p2[0] || 0;
17611 dy = s2.y - p2[1] || 0;
17612 return function gesture(type2, event2, touch2) {
17616 gestures[identifier] = gesture, n3 = active++;
17619 delete gestures[identifier], --active;
17622 p2 = pointer_default(touch2 || event2, container2), n3 = active;
17628 new DragEvent(type2, {
17629 sourceEvent: event2,
17636 dx: p2[0] - p02[0],
17637 dy: p2[1] - p02[1],
17638 dispatch: dispatch14
17644 drag.filter = function(_2) {
17645 return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : filter2;
17647 drag.container = function(_2) {
17648 return arguments.length ? (container = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : container;
17650 drag.subject = function(_2) {
17651 return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant_default2(_2), drag) : subject;
17653 drag.touchable = function(_2) {
17654 return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default2(!!_2), drag) : touchable;
17656 drag.on = function() {
17657 var value = listeners.on.apply(listeners, arguments);
17658 return value === listeners ? drag : value;
17660 drag.clickDistance = function(_2) {
17661 return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag) : Math.sqrt(clickDistance2);
17666 // node_modules/d3-color/src/define.js
17667 function define_default(constructor, factory, prototype) {
17668 constructor.prototype = factory.prototype = prototype;
17669 prototype.constructor = constructor;
17671 function extend(parent, definition) {
17672 var prototype = Object.create(parent.prototype);
17673 for (var key in definition) prototype[key] = definition[key];
17677 // node_modules/d3-color/src/color.js
17681 var brighter = 1 / darker;
17682 var reI = "\\s*([+-]?\\d+)\\s*";
17683 var reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*";
17684 var reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*";
17685 var reHex = /^#([0-9a-f]{3,8})$/;
17686 var reRgbInteger = new RegExp("^rgb\\(".concat(reI, ",").concat(reI, ",").concat(reI, "\\)$"));
17687 var reRgbPercent = new RegExp("^rgb\\(".concat(reP, ",").concat(reP, ",").concat(reP, "\\)$"));
17688 var reRgbaInteger = new RegExp("^rgba\\(".concat(reI, ",").concat(reI, ",").concat(reI, ",").concat(reN, "\\)$"));
17689 var reRgbaPercent = new RegExp("^rgba\\(".concat(reP, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
17690 var reHslPercent = new RegExp("^hsl\\(".concat(reN, ",").concat(reP, ",").concat(reP, "\\)$"));
17691 var reHslaPercent = new RegExp("^hsla\\(".concat(reN, ",").concat(reP, ",").concat(reP, ",").concat(reN, "\\)$"));
17693 aliceblue: 15792383,
17694 antiquewhite: 16444375,
17696 aquamarine: 8388564,
17701 blanchedalmond: 16772045,
17703 blueviolet: 9055202,
17705 burlywood: 14596231,
17706 cadetblue: 6266528,
17707 chartreuse: 8388352,
17708 chocolate: 13789470,
17710 cornflowerblue: 6591981,
17711 cornsilk: 16775388,
17716 darkgoldenrod: 12092939,
17717 darkgray: 11119017,
17719 darkgrey: 11119017,
17720 darkkhaki: 12433259,
17721 darkmagenta: 9109643,
17722 darkolivegreen: 5597999,
17723 darkorange: 16747520,
17724 darkorchid: 10040012,
17726 darksalmon: 15308410,
17727 darkseagreen: 9419919,
17728 darkslateblue: 4734347,
17729 darkslategray: 3100495,
17730 darkslategrey: 3100495,
17731 darkturquoise: 52945,
17732 darkviolet: 9699539,
17733 deeppink: 16716947,
17734 deepskyblue: 49151,
17737 dodgerblue: 2003199,
17738 firebrick: 11674146,
17739 floralwhite: 16775920,
17740 forestgreen: 2263842,
17742 gainsboro: 14474460,
17743 ghostwhite: 16316671,
17745 goldenrod: 14329120,
17748 greenyellow: 11403055,
17750 honeydew: 15794160,
17752 indianred: 13458524,
17756 lavender: 15132410,
17757 lavenderblush: 16773365,
17758 lawngreen: 8190976,
17759 lemonchiffon: 16775885,
17760 lightblue: 11393254,
17761 lightcoral: 15761536,
17762 lightcyan: 14745599,
17763 lightgoldenrodyellow: 16448210,
17764 lightgray: 13882323,
17765 lightgreen: 9498256,
17766 lightgrey: 13882323,
17767 lightpink: 16758465,
17768 lightsalmon: 16752762,
17769 lightseagreen: 2142890,
17770 lightskyblue: 8900346,
17771 lightslategray: 7833753,
17772 lightslategrey: 7833753,
17773 lightsteelblue: 11584734,
17774 lightyellow: 16777184,
17776 limegreen: 3329330,
17780 mediumaquamarine: 6737322,
17782 mediumorchid: 12211667,
17783 mediumpurple: 9662683,
17784 mediumseagreen: 3978097,
17785 mediumslateblue: 8087790,
17786 mediumspringgreen: 64154,
17787 mediumturquoise: 4772300,
17788 mediumvioletred: 13047173,
17789 midnightblue: 1644912,
17790 mintcream: 16121850,
17791 mistyrose: 16770273,
17792 moccasin: 16770229,
17793 navajowhite: 16768685,
17797 olivedrab: 7048739,
17799 orangered: 16729344,
17801 palegoldenrod: 15657130,
17802 palegreen: 10025880,
17803 paleturquoise: 11529966,
17804 palevioletred: 14381203,
17805 papayawhip: 16773077,
17806 peachpuff: 16767673,
17810 powderblue: 11591910,
17812 rebeccapurple: 6697881,
17814 rosybrown: 12357519,
17815 royalblue: 4286945,
17816 saddlebrown: 9127187,
17818 sandybrown: 16032864,
17820 seashell: 16774638,
17824 slateblue: 6970061,
17825 slategray: 7372944,
17826 slategrey: 7372944,
17828 springgreen: 65407,
17829 steelblue: 4620980,
17834 turquoise: 4251856,
17838 whitesmoke: 16119285,
17840 yellowgreen: 10145074
17842 define_default(Color, color, {
17844 return Object.assign(new this.constructor(), this, channels);
17847 return this.rgb().displayable();
17849 hex: color_formatHex,
17850 // Deprecated! Use color.formatHex.
17851 formatHex: color_formatHex,
17852 formatHex8: color_formatHex8,
17853 formatHsl: color_formatHsl,
17854 formatRgb: color_formatRgb,
17855 toString: color_formatRgb
17857 function color_formatHex() {
17858 return this.rgb().formatHex();
17860 function color_formatHex8() {
17861 return this.rgb().formatHex8();
17863 function color_formatHsl() {
17864 return hslConvert(this).formatHsl();
17866 function color_formatRgb() {
17867 return this.rgb().formatRgb();
17869 function color(format2) {
17871 format2 = (format2 + "").trim().toLowerCase();
17872 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;
17874 function rgbn(n3) {
17875 return new Rgb(n3 >> 16 & 255, n3 >> 8 & 255, n3 & 255, 1);
17877 function rgba(r2, g3, b2, a2) {
17878 if (a2 <= 0) r2 = g3 = b2 = NaN;
17879 return new Rgb(r2, g3, b2, a2);
17881 function rgbConvert(o2) {
17882 if (!(o2 instanceof Color)) o2 = color(o2);
17883 if (!o2) return new Rgb();
17885 return new Rgb(o2.r, o2.g, o2.b, o2.opacity);
17887 function rgb(r2, g3, b2, opacity) {
17888 return arguments.length === 1 ? rgbConvert(r2) : new Rgb(r2, g3, b2, opacity == null ? 1 : opacity);
17890 function Rgb(r2, g3, b2, opacity) {
17894 this.opacity = +opacity;
17896 define_default(Rgb, rgb, extend(Color, {
17898 k2 = k2 == null ? brighter : Math.pow(brighter, k2);
17899 return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
17902 k2 = k2 == null ? darker : Math.pow(darker, k2);
17903 return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity);
17909 return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
17912 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);
17914 hex: rgb_formatHex,
17915 // Deprecated! Use color.formatHex.
17916 formatHex: rgb_formatHex,
17917 formatHex8: rgb_formatHex8,
17918 formatRgb: rgb_formatRgb,
17919 toString: rgb_formatRgb
17921 function rgb_formatHex() {
17922 return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b));
17924 function rgb_formatHex8() {
17925 return "#".concat(hex(this.r)).concat(hex(this.g)).concat(hex(this.b)).concat(hex((isNaN(this.opacity) ? 1 : this.opacity) * 255));
17927 function rgb_formatRgb() {
17928 const a2 = clampa(this.opacity);
17929 return "".concat(a2 === 1 ? "rgb(" : "rgba(").concat(clampi(this.r), ", ").concat(clampi(this.g), ", ").concat(clampi(this.b)).concat(a2 === 1 ? ")" : ", ".concat(a2, ")"));
17931 function clampa(opacity) {
17932 return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
17934 function clampi(value) {
17935 return Math.max(0, Math.min(255, Math.round(value) || 0));
17937 function hex(value) {
17938 value = clampi(value);
17939 return (value < 16 ? "0" : "") + value.toString(16);
17941 function hsla(h2, s2, l2, a2) {
17942 if (a2 <= 0) h2 = s2 = l2 = NaN;
17943 else if (l2 <= 0 || l2 >= 1) h2 = s2 = NaN;
17944 else if (s2 <= 0) h2 = NaN;
17945 return new Hsl(h2, s2, l2, a2);
17947 function hslConvert(o2) {
17948 if (o2 instanceof Hsl) return new Hsl(o2.h, o2.s, o2.l, o2.opacity);
17949 if (!(o2 instanceof Color)) o2 = color(o2);
17950 if (!o2) return new Hsl();
17951 if (o2 instanceof Hsl) return o2;
17953 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;
17955 if (r2 === max3) h2 = (g3 - b2) / s2 + (g3 < b2) * 6;
17956 else if (g3 === max3) h2 = (b2 - r2) / s2 + 2;
17957 else h2 = (r2 - g3) / s2 + 4;
17958 s2 /= l2 < 0.5 ? max3 + min3 : 2 - max3 - min3;
17961 s2 = l2 > 0 && l2 < 1 ? 0 : h2;
17963 return new Hsl(h2, s2, l2, o2.opacity);
17965 function hsl(h2, s2, l2, opacity) {
17966 return arguments.length === 1 ? hslConvert(h2) : new Hsl(h2, s2, l2, opacity == null ? 1 : opacity);
17968 function Hsl(h2, s2, l2, opacity) {
17972 this.opacity = +opacity;
17974 define_default(Hsl, hsl, extend(Color, {
17976 k2 = k2 == null ? brighter : Math.pow(brighter, k2);
17977 return new Hsl(this.h, this.s, this.l * k2, this.opacity);
17980 k2 = k2 == null ? darker : Math.pow(darker, k2);
17981 return new Hsl(this.h, this.s, this.l * k2, this.opacity);
17984 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;
17986 hsl2rgb(h2 >= 240 ? h2 - 240 : h2 + 120, m1, m2),
17987 hsl2rgb(h2, m1, m2),
17988 hsl2rgb(h2 < 120 ? h2 + 240 : h2 - 120, m1, m2),
17993 return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
17996 return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
17999 const a2 = clampa(this.opacity);
18000 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, ")"));
18003 function clamph(value) {
18004 value = (value || 0) % 360;
18005 return value < 0 ? value + 360 : value;
18007 function clampt(value) {
18008 return Math.max(0, Math.min(1, value || 0));
18010 function hsl2rgb(h2, m1, m2) {
18011 return (h2 < 60 ? m1 + (m2 - m1) * h2 / 60 : h2 < 180 ? m2 : h2 < 240 ? m1 + (m2 - m1) * (240 - h2) / 60 : m1) * 255;
18014 // node_modules/d3-interpolate/src/basis.js
18015 function basis(t1, v0, v1, v2, v3) {
18016 var t2 = t1 * t1, t3 = t2 * t1;
18017 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;
18019 function basis_default(values) {
18020 var n3 = values.length - 1;
18021 return function(t2) {
18022 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;
18023 return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
18027 // node_modules/d3-interpolate/src/basisClosed.js
18028 function basisClosed_default(values) {
18029 var n3 = values.length;
18030 return function(t2) {
18031 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];
18032 return basis((t2 - i3 / n3) * n3, v0, v1, v2, v3);
18036 // node_modules/d3-interpolate/src/constant.js
18037 var constant_default3 = (x2) => () => x2;
18039 // node_modules/d3-interpolate/src/color.js
18040 function linear(a2, d2) {
18041 return function(t2) {
18042 return a2 + t2 * d2;
18045 function exponential(a2, b2, y2) {
18046 return a2 = Math.pow(a2, y2), b2 = Math.pow(b2, y2) - a2, y2 = 1 / y2, function(t2) {
18047 return Math.pow(a2 + t2 * b2, y2);
18050 function gamma(y2) {
18051 return (y2 = +y2) === 1 ? nogamma : function(a2, b2) {
18052 return b2 - a2 ? exponential(a2, b2, y2) : constant_default3(isNaN(a2) ? b2 : a2);
18055 function nogamma(a2, b2) {
18057 return d2 ? linear(a2, d2) : constant_default3(isNaN(a2) ? b2 : a2);
18060 // node_modules/d3-interpolate/src/rgb.js
18061 var rgb_default = function rgbGamma(y2) {
18062 var color2 = gamma(y2);
18063 function rgb2(start2, end) {
18064 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);
18065 return function(t2) {
18069 start2.opacity = opacity(t2);
18070 return start2 + "";
18073 rgb2.gamma = rgbGamma;
18076 function rgbSpline(spline) {
18077 return function(colors) {
18078 var n3 = colors.length, r2 = new Array(n3), g3 = new Array(n3), b2 = new Array(n3), i3, color2;
18079 for (i3 = 0; i3 < n3; ++i3) {
18080 color2 = rgb(colors[i3]);
18081 r2[i3] = color2.r || 0;
18082 g3[i3] = color2.g || 0;
18083 b2[i3] = color2.b || 0;
18088 color2.opacity = 1;
18089 return function(t2) {
18093 return color2 + "";
18097 var rgbBasis = rgbSpline(basis_default);
18098 var rgbBasisClosed = rgbSpline(basisClosed_default);
18100 // node_modules/d3-interpolate/src/numberArray.js
18101 function numberArray_default(a2, b2) {
18103 var n3 = a2 ? Math.min(b2.length, a2.length) : 0, c2 = b2.slice(), i3;
18104 return function(t2) {
18105 for (i3 = 0; i3 < n3; ++i3) c2[i3] = a2[i3] * (1 - t2) + b2[i3] * t2;
18109 function isNumberArray(x2) {
18110 return ArrayBuffer.isView(x2) && !(x2 instanceof DataView);
18113 // node_modules/d3-interpolate/src/array.js
18114 function genericArray(a2, b2) {
18115 var nb = b2 ? b2.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i3;
18116 for (i3 = 0; i3 < na; ++i3) x2[i3] = value_default(a2[i3], b2[i3]);
18117 for (; i3 < nb; ++i3) c2[i3] = b2[i3];
18118 return function(t2) {
18119 for (i3 = 0; i3 < na; ++i3) c2[i3] = x2[i3](t2);
18124 // node_modules/d3-interpolate/src/date.js
18125 function date_default(a2, b2) {
18126 var d2 = /* @__PURE__ */ new Date();
18127 return a2 = +a2, b2 = +b2, function(t2) {
18128 return d2.setTime(a2 * (1 - t2) + b2 * t2), d2;
18132 // node_modules/d3-interpolate/src/number.js
18133 function number_default(a2, b2) {
18134 return a2 = +a2, b2 = +b2, function(t2) {
18135 return a2 * (1 - t2) + b2 * t2;
18139 // node_modules/d3-interpolate/src/object.js
18140 function object_default(a2, b2) {
18141 var i3 = {}, c2 = {}, k2;
18142 if (a2 === null || typeof a2 !== "object") a2 = {};
18143 if (b2 === null || typeof b2 !== "object") b2 = {};
18146 i3[k2] = value_default(a2[k2], b2[k2]);
18151 return function(t2) {
18152 for (k2 in i3) c2[k2] = i3[k2](t2);
18157 // node_modules/d3-interpolate/src/string.js
18158 var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
18159 var reB = new RegExp(reA.source, "g");
18160 function zero2(b2) {
18161 return function() {
18166 return function(t2) {
18167 return b2(t2) + "";
18170 function string_default(a2, b2) {
18171 var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i3 = -1, s2 = [], q2 = [];
18172 a2 = a2 + "", b2 = b2 + "";
18173 while ((am = reA.exec(a2)) && (bm = reB.exec(b2))) {
18174 if ((bs = bm.index) > bi) {
18175 bs = b2.slice(bi, bs);
18176 if (s2[i3]) s2[i3] += bs;
18177 else s2[++i3] = bs;
18179 if ((am = am[0]) === (bm = bm[0])) {
18180 if (s2[i3]) s2[i3] += bm;
18181 else s2[++i3] = bm;
18184 q2.push({ i: i3, x: number_default(am, bm) });
18186 bi = reB.lastIndex;
18188 if (bi < b2.length) {
18190 if (s2[i3]) s2[i3] += bs;
18191 else s2[++i3] = bs;
18193 return s2.length < 2 ? q2[0] ? one(q2[0].x) : zero2(b2) : (b2 = q2.length, function(t2) {
18194 for (var i4 = 0, o2; i4 < b2; ++i4) s2[(o2 = q2[i4]).i] = o2.x(t2);
18195 return s2.join("");
18199 // node_modules/d3-interpolate/src/value.js
18200 function value_default(a2, b2) {
18201 var t2 = typeof b2, c2;
18202 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);
18205 // node_modules/d3-interpolate/src/round.js
18206 function round_default(a2, b2) {
18207 return a2 = +a2, b2 = +b2, function(t2) {
18208 return Math.round(a2 * (1 - t2) + b2 * t2);
18212 // node_modules/d3-interpolate/src/transform/decompose.js
18213 var degrees2 = 180 / Math.PI;
18222 function decompose_default(a2, b2, c2, d2, e3, f2) {
18223 var scaleX, scaleY, skewX;
18224 if (scaleX = Math.sqrt(a2 * a2 + b2 * b2)) a2 /= scaleX, b2 /= scaleX;
18225 if (skewX = a2 * c2 + b2 * d2) c2 -= a2 * skewX, d2 -= b2 * skewX;
18226 if (scaleY = Math.sqrt(c2 * c2 + d2 * d2)) c2 /= scaleY, d2 /= scaleY, skewX /= scaleY;
18227 if (a2 * d2 < b2 * c2) a2 = -a2, b2 = -b2, skewX = -skewX, scaleX = -scaleX;
18231 rotate: Math.atan2(b2, a2) * degrees2,
18232 skewX: Math.atan(skewX) * degrees2,
18238 // node_modules/d3-interpolate/src/transform/parse.js
18240 function parseCss(value) {
18241 const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
18242 return m2.isIdentity ? identity : decompose_default(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f);
18244 function parseSvg(value) {
18245 if (value == null) return identity;
18246 if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
18247 svgNode.setAttribute("transform", value);
18248 if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
18249 value = value.matrix;
18250 return decompose_default(value.a, value.b, value.c, value.d, value.e, value.f);
18253 // node_modules/d3-interpolate/src/transform/index.js
18254 function interpolateTransform(parse, pxComma, pxParen, degParen) {
18256 return s2.length ? s2.pop() + " " : "";
18258 function translate(xa, ya, xb, yb, s2, q2) {
18259 if (xa !== xb || ya !== yb) {
18260 var i3 = s2.push("translate(", null, pxComma, null, pxParen);
18261 q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
18262 } else if (xb || yb) {
18263 s2.push("translate(" + xb + pxComma + yb + pxParen);
18266 function rotate(a2, b2, s2, q2) {
18268 if (a2 - b2 > 180) b2 += 360;
18269 else if (b2 - a2 > 180) a2 += 360;
18270 q2.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: number_default(a2, b2) });
18272 s2.push(pop(s2) + "rotate(" + b2 + degParen);
18275 function skewX(a2, b2, s2, q2) {
18277 q2.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: number_default(a2, b2) });
18279 s2.push(pop(s2) + "skewX(" + b2 + degParen);
18282 function scale(xa, ya, xb, yb, s2, q2) {
18283 if (xa !== xb || ya !== yb) {
18284 var i3 = s2.push(pop(s2) + "scale(", null, ",", null, ")");
18285 q2.push({ i: i3 - 4, x: number_default(xa, xb) }, { i: i3 - 2, x: number_default(ya, yb) });
18286 } else if (xb !== 1 || yb !== 1) {
18287 s2.push(pop(s2) + "scale(" + xb + "," + yb + ")");
18290 return function(a2, b2) {
18291 var s2 = [], q2 = [];
18292 a2 = parse(a2), b2 = parse(b2);
18293 translate(a2.translateX, a2.translateY, b2.translateX, b2.translateY, s2, q2);
18294 rotate(a2.rotate, b2.rotate, s2, q2);
18295 skewX(a2.skewX, b2.skewX, s2, q2);
18296 scale(a2.scaleX, a2.scaleY, b2.scaleX, b2.scaleY, s2, q2);
18298 return function(t2) {
18299 var i3 = -1, n3 = q2.length, o2;
18300 while (++i3 < n3) s2[(o2 = q2[i3]).i] = o2.x(t2);
18301 return s2.join("");
18305 var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
18306 var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
18308 // node_modules/d3-interpolate/src/zoom.js
18309 var epsilon22 = 1e-12;
18310 function cosh(x2) {
18311 return ((x2 = Math.exp(x2)) + 1 / x2) / 2;
18313 function sinh(x2) {
18314 return ((x2 = Math.exp(x2)) - 1 / x2) / 2;
18316 function tanh(x2) {
18317 return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1);
18319 var zoom_default = function zoomRho(rho, rho2, rho4) {
18320 function zoom(p02, p1) {
18321 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;
18322 if (d2 < epsilon22) {
18323 S2 = Math.log(w1 / w0) / rho;
18324 i3 = function(t2) {
18328 w0 * Math.exp(rho * t2 * S2)
18332 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);
18333 S2 = (r1 - r0) / rho;
18334 i3 = function(t2) {
18335 var s2 = t2 * S2, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0));
18339 w0 * coshr0 / cosh(rho * s2 + r0)
18343 i3.duration = S2 * 1e3 * rho / Math.SQRT2;
18346 zoom.rho = function(_2) {
18347 var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22;
18348 return zoomRho(_1, _22, _4);
18351 }(Math.SQRT2, 2, 4);
18353 // node_modules/d3-interpolate/src/quantize.js
18354 function quantize_default(interpolator, n3) {
18355 var samples = new Array(n3);
18356 for (var i3 = 0; i3 < n3; ++i3) samples[i3] = interpolator(i3 / (n3 - 1));
18360 // node_modules/d3-timer/src/timer.js
18364 var pokeDelay = 1e3;
18370 var clock = typeof performance === "object" && performance.now ? performance : Date;
18371 var setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f2) {
18372 setTimeout(f2, 17);
18375 return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
18377 function clearNow() {
18381 this._call = this._time = this._next = null;
18383 Timer.prototype = timer.prototype = {
18384 constructor: Timer,
18385 restart: function(callback, delay, time) {
18386 if (typeof callback !== "function") throw new TypeError("callback is not a function");
18387 time = (time == null ? now() : +time) + (delay == null ? 0 : +delay);
18388 if (!this._next && taskTail !== this) {
18389 if (taskTail) taskTail._next = this;
18390 else taskHead = this;
18393 this._call = callback;
18400 this._time = Infinity;
18405 function timer(callback, delay, time) {
18406 var t2 = new Timer();
18407 t2.restart(callback, delay, time);
18410 function timerFlush() {
18413 var t2 = taskHead, e3;
18415 if ((e3 = clockNow - t2._time) >= 0) t2._call.call(void 0, e3);
18421 clockNow = (clockLast = clock.now()) + clockSkew;
18422 frame = timeout = 0;
18432 var now3 = clock.now(), delay = now3 - clockLast;
18433 if (delay > pokeDelay) clockSkew -= delay, clockLast = now3;
18436 var t0, t1 = taskHead, t2, time = Infinity;
18439 if (time > t1._time) time = t1._time;
18440 t0 = t1, t1 = t1._next;
18442 t2 = t1._next, t1._next = null;
18443 t1 = t0 ? t0._next = t2 : taskHead = t2;
18449 function sleep(time) {
18451 if (timeout) timeout = clearTimeout(timeout);
18452 var delay = time - clockNow;
18454 if (time < Infinity) timeout = setTimeout(wake, time - clock.now() - clockSkew);
18455 if (interval) interval = clearInterval(interval);
18457 if (!interval) clockLast = clock.now(), interval = setInterval(poke, pokeDelay);
18458 frame = 1, setFrame(wake);
18462 // node_modules/d3-timer/src/timeout.js
18463 function timeout_default(callback, delay, time) {
18464 var t2 = new Timer();
18465 delay = delay == null ? 0 : +delay;
18466 t2.restart((elapsed) => {
18468 callback(elapsed + delay);
18473 // node_modules/d3-transition/src/transition/schedule.js
18474 var emptyOn = dispatch_default("start", "end", "cancel", "interrupt");
18475 var emptyTween = [];
18483 function schedule_default(node, name, id2, index, group, timing) {
18484 var schedules = node.__transition;
18485 if (!schedules) node.__transition = {};
18486 else if (id2 in schedules) return;
18487 create(node, id2, {
18490 // For context during callback.
18492 // For context during callback.
18496 delay: timing.delay,
18497 duration: timing.duration,
18503 function init(node, id2) {
18504 var schedule = get2(node, id2);
18505 if (schedule.state > CREATED) throw new Error("too late; already scheduled");
18508 function set2(node, id2) {
18509 var schedule = get2(node, id2);
18510 if (schedule.state > STARTED) throw new Error("too late; already running");
18513 function get2(node, id2) {
18514 var schedule = node.__transition;
18515 if (!schedule || !(schedule = schedule[id2])) throw new Error("transition not found");
18518 function create(node, id2, self2) {
18519 var schedules = node.__transition, tween;
18520 schedules[id2] = self2;
18521 self2.timer = timer(schedule, 0, self2.time);
18522 function schedule(elapsed) {
18523 self2.state = SCHEDULED;
18524 self2.timer.restart(start2, self2.delay, self2.time);
18525 if (self2.delay <= elapsed) start2(elapsed - self2.delay);
18527 function start2(elapsed) {
18528 var i3, j2, n3, o2;
18529 if (self2.state !== SCHEDULED) return stop();
18530 for (i3 in schedules) {
18531 o2 = schedules[i3];
18532 if (o2.name !== self2.name) continue;
18533 if (o2.state === STARTED) return timeout_default(start2);
18534 if (o2.state === RUNNING) {
18537 o2.on.call("interrupt", node, node.__data__, o2.index, o2.group);
18538 delete schedules[i3];
18539 } else if (+i3 < id2) {
18542 o2.on.call("cancel", node, node.__data__, o2.index, o2.group);
18543 delete schedules[i3];
18546 timeout_default(function() {
18547 if (self2.state === STARTED) {
18548 self2.state = RUNNING;
18549 self2.timer.restart(tick, self2.delay, self2.time);
18553 self2.state = STARTING;
18554 self2.on.call("start", node, node.__data__, self2.index, self2.group);
18555 if (self2.state !== STARTING) return;
18556 self2.state = STARTED;
18557 tween = new Array(n3 = self2.tween.length);
18558 for (i3 = 0, j2 = -1; i3 < n3; ++i3) {
18559 if (o2 = self2.tween[i3].value.call(node, node.__data__, self2.index, self2.group)) {
18563 tween.length = j2 + 1;
18565 function tick(elapsed) {
18566 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;
18567 while (++i3 < n3) {
18568 tween[i3].call(node, t2);
18570 if (self2.state === ENDING) {
18571 self2.on.call("end", node, node.__data__, self2.index, self2.group);
18576 self2.state = ENDED;
18577 self2.timer.stop();
18578 delete schedules[id2];
18579 for (var i3 in schedules) return;
18580 delete node.__transition;
18584 // node_modules/d3-transition/src/interrupt.js
18585 function interrupt_default(node, name) {
18586 var schedules = node.__transition, schedule, active, empty2 = true, i3;
18587 if (!schedules) return;
18588 name = name == null ? null : name + "";
18589 for (i3 in schedules) {
18590 if ((schedule = schedules[i3]).name !== name) {
18594 active = schedule.state > STARTING && schedule.state < ENDING;
18595 schedule.state = ENDED;
18596 schedule.timer.stop();
18597 schedule.on.call(active ? "interrupt" : "cancel", node, node.__data__, schedule.index, schedule.group);
18598 delete schedules[i3];
18600 if (empty2) delete node.__transition;
18603 // node_modules/d3-transition/src/selection/interrupt.js
18604 function interrupt_default2(name) {
18605 return this.each(function() {
18606 interrupt_default(this, name);
18610 // node_modules/d3-transition/src/transition/tween.js
18611 function tweenRemove(id2, name) {
18612 var tween0, tween1;
18613 return function() {
18614 var schedule = set2(this, id2), tween = schedule.tween;
18615 if (tween !== tween0) {
18616 tween1 = tween0 = tween;
18617 for (var i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
18618 if (tween1[i3].name === name) {
18619 tween1 = tween1.slice();
18620 tween1.splice(i3, 1);
18625 schedule.tween = tween1;
18628 function tweenFunction(id2, name, value) {
18629 var tween0, tween1;
18630 if (typeof value !== "function") throw new Error();
18631 return function() {
18632 var schedule = set2(this, id2), tween = schedule.tween;
18633 if (tween !== tween0) {
18634 tween1 = (tween0 = tween).slice();
18635 for (var t2 = { name, value }, i3 = 0, n3 = tween1.length; i3 < n3; ++i3) {
18636 if (tween1[i3].name === name) {
18641 if (i3 === n3) tween1.push(t2);
18643 schedule.tween = tween1;
18646 function tween_default(name, value) {
18647 var id2 = this._id;
18649 if (arguments.length < 2) {
18650 var tween = get2(this.node(), id2).tween;
18651 for (var i3 = 0, n3 = tween.length, t2; i3 < n3; ++i3) {
18652 if ((t2 = tween[i3]).name === name) {
18658 return this.each((value == null ? tweenRemove : tweenFunction)(id2, name, value));
18660 function tweenValue(transition2, name, value) {
18661 var id2 = transition2._id;
18662 transition2.each(function() {
18663 var schedule = set2(this, id2);
18664 (schedule.value || (schedule.value = {}))[name] = value.apply(this, arguments);
18666 return function(node) {
18667 return get2(node, id2).value[name];
18671 // node_modules/d3-transition/src/transition/interpolate.js
18672 function interpolate_default(a2, b2) {
18674 return (typeof b2 === "number" ? number_default : b2 instanceof color ? rgb_default : (c2 = color(b2)) ? (b2 = c2, rgb_default) : string_default)(a2, b2);
18677 // node_modules/d3-transition/src/transition/attr.js
18678 function attrRemove2(name) {
18679 return function() {
18680 this.removeAttribute(name);
18683 function attrRemoveNS2(fullname) {
18684 return function() {
18685 this.removeAttributeNS(fullname.space, fullname.local);
18688 function attrConstant2(name, interpolate, value1) {
18689 var string00, string1 = value1 + "", interpolate0;
18690 return function() {
18691 var string0 = this.getAttribute(name);
18692 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18695 function attrConstantNS2(fullname, interpolate, value1) {
18696 var string00, string1 = value1 + "", interpolate0;
18697 return function() {
18698 var string0 = this.getAttributeNS(fullname.space, fullname.local);
18699 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18702 function attrFunction2(name, interpolate, value) {
18703 var string00, string10, interpolate0;
18704 return function() {
18705 var string0, value1 = value(this), string1;
18706 if (value1 == null) return void this.removeAttribute(name);
18707 string0 = this.getAttribute(name);
18708 string1 = value1 + "";
18709 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18712 function attrFunctionNS2(fullname, interpolate, value) {
18713 var string00, string10, interpolate0;
18714 return function() {
18715 var string0, value1 = value(this), string1;
18716 if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local);
18717 string0 = this.getAttributeNS(fullname.space, fullname.local);
18718 string1 = value1 + "";
18719 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18722 function attr_default2(name, value) {
18723 var fullname = namespace_default(name), i3 = fullname === "transform" ? interpolateTransformSvg : interpolate_default;
18724 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));
18727 // node_modules/d3-transition/src/transition/attrTween.js
18728 function attrInterpolate(name, i3) {
18729 return function(t2) {
18730 this.setAttribute(name, i3.call(this, t2));
18733 function attrInterpolateNS(fullname, i3) {
18734 return function(t2) {
18735 this.setAttributeNS(fullname.space, fullname.local, i3.call(this, t2));
18738 function attrTweenNS(fullname, value) {
18741 var i3 = value.apply(this, arguments);
18742 if (i3 !== i0) t0 = (i0 = i3) && attrInterpolateNS(fullname, i3);
18745 tween._value = value;
18748 function attrTween(name, value) {
18751 var i3 = value.apply(this, arguments);
18752 if (i3 !== i0) t0 = (i0 = i3) && attrInterpolate(name, i3);
18755 tween._value = value;
18758 function attrTween_default(name, value) {
18759 var key = "attr." + name;
18760 if (arguments.length < 2) return (key = this.tween(key)) && key._value;
18761 if (value == null) return this.tween(key, null);
18762 if (typeof value !== "function") throw new Error();
18763 var fullname = namespace_default(name);
18764 return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value));
18767 // node_modules/d3-transition/src/transition/delay.js
18768 function delayFunction(id2, value) {
18769 return function() {
18770 init(this, id2).delay = +value.apply(this, arguments);
18773 function delayConstant(id2, value) {
18774 return value = +value, function() {
18775 init(this, id2).delay = value;
18778 function delay_default(value) {
18779 var id2 = this._id;
18780 return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get2(this.node(), id2).delay;
18783 // node_modules/d3-transition/src/transition/duration.js
18784 function durationFunction(id2, value) {
18785 return function() {
18786 set2(this, id2).duration = +value.apply(this, arguments);
18789 function durationConstant(id2, value) {
18790 return value = +value, function() {
18791 set2(this, id2).duration = value;
18794 function duration_default(value) {
18795 var id2 = this._id;
18796 return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get2(this.node(), id2).duration;
18799 // node_modules/d3-transition/src/transition/ease.js
18800 function easeConstant(id2, value) {
18801 if (typeof value !== "function") throw new Error();
18802 return function() {
18803 set2(this, id2).ease = value;
18806 function ease_default(value) {
18807 var id2 = this._id;
18808 return arguments.length ? this.each(easeConstant(id2, value)) : get2(this.node(), id2).ease;
18811 // node_modules/d3-transition/src/transition/easeVarying.js
18812 function easeVarying(id2, value) {
18813 return function() {
18814 var v2 = value.apply(this, arguments);
18815 if (typeof v2 !== "function") throw new Error();
18816 set2(this, id2).ease = v2;
18819 function easeVarying_default(value) {
18820 if (typeof value !== "function") throw new Error();
18821 return this.each(easeVarying(this._id, value));
18824 // node_modules/d3-transition/src/transition/filter.js
18825 function filter_default2(match) {
18826 if (typeof match !== "function") match = matcher_default(match);
18827 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18828 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = [], node, i3 = 0; i3 < n3; ++i3) {
18829 if ((node = group[i3]) && match.call(node, node.__data__, i3, group)) {
18830 subgroup.push(node);
18834 return new Transition(subgroups, this._parents, this._name, this._id);
18837 // node_modules/d3-transition/src/transition/merge.js
18838 function merge_default2(transition2) {
18839 if (transition2._id !== this._id) throw new Error();
18840 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) {
18841 for (var group0 = groups0[j2], group1 = groups1[j2], n3 = group0.length, merge2 = merges[j2] = new Array(n3), node, i3 = 0; i3 < n3; ++i3) {
18842 if (node = group0[i3] || group1[i3]) {
18847 for (; j2 < m0; ++j2) {
18848 merges[j2] = groups0[j2];
18850 return new Transition(merges, this._parents, this._name, this._id);
18853 // node_modules/d3-transition/src/transition/on.js
18854 function start(name) {
18855 return (name + "").trim().split(/^|\s+/).every(function(t2) {
18856 var i3 = t2.indexOf(".");
18857 if (i3 >= 0) t2 = t2.slice(0, i3);
18858 return !t2 || t2 === "start";
18861 function onFunction(id2, name, listener) {
18862 var on0, on1, sit = start(name) ? init : set2;
18863 return function() {
18864 var schedule = sit(this, id2), on = schedule.on;
18865 if (on !== on0) (on1 = (on0 = on).copy()).on(name, listener);
18869 function on_default2(name, listener) {
18870 var id2 = this._id;
18871 return arguments.length < 2 ? get2(this.node(), id2).on.on(name) : this.each(onFunction(id2, name, listener));
18874 // node_modules/d3-transition/src/transition/remove.js
18875 function removeFunction(id2) {
18876 return function() {
18877 var parent = this.parentNode;
18878 for (var i3 in this.__transition) if (+i3 !== id2) return;
18879 if (parent) parent.removeChild(this);
18882 function remove_default2() {
18883 return this.on("end.remove", removeFunction(this._id));
18886 // node_modules/d3-transition/src/transition/select.js
18887 function select_default3(select) {
18888 var name = this._name, id2 = this._id;
18889 if (typeof select !== "function") select = selector_default(select);
18890 for (var groups = this._groups, m2 = groups.length, subgroups = new Array(m2), j2 = 0; j2 < m2; ++j2) {
18891 for (var group = groups[j2], n3 = group.length, subgroup = subgroups[j2] = new Array(n3), node, subnode, i3 = 0; i3 < n3; ++i3) {
18892 if ((node = group[i3]) && (subnode = select.call(node, node.__data__, i3, group))) {
18893 if ("__data__" in node) subnode.__data__ = node.__data__;
18894 subgroup[i3] = subnode;
18895 schedule_default(subgroup[i3], name, id2, i3, subgroup, get2(node, id2));
18899 return new Transition(subgroups, this._parents, name, id2);
18902 // node_modules/d3-transition/src/transition/selectAll.js
18903 function selectAll_default3(select) {
18904 var name = this._name, id2 = this._id;
18905 if (typeof select !== "function") select = selectorAll_default(select);
18906 for (var groups = this._groups, m2 = groups.length, subgroups = [], parents = [], j2 = 0; j2 < m2; ++j2) {
18907 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
18908 if (node = group[i3]) {
18909 for (var children2 = select.call(node, node.__data__, i3, group), child, inherit2 = get2(node, id2), k2 = 0, l2 = children2.length; k2 < l2; ++k2) {
18910 if (child = children2[k2]) {
18911 schedule_default(child, name, id2, k2, children2, inherit2);
18914 subgroups.push(children2);
18915 parents.push(node);
18919 return new Transition(subgroups, parents, name, id2);
18922 // node_modules/d3-transition/src/transition/selection.js
18923 var Selection2 = selection_default.prototype.constructor;
18924 function selection_default2() {
18925 return new Selection2(this._groups, this._parents);
18928 // node_modules/d3-transition/src/transition/style.js
18929 function styleNull(name, interpolate) {
18930 var string00, string10, interpolate0;
18931 return function() {
18932 var string0 = styleValue(this, name), string1 = (this.style.removeProperty(name), styleValue(this, name));
18933 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate(string00 = string0, string10 = string1);
18936 function styleRemove2(name) {
18937 return function() {
18938 this.style.removeProperty(name);
18941 function styleConstant2(name, interpolate, value1) {
18942 var string00, string1 = value1 + "", interpolate0;
18943 return function() {
18944 var string0 = styleValue(this, name);
18945 return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate(string00 = string0, value1);
18948 function styleFunction2(name, interpolate, value) {
18949 var string00, string10, interpolate0;
18950 return function() {
18951 var string0 = styleValue(this, name), value1 = value(this), string1 = value1 + "";
18952 if (value1 == null) string1 = value1 = (this.style.removeProperty(name), styleValue(this, name));
18953 return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate(string00 = string0, value1));
18956 function styleMaybeRemove(id2, name) {
18957 var on0, on1, listener0, key = "style." + name, event = "end." + key, remove2;
18958 return function() {
18959 var schedule = set2(this, id2), on = schedule.on, listener = schedule.value[key] == null ? remove2 || (remove2 = styleRemove2(name)) : void 0;
18960 if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener);
18964 function style_default2(name, value, priority) {
18965 var i3 = (name += "") === "transform" ? interpolateTransformCss : interpolate_default;
18966 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);
18969 // node_modules/d3-transition/src/transition/styleTween.js
18970 function styleInterpolate(name, i3, priority) {
18971 return function(t2) {
18972 this.style.setProperty(name, i3.call(this, t2), priority);
18975 function styleTween(name, value, priority) {
18978 var i3 = value.apply(this, arguments);
18979 if (i3 !== i0) t2 = (i0 = i3) && styleInterpolate(name, i3, priority);
18982 tween._value = value;
18985 function styleTween_default(name, value, priority) {
18986 var key = "style." + (name += "");
18987 if (arguments.length < 2) return (key = this.tween(key)) && key._value;
18988 if (value == null) return this.tween(key, null);
18989 if (typeof value !== "function") throw new Error();
18990 return this.tween(key, styleTween(name, value, priority == null ? "" : priority));
18993 // node_modules/d3-transition/src/transition/text.js
18994 function textConstant2(value) {
18995 return function() {
18996 this.textContent = value;
18999 function textFunction2(value) {
19000 return function() {
19001 var value1 = value(this);
19002 this.textContent = value1 == null ? "" : value1;
19005 function text_default2(value) {
19006 return this.tween("text", typeof value === "function" ? textFunction2(tweenValue(this, "text", value)) : textConstant2(value == null ? "" : value + ""));
19009 // node_modules/d3-transition/src/transition/textTween.js
19010 function textInterpolate(i3) {
19011 return function(t2) {
19012 this.textContent = i3.call(this, t2);
19015 function textTween(value) {
19018 var i3 = value.apply(this, arguments);
19019 if (i3 !== i0) t0 = (i0 = i3) && textInterpolate(i3);
19022 tween._value = value;
19025 function textTween_default(value) {
19027 if (arguments.length < 1) return (key = this.tween(key)) && key._value;
19028 if (value == null) return this.tween(key, null);
19029 if (typeof value !== "function") throw new Error();
19030 return this.tween(key, textTween(value));
19033 // node_modules/d3-transition/src/transition/transition.js
19034 function transition_default() {
19035 var name = this._name, id0 = this._id, id1 = newId();
19036 for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
19037 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19038 if (node = group[i3]) {
19039 var inherit2 = get2(node, id0);
19040 schedule_default(node, name, id1, i3, group, {
19041 time: inherit2.time + inherit2.delay + inherit2.duration,
19043 duration: inherit2.duration,
19044 ease: inherit2.ease
19049 return new Transition(groups, this._parents, name, id1);
19052 // node_modules/d3-transition/src/transition/end.js
19053 function end_default() {
19054 var on0, on1, that = this, id2 = that._id, size = that.size();
19055 return new Promise(function(resolve, reject) {
19056 var cancel = { value: reject }, end = { value: function() {
19057 if (--size === 0) resolve();
19059 that.each(function() {
19060 var schedule = set2(this, id2), on = schedule.on;
19062 on1 = (on0 = on).copy();
19063 on1._.cancel.push(cancel);
19064 on1._.interrupt.push(cancel);
19065 on1._.end.push(end);
19069 if (size === 0) resolve();
19073 // node_modules/d3-transition/src/transition/index.js
19075 function Transition(groups, parents, name, id2) {
19076 this._groups = groups;
19077 this._parents = parents;
19081 function transition(name) {
19082 return selection_default().transition(name);
19087 var selection_prototype = selection_default.prototype;
19088 Transition.prototype = transition.prototype = {
19089 constructor: Transition,
19090 select: select_default3,
19091 selectAll: selectAll_default3,
19092 selectChild: selection_prototype.selectChild,
19093 selectChildren: selection_prototype.selectChildren,
19094 filter: filter_default2,
19095 merge: merge_default2,
19096 selection: selection_default2,
19097 transition: transition_default,
19098 call: selection_prototype.call,
19099 nodes: selection_prototype.nodes,
19100 node: selection_prototype.node,
19101 size: selection_prototype.size,
19102 empty: selection_prototype.empty,
19103 each: selection_prototype.each,
19105 attr: attr_default2,
19106 attrTween: attrTween_default,
19107 style: style_default2,
19108 styleTween: styleTween_default,
19109 text: text_default2,
19110 textTween: textTween_default,
19111 remove: remove_default2,
19112 tween: tween_default,
19113 delay: delay_default,
19114 duration: duration_default,
19115 ease: ease_default,
19116 easeVarying: easeVarying_default,
19118 [Symbol.iterator]: selection_prototype[Symbol.iterator]
19121 // node_modules/d3-ease/src/linear.js
19122 var linear2 = (t2) => +t2;
19124 // node_modules/d3-ease/src/cubic.js
19125 function cubicInOut(t2) {
19126 return ((t2 *= 2) <= 1 ? t2 * t2 * t2 : (t2 -= 2) * t2 * t2 + 2) / 2;
19129 // node_modules/d3-transition/src/selection/transition.js
19130 var defaultTiming = {
19137 function inherit(node, id2) {
19139 while (!(timing = node.__transition) || !(timing = timing[id2])) {
19140 if (!(node = node.parentNode)) {
19141 throw new Error("transition ".concat(id2, " not found"));
19146 function transition_default2(name) {
19148 if (name instanceof Transition) {
19149 id2 = name._id, name = name._name;
19151 id2 = newId(), (timing = defaultTiming).time = now(), name = name == null ? null : name + "";
19153 for (var groups = this._groups, m2 = groups.length, j2 = 0; j2 < m2; ++j2) {
19154 for (var group = groups[j2], n3 = group.length, node, i3 = 0; i3 < n3; ++i3) {
19155 if (node = group[i3]) {
19156 schedule_default(node, name, id2, i3, group, timing || inherit(node, id2));
19160 return new Transition(groups, this._parents, name, id2);
19163 // node_modules/d3-transition/src/selection/index.js
19164 selection_default.prototype.interrupt = interrupt_default2;
19165 selection_default.prototype.transition = transition_default2;
19167 // node_modules/d3-zoom/src/constant.js
19168 var constant_default4 = (x2) => () => x2;
19170 // node_modules/d3-zoom/src/event.js
19171 function ZoomEvent(type2, {
19174 transform: transform2,
19175 dispatch: dispatch14
19177 Object.defineProperties(this, {
19178 type: { value: type2, enumerable: true, configurable: true },
19179 sourceEvent: { value: sourceEvent, enumerable: true, configurable: true },
19180 target: { value: target, enumerable: true, configurable: true },
19181 transform: { value: transform2, enumerable: true, configurable: true },
19182 _: { value: dispatch14 }
19186 // node_modules/d3-zoom/src/transform.js
19187 function Transform(k2, x2, y2) {
19192 Transform.prototype = {
19193 constructor: Transform,
19194 scale: function(k2) {
19195 return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y);
19197 translate: function(x2, y2) {
19198 return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2);
19200 apply: function(point) {
19201 return [point[0] * this.k + this.x, point[1] * this.k + this.y];
19203 applyX: function(x2) {
19204 return x2 * this.k + this.x;
19206 applyY: function(y2) {
19207 return y2 * this.k + this.y;
19209 invert: function(location) {
19210 return [(location[0] - this.x) / this.k, (location[1] - this.y) / this.k];
19212 invertX: function(x2) {
19213 return (x2 - this.x) / this.k;
19215 invertY: function(y2) {
19216 return (y2 - this.y) / this.k;
19218 rescaleX: function(x2) {
19219 return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2));
19221 rescaleY: function(y2) {
19222 return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2));
19224 toString: function() {
19225 return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
19228 var identity2 = new Transform(1, 0, 0);
19229 transform.prototype = Transform.prototype;
19230 function transform(node) {
19231 while (!node.__zoom) if (!(node = node.parentNode)) return identity2;
19232 return node.__zoom;
19235 // node_modules/d3-zoom/src/noevent.js
19236 function nopropagation2(event) {
19237 event.stopImmediatePropagation();
19239 function noevent_default2(event) {
19240 event.preventDefault();
19241 event.stopImmediatePropagation();
19244 // node_modules/d3-zoom/src/zoom.js
19245 function defaultFilter2(event) {
19246 return (!event.ctrlKey || event.type === "wheel") && !event.button;
19248 function defaultExtent() {
19250 if (e3 instanceof SVGElement) {
19251 e3 = e3.ownerSVGElement || e3;
19252 if (e3.hasAttribute("viewBox")) {
19253 e3 = e3.viewBox.baseVal;
19254 return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
19256 return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
19258 return [[0, 0], [e3.clientWidth, e3.clientHeight]];
19260 function defaultTransform() {
19261 return this.__zoom || identity2;
19263 function defaultWheelDelta(event) {
19264 return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1);
19266 function defaultTouchable2() {
19267 return navigator.maxTouchPoints || "ontouchstart" in this;
19269 function defaultConstrain(transform2, extent, translateExtent) {
19270 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];
19271 return transform2.translate(
19272 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
19273 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
19276 function zoom_default2() {
19277 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;
19278 function zoom(selection2) {
19279 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)");
19281 zoom.transform = function(collection, transform2, point, event) {
19282 var selection2 = collection.selection ? collection.selection() : collection;
19283 selection2.property("__zoom", defaultTransform);
19284 if (collection !== selection2) {
19285 schedule(collection, transform2, point, event);
19287 selection2.interrupt().each(function() {
19288 gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end();
19292 zoom.scaleBy = function(selection2, k2, p2, event) {
19293 zoom.scaleTo(selection2, function() {
19294 var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
19298 zoom.scaleTo = function(selection2, k2, p2, event) {
19299 zoom.transform(selection2, function() {
19300 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;
19301 return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
19304 zoom.translateBy = function(selection2, x2, y2, event) {
19305 zoom.transform(selection2, function() {
19306 return constrain(this.__zoom.translate(
19307 typeof x2 === "function" ? x2.apply(this, arguments) : x2,
19308 typeof y2 === "function" ? y2.apply(this, arguments) : y2
19309 ), extent.apply(this, arguments), translateExtent);
19312 zoom.translateTo = function(selection2, x2, y2, p2, event) {
19313 zoom.transform(selection2, function() {
19314 var e3 = extent.apply(this, arguments), t2 = this.__zoom, p02 = p2 == null ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
19315 return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
19316 typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
19317 typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
19318 ), e3, translateExtent);
19321 function scale(transform2, k2) {
19322 k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
19323 return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
19325 function translate(transform2, p02, p1) {
19326 var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
19327 return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
19329 function centroid(extent2) {
19330 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
19332 function schedule(transition2, transform2, point, event) {
19333 transition2.on("start.zoom", function() {
19334 gesture(this, arguments).event(event).start();
19335 }).on("interrupt.zoom end.zoom", function() {
19336 gesture(this, arguments).event(event).end();
19337 }).tween("zoom", function() {
19338 var that = this, args = arguments, g3 = gesture(that, args).event(event), e3 = extent.apply(that, args), p2 = point == null ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, 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));
19339 return function(t2) {
19340 if (t2 === 1) t2 = b2;
19342 var l2 = i3(t2), k2 = w2 / l2[2];
19343 t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
19349 function gesture(that, args, clean2) {
19350 return !clean2 && that.__zooming || new Gesture(that, args);
19352 function Gesture(that, args) {
19356 this.sourceEvent = null;
19357 this.extent = extent.apply(that, args);
19360 Gesture.prototype = {
19361 event: function(event) {
19362 if (event) this.sourceEvent = event;
19365 start: function() {
19366 if (++this.active === 1) {
19367 this.that.__zooming = this;
19368 this.emit("start");
19372 zoom: function(key, transform2) {
19373 if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
19374 if (this.touch0 && key !== "touch") this.touch0[1] = transform2.invert(this.touch0[0]);
19375 if (this.touch1 && key !== "touch") this.touch1[1] = transform2.invert(this.touch1[0]);
19376 this.that.__zoom = transform2;
19381 if (--this.active === 0) {
19382 delete this.that.__zooming;
19387 emit: function(type2) {
19388 var d2 = select_default2(this.that).datum();
19392 new ZoomEvent(type2, {
19393 sourceEvent: this.sourceEvent,
19396 transform: this.that.__zoom,
19397 dispatch: listeners
19403 function wheeled(event, ...args) {
19404 if (!filter2.apply(this, arguments)) return;
19405 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);
19407 if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
19408 g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
19410 clearTimeout(g3.wheel);
19411 } else if (t2.k === k2) return;
19413 g3.mouse = [p2, t2.invert(p2)];
19414 interrupt_default(this);
19417 noevent_default2(event);
19418 g3.wheel = setTimeout(wheelidled, wheelDelay);
19419 g3.zoom("mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
19420 function wheelidled() {
19425 function mousedowned(event, ...args) {
19426 if (touchending || !filter2.apply(this, arguments)) return;
19427 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;
19428 nodrag_default(event.view);
19429 nopropagation2(event);
19430 g3.mouse = [p2, this.__zoom.invert(p2)];
19431 interrupt_default(this);
19433 function mousemoved(event2) {
19434 noevent_default2(event2);
19436 var dx = event2.clientX - x05, dy = event2.clientY - y05;
19437 g3.moved = dx * dx + dy * dy > clickDistance2;
19439 g3.event(event2).zoom("mouse", constrain(translate(g3.that.__zoom, g3.mouse[0] = pointer_default(event2, currentTarget), g3.mouse[1]), g3.extent, translateExtent));
19441 function mouseupped(event2) {
19442 v2.on("mousemove.zoom mouseup.zoom", null);
19443 yesdrag(event2.view, g3.moved);
19444 noevent_default2(event2);
19445 g3.event(event2).end();
19448 function dblclicked(event, ...args) {
19449 if (!filter2.apply(this, arguments)) return;
19450 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);
19451 noevent_default2(event);
19452 if (duration > 0) select_default2(this).transition().duration(duration).call(schedule, t1, p02, event);
19453 else select_default2(this).call(zoom.transform, t1, p02, event);
19455 function touchstarted(event, ...args) {
19456 if (!filter2.apply(this, arguments)) return;
19457 var touches = event.touches, n3 = touches.length, g3 = gesture(this, args, event.changedTouches.length === n3).event(event), started, i3, t2, p2;
19458 nopropagation2(event);
19459 for (i3 = 0; i3 < n3; ++i3) {
19460 t2 = touches[i3], p2 = pointer_default(t2, this);
19461 p2 = [p2, this.__zoom.invert(p2), t2.identifier];
19462 if (!g3.touch0) g3.touch0 = p2, started = true, g3.taps = 1 + !!touchstarting;
19463 else if (!g3.touch1 && g3.touch0[2] !== p2[2]) g3.touch1 = p2, g3.taps = 0;
19465 if (touchstarting) touchstarting = clearTimeout(touchstarting);
19467 if (g3.taps < 2) touchfirst = p2[0], touchstarting = setTimeout(function() {
19468 touchstarting = null;
19470 interrupt_default(this);
19474 function touchmoved(event, ...args) {
19475 if (!this.__zooming) return;
19476 var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2, p2, l2;
19477 noevent_default2(event);
19478 for (i3 = 0; i3 < n3; ++i3) {
19479 t2 = touches[i3], p2 = pointer_default(t2, this);
19480 if (g3.touch0 && g3.touch0[2] === t2.identifier) g3.touch0[0] = p2;
19481 else if (g3.touch1 && g3.touch1[2] === t2.identifier) g3.touch1[0] = p2;
19483 t2 = g3.that.__zoom;
19485 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;
19486 t2 = scale(t2, Math.sqrt(dp / dl));
19487 p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
19488 l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
19489 } else if (g3.touch0) p2 = g3.touch0[0], l2 = g3.touch0[1];
19491 g3.zoom("touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
19493 function touchended(event, ...args) {
19494 if (!this.__zooming) return;
19495 var g3 = gesture(this, args).event(event), touches = event.changedTouches, n3 = touches.length, i3, t2;
19496 nopropagation2(event);
19497 if (touchending) clearTimeout(touchending);
19498 touchending = setTimeout(function() {
19499 touchending = null;
19501 for (i3 = 0; i3 < n3; ++i3) {
19503 if (g3.touch0 && g3.touch0[2] === t2.identifier) delete g3.touch0;
19504 else if (g3.touch1 && g3.touch1[2] === t2.identifier) delete g3.touch1;
19506 if (g3.touch1 && !g3.touch0) g3.touch0 = g3.touch1, delete g3.touch1;
19507 if (g3.touch0) g3.touch0[1] = this.__zoom.invert(g3.touch0[0]);
19510 if (g3.taps === 2) {
19511 t2 = pointer_default(t2, this);
19512 if (Math.hypot(touchfirst[0] - t2[0], touchfirst[1] - t2[1]) < tapDistance) {
19513 var p2 = select_default2(this).on("dblclick.zoom");
19514 if (p2) p2.apply(this, arguments);
19519 zoom.wheelDelta = function(_2) {
19520 return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant_default4(+_2), zoom) : wheelDelta;
19522 zoom.filter = function(_2) {
19523 return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : filter2;
19525 zoom.touchable = function(_2) {
19526 return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant_default4(!!_2), zoom) : touchable;
19528 zoom.extent = function(_2) {
19529 return arguments.length ? (extent = typeof _2 === "function" ? _2 : constant_default4([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
19531 zoom.scaleExtent = function(_2) {
19532 return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
19534 zoom.translateExtent = function(_2) {
19535 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]]];
19537 zoom.constrain = function(_2) {
19538 return arguments.length ? (constrain = _2, zoom) : constrain;
19540 zoom.duration = function(_2) {
19541 return arguments.length ? (duration = +_2, zoom) : duration;
19543 zoom.interpolate = function(_2) {
19544 return arguments.length ? (interpolate = _2, zoom) : interpolate;
19546 zoom.on = function() {
19547 var value = listeners.on.apply(listeners, arguments);
19548 return value === listeners ? zoom : value;
19550 zoom.clickDistance = function(_2) {
19551 return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom) : Math.sqrt(clickDistance2);
19553 zoom.tapDistance = function(_2) {
19554 return arguments.length ? (tapDistance = +_2, zoom) : tapDistance;
19559 // modules/geo/raw_mercator.js
19560 function geoRawMercator() {
19561 var project = mercatorRaw;
19562 var k2 = 512 / Math.PI;
19565 var clipExtent = [[0, 0], [0, 0]];
19566 function projection2(point) {
19567 point = project(point[0] * Math.PI / 180, point[1] * Math.PI / 180);
19568 return [point[0] * k2 + x2, y2 - point[1] * k2];
19570 projection2.invert = function(point) {
19571 point = project.invert((point[0] - x2) / k2, (y2 - point[1]) / k2);
19572 return point && [point[0] * 180 / Math.PI, point[1] * 180 / Math.PI];
19574 projection2.scale = function(_2) {
19575 if (!arguments.length) return k2;
19577 return projection2;
19579 projection2.translate = function(_2) {
19580 if (!arguments.length) return [x2, y2];
19583 return projection2;
19585 projection2.clipExtent = function(_2) {
19586 if (!arguments.length) return clipExtent;
19588 return projection2;
19590 projection2.transform = function(obj) {
19591 if (!arguments.length) return identity2.translate(x2, y2).scale(k2);
19595 return projection2;
19597 projection2.stream = transform_default({
19598 point: function(x3, y3) {
19599 var vec = projection2([x3, y3]);
19600 this.stream.point(vec[0], vec[1]);
19603 return projection2;
19606 // modules/geo/ortho.js
19607 function geoOrthoNormalizedDotProduct(a2, b2, origin) {
19608 if (geoVecEqual(origin, a2) || geoVecEqual(origin, b2)) {
19611 return geoVecNormalizedDot(a2, b2, origin);
19613 function geoOrthoFilterDotProduct(dotp, epsilon3, lowerThreshold, upperThreshold, allowStraightAngles) {
19614 var val = Math.abs(dotp);
19615 if (val < epsilon3) {
19617 } else if (allowStraightAngles && Math.abs(val - 1) < epsilon3) {
19619 } else if (val < lowerThreshold || val > upperThreshold) {
19625 function geoOrthoCalcScore(points, isClosed, epsilon3, threshold) {
19627 var first = isClosed ? 0 : 1;
19628 var last = isClosed ? points.length : points.length - 1;
19629 var coords = points.map(function(p2) {
19632 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
19633 var upperThreshold = Math.cos(threshold * Math.PI / 180);
19634 for (var i3 = first; i3 < last; i3++) {
19635 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19636 var origin = coords[i3];
19637 var b2 = coords[(i3 + 1) % coords.length];
19638 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold);
19639 if (dotp === null) continue;
19640 score = score + 2 * Math.min(Math.abs(dotp - 1), Math.min(Math.abs(dotp), Math.abs(dotp + 1)));
19644 function geoOrthoMaxOffsetAngle(coords, isClosed, lessThan) {
19645 var max3 = -Infinity;
19646 var first = isClosed ? 0 : 1;
19647 var last = isClosed ? coords.length : coords.length - 1;
19648 for (var i3 = first; i3 < last; i3++) {
19649 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19650 var origin = coords[i3];
19651 var b2 = coords[(i3 + 1) % coords.length];
19652 var normalizedDotP = geoOrthoNormalizedDotProduct(a2, b2, origin);
19653 var angle2 = Math.acos(Math.abs(normalizedDotP)) * 180 / Math.PI;
19654 if (angle2 > 45) angle2 = 90 - angle2;
19655 if (angle2 >= lessThan) continue;
19656 if (angle2 > max3) max3 = angle2;
19658 if (max3 === -Infinity) return null;
19661 function geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles) {
19663 var first = isClosed ? 0 : 1;
19664 var last = isClosed ? coords.length : coords.length - 1;
19665 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
19666 var upperThreshold = Math.cos(threshold * Math.PI / 180);
19667 for (var i3 = first; i3 < last; i3++) {
19668 var a2 = coords[(i3 - 1 + coords.length) % coords.length];
19669 var origin = coords[i3];
19670 var b2 = coords[(i3 + 1) % coords.length];
19671 var dotp = geoOrthoFilterDotProduct(geoOrthoNormalizedDotProduct(a2, b2, origin), epsilon3, lowerThreshold, upperThreshold, allowStraightAngles);
19672 if (dotp === null) continue;
19673 if (Math.abs(dotp) > 0) return 1;
19679 // modules/osm/tags.js
19680 function osmIsInterestingTag(key) {
19681 return key !== "attribution" && key !== "created_by" && key !== "source" && key !== "odbl" && key.indexOf("source:") !== 0 && key.indexOf("source_ref") !== 0 && // purposely exclude colon
19682 key.indexOf("tiger:") !== 0;
19684 var osmLifecyclePrefixes = {
19685 // nonexistent, might be built
19688 // under maintenance or between groundbreaking and opening
19689 construction: true,
19690 // existent but not functional
19692 // dilapidated to nonexistent
19695 // nonexistent, still may appear in imagery
19702 // existent occasionally, e.g. stormwater drainage basin
19705 function osmRemoveLifecyclePrefix(key) {
19706 const keySegments = key.split(":");
19707 if (keySegments.length === 1) return key;
19708 if (keySegments[0] in osmLifecyclePrefixes) {
19709 return key.slice(keySegments[0].length + 1);
19713 var osmAreaKeys = {};
19714 function osmSetAreaKeys(value) {
19715 osmAreaKeys = value;
19717 var osmAreaKeysExceptions = {
19723 public_transport: {
19733 ventilation_shaft: true
19739 bicycle_parking: true
19742 function osmTagSuggestingArea(tags) {
19743 if (tags.area === "yes") return { area: "yes" };
19744 if (tags.area === "no") return null;
19745 var returnTags = {};
19746 for (var realKey in tags) {
19747 const key = osmRemoveLifecyclePrefix(realKey);
19748 if (key in osmAreaKeys && !(tags[realKey] in osmAreaKeys[key])) {
19749 returnTags[realKey] = tags[realKey];
19752 if (key in osmAreaKeysExceptions && tags[realKey] in osmAreaKeysExceptions[key]) {
19753 returnTags[realKey] = tags[realKey];
19759 var osmLineTags = {};
19760 function osmSetLineTags(value) {
19761 osmLineTags = value;
19763 var osmPointTags = {};
19764 function osmSetPointTags(value) {
19765 osmPointTags = value;
19767 var osmVertexTags = {};
19768 function osmSetVertexTags(value) {
19769 osmVertexTags = value;
19771 function osmNodeGeometriesForTags(nodeTags) {
19772 var geometries = {};
19773 for (var key in nodeTags) {
19774 if (osmPointTags[key] && (osmPointTags[key]["*"] || osmPointTags[key][nodeTags[key]])) {
19775 geometries.point = true;
19777 if (osmVertexTags[key] && (osmVertexTags[key]["*"] || osmVertexTags[key][nodeTags[key]])) {
19778 geometries.vertex = true;
19780 if (geometries.point && geometries.vertex) break;
19784 var osmOneWayTags = {
19786 "chair_lift": true,
19789 "magic_carpet": true,
19790 "mixed_lift": true,
19809 "goods_conveyor": true,
19810 "piste:halfpipe": true
19818 "two-way_route": true,
19819 "recommended_traffic_lane": true,
19820 "separation_lane": true,
19821 "separation_roundabout": true
19829 "pressurised": true,
19833 "tidal_channel": true
19836 var osmPavedTags = {
19842 "concrete:lanes": true,
19843 "concrete:plates": true
19849 var osmSemipavedTags = {
19851 "cobblestone": true,
19852 "cobblestone:flattened": true,
19853 "unhewn_cobblestone": true,
19855 "paving_stones": true,
19860 var osmRightSideIsInsideTags = {
19863 "coastline": "coastline"
19866 "retaining_wall": true,
19868 "guard_rail": true,
19872 "embankment": true,
19879 var osmRoutableHighwayTagValues = {
19886 motorway_link: true,
19888 primary_link: true,
19889 secondary_link: true,
19890 tertiary_link: true,
19891 unclassified: true,
19895 living_street: true,
19896 bus_guideway: true,
19907 var osmPathHighwayTagValues = {
19917 var osmRailwayTrackTagValues = {
19925 narrow_gauge: true,
19929 var osmFlowingWaterwayTagValues = {
19937 tidal_channel: true
19939 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/;
19940 function isColourValid(value) {
19941 if (!value.match(/^(#([0-9a-fA-F]{3}){1,2}|\w+)$/)) {
19944 if (!CSS.supports("color", value) || ["unset", "inherit", "initial", "revert"].includes(value)) {
19949 var osmMutuallyExclusiveTagPairs = [
19950 ["noname", "name"],
19952 ["nohousenumber", "addr:housenumber"],
19953 ["noaddress", "addr:housenumber"],
19954 ["noaddress", "addr:housename"],
19955 ["noaddress", "addr:unit"],
19956 ["addr:nostreet", "addr:street"]
19959 // modules/util/array.js
19960 function utilArrayIdentical(a2, b2) {
19961 if (a2 === b2) return true;
19962 var i3 = a2.length;
19963 if (i3 !== b2.length) return false;
19965 if (a2[i3] !== b2[i3]) return false;
19969 function utilArrayDifference(a2, b2) {
19970 var other = new Set(b2);
19971 return Array.from(new Set(a2)).filter(function(v2) {
19972 return !other.has(v2);
19975 function utilArrayIntersection(a2, b2) {
19976 var other = new Set(b2);
19977 return Array.from(new Set(a2)).filter(function(v2) {
19978 return other.has(v2);
19981 function utilArrayUnion(a2, b2) {
19982 var result = new Set(a2);
19983 b2.forEach(function(v2) {
19986 return Array.from(result);
19988 function utilArrayUniq(a2) {
19989 return Array.from(new Set(a2));
19991 function utilArrayChunk(a2, chunkSize) {
19992 if (!chunkSize || chunkSize < 0) return [a2.slice()];
19993 var result = new Array(Math.ceil(a2.length / chunkSize));
19994 return Array.from(result, function(item, i3) {
19995 return a2.slice(i3 * chunkSize, i3 * chunkSize + chunkSize);
19998 function utilArrayFlatten(a2) {
19999 return a2.reduce(function(acc, val) {
20000 return acc.concat(val);
20003 function utilArrayGroupBy(a2, key) {
20004 return a2.reduce(function(acc, item) {
20005 var group = typeof key === "function" ? key(item) : item[key];
20006 (acc[group] = acc[group] || []).push(item);
20010 function utilArrayUniqBy(a2, key) {
20011 var seen = /* @__PURE__ */ new Set();
20012 return a2.reduce(function(acc, item) {
20013 var val = typeof key === "function" ? key(item) : item[key];
20014 if (val && !seen.has(val)) {
20022 // modules/util/util.js
20023 var import_diacritics = __toESM(require_diacritics());
20025 // modules/util/svg_paths_rtl_fix.js
20026 var import_alif_toolkit = __toESM(require_lib());
20027 var rtlRegex = /[\u0590-\u05FF\u0600-\u06FF\u0750-\u07BF\u08A0–\u08BF]/;
20028 function fixRTLTextForSvg(inputText) {
20029 var ret = "", rtlBuffer = [];
20030 var arabicRegex = /[\u0600-\u06FF]/g;
20031 var arabicDiacritics = /[\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06ED]/g;
20032 var arabicMath = /[\u0660-\u066C\u06F0-\u06F9]+/g;
20033 var thaanaVowel = /[\u07A6-\u07B0]/;
20034 var hebrewSign = /[\u0591-\u05bd\u05bf\u05c1-\u05c5\u05c7]/;
20035 if (arabicRegex.test(inputText)) {
20036 inputText = (0, import_alif_toolkit.WordShaper)(inputText);
20038 for (var n3 = 0; n3 < inputText.length; n3++) {
20039 var c2 = inputText[n3];
20040 if (arabicMath.test(c2)) {
20041 ret += rtlBuffer.reverse().join("");
20044 if (rtlBuffer.length && arabicMath.test(rtlBuffer[rtlBuffer.length - 1])) {
20045 ret += rtlBuffer.reverse().join("");
20048 if ((thaanaVowel.test(c2) || hebrewSign.test(c2) || arabicDiacritics.test(c2)) && rtlBuffer.length) {
20049 rtlBuffer[rtlBuffer.length - 1] += c2;
20050 } else if (rtlRegex.test(c2) || c2.charCodeAt(0) >= 64336 && c2.charCodeAt(0) <= 65023 || c2.charCodeAt(0) >= 65136 && c2.charCodeAt(0) <= 65279) {
20051 rtlBuffer.push(c2);
20052 } else if (c2 === " " && rtlBuffer.length) {
20053 rtlBuffer = [rtlBuffer.reverse().join("") + " "];
20055 ret += rtlBuffer.reverse().join("") + c2;
20060 ret += rtlBuffer.reverse().join("");
20064 // modules/core/preferences.js
20067 _storage = localStorage;
20070 _storage = _storage || /* @__PURE__ */ (() => {
20073 getItem: (k2) => s2[k2],
20074 setItem: (k2, v2) => s2[k2] = v2,
20075 removeItem: (k2) => delete s2[k2]
20078 var _listeners = {};
20079 function corePreferences(k2, v2) {
20081 if (v2 === void 0) return _storage.getItem(k2);
20082 else if (v2 === null) _storage.removeItem(k2);
20083 else _storage.setItem(k2, v2);
20084 if (_listeners[k2]) {
20085 _listeners[k2].forEach((handler) => handler(v2));
20089 if (typeof console !== "undefined") {
20090 console.error("localStorage quota exceeded");
20095 corePreferences.onChange = function(k2, handler) {
20096 _listeners[k2] = _listeners[k2] || [];
20097 _listeners[k2].push(handler);
20100 // modules/core/file_fetcher.js
20101 var import_vparse = __toESM(require_vparse());
20104 var presetsCdnUrl = "https://cdn.jsdelivr.net/npm/@openstreetmap/id-tagging-schema@{presets_version}/";
20105 var ociCdnUrl = "https://cdn.jsdelivr.net/npm/osm-community-index@{version}/";
20106 var wmfSitematrixCdnUrl = "https://cdn.jsdelivr.net/npm/wmf-sitematrix@{version}/";
20107 var nsiCdnUrl = "https://cdn.jsdelivr.net/npm/name-suggestion-index@{version}/";
20108 var defaultOsmApiConnections = {
20110 url: "https://www.openstreetmap.org",
20111 apiUrl: "https://api.openstreetmap.org",
20112 client_id: "0tmNTmd0Jo1dQp4AUmMBLtGiD9YpMuXzHefitcuVStc"
20115 url: "https://api06.dev.openstreetmap.org",
20116 client_id: "Ee1wWJ6UlpERbF6BfTNOpwn0R8k_06mvMXdDUkeHMgw"
20119 var osmApiConnections = [];
20121 osmApiConnections.push({
20126 } else if (false) {
20127 osmApiConnections.push(defaultOsmApiConnections[null]);
20129 osmApiConnections.push(defaultOsmApiConnections.live);
20130 osmApiConnections.push(defaultOsmApiConnections.dev);
20132 var taginfoApiUrl = "https://taginfo.openstreetmap.org/api/4/";
20133 var nominatimApiUrl = "https://nominatim.openstreetmap.org/";
20134 var showDonationMessage = true;
20137 var package_default = {
20140 description: "A friendly editor for OpenStreetMap",
20141 main: "dist/iD.min.js",
20142 repository: "github:openstreetmap/iD",
20143 homepage: "https://github.com/openstreetmap/iD",
20144 bugs: "https://github.com/openstreetmap/iD/issues",
20151 all: "run-s clean build dist",
20152 build: "run-s build:css build:data build:js",
20153 "build:css": "node scripts/build_css.js",
20154 "build:data": "shx mkdir -p dist/data && node scripts/build_data.js",
20155 "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",
20156 "build:js": "node config/esbuild.config.mjs",
20157 "build:js:watch": "node config/esbuild.config.mjs --watch",
20158 clean: "shx rm -f dist/esbuild.json dist/*.js dist/*.map dist/*.css dist/img/*.svg",
20159 dist: "run-p dist:**",
20160 "dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
20161 "dist:pannellum": "shx mkdir -p dist/pannellum && shx cp -R node_modules/pannellum/build/* dist/pannellum/",
20162 "dist:min": "node config/esbuild.config.min.mjs",
20163 "dist:svg:iD": 'svg-sprite --symbol --symbol-dest . --shape-id-generator "iD-%s" --symbol-sprite dist/img/iD-sprite.svg "svg/iD-sprite/**/*.svg"',
20164 "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',
20165 "dist:svg:fa": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/fa-sprite.svg svg/fontawesome/*.svg",
20166 "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',
20167 "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",
20168 "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",
20169 "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',
20170 "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',
20171 imagery: "node scripts/update_imagery.js",
20172 lint: "eslint config scripts test/spec modules",
20173 "lint:fix": "eslint scripts test/spec modules --fix",
20174 start: "run-s start:watch",
20175 "start:single-build": "run-p build:js start:server",
20176 "start:watch": "run-p build:js:watch start:server",
20177 "start:server": "node scripts/server.js",
20178 test: "npm-run-all -s lint build test:spec",
20179 "test:spec": "karma start config/karma.conf.js",
20180 translations: "node scripts/update_locales.js"
20183 "@mapbox/geojson-area": "^0.2.2",
20184 "@mapbox/sexagesimal": "1.2.0",
20185 "@mapbox/vector-tile": "^2.0.3",
20186 "@rapideditor/country-coder": "~5.3.0",
20187 "@rapideditor/location-conflation": "~1.4.0",
20188 "@tmcw/togeojson": "^5.8.1",
20189 "@turf/bbox": "^7.1.0",
20190 "@turf/bbox-clip": "^7.1.0",
20191 "abortcontroller-polyfill": "^1.7.5",
20192 "aes-js": "^3.1.2",
20193 "alif-toolkit": "^1.3.0",
20194 "core-js-bundle": "^3.38.0",
20195 diacritics: "1.3.0",
20197 "fast-deep-equal": "~3.1.1",
20198 "fast-json-stable-stringify": "2.1.0",
20199 "lodash-es": "~4.17.15",
20201 "node-diff3": "~3.1.0",
20202 "osm-auth": "~2.5.0",
20203 pannellum: "2.5.6",
20205 "polygon-clipping": "~0.15.7",
20207 "whatwg-fetch": "^3.6.20",
20208 "which-polygon": "2.2.1"
20211 "@fortawesome/fontawesome-svg-core": "~6.6.0",
20212 "@fortawesome/free-brands-svg-icons": "~6.6.0",
20213 "@fortawesome/free-regular-svg-icons": "~6.6.0",
20214 "@fortawesome/free-solid-svg-icons": "~6.6.0",
20215 "@mapbox/maki": "^8.0.1",
20216 "@openstreetmap/id-tagging-schema": "^6.8.1",
20217 "@rapideditor/mapillary_sprite_source": "^1.8.0",
20218 "@rapideditor/temaki": "^5.9.0",
20219 "@transifex/api": "^7.1.2",
20220 autoprefixer: "^10.4.20",
20221 browserslist: "^4.23.3",
20222 "browserslist-to-esbuild": "^2.1.1",
20225 "cldr-core": "^45.0.0",
20226 "cldr-localenames-full": "^45.0.0",
20227 "concat-files": "^0.1.1",
20230 "editor-layer-index": "github:osmlab/editor-layer-index#gh-pages",
20231 esbuild: "^0.23.1",
20232 "esbuild-visualizer": "^0.6.0",
20234 "fetch-mock": "^9.11.0",
20238 "js-yaml": "^4.0.0",
20239 "json-stringify-pretty-compact": "^3.0.0",
20241 "karma-chrome-launcher": "^3.2.0",
20242 "karma-coverage": "2.1.1",
20243 "karma-mocha": "^2.0.1",
20244 "karma-remap-istanbul": "^0.6.0",
20245 "mapillary-js": "4.1.2",
20246 minimist: "^1.2.8",
20248 "name-suggestion-index": "~6.0",
20249 "npm-run-all": "^4.0.0",
20250 "osm-community-index": "~5.8.0",
20251 postcss: "^8.4.41",
20252 "postcss-selector-prepend": "^0.5.0",
20256 "sinon-chai": "^3.7.0",
20258 "static-server": "^2.2.1",
20259 "svg-sprite": "2.0.4",
20266 "> 0.3%, last 6 major versions, not dead, Firefox ESR, maintained node versions"
20270 // modules/core/file_fetcher.js
20271 var _mainFileFetcher = coreFileFetcher();
20272 function coreFileFetcher() {
20273 const ociVersion = package_default.dependencies["osm-community-index"] || package_default.devDependencies["osm-community-index"];
20274 const v2 = (0, import_vparse.default)(ociVersion);
20275 const ociVersionMinor = "".concat(v2.major, ".").concat(v2.minor);
20276 const presetsVersion = package_default.devDependencies["@openstreetmap/id-tagging-schema"];
20278 let _inflight4 = {};
20280 "address_formats": "data/address_formats.min.json",
20281 "imagery": "data/imagery.min.json",
20282 "intro_graph": "data/intro_graph.min.json",
20283 "keepRight": "data/keepRight.min.json",
20284 "languages": "data/languages.min.json",
20285 "locales": "locales/index.min.json",
20286 "phone_formats": "data/phone_formats.min.json",
20287 "qa_data": "data/qa_data.min.json",
20288 "shortcuts": "data/shortcuts.min.json",
20289 "territory_languages": "data/territory_languages.min.json",
20290 "oci_defaults": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/defaults.min.json",
20291 "oci_features": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/featureCollection.min.json",
20292 "oci_resources": ociCdnUrl.replace("{version}", ociVersionMinor) + "dist/resources.min.json",
20293 "presets_package": presetsCdnUrl.replace("{presets_version}", presetsVersion) + "package.json",
20294 "deprecated": presetsCdnUrl + "dist/deprecated.min.json",
20295 "discarded": presetsCdnUrl + "dist/discarded.min.json",
20296 "preset_categories": presetsCdnUrl + "dist/preset_categories.min.json",
20297 "preset_defaults": presetsCdnUrl + "dist/preset_defaults.min.json",
20298 "preset_fields": presetsCdnUrl + "dist/fields.min.json",
20299 "preset_presets": presetsCdnUrl + "dist/presets.min.json",
20300 "wmf_sitematrix": wmfSitematrixCdnUrl.replace("{version}", "0.1") + "wikipedia.min.json"
20302 let _cachedData = {};
20303 _this.cache = () => _cachedData;
20304 _this.get = (which) => {
20305 if (_cachedData[which]) {
20306 return Promise.resolve(_cachedData[which]);
20308 const file = _fileMap[which];
20309 const url = file && _this.asset(file);
20311 return Promise.reject('Unknown data file for "'.concat(which, '"'));
20313 if (url.includes("{presets_version}")) {
20314 return _this.get("presets_package").then((result) => {
20315 const presetsVersion2 = result.version;
20316 return getUrl(url.replace("{presets_version}", presetsVersion2), which);
20319 return getUrl(url, which);
20322 function getUrl(url, which) {
20323 let prom = _inflight4[url];
20325 _inflight4[url] = prom = fetch(url).then((response) => {
20326 if (!response.ok || !response.json) {
20327 throw new Error(response.status + " " + response.statusText);
20329 if (response.status === 204 || response.status === 205) return;
20330 return response.json();
20331 }).then((result) => {
20332 delete _inflight4[url];
20334 throw new Error('No data loaded for "'.concat(which, '"'));
20336 _cachedData[which] = result;
20338 }).catch((err) => {
20339 delete _inflight4[url];
20345 _this.fileMap = function(val) {
20346 if (!arguments.length) return _fileMap;
20350 let _assetPath = "";
20351 _this.assetPath = function(val) {
20352 if (!arguments.length) return _assetPath;
20356 let _assetMap = {};
20357 _this.assetMap = function(val) {
20358 if (!arguments.length) return _assetMap;
20362 _this.asset = (val) => {
20363 if (/^http(s)?:\/\//i.test(val)) return val;
20364 const filename = _assetPath + val;
20365 return _assetMap[filename] || filename;
20370 // node_modules/@rapideditor/country-coder/dist/country-coder.mjs
20371 var import_which_polygon = __toESM(require_which_polygon(), 1);
20372 var borders_default = { type: "FeatureCollection", features: [
20373 { 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]]]] } },
20374 { 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]]]] } },
20375 { 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]]]] } },
20376 { 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]]]] } },
20377 { 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]]]] } },
20378 { 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]]]] } },
20379 { 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]]]] } },
20380 { 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]]]] } },
20381 { 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]]]] } },
20382 { 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]]]] } },
20383 { 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]]]] } },
20384 { 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]]]] } },
20385 { 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]]]] } },
20386 { 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]]]] } },
20387 { 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]]]] } },
20388 { 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]]]] } },
20389 { 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]]]] } },
20390 { 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]]]] } },
20391 { 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]]]] } },
20392 { type: "Feature", properties: { wikidata: "Q12837", nameEn: "Iberia", level: "sharedLandform" }, geometry: null },
20393 { 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]]]] } },
20394 { 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]]]] } },
20395 { type: "Feature", properties: { wikidata: "Q22890", nameEn: "Ireland", level: "sharedLandform" }, geometry: null },
20396 { type: "Feature", properties: { wikidata: "Q23666", nameEn: "Great Britain", country: "GB", level: "sharedLandform" }, geometry: null },
20397 { 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]]]] } },
20398 { 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]]]] } },
20399 { 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]]]] } },
20400 { 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]]]] } },
20401 { 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]]]] } },
20402 { 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]]]] } },
20403 { 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]]]] } },
20404 { 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]]]] } },
20405 { 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]]]] } },
20406 { 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]]]] } },
20407 { 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]]]] } },
20408 { 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]]]] } },
20409 { type: "Feature", properties: { wikidata: "Q35657", nameEn: "US States", country: "US", level: "subcountryGroup" }, geometry: null },
20410 { type: "Feature", properties: { wikidata: "Q36117", nameEn: "Borneo", level: "sharedLandform" }, geometry: null },
20411 { 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]]]] } },
20412 { type: "Feature", properties: { wikidata: "Q37362", nameEn: "Akrotiri and Dhekelia", aliases: ["SBA"], country: "GB" }, geometry: null },
20413 { 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]]]] } },
20414 { 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]]]] } },
20415 { 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]]]] } },
20416 { 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]]]] } },
20417 { 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]]]] } },
20418 { 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]]]] } },
20419 { type: "Feature", properties: { wikidata: "Q46395", nameEn: "British Overseas Territories", aliases: ["BOTS", "UKOTS"], country: "GB", level: "subcountryGroup" }, geometry: null },
20420 { 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]]]] } },
20421 { 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]]]] } },
20422 { 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]]]] } },
20423 { 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]]]] } },
20424 { type: "Feature", properties: { wikidata: "Q105472", nameEn: "Macaronesia", level: "sharedLandform" }, geometry: null },
20425 { 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]]]] } },
20426 { 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]]]] } },
20427 { 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]]]] } },
20428 { 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]]]] } },
20429 { 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]]]] } },
20430 { 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]]]] } },
20431 { 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]]]] } },
20432 { 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]]]] } },
20433 { 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]]]] } },
20434 { 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]]]] } },
20435 { type: "Feature", properties: { wikidata: "Q153732", nameEn: "Mariana Islands", level: "sharedLandform" }, geometry: null },
20436 { 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]]]] } },
20437 { 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]]]] } },
20438 { type: "Feature", properties: { wikidata: "Q185086", nameEn: "Crown Dependencies", country: "GB", level: "subcountryGroup" }, geometry: null },
20439 { 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]]]] } },
20440 { type: "Feature", properties: { wikidata: "Q191011", nameEn: "Plazas de soberan\xEDa", country: "ES" }, geometry: null },
20441 { 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]]]] } },
20442 { 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]]]] } },
20443 { 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]]]] } },
20444 { 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]]]] } },
20445 { 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]]]] } },
20446 { type: "Feature", properties: { wikidata: "Q644636", nameEn: "Cyprus", level: "sharedLandform" }, geometry: null },
20447 { type: "Feature", properties: { wikidata: "Q851132", nameEn: "New Zealand Outlying Islands", country: "NZ", level: "subcountryGroup" }, geometry: null },
20448 { 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]]]] } },
20449 { 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]]]] } },
20450 { 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]]]] } },
20451 { 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]]]] } },
20452 { type: "Feature", properties: { wikidata: "Q1352230", nameEn: "US Territories", country: "US", level: "subcountryGroup" }, geometry: null },
20453 { type: "Feature", properties: { wikidata: "Q1451600", nameEn: "Overseas Countries and Territories of the EU", aliases: ["OCT"], level: "subunion" }, geometry: null },
20454 { 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]]]] } },
20455 { 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]]]] } },
20456 { 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]]]] } },
20457 { 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]]]] } },
20458 { 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]]]] } },
20459 { 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]]]] } },
20460 { 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]]]] } },
20461 { 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]]]] } },
20462 { type: "Feature", properties: { wikidata: "Q2914565", nameEn: "Autonomous Regions of Portugal", country: "PT", level: "subcountryGroup" }, geometry: null },
20463 { 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]]]] } },
20464 { 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]]]] } },
20465 { type: "Feature", properties: { wikidata: "Q3320166", nameEn: "Outermost Regions of the EU", aliases: ["OMR"], level: "subunion" }, geometry: null },
20466 { type: "Feature", properties: { wikidata: "Q3336843", nameEn: "Countries of the United Kingdom", aliases: ["GB-UKM"], country: "GB", level: "subcountryGroup" }, geometry: null },
20467 { 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]]]] } },
20468 { 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]]]] } },
20469 { 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]]]] } },
20470 { 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]]]] } },
20471 { 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]]]] } },
20472 { 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]]]] } },
20473 { type: "Feature", properties: { m49: "001", wikidata: "Q2", nameEn: "World", aliases: ["Earth", "Planet"], level: "world" }, geometry: null },
20474 { type: "Feature", properties: { m49: "002", wikidata: "Q15", nameEn: "Africa", level: "region" }, geometry: null },
20475 { type: "Feature", properties: { m49: "003", wikidata: "Q49", nameEn: "North America", level: "subregion" }, geometry: null },
20476 { type: "Feature", properties: { m49: "005", wikidata: "Q18", nameEn: "South America", level: "intermediateRegion" }, geometry: null },
20477 { type: "Feature", properties: { m49: "009", wikidata: "Q538", nameEn: "Oceania", level: "region" }, geometry: null },
20478 { type: "Feature", properties: { m49: "011", wikidata: "Q4412", nameEn: "Western Africa", level: "intermediateRegion" }, geometry: null },
20479 { type: "Feature", properties: { m49: "013", wikidata: "Q27611", nameEn: "Central America", level: "intermediateRegion" }, geometry: null },
20480 { type: "Feature", properties: { m49: "014", wikidata: "Q27407", nameEn: "Eastern Africa", level: "intermediateRegion" }, geometry: null },
20481 { type: "Feature", properties: { m49: "015", wikidata: "Q27381", nameEn: "Northern Africa", level: "subregion" }, geometry: null },
20482 { type: "Feature", properties: { m49: "017", wikidata: "Q27433", nameEn: "Middle Africa", level: "intermediateRegion" }, geometry: null },
20483 { type: "Feature", properties: { m49: "018", wikidata: "Q27394", nameEn: "Southern Africa", level: "intermediateRegion" }, geometry: null },
20484 { type: "Feature", properties: { m49: "019", wikidata: "Q828", nameEn: "Americas", level: "region" }, geometry: null },
20485 { type: "Feature", properties: { m49: "021", wikidata: "Q2017699", nameEn: "Northern America", level: "subregion" }, geometry: null },
20486 { type: "Feature", properties: { m49: "029", wikidata: "Q664609", nameEn: "Caribbean", level: "intermediateRegion" }, geometry: null },
20487 { type: "Feature", properties: { m49: "030", wikidata: "Q27231", nameEn: "Eastern Asia", level: "subregion" }, geometry: null },
20488 { type: "Feature", properties: { m49: "034", wikidata: "Q771405", nameEn: "Southern Asia", level: "subregion" }, geometry: null },
20489 { type: "Feature", properties: { m49: "035", wikidata: "Q11708", nameEn: "South-eastern Asia", level: "subregion" }, geometry: null },
20490 { type: "Feature", properties: { m49: "039", wikidata: "Q27449", nameEn: "Southern Europe", level: "subregion" }, geometry: null },
20491 { type: "Feature", properties: { m49: "053", wikidata: "Q45256", nameEn: "Australia and New Zealand", aliases: ["Australasia"], level: "subregion" }, geometry: null },
20492 { type: "Feature", properties: { m49: "054", wikidata: "Q37394", nameEn: "Melanesia", level: "subregion" }, geometry: null },
20493 { type: "Feature", properties: { m49: "057", wikidata: "Q3359409", nameEn: "Micronesia", level: "subregion" }, geometry: null },
20494 { type: "Feature", properties: { m49: "061", wikidata: "Q35942", nameEn: "Polynesia", level: "subregion" }, geometry: null },
20495 { type: "Feature", properties: { m49: "142", wikidata: "Q48", nameEn: "Asia", level: "region" }, geometry: null },
20496 { type: "Feature", properties: { m49: "143", wikidata: "Q27275", nameEn: "Central Asia", level: "subregion" }, geometry: null },
20497 { type: "Feature", properties: { m49: "145", wikidata: "Q27293", nameEn: "Western Asia", level: "subregion" }, geometry: null },
20498 { type: "Feature", properties: { m49: "150", wikidata: "Q46", nameEn: "Europe", level: "region" }, geometry: null },
20499 { type: "Feature", properties: { m49: "151", wikidata: "Q27468", nameEn: "Eastern Europe", level: "subregion" }, geometry: null },
20500 { type: "Feature", properties: { m49: "154", wikidata: "Q27479", nameEn: "Northern Europe", level: "subregion" }, geometry: null },
20501 { type: "Feature", properties: { m49: "155", wikidata: "Q27496", nameEn: "Western Europe", level: "subregion" }, geometry: null },
20502 { type: "Feature", properties: { m49: "202", wikidata: "Q132959", nameEn: "Sub-Saharan Africa", level: "subregion" }, geometry: null },
20503 { type: "Feature", properties: { m49: "419", wikidata: "Q72829598", nameEn: "Latin America and the Caribbean", level: "subregion" }, geometry: null },
20504 { type: "Feature", properties: { m49: "830", wikidata: "Q42314", nameEn: "Channel Islands", level: "intermediateRegion" }, geometry: null },
20505 { 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]]]] } },
20506 { 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]]]] } },
20507 { 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]]]] } },
20508 { 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]]]] } },
20509 { 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]]]] } },
20510 { 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]]]] } },
20511 { 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]]]] } },
20512 { 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]]]] } },
20513 { 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]]]] } },
20514 { 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]]]] } },
20515 { 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]]]] } },
20516 { 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]]]] } },
20517 { 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]]]] } },
20518 { type: "Feature", properties: { iso1A2: "AU", iso1A3: "AUS", iso1N3: "036", wikidata: "Q408", nameEn: "Australia" }, geometry: null },
20519 { 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]]]] } },
20520 { 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]]]] } },
20521 { 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]]]] } },
20522 { 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]]]] } },
20523 { 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]]]] } },
20524 { 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]]]] } },
20525 { 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]]]] } },
20526 { 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]]]] } },
20527 { 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]]]] } },
20528 { 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]]]] } },
20529 { 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]]]] } },
20530 { 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]]]] } },
20531 { 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]]]] } },
20532 { 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]]]] } },
20533 { 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]]]] } },
20534 { 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]]]] } },
20535 { type: "Feature", properties: { iso1A2: "BQ", iso1A3: "BES", iso1N3: "535", wikidata: "Q27561", nameEn: "Caribbean Netherlands", country: "NL" }, geometry: null },
20536 { 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]]]] } },
20537 { 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]]]] } },
20538 { 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]]]] } },
20539 { 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]]]] } },
20540 { 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]]]] } },
20541 { 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]]]] } },
20542 { 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]]]] } },
20543 { 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]]]] } },
20544 { 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]]]] } },
20545 { 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]]]] } },
20546 { 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]]]] } },
20547 { 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]]]] } },
20548 { 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"] } },
20549 { 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]]]] } },
20550 { 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]]]] } },
20551 { 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]]]] } },
20552 { 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]]]] } },
20553 { type: "Feature", properties: { iso1A2: "CN", iso1A3: "CHN", iso1N3: "156", wikidata: "Q148", nameEn: "People's Republic of China" }, geometry: null },
20554 { 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]]]] } },
20555 { 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]]]] } },
20556 { type: "Feature", properties: { iso1A2: "CQ", iso1A3: "CRQ", iso1N3: "680", m49: "680", wikidata: "Q3405693", ccTLD: null, nameEn: "Sark", country: "GB", groups: ["GG", "830", "Q185086", "154", "150", "UN"], level: "subterritory", isoStatus: "excRes", 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]]]] } },
20557 { 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]]]] } },
20558 { 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]]]] } },
20559 { 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]]]] } },
20560 { 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]]]] } },
20561 { 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]]]] } },
20562 { 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]]]] } },
20563 { 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]]]] } },
20564 { 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]]]] } },
20565 { 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]]]] } },
20566 { 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]]]] } },
20567 { type: "Feature", properties: { iso1A2: "DK", iso1A3: "DNK", iso1N3: "208", wikidata: "Q756617", nameEn: "Kingdom of Denmark" }, geometry: null },
20568 { 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]]]] } },
20569 { 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]]]] } },
20570 { 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]]]] } },
20571 { type: "Feature", properties: { iso1A2: "EA", wikidata: "Q28868874", nameEn: "Ceuta, Melilla", country: "ES", level: "territory", isoStatus: "excRes" }, geometry: null },
20572 { type: "Feature", properties: { iso1A2: "EC", iso1A3: "ECU", iso1N3: "218", wikidata: "Q736", nameEn: "Ecuador" }, geometry: null },
20573 { 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]]]] } },
20574 { 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]]]] } },
20575 { 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]]]] } },
20576 { 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]]]] } },
20577 { type: "Feature", properties: { iso1A2: "ES", iso1A3: "ESP", iso1N3: "724", wikidata: "Q29", nameEn: "Spain" }, geometry: null },
20578 { 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]]]] } },
20579 { type: "Feature", properties: { iso1A2: "EU", iso1A3: "EUE", wikidata: "Q458", nameEn: "European Union", level: "union", isoStatus: "excRes" }, geometry: null },
20580 { type: "Feature", properties: { iso1A2: "FI", iso1A3: "FIN", iso1N3: "246", wikidata: "Q33", nameEn: "Finland", aliases: ["SF"] }, geometry: null },
20581 { 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]]]] } },
20582 { 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]]]] } },
20583 { 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]]]] } },
20584 { 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]]]] } },
20585 { type: "Feature", properties: { iso1A2: "FR", iso1A3: "FRA", iso1N3: "250", wikidata: "Q142", nameEn: "France" }, geometry: null },
20586 { 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]]]] } },
20587 { 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]]]] } },
20588 { type: "Feature", properties: { iso1A2: "GB", iso1A3: "GBR", iso1N3: "826", wikidata: "Q145", ccTLD: ".uk", nameEn: "United Kingdom", aliases: ["UK"] }, geometry: null },
20589 { 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]]]] } },
20590 { 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]]]] } },
20591 { 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]]]] } },
20592 { type: "Feature", properties: { iso1A2: "GG", iso1A3: "GGY", iso1N3: "831", wikidata: "Q25230", nameEn: "Bailiwick of Guernsey", country: "GB" }, geometry: null },
20593 { 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]]]] } },
20594 { 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]]]] } },
20595 { 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]]]] } },
20596 { 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]]]] } },
20597 { 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]]]] } },
20598 { 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]]]] } },
20599 { 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]]]] } },
20600 { 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]]]] } },
20601 { 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]]]] } },
20602 { 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]]]] } },
20603 { 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]]]] } },
20604 { 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]]]] } },
20605 { 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]]]] } },
20606 { 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]]]] } },
20607 { 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]]]] } },
20608 { 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]]]] } },
20609 { 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]]]] } },
20610 { 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]]]] } },
20611 { 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]]]] } },
20612 { 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]]]] } },
20613 { type: "Feature", properties: { iso1A2: "ID", iso1A3: "IDN", iso1N3: "360", wikidata: "Q252", nameEn: "Indonesia", aliases: ["RI"] }, geometry: null },
20614 { 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"] } },
20615 { 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]]]] } },
20616 { 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]]]] } },
20617 { type: "Feature", properties: { iso1A2: "IN", iso1A3: "IND", iso1N3: "356", wikidata: "Q668", nameEn: "India" }, geometry: null },
20618 { type: "Feature", properties: { iso1A2: "IO", iso1A3: "IOT", iso1N3: "086", wikidata: "Q43448", nameEn: "British Indian Ocean Territory", country: "GB" }, geometry: null },
20619 { 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]]]] } },
20620 { 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]]]] } },
20621 { 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]]]] } },
20622 { 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]]]] } },
20623 { 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]]]] } },
20624 { 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]]]] } },
20625 { 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]]]] } },
20626 { 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]]]] } },
20627 { 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]]]] } },
20628 { 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]]]] } },
20629 { 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]]]] } },
20630 { 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]]]] } },
20631 { 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]]]] } },
20632 { 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]]]] } },
20633 { 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]]]] } },
20634 { 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]]]] } },
20635 { 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]]]] } },
20636 { 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]]]] } },
20637 { 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]]]] } },
20638 { 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]]]] } },
20639 { 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]]]] } },
20640 { 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]]]] } },
20641 { 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]]]] } },
20642 { 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]]]] } },
20643 { 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]]]] } },
20644 { 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]]]] } },
20645 { 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]]]] } },
20646 { 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]]]] } },
20647 { 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]]]] } },
20648 { 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]]]] } },
20649 { 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]]]] } },
20650 { 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]]]] } },
20651 { 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]]]] } },
20652 { 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]]]] } },
20653 { 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]]]] } },
20654 { 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]]]] } },
20655 { 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]]]] } },
20656 { 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]]]] } },
20657 { 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]]]] } },
20658 { 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]]]] } },
20659 { 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]]]] } },
20660 { 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]]]] } },
20661 { 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]]]] } },
20662 { 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]]]] } },
20663 { 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]]]] } },
20664 { 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]]]] } },
20665 { 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]]]] } },
20666 { 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]]]] } },
20667 { 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]]]] } },
20668 { 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]]]] } },
20669 { 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]]]] } },
20670 { type: "Feature", properties: { iso1A2: "MY", iso1A3: "MYS", iso1N3: "458", wikidata: "Q833", nameEn: "Malaysia" }, geometry: null },
20671 { 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]]]] } },
20672 { 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]]]] } },
20673 { 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]]]] } },
20674 { 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]]]] } },
20675 { 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]]]] } },
20676 { 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]]]] } },
20677 { 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]]]] } },
20678 { type: "Feature", properties: { iso1A2: "NL", iso1A3: "NLD", iso1N3: "528", wikidata: "Q29999", nameEn: "Kingdom of the Netherlands" }, geometry: null },
20679 { type: "Feature", properties: { iso1A2: "NO", iso1A3: "NOR", iso1N3: "578", wikidata: "Q20", nameEn: "Norway" }, geometry: null },
20680 { 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]]]] } },
20681 { 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]]]] } },
20682 { 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]]]] } },
20683 { type: "Feature", properties: { iso1A2: "NZ", iso1A3: "NZL", iso1N3: "554", wikidata: "Q664", nameEn: "New Zealand" }, geometry: null },
20684 { 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]]]] } },
20685 { 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]]]] } },
20686 { 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]]]] } },
20687 { 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]]]] } },
20688 { 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]]]] } },
20689 { 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]]]] } },
20690 { 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]]]] } },
20691 { 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]]]] } },
20692 { 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]]]] } },
20693 { 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]]]] } },
20694 { 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]]]] } },
20695 { type: "Feature", properties: { iso1A2: "PS", iso1A3: "PSE", iso1N3: "275", wikidata: "Q219060", nameEn: "Palestine" }, geometry: null },
20696 { type: "Feature", properties: { iso1A2: "PT", iso1A3: "PRT", iso1N3: "620", wikidata: "Q45", nameEn: "Portugal" }, geometry: null },
20697 { 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]]]] } },
20698 { 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]]]] } },
20699 { 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]]]] } },
20700 { 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]]]] } },
20701 { 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]]]] } },
20702 { 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]]]] } },
20703 { type: "Feature", properties: { iso1A2: "RU", iso1A3: "RUS", iso1N3: "643", wikidata: "Q159", nameEn: "Russia" }, geometry: null },
20704 { 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]]]] } },
20705 { 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]]]] } },
20706 { 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]]]] } },
20707 { 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]]]] } },
20708 { 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]]]] } },
20709 { 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]]]] } },
20710 { 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]]]] } },
20711 { type: "Feature", properties: { iso1A2: "SH", iso1A3: "SHN", iso1N3: "654", wikidata: "Q192184", nameEn: "Saint Helena, Ascension and Tristan da Cunha", country: "GB" }, geometry: null },
20712 { 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]]]] } },
20713 { type: "Feature", properties: { iso1A2: "SJ", iso1A3: "SJM", iso1N3: "744", wikidata: "Q842829", nameEn: "Svalbard and Jan Mayen", country: "NO" }, geometry: null },
20714 { 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]]]] } },
20715 { 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]]]] } },
20716 { 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]]]] } },
20717 { 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]]]] } },
20718 { 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]]]] } },
20719 { 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]]]] } },
20720 { 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]]]] } },
20721 { 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]]]] } },
20722 { 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]]]] } },
20723 { 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]]]] } },
20724 { 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]]]] } },
20725 { 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]]]] } },
20726 { 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]]]] } },
20727 { 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]]]] } },
20728 { 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]]]] } },
20729 { type: "Feature", properties: { iso1A2: "TF", iso1A3: "ATF", iso1N3: "260", wikidata: "Q129003", nameEn: "French Southern Territories", country: "FR", groups: ["EU", "UN"] }, geometry: null },
20730 { 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]]]] } },
20731 { 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]]]] } },
20732 { 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]]]] } },
20733 { 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]]]] } },
20734 { 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]]]] } },
20735 { 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]]]] } },
20736 { 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]]]] } },
20737 { 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]]]] } },
20738 { 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]]]] } },
20739 { 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]]]] } },
20740 { 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]]]] } },
20741 { 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]]]] } },
20742 { 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]]]] } },
20743 { 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]]]] } },
20744 { 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]]]] } },
20745 { type: "Feature", properties: { iso1A2: "UM", iso1A3: "UMI", iso1N3: "581", wikidata: "Q16645", nameEn: "United States Minor Outlying Islands", country: "US" }, geometry: null },
20746 { type: "Feature", properties: { iso1A2: "UN", wikidata: "Q1065", nameEn: "United Nations", level: "unitedNations", isoStatus: "excRes" }, geometry: null },
20747 { type: "Feature", properties: { iso1A2: "US", iso1A3: "USA", iso1N3: "840", wikidata: "Q30", nameEn: "United States of America" }, geometry: null },
20748 { 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]]]] } },
20749 { 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]]]] } },
20750 { 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]]]] } },
20751 { 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]]]] } },
20752 { 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]]]] } },
20753 { 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]]]] } },
20754 { 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]]]] } },
20755 { 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]]]] } },
20756 { 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]]]] } },
20757 { 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]]]] } },
20758 { 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]]]] } },
20759 { 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]]]] } },
20760 { 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]]]] } },
20761 { 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]]]] } },
20762 { 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]]]] } },
20763 { 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]]]] } },
20764 { 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]]]] } }
20766 var borders = borders_default;
20767 var _whichPolygon = {};
20768 var _featuresByCode = {};
20769 var idFilterRegex = /(?=(?!^(and|the|of|el|la|de)$))(\b(and|the|of|el|la|de)\b)|[-_ .,'()&[\]/]/gi;
20770 function canonicalID(id2) {
20771 const s2 = id2 || "";
20772 if (s2.charAt(0) === ".") {
20773 return s2.toUpperCase();
20775 return s2.replace(idFilterRegex, "").toUpperCase();
20784 "intermediateRegion",
20792 loadDerivedDataAndCaches(borders);
20793 function loadDerivedDataAndCaches(borders2) {
20794 const identifierProps = ["iso1A2", "iso1A3", "m49", "wikidata", "emojiFlag", "ccTLD", "nameEn"];
20795 let geometryFeatures = [];
20796 for (const feature22 of borders2.features) {
20797 const props = feature22.properties;
20798 props.id = props.iso1A2 || props.m49 || props.wikidata;
20799 loadM49(feature22);
20800 loadTLD(feature22);
20801 loadIsoStatus(feature22);
20802 loadLevel(feature22);
20803 loadGroups(feature22);
20804 loadFlag(feature22);
20805 cacheFeatureByIDs(feature22);
20806 if (feature22.geometry) {
20807 geometryFeatures.push(feature22);
20810 for (const feature22 of borders2.features) {
20811 feature22.properties.groups = feature22.properties.groups.map((groupID) => {
20812 return _featuresByCode[groupID].properties.id;
20814 loadMembersForGroupsOf(feature22);
20816 for (const feature22 of borders2.features) {
20817 loadRoadSpeedUnit(feature22);
20818 loadRoadHeightUnit(feature22);
20819 loadDriveSide(feature22);
20820 loadCallingCodes(feature22);
20821 loadGroupGroups(feature22);
20823 for (const feature22 of borders2.features) {
20824 feature22.properties.groups.sort((groupID1, groupID2) => {
20825 return levels.indexOf(_featuresByCode[groupID1].properties.level) - levels.indexOf(_featuresByCode[groupID2].properties.level);
20827 if (feature22.properties.members) {
20828 feature22.properties.members.sort((id1, id2) => {
20829 const diff = levels.indexOf(_featuresByCode[id1].properties.level) - levels.indexOf(_featuresByCode[id2].properties.level);
20831 return borders2.features.indexOf(_featuresByCode[id1]) - borders2.features.indexOf(_featuresByCode[id2]);
20837 const geometryOnlyCollection = {
20838 type: "FeatureCollection",
20839 features: geometryFeatures
20841 _whichPolygon = (0, import_which_polygon.default)(geometryOnlyCollection);
20842 function loadGroups(feature22) {
20843 const props = feature22.properties;
20844 if (!props.groups) {
20847 if (feature22.geometry && props.country) {
20848 props.groups.push(props.country);
20850 if (props.m49 !== "001") {
20851 props.groups.push("001");
20854 function loadM49(feature22) {
20855 const props = feature22.properties;
20856 if (!props.m49 && props.iso1N3) {
20857 props.m49 = props.iso1N3;
20860 function loadTLD(feature22) {
20861 const props = feature22.properties;
20862 if (props.level === "unitedNations") return;
20863 if (props.ccTLD === null) return;
20864 if (!props.ccTLD && props.iso1A2) {
20865 props.ccTLD = "." + props.iso1A2.toLowerCase();
20868 function loadIsoStatus(feature22) {
20869 const props = feature22.properties;
20870 if (!props.isoStatus && props.iso1A2) {
20871 props.isoStatus = "official";
20874 function loadLevel(feature22) {
20875 const props = feature22.properties;
20876 if (props.level) return;
20877 if (!props.country) {
20878 props.level = "country";
20879 } else if (!props.iso1A2 || props.isoStatus === "official") {
20880 props.level = "territory";
20882 props.level = "subterritory";
20885 function loadGroupGroups(feature22) {
20886 const props = feature22.properties;
20887 if (feature22.geometry || !props.members) return;
20888 const featureLevelIndex = levels.indexOf(props.level);
20889 let sharedGroups = [];
20890 props.members.forEach((memberID, index) => {
20891 const member = _featuresByCode[memberID];
20892 const memberGroups = member.properties.groups.filter((groupID) => {
20893 return groupID !== feature22.properties.id && featureLevelIndex < levels.indexOf(_featuresByCode[groupID].properties.level);
20896 sharedGroups = memberGroups;
20898 sharedGroups = sharedGroups.filter((groupID) => memberGroups.indexOf(groupID) !== -1);
20901 props.groups = props.groups.concat(
20902 sharedGroups.filter((groupID) => props.groups.indexOf(groupID) === -1)
20904 for (const groupID of sharedGroups) {
20905 const groupFeature = _featuresByCode[groupID];
20906 if (groupFeature.properties.members.indexOf(props.id) === -1) {
20907 groupFeature.properties.members.push(props.id);
20911 function loadRoadSpeedUnit(feature22) {
20912 const props = feature22.properties;
20913 if (feature22.geometry) {
20914 if (!props.roadSpeedUnit) props.roadSpeedUnit = "km/h";
20915 } else if (props.members) {
20916 const vals = Array.from(
20918 props.members.map((id2) => {
20919 const member = _featuresByCode[id2];
20920 if (member.geometry) return member.properties.roadSpeedUnit || "km/h";
20924 if (vals.length === 1) props.roadSpeedUnit = vals[0];
20927 function loadRoadHeightUnit(feature22) {
20928 const props = feature22.properties;
20929 if (feature22.geometry) {
20930 if (!props.roadHeightUnit) props.roadHeightUnit = "m";
20931 } else if (props.members) {
20932 const vals = Array.from(
20934 props.members.map((id2) => {
20935 const member = _featuresByCode[id2];
20936 if (member.geometry) return member.properties.roadHeightUnit || "m";
20940 if (vals.length === 1) props.roadHeightUnit = vals[0];
20943 function loadDriveSide(feature22) {
20944 const props = feature22.properties;
20945 if (feature22.geometry) {
20946 if (!props.driveSide) props.driveSide = "right";
20947 } else if (props.members) {
20948 const vals = Array.from(
20950 props.members.map((id2) => {
20951 const member = _featuresByCode[id2];
20952 if (member.geometry) return member.properties.driveSide || "right";
20956 if (vals.length === 1) props.driveSide = vals[0];
20959 function loadCallingCodes(feature22) {
20960 const props = feature22.properties;
20961 if (!feature22.geometry && props.members) {
20962 props.callingCodes = Array.from(
20964 props.members.reduce((array2, id2) => {
20965 const member = _featuresByCode[id2];
20966 if (member.geometry && member.properties.callingCodes) {
20967 return array2.concat(member.properties.callingCodes);
20975 function loadFlag(feature22) {
20976 if (!feature22.properties.iso1A2) return;
20977 const flag = feature22.properties.iso1A2.replace(/./g, function(char) {
20978 return String.fromCodePoint(char.charCodeAt(0) + 127397);
20980 feature22.properties.emojiFlag = flag;
20982 function loadMembersForGroupsOf(feature22) {
20983 for (const groupID of feature22.properties.groups) {
20984 const groupFeature = _featuresByCode[groupID];
20985 if (!groupFeature.properties.members) {
20986 groupFeature.properties.members = [];
20988 groupFeature.properties.members.push(feature22.properties.id);
20991 function cacheFeatureByIDs(feature22) {
20993 for (const prop of identifierProps) {
20994 const id2 = feature22.properties[prop];
20999 for (const alias of feature22.properties.aliases || []) {
21002 for (const id2 of ids) {
21003 const cid = canonicalID(id2);
21004 _featuresByCode[cid] = feature22;
21008 function locArray(loc) {
21009 if (Array.isArray(loc)) {
21011 } else if (loc.coordinates) {
21012 return loc.coordinates;
21014 return loc.geometry.coordinates;
21016 function smallestFeature(loc) {
21017 const query = locArray(loc);
21018 const featureProperties = _whichPolygon(query);
21019 if (!featureProperties) return null;
21020 return _featuresByCode[featureProperties.id];
21022 function countryFeature(loc) {
21023 const feature22 = smallestFeature(loc);
21024 if (!feature22) return null;
21025 const countryCode = feature22.properties.country || feature22.properties.iso1A2;
21026 return _featuresByCode[countryCode] || null;
21028 var defaultOpts = {
21033 function featureForLoc(loc, opts) {
21034 const targetLevel = opts.level || "country";
21035 const maxLevel = opts.maxLevel || "world";
21036 const withProp = opts.withProp;
21037 const targetLevelIndex = levels.indexOf(targetLevel);
21038 if (targetLevelIndex === -1) return null;
21039 const maxLevelIndex = levels.indexOf(maxLevel);
21040 if (maxLevelIndex === -1) return null;
21041 if (maxLevelIndex < targetLevelIndex) return null;
21042 if (targetLevel === "country") {
21043 const fastFeature = countryFeature(loc);
21045 if (!withProp || fastFeature.properties[withProp]) {
21046 return fastFeature;
21050 const features = featuresContaining(loc);
21051 const match = features.find((feature22) => {
21052 let levelIndex = levels.indexOf(feature22.properties.level);
21053 if (feature22.properties.level === targetLevel || // if no feature exists at the target level, return the first feature at the next level up
21054 levelIndex > targetLevelIndex && levelIndex <= maxLevelIndex) {
21055 if (!withProp || feature22.properties[withProp]) {
21061 return match || null;
21063 function featureForID(id2) {
21065 if (typeof id2 === "number") {
21066 stringID = id2.toString();
21067 if (stringID.length === 1) {
21068 stringID = "00" + stringID;
21069 } else if (stringID.length === 2) {
21070 stringID = "0" + stringID;
21073 stringID = canonicalID(id2);
21075 return _featuresByCode[stringID] || null;
21077 function smallestFeaturesForBbox(bbox2) {
21078 return _whichPolygon.bbox(bbox2).map((props) => _featuresByCode[props.id]);
21080 function smallestOrMatchingFeature(query) {
21081 if (typeof query === "object") {
21082 return smallestFeature(query);
21084 return featureForID(query);
21086 function feature(query, opts = defaultOpts) {
21087 if (typeof query === "object") {
21088 return featureForLoc(query, opts);
21090 return featureForID(query);
21092 function iso1A2Code(query, opts = defaultOpts) {
21093 opts.withProp = "iso1A2";
21094 const match = feature(query, opts);
21095 if (!match) return null;
21096 return match.properties.iso1A2 || null;
21098 function propertiesForQuery(query, property) {
21099 const features = featuresContaining(query, false);
21100 return features.map((feature22) => feature22.properties[property]).filter(Boolean);
21102 function iso1A2Codes(query) {
21103 return propertiesForQuery(query, "iso1A2");
21105 function featuresContaining(query, strict) {
21106 let matchingFeatures;
21107 if (Array.isArray(query) && query.length === 4) {
21108 matchingFeatures = smallestFeaturesForBbox(query);
21110 const smallestOrMatching = smallestOrMatchingFeature(query);
21111 matchingFeatures = smallestOrMatching ? [smallestOrMatching] : [];
21113 if (!matchingFeatures.length) return [];
21114 let returnFeatures;
21115 if (!strict || typeof query === "object") {
21116 returnFeatures = matchingFeatures.slice();
21118 returnFeatures = [];
21120 for (const feature22 of matchingFeatures) {
21121 const properties = feature22.properties;
21122 for (const groupID of properties.groups) {
21123 const groupFeature = _featuresByCode[groupID];
21124 if (returnFeatures.indexOf(groupFeature) === -1) {
21125 returnFeatures.push(groupFeature);
21129 return returnFeatures;
21131 function featuresIn(id2, strict) {
21132 const feature22 = featureForID(id2);
21133 if (!feature22) return [];
21136 features.push(feature22);
21138 const properties = feature22.properties;
21139 for (const memberID of properties.members || []) {
21140 features.push(_featuresByCode[memberID]);
21144 function aggregateFeature(id2) {
21146 const features = featuresIn(id2, false);
21147 if (features.length === 0) return null;
21148 let aggregateCoordinates = [];
21149 for (const feature22 of features) {
21150 if (((_a3 = feature22.geometry) == null ? void 0 : _a3.type) === "MultiPolygon" && feature22.geometry.coordinates) {
21151 aggregateCoordinates = aggregateCoordinates.concat(feature22.geometry.coordinates);
21156 properties: features[0].properties,
21158 type: "MultiPolygon",
21159 coordinates: aggregateCoordinates
21163 function roadSpeedUnit(query) {
21164 const feature22 = smallestOrMatchingFeature(query);
21165 return feature22 && feature22.properties.roadSpeedUnit || null;
21167 function roadHeightUnit(query) {
21168 const feature22 = smallestOrMatchingFeature(query);
21169 return feature22 && feature22.properties.roadHeightUnit || null;
21172 // node_modules/polyclip-ts/dist/constant.js
21173 var constant_default5 = (x2) => {
21179 // node_modules/polyclip-ts/dist/compare.js
21180 var compare_default = (eps) => {
21181 const almostEqual = eps ? (a2, b2) => b2.minus(a2).abs().isLessThanOrEqualTo(eps) : constant_default5(false);
21182 return (a2, b2) => {
21183 if (almostEqual(a2, b2))
21185 return a2.comparedTo(b2);
21189 // node_modules/polyclip-ts/dist/orient.js
21190 function orient_default(eps) {
21191 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);
21192 return (a2, b2, c2) => {
21193 const ax = a2.x, ay = a2.y, cx = c2.x, cy = c2.y;
21194 const area2 = ay.minus(cy).times(b2.x.minus(cx)).minus(ax.minus(cx).times(b2.y.minus(cy)));
21195 if (almostCollinear(area2, ax, ay, cx, cy))
21197 return area2.comparedTo(0);
21201 // node_modules/bignumber.js/bignumber.mjs
21202 var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
21203 var mathceil = Math.ceil;
21204 var mathfloor = Math.floor;
21205 var bignumberError = "[BigNumber Error] ";
21206 var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
21209 var MAX_SAFE_INTEGER = 9007199254740991;
21210 var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
21211 var SQRT_BASE = 1e7;
21213 function clone(configObject) {
21214 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 = {
21217 secondaryGroupSize: 0,
21218 groupSeparator: ",",
21219 decimalSeparator: ".",
21220 fractionGroupSize: 0,
21221 fractionGroupSeparator: "\xA0",
21222 // non-breaking space
21224 }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
21225 function BigNumber2(v2, b2) {
21226 var alphabet, c2, caseChanged, e3, i3, isNum, len, str, x2 = this;
21227 if (!(x2 instanceof BigNumber2)) return new BigNumber2(v2, b2);
21229 if (v2 && v2._isBigNumber === true) {
21231 if (!v2.c || v2.e > MAX_EXP) {
21232 x2.c = x2.e = null;
21233 } else if (v2.e < MIN_EXP) {
21237 x2.c = v2.c.slice();
21241 if ((isNum = typeof v2 == "number") && v2 * 0 == 0) {
21242 x2.s = 1 / v2 < 0 ? (v2 = -v2, -1) : 1;
21244 for (e3 = 0, i3 = v2; i3 >= 10; i3 /= 10, e3++) ;
21245 if (e3 > MAX_EXP) {
21246 x2.c = x2.e = null;
21255 if (!isNumeric.test(str = String(v2))) return parseNumeric2(x2, str, isNum);
21256 x2.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
21258 if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
21259 if ((i3 = str.search(/e/i)) > 0) {
21260 if (e3 < 0) e3 = i3;
21261 e3 += +str.slice(i3 + 1);
21262 str = str.substring(0, i3);
21263 } else if (e3 < 0) {
21267 intCheck(b2, 2, ALPHABET.length, "Base");
21268 if (b2 == 10 && alphabetHasNormalDecimalDigits) {
21269 x2 = new BigNumber2(v2);
21270 return round(x2, DECIMAL_PLACES + x2.e + 1, ROUNDING_MODE);
21273 if (isNum = typeof v2 == "number") {
21274 if (v2 * 0 != 0) return parseNumeric2(x2, str, isNum, b2);
21275 x2.s = 1 / v2 < 0 ? (str = str.slice(1), -1) : 1;
21276 if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
21277 throw Error(tooManyDigits + v2);
21280 x2.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
21282 alphabet = ALPHABET.slice(0, b2);
21284 for (len = str.length; i3 < len; i3++) {
21285 if (alphabet.indexOf(c2 = str.charAt(i3)) < 0) {
21291 } else if (!caseChanged) {
21292 if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
21293 caseChanged = true;
21299 return parseNumeric2(x2, String(v2), isNum, b2);
21303 str = convertBase(str, b2, 10, x2.s);
21304 if ((e3 = str.indexOf(".")) > -1) str = str.replace(".", "");
21305 else e3 = str.length;
21307 for (i3 = 0; str.charCodeAt(i3) === 48; i3++) ;
21308 for (len = str.length; str.charCodeAt(--len) === 48; ) ;
21309 if (str = str.slice(i3, ++len)) {
21311 if (isNum && BigNumber2.DEBUG && len > 15 && (v2 > MAX_SAFE_INTEGER || v2 !== mathfloor(v2))) {
21312 throw Error(tooManyDigits + x2.s * v2);
21314 if ((e3 = e3 - i3 - 1) > MAX_EXP) {
21315 x2.c = x2.e = null;
21316 } else if (e3 < MIN_EXP) {
21321 i3 = (e3 + 1) % LOG_BASE;
21322 if (e3 < 0) i3 += LOG_BASE;
21324 if (i3) x2.c.push(+str.slice(0, i3));
21325 for (len -= LOG_BASE; i3 < len; ) {
21326 x2.c.push(+str.slice(i3, i3 += LOG_BASE));
21328 i3 = LOG_BASE - (str = str.slice(i3)).length;
21332 for (; i3--; str += "0") ;
21339 BigNumber2.clone = clone;
21340 BigNumber2.ROUND_UP = 0;
21341 BigNumber2.ROUND_DOWN = 1;
21342 BigNumber2.ROUND_CEIL = 2;
21343 BigNumber2.ROUND_FLOOR = 3;
21344 BigNumber2.ROUND_HALF_UP = 4;
21345 BigNumber2.ROUND_HALF_DOWN = 5;
21346 BigNumber2.ROUND_HALF_EVEN = 6;
21347 BigNumber2.ROUND_HALF_CEIL = 7;
21348 BigNumber2.ROUND_HALF_FLOOR = 8;
21349 BigNumber2.EUCLID = 9;
21350 BigNumber2.config = BigNumber2.set = function(obj) {
21353 if (typeof obj == "object") {
21354 if (obj.hasOwnProperty(p2 = "DECIMAL_PLACES")) {
21356 intCheck(v2, 0, MAX, p2);
21357 DECIMAL_PLACES = v2;
21359 if (obj.hasOwnProperty(p2 = "ROUNDING_MODE")) {
21361 intCheck(v2, 0, 8, p2);
21362 ROUNDING_MODE = v2;
21364 if (obj.hasOwnProperty(p2 = "EXPONENTIAL_AT")) {
21366 if (v2 && v2.pop) {
21367 intCheck(v2[0], -MAX, 0, p2);
21368 intCheck(v2[1], 0, MAX, p2);
21369 TO_EXP_NEG = v2[0];
21370 TO_EXP_POS = v2[1];
21372 intCheck(v2, -MAX, MAX, p2);
21373 TO_EXP_NEG = -(TO_EXP_POS = v2 < 0 ? -v2 : v2);
21376 if (obj.hasOwnProperty(p2 = "RANGE")) {
21378 if (v2 && v2.pop) {
21379 intCheck(v2[0], -MAX, -1, p2);
21380 intCheck(v2[1], 1, MAX, p2);
21384 intCheck(v2, -MAX, MAX, p2);
21386 MIN_EXP = -(MAX_EXP = v2 < 0 ? -v2 : v2);
21388 throw Error(bignumberError + p2 + " cannot be zero: " + v2);
21392 if (obj.hasOwnProperty(p2 = "CRYPTO")) {
21396 if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
21400 throw Error(bignumberError + "crypto unavailable");
21406 throw Error(bignumberError + p2 + " not true or false: " + v2);
21409 if (obj.hasOwnProperty(p2 = "MODULO_MODE")) {
21411 intCheck(v2, 0, 9, p2);
21414 if (obj.hasOwnProperty(p2 = "POW_PRECISION")) {
21416 intCheck(v2, 0, MAX, p2);
21417 POW_PRECISION = v2;
21419 if (obj.hasOwnProperty(p2 = "FORMAT")) {
21421 if (typeof v2 == "object") FORMAT = v2;
21422 else throw Error(bignumberError + p2 + " not an object: " + v2);
21424 if (obj.hasOwnProperty(p2 = "ALPHABET")) {
21426 if (typeof v2 == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v2)) {
21427 alphabetHasNormalDecimalDigits = v2.slice(0, 10) == "0123456789";
21430 throw Error(bignumberError + p2 + " invalid: " + v2);
21434 throw Error(bignumberError + "Object expected: " + obj);
21440 EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
21441 RANGE: [MIN_EXP, MAX_EXP],
21449 BigNumber2.isBigNumber = function(v2) {
21450 if (!v2 || v2._isBigNumber !== true) return false;
21451 if (!BigNumber2.DEBUG) return true;
21452 var i3, n3, c2 = v2.c, e3 = v2.e, s2 = v2.s;
21453 out: if ({}.toString.call(c2) == "[object Array]") {
21454 if ((s2 === 1 || s2 === -1) && e3 >= -MAX && e3 <= MAX && e3 === mathfloor(e3)) {
21456 if (e3 === 0 && c2.length === 1) return true;
21459 i3 = (e3 + 1) % LOG_BASE;
21460 if (i3 < 1) i3 += LOG_BASE;
21461 if (String(c2[0]).length == i3) {
21462 for (i3 = 0; i3 < c2.length; i3++) {
21464 if (n3 < 0 || n3 >= BASE || n3 !== mathfloor(n3)) break out;
21466 if (n3 !== 0) return true;
21469 } else if (c2 === null && e3 === null && (s2 === null || s2 === 1 || s2 === -1)) {
21472 throw Error(bignumberError + "Invalid BigNumber: " + v2);
21474 BigNumber2.maximum = BigNumber2.max = function() {
21475 return maxOrMin(arguments, -1);
21477 BigNumber2.minimum = BigNumber2.min = function() {
21478 return maxOrMin(arguments, 1);
21480 BigNumber2.random = function() {
21481 var pow2_53 = 9007199254740992;
21482 var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
21483 return mathfloor(Math.random() * pow2_53);
21485 return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
21487 return function(dp) {
21488 var a2, b2, e3, k2, v2, i3 = 0, c2 = [], rand = new BigNumber2(ONE);
21489 if (dp == null) dp = DECIMAL_PLACES;
21490 else intCheck(dp, 0, MAX);
21491 k2 = mathceil(dp / LOG_BASE);
21493 if (crypto.getRandomValues) {
21494 a2 = crypto.getRandomValues(new Uint32Array(k2 *= 2));
21495 for (; i3 < k2; ) {
21496 v2 = a2[i3] * 131072 + (a2[i3 + 1] >>> 11);
21498 b2 = crypto.getRandomValues(new Uint32Array(2));
21500 a2[i3 + 1] = b2[1];
21502 c2.push(v2 % 1e14);
21507 } else if (crypto.randomBytes) {
21508 a2 = crypto.randomBytes(k2 *= 7);
21509 for (; i3 < k2; ) {
21510 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];
21512 crypto.randomBytes(7).copy(a2, i3);
21514 c2.push(v2 % 1e14);
21521 throw Error(bignumberError + "crypto unavailable");
21525 for (; i3 < k2; ) {
21526 v2 = random53bitInt();
21527 if (v2 < 9e15) c2[i3++] = v2 % 1e14;
21533 v2 = POWS_TEN[LOG_BASE - dp];
21534 c2[i3] = mathfloor(k2 / v2) * v2;
21536 for (; c2[i3] === 0; c2.pop(), i3--) ;
21540 for (e3 = -1; c2[0] === 0; c2.splice(0, 1), e3 -= LOG_BASE) ;
21541 for (i3 = 1, v2 = c2[0]; v2 >= 10; v2 /= 10, i3++) ;
21542 if (i3 < LOG_BASE) e3 -= LOG_BASE - i3;
21549 BigNumber2.sum = function() {
21550 var i3 = 1, args = arguments, sum = new BigNumber2(args[0]);
21551 for (; i3 < args.length; ) sum = sum.plus(args[i3++]);
21554 convertBase = /* @__PURE__ */ function() {
21555 var decimal = "0123456789";
21556 function toBaseOut(str, baseIn, baseOut, alphabet) {
21557 var j2, arr = [0], arrL, i3 = 0, len = str.length;
21558 for (; i3 < len; ) {
21559 for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
21560 arr[0] += alphabet.indexOf(str.charAt(i3++));
21561 for (j2 = 0; j2 < arr.length; j2++) {
21562 if (arr[j2] > baseOut - 1) {
21563 if (arr[j2 + 1] == null) arr[j2 + 1] = 0;
21564 arr[j2 + 1] += arr[j2] / baseOut | 0;
21565 arr[j2] %= baseOut;
21569 return arr.reverse();
21571 return function(str, baseIn, baseOut, sign2, callerIsToString) {
21572 var alphabet, d2, e3, k2, r2, x2, xc, y2, i3 = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
21574 k2 = POW_PRECISION;
21576 str = str.replace(".", "");
21577 y2 = new BigNumber2(baseIn);
21578 x2 = y2.pow(str.length - i3);
21579 POW_PRECISION = k2;
21581 toFixedPoint(coeffToString(x2.c), x2.e, "0"),
21586 y2.e = y2.c.length;
21588 xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
21589 e3 = k2 = xc.length;
21590 for (; xc[--k2] == 0; xc.pop()) ;
21591 if (!xc[0]) return alphabet.charAt(0);
21598 x2 = div(x2, y2, dp, rm, baseOut);
21606 r2 = r2 || d2 < 0 || xc[d2 + 1] != null;
21607 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));
21608 if (d2 < 1 || !xc[0]) {
21609 str = r2 ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
21613 for (--baseOut; ++xc[--d2] > baseOut; ) {
21617 xc = [1].concat(xc);
21621 for (k2 = xc.length; !xc[--k2]; ) ;
21622 for (i3 = 0, str = ""; i3 <= k2; str += alphabet.charAt(xc[i3++])) ;
21623 str = toFixedPoint(str, e3, alphabet.charAt(0));
21628 div = /* @__PURE__ */ function() {
21629 function multiply(x2, k2, base) {
21630 var m2, temp, xlo, xhi, carry = 0, i3 = x2.length, klo = k2 % SQRT_BASE, khi = k2 / SQRT_BASE | 0;
21631 for (x2 = x2.slice(); i3--; ) {
21632 xlo = x2[i3] % SQRT_BASE;
21633 xhi = x2[i3] / SQRT_BASE | 0;
21634 m2 = khi * xlo + xhi * klo;
21635 temp = klo * xlo + m2 % SQRT_BASE * SQRT_BASE + carry;
21636 carry = (temp / base | 0) + (m2 / SQRT_BASE | 0) + khi * xhi;
21637 x2[i3] = temp % base;
21639 if (carry) x2 = [carry].concat(x2);
21642 function compare2(a2, b2, aL, bL) {
21645 cmp = aL > bL ? 1 : -1;
21647 for (i3 = cmp = 0; i3 < aL; i3++) {
21648 if (a2[i3] != b2[i3]) {
21649 cmp = a2[i3] > b2[i3] ? 1 : -1;
21656 function subtract(a2, b2, aL, base) {
21660 i3 = a2[aL] < b2[aL] ? 1 : 0;
21661 a2[aL] = i3 * base + a2[aL] - b2[aL];
21663 for (; !a2[0] && a2.length > 1; a2.splice(0, 1)) ;
21665 return function(x2, y2, dp, rm, base) {
21666 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;
21667 if (!xc || !xc[0] || !yc || !yc[0]) {
21668 return new BigNumber2(
21669 // Return NaN if either NaN, or both Infinity or 0.
21670 !x2.s || !y2.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
21671 // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
21672 xc && xc[0] == 0 || !yc ? s2 * 0 : s2 / 0
21676 q2 = new BigNumber2(s2);
21682 e3 = bitFloor(x2.e / LOG_BASE) - bitFloor(y2.e / LOG_BASE);
21683 s2 = s2 / LOG_BASE | 0;
21685 for (i3 = 0; yc[i3] == (xc[i3] || 0); i3++) ;
21686 if (yc[i3] > (xc[i3] || 0)) e3--;
21695 n3 = mathfloor(base / (yc[0] + 1));
21697 yc = multiply(yc, n3, base);
21698 xc = multiply(xc, n3, base);
21703 rem = xc.slice(0, yL);
21705 for (; remL < yL; rem[remL++] = 0) ;
21707 yz = [0].concat(yz);
21709 if (yc[1] >= base / 2) yc0++;
21712 cmp = compare2(yc, rem, yL, remL);
21715 if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
21716 n3 = mathfloor(rem0 / yc0);
21718 if (n3 >= base) n3 = base - 1;
21719 prod = multiply(yc, n3, base);
21720 prodL = prod.length;
21722 while (compare2(prod, rem, prodL, remL) == 1) {
21724 subtract(prod, yL < prodL ? yz : yc, prodL, base);
21725 prodL = prod.length;
21733 prodL = prod.length;
21735 if (prodL < remL) prod = [0].concat(prod);
21736 subtract(rem, prod, remL, base);
21739 while (compare2(yc, rem, yL, remL) < 1) {
21741 subtract(rem, yL < remL ? yz : yc, remL, base);
21745 } else if (cmp === 0) {
21751 rem[remL++] = xc[xi] || 0;
21756 } while ((xi++ < xL || rem[0] != null) && s2--);
21757 more = rem[0] != null;
21758 if (!qc[0]) qc.splice(0, 1);
21760 if (base == BASE) {
21761 for (i3 = 1, s2 = qc[0]; s2 >= 10; s2 /= 10, i3++) ;
21762 round(q2, dp + (q2.e = i3 + e3 * LOG_BASE - 1) + 1, rm, more);
21770 function format2(n3, i3, rm, id2) {
21771 var c0, e3, ne2, len, str;
21772 if (rm == null) rm = ROUNDING_MODE;
21773 else intCheck(rm, 0, 8);
21774 if (!n3.c) return n3.toString();
21778 str = coeffToString(n3.c);
21779 str = id2 == 1 || id2 == 2 && (ne2 <= TO_EXP_NEG || ne2 >= TO_EXP_POS) ? toExponential(str, ne2) : toFixedPoint(str, ne2, "0");
21781 n3 = round(new BigNumber2(n3), i3, rm);
21783 str = coeffToString(n3.c);
21785 if (id2 == 1 || id2 == 2 && (i3 <= e3 || e3 <= TO_EXP_NEG)) {
21786 for (; len < i3; str += "0", len++) ;
21787 str = toExponential(str, e3);
21790 str = toFixedPoint(str, e3, "0");
21791 if (e3 + 1 > len) {
21792 if (--i3 > 0) for (str += "."; i3--; str += "0") ;
21796 if (e3 + 1 == len) str += ".";
21797 for (; i3--; str += "0") ;
21802 return n3.s < 0 && c0 ? "-" + str : str;
21804 function maxOrMin(args, n3) {
21805 var k2, y2, i3 = 1, x2 = new BigNumber2(args[0]);
21806 for (; i3 < args.length; i3++) {
21807 y2 = new BigNumber2(args[i3]);
21808 if (!y2.s || (k2 = compare(x2, y2)) === n3 || k2 === 0 && x2.s === n3) {
21814 function normalise(n3, c2, e3) {
21815 var i3 = 1, j2 = c2.length;
21816 for (; !c2[--j2]; c2.pop()) ;
21817 for (j2 = c2[0]; j2 >= 10; j2 /= 10, i3++) ;
21818 if ((e3 = i3 + e3 * LOG_BASE - 1) > MAX_EXP) {
21819 n3.c = n3.e = null;
21820 } else if (e3 < MIN_EXP) {
21828 parseNumeric2 = /* @__PURE__ */ function() {
21829 var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
21830 return function(x2, str, isNum, b2) {
21831 var base, s2 = isNum ? str : str.replace(whitespaceOrPlus, "");
21832 if (isInfinityOrNaN.test(s2)) {
21833 x2.s = isNaN(s2) ? null : s2 < 0 ? -1 : 1;
21836 s2 = s2.replace(basePrefix, function(m2, p1, p2) {
21837 base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
21838 return !b2 || b2 == base ? p1 : m2;
21842 s2 = s2.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
21844 if (str != s2) return new BigNumber2(s2, base);
21846 if (BigNumber2.DEBUG) {
21847 throw Error(bignumberError + "Not a" + (b2 ? " base " + b2 : "") + " number: " + str);
21851 x2.c = x2.e = null;
21854 function round(x2, sd, rm, r2) {
21855 var d2, i3, j2, k2, n3, ni, rd, xc = x2.c, pows10 = POWS_TEN;
21858 for (d2 = 1, k2 = xc[0]; k2 >= 10; k2 /= 10, d2++) ;
21864 rd = mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
21866 ni = mathceil((i3 + 1) / LOG_BASE);
21867 if (ni >= xc.length) {
21869 for (; xc.length <= ni; xc.push(0)) ;
21873 j2 = i3 - LOG_BASE + 1;
21879 for (d2 = 1; k2 >= 10; k2 /= 10, d2++) ;
21881 j2 = i3 - LOG_BASE + d2;
21882 rd = j2 < 0 ? 0 : mathfloor(n3 / pows10[d2 - j2 - 1] % 10);
21885 r2 = r2 || sd < 0 || // Are there any non-zero digits after the rounding digit?
21886 // The expression n % pows10[d - j - 1] returns all digits of n to the right
21887 // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
21888 xc[ni + 1] != null || (j2 < 0 ? n3 : n3 % pows10[d2 - j2 - 1]);
21889 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.
21890 (i3 > 0 ? j2 > 0 ? n3 / pows10[d2 - j2] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x2.s < 0 ? 8 : 7));
21891 if (sd < 1 || !xc[0]) {
21895 xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
21907 xc.length = ni + 1;
21908 k2 = pows10[LOG_BASE - i3];
21909 xc[ni] = j2 > 0 ? mathfloor(n3 / pows10[d2 - j2] % pows10[j2]) * k2 : 0;
21914 for (i3 = 1, j2 = xc[0]; j2 >= 10; j2 /= 10, i3++) ;
21916 for (k2 = 1; j2 >= 10; j2 /= 10, k2++) ;
21919 if (xc[0] == BASE) xc[0] = 1;
21924 if (xc[ni] != BASE) break;
21930 for (i3 = xc.length; xc[--i3] === 0; xc.pop()) ;
21932 if (x2.e > MAX_EXP) {
21933 x2.c = x2.e = null;
21934 } else if (x2.e < MIN_EXP) {
21940 function valueOf(n3) {
21941 var str, e3 = n3.e;
21942 if (e3 === null) return n3.toString();
21943 str = coeffToString(n3.c);
21944 str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(str, e3) : toFixedPoint(str, e3, "0");
21945 return n3.s < 0 ? "-" + str : str;
21947 P2.absoluteValue = P2.abs = function() {
21948 var x2 = new BigNumber2(this);
21949 if (x2.s < 0) x2.s = 1;
21952 P2.comparedTo = function(y2, b2) {
21953 return compare(this, new BigNumber2(y2, b2));
21955 P2.decimalPlaces = P2.dp = function(dp, rm) {
21956 var c2, n3, v2, x2 = this;
21958 intCheck(dp, 0, MAX);
21959 if (rm == null) rm = ROUNDING_MODE;
21960 else intCheck(rm, 0, 8);
21961 return round(new BigNumber2(x2), dp + x2.e + 1, rm);
21963 if (!(c2 = x2.c)) return null;
21964 n3 = ((v2 = c2.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
21965 if (v2 = c2[v2]) for (; v2 % 10 == 0; v2 /= 10, n3--) ;
21966 if (n3 < 0) n3 = 0;
21969 P2.dividedBy = P2.div = function(y2, b2) {
21970 return div(this, new BigNumber2(y2, b2), DECIMAL_PLACES, ROUNDING_MODE);
21972 P2.dividedToIntegerBy = P2.idiv = function(y2, b2) {
21973 return div(this, new BigNumber2(y2, b2), 0, 1);
21975 P2.exponentiatedBy = P2.pow = function(n3, m2) {
21976 var half, isModExp, i3, k2, more, nIsBig, nIsNeg, nIsOdd, y2, x2 = this;
21977 n3 = new BigNumber2(n3);
21978 if (n3.c && !n3.isInteger()) {
21979 throw Error(bignumberError + "Exponent not an integer: " + valueOf(n3));
21981 if (m2 != null) m2 = new BigNumber2(m2);
21982 nIsBig = n3.e > 14;
21983 if (!x2.c || !x2.c[0] || x2.c[0] == 1 && !x2.e && x2.c.length == 1 || !n3.c || !n3.c[0]) {
21984 y2 = new BigNumber2(Math.pow(+valueOf(x2), nIsBig ? n3.s * (2 - isOdd(n3)) : +valueOf(n3)));
21985 return m2 ? y2.mod(m2) : y2;
21989 if (m2.c ? !m2.c[0] : !m2.s) return new BigNumber2(NaN);
21990 isModExp = !nIsNeg && x2.isInteger() && m2.isInteger();
21991 if (isModExp) x2 = x2.mod(m2);
21992 } 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))) {
21993 k2 = x2.s < 0 && isOdd(n3) ? -0 : 0;
21994 if (x2.e > -1) k2 = 1 / k2;
21995 return new BigNumber2(nIsNeg ? 1 / k2 : k2);
21996 } else if (POW_PRECISION) {
21997 k2 = mathceil(POW_PRECISION / LOG_BASE + 2);
22000 half = new BigNumber2(0.5);
22001 if (nIsNeg) n3.s = 1;
22002 nIsOdd = isOdd(n3);
22004 i3 = Math.abs(+valueOf(n3));
22007 y2 = new BigNumber2(ONE);
22013 if (y2.c.length > k2) y2.c.length = k2;
22014 } else if (isModExp) {
22019 i3 = mathfloor(i3 / 2);
22020 if (i3 === 0) break;
22023 n3 = n3.times(half);
22024 round(n3, n3.e + 1, 1);
22026 nIsOdd = isOdd(n3);
22029 if (i3 === 0) break;
22035 if (x2.c && x2.c.length > k2) x2.c.length = k2;
22036 } else if (isModExp) {
22040 if (isModExp) return y2;
22041 if (nIsNeg) y2 = ONE.div(y2);
22042 return m2 ? y2.mod(m2) : k2 ? round(y2, POW_PRECISION, ROUNDING_MODE, more) : y2;
22044 P2.integerValue = function(rm) {
22045 var n3 = new BigNumber2(this);
22046 if (rm == null) rm = ROUNDING_MODE;
22047 else intCheck(rm, 0, 8);
22048 return round(n3, n3.e + 1, rm);
22050 P2.isEqualTo = P2.eq = function(y2, b2) {
22051 return compare(this, new BigNumber2(y2, b2)) === 0;
22053 P2.isFinite = function() {
22056 P2.isGreaterThan = P2.gt = function(y2, b2) {
22057 return compare(this, new BigNumber2(y2, b2)) > 0;
22059 P2.isGreaterThanOrEqualTo = P2.gte = function(y2, b2) {
22060 return (b2 = compare(this, new BigNumber2(y2, b2))) === 1 || b2 === 0;
22062 P2.isInteger = function() {
22063 return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
22065 P2.isLessThan = P2.lt = function(y2, b2) {
22066 return compare(this, new BigNumber2(y2, b2)) < 0;
22068 P2.isLessThanOrEqualTo = P2.lte = function(y2, b2) {
22069 return (b2 = compare(this, new BigNumber2(y2, b2))) === -1 || b2 === 0;
22071 P2.isNaN = function() {
22074 P2.isNegative = function() {
22077 P2.isPositive = function() {
22080 P2.isZero = function() {
22081 return !!this.c && this.c[0] == 0;
22083 P2.minus = function(y2, b2) {
22084 var i3, j2, t2, xLTy, x2 = this, a2 = x2.s;
22085 y2 = new BigNumber2(y2, b2);
22087 if (!a2 || !b2) return new BigNumber2(NaN);
22090 return x2.plus(y2);
22092 var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
22093 if (!xe2 || !ye2) {
22094 if (!xc || !yc) return xc ? (y2.s = -b2, y2) : new BigNumber2(yc ? x2 : NaN);
22095 if (!xc[0] || !yc[0]) {
22096 return yc[0] ? (y2.s = -b2, y2) : new BigNumber2(xc[0] ? x2 : (
22097 // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
22098 ROUNDING_MODE == 3 ? -0 : 0
22102 xe2 = bitFloor(xe2);
22103 ye2 = bitFloor(ye2);
22105 if (a2 = xe2 - ye2) {
22106 if (xLTy = a2 < 0) {
22114 for (b2 = a2; b2--; t2.push(0)) ;
22117 j2 = (xLTy = (a2 = xc.length) < (b2 = yc.length)) ? a2 : b2;
22118 for (a2 = b2 = 0; b2 < j2; b2++) {
22119 if (xc[b2] != yc[b2]) {
22120 xLTy = xc[b2] < yc[b2];
22131 b2 = (j2 = yc.length) - (i3 = xc.length);
22132 if (b2 > 0) for (; b2--; xc[i3++] = 0) ;
22134 for (; j2 > a2; ) {
22135 if (xc[--j2] < yc[j2]) {
22136 for (i3 = j2; i3 && !xc[--i3]; xc[i3] = b2) ;
22142 for (; xc[0] == 0; xc.splice(0, 1), --ye2) ;
22144 y2.s = ROUNDING_MODE == 3 ? -1 : 1;
22148 return normalise(y2, xc, ye2);
22150 P2.modulo = P2.mod = function(y2, b2) {
22151 var q2, s2, x2 = this;
22152 y2 = new BigNumber2(y2, b2);
22153 if (!x2.c || !y2.s || y2.c && !y2.c[0]) {
22154 return new BigNumber2(NaN);
22155 } else if (!y2.c || x2.c && !x2.c[0]) {
22156 return new BigNumber2(x2);
22158 if (MODULO_MODE == 9) {
22161 q2 = div(x2, y2, 0, 3);
22165 q2 = div(x2, y2, 0, MODULO_MODE);
22167 y2 = x2.minus(q2.times(y2));
22168 if (!y2.c[0] && MODULO_MODE == 1) y2.s = x2.s;
22171 P2.multipliedBy = P2.times = function(y2, b2) {
22172 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;
22173 if (!xc || !yc || !xc[0] || !yc[0]) {
22174 if (!x2.s || !y2.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
22175 y2.c = y2.e = y2.s = null;
22179 y2.c = y2.e = null;
22187 e3 = bitFloor(x2.e / LOG_BASE) + bitFloor(y2.e / LOG_BASE);
22199 for (i3 = xcL + ycL, zc = []; i3--; zc.push(0)) ;
22201 sqrtBase = SQRT_BASE;
22202 for (i3 = ycL; --i3 >= 0; ) {
22204 ylo = yc[i3] % sqrtBase;
22205 yhi = yc[i3] / sqrtBase | 0;
22206 for (k2 = xcL, j2 = i3 + k2; j2 > i3; ) {
22207 xlo = xc[--k2] % sqrtBase;
22208 xhi = xc[k2] / sqrtBase | 0;
22209 m2 = yhi * xlo + xhi * ylo;
22210 xlo = ylo * xlo + m2 % sqrtBase * sqrtBase + zc[j2] + c2;
22211 c2 = (xlo / base | 0) + (m2 / sqrtBase | 0) + yhi * xhi;
22212 zc[j2--] = xlo % base;
22221 return normalise(y2, zc, e3);
22223 P2.negated = function() {
22224 var x2 = new BigNumber2(this);
22225 x2.s = -x2.s || null;
22228 P2.plus = function(y2, b2) {
22229 var t2, x2 = this, a2 = x2.s;
22230 y2 = new BigNumber2(y2, b2);
22232 if (!a2 || !b2) return new BigNumber2(NaN);
22235 return x2.minus(y2);
22237 var xe2 = x2.e / LOG_BASE, ye2 = y2.e / LOG_BASE, xc = x2.c, yc = y2.c;
22238 if (!xe2 || !ye2) {
22239 if (!xc || !yc) return new BigNumber2(a2 / 0);
22240 if (!xc[0] || !yc[0]) return yc[0] ? y2 : new BigNumber2(xc[0] ? x2 : a2 * 0);
22242 xe2 = bitFloor(xe2);
22243 ye2 = bitFloor(ye2);
22245 if (a2 = xe2 - ye2) {
22254 for (; a2--; t2.push(0)) ;
22265 for (a2 = 0; b2; ) {
22266 a2 = (xc[--b2] = xc[b2] + yc[b2] + a2) / BASE | 0;
22267 xc[b2] = BASE === xc[b2] ? 0 : xc[b2] % BASE;
22270 xc = [a2].concat(xc);
22273 return normalise(y2, xc, ye2);
22275 P2.precision = P2.sd = function(sd, rm) {
22276 var c2, n3, v2, x2 = this;
22277 if (sd != null && sd !== !!sd) {
22278 intCheck(sd, 1, MAX);
22279 if (rm == null) rm = ROUNDING_MODE;
22280 else intCheck(rm, 0, 8);
22281 return round(new BigNumber2(x2), sd, rm);
22283 if (!(c2 = x2.c)) return null;
22284 v2 = c2.length - 1;
22285 n3 = v2 * LOG_BASE + 1;
22287 for (; v2 % 10 == 0; v2 /= 10, n3--) ;
22288 for (v2 = c2[0]; v2 >= 10; v2 /= 10, n3++) ;
22290 if (sd && x2.e + 1 > n3) n3 = x2.e + 1;
22293 P2.shiftedBy = function(k2) {
22294 intCheck(k2, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
22295 return this.times("1e" + k2);
22297 P2.squareRoot = P2.sqrt = function() {
22298 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");
22299 if (s2 !== 1 || !c2 || !c2[0]) {
22300 return new BigNumber2(!s2 || s2 < 0 && (!c2 || c2[0]) ? NaN : c2 ? x2 : 1 / 0);
22302 s2 = Math.sqrt(+valueOf(x2));
22303 if (s2 == 0 || s2 == 1 / 0) {
22304 n3 = coeffToString(c2);
22305 if ((n3.length + e3) % 2 == 0) n3 += "0";
22306 s2 = Math.sqrt(+n3);
22307 e3 = bitFloor((e3 + 1) / 2) - (e3 < 0 || e3 % 2);
22311 n3 = s2.toExponential();
22312 n3 = n3.slice(0, n3.indexOf("e") + 1) + e3;
22314 r2 = new BigNumber2(n3);
22316 r2 = new BigNumber2(s2 + "");
22321 if (s2 < 3) s2 = 0;
22324 r2 = half.times(t2.plus(div(x2, t2, dp, 1)));
22325 if (coeffToString(t2.c).slice(0, s2) === (n3 = coeffToString(r2.c)).slice(0, s2)) {
22326 if (r2.e < e3) --s2;
22327 n3 = n3.slice(s2 - 3, s2 + 1);
22328 if (n3 == "9999" || !rep && n3 == "4999") {
22330 round(t2, t2.e + DECIMAL_PLACES + 2, 0);
22331 if (t2.times(t2).eq(x2)) {
22340 if (!+n3 || !+n3.slice(1) && n3.charAt(0) == "5") {
22341 round(r2, r2.e + DECIMAL_PLACES + 2, 1);
22342 m2 = !r2.times(r2).eq(x2);
22349 return round(r2, r2.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m2);
22351 P2.toExponential = function(dp, rm) {
22353 intCheck(dp, 0, MAX);
22356 return format2(this, dp, rm, 1);
22358 P2.toFixed = function(dp, rm) {
22360 intCheck(dp, 0, MAX);
22361 dp = dp + this.e + 1;
22363 return format2(this, dp, rm);
22365 P2.toFormat = function(dp, rm, format3) {
22366 var str, x2 = this;
22367 if (format3 == null) {
22368 if (dp != null && rm && typeof rm == "object") {
22371 } else if (dp && typeof dp == "object") {
22377 } else if (typeof format3 != "object") {
22378 throw Error(bignumberError + "Argument not an object: " + format3);
22380 str = x2.toFixed(dp, rm);
22382 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;
22389 if (g1 > 0 && len > 0) {
22390 i3 = len % g1 || g1;
22391 intPart = intDigits.substr(0, i3);
22392 for (; i3 < len; i3 += g1) intPart += groupSeparator + intDigits.substr(i3, g1);
22393 if (g22 > 0) intPart += groupSeparator + intDigits.slice(i3);
22394 if (isNeg) intPart = "-" + intPart;
22396 str = fractionPart ? intPart + (format3.decimalSeparator || "") + ((g22 = +format3.fractionGroupSize) ? fractionPart.replace(
22397 new RegExp("\\d{" + g22 + "}\\B", "g"),
22398 "$&" + (format3.fractionGroupSeparator || "")
22399 ) : fractionPart) : intPart;
22401 return (format3.prefix || "") + str + (format3.suffix || "");
22403 P2.toFraction = function(md) {
22404 var d2, d0, d1, d22, e3, exp2, n3, n0, n1, q2, r2, s2, x2 = this, xc = x2.c;
22406 n3 = new BigNumber2(md);
22407 if (!n3.isInteger() && (n3.c || n3.s !== 1) || n3.lt(ONE)) {
22408 throw Error(bignumberError + "Argument " + (n3.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n3));
22411 if (!xc) return new BigNumber2(x2);
22412 d2 = new BigNumber2(ONE);
22413 n1 = d0 = new BigNumber2(ONE);
22414 d1 = n0 = new BigNumber2(ONE);
22415 s2 = coeffToString(xc);
22416 e3 = d2.e = s2.length - x2.e - 1;
22417 d2.c[0] = POWS_TEN[(exp2 = e3 % LOG_BASE) < 0 ? LOG_BASE + exp2 : exp2];
22418 md = !md || n3.comparedTo(d2) > 0 ? e3 > 0 ? d2 : n1 : n3;
22421 n3 = new BigNumber2(s2);
22424 q2 = div(n3, d2, 0, 1);
22425 d22 = d0.plus(q2.times(d1));
22426 if (d22.comparedTo(md) == 1) break;
22429 n1 = n0.plus(q2.times(d22 = n1));
22431 d2 = n3.minus(q2.times(d22 = d2));
22434 d22 = div(md.minus(d0), d1, 0, 1);
22435 n0 = n0.plus(d22.times(n1));
22436 d0 = d0.plus(d22.times(d1));
22437 n0.s = n1.s = x2.s;
22439 r2 = div(n1, d1, e3, ROUNDING_MODE).minus(x2).abs().comparedTo(
22440 div(n0, d0, e3, ROUNDING_MODE).minus(x2).abs()
22441 ) < 1 ? [n1, d1] : [n0, d0];
22445 P2.toNumber = function() {
22446 return +valueOf(this);
22448 P2.toPrecision = function(sd, rm) {
22449 if (sd != null) intCheck(sd, 1, MAX);
22450 return format2(this, sd, rm, 2);
22452 P2.toString = function(b2) {
22453 var str, n3 = this, s2 = n3.s, e3 = n3.e;
22457 if (s2 < 0) str = "-" + str;
22463 str = e3 <= TO_EXP_NEG || e3 >= TO_EXP_POS ? toExponential(coeffToString(n3.c), e3) : toFixedPoint(coeffToString(n3.c), e3, "0");
22464 } else if (b2 === 10 && alphabetHasNormalDecimalDigits) {
22465 n3 = round(new BigNumber2(n3), DECIMAL_PLACES + e3 + 1, ROUNDING_MODE);
22466 str = toFixedPoint(coeffToString(n3.c), n3.e, "0");
22468 intCheck(b2, 2, ALPHABET.length, "Base");
22469 str = convertBase(toFixedPoint(coeffToString(n3.c), e3, "0"), 10, b2, s2, true);
22471 if (s2 < 0 && n3.c[0]) str = "-" + str;
22475 P2.valueOf = P2.toJSON = function() {
22476 return valueOf(this);
22478 P2._isBigNumber = true;
22479 P2[Symbol.toStringTag] = "BigNumber";
22480 P2[Symbol.for("nodejs.util.inspect.custom")] = P2.valueOf;
22481 if (configObject != null) BigNumber2.set(configObject);
22484 function bitFloor(n3) {
22486 return n3 > 0 || n3 === i3 ? i3 : i3 - 1;
22488 function coeffToString(a2) {
22489 var s2, z2, i3 = 1, j2 = a2.length, r2 = a2[0] + "";
22490 for (; i3 < j2; ) {
22491 s2 = a2[i3++] + "";
22492 z2 = LOG_BASE - s2.length;
22493 for (; z2--; s2 = "0" + s2) ;
22496 for (j2 = r2.length; r2.charCodeAt(--j2) === 48; ) ;
22497 return r2.slice(0, j2 + 1 || 1);
22499 function compare(x2, y2) {
22500 var a2, b2, xc = x2.c, yc = y2.c, i3 = x2.s, j2 = y2.s, k2 = x2.e, l2 = y2.e;
22501 if (!i3 || !j2) return null;
22504 if (a2 || b2) return a2 ? b2 ? 0 : -j2 : i3;
22505 if (i3 != j2) return i3;
22508 if (!xc || !yc) return b2 ? 0 : !xc ^ a2 ? 1 : -1;
22509 if (!b2) return k2 > l2 ^ a2 ? 1 : -1;
22510 j2 = (k2 = xc.length) < (l2 = yc.length) ? k2 : l2;
22511 for (i3 = 0; i3 < j2; i3++) if (xc[i3] != yc[i3]) return xc[i3] > yc[i3] ^ a2 ? 1 : -1;
22512 return k2 == l2 ? 0 : k2 > l2 ^ a2 ? 1 : -1;
22514 function intCheck(n3, min3, max3, name) {
22515 if (n3 < min3 || n3 > max3 || n3 !== mathfloor(n3)) {
22516 throw Error(bignumberError + (name || "Argument") + (typeof n3 == "number" ? n3 < min3 || n3 > max3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n3));
22519 function isOdd(n3) {
22520 var k2 = n3.c.length - 1;
22521 return bitFloor(n3.e / LOG_BASE) == k2 && n3.c[k2] % 2 != 0;
22523 function toExponential(str, e3) {
22524 return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e3 < 0 ? "e" : "e+") + e3;
22526 function toFixedPoint(str, e3, z2) {
22529 for (zs = z2 + "."; ++e3; zs += z2) ;
22534 for (zs = z2, e3 -= len; --e3; zs += z2) ;
22536 } else if (e3 < len) {
22537 str = str.slice(0, e3) + "." + str.slice(e3);
22542 var BigNumber = clone();
22543 var bignumber_default = BigNumber;
22545 // node_modules/splaytree-ts/dist/index.js
22546 var SplayTreeNode = class {
22548 __publicField(this, "key");
22549 __publicField(this, "left", null);
22550 __publicField(this, "right", null);
22554 var SplayTreeSetNode = class extends SplayTreeNode {
22559 var SplayTreeMapNode = class _SplayTreeMapNode extends SplayTreeNode {
22560 constructor(key, value) {
22562 __publicField(this, "value");
22563 this.value = value;
22565 replaceValue(value) {
22566 const node = new _SplayTreeMapNode(this.key, value);
22567 node.left = this.left;
22568 node.right = this.right;
22572 var SplayTree = class {
22574 __publicField(this, "size", 0);
22575 __publicField(this, "modificationCount", 0);
22576 __publicField(this, "splayCount", 0);
22579 const root3 = this.root;
22580 if (root3 == null) {
22581 this.compare(key, key);
22585 let newTreeRight = null;
22587 let newTreeLeft = null;
22588 let current = root3;
22589 const compare2 = this.compare;
22592 comp = compare2(current.key, key);
22594 let currentLeft = current.left;
22595 if (currentLeft == null)
22597 comp = compare2(currentLeft.key, key);
22599 current.left = currentLeft.right;
22600 currentLeft.right = current;
22601 current = currentLeft;
22602 currentLeft = current.left;
22603 if (currentLeft == null)
22606 if (right == null) {
22607 newTreeRight = current;
22609 right.left = current;
22612 current = currentLeft;
22613 } else if (comp < 0) {
22614 let currentRight = current.right;
22615 if (currentRight == null)
22617 comp = compare2(currentRight.key, key);
22619 current.right = currentRight.left;
22620 currentRight.left = current;
22621 current = currentRight;
22622 currentRight = current.right;
22623 if (currentRight == null)
22626 if (left == null) {
22627 newTreeLeft = current;
22629 left.right = current;
22632 current = currentRight;
22637 if (left != null) {
22638 left.right = current.left;
22639 current.left = newTreeLeft;
22641 if (right != null) {
22642 right.left = current.right;
22643 current.right = newTreeRight;
22645 if (this.root !== current) {
22646 this.root = current;
22652 let current = node;
22653 let nextLeft = current.left;
22654 while (nextLeft != null) {
22655 const left = nextLeft;
22656 current.left = left.right;
22657 left.right = current;
22659 nextLeft = current.left;
22664 let current = node;
22665 let nextRight = current.right;
22666 while (nextRight != null) {
22667 const right = nextRight;
22668 current.right = right.left;
22669 right.left = current;
22671 nextRight = current.right;
22676 if (this.root == null)
22678 const comp = this.splay(key);
22681 let root3 = this.root;
22682 const result = root3;
22683 const left = root3.left;
22685 if (left == null) {
22686 this.root = root3.right;
22688 const right = root3.right;
22689 root3 = this.splayMax(left);
22690 root3.right = right;
22693 this.modificationCount++;
22696 addNewRoot(node, comp) {
22698 this.modificationCount++;
22699 const root3 = this.root;
22700 if (root3 == null) {
22706 node.right = root3.right;
22707 root3.right = null;
22709 node.right = root3;
22710 node.left = root3.left;
22716 const root3 = this.root;
22719 this.root = this.splayMin(root3);
22723 const root3 = this.root;
22726 this.root = this.splayMax(root3);
22732 this.modificationCount++;
22735 return this.validKey(key) && this.splay(key) == 0;
22738 return (a2, b2) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
22745 setRoot: (root3) => {
22751 getModificationCount: () => {
22752 return this.modificationCount;
22754 getSplayCount: () => {
22755 return this.splayCount;
22757 setSplayCount: (count) => {
22758 this.splayCount = count;
22761 return this.splay(key);
22764 return this.has(key);
22770 var SplayTreeMap = class extends SplayTree {
22771 constructor(compare2, isValidKey) {
22773 __publicField(this, "root", null);
22774 __publicField(this, "compare");
22775 __publicField(this, "validKey");
22776 __publicField(this, _a, "[object Map]");
22777 this.compare = compare2 != null ? compare2 : this.defaultCompare();
22778 this.validKey = isValidKey != null ? isValidKey : (a2) => a2 != null && a2 != void 0;
22781 if (!this.validKey(key))
22783 return this._delete(key) != null;
22786 const nodes = new SplayTreeMapEntryIterableIterator(this.wrap());
22788 while (result = nodes.next(), !result.done) {
22789 f2(result.value[1], result.value[0], this);
22793 if (!this.validKey(key))
22795 if (this.root != null) {
22796 const comp = this.splay(key);
22798 return this.root.value;
22804 const initialSplayCount = this.splayCount;
22805 const visit = (node) => {
22806 while (node != null) {
22807 if (node.value == value)
22809 if (initialSplayCount != this.splayCount) {
22810 throw "Concurrent modification during iteration.";
22812 if (node.right != null && visit(node.right)) {
22819 return visit(this.root);
22822 const comp = this.splay(key);
22824 this.root = this.root.replaceValue(value);
22825 this.splayCount += 1;
22828 this.addNewRoot(new SplayTreeMapNode(key, value), comp);
22832 other.forEach((value, key) => {
22833 this.set(key, value);
22836 setIfAbsent(key, ifAbsent) {
22837 let comp = this.splay(key);
22839 return this.root.value;
22841 const modificationCount = this.modificationCount;
22842 const splayCount = this.splayCount;
22843 const value = ifAbsent();
22844 if (modificationCount != this.modificationCount) {
22845 throw "Concurrent modification during iteration.";
22847 if (splayCount != this.splayCount) {
22848 comp = this.splay(key);
22850 this.addNewRoot(new SplayTreeMapNode(key, value), comp);
22854 return this.root == null;
22857 return !this.isEmpty();
22860 if (this.root == null)
22862 return this._first().key;
22865 if (this.root == null)
22867 return this._last().key;
22869 lastKeyBefore(key) {
22871 throw "Invalid arguments(s)";
22872 if (this.root == null)
22874 const comp = this.splay(key);
22876 return this.root.key;
22877 let node = this.root.left;
22880 let nodeRight = node.right;
22881 while (nodeRight != null) {
22883 nodeRight = node.right;
22887 firstKeyAfter(key) {
22889 throw "Invalid arguments(s)";
22890 if (this.root == null)
22892 const comp = this.splay(key);
22894 return this.root.key;
22895 let node = this.root.right;
22898 let nodeLeft = node.left;
22899 while (nodeLeft != null) {
22901 nodeLeft = node.left;
22905 update(key, update, ifAbsent) {
22906 let comp = this.splay(key);
22908 const modificationCount = this.modificationCount;
22909 const splayCount = this.splayCount;
22910 const newValue = update(this.root.value);
22911 if (modificationCount != this.modificationCount) {
22912 throw "Concurrent modification during iteration.";
22914 if (splayCount != this.splayCount) {
22917 this.root = this.root.replaceValue(newValue);
22918 this.splayCount += 1;
22921 if (ifAbsent != null) {
22922 const modificationCount = this.modificationCount;
22923 const splayCount = this.splayCount;
22924 const newValue = ifAbsent();
22925 if (modificationCount != this.modificationCount) {
22926 throw "Concurrent modification during iteration.";
22928 if (splayCount != this.splayCount) {
22929 comp = this.splay(key);
22931 this.addNewRoot(new SplayTreeMapNode(key, newValue), comp);
22934 throw "Invalid argument (key): Key not in map.";
22936 updateAll(update) {
22937 const root3 = this.root;
22940 const iterator = new SplayTreeMapEntryIterableIterator(this.wrap());
22942 while (node = iterator.next(), !node.done) {
22943 const newValue = update(...node.value);
22944 iterator.replaceValue(newValue);
22948 return new SplayTreeKeyIterableIterator(this.wrap());
22951 return new SplayTreeValueIterableIterator(this.wrap());
22954 return this[Symbol.iterator]();
22956 [(_b = Symbol.iterator, _a = Symbol.toStringTag, _b)]() {
22957 return new SplayTreeMapEntryIterableIterator(this.wrap());
22961 var SplayTreeSet = class _SplayTreeSet extends SplayTree {
22962 constructor(compare2, isValidKey) {
22964 __publicField(this, "root", null);
22965 __publicField(this, "compare");
22966 __publicField(this, "validKey");
22967 __publicField(this, _a2, "[object Set]");
22968 this.compare = compare2 != null ? compare2 : this.defaultCompare();
22969 this.validKey = isValidKey != null ? isValidKey : (v2) => v2 != null && v2 != void 0;
22972 if (!this.validKey(element))
22974 return this._delete(element) != null;
22976 deleteAll(elements) {
22977 for (const element of elements) {
22978 this.delete(element);
22982 const nodes = this[Symbol.iterator]();
22984 while (result = nodes.next(), !result.done) {
22985 f2(result.value, result.value, this);
22989 const compare2 = this.splay(element);
22991 this.addNewRoot(new SplayTreeSetNode(element), compare2);
22994 addAndReturn(element) {
22995 const compare2 = this.splay(element);
22997 this.addNewRoot(new SplayTreeSetNode(element), compare2);
22998 return this.root.key;
23001 for (const element of elements) {
23006 return this.root == null;
23009 return this.root != null;
23012 if (this.size == 0)
23013 throw "Bad state: No element";
23015 throw "Bad state: Too many element";
23016 return this.root.key;
23019 if (this.size == 0)
23020 throw "Bad state: No element";
23021 return this._first().key;
23024 if (this.size == 0)
23025 throw "Bad state: No element";
23026 return this._last().key;
23028 lastBefore(element) {
23029 if (element == null)
23030 throw "Invalid arguments(s)";
23031 if (this.root == null)
23033 const comp = this.splay(element);
23035 return this.root.key;
23036 let node = this.root.left;
23039 let nodeRight = node.right;
23040 while (nodeRight != null) {
23042 nodeRight = node.right;
23046 firstAfter(element) {
23047 if (element == null)
23048 throw "Invalid arguments(s)";
23049 if (this.root == null)
23051 const comp = this.splay(element);
23053 return this.root.key;
23054 let node = this.root.right;
23057 let nodeLeft = node.left;
23058 while (nodeLeft != null) {
23060 nodeLeft = node.left;
23064 retainAll(elements) {
23065 const retainSet = new _SplayTreeSet(this.compare, this.validKey);
23066 const modificationCount = this.modificationCount;
23067 for (const object of elements) {
23068 if (modificationCount != this.modificationCount) {
23069 throw "Concurrent modification during iteration.";
23071 if (this.validKey(object) && this.splay(object) == 0) {
23072 retainSet.add(this.root.key);
23075 if (retainSet.size != this.size) {
23076 this.root = retainSet.root;
23077 this.size = retainSet.size;
23078 this.modificationCount++;
23082 if (!this.validKey(object))
23084 const comp = this.splay(object);
23087 return this.root.key;
23089 intersection(other) {
23090 const result = new _SplayTreeSet(this.compare, this.validKey);
23091 for (const element of this) {
23092 if (other.has(element))
23093 result.add(element);
23097 difference(other) {
23098 const result = new _SplayTreeSet(this.compare, this.validKey);
23099 for (const element of this) {
23100 if (!other.has(element))
23101 result.add(element);
23106 const u2 = this.clone();
23111 const set4 = new _SplayTreeSet(this.compare, this.validKey);
23112 set4.size = this.size;
23113 set4.root = this.copyNode(this.root);
23119 function copyChildren(node2, dest) {
23124 right = node2.right;
23125 if (left != null) {
23126 const newLeft = new SplayTreeSetNode(left.key);
23127 dest.left = newLeft;
23128 copyChildren(left, newLeft);
23130 if (right != null) {
23131 const newRight = new SplayTreeSetNode(right.key);
23132 dest.right = newRight;
23136 } while (right != null);
23138 const result = new SplayTreeSetNode(node.key);
23139 copyChildren(node, result);
23143 return this.clone();
23146 return new SplayTreeSetEntryIterableIterator(this.wrap());
23149 return this[Symbol.iterator]();
23152 return this[Symbol.iterator]();
23154 [(_b2 = Symbol.iterator, _a2 = Symbol.toStringTag, _b2)]() {
23155 return new SplayTreeKeyIterableIterator(this.wrap());
23158 var SplayTreeIterableIterator = class {
23159 constructor(tree) {
23160 __publicField(this, "tree");
23161 __publicField(this, "path", new Array());
23162 __publicField(this, "modificationCount", null);
23163 __publicField(this, "splayCount");
23165 this.splayCount = tree.getSplayCount();
23167 [Symbol.iterator]() {
23171 if (this.moveNext())
23172 return { done: false, value: this.current() };
23173 return { done: true, value: null };
23176 if (!this.path.length)
23178 const node = this.path[this.path.length - 1];
23179 return this.getValue(node);
23182 this.path.splice(0, this.path.length);
23183 this.tree.splay(key);
23184 this.path.push(this.tree.getRoot());
23185 this.splayCount = this.tree.getSplayCount();
23187 findLeftMostDescendent(node) {
23188 while (node != null) {
23189 this.path.push(node);
23194 if (this.modificationCount != this.tree.getModificationCount()) {
23195 if (this.modificationCount == null) {
23196 this.modificationCount = this.tree.getModificationCount();
23197 let node2 = this.tree.getRoot();
23198 while (node2 != null) {
23199 this.path.push(node2);
23200 node2 = node2.left;
23202 return this.path.length > 0;
23204 throw "Concurrent modification during iteration.";
23206 if (!this.path.length)
23208 if (this.splayCount != this.tree.getSplayCount()) {
23209 this.rebuildPath(this.path[this.path.length - 1].key);
23211 let node = this.path[this.path.length - 1];
23212 let next = node.right;
23213 if (next != null) {
23214 while (next != null) {
23215 this.path.push(next);
23221 while (this.path.length && this.path[this.path.length - 1].right === node) {
23222 node = this.path.pop();
23224 return this.path.length > 0;
23227 var SplayTreeKeyIterableIterator = class extends SplayTreeIterableIterator {
23232 var SplayTreeSetEntryIterableIterator = class extends SplayTreeIterableIterator {
23234 return [node.key, node.key];
23237 var SplayTreeValueIterableIterator = class extends SplayTreeIterableIterator {
23238 constructor(map2) {
23245 var SplayTreeMapEntryIterableIterator = class extends SplayTreeIterableIterator {
23246 constructor(map2) {
23250 return [node.key, node.value];
23252 replaceValue(value) {
23253 if (this.modificationCount != this.tree.getModificationCount()) {
23254 throw "Concurrent modification during iteration.";
23256 if (this.splayCount != this.tree.getSplayCount()) {
23257 this.rebuildPath(this.path[this.path.length - 1].key);
23259 const last = this.path.pop();
23260 const newLast = last.replaceValue(value);
23261 if (!this.path.length) {
23262 this.tree.setRoot(newLast);
23264 const parent = this.path[this.path.length - 1];
23265 if (last === parent.left) {
23266 parent.left = newLast;
23268 parent.right = newLast;
23271 this.path.push(newLast);
23272 const count = this.tree.getSplayCount() + 1;
23273 this.tree.setSplayCount(count);
23274 this.splayCount = count;
23278 // node_modules/polyclip-ts/dist/identity.js
23279 var identity_default3 = (x2) => {
23283 // node_modules/polyclip-ts/dist/snap.js
23284 var snap_default = (eps) => {
23286 const xTree = new SplayTreeSet(compare_default(eps));
23287 const yTree = new SplayTreeSet(compare_default(eps));
23288 const snapCoord = (coord2, tree) => {
23289 return tree.addAndReturn(coord2);
23291 const snap = (v2) => {
23293 x: snapCoord(v2.x, xTree),
23294 y: snapCoord(v2.y, yTree)
23297 snap({ x: new bignumber_default(0), y: new bignumber_default(0) });
23300 return identity_default3;
23303 // node_modules/polyclip-ts/dist/precision.js
23304 var set3 = (eps) => {
23307 precision = set3(eps2);
23309 reset: () => set3(eps),
23310 compare: compare_default(eps),
23311 snap: snap_default(eps),
23312 orient: orient_default(eps)
23315 var precision = set3();
23317 // node_modules/polyclip-ts/dist/bbox.js
23318 var isInBbox = (bbox2, point) => {
23319 return bbox2.ll.x.isLessThanOrEqualTo(point.x) && point.x.isLessThanOrEqualTo(bbox2.ur.x) && bbox2.ll.y.isLessThanOrEqualTo(point.y) && point.y.isLessThanOrEqualTo(bbox2.ur.y);
23321 var getBboxOverlap = (b1, b2) => {
23322 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))
23324 const lowerX = b1.ll.x.isLessThan(b2.ll.x) ? b2.ll.x : b1.ll.x;
23325 const upperX = b1.ur.x.isLessThan(b2.ur.x) ? b1.ur.x : b2.ur.x;
23326 const lowerY = b1.ll.y.isLessThan(b2.ll.y) ? b2.ll.y : b1.ll.y;
23327 const upperY = b1.ur.y.isLessThan(b2.ur.y) ? b1.ur.y : b2.ur.y;
23328 return { ll: { x: lowerX, y: lowerY }, ur: { x: upperX, y: upperY } };
23331 // node_modules/polyclip-ts/dist/vector.js
23332 var crossProduct = (a2, b2) => a2.x.times(b2.y).minus(a2.y.times(b2.x));
23333 var dotProduct = (a2, b2) => a2.x.times(b2.x).plus(a2.y.times(b2.y));
23334 var length = (v2) => dotProduct(v2, v2).sqrt();
23335 var sineOfAngle = (pShared, pBase, pAngle) => {
23336 const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
23337 const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
23338 return crossProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
23340 var cosineOfAngle = (pShared, pBase, pAngle) => {
23341 const vBase = { x: pBase.x.minus(pShared.x), y: pBase.y.minus(pShared.y) };
23342 const vAngle = { x: pAngle.x.minus(pShared.x), y: pAngle.y.minus(pShared.y) };
23343 return dotProduct(vAngle, vBase).div(length(vAngle)).div(length(vBase));
23345 var horizontalIntersection = (pt2, v2, y2) => {
23348 return { x: pt2.x.plus(v2.x.div(v2.y).times(y2.minus(pt2.y))), y: y2 };
23350 var verticalIntersection = (pt2, v2, x2) => {
23353 return { x: x2, y: pt2.y.plus(v2.y.div(v2.x).times(x2.minus(pt2.x))) };
23355 var intersection = (pt1, v1, pt2, v2) => {
23357 return verticalIntersection(pt2, v2, pt1.x);
23359 return verticalIntersection(pt1, v1, pt2.x);
23361 return horizontalIntersection(pt2, v2, pt1.y);
23363 return horizontalIntersection(pt1, v1, pt2.y);
23364 const kross = crossProduct(v1, v2);
23365 if (kross.isZero())
23367 const ve2 = { x: pt2.x.minus(pt1.x), y: pt2.y.minus(pt1.y) };
23368 const d1 = crossProduct(ve2, v1).div(kross);
23369 const d2 = crossProduct(ve2, v2).div(kross);
23370 const x12 = pt1.x.plus(d2.times(v1.x)), x2 = pt2.x.plus(d1.times(v2.x));
23371 const y12 = pt1.y.plus(d2.times(v1.y)), y2 = pt2.y.plus(d1.times(v2.y));
23372 const x3 = x12.plus(x2).div(2);
23373 const y3 = y12.plus(y2).div(2);
23374 return { x: x3, y: y3 };
23377 // node_modules/polyclip-ts/dist/sweep-event.js
23378 var SweepEvent = class _SweepEvent {
23379 // Warning: 'point' input will be modified and re-used (for performance)
23380 constructor(point, isLeft) {
23381 __publicField(this, "point");
23382 __publicField(this, "isLeft");
23383 __publicField(this, "segment");
23384 __publicField(this, "otherSE");
23385 __publicField(this, "consumedBy");
23386 if (point.events === void 0)
23387 point.events = [this];
23389 point.events.push(this);
23390 this.point = point;
23391 this.isLeft = isLeft;
23393 // for ordering sweep events in the sweep event queue
23394 static compare(a2, b2) {
23395 const ptCmp = _SweepEvent.comparePoints(a2.point, b2.point);
23398 if (a2.point !== b2.point)
23400 if (a2.isLeft !== b2.isLeft)
23401 return a2.isLeft ? 1 : -1;
23402 return Segment.compare(a2.segment, b2.segment);
23404 // for ordering points in sweep line order
23405 static comparePoints(aPt, bPt) {
23406 if (aPt.x.isLessThan(bPt.x))
23408 if (aPt.x.isGreaterThan(bPt.x))
23410 if (aPt.y.isLessThan(bPt.y))
23412 if (aPt.y.isGreaterThan(bPt.y))
23417 if (other.point === this.point) {
23418 throw new Error("Tried to link already linked events");
23420 const otherEvents = other.point.events;
23421 for (let i3 = 0, iMax = otherEvents.length; i3 < iMax; i3++) {
23422 const evt = otherEvents[i3];
23423 this.point.events.push(evt);
23424 evt.point = this.point;
23426 this.checkForConsuming();
23428 /* Do a pass over our linked events and check to see if any pair
23429 * of segments match, and should be consumed. */
23430 checkForConsuming() {
23431 const numEvents = this.point.events.length;
23432 for (let i3 = 0; i3 < numEvents; i3++) {
23433 const evt1 = this.point.events[i3];
23434 if (evt1.segment.consumedBy !== void 0)
23436 for (let j2 = i3 + 1; j2 < numEvents; j2++) {
23437 const evt2 = this.point.events[j2];
23438 if (evt2.consumedBy !== void 0)
23440 if (evt1.otherSE.point.events !== evt2.otherSE.point.events)
23442 evt1.segment.consume(evt2.segment);
23446 getAvailableLinkedEvents() {
23448 for (let i3 = 0, iMax = this.point.events.length; i3 < iMax; i3++) {
23449 const evt = this.point.events[i3];
23450 if (evt !== this && !evt.segment.ringOut && evt.segment.isInResult()) {
23457 * Returns a comparator function for sorting linked events that will
23458 * favor the event that will give us the smallest left-side angle.
23459 * All ring construction starts as low as possible heading to the right,
23460 * so by always turning left as sharp as possible we'll get polygons
23461 * without uncessary loops & holes.
23463 * The comparator function has a compute cache such that it avoids
23464 * re-computing already-computed values.
23466 getLeftmostComparator(baseEvent) {
23467 const cache = /* @__PURE__ */ new Map();
23468 const fillCache = (linkedEvent) => {
23469 const nextEvent = linkedEvent.otherSE;
23470 cache.set(linkedEvent, {
23471 sine: sineOfAngle(this.point, baseEvent.point, nextEvent.point),
23472 cosine: cosineOfAngle(this.point, baseEvent.point, nextEvent.point)
23475 return (a2, b2) => {
23476 if (!cache.has(a2))
23478 if (!cache.has(b2))
23480 const { sine: asine, cosine: acosine } = cache.get(a2);
23481 const { sine: bsine, cosine: bcosine } = cache.get(b2);
23482 if (asine.isGreaterThanOrEqualTo(0) && bsine.isGreaterThanOrEqualTo(0)) {
23483 if (acosine.isLessThan(bcosine))
23485 if (acosine.isGreaterThan(bcosine))
23489 if (asine.isLessThan(0) && bsine.isLessThan(0)) {
23490 if (acosine.isLessThan(bcosine))
23492 if (acosine.isGreaterThan(bcosine))
23496 if (bsine.isLessThan(asine))
23498 if (bsine.isGreaterThan(asine))
23505 // node_modules/polyclip-ts/dist/segment.js
23507 var Segment = class _Segment {
23508 /* Warning: a reference to ringWindings input will be stored,
23509 * and possibly will be later modified */
23510 constructor(leftSE, rightSE, rings, windings) {
23511 __publicField(this, "id");
23512 __publicField(this, "leftSE");
23513 __publicField(this, "rightSE");
23514 __publicField(this, "rings");
23515 __publicField(this, "windings");
23516 __publicField(this, "ringOut");
23517 __publicField(this, "consumedBy");
23518 __publicField(this, "prev");
23519 __publicField(this, "_prevInResult");
23520 __publicField(this, "_beforeState");
23521 __publicField(this, "_afterState");
23522 __publicField(this, "_isInResult");
23523 this.id = ++segmentId;
23524 this.leftSE = leftSE;
23525 leftSE.segment = this;
23526 leftSE.otherSE = rightSE;
23527 this.rightSE = rightSE;
23528 rightSE.segment = this;
23529 rightSE.otherSE = leftSE;
23530 this.rings = rings;
23531 this.windings = windings;
23533 /* This compare() function is for ordering segments in the sweep
23534 * line tree, and does so according to the following criteria:
23536 * Consider the vertical line that lies an infinestimal step to the
23537 * right of the right-more of the two left endpoints of the input
23538 * segments. Imagine slowly moving a point up from negative infinity
23539 * in the increasing y direction. Which of the two segments will that
23540 * point intersect first? That segment comes 'before' the other one.
23542 * If neither segment would be intersected by such a line, (if one
23543 * or more of the segments are vertical) then the line to be considered
23544 * is directly on the right-more of the two left inputs.
23546 static compare(a2, b2) {
23547 const alx = a2.leftSE.point.x;
23548 const blx = b2.leftSE.point.x;
23549 const arx = a2.rightSE.point.x;
23550 const brx = b2.rightSE.point.x;
23551 if (brx.isLessThan(alx))
23553 if (arx.isLessThan(blx))
23555 const aly = a2.leftSE.point.y;
23556 const bly = b2.leftSE.point.y;
23557 const ary = a2.rightSE.point.y;
23558 const bry = b2.rightSE.point.y;
23559 if (alx.isLessThan(blx)) {
23560 if (bly.isLessThan(aly) && bly.isLessThan(ary))
23562 if (bly.isGreaterThan(aly) && bly.isGreaterThan(ary))
23564 const aCmpBLeft = a2.comparePoint(b2.leftSE.point);
23569 const bCmpARight = b2.comparePoint(a2.rightSE.point);
23570 if (bCmpARight !== 0)
23574 if (alx.isGreaterThan(blx)) {
23575 if (aly.isLessThan(bly) && aly.isLessThan(bry))
23577 if (aly.isGreaterThan(bly) && aly.isGreaterThan(bry))
23579 const bCmpALeft = b2.comparePoint(a2.leftSE.point);
23580 if (bCmpALeft !== 0)
23582 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
23583 if (aCmpBRight < 0)
23585 if (aCmpBRight > 0)
23589 if (aly.isLessThan(bly))
23591 if (aly.isGreaterThan(bly))
23593 if (arx.isLessThan(brx)) {
23594 const bCmpARight = b2.comparePoint(a2.rightSE.point);
23595 if (bCmpARight !== 0)
23598 if (arx.isGreaterThan(brx)) {
23599 const aCmpBRight = a2.comparePoint(b2.rightSE.point);
23600 if (aCmpBRight < 0)
23602 if (aCmpBRight > 0)
23605 if (!arx.eq(brx)) {
23606 const ay = ary.minus(aly);
23607 const ax = arx.minus(alx);
23608 const by = bry.minus(bly);
23609 const bx = brx.minus(blx);
23610 if (ay.isGreaterThan(ax) && by.isLessThan(bx))
23612 if (ay.isLessThan(ax) && by.isGreaterThan(bx))
23615 if (arx.isGreaterThan(brx))
23617 if (arx.isLessThan(brx))
23619 if (ary.isLessThan(bry))
23621 if (ary.isGreaterThan(bry))
23629 static fromRing(pt1, pt2, ring) {
23630 let leftPt, rightPt, winding;
23631 const cmpPts = SweepEvent.comparePoints(pt1, pt2);
23636 } else if (cmpPts > 0) {
23641 throw new Error("Tried to create degenerate segment at [".concat(pt1.x, ", ").concat(pt1.y, "]"));
23642 const leftSE = new SweepEvent(leftPt, true);
23643 const rightSE = new SweepEvent(rightPt, false);
23644 return new _Segment(leftSE, rightSE, [ring], [winding]);
23646 /* When a segment is split, the rightSE is replaced with a new sweep event */
23647 replaceRightSE(newRightSE) {
23648 this.rightSE = newRightSE;
23649 this.rightSE.segment = this;
23650 this.rightSE.otherSE = this.leftSE;
23651 this.leftSE.otherSE = this.rightSE;
23654 const y12 = this.leftSE.point.y;
23655 const y2 = this.rightSE.point.y;
23657 ll: { x: this.leftSE.point.x, y: y12.isLessThan(y2) ? y12 : y2 },
23658 ur: { x: this.rightSE.point.x, y: y12.isGreaterThan(y2) ? y12 : y2 }
23661 /* A vector from the left point to the right */
23664 x: this.rightSE.point.x.minus(this.leftSE.point.x),
23665 y: this.rightSE.point.y.minus(this.leftSE.point.y)
23668 isAnEndpoint(pt2) {
23669 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);
23671 /* Compare this segment with a point.
23673 * A point P is considered to be colinear to a segment if there
23674 * exists a distance D such that if we travel along the segment
23675 * from one * endpoint towards the other a distance D, we find
23676 * ourselves at point P.
23678 * Return value indicates:
23680 * 1: point lies above the segment (to the left of vertical)
23681 * 0: point is colinear to segment
23682 * -1: point lies below the segment (to the right of vertical)
23684 comparePoint(point) {
23685 return precision.orient(this.leftSE.point, point, this.rightSE.point);
23688 * Given another segment, returns the first non-trivial intersection
23689 * between the two segments (in terms of sweep line ordering), if it exists.
23691 * A 'non-trivial' intersection is one that will cause one or both of the
23692 * segments to be split(). As such, 'trivial' vs. 'non-trivial' intersection:
23694 * * endpoint of segA with endpoint of segB --> trivial
23695 * * endpoint of segA with point along segB --> non-trivial
23696 * * endpoint of segB with point along segA --> non-trivial
23697 * * point along segA with point along segB --> non-trivial
23699 * If no non-trivial intersection exists, return null
23700 * Else, return null.
23702 getIntersection(other) {
23703 const tBbox = this.bbox();
23704 const oBbox = other.bbox();
23705 const bboxOverlap = getBboxOverlap(tBbox, oBbox);
23706 if (bboxOverlap === null)
23708 const tlp = this.leftSE.point;
23709 const trp = this.rightSE.point;
23710 const olp = other.leftSE.point;
23711 const orp = other.rightSE.point;
23712 const touchesOtherLSE = isInBbox(tBbox, olp) && this.comparePoint(olp) === 0;
23713 const touchesThisLSE = isInBbox(oBbox, tlp) && other.comparePoint(tlp) === 0;
23714 const touchesOtherRSE = isInBbox(tBbox, orp) && this.comparePoint(orp) === 0;
23715 const touchesThisRSE = isInBbox(oBbox, trp) && other.comparePoint(trp) === 0;
23716 if (touchesThisLSE && touchesOtherLSE) {
23717 if (touchesThisRSE && !touchesOtherRSE)
23719 if (!touchesThisRSE && touchesOtherRSE)
23723 if (touchesThisLSE) {
23724 if (touchesOtherRSE) {
23725 if (tlp.x.eq(orp.x) && tlp.y.eq(orp.y))
23730 if (touchesOtherLSE) {
23731 if (touchesThisRSE) {
23732 if (trp.x.eq(olp.x) && trp.y.eq(olp.y))
23737 if (touchesThisRSE && touchesOtherRSE)
23739 if (touchesThisRSE)
23741 if (touchesOtherRSE)
23743 const pt2 = intersection(tlp, this.vector(), olp, other.vector());
23746 if (!isInBbox(bboxOverlap, pt2))
23748 return precision.snap(pt2);
23751 * Split the given segment into multiple segments on the given points.
23752 * * Each existing segment will retain its leftSE and a new rightSE will be
23753 * generated for it.
23754 * * A new segment will be generated which will adopt the original segment's
23755 * rightSE, and a new leftSE will be generated for it.
23756 * * If there are more than two points given to split on, new segments
23757 * in the middle will be generated with new leftSE and rightSE's.
23758 * * An array of the newly generated SweepEvents will be returned.
23760 * Warning: input array of points is modified
23763 const newEvents = [];
23764 const alreadyLinked = point.events !== void 0;
23765 const newLeftSE = new SweepEvent(point, true);
23766 const newRightSE = new SweepEvent(point, false);
23767 const oldRightSE = this.rightSE;
23768 this.replaceRightSE(newRightSE);
23769 newEvents.push(newRightSE);
23770 newEvents.push(newLeftSE);
23771 const newSeg = new _Segment(newLeftSE, oldRightSE, this.rings.slice(), this.windings.slice());
23772 if (SweepEvent.comparePoints(newSeg.leftSE.point, newSeg.rightSE.point) > 0) {
23773 newSeg.swapEvents();
23775 if (SweepEvent.comparePoints(this.leftSE.point, this.rightSE.point) > 0) {
23778 if (alreadyLinked) {
23779 newLeftSE.checkForConsuming();
23780 newRightSE.checkForConsuming();
23784 /* Swap which event is left and right */
23786 const tmpEvt = this.rightSE;
23787 this.rightSE = this.leftSE;
23788 this.leftSE = tmpEvt;
23789 this.leftSE.isLeft = true;
23790 this.rightSE.isLeft = false;
23791 for (let i3 = 0, iMax = this.windings.length; i3 < iMax; i3++) {
23792 this.windings[i3] *= -1;
23795 /* Consume another segment. We take their rings under our wing
23796 * and mark them as consumed. Use for perfectly overlapping segments */
23798 let consumer = this;
23799 let consumee = other;
23800 while (consumer.consumedBy)
23801 consumer = consumer.consumedBy;
23802 while (consumee.consumedBy)
23803 consumee = consumee.consumedBy;
23804 const cmp = _Segment.compare(consumer, consumee);
23808 const tmp = consumer;
23809 consumer = consumee;
23812 if (consumer.prev === consumee) {
23813 const tmp = consumer;
23814 consumer = consumee;
23817 for (let i3 = 0, iMax = consumee.rings.length; i3 < iMax; i3++) {
23818 const ring = consumee.rings[i3];
23819 const winding = consumee.windings[i3];
23820 const index = consumer.rings.indexOf(ring);
23821 if (index === -1) {
23822 consumer.rings.push(ring);
23823 consumer.windings.push(winding);
23825 consumer.windings[index] += winding;
23827 consumee.rings = null;
23828 consumee.windings = null;
23829 consumee.consumedBy = consumer;
23830 consumee.leftSE.consumedBy = consumer.leftSE;
23831 consumee.rightSE.consumedBy = consumer.rightSE;
23833 /* The first segment previous segment chain that is in the result */
23835 if (this._prevInResult !== void 0)
23836 return this._prevInResult;
23838 this._prevInResult = null;
23839 else if (this.prev.isInResult())
23840 this._prevInResult = this.prev;
23842 this._prevInResult = this.prev.prevInResult();
23843 return this._prevInResult;
23846 if (this._beforeState !== void 0)
23847 return this._beforeState;
23849 this._beforeState = {
23855 const seg = this.prev.consumedBy || this.prev;
23856 this._beforeState = seg.afterState();
23858 return this._beforeState;
23861 if (this._afterState !== void 0)
23862 return this._afterState;
23863 const beforeState = this.beforeState();
23864 this._afterState = {
23865 rings: beforeState.rings.slice(0),
23866 windings: beforeState.windings.slice(0),
23869 const ringsAfter = this._afterState.rings;
23870 const windingsAfter = this._afterState.windings;
23871 const mpsAfter = this._afterState.multiPolys;
23872 for (let i3 = 0, iMax = this.rings.length; i3 < iMax; i3++) {
23873 const ring = this.rings[i3];
23874 const winding = this.windings[i3];
23875 const index = ringsAfter.indexOf(ring);
23876 if (index === -1) {
23877 ringsAfter.push(ring);
23878 windingsAfter.push(winding);
23880 windingsAfter[index] += winding;
23882 const polysAfter = [];
23883 const polysExclude = [];
23884 for (let i3 = 0, iMax = ringsAfter.length; i3 < iMax; i3++) {
23885 if (windingsAfter[i3] === 0)
23887 const ring = ringsAfter[i3];
23888 const poly = ring.poly;
23889 if (polysExclude.indexOf(poly) !== -1)
23891 if (ring.isExterior)
23892 polysAfter.push(poly);
23894 if (polysExclude.indexOf(poly) === -1)
23895 polysExclude.push(poly);
23896 const index = polysAfter.indexOf(ring.poly);
23898 polysAfter.splice(index, 1);
23901 for (let i3 = 0, iMax = polysAfter.length; i3 < iMax; i3++) {
23902 const mp = polysAfter[i3].multiPoly;
23903 if (mpsAfter.indexOf(mp) === -1)
23906 return this._afterState;
23908 /* Is this segment part of the final result? */
23910 if (this.consumedBy)
23912 if (this._isInResult !== void 0)
23913 return this._isInResult;
23914 const mpsBefore = this.beforeState().multiPolys;
23915 const mpsAfter = this.afterState().multiPolys;
23916 switch (operation_default.type) {
23918 const noBefores = mpsBefore.length === 0;
23919 const noAfters = mpsAfter.length === 0;
23920 this._isInResult = noBefores !== noAfters;
23923 case "intersection": {
23926 if (mpsBefore.length < mpsAfter.length) {
23927 least = mpsBefore.length;
23928 most = mpsAfter.length;
23930 least = mpsAfter.length;
23931 most = mpsBefore.length;
23933 this._isInResult = most === operation_default.numMultiPolys && least < most;
23937 const diff = Math.abs(mpsBefore.length - mpsAfter.length);
23938 this._isInResult = diff % 2 === 1;
23941 case "difference": {
23942 const isJustSubject = (mps) => mps.length === 1 && mps[0].isSubject;
23943 this._isInResult = isJustSubject(mpsBefore) !== isJustSubject(mpsAfter);
23947 return this._isInResult;
23951 // node_modules/polyclip-ts/dist/geom-in.js
23952 var RingIn = class {
23953 constructor(geomRing, poly, isExterior) {
23954 __publicField(this, "poly");
23955 __publicField(this, "isExterior");
23956 __publicField(this, "segments");
23957 __publicField(this, "bbox");
23958 if (!Array.isArray(geomRing) || geomRing.length === 0) {
23959 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23962 this.isExterior = isExterior;
23963 this.segments = [];
23964 if (typeof geomRing[0][0] !== "number" || typeof geomRing[0][1] !== "number") {
23965 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23967 const firstPoint = precision.snap({ x: new bignumber_default(geomRing[0][0]), y: new bignumber_default(geomRing[0][1]) });
23969 ll: { x: firstPoint.x, y: firstPoint.y },
23970 ur: { x: firstPoint.x, y: firstPoint.y }
23972 let prevPoint = firstPoint;
23973 for (let i3 = 1, iMax = geomRing.length; i3 < iMax; i3++) {
23974 if (typeof geomRing[i3][0] !== "number" || typeof geomRing[i3][1] !== "number") {
23975 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
23977 const point = precision.snap({ x: new bignumber_default(geomRing[i3][0]), y: new bignumber_default(geomRing[i3][1]) });
23978 if (point.x.eq(prevPoint.x) && point.y.eq(prevPoint.y))
23980 this.segments.push(Segment.fromRing(prevPoint, point, this));
23981 if (point.x.isLessThan(this.bbox.ll.x))
23982 this.bbox.ll.x = point.x;
23983 if (point.y.isLessThan(this.bbox.ll.y))
23984 this.bbox.ll.y = point.y;
23985 if (point.x.isGreaterThan(this.bbox.ur.x))
23986 this.bbox.ur.x = point.x;
23987 if (point.y.isGreaterThan(this.bbox.ur.y))
23988 this.bbox.ur.y = point.y;
23991 if (!firstPoint.x.eq(prevPoint.x) || !firstPoint.y.eq(prevPoint.y)) {
23992 this.segments.push(Segment.fromRing(prevPoint, firstPoint, this));
23996 const sweepEvents = [];
23997 for (let i3 = 0, iMax = this.segments.length; i3 < iMax; i3++) {
23998 const segment = this.segments[i3];
23999 sweepEvents.push(segment.leftSE);
24000 sweepEvents.push(segment.rightSE);
24002 return sweepEvents;
24005 var PolyIn = class {
24006 constructor(geomPoly, multiPoly) {
24007 __publicField(this, "multiPoly");
24008 __publicField(this, "exteriorRing");
24009 __publicField(this, "interiorRings");
24010 __publicField(this, "bbox");
24011 if (!Array.isArray(geomPoly)) {
24012 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
24014 this.exteriorRing = new RingIn(geomPoly[0], this, true);
24016 ll: { x: this.exteriorRing.bbox.ll.x, y: this.exteriorRing.bbox.ll.y },
24017 ur: { x: this.exteriorRing.bbox.ur.x, y: this.exteriorRing.bbox.ur.y }
24019 this.interiorRings = [];
24020 for (let i3 = 1, iMax = geomPoly.length; i3 < iMax; i3++) {
24021 const ring = new RingIn(geomPoly[i3], this, false);
24022 if (ring.bbox.ll.x.isLessThan(this.bbox.ll.x))
24023 this.bbox.ll.x = ring.bbox.ll.x;
24024 if (ring.bbox.ll.y.isLessThan(this.bbox.ll.y))
24025 this.bbox.ll.y = ring.bbox.ll.y;
24026 if (ring.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
24027 this.bbox.ur.x = ring.bbox.ur.x;
24028 if (ring.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
24029 this.bbox.ur.y = ring.bbox.ur.y;
24030 this.interiorRings.push(ring);
24032 this.multiPoly = multiPoly;
24035 const sweepEvents = this.exteriorRing.getSweepEvents();
24036 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
24037 const ringSweepEvents = this.interiorRings[i3].getSweepEvents();
24038 for (let j2 = 0, jMax = ringSweepEvents.length; j2 < jMax; j2++) {
24039 sweepEvents.push(ringSweepEvents[j2]);
24042 return sweepEvents;
24045 var MultiPolyIn = class {
24046 constructor(geom, isSubject) {
24047 __publicField(this, "isSubject");
24048 __publicField(this, "polys");
24049 __publicField(this, "bbox");
24050 if (!Array.isArray(geom)) {
24051 throw new Error("Input geometry is not a valid Polygon or MultiPolygon");
24054 if (typeof geom[0][0][0] === "number")
24060 ll: { x: new bignumber_default(Number.POSITIVE_INFINITY), y: new bignumber_default(Number.POSITIVE_INFINITY) },
24061 ur: { x: new bignumber_default(Number.NEGATIVE_INFINITY), y: new bignumber_default(Number.NEGATIVE_INFINITY) }
24063 for (let i3 = 0, iMax = geom.length; i3 < iMax; i3++) {
24064 const poly = new PolyIn(geom[i3], this);
24065 if (poly.bbox.ll.x.isLessThan(this.bbox.ll.x))
24066 this.bbox.ll.x = poly.bbox.ll.x;
24067 if (poly.bbox.ll.y.isLessThan(this.bbox.ll.y))
24068 this.bbox.ll.y = poly.bbox.ll.y;
24069 if (poly.bbox.ur.x.isGreaterThan(this.bbox.ur.x))
24070 this.bbox.ur.x = poly.bbox.ur.x;
24071 if (poly.bbox.ur.y.isGreaterThan(this.bbox.ur.y))
24072 this.bbox.ur.y = poly.bbox.ur.y;
24073 this.polys.push(poly);
24075 this.isSubject = isSubject;
24078 const sweepEvents = [];
24079 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
24080 const polySweepEvents = this.polys[i3].getSweepEvents();
24081 for (let j2 = 0, jMax = polySweepEvents.length; j2 < jMax; j2++) {
24082 sweepEvents.push(polySweepEvents[j2]);
24085 return sweepEvents;
24089 // node_modules/polyclip-ts/dist/geom-out.js
24090 var RingOut = class _RingOut {
24091 constructor(events) {
24092 __publicField(this, "events");
24093 __publicField(this, "poly");
24094 __publicField(this, "_isExteriorRing");
24095 __publicField(this, "_enclosingRing");
24096 this.events = events;
24097 for (let i3 = 0, iMax = events.length; i3 < iMax; i3++) {
24098 events[i3].segment.ringOut = this;
24102 /* Given the segments from the sweep line pass, compute & return a series
24103 * of closed rings from all the segments marked to be part of the result */
24104 static factory(allSegments) {
24105 const ringsOut = [];
24106 for (let i3 = 0, iMax = allSegments.length; i3 < iMax; i3++) {
24107 const segment = allSegments[i3];
24108 if (!segment.isInResult() || segment.ringOut)
24110 let prevEvent = null;
24111 let event = segment.leftSE;
24112 let nextEvent = segment.rightSE;
24113 const events = [event];
24114 const startingPoint = event.point;
24115 const intersectionLEs = [];
24119 events.push(event);
24120 if (event.point === startingPoint)
24123 const availableLEs = event.getAvailableLinkedEvents();
24124 if (availableLEs.length === 0) {
24125 const firstPt = events[0].point;
24126 const lastPt = events[events.length - 1].point;
24127 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, "]."));
24129 if (availableLEs.length === 1) {
24130 nextEvent = availableLEs[0].otherSE;
24133 let indexLE = null;
24134 for (let j2 = 0, jMax = intersectionLEs.length; j2 < jMax; j2++) {
24135 if (intersectionLEs[j2].point === event.point) {
24140 if (indexLE !== null) {
24141 const intersectionLE = intersectionLEs.splice(indexLE)[0];
24142 const ringEvents = events.splice(intersectionLE.index);
24143 ringEvents.unshift(ringEvents[0].otherSE);
24144 ringsOut.push(new _RingOut(ringEvents.reverse()));
24147 intersectionLEs.push({
24148 index: events.length,
24151 const comparator = event.getLeftmostComparator(prevEvent);
24152 nextEvent = availableLEs.sort(comparator)[0].otherSE;
24156 ringsOut.push(new _RingOut(events));
24161 let prevPt = this.events[0].point;
24162 const points = [prevPt];
24163 for (let i3 = 1, iMax = this.events.length - 1; i3 < iMax; i3++) {
24164 const pt3 = this.events[i3].point;
24165 const nextPt2 = this.events[i3 + 1].point;
24166 if (precision.orient(pt3, prevPt, nextPt2) === 0)
24171 if (points.length === 1)
24173 const pt2 = points[0];
24174 const nextPt = points[1];
24175 if (precision.orient(pt2, prevPt, nextPt) === 0)
24177 points.push(points[0]);
24178 const step = this.isExteriorRing() ? 1 : -1;
24179 const iStart = this.isExteriorRing() ? 0 : points.length - 1;
24180 const iEnd = this.isExteriorRing() ? points.length : -1;
24181 const orderedPoints = [];
24182 for (let i3 = iStart; i3 != iEnd; i3 += step)
24183 orderedPoints.push([points[i3].x.toNumber(), points[i3].y.toNumber()]);
24184 return orderedPoints;
24187 if (this._isExteriorRing === void 0) {
24188 const enclosing = this.enclosingRing();
24189 this._isExteriorRing = enclosing ? !enclosing.isExteriorRing() : true;
24191 return this._isExteriorRing;
24194 if (this._enclosingRing === void 0) {
24195 this._enclosingRing = this._calcEnclosingRing();
24197 return this._enclosingRing;
24199 /* Returns the ring that encloses this one, if any */
24200 _calcEnclosingRing() {
24202 let leftMostEvt = this.events[0];
24203 for (let i3 = 1, iMax = this.events.length; i3 < iMax; i3++) {
24204 const evt = this.events[i3];
24205 if (SweepEvent.compare(leftMostEvt, evt) > 0)
24208 let prevSeg = leftMostEvt.segment.prevInResult();
24209 let prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
24214 return prevSeg.ringOut;
24215 if (prevPrevSeg.ringOut !== prevSeg.ringOut) {
24216 if (((_a3 = prevPrevSeg.ringOut) == null ? void 0 : _a3.enclosingRing()) !== prevSeg.ringOut) {
24217 return prevSeg.ringOut;
24219 return (_b3 = prevSeg.ringOut) == null ? void 0 : _b3.enclosingRing();
24221 prevSeg = prevPrevSeg.prevInResult();
24222 prevPrevSeg = prevSeg ? prevSeg.prevInResult() : null;
24226 var PolyOut = class {
24227 constructor(exteriorRing) {
24228 __publicField(this, "exteriorRing");
24229 __publicField(this, "interiorRings");
24230 this.exteriorRing = exteriorRing;
24231 exteriorRing.poly = this;
24232 this.interiorRings = [];
24234 addInterior(ring) {
24235 this.interiorRings.push(ring);
24239 const geom0 = this.exteriorRing.getGeom();
24240 if (geom0 === null)
24242 const geom = [geom0];
24243 for (let i3 = 0, iMax = this.interiorRings.length; i3 < iMax; i3++) {
24244 const ringGeom = this.interiorRings[i3].getGeom();
24245 if (ringGeom === null)
24247 geom.push(ringGeom);
24252 var MultiPolyOut = class {
24253 constructor(rings) {
24254 __publicField(this, "rings");
24255 __publicField(this, "polys");
24256 this.rings = rings;
24257 this.polys = this._composePolys(rings);
24261 for (let i3 = 0, iMax = this.polys.length; i3 < iMax; i3++) {
24262 const polyGeom = this.polys[i3].getGeom();
24263 if (polyGeom === null)
24265 geom.push(polyGeom);
24269 _composePolys(rings) {
24272 for (let i3 = 0, iMax = rings.length; i3 < iMax; i3++) {
24273 const ring = rings[i3];
24276 if (ring.isExteriorRing())
24277 polys.push(new PolyOut(ring));
24279 const enclosingRing = ring.enclosingRing();
24280 if (!(enclosingRing == null ? void 0 : enclosingRing.poly))
24281 polys.push(new PolyOut(enclosingRing));
24282 (_a3 = enclosingRing == null ? void 0 : enclosingRing.poly) == null ? void 0 : _a3.addInterior(ring);
24289 // node_modules/polyclip-ts/dist/sweep-line.js
24290 var SweepLine = class {
24291 constructor(queue, comparator = Segment.compare) {
24292 __publicField(this, "queue");
24293 __publicField(this, "tree");
24294 __publicField(this, "segments");
24295 this.queue = queue;
24296 this.tree = new SplayTreeSet(comparator);
24297 this.segments = [];
24300 const segment = event.segment;
24301 const newEvents = [];
24302 if (event.consumedBy) {
24304 this.queue.delete(event.otherSE);
24306 this.tree.delete(segment);
24310 this.tree.add(segment);
24311 let prevSeg = segment;
24312 let nextSeg = segment;
24314 prevSeg = this.tree.lastBefore(prevSeg);
24315 } while (prevSeg != null && prevSeg.consumedBy != void 0);
24317 nextSeg = this.tree.firstAfter(nextSeg);
24318 } while (nextSeg != null && nextSeg.consumedBy != void 0);
24319 if (event.isLeft) {
24320 let prevMySplitter = null;
24322 const prevInter = prevSeg.getIntersection(segment);
24323 if (prevInter !== null) {
24324 if (!segment.isAnEndpoint(prevInter))
24325 prevMySplitter = prevInter;
24326 if (!prevSeg.isAnEndpoint(prevInter)) {
24327 const newEventsFromSplit = this._splitSafely(prevSeg, prevInter);
24328 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24329 newEvents.push(newEventsFromSplit[i3]);
24334 let nextMySplitter = null;
24336 const nextInter = nextSeg.getIntersection(segment);
24337 if (nextInter !== null) {
24338 if (!segment.isAnEndpoint(nextInter))
24339 nextMySplitter = nextInter;
24340 if (!nextSeg.isAnEndpoint(nextInter)) {
24341 const newEventsFromSplit = this._splitSafely(nextSeg, nextInter);
24342 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24343 newEvents.push(newEventsFromSplit[i3]);
24348 if (prevMySplitter !== null || nextMySplitter !== null) {
24349 let mySplitter = null;
24350 if (prevMySplitter === null)
24351 mySplitter = nextMySplitter;
24352 else if (nextMySplitter === null)
24353 mySplitter = prevMySplitter;
24355 const cmpSplitters = SweepEvent.comparePoints(prevMySplitter, nextMySplitter);
24356 mySplitter = cmpSplitters <= 0 ? prevMySplitter : nextMySplitter;
24358 this.queue.delete(segment.rightSE);
24359 newEvents.push(segment.rightSE);
24360 const newEventsFromSplit = segment.split(mySplitter);
24361 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24362 newEvents.push(newEventsFromSplit[i3]);
24365 if (newEvents.length > 0) {
24366 this.tree.delete(segment);
24367 newEvents.push(event);
24369 this.segments.push(segment);
24370 segment.prev = prevSeg;
24373 if (prevSeg && nextSeg) {
24374 const inter = prevSeg.getIntersection(nextSeg);
24375 if (inter !== null) {
24376 if (!prevSeg.isAnEndpoint(inter)) {
24377 const newEventsFromSplit = this._splitSafely(prevSeg, inter);
24378 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24379 newEvents.push(newEventsFromSplit[i3]);
24382 if (!nextSeg.isAnEndpoint(inter)) {
24383 const newEventsFromSplit = this._splitSafely(nextSeg, inter);
24384 for (let i3 = 0, iMax = newEventsFromSplit.length; i3 < iMax; i3++) {
24385 newEvents.push(newEventsFromSplit[i3]);
24390 this.tree.delete(segment);
24394 /* Safely split a segment that is currently in the datastructures
24395 * IE - a segment other than the one that is currently being processed. */
24396 _splitSafely(seg, pt2) {
24397 this.tree.delete(seg);
24398 const rightSE = seg.rightSE;
24399 this.queue.delete(rightSE);
24400 const newEvents = seg.split(pt2);
24401 newEvents.push(rightSE);
24402 if (seg.consumedBy === void 0)
24403 this.tree.add(seg);
24408 // node_modules/polyclip-ts/dist/operation.js
24409 var Operation = class {
24411 __publicField(this, "type");
24412 __publicField(this, "numMultiPolys");
24414 run(type2, geom, moreGeoms) {
24415 operation.type = type2;
24416 const multipolys = [new MultiPolyIn(geom, true)];
24417 for (let i3 = 0, iMax = moreGeoms.length; i3 < iMax; i3++) {
24418 multipolys.push(new MultiPolyIn(moreGeoms[i3], false));
24420 operation.numMultiPolys = multipolys.length;
24421 if (operation.type === "difference") {
24422 const subject = multipolys[0];
24424 while (i3 < multipolys.length) {
24425 if (getBboxOverlap(multipolys[i3].bbox, subject.bbox) !== null)
24428 multipolys.splice(i3, 1);
24431 if (operation.type === "intersection") {
24432 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
24433 const mpA = multipolys[i3];
24434 for (let j2 = i3 + 1, jMax = multipolys.length; j2 < jMax; j2++) {
24435 if (getBboxOverlap(mpA.bbox, multipolys[j2].bbox) === null)
24440 const queue = new SplayTreeSet(SweepEvent.compare);
24441 for (let i3 = 0, iMax = multipolys.length; i3 < iMax; i3++) {
24442 const sweepEvents = multipolys[i3].getSweepEvents();
24443 for (let j2 = 0, jMax = sweepEvents.length; j2 < jMax; j2++) {
24444 queue.add(sweepEvents[j2]);
24447 const sweepLine = new SweepLine(queue);
24449 if (queue.size != 0) {
24450 evt = queue.first();
24454 const newEvents = sweepLine.process(evt);
24455 for (let i3 = 0, iMax = newEvents.length; i3 < iMax; i3++) {
24456 const evt2 = newEvents[i3];
24457 if (evt2.consumedBy === void 0)
24460 if (queue.size != 0) {
24461 evt = queue.first();
24468 const ringsOut = RingOut.factory(sweepLine.segments);
24469 const result = new MultiPolyOut(ringsOut);
24470 return result.getGeom();
24473 var operation = new Operation();
24474 var operation_default = operation;
24476 // node_modules/polyclip-ts/dist/index.js
24477 var union = (geom, ...moreGeoms) => operation_default.run("union", geom, moreGeoms);
24478 var difference = (geom, ...moreGeoms) => operation_default.run("difference", geom, moreGeoms);
24479 var setPrecision = precision.set;
24481 // node_modules/@rapideditor/location-conflation/index.mjs
24482 var import_geojson_area = __toESM(require_geojson_area(), 1);
24483 var import_circle_to_polygon = __toESM(require_circle_to_polygon(), 1);
24484 var import_geojson_precision = __toESM(require_geojson_precision(), 1);
24485 var import_json_stringify_pretty_compact = __toESM(require_json_stringify_pretty_compact(), 1);
24486 var LocationConflation = class {
24489 // `fc` Optional FeatureCollection of known features
24491 // Optionally pass a GeoJSON FeatureCollection of known features which we can refer to later.
24492 // Each feature must have a filename-like `id`, for example: `something.geojson`
24495 // "type": "FeatureCollection"
24498 // "type": "Feature",
24499 // "id": "philly_metro.geojson",
24500 // "properties": { … },
24501 // "geometry": { … }
24507 this.strict = true;
24508 if (fc && fc.type === "FeatureCollection" && Array.isArray(fc.features)) {
24509 fc.features.forEach((feature3) => {
24510 feature3.properties = feature3.properties || {};
24511 let props = feature3.properties;
24512 let id2 = feature3.id || props.id;
24513 if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
24514 id2 = id2.toLowerCase();
24518 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24519 props.area = Number(area.toFixed(2));
24521 this._cache[id2] = feature3;
24524 let world = _cloneDeep(feature("Q2"));
24527 coordinates: [[[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]]]
24530 world.properties.id = "Q2";
24531 world.properties.area = import_geojson_area.default.geometry(world.geometry) / 1e6;
24532 this._cache.Q2 = world;
24534 // validateLocation
24535 // `location` The location to validate
24537 // Pass a `location` value to validate
24539 // Returns a result like:
24541 // type: 'point', 'geojson', or 'countrycoder'
24542 // location: the queried location
24543 // id: the stable identifier for the feature
24545 // or `null` if the location is invalid
24547 validateLocation(location) {
24548 if (Array.isArray(location) && (location.length === 2 || location.length === 3)) {
24549 const lon = location[0];
24550 const lat = location[1];
24551 const radius = location[2];
24552 if (Number.isFinite(lon) && lon >= -180 && lon <= 180 && Number.isFinite(lat) && lat >= -90 && lat <= 90 && (location.length === 2 || Number.isFinite(radius) && radius > 0)) {
24553 const id2 = "[" + location.toString() + "]";
24554 return { type: "point", location, id: id2 };
24556 } else if (typeof location === "string" && /^\S+\.geojson$/i.test(location)) {
24557 const id2 = location.toLowerCase();
24558 if (this._cache[id2]) {
24559 return { type: "geojson", location, id: id2 };
24561 } else if (typeof location === "string" || typeof location === "number") {
24562 const feature3 = feature(location);
24564 const id2 = feature3.properties.wikidata;
24565 return { type: "countrycoder", location, id: id2 };
24569 throw new Error('validateLocation: Invalid location: "'.concat(location, '".'));
24575 // `location` The location to resolve
24577 // Pass a `location` value to resolve
24579 // Returns a result like:
24581 // type: 'point', 'geojson', or 'countrycoder'
24582 // location: the queried location
24583 // id: a stable identifier for the feature
24584 // feature: the resolved GeoJSON feature
24586 // or `null` if the location is invalid
24588 resolveLocation(location) {
24589 const valid = this.validateLocation(location);
24590 if (!valid) return null;
24591 const id2 = valid.id;
24592 if (this._cache[id2]) {
24593 return Object.assign(valid, { feature: this._cache[id2] });
24595 if (valid.type === "point") {
24596 const lon = location[0];
24597 const lat = location[1];
24598 const radius = location[2] || 25;
24600 const PRECISION = 3;
24601 const area = Math.PI * radius * radius;
24602 const feature3 = this._cache[id2] = (0, import_geojson_precision.default)({
24605 properties: { id: id2, area: Number(area.toFixed(2)) },
24606 geometry: (0, import_circle_to_polygon.default)([lon, lat], radius * 1e3, EDGES)
24609 return Object.assign(valid, { feature: feature3 });
24610 } else if (valid.type === "geojson") {
24611 } else if (valid.type === "countrycoder") {
24612 let feature3 = _cloneDeep(feature(id2));
24613 let props = feature3.properties;
24614 if (Array.isArray(props.members)) {
24615 let aggregate = aggregateFeature(id2);
24616 aggregate.geometry.coordinates = _clip([aggregate], "UNION").geometry.coordinates;
24617 feature3.geometry = aggregate.geometry;
24620 const area = import_geojson_area.default.geometry(feature3.geometry) / 1e6;
24621 props.area = Number(area.toFixed(2));
24625 this._cache[id2] = feature3;
24626 return Object.assign(valid, { feature: feature3 });
24629 throw new Error("resolveLocation: Couldn't resolve location \"".concat(location, '".'));
24634 // validateLocationSet
24635 // `locationSet` the locationSet to validate
24637 // Pass a locationSet Object to validate like:
24639 // include: [ Array of locations ],
24640 // exclude: [ Array of locations ]
24643 // Returns a result like:
24645 // type: 'locationset'
24646 // locationSet: the queried locationSet
24647 // id: the stable identifier for the feature
24649 // or `null` if the locationSet is invalid
24651 validateLocationSet(locationSet) {
24652 locationSet = locationSet || {};
24653 const validator = this.validateLocation.bind(this);
24654 let include = (locationSet.include || []).map(validator).filter(Boolean);
24655 let exclude = (locationSet.exclude || []).map(validator).filter(Boolean);
24656 if (!include.length) {
24658 throw new Error("validateLocationSet: LocationSet includes nothing.");
24660 locationSet.include = ["Q2"];
24661 include = [{ type: "countrycoder", location: "Q2", id: "Q2" }];
24664 include.sort(_sortLocations);
24665 let id2 = "+[" + include.map((d2) => d2.id).join(",") + "]";
24666 if (exclude.length) {
24667 exclude.sort(_sortLocations);
24668 id2 += "-[" + exclude.map((d2) => d2.id).join(",") + "]";
24670 return { type: "locationset", locationSet, id: id2 };
24672 // resolveLocationSet
24673 // `locationSet` the locationSet to resolve
24675 // Pass a locationSet Object to validate like:
24677 // include: [ Array of locations ],
24678 // exclude: [ Array of locations ]
24681 // Returns a result like:
24683 // type: 'locationset'
24684 // locationSet: the queried locationSet
24685 // id: the stable identifier for the feature
24686 // feature: the resolved GeoJSON feature
24688 // or `null` if the locationSet is invalid
24690 resolveLocationSet(locationSet) {
24691 locationSet = locationSet || {};
24692 const valid = this.validateLocationSet(locationSet);
24693 if (!valid) return null;
24694 const id2 = valid.id;
24695 if (this._cache[id2]) {
24696 return Object.assign(valid, { feature: this._cache[id2] });
24698 const resolver = this.resolveLocation.bind(this);
24699 const includes = (locationSet.include || []).map(resolver).filter(Boolean);
24700 const excludes = (locationSet.exclude || []).map(resolver).filter(Boolean);
24701 if (includes.length === 1 && excludes.length === 0) {
24702 return Object.assign(valid, { feature: includes[0].feature });
24704 const includeGeoJSON = _clip(includes.map((d2) => d2.feature), "UNION");
24705 const excludeGeoJSON = _clip(excludes.map((d2) => d2.feature), "UNION");
24706 let resultGeoJSON = excludeGeoJSON ? _clip([includeGeoJSON, excludeGeoJSON], "DIFFERENCE") : includeGeoJSON;
24707 const area = import_geojson_area.default.geometry(resultGeoJSON.geometry) / 1e6;
24708 resultGeoJSON.id = id2;
24709 resultGeoJSON.properties = { id: id2, area: Number(area.toFixed(2)) };
24710 this._cache[id2] = resultGeoJSON;
24711 return Object.assign(valid, { feature: resultGeoJSON });
24714 // convenience method to prettyStringify the given object
24715 stringify(obj, options2) {
24716 return (0, import_json_stringify_pretty_compact.default)(obj, options2);
24719 function _clip(features, which) {
24720 if (!Array.isArray(features) || !features.length) return null;
24721 const fn = { UNION: union, DIFFERENCE: difference }[which];
24722 const args = features.map((feature3) => feature3.geometry.coordinates);
24723 const coords = fn.apply(null, args);
24728 type: whichType(coords),
24729 coordinates: coords
24732 function whichType(coords2) {
24733 const a2 = Array.isArray(coords2);
24734 const b2 = a2 && Array.isArray(coords2[0]);
24735 const c2 = b2 && Array.isArray(coords2[0][0]);
24736 const d2 = c2 && Array.isArray(coords2[0][0][0]);
24737 return d2 ? "MultiPolygon" : "Polygon";
24740 function _cloneDeep(obj) {
24741 return JSON.parse(JSON.stringify(obj));
24743 function _sortLocations(a2, b2) {
24744 const rank = { countrycoder: 1, geojson: 2, point: 3 };
24745 const aRank = rank[a2.type];
24746 const bRank = rank[b2.type];
24747 return aRank > bRank ? 1 : aRank < bRank ? -1 : a2.id.localeCompare(b2.id);
24750 // modules/core/LocationManager.js
24751 var import_which_polygon2 = __toESM(require_which_polygon());
24752 var import_geojson_area2 = __toESM(require_geojson_area());
24753 var _loco = new LocationConflation();
24754 var LocationManager = class {
24760 this._resolved = /* @__PURE__ */ new Map();
24761 this._knownLocationSets = /* @__PURE__ */ new Map();
24762 this._locationIncludedIn = /* @__PURE__ */ new Map();
24763 this._locationExcludedIn = /* @__PURE__ */ new Map();
24764 const world = { locationSet: { include: ["Q2"] } };
24765 this._resolveLocationSet(world);
24766 this._rebuildIndex();
24769 * _validateLocationSet
24770 * Pass an Object with a `locationSet` property.
24771 * Validates the `locationSet` and sets a `locationSetID` property on the object.
24772 * To avoid so much computation we only resolve the include and exclude regions, but not the locationSet itself.
24774 * Use `_resolveLocationSet()` instead if you need to resolve geojson of locationSet, for example to render it.
24775 * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24777 * @param `obj` Object to check, it should have `locationSet` property
24779 _validateLocationSet(obj) {
24780 if (obj.locationSetID) return;
24782 let locationSet = obj.locationSet;
24783 if (!locationSet) {
24784 throw new Error("object missing locationSet property");
24786 if (!locationSet.include) {
24787 locationSet.include = ["Q2"];
24789 const locationSetID = _loco.validateLocationSet(locationSet).id;
24790 obj.locationSetID = locationSetID;
24791 if (this._knownLocationSets.has(locationSetID)) return;
24793 (locationSet.include || []).forEach((location) => {
24794 const locationID = _loco.validateLocation(location).id;
24795 let geojson = this._resolved.get(locationID);
24797 geojson = _loco.resolveLocation(location).feature;
24798 this._resolved.set(locationID, geojson);
24800 area += geojson.properties.area;
24801 let s2 = this._locationIncludedIn.get(locationID);
24803 s2 = /* @__PURE__ */ new Set();
24804 this._locationIncludedIn.set(locationID, s2);
24806 s2.add(locationSetID);
24808 (locationSet.exclude || []).forEach((location) => {
24809 const locationID = _loco.validateLocation(location).id;
24810 let geojson = this._resolved.get(locationID);
24812 geojson = _loco.resolveLocation(location).feature;
24813 this._resolved.set(locationID, geojson);
24815 area -= geojson.properties.area;
24816 let s2 = this._locationExcludedIn.get(locationID);
24818 s2 = /* @__PURE__ */ new Set();
24819 this._locationExcludedIn.set(locationID, s2);
24821 s2.add(locationSetID);
24823 this._knownLocationSets.set(locationSetID, area);
24825 obj.locationSet = { include: ["Q2"] };
24826 obj.locationSetID = "+[Q2]";
24830 * _resolveLocationSet
24831 * Does everything that `_validateLocationSet()` does, but then "resolves" the locationSet into GeoJSON.
24832 * This step is a bit more computationally expensive, so really only needed if you intend to render the shape.
24834 * Note: You need to call `_rebuildIndex()` after you're all finished validating the locationSets.
24836 * @param `obj` Object to check, it should have `locationSet` property
24838 _resolveLocationSet(obj) {
24839 this._validateLocationSet(obj);
24840 if (this._resolved.has(obj.locationSetID)) return;
24842 const result = _loco.resolveLocationSet(obj.locationSet);
24843 const locationSetID = result.id;
24844 obj.locationSetID = locationSetID;
24845 if (!result.feature.geometry.coordinates.length || !result.feature.properties.area) {
24846 throw new Error("locationSet ".concat(locationSetID, " resolves to an empty feature."));
24848 let geojson = JSON.parse(JSON.stringify(result.feature));
24849 geojson.id = locationSetID;
24850 geojson.properties.id = locationSetID;
24851 this._resolved.set(locationSetID, geojson);
24853 obj.locationSet = { include: ["Q2"] };
24854 obj.locationSetID = "+[Q2]";
24859 * Rebuilds the whichPolygon index with whatever features have been resolved into GeoJSON.
24862 this._wp = (0, import_which_polygon2.default)({ features: [...this._resolved.values()] });
24865 * mergeCustomGeoJSON
24866 * Accepts a FeatureCollection-like object containing custom locations
24867 * Each feature must have a filename-like `id`, for example: `something.geojson`
24869 * "type": "FeatureCollection"
24872 * "type": "Feature",
24873 * "id": "philly_metro.geojson",
24874 * "properties": { … },
24875 * "geometry": { … }
24880 * @param `fc` FeatureCollection-like Object containing custom locations
24882 mergeCustomGeoJSON(fc) {
24883 if (!fc || fc.type !== "FeatureCollection" || !Array.isArray(fc.features)) return;
24884 fc.features.forEach((feature3) => {
24885 feature3.properties = feature3.properties || {};
24886 let props = feature3.properties;
24887 let id2 = feature3.id || props.id;
24888 if (!id2 || !/^\S+\.geojson$/i.test(id2)) return;
24889 id2 = id2.toLowerCase();
24893 const area = import_geojson_area2.default.geometry(feature3.geometry) / 1e6;
24894 props.area = Number(area.toFixed(2));
24896 _loco._cache[id2] = feature3;
24900 * mergeLocationSets
24901 * Accepts an Array of Objects containing `locationSet` properties:
24903 * { id: 'preset1', locationSet: {…} },
24904 * { id: 'preset2', locationSet: {…} },
24907 * After validating, the Objects will be decorated with a `locationSetID` property:
24909 * { id: 'preset1', locationSet: {…}, locationSetID: '+[Q2]' },
24910 * { id: 'preset2', locationSet: {…}, locationSetID: '+[Q30]' },
24914 * @param `objects` Objects to check - they should have `locationSet` property
24915 * @return Promise resolved true (this function used to be slow/async, now it's faster and sync)
24917 mergeLocationSets(objects) {
24918 if (!Array.isArray(objects)) return Promise.reject("nothing to do");
24919 objects.forEach((obj) => this._validateLocationSet(obj));
24920 this._rebuildIndex();
24921 return Promise.resolve(objects);
24925 * Returns a locationSetID for a given locationSet (fallback to `+[Q2]`, world)
24926 * (The locationSet doesn't necessarily need to be resolved to compute its `id`)
24928 * @param `locationSet` A locationSet Object, e.g. `{ include: ['us'] }`
24929 * @return String locationSetID, e.g. `+[Q30]`
24931 locationSetID(locationSet) {
24934 locationSetID = _loco.validateLocationSet(locationSet).id;
24936 locationSetID = "+[Q2]";
24938 return locationSetID;
24942 * Returns the resolved GeoJSON feature for a given locationSetID (fallback to 'world')
24943 * A GeoJSON feature:
24947 * properties: { id: '+[Q30]', area: 21817019.17, … },
24951 * @param `locationSetID` String identifier, e.g. `+[Q30]`
24952 * @return GeoJSON object (fallback to world)
24954 feature(locationSetID = "+[Q2]") {
24955 const feature3 = this._resolved.get(locationSetID);
24956 return feature3 || this._resolved.get("+[Q2]");
24960 * Find all the locationSets valid at the given location.
24961 * Results include the area (in km²) to facilitate sorting.
24963 * Object of locationSetIDs to areas (in km²)
24965 * "+[Q2]": 511207893.3958111,
24966 * "+[Q30]": 21817019.17,
24967 * "+[new_jersey.geojson]": 22390.77,
24971 * @param `loc` `[lon,lat]` location to query, e.g. `[-74.4813, 40.7967]`
24972 * @return Object of locationSetIDs valid at given location
24974 locationSetsAt(loc) {
24976 const hits = this._wp(loc, true) || [];
24978 hits.forEach((prop) => {
24979 if (prop.id[0] !== "+") return;
24980 const locationSetID = prop.id;
24981 const area = thiz._knownLocationSets.get(locationSetID);
24983 result[locationSetID] = area;
24986 hits.forEach((prop) => {
24987 if (prop.id[0] === "+") return;
24988 const locationID = prop.id;
24989 const included = thiz._locationIncludedIn.get(locationID);
24990 (included || []).forEach((locationSetID) => {
24991 const area = thiz._knownLocationSets.get(locationSetID);
24993 result[locationSetID] = area;
24997 hits.forEach((prop) => {
24998 if (prop.id[0] === "+") return;
24999 const locationID = prop.id;
25000 const excluded = thiz._locationExcludedIn.get(locationID);
25001 (excluded || []).forEach((locationSetID) => {
25002 delete result[locationSetID];
25007 // Direct access to the location-conflation resolver
25012 var _sharedLocationManager = new LocationManager();
25014 // node_modules/lodash-es/_freeGlobal.js
25015 var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
25016 var freeGlobal_default = freeGlobal;
25018 // node_modules/lodash-es/_root.js
25019 var freeSelf = typeof self == "object" && self && self.Object === Object && self;
25020 var root2 = freeGlobal_default || freeSelf || Function("return this")();
25021 var root_default = root2;
25023 // node_modules/lodash-es/_Symbol.js
25024 var Symbol2 = root_default.Symbol;
25025 var Symbol_default = Symbol2;
25027 // node_modules/lodash-es/_getRawTag.js
25028 var objectProto = Object.prototype;
25029 var hasOwnProperty = objectProto.hasOwnProperty;
25030 var nativeObjectToString = objectProto.toString;
25031 var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
25032 function getRawTag(value) {
25033 var isOwn = hasOwnProperty.call(value, symToStringTag), tag2 = value[symToStringTag];
25035 value[symToStringTag] = void 0;
25036 var unmasked = true;
25039 var result = nativeObjectToString.call(value);
25042 value[symToStringTag] = tag2;
25044 delete value[symToStringTag];
25049 var getRawTag_default = getRawTag;
25051 // node_modules/lodash-es/_objectToString.js
25052 var objectProto2 = Object.prototype;
25053 var nativeObjectToString2 = objectProto2.toString;
25054 function objectToString(value) {
25055 return nativeObjectToString2.call(value);
25057 var objectToString_default = objectToString;
25059 // node_modules/lodash-es/_baseGetTag.js
25060 var nullTag = "[object Null]";
25061 var undefinedTag = "[object Undefined]";
25062 var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
25063 function baseGetTag(value) {
25064 if (value == null) {
25065 return value === void 0 ? undefinedTag : nullTag;
25067 return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
25069 var baseGetTag_default = baseGetTag;
25071 // node_modules/lodash-es/isObjectLike.js
25072 function isObjectLike(value) {
25073 return value != null && typeof value == "object";
25075 var isObjectLike_default = isObjectLike;
25077 // node_modules/lodash-es/isSymbol.js
25078 var symbolTag = "[object Symbol]";
25079 function isSymbol(value) {
25080 return typeof value == "symbol" || isObjectLike_default(value) && baseGetTag_default(value) == symbolTag;
25082 var isSymbol_default = isSymbol;
25084 // node_modules/lodash-es/_arrayMap.js
25085 function arrayMap(array2, iteratee) {
25086 var index = -1, length2 = array2 == null ? 0 : array2.length, result = Array(length2);
25087 while (++index < length2) {
25088 result[index] = iteratee(array2[index], index, array2);
25092 var arrayMap_default = arrayMap;
25094 // node_modules/lodash-es/isArray.js
25095 var isArray = Array.isArray;
25096 var isArray_default = isArray;
25098 // node_modules/lodash-es/_baseToString.js
25099 var INFINITY = 1 / 0;
25100 var symbolProto = Symbol_default ? Symbol_default.prototype : void 0;
25101 var symbolToString = symbolProto ? symbolProto.toString : void 0;
25102 function baseToString(value) {
25103 if (typeof value == "string") {
25106 if (isArray_default(value)) {
25107 return arrayMap_default(value, baseToString) + "";
25109 if (isSymbol_default(value)) {
25110 return symbolToString ? symbolToString.call(value) : "";
25112 var result = value + "";
25113 return result == "0" && 1 / value == -INFINITY ? "-0" : result;
25115 var baseToString_default = baseToString;
25117 // node_modules/lodash-es/_trimmedEndIndex.js
25118 var reWhitespace = /\s/;
25119 function trimmedEndIndex(string) {
25120 var index = string.length;
25121 while (index-- && reWhitespace.test(string.charAt(index))) {
25125 var trimmedEndIndex_default = trimmedEndIndex;
25127 // node_modules/lodash-es/_baseTrim.js
25128 var reTrimStart = /^\s+/;
25129 function baseTrim(string) {
25130 return string ? string.slice(0, trimmedEndIndex_default(string) + 1).replace(reTrimStart, "") : string;
25132 var baseTrim_default = baseTrim;
25134 // node_modules/lodash-es/isObject.js
25135 function isObject(value) {
25136 var type2 = typeof value;
25137 return value != null && (type2 == "object" || type2 == "function");
25139 var isObject_default = isObject;
25141 // node_modules/lodash-es/toNumber.js
25143 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
25144 var reIsBinary = /^0b[01]+$/i;
25145 var reIsOctal = /^0o[0-7]+$/i;
25146 var freeParseInt = parseInt;
25147 function toNumber(value) {
25148 if (typeof value == "number") {
25151 if (isSymbol_default(value)) {
25154 if (isObject_default(value)) {
25155 var other = typeof value.valueOf == "function" ? value.valueOf() : value;
25156 value = isObject_default(other) ? other + "" : other;
25158 if (typeof value != "string") {
25159 return value === 0 ? value : +value;
25161 value = baseTrim_default(value);
25162 var isBinary = reIsBinary.test(value);
25163 return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
25165 var toNumber_default = toNumber;
25167 // node_modules/lodash-es/isFunction.js
25168 var asyncTag = "[object AsyncFunction]";
25169 var funcTag = "[object Function]";
25170 var genTag = "[object GeneratorFunction]";
25171 var proxyTag = "[object Proxy]";
25172 function isFunction(value) {
25173 if (!isObject_default(value)) {
25176 var tag2 = baseGetTag_default(value);
25177 return tag2 == funcTag || tag2 == genTag || tag2 == asyncTag || tag2 == proxyTag;
25179 var isFunction_default = isFunction;
25181 // node_modules/lodash-es/_coreJsData.js
25182 var coreJsData = root_default["__core-js_shared__"];
25183 var coreJsData_default = coreJsData;
25185 // node_modules/lodash-es/_isMasked.js
25186 var maskSrcKey = function() {
25187 var uid = /[^.]+$/.exec(coreJsData_default && coreJsData_default.keys && coreJsData_default.keys.IE_PROTO || "");
25188 return uid ? "Symbol(src)_1." + uid : "";
25190 function isMasked(func) {
25191 return !!maskSrcKey && maskSrcKey in func;
25193 var isMasked_default = isMasked;
25195 // node_modules/lodash-es/_toSource.js
25196 var funcProto = Function.prototype;
25197 var funcToString = funcProto.toString;
25198 function toSource(func) {
25199 if (func != null) {
25201 return funcToString.call(func);
25211 var toSource_default = toSource;
25213 // node_modules/lodash-es/_baseIsNative.js
25214 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
25215 var reIsHostCtor = /^\[object .+?Constructor\]$/;
25216 var funcProto2 = Function.prototype;
25217 var objectProto3 = Object.prototype;
25218 var funcToString2 = funcProto2.toString;
25219 var hasOwnProperty2 = objectProto3.hasOwnProperty;
25220 var reIsNative = RegExp(
25221 "^" + funcToString2.call(hasOwnProperty2).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
25223 function baseIsNative(value) {
25224 if (!isObject_default(value) || isMasked_default(value)) {
25227 var pattern = isFunction_default(value) ? reIsNative : reIsHostCtor;
25228 return pattern.test(toSource_default(value));
25230 var baseIsNative_default = baseIsNative;
25232 // node_modules/lodash-es/_getValue.js
25233 function getValue(object, key) {
25234 return object == null ? void 0 : object[key];
25236 var getValue_default = getValue;
25238 // node_modules/lodash-es/_getNative.js
25239 function getNative(object, key) {
25240 var value = getValue_default(object, key);
25241 return baseIsNative_default(value) ? value : void 0;
25243 var getNative_default = getNative;
25245 // node_modules/lodash-es/_WeakMap.js
25246 var WeakMap = getNative_default(root_default, "WeakMap");
25247 var WeakMap_default = WeakMap;
25249 // node_modules/lodash-es/_isIndex.js
25250 var MAX_SAFE_INTEGER2 = 9007199254740991;
25251 var reIsUint = /^(?:0|[1-9]\d*)$/;
25252 function isIndex(value, length2) {
25253 var type2 = typeof value;
25254 length2 = length2 == null ? MAX_SAFE_INTEGER2 : length2;
25255 return !!length2 && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length2);
25257 var isIndex_default = isIndex;
25259 // node_modules/lodash-es/eq.js
25260 function eq(value, other) {
25261 return value === other || value !== value && other !== other;
25263 var eq_default = eq;
25265 // node_modules/lodash-es/isLength.js
25266 var MAX_SAFE_INTEGER3 = 9007199254740991;
25267 function isLength(value) {
25268 return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER3;
25270 var isLength_default = isLength;
25272 // node_modules/lodash-es/isArrayLike.js
25273 function isArrayLike(value) {
25274 return value != null && isLength_default(value.length) && !isFunction_default(value);
25276 var isArrayLike_default = isArrayLike;
25278 // node_modules/lodash-es/_isPrototype.js
25279 var objectProto4 = Object.prototype;
25280 function isPrototype(value) {
25281 var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4;
25282 return value === proto;
25284 var isPrototype_default = isPrototype;
25286 // node_modules/lodash-es/_baseTimes.js
25287 function baseTimes(n3, iteratee) {
25288 var index = -1, result = Array(n3);
25289 while (++index < n3) {
25290 result[index] = iteratee(index);
25294 var baseTimes_default = baseTimes;
25296 // node_modules/lodash-es/_baseIsArguments.js
25297 var argsTag = "[object Arguments]";
25298 function baseIsArguments(value) {
25299 return isObjectLike_default(value) && baseGetTag_default(value) == argsTag;
25301 var baseIsArguments_default = baseIsArguments;
25303 // node_modules/lodash-es/isArguments.js
25304 var objectProto5 = Object.prototype;
25305 var hasOwnProperty3 = objectProto5.hasOwnProperty;
25306 var propertyIsEnumerable = objectProto5.propertyIsEnumerable;
25307 var isArguments = baseIsArguments_default(/* @__PURE__ */ function() {
25309 }()) ? baseIsArguments_default : function(value) {
25310 return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
25312 var isArguments_default = isArguments;
25314 // node_modules/lodash-es/stubFalse.js
25315 function stubFalse() {
25318 var stubFalse_default = stubFalse;
25320 // node_modules/lodash-es/isBuffer.js
25321 var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
25322 var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
25323 var moduleExports = freeModule && freeModule.exports === freeExports;
25324 var Buffer2 = moduleExports ? root_default.Buffer : void 0;
25325 var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
25326 var isBuffer = nativeIsBuffer || stubFalse_default;
25327 var isBuffer_default = isBuffer;
25329 // node_modules/lodash-es/_baseIsTypedArray.js
25330 var argsTag2 = "[object Arguments]";
25331 var arrayTag = "[object Array]";
25332 var boolTag = "[object Boolean]";
25333 var dateTag = "[object Date]";
25334 var errorTag = "[object Error]";
25335 var funcTag2 = "[object Function]";
25336 var mapTag = "[object Map]";
25337 var numberTag = "[object Number]";
25338 var objectTag = "[object Object]";
25339 var regexpTag = "[object RegExp]";
25340 var setTag = "[object Set]";
25341 var stringTag = "[object String]";
25342 var weakMapTag = "[object WeakMap]";
25343 var arrayBufferTag = "[object ArrayBuffer]";
25344 var dataViewTag = "[object DataView]";
25345 var float32Tag = "[object Float32Array]";
25346 var float64Tag = "[object Float64Array]";
25347 var int8Tag = "[object Int8Array]";
25348 var int16Tag = "[object Int16Array]";
25349 var int32Tag = "[object Int32Array]";
25350 var uint8Tag = "[object Uint8Array]";
25351 var uint8ClampedTag = "[object Uint8ClampedArray]";
25352 var uint16Tag = "[object Uint16Array]";
25353 var uint32Tag = "[object Uint32Array]";
25354 var typedArrayTags = {};
25355 typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
25356 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;
25357 function baseIsTypedArray(value) {
25358 return isObjectLike_default(value) && isLength_default(value.length) && !!typedArrayTags[baseGetTag_default(value)];
25360 var baseIsTypedArray_default = baseIsTypedArray;
25362 // node_modules/lodash-es/_baseUnary.js
25363 function baseUnary(func) {
25364 return function(value) {
25365 return func(value);
25368 var baseUnary_default = baseUnary;
25370 // node_modules/lodash-es/_nodeUtil.js
25371 var freeExports2 = typeof exports == "object" && exports && !exports.nodeType && exports;
25372 var freeModule2 = freeExports2 && typeof module == "object" && module && !module.nodeType && module;
25373 var moduleExports2 = freeModule2 && freeModule2.exports === freeExports2;
25374 var freeProcess = moduleExports2 && freeGlobal_default.process;
25375 var nodeUtil = function() {
25377 var types = freeModule2 && freeModule2.require && freeModule2.require("util").types;
25381 return freeProcess && freeProcess.binding && freeProcess.binding("util");
25385 var nodeUtil_default = nodeUtil;
25387 // node_modules/lodash-es/isTypedArray.js
25388 var nodeIsTypedArray = nodeUtil_default && nodeUtil_default.isTypedArray;
25389 var isTypedArray = nodeIsTypedArray ? baseUnary_default(nodeIsTypedArray) : baseIsTypedArray_default;
25390 var isTypedArray_default = isTypedArray;
25392 // node_modules/lodash-es/_arrayLikeKeys.js
25393 var objectProto6 = Object.prototype;
25394 var hasOwnProperty4 = objectProto6.hasOwnProperty;
25395 function arrayLikeKeys(value, inherited) {
25396 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;
25397 for (var key in value) {
25398 if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
25399 (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
25400 isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
25401 isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
25402 isIndex_default(key, length2)))) {
25408 var arrayLikeKeys_default = arrayLikeKeys;
25410 // node_modules/lodash-es/_overArg.js
25411 function overArg(func, transform2) {
25412 return function(arg) {
25413 return func(transform2(arg));
25416 var overArg_default = overArg;
25418 // node_modules/lodash-es/_nativeKeys.js
25419 var nativeKeys = overArg_default(Object.keys, Object);
25420 var nativeKeys_default = nativeKeys;
25422 // node_modules/lodash-es/_baseKeys.js
25423 var objectProto7 = Object.prototype;
25424 var hasOwnProperty5 = objectProto7.hasOwnProperty;
25425 function baseKeys(object) {
25426 if (!isPrototype_default(object)) {
25427 return nativeKeys_default(object);
25430 for (var key in Object(object)) {
25431 if (hasOwnProperty5.call(object, key) && key != "constructor") {
25437 var baseKeys_default = baseKeys;
25439 // node_modules/lodash-es/keys.js
25440 function keys(object) {
25441 return isArrayLike_default(object) ? arrayLikeKeys_default(object) : baseKeys_default(object);
25443 var keys_default = keys;
25445 // node_modules/lodash-es/_nativeCreate.js
25446 var nativeCreate = getNative_default(Object, "create");
25447 var nativeCreate_default = nativeCreate;
25449 // node_modules/lodash-es/_hashClear.js
25450 function hashClear() {
25451 this.__data__ = nativeCreate_default ? nativeCreate_default(null) : {};
25454 var hashClear_default = hashClear;
25456 // node_modules/lodash-es/_hashDelete.js
25457 function hashDelete(key) {
25458 var result = this.has(key) && delete this.__data__[key];
25459 this.size -= result ? 1 : 0;
25462 var hashDelete_default = hashDelete;
25464 // node_modules/lodash-es/_hashGet.js
25465 var HASH_UNDEFINED = "__lodash_hash_undefined__";
25466 var objectProto8 = Object.prototype;
25467 var hasOwnProperty6 = objectProto8.hasOwnProperty;
25468 function hashGet(key) {
25469 var data = this.__data__;
25470 if (nativeCreate_default) {
25471 var result = data[key];
25472 return result === HASH_UNDEFINED ? void 0 : result;
25474 return hasOwnProperty6.call(data, key) ? data[key] : void 0;
25476 var hashGet_default = hashGet;
25478 // node_modules/lodash-es/_hashHas.js
25479 var objectProto9 = Object.prototype;
25480 var hasOwnProperty7 = objectProto9.hasOwnProperty;
25481 function hashHas(key) {
25482 var data = this.__data__;
25483 return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key);
25485 var hashHas_default = hashHas;
25487 // node_modules/lodash-es/_hashSet.js
25488 var HASH_UNDEFINED2 = "__lodash_hash_undefined__";
25489 function hashSet(key, value) {
25490 var data = this.__data__;
25491 this.size += this.has(key) ? 0 : 1;
25492 data[key] = nativeCreate_default && value === void 0 ? HASH_UNDEFINED2 : value;
25495 var hashSet_default = hashSet;
25497 // node_modules/lodash-es/_Hash.js
25498 function Hash(entries) {
25499 var index = -1, length2 = entries == null ? 0 : entries.length;
25501 while (++index < length2) {
25502 var entry = entries[index];
25503 this.set(entry[0], entry[1]);
25506 Hash.prototype.clear = hashClear_default;
25507 Hash.prototype["delete"] = hashDelete_default;
25508 Hash.prototype.get = hashGet_default;
25509 Hash.prototype.has = hashHas_default;
25510 Hash.prototype.set = hashSet_default;
25511 var Hash_default = Hash;
25513 // node_modules/lodash-es/_listCacheClear.js
25514 function listCacheClear() {
25515 this.__data__ = [];
25518 var listCacheClear_default = listCacheClear;
25520 // node_modules/lodash-es/_assocIndexOf.js
25521 function assocIndexOf(array2, key) {
25522 var length2 = array2.length;
25523 while (length2--) {
25524 if (eq_default(array2[length2][0], key)) {
25530 var assocIndexOf_default = assocIndexOf;
25532 // node_modules/lodash-es/_listCacheDelete.js
25533 var arrayProto = Array.prototype;
25534 var splice = arrayProto.splice;
25535 function listCacheDelete(key) {
25536 var data = this.__data__, index = assocIndexOf_default(data, key);
25540 var lastIndex = data.length - 1;
25541 if (index == lastIndex) {
25544 splice.call(data, index, 1);
25549 var listCacheDelete_default = listCacheDelete;
25551 // node_modules/lodash-es/_listCacheGet.js
25552 function listCacheGet(key) {
25553 var data = this.__data__, index = assocIndexOf_default(data, key);
25554 return index < 0 ? void 0 : data[index][1];
25556 var listCacheGet_default = listCacheGet;
25558 // node_modules/lodash-es/_listCacheHas.js
25559 function listCacheHas(key) {
25560 return assocIndexOf_default(this.__data__, key) > -1;
25562 var listCacheHas_default = listCacheHas;
25564 // node_modules/lodash-es/_listCacheSet.js
25565 function listCacheSet(key, value) {
25566 var data = this.__data__, index = assocIndexOf_default(data, key);
25569 data.push([key, value]);
25571 data[index][1] = value;
25575 var listCacheSet_default = listCacheSet;
25577 // node_modules/lodash-es/_ListCache.js
25578 function ListCache(entries) {
25579 var index = -1, length2 = entries == null ? 0 : entries.length;
25581 while (++index < length2) {
25582 var entry = entries[index];
25583 this.set(entry[0], entry[1]);
25586 ListCache.prototype.clear = listCacheClear_default;
25587 ListCache.prototype["delete"] = listCacheDelete_default;
25588 ListCache.prototype.get = listCacheGet_default;
25589 ListCache.prototype.has = listCacheHas_default;
25590 ListCache.prototype.set = listCacheSet_default;
25591 var ListCache_default = ListCache;
25593 // node_modules/lodash-es/_Map.js
25594 var Map2 = getNative_default(root_default, "Map");
25595 var Map_default = Map2;
25597 // node_modules/lodash-es/_mapCacheClear.js
25598 function mapCacheClear() {
25601 "hash": new Hash_default(),
25602 "map": new (Map_default || ListCache_default)(),
25603 "string": new Hash_default()
25606 var mapCacheClear_default = mapCacheClear;
25608 // node_modules/lodash-es/_isKeyable.js
25609 function isKeyable(value) {
25610 var type2 = typeof value;
25611 return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
25613 var isKeyable_default = isKeyable;
25615 // node_modules/lodash-es/_getMapData.js
25616 function getMapData(map2, key) {
25617 var data = map2.__data__;
25618 return isKeyable_default(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
25620 var getMapData_default = getMapData;
25622 // node_modules/lodash-es/_mapCacheDelete.js
25623 function mapCacheDelete(key) {
25624 var result = getMapData_default(this, key)["delete"](key);
25625 this.size -= result ? 1 : 0;
25628 var mapCacheDelete_default = mapCacheDelete;
25630 // node_modules/lodash-es/_mapCacheGet.js
25631 function mapCacheGet(key) {
25632 return getMapData_default(this, key).get(key);
25634 var mapCacheGet_default = mapCacheGet;
25636 // node_modules/lodash-es/_mapCacheHas.js
25637 function mapCacheHas(key) {
25638 return getMapData_default(this, key).has(key);
25640 var mapCacheHas_default = mapCacheHas;
25642 // node_modules/lodash-es/_mapCacheSet.js
25643 function mapCacheSet(key, value) {
25644 var data = getMapData_default(this, key), size = data.size;
25645 data.set(key, value);
25646 this.size += data.size == size ? 0 : 1;
25649 var mapCacheSet_default = mapCacheSet;
25651 // node_modules/lodash-es/_MapCache.js
25652 function MapCache(entries) {
25653 var index = -1, length2 = entries == null ? 0 : entries.length;
25655 while (++index < length2) {
25656 var entry = entries[index];
25657 this.set(entry[0], entry[1]);
25660 MapCache.prototype.clear = mapCacheClear_default;
25661 MapCache.prototype["delete"] = mapCacheDelete_default;
25662 MapCache.prototype.get = mapCacheGet_default;
25663 MapCache.prototype.has = mapCacheHas_default;
25664 MapCache.prototype.set = mapCacheSet_default;
25665 var MapCache_default = MapCache;
25667 // node_modules/lodash-es/toString.js
25668 function toString(value) {
25669 return value == null ? "" : baseToString_default(value);
25671 var toString_default = toString;
25673 // node_modules/lodash-es/_arrayPush.js
25674 function arrayPush(array2, values) {
25675 var index = -1, length2 = values.length, offset = array2.length;
25676 while (++index < length2) {
25677 array2[offset + index] = values[index];
25681 var arrayPush_default = arrayPush;
25683 // node_modules/lodash-es/_basePropertyOf.js
25684 function basePropertyOf(object) {
25685 return function(key) {
25686 return object == null ? void 0 : object[key];
25689 var basePropertyOf_default = basePropertyOf;
25691 // node_modules/lodash-es/_stackClear.js
25692 function stackClear() {
25693 this.__data__ = new ListCache_default();
25696 var stackClear_default = stackClear;
25698 // node_modules/lodash-es/_stackDelete.js
25699 function stackDelete(key) {
25700 var data = this.__data__, result = data["delete"](key);
25701 this.size = data.size;
25704 var stackDelete_default = stackDelete;
25706 // node_modules/lodash-es/_stackGet.js
25707 function stackGet(key) {
25708 return this.__data__.get(key);
25710 var stackGet_default = stackGet;
25712 // node_modules/lodash-es/_stackHas.js
25713 function stackHas(key) {
25714 return this.__data__.has(key);
25716 var stackHas_default = stackHas;
25718 // node_modules/lodash-es/_stackSet.js
25719 var LARGE_ARRAY_SIZE = 200;
25720 function stackSet(key, value) {
25721 var data = this.__data__;
25722 if (data instanceof ListCache_default) {
25723 var pairs2 = data.__data__;
25724 if (!Map_default || pairs2.length < LARGE_ARRAY_SIZE - 1) {
25725 pairs2.push([key, value]);
25726 this.size = ++data.size;
25729 data = this.__data__ = new MapCache_default(pairs2);
25731 data.set(key, value);
25732 this.size = data.size;
25735 var stackSet_default = stackSet;
25737 // node_modules/lodash-es/_Stack.js
25738 function Stack(entries) {
25739 var data = this.__data__ = new ListCache_default(entries);
25740 this.size = data.size;
25742 Stack.prototype.clear = stackClear_default;
25743 Stack.prototype["delete"] = stackDelete_default;
25744 Stack.prototype.get = stackGet_default;
25745 Stack.prototype.has = stackHas_default;
25746 Stack.prototype.set = stackSet_default;
25747 var Stack_default = Stack;
25749 // node_modules/lodash-es/_arrayFilter.js
25750 function arrayFilter(array2, predicate) {
25751 var index = -1, length2 = array2 == null ? 0 : array2.length, resIndex = 0, result = [];
25752 while (++index < length2) {
25753 var value = array2[index];
25754 if (predicate(value, index, array2)) {
25755 result[resIndex++] = value;
25760 var arrayFilter_default = arrayFilter;
25762 // node_modules/lodash-es/stubArray.js
25763 function stubArray() {
25766 var stubArray_default = stubArray;
25768 // node_modules/lodash-es/_getSymbols.js
25769 var objectProto10 = Object.prototype;
25770 var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable;
25771 var nativeGetSymbols = Object.getOwnPropertySymbols;
25772 var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) {
25773 if (object == null) {
25776 object = Object(object);
25777 return arrayFilter_default(nativeGetSymbols(object), function(symbol) {
25778 return propertyIsEnumerable2.call(object, symbol);
25781 var getSymbols_default = getSymbols;
25783 // node_modules/lodash-es/_baseGetAllKeys.js
25784 function baseGetAllKeys(object, keysFunc, symbolsFunc) {
25785 var result = keysFunc(object);
25786 return isArray_default(object) ? result : arrayPush_default(result, symbolsFunc(object));
25788 var baseGetAllKeys_default = baseGetAllKeys;
25790 // node_modules/lodash-es/_getAllKeys.js
25791 function getAllKeys(object) {
25792 return baseGetAllKeys_default(object, keys_default, getSymbols_default);
25794 var getAllKeys_default = getAllKeys;
25796 // node_modules/lodash-es/_DataView.js
25797 var DataView2 = getNative_default(root_default, "DataView");
25798 var DataView_default = DataView2;
25800 // node_modules/lodash-es/_Promise.js
25801 var Promise2 = getNative_default(root_default, "Promise");
25802 var Promise_default = Promise2;
25804 // node_modules/lodash-es/_Set.js
25805 var Set2 = getNative_default(root_default, "Set");
25806 var Set_default = Set2;
25808 // node_modules/lodash-es/_getTag.js
25809 var mapTag2 = "[object Map]";
25810 var objectTag2 = "[object Object]";
25811 var promiseTag = "[object Promise]";
25812 var setTag2 = "[object Set]";
25813 var weakMapTag2 = "[object WeakMap]";
25814 var dataViewTag2 = "[object DataView]";
25815 var dataViewCtorString = toSource_default(DataView_default);
25816 var mapCtorString = toSource_default(Map_default);
25817 var promiseCtorString = toSource_default(Promise_default);
25818 var setCtorString = toSource_default(Set_default);
25819 var weakMapCtorString = toSource_default(WeakMap_default);
25820 var getTag = baseGetTag_default;
25821 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) {
25822 getTag = function(value) {
25823 var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : "";
25825 switch (ctorString) {
25826 case dataViewCtorString:
25827 return dataViewTag2;
25828 case mapCtorString:
25830 case promiseCtorString:
25832 case setCtorString:
25834 case weakMapCtorString:
25835 return weakMapTag2;
25841 var getTag_default = getTag;
25843 // node_modules/lodash-es/_Uint8Array.js
25844 var Uint8Array2 = root_default.Uint8Array;
25845 var Uint8Array_default = Uint8Array2;
25847 // node_modules/lodash-es/_setCacheAdd.js
25848 var HASH_UNDEFINED3 = "__lodash_hash_undefined__";
25849 function setCacheAdd(value) {
25850 this.__data__.set(value, HASH_UNDEFINED3);
25853 var setCacheAdd_default = setCacheAdd;
25855 // node_modules/lodash-es/_setCacheHas.js
25856 function setCacheHas(value) {
25857 return this.__data__.has(value);
25859 var setCacheHas_default = setCacheHas;
25861 // node_modules/lodash-es/_SetCache.js
25862 function SetCache(values) {
25863 var index = -1, length2 = values == null ? 0 : values.length;
25864 this.__data__ = new MapCache_default();
25865 while (++index < length2) {
25866 this.add(values[index]);
25869 SetCache.prototype.add = SetCache.prototype.push = setCacheAdd_default;
25870 SetCache.prototype.has = setCacheHas_default;
25871 var SetCache_default = SetCache;
25873 // node_modules/lodash-es/_arraySome.js
25874 function arraySome(array2, predicate) {
25875 var index = -1, length2 = array2 == null ? 0 : array2.length;
25876 while (++index < length2) {
25877 if (predicate(array2[index], index, array2)) {
25883 var arraySome_default = arraySome;
25885 // node_modules/lodash-es/_cacheHas.js
25886 function cacheHas(cache, key) {
25887 return cache.has(key);
25889 var cacheHas_default = cacheHas;
25891 // node_modules/lodash-es/_equalArrays.js
25892 var COMPARE_PARTIAL_FLAG = 1;
25893 var COMPARE_UNORDERED_FLAG = 2;
25894 function equalArrays(array2, other, bitmask, customizer, equalFunc, stack) {
25895 var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array2.length, othLength = other.length;
25896 if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
25899 var arrStacked = stack.get(array2);
25900 var othStacked = stack.get(other);
25901 if (arrStacked && othStacked) {
25902 return arrStacked == other && othStacked == array2;
25904 var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache_default() : void 0;
25905 stack.set(array2, other);
25906 stack.set(other, array2);
25907 while (++index < arrLength) {
25908 var arrValue = array2[index], othValue = other[index];
25910 var compared = isPartial ? customizer(othValue, arrValue, index, other, array2, stack) : customizer(arrValue, othValue, index, array2, other, stack);
25912 if (compared !== void 0) {
25920 if (!arraySome_default(other, function(othValue2, othIndex) {
25921 if (!cacheHas_default(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
25922 return seen.push(othIndex);
25928 } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
25933 stack["delete"](array2);
25934 stack["delete"](other);
25937 var equalArrays_default = equalArrays;
25939 // node_modules/lodash-es/_mapToArray.js
25940 function mapToArray(map2) {
25941 var index = -1, result = Array(map2.size);
25942 map2.forEach(function(value, key) {
25943 result[++index] = [key, value];
25947 var mapToArray_default = mapToArray;
25949 // node_modules/lodash-es/_setToArray.js
25950 function setToArray(set4) {
25951 var index = -1, result = Array(set4.size);
25952 set4.forEach(function(value) {
25953 result[++index] = value;
25957 var setToArray_default = setToArray;
25959 // node_modules/lodash-es/_equalByTag.js
25960 var COMPARE_PARTIAL_FLAG2 = 1;
25961 var COMPARE_UNORDERED_FLAG2 = 2;
25962 var boolTag2 = "[object Boolean]";
25963 var dateTag2 = "[object Date]";
25964 var errorTag2 = "[object Error]";
25965 var mapTag3 = "[object Map]";
25966 var numberTag2 = "[object Number]";
25967 var regexpTag2 = "[object RegExp]";
25968 var setTag3 = "[object Set]";
25969 var stringTag2 = "[object String]";
25970 var symbolTag2 = "[object Symbol]";
25971 var arrayBufferTag2 = "[object ArrayBuffer]";
25972 var dataViewTag3 = "[object DataView]";
25973 var symbolProto2 = Symbol_default ? Symbol_default.prototype : void 0;
25974 var symbolValueOf = symbolProto2 ? symbolProto2.valueOf : void 0;
25975 function equalByTag(object, other, tag2, bitmask, customizer, equalFunc, stack) {
25978 if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
25981 object = object.buffer;
25982 other = other.buffer;
25983 case arrayBufferTag2:
25984 if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array_default(object), new Uint8Array_default(other))) {
25991 return eq_default(+object, +other);
25993 return object.name == other.name && object.message == other.message;
25996 return object == other + "";
25998 var convert = mapToArray_default;
26000 var isPartial = bitmask & COMPARE_PARTIAL_FLAG2;
26001 convert || (convert = setToArray_default);
26002 if (object.size != other.size && !isPartial) {
26005 var stacked = stack.get(object);
26007 return stacked == other;
26009 bitmask |= COMPARE_UNORDERED_FLAG2;
26010 stack.set(object, other);
26011 var result = equalArrays_default(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
26012 stack["delete"](object);
26015 if (symbolValueOf) {
26016 return symbolValueOf.call(object) == symbolValueOf.call(other);
26021 var equalByTag_default = equalByTag;
26023 // node_modules/lodash-es/_equalObjects.js
26024 var COMPARE_PARTIAL_FLAG3 = 1;
26025 var objectProto11 = Object.prototype;
26026 var hasOwnProperty8 = objectProto11.hasOwnProperty;
26027 function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
26028 var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length;
26029 if (objLength != othLength && !isPartial) {
26032 var index = objLength;
26034 var key = objProps[index];
26035 if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) {
26039 var objStacked = stack.get(object);
26040 var othStacked = stack.get(other);
26041 if (objStacked && othStacked) {
26042 return objStacked == other && othStacked == object;
26045 stack.set(object, other);
26046 stack.set(other, object);
26047 var skipCtor = isPartial;
26048 while (++index < objLength) {
26049 key = objProps[index];
26050 var objValue = object[key], othValue = other[key];
26052 var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
26054 if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
26058 skipCtor || (skipCtor = key == "constructor");
26060 if (result && !skipCtor) {
26061 var objCtor = object.constructor, othCtor = other.constructor;
26062 if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
26066 stack["delete"](object);
26067 stack["delete"](other);
26070 var equalObjects_default = equalObjects;
26072 // node_modules/lodash-es/_baseIsEqualDeep.js
26073 var COMPARE_PARTIAL_FLAG4 = 1;
26074 var argsTag3 = "[object Arguments]";
26075 var arrayTag2 = "[object Array]";
26076 var objectTag3 = "[object Object]";
26077 var objectProto12 = Object.prototype;
26078 var hasOwnProperty9 = objectProto12.hasOwnProperty;
26079 function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
26080 var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other);
26081 objTag = objTag == argsTag3 ? objectTag3 : objTag;
26082 othTag = othTag == argsTag3 ? objectTag3 : othTag;
26083 var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag;
26084 if (isSameTag && isBuffer_default(object)) {
26085 if (!isBuffer_default(other)) {
26091 if (isSameTag && !objIsObj) {
26092 stack || (stack = new Stack_default());
26093 return objIsArr || isTypedArray_default(object) ? equalArrays_default(object, other, bitmask, customizer, equalFunc, stack) : equalByTag_default(object, other, objTag, bitmask, customizer, equalFunc, stack);
26095 if (!(bitmask & COMPARE_PARTIAL_FLAG4)) {
26096 var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__");
26097 if (objIsWrapped || othIsWrapped) {
26098 var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
26099 stack || (stack = new Stack_default());
26100 return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
26106 stack || (stack = new Stack_default());
26107 return equalObjects_default(object, other, bitmask, customizer, equalFunc, stack);
26109 var baseIsEqualDeep_default = baseIsEqualDeep;
26111 // node_modules/lodash-es/_baseIsEqual.js
26112 function baseIsEqual(value, other, bitmask, customizer, stack) {
26113 if (value === other) {
26116 if (value == null || other == null || !isObjectLike_default(value) && !isObjectLike_default(other)) {
26117 return value !== value && other !== other;
26119 return baseIsEqualDeep_default(value, other, bitmask, customizer, baseIsEqual, stack);
26121 var baseIsEqual_default = baseIsEqual;
26123 // node_modules/lodash-es/now.js
26124 var now2 = function() {
26125 return root_default.Date.now();
26127 var now_default = now2;
26129 // node_modules/lodash-es/debounce.js
26130 var FUNC_ERROR_TEXT = "Expected a function";
26131 var nativeMax = Math.max;
26132 var nativeMin = Math.min;
26133 function debounce(func, wait, options2) {
26134 var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
26135 if (typeof func != "function") {
26136 throw new TypeError(FUNC_ERROR_TEXT);
26138 wait = toNumber_default(wait) || 0;
26139 if (isObject_default(options2)) {
26140 leading = !!options2.leading;
26141 maxing = "maxWait" in options2;
26142 maxWait = maxing ? nativeMax(toNumber_default(options2.maxWait) || 0, wait) : maxWait;
26143 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
26145 function invokeFunc(time) {
26146 var args = lastArgs, thisArg = lastThis;
26147 lastArgs = lastThis = void 0;
26148 lastInvokeTime = time;
26149 result = func.apply(thisArg, args);
26152 function leadingEdge(time) {
26153 lastInvokeTime = time;
26154 timerId = setTimeout(timerExpired, wait);
26155 return leading ? invokeFunc(time) : result;
26157 function remainingWait(time) {
26158 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
26159 return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
26161 function shouldInvoke(time) {
26162 var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
26163 return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
26165 function timerExpired() {
26166 var time = now_default();
26167 if (shouldInvoke(time)) {
26168 return trailingEdge(time);
26170 timerId = setTimeout(timerExpired, remainingWait(time));
26172 function trailingEdge(time) {
26174 if (trailing && lastArgs) {
26175 return invokeFunc(time);
26177 lastArgs = lastThis = void 0;
26180 function cancel() {
26181 if (timerId !== void 0) {
26182 clearTimeout(timerId);
26184 lastInvokeTime = 0;
26185 lastArgs = lastCallTime = lastThis = timerId = void 0;
26188 return timerId === void 0 ? result : trailingEdge(now_default());
26190 function debounced() {
26191 var time = now_default(), isInvoking = shouldInvoke(time);
26192 lastArgs = arguments;
26194 lastCallTime = time;
26196 if (timerId === void 0) {
26197 return leadingEdge(lastCallTime);
26200 clearTimeout(timerId);
26201 timerId = setTimeout(timerExpired, wait);
26202 return invokeFunc(lastCallTime);
26205 if (timerId === void 0) {
26206 timerId = setTimeout(timerExpired, wait);
26210 debounced.cancel = cancel;
26211 debounced.flush = flush;
26214 var debounce_default = debounce;
26216 // node_modules/lodash-es/_escapeHtmlChar.js
26217 var htmlEscapes = {
26224 var escapeHtmlChar = basePropertyOf_default(htmlEscapes);
26225 var escapeHtmlChar_default = escapeHtmlChar;
26227 // node_modules/lodash-es/escape.js
26228 var reUnescapedHtml = /[&<>"']/g;
26229 var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
26230 function escape2(string) {
26231 string = toString_default(string);
26232 return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar_default) : string;
26234 var escape_default = escape2;
26236 // node_modules/lodash-es/isEqual.js
26237 function isEqual(value, other) {
26238 return baseIsEqual_default(value, other);
26240 var isEqual_default = isEqual;
26242 // node_modules/lodash-es/isNumber.js
26243 var numberTag3 = "[object Number]";
26244 function isNumber(value) {
26245 return typeof value == "number" || isObjectLike_default(value) && baseGetTag_default(value) == numberTag3;
26247 var isNumber_default = isNumber;
26249 // node_modules/lodash-es/throttle.js
26250 var FUNC_ERROR_TEXT2 = "Expected a function";
26251 function throttle(func, wait, options2) {
26252 var leading = true, trailing = true;
26253 if (typeof func != "function") {
26254 throw new TypeError(FUNC_ERROR_TEXT2);
26256 if (isObject_default(options2)) {
26257 leading = "leading" in options2 ? !!options2.leading : leading;
26258 trailing = "trailing" in options2 ? !!options2.trailing : trailing;
26260 return debounce_default(func, wait, {
26261 "leading": leading,
26263 "trailing": trailing
26266 var throttle_default = throttle;
26268 // node_modules/lodash-es/_unescapeHtmlChar.js
26269 var htmlUnescapes = {
26276 var unescapeHtmlChar = basePropertyOf_default(htmlUnescapes);
26277 var unescapeHtmlChar_default = unescapeHtmlChar;
26279 // node_modules/lodash-es/unescape.js
26280 var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
26281 var reHasEscapedHtml = RegExp(reEscapedHtml.source);
26282 function unescape(string) {
26283 string = toString_default(string);
26284 return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar_default) : string;
26286 var unescape_default = unescape;
26288 // modules/util/detect.js
26290 function utilDetect(refresh2) {
26291 if (_detected && !refresh2) return _detected;
26293 const ua = navigator.userAgent;
26295 m2 = ua.match(/(edge)\/?\s*(\.?\d+(\.\d+)*)/i);
26297 _detected.browser = m2[1];
26298 _detected.version = m2[2];
26300 if (!_detected.browser) {
26301 m2 = ua.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/i);
26303 _detected.browser = "msie";
26304 _detected.version = m2[1];
26307 if (!_detected.browser) {
26308 m2 = ua.match(/(opr)\/?\s*(\.?\d+(\.\d+)*)/i);
26310 _detected.browser = "Opera";
26311 _detected.version = m2[2];
26314 if (!_detected.browser) {
26315 m2 = ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
26317 _detected.browser = m2[1];
26318 _detected.version = m2[2];
26319 m2 = ua.match(/version\/([\.\d]+)/i);
26320 if (m2 !== null) _detected.version = m2[1];
26323 if (!_detected.browser) {
26324 _detected.browser = navigator.appName;
26325 _detected.version = navigator.appVersion;
26327 _detected.version = _detected.version.split(/\W/).slice(0, 2).join(".");
26328 _detected.opera = _detected.browser.toLowerCase() === "opera" && Number(_detected.version) < 15;
26329 if (_detected.browser.toLowerCase() === "msie") {
26330 _detected.ie = true;
26331 _detected.browser = "Internet Explorer";
26332 _detected.support = false;
26334 _detected.ie = false;
26335 _detected.support = true;
26337 _detected.filedrop = window.FileReader && "ondrop" in window;
26338 if (/Win/.test(ua)) {
26339 _detected.os = "win";
26340 _detected.platform = "Windows";
26341 } else if (/Mac/.test(ua)) {
26342 _detected.os = "mac";
26343 _detected.platform = "Macintosh";
26344 } else if (/X11/.test(ua) || /Linux/.test(ua)) {
26345 _detected.os = "linux";
26346 _detected.platform = "Linux";
26348 _detected.os = "win";
26349 _detected.platform = "Unknown";
26351 _detected.isMobileWebKit = (/\b(iPad|iPhone|iPod)\b/.test(ua) || // HACK: iPadOS 13+ requests desktop sites by default by using a Mac user agent,
26352 // so assume any "mac" with multitouch is actually iOS
26353 navigator.platform === "MacIntel" && "maxTouchPoints" in navigator && navigator.maxTouchPoints > 1) && /WebKit/.test(ua) && !/Edge/.test(ua) && !window.MSStream;
26354 _detected.browserLocales = Array.from(new Set(
26355 // remove duplicates
26356 [navigator.language].concat(navigator.languages || []).concat([
26357 // old property for backwards compatibility
26358 navigator.userLanguage
26361 const loc = window.top.location;
26362 let origin = loc.origin;
26364 origin = loc.protocol + "//" + loc.hostname + (loc.port ? ":" + loc.port : "");
26366 _detected.host = origin + loc.pathname;
26370 // modules/util/aes.js
26371 var import_aes_js = __toESM(require_aes_js());
26372 var DEFAULT_128 = [250, 157, 60, 79, 142, 134, 229, 129, 138, 126, 210, 129, 29, 71, 160, 208];
26373 function utilAesEncrypt(text, key) {
26374 key = key || DEFAULT_128;
26375 const textBytes = import_aes_js.default.utils.utf8.toBytes(text);
26376 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
26377 const encryptedBytes = aesCtr.encrypt(textBytes);
26378 const encryptedHex = import_aes_js.default.utils.hex.fromBytes(encryptedBytes);
26379 return encryptedHex;
26381 function utilAesDecrypt(encryptedHex, key) {
26382 key = key || DEFAULT_128;
26383 const encryptedBytes = import_aes_js.default.utils.hex.toBytes(encryptedHex);
26384 const aesCtr = new import_aes_js.default.ModeOfOperation.ctr(key);
26385 const decryptedBytes = aesCtr.decrypt(encryptedBytes);
26386 const text = import_aes_js.default.utils.utf8.fromBytes(decryptedBytes);
26390 // modules/util/clean_tags.js
26391 function utilCleanTags(tags) {
26393 for (var k2 in tags) {
26396 if (v2 !== void 0) {
26397 out[k2] = cleanValue(k2, v2);
26401 function cleanValue(k3, v3) {
26402 function keepSpaces(k4) {
26403 return /_hours|_times|:conditional$/.test(k4);
26405 function skip(k4) {
26406 return /^(description|note|fixme|inscription)$/.test(k4);
26408 if (skip(k3)) return v3;
26409 var cleaned = v3.split(";").map(function(s2) {
26411 }).join(keepSpaces(k3) ? "; " : ";");
26412 if (k3.indexOf("website") !== -1 || k3.indexOf("email") !== -1 || cleaned.indexOf("http") === 0) {
26413 cleaned = cleaned.replace(/[\u200B-\u200F\uFEFF]/g, "");
26419 // modules/util/get_set_value.js
26420 function utilGetSetValue(selection2, value, shouldUpdate) {
26421 function setValue(value2, shouldUpdate2) {
26422 function valueNull() {
26425 function valueConstant() {
26426 if (shouldUpdate2(this.value, value2)) {
26427 this.value = value2;
26430 function valueFunction() {
26431 var x2 = value2.apply(this, arguments);
26432 if (x2 === null || x2 === void 0) {
26434 } else if (shouldUpdate2(this.value, x2)) {
26438 return value2 === null || value2 === void 0 ? valueNull : typeof value2 === "function" ? valueFunction : valueConstant;
26440 if (arguments.length === 1) {
26441 return selection2.property("value");
26443 if (shouldUpdate === void 0) {
26444 shouldUpdate = (a2, b2) => a2 !== b2;
26446 return selection2.each(setValue(value, shouldUpdate));
26449 // modules/util/keybinding.js
26450 function utilKeybinding(namespace) {
26451 var _keybindings = {};
26452 function testBindings(d3_event, isCapturing) {
26453 var didMatch = false;
26454 var bindings = Object.keys(_keybindings).map(function(id2) {
26455 return _keybindings[id2];
26458 for (i3 = 0; i3 < bindings.length; i3++) {
26459 binding = bindings[i3];
26460 if (!binding.event.modifiers.shiftKey) continue;
26461 if (!!binding.capture !== isCapturing) continue;
26462 if (matches(d3_event, binding, true)) {
26463 binding.callback(d3_event);
26468 if (didMatch) return;
26469 for (i3 = 0; i3 < bindings.length; i3++) {
26470 binding = bindings[i3];
26471 if (binding.event.modifiers.shiftKey) continue;
26472 if (!!binding.capture !== isCapturing) continue;
26473 if (matches(d3_event, binding, false)) {
26474 binding.callback(d3_event);
26478 function matches(d3_event2, binding2, testShift) {
26479 var event = d3_event2;
26480 var isMatch = false;
26481 var tryKeyCode = true;
26482 if (event.key !== void 0) {
26483 tryKeyCode = event.key.charCodeAt(0) > 127;
26485 if (binding2.event.key === void 0) {
26487 } else if (Array.isArray(binding2.event.key)) {
26488 if (binding2.event.key.map(function(s2) {
26489 return s2.toLowerCase();
26490 }).indexOf(event.key.toLowerCase()) === -1) {
26494 if (event.key.toLowerCase() !== binding2.event.key.toLowerCase()) {
26499 if (!isMatch && (tryKeyCode || binding2.event.modifiers.altKey)) {
26500 isMatch = event.keyCode === binding2.event.keyCode;
26502 if (!isMatch) return false;
26503 if (!(event.ctrlKey && event.altKey)) {
26504 if (event.ctrlKey !== binding2.event.modifiers.ctrlKey) return false;
26505 if (event.altKey !== binding2.event.modifiers.altKey) return false;
26507 if (event.metaKey !== binding2.event.modifiers.metaKey) return false;
26508 if (testShift && event.shiftKey !== binding2.event.modifiers.shiftKey) return false;
26512 function capture(d3_event) {
26513 testBindings(d3_event, true);
26515 function bubble(d3_event) {
26516 var tagName = select_default2(d3_event.target).node().tagName;
26517 if (tagName === "INPUT" || tagName === "SELECT" || tagName === "TEXTAREA") {
26520 testBindings(d3_event, false);
26522 function keybinding(selection2) {
26523 selection2 = selection2 || select_default2(document);
26524 selection2.on("keydown.capture." + namespace, capture, true);
26525 selection2.on("keydown.bubble." + namespace, bubble, false);
26528 keybinding.unbind = function(selection2) {
26530 selection2 = selection2 || select_default2(document);
26531 selection2.on("keydown.capture." + namespace, null);
26532 selection2.on("keydown.bubble." + namespace, null);
26535 keybinding.clear = function() {
26539 keybinding.off = function(codes, capture2) {
26540 var arr = utilArrayUniq([].concat(codes));
26541 for (var i3 = 0; i3 < arr.length; i3++) {
26542 var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26543 delete _keybindings[id2];
26547 keybinding.on = function(codes, callback, capture2) {
26548 if (typeof callback !== "function") {
26549 return keybinding.off(codes, capture2);
26551 var arr = utilArrayUniq([].concat(codes));
26552 for (var i3 = 0; i3 < arr.length; i3++) {
26553 var id2 = arr[i3] + (capture2 ? "-capture" : "-bubble");
26571 if (_keybindings[id2]) {
26572 console.warn('warning: duplicate keybinding for "' + id2 + '"');
26574 _keybindings[id2] = binding;
26575 var matches = arr[i3].toLowerCase().match(/(?:(?:[^+⇧⌃⌥⌘])+|[⇧⌃⌥⌘]|\+\+|^\+$)/g);
26576 for (var j2 = 0; j2 < matches.length; j2++) {
26577 if (matches[j2] === "++") matches[j2] = "+";
26578 if (matches[j2] in utilKeybinding.modifierCodes) {
26579 var prop = utilKeybinding.modifierProperties[utilKeybinding.modifierCodes[matches[j2]]];
26580 binding.event.modifiers[prop] = true;
26582 binding.event.key = utilKeybinding.keys[matches[j2]] || matches[j2];
26583 if (matches[j2] in utilKeybinding.keyCodes) {
26584 binding.event.keyCode = utilKeybinding.keyCodes[matches[j2]];
26593 utilKeybinding.modifierCodes = {
26597 // CTRL key, on Mac: ⌃
26600 // ALT key, on Mac: ⌥ (Alt)
26604 // META, on Mac: ⌘ (CMD), on Windows (Win), on Linux (Super)
26611 utilKeybinding.modifierProperties = {
26617 utilKeybinding.plusKeys = ["plus", "ffplus", "=", "ffequals", "\u2260", "\xB1"];
26618 utilKeybinding.minusKeys = ["_", "-", "ffminus", "dash", "\u2013", "\u2014"];
26619 utilKeybinding.keys = {
26620 // Backspace key, on Mac: ⌫ (Backspace)
26621 "\u232B": "Backspace",
26622 backspace: "Backspace",
26623 // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26636 "pause-break": "Pause",
26637 // Caps Lock key, ⇪
26638 "\u21EA": "CapsLock",
26640 "caps-lock": "CapsLock",
26641 // Escape key, on Mac: ⎋, on Windows: Esc
26642 "\u238B": ["Escape", "Esc"],
26643 escape: ["Escape", "Esc"],
26644 esc: ["Escape", "Esc"],
26646 space: [" ", "Spacebar"],
26647 // Page-Up key, or pgup, on Mac: ↖
26648 "\u2196": "PageUp",
26650 "page-up": "PageUp",
26651 // Page-Down key, or pgdown, on Mac: ↘
26652 "\u2198": "PageDown",
26653 pgdown: "PageDown",
26654 "page-down": "PageDown",
26655 // END key, on Mac: ⇟
26658 // HOME key, on Mac: ⇞
26661 // Insert key, or ins
26664 // Delete key, on Mac: ⌦ (Delete)
26665 "\u2326": ["Delete", "Del"],
26666 del: ["Delete", "Del"],
26667 "delete": ["Delete", "Del"],
26668 // Left Arrow Key, or ←
26669 "\u2190": ["ArrowLeft", "Left"],
26670 left: ["ArrowLeft", "Left"],
26671 "arrow-left": ["ArrowLeft", "Left"],
26672 // Up Arrow Key, or ↑
26673 "\u2191": ["ArrowUp", "Up"],
26674 up: ["ArrowUp", "Up"],
26675 "arrow-up": ["ArrowUp", "Up"],
26676 // Right Arrow Key, or →
26677 "\u2192": ["ArrowRight", "Right"],
26678 right: ["ArrowRight", "Right"],
26679 "arrow-right": ["ArrowRight", "Right"],
26680 // Up Arrow Key, or ↓
26681 "\u2193": ["ArrowDown", "Down"],
26682 down: ["ArrowDown", "Down"],
26683 "arrow-down": ["ArrowDown", "Down"],
26684 // odities, stuff for backward compatibility (browsers and code):
26685 // Num-Multiply, or *
26686 "*": ["*", "Multiply"],
26687 star: ["*", "Multiply"],
26688 asterisk: ["*", "Multiply"],
26689 multiply: ["*", "Multiply"],
26692 "plus": ["+", "Add"],
26693 // Num-Subtract, or -
26694 "-": ["-", "Subtract"],
26695 subtract: ["-", "Subtract"],
26696 "dash": ["-", "Subtract"],
26703 // Period, or ., or full-stop
26706 // Slash, or /, or forward-slash
26708 "forward-slash": "/",
26709 // Tick, or `, or back-quote
26712 // Open bracket, or [
26713 "open-bracket": "[",
26714 // Back slash, or \
26715 "back-slash": "\\",
26716 // Close bracket, or ]
26717 "close-bracket": "]",
26718 // Apostrophe, or Quote, or '
26759 utilKeybinding.keyCodes = {
26760 // Backspace key, on Mac: ⌫ (Backspace)
26763 // Tab Key, on Mac: ⇥ (Tab), on Windows ⇥⇥
26777 // Caps Lock key, ⇪
26781 // Escape key, on Mac: ⎋, on Windows: Esc
26787 // Page-Up key, or pgup, on Mac: ↖
26791 // Page-Down key, or pgdown, on Mac: ↘
26795 // END key, on Mac: ⇟
26798 // HOME key, on Mac: ⇞
26801 // Insert key, or ins
26804 // Delete key, on Mac: ⌦ (Delete)
26808 // Left Arrow Key, or ←
26812 // Up Arrow Key, or ↑
26816 // Right Arrow Key, or →
26820 // Up Arrow Key, or ↓
26824 // odities, printing characters that come out wrong:
26827 // Num-Multiply, or *
26835 // Num-Subtract, or -
26838 // Vertical Bar / Pipe
26853 // Dash / Underscore key
26855 // Period, or ., or full-stop
26859 // Slash, or /, or forward-slash
26862 "forward-slash": 191,
26863 // Tick, or `, or back-quote
26867 // Open bracket, or [
26869 "open-bracket": 219,
26870 // Back slash, or \
26873 // Close bracket, or ]
26875 "close-bracket": 221,
26876 // Apostrophe, or Quote, or '
26883 while (++i < 106) {
26884 utilKeybinding.keyCodes["num-" + n] = i;
26890 utilKeybinding.keyCodes[n] = i;
26895 while (++i < 136) {
26896 utilKeybinding.keyCodes["f" + n] = i;
26901 utilKeybinding.keyCodes[String.fromCharCode(i).toLowerCase()] = i;
26904 // modules/util/object.js
26905 function utilObjectOmit(obj, omitKeys) {
26906 return Object.keys(obj).reduce(function(result, key) {
26907 if (omitKeys.indexOf(key) === -1) {
26908 result[key] = obj[key];
26914 // modules/util/rebind.js
26915 function utilRebind(target, source) {
26916 var i3 = 1, n3 = arguments.length, method;
26917 while (++i3 < n3) {
26918 target[method = arguments[i3]] = d3_rebind(target, source, source[method]);
26922 function d3_rebind(target, source, method) {
26923 return function() {
26924 var value = method.apply(source, arguments);
26925 return value === source ? target : value;
26929 // modules/util/session_mutex.js
26930 function utilSessionMutex(name) {
26934 var expires = /* @__PURE__ */ new Date();
26935 expires.setSeconds(expires.getSeconds() + 5);
26936 document.cookie = name + "=1; expires=" + expires.toUTCString() + "; sameSite=strict";
26938 mutex.lock = function() {
26939 if (intervalID) return true;
26940 var cookie = document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + name + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1");
26941 if (cookie) return false;
26943 intervalID = window.setInterval(renew, 4e3);
26946 mutex.unlock = function() {
26947 if (!intervalID) return;
26948 document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; sameSite=strict";
26949 clearInterval(intervalID);
26952 mutex.locked = function() {
26953 return !!intervalID;
26958 // modules/util/tiler.js
26959 function utilTiler() {
26960 var _size = [256, 256];
26962 var _tileSize = 256;
26963 var _zoomExtent = [0, 20];
26964 var _translate = [_size[0] / 2, _size[1] / 2];
26966 var _skipNullIsland = false;
26967 function clamp3(num, min3, max3) {
26968 return Math.max(min3, Math.min(num, max3));
26970 function nearNullIsland(tile) {
26975 var center = Math.pow(2, z2 - 1);
26976 var width = Math.pow(2, z2 - 6);
26977 var min3 = center - width / 2;
26978 var max3 = center + width / 2 - 1;
26979 return x2 >= min3 && x2 <= max3 && y2 >= min3 && y2 <= max3;
26983 function tiler8() {
26984 var z2 = geoScaleToZoom(_scale / (2 * Math.PI), _tileSize);
26985 var z0 = clamp3(Math.round(z2), _zoomExtent[0], _zoomExtent[1]);
26987 var tileMax = Math.pow(2, z0) - 1;
26988 var log2ts = Math.log(_tileSize) * Math.LOG2E;
26989 var k2 = Math.pow(2, z2 - z0 + log2ts);
26991 (_translate[0] - _scale / 2) / k2,
26992 (_translate[1] - _scale / 2) / k2
26995 clamp3(Math.floor(-origin[0]) - _margin, tileMin, tileMax + 1),
26996 clamp3(Math.ceil(_size[0] / k2 - origin[0]) + _margin, tileMin, tileMax + 1)
26999 clamp3(Math.floor(-origin[1]) - _margin, tileMin, tileMax + 1),
27000 clamp3(Math.ceil(_size[1] / k2 - origin[1]) + _margin, tileMin, tileMax + 1)
27003 for (var i3 = 0; i3 < rows.length; i3++) {
27005 for (var j2 = 0; j2 < cols.length; j2++) {
27007 if (i3 >= _margin && i3 <= rows.length - _margin && j2 >= _margin && j2 <= cols.length - _margin) {
27008 tiles.unshift([x2, y2, z0]);
27010 tiles.push([x2, y2, z0]);
27014 tiles.translate = origin;
27018 tiler8.getTiles = function(projection2) {
27020 projection2.scale() * Math.PI - projection2.translate()[0],
27021 projection2.scale() * Math.PI - projection2.translate()[1]
27023 this.size(projection2.clipExtent()[1]).scale(projection2.scale() * 2 * Math.PI).translate(projection2.translate());
27024 var tiles = tiler8();
27025 var ts = tiles.scale;
27026 return tiles.map(function(tile) {
27027 if (_skipNullIsland && nearNullIsland(tile)) {
27030 var x2 = tile[0] * ts - origin[0];
27031 var y2 = tile[1] * ts - origin[1];
27033 id: tile.toString(),
27036 projection2.invert([x2, y2 + ts]),
27037 projection2.invert([x2 + ts, y2])
27040 }).filter(Boolean);
27042 tiler8.getGeoJSON = function(projection2) {
27043 var features = tiler8.getTiles(projection2).map(function(tile) {
27052 coordinates: [tile.extent.polygon()]
27057 type: "FeatureCollection",
27061 tiler8.tileSize = function(val) {
27062 if (!arguments.length) return _tileSize;
27066 tiler8.zoomExtent = function(val) {
27067 if (!arguments.length) return _zoomExtent;
27071 tiler8.size = function(val) {
27072 if (!arguments.length) return _size;
27076 tiler8.scale = function(val) {
27077 if (!arguments.length) return _scale;
27081 tiler8.translate = function(val) {
27082 if (!arguments.length) return _translate;
27086 tiler8.margin = function(val) {
27087 if (!arguments.length) return _margin;
27091 tiler8.skipNullIsland = function(val) {
27092 if (!arguments.length) return _skipNullIsland;
27093 _skipNullIsland = val;
27099 // modules/util/trigger_event.js
27100 function utilTriggerEvent(target, type2, eventProperties) {
27101 target.each(function() {
27102 var evt = document.createEvent("HTMLEvents");
27103 evt.initEvent(type2, true, true);
27104 for (var prop in eventProperties) {
27105 evt[prop] = eventProperties[prop];
27107 this.dispatchEvent(evt);
27111 // modules/util/units.js
27112 var OSM_PRECISION = 7;
27113 function displayLength(m2, isImperial) {
27114 var d2 = m2 * (isImperial ? 3.28084 : 1);
27126 unit2 = "kilometers";
27131 return _t("units." + unit2, {
27132 quantity: d2.toLocaleString(_mainLocalizer.localeCode(), {
27133 maximumSignificantDigits: 4
27137 function displayArea(m2, isImperial) {
27138 var locale2 = _mainLocalizer.localeCode();
27139 var d2 = m2 * (isImperial ? 10.7639111056 : 1);
27144 if (d2 >= 6969600) {
27145 d1 = d2 / 27878400;
27146 unit1 = "square_miles";
27149 unit1 = "square_feet";
27151 if (d2 > 4356 && d2 < 4356e4) {
27158 unit1 = "square_kilometers";
27161 unit1 = "square_meters";
27163 if (d2 > 1e3 && d2 < 1e7) {
27165 unit2 = "hectares";
27168 area = _t("units." + unit1, {
27169 quantity: d1.toLocaleString(locale2, {
27170 maximumSignificantDigits: 4
27174 return _t("units.area_pair", {
27176 area2: _t("units." + unit2, {
27177 quantity: d22.toLocaleString(locale2, {
27178 maximumSignificantDigits: 2
27186 function wrap(x2, min3, max3) {
27187 var d2 = max3 - min3;
27188 return ((x2 - min3) % d2 + d2) % d2 + min3;
27190 function clamp(x2, min3, max3) {
27191 return Math.max(min3, Math.min(x2, max3));
27193 function roundToDecimal(target, decimalPlace) {
27194 target = Number(target);
27195 decimalPlace = Number(decimalPlace);
27196 const factor = Math.pow(10, decimalPlace);
27197 return Math.round(target * factor) / factor;
27199 function displayCoordinate(deg, pos, neg) {
27200 var displayCoordinate2;
27201 var locale2 = _mainLocalizer.localeCode();
27202 var degreesFloor = Math.floor(Math.abs(deg));
27203 var min3 = (Math.abs(deg) - degreesFloor) * 60;
27204 var minFloor = Math.floor(min3);
27205 var sec = (min3 - minFloor) * 60;
27206 var fix = roundToDecimal(sec, 8);
27207 var secRounded = roundToDecimal(fix, 0);
27208 if (secRounded === 60) {
27211 if (minFloor === 60) {
27216 displayCoordinate2 = _t("units.arcdegrees", {
27217 quantity: degreesFloor.toLocaleString(locale2)
27218 }) + (minFloor !== 0 || secRounded !== 0 ? _t("units.arcminutes", {
27219 quantity: minFloor.toLocaleString(locale2)
27220 }) : "") + (secRounded !== 0 ? _t("units.arcseconds", {
27221 quantity: secRounded.toLocaleString(locale2)
27224 return displayCoordinate2;
27226 return _t("units.coordinate", {
27227 coordinate: displayCoordinate2,
27228 direction: _t("units." + (deg > 0 ? pos : neg))
27232 function dmsCoordinatePair(coord2) {
27233 return _t("units.coordinate_pair", {
27234 latitude: displayCoordinate(clamp(coord2[1], -90, 90), "north", "south"),
27235 longitude: displayCoordinate(wrap(coord2[0], -180, 180), "east", "west")
27238 function decimalCoordinatePair(coord2) {
27239 return _t("units.coordinate_pair", {
27240 latitude: clamp(coord2[1], -90, 90).toFixed(OSM_PRECISION),
27241 longitude: wrap(coord2[0], -180, 180).toFixed(OSM_PRECISION)
27244 function dmsMatcher(q2) {
27246 // D M SS , D M SS ex: 35 11 10.1 , 136 49 53.8
27248 condition: /^\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+)\s+(\d+\.?\d*)\s*$/,
27249 parser: function(q3) {
27250 const match = this.condition.exec(q3);
27251 const lat = +match[2] + +match[3] / 60 + +match[4] / 3600;
27252 const lng = +match[6] + +match[7] / 60 + +match[8] / 3600;
27253 const isNegLat = match[1] === "-" ? -lat : lat;
27254 const isNegLng = match[5] === "-" ? -lng : lng;
27255 const d2 = [isNegLat, isNegLng];
27259 // D MM , D MM ex: 35 11.1683 , 136 49.8966
27261 condition: /^\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*\,\s*(-?)\s*(\d+)\s+(\d+\.?\d*)\s*$/,
27262 parser: function(q3) {
27263 const match = this.condition.exec(q3);
27264 const lat = +match[2] + +match[3] / 60;
27265 const lng = +match[5] + +match[6] / 60;
27266 const isNegLat = match[1] === "-" ? -lat : lat;
27267 const isNegLng = match[4] === "-" ? -lng : lng;
27268 const d2 = [isNegLat, isNegLng];
27273 for (const matcher of matchers) {
27274 if (matcher.condition.test(q2)) {
27275 return matcher.parser(q2);
27281 // modules/core/localizer.js
27282 var _mainLocalizer = coreLocalizer();
27283 var _t = _mainLocalizer.t;
27284 function coreLocalizer() {
27285 let localizer = {};
27286 let _dataLanguages = {};
27287 let _dataLocales = {};
27288 let _localeStrings = {};
27289 let _localeCode = "en-US";
27290 let _localeCodes = ["en-US", "en"];
27291 let _languageCode = "en";
27292 let _textDirection = "ltr";
27293 let _usesMetric = false;
27294 let _languageNames = {};
27295 let _scriptNames = {};
27296 localizer.localeCode = () => _localeCode;
27297 localizer.localeCodes = () => _localeCodes;
27298 localizer.languageCode = () => _languageCode;
27299 localizer.textDirection = () => _textDirection;
27300 localizer.usesMetric = () => _usesMetric;
27301 localizer.languageNames = () => _languageNames;
27302 localizer.scriptNames = () => _scriptNames;
27303 let _preferredLocaleCodes = [];
27304 localizer.preferredLocaleCodes = function(codes) {
27305 if (!arguments.length) return _preferredLocaleCodes;
27306 if (typeof codes === "string") {
27307 _preferredLocaleCodes = codes.split(/,|;| /gi).filter(Boolean);
27309 _preferredLocaleCodes = codes;
27314 localizer.ensureLoaded = () => {
27315 if (_loadPromise) return _loadPromise;
27316 let filesToFetch = [
27318 // load the list of languages
27320 // load the list of supported locales
27322 const localeDirs = {
27323 general: "locales",
27324 tagging: presetsCdnUrl + "dist/translations"
27326 let fileMap = _mainFileFetcher.fileMap();
27327 for (let scopeId in localeDirs) {
27328 const key = "locales_index_".concat(scopeId);
27329 if (!fileMap[key]) {
27330 fileMap[key] = localeDirs[scopeId] + "/index.min.json";
27332 filesToFetch.push(key);
27334 return _loadPromise = Promise.all(filesToFetch.map((key) => _mainFileFetcher.get(key))).then((results) => {
27335 _dataLanguages = results[0];
27336 _dataLocales = results[1];
27337 let indexes = results.slice(2);
27338 let requestedLocales = (_preferredLocaleCodes || []).concat(utilDetect().browserLocales).concat(["en"]);
27339 _localeCodes = localesToUseFrom(requestedLocales);
27340 _localeCode = _localeCodes[0];
27341 let loadStringsPromises = [];
27342 indexes.forEach((index, i3) => {
27343 const fullCoverageIndex = _localeCodes.findIndex(function(locale2) {
27344 return index[locale2] && index[locale2].pct === 1;
27346 _localeCodes.slice(0, fullCoverageIndex + 1).forEach(function(code) {
27347 let scopeId = Object.keys(localeDirs)[i3];
27348 let directory = Object.values(localeDirs)[i3];
27349 if (index[code]) loadStringsPromises.push(localizer.loadLocale(code, scopeId, directory));
27352 return Promise.all(loadStringsPromises);
27354 updateForCurrentLocale();
27355 }).catch((err) => console.error(err));
27357 function localesToUseFrom(requestedLocales) {
27358 let supportedLocales = _dataLocales;
27360 for (let i3 in requestedLocales) {
27361 let locale2 = requestedLocales[i3];
27362 if (supportedLocales[locale2]) toUse.push(locale2);
27363 if (locale2.includes("-")) {
27364 let langPart = locale2.split("-")[0];
27365 if (supportedLocales[langPart]) toUse.push(langPart);
27368 return utilArrayUniq(toUse);
27370 function updateForCurrentLocale() {
27371 if (!_localeCode) return;
27372 _languageCode = _localeCode.split("-")[0];
27373 const currentData = _dataLocales[_localeCode] || _dataLocales[_languageCode];
27374 const hash = utilStringQs(window.location.hash);
27375 if (hash.rtl === "true") {
27376 _textDirection = "rtl";
27377 } else if (hash.rtl === "false") {
27378 _textDirection = "ltr";
27380 _textDirection = currentData && currentData.rtl ? "rtl" : "ltr";
27382 let locale2 = _localeCode;
27383 if (locale2.toLowerCase() === "en-us") locale2 = "en";
27384 _languageNames = _localeStrings.general[locale2].languageNames || _localeStrings.general[_languageCode].languageNames;
27385 _scriptNames = _localeStrings.general[locale2].scriptNames || _localeStrings.general[_languageCode].scriptNames;
27386 _usesMetric = _localeCode.slice(-3).toLowerCase() !== "-us";
27388 localizer.loadLocale = (locale2, scopeId, directory) => {
27389 if (locale2.toLowerCase() === "en-us") locale2 = "en";
27390 if (_localeStrings[scopeId] && _localeStrings[scopeId][locale2]) {
27391 return Promise.resolve(locale2);
27393 let fileMap = _mainFileFetcher.fileMap();
27394 const key = "locale_".concat(scopeId, "_").concat(locale2);
27395 if (!fileMap[key]) {
27396 fileMap[key] = "".concat(directory, "/").concat(locale2, ".min.json");
27398 return _mainFileFetcher.get(key).then((d2) => {
27399 if (!_localeStrings[scopeId]) _localeStrings[scopeId] = {};
27400 _localeStrings[scopeId][locale2] = d2[locale2];
27404 localizer.pluralRule = function(number3) {
27405 return pluralRule(number3, _localeCode);
27407 function pluralRule(number3, localeCode) {
27408 const rules = "Intl" in window && Intl.PluralRules && new Intl.PluralRules(localeCode);
27410 return rules.select(number3);
27412 if (number3 === 1) return "one";
27415 localizer.tInfo = function(origStringId, replacements, locale2) {
27416 let stringId = origStringId.trim();
27417 let scopeId = "general";
27418 if (stringId[0] === "_") {
27419 let split = stringId.split(".");
27420 scopeId = split[0].slice(1);
27421 stringId = split.slice(1).join(".");
27423 locale2 = locale2 || _localeCode;
27424 let path = stringId.split(".").map((s2) => s2.replace(/<TX_DOT>/g, ".")).reverse();
27425 let stringsKey = locale2;
27426 if (stringsKey.toLowerCase() === "en-us") stringsKey = "en";
27427 let result = _localeStrings && _localeStrings[scopeId] && _localeStrings[scopeId][stringsKey];
27428 while (result !== void 0 && path.length) {
27429 result = result[path.pop()];
27431 if (result !== void 0) {
27432 if (replacements) {
27433 if (typeof result === "object" && Object.keys(result).length) {
27434 const number3 = Object.values(replacements).find(function(value) {
27435 return typeof value === "number";
27437 if (number3 !== void 0) {
27438 const rule = pluralRule(number3, locale2);
27439 if (result[rule]) {
27440 result = result[rule];
27442 result = Object.values(result)[0];
27446 if (typeof result === "string") {
27447 for (let key in replacements) {
27448 let value = replacements[key];
27449 if (typeof value === "number") {
27450 if (value.toLocaleString) {
27451 value = value.toLocaleString(locale2, {
27454 minimumFractionDigits: 0
27457 value = value.toString();
27460 const token = "{".concat(key, "}");
27461 const regex = new RegExp(token, "g");
27462 result = result.replace(regex, value);
27466 if (typeof result === "string") {
27473 let index = _localeCodes.indexOf(locale2);
27474 if (index >= 0 && index < _localeCodes.length - 1) {
27475 let fallback = _localeCodes[index + 1];
27476 return localizer.tInfo(origStringId, replacements, fallback);
27478 if (replacements && "default" in replacements) {
27480 text: replacements.default,
27484 const missing = "Missing ".concat(locale2, " translation: ").concat(origStringId);
27485 if (typeof console !== "undefined") console.error(missing);
27491 localizer.hasTextForStringId = function(stringId) {
27492 return !!localizer.tInfo(stringId, { default: "nothing found" }).locale;
27494 localizer.t = function(stringId, replacements, locale2) {
27495 return localizer.tInfo(stringId, replacements, locale2).text;
27497 localizer.t.html = function(stringId, replacements, locale2) {
27498 replacements = Object.assign({}, replacements);
27499 for (var k2 in replacements) {
27500 if (typeof replacements[k2] === "string") {
27501 replacements[k2] = escape_default(replacements[k2]);
27503 if (typeof replacements[k2] === "object" && typeof replacements[k2].html === "string") {
27504 replacements[k2] = replacements[k2].html;
27507 const info = localizer.tInfo(stringId, replacements, locale2);
27509 return '<span class="localized-text" lang="'.concat(info.locale || "und", '">').concat(info.text, "</span>");
27514 localizer.t.append = function(stringId, replacements, locale2) {
27515 const ret = function(selection2) {
27516 const info = localizer.tInfo(stringId, replacements, locale2);
27517 return selection2.append("span").attr("class", "localized-text").attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
27519 ret.stringId = stringId;
27522 localizer.t.addOrUpdate = function(stringId, replacements, locale2) {
27523 const ret = function(selection2) {
27524 const info = localizer.tInfo(stringId, replacements, locale2);
27525 const span = selection2.selectAll("span.localized-text").data([info]);
27526 const enter = span.enter().append("span").classed("localized-text", true);
27527 span.merge(enter).attr("lang", info.locale || "und").text((replacements && replacements.prefix || "") + info.text + (replacements && replacements.suffix || ""));
27529 ret.stringId = stringId;
27532 localizer.languageName = (code, options2) => {
27533 if (_languageNames && _languageNames[code]) {
27534 return _languageNames[code];
27536 if (options2 && options2.localOnly) return null;
27537 const langInfo = _dataLanguages[code];
27539 if (langInfo.nativeName) {
27540 return localizer.t("translate.language_and_code", { language: langInfo.nativeName, code });
27541 } else if (langInfo.base && langInfo.script) {
27542 const base = langInfo.base;
27543 if (_languageNames && _languageNames[base]) {
27544 const scriptCode = langInfo.script;
27545 const script = _scriptNames && _scriptNames[scriptCode] || scriptCode;
27546 return localizer.t("translate.language_and_code", { language: _languageNames[base], code: script });
27547 } else if (_dataLanguages[base] && _dataLanguages[base].nativeName) {
27548 return localizer.t("translate.language_and_code", { language: _dataLanguages[base].nativeName, code });
27554 localizer.floatFormatter = (locale2) => {
27555 if (!("Intl" in window && "NumberFormat" in Intl && "formatToParts" in Intl.NumberFormat.prototype)) {
27556 return (number3, fractionDigits) => {
27557 return fractionDigits === void 0 ? number3.toString() : number3.toFixed(fractionDigits);
27560 return (number3, fractionDigits) => number3.toLocaleString(locale2, {
27561 minimumFractionDigits: fractionDigits,
27562 maximumFractionDigits: fractionDigits === void 0 ? 20 : fractionDigits
27566 localizer.floatParser = (locale2) => {
27567 const polyfill = (string) => +string.trim();
27568 if (!("Intl" in window && "NumberFormat" in Intl)) return polyfill;
27569 const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
27570 if (!("formatToParts" in format2)) return polyfill;
27571 const parts = format2.formatToParts(-12345.6);
27572 const numerals = Array.from({ length: 10 }).map((_2, i3) => format2.format(i3));
27573 const index = new Map(numerals.map((d2, i3) => [d2, i3]));
27574 const literalPart = parts.find((d2) => d2.type === "literal");
27575 const literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
27576 const groupPart = parts.find((d2) => d2.type === "group");
27577 const group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
27578 const decimalPart = parts.find((d2) => d2.type === "decimal");
27579 const decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
27580 const numeral = new RegExp("[".concat(numerals.join(""), "]"), "g");
27581 const getIndex = (d2) => index.get(d2);
27582 return (string) => {
27583 string = string.trim();
27584 if (literal) string = string.replace(literal, "");
27585 if (group) string = string.replace(group, "");
27586 if (decimal) string = string.replace(decimal, ".");
27587 string = string.replace(numeral, getIndex);
27588 return string ? +string : NaN;
27591 localizer.decimalPlaceCounter = (locale2) => {
27592 var literal, group, decimal;
27593 if ("Intl" in window && "NumberFormat" in Intl) {
27594 const format2 = new Intl.NumberFormat(locale2, { maximumFractionDigits: 20 });
27595 if ("formatToParts" in format2) {
27596 const parts = format2.formatToParts(-12345.6);
27597 const literalPart = parts.find((d2) => d2.type === "literal");
27598 literal = literalPart && new RegExp("[".concat(literalPart.value, "]"), "g");
27599 const groupPart = parts.find((d2) => d2.type === "group");
27600 group = groupPart && new RegExp("[".concat(groupPart.value, "]"), "g");
27601 const decimalPart = parts.find((d2) => d2.type === "decimal");
27602 decimal = decimalPart && new RegExp("[".concat(decimalPart.value, "]"));
27605 return (string) => {
27606 string = string.trim();
27607 if (literal) string = string.replace(literal, "");
27608 if (group) string = string.replace(group, "");
27609 const parts = string.split(decimal || ".");
27610 return parts && parts[1] && parts[1].length || 0;
27616 // modules/presets/collection.js
27617 function presetCollection(collection) {
27618 const MAXRESULTS = 50;
27621 _this.collection = collection;
27622 _this.item = (id2) => {
27623 if (_memo[id2]) return _memo[id2];
27624 const found = _this.collection.find((d2) => d2.id === id2);
27625 if (found) _memo[id2] = found;
27628 _this.index = (id2) => _this.collection.findIndex((d2) => d2.id === id2);
27629 _this.matchGeometry = (geometry) => {
27630 return presetCollection(
27631 _this.collection.filter((d2) => d2.matchGeometry(geometry))
27634 _this.matchAllGeometry = (geometries) => {
27635 return presetCollection(
27636 _this.collection.filter((d2) => d2 && d2.matchAllGeometry(geometries))
27639 _this.matchAnyGeometry = (geometries) => {
27640 return presetCollection(
27641 _this.collection.filter((d2) => geometries.some((geom) => d2.matchGeometry(geom)))
27644 _this.fallback = (geometry) => {
27645 let id2 = geometry;
27646 if (id2 === "vertex") id2 = "point";
27647 return _this.item(id2);
27649 _this.search = (value, geometry, loc) => {
27650 if (!value) return _this;
27651 value = value.toLowerCase().trim();
27652 function leading(a2) {
27653 const index = a2.indexOf(value);
27654 return index === 0 || a2[index - 1] === " ";
27656 function leadingStrict(a2) {
27657 const index = a2.indexOf(value);
27658 return index === 0;
27660 function sortPresets(nameProp, aliasesProp) {
27661 return function sortNames(a2, b2) {
27662 let aCompare = a2[nameProp]();
27663 let bCompare = b2[nameProp]();
27665 const findMatchingAlias = (strings) => {
27666 if (strings.some((s2) => s2 === value)) {
27667 return strings.find((s2) => s2 === value);
27669 return strings.filter((s2) => s2.includes(value)).sort((a3, b3) => a3.length - b3.length)[0];
27672 aCompare = findMatchingAlias([aCompare].concat(a2[aliasesProp]()));
27673 bCompare = findMatchingAlias([bCompare].concat(b2[aliasesProp]()));
27675 if (value === aCompare) return -1;
27676 if (value === bCompare) return 1;
27677 let i3 = b2.originalScore - a2.originalScore;
27678 if (i3 !== 0) return i3;
27679 i3 = aCompare.indexOf(value) - bCompare.indexOf(value);
27680 if (i3 !== 0) return i3;
27681 return aCompare.length - bCompare.length;
27684 let pool = _this.collection;
27685 if (Array.isArray(loc)) {
27686 const validHere = _sharedLocationManager.locationSetsAt(loc);
27687 pool = pool.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
27689 const searchable = pool.filter((a2) => a2.searchable !== false && a2.suggestion !== true);
27690 const suggestions = pool.filter((a2) => a2.suggestion === true);
27691 const leadingNames = searchable.filter((a2) => leading(a2.searchName()) || a2.searchAliases().some(leading)).sort(sortPresets("searchName", "searchAliases"));
27692 const leadingSuggestions = suggestions.filter((a2) => leadingStrict(a2.searchName())).sort(sortPresets("searchName"));
27693 const leadingNamesStripped = searchable.filter((a2) => leading(a2.searchNameStripped()) || a2.searchAliasesStripped().some(leading)).sort(sortPresets("searchNameStripped", "searchAliasesStripped"));
27694 const leadingSuggestionsStripped = suggestions.filter((a2) => leadingStrict(a2.searchNameStripped())).sort(sortPresets("searchNameStripped"));
27695 const leadingTerms = searchable.filter((a2) => (a2.terms() || []).some(leading));
27696 const leadingSuggestionTerms = suggestions.filter((a2) => (a2.terms() || []).some(leading));
27697 const leadingTagValues = searchable.filter((a2) => Object.values(a2.tags || {}).filter((val) => val !== "*").some(leading));
27698 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);
27699 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);
27700 const similarTerms = searchable.filter((a2) => {
27701 return (a2.terms() || []).some((b2) => {
27702 return utilEditDistance(value, b2) + Math.min(value.length - b2.length, 0) < 3;
27705 let leadingTagKeyValues = [];
27706 if (value.includes("=")) {
27707 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]))));
27709 let results = leadingNames.concat(
27710 leadingSuggestions,
27711 leadingNamesStripped,
27712 leadingSuggestionsStripped,
27714 leadingSuggestionTerms,
27717 similarSuggestions,
27719 leadingTagKeyValues
27720 ).slice(0, MAXRESULTS - 1);
27722 if (typeof geometry === "string") {
27723 results.push(_this.fallback(geometry));
27725 geometry.forEach((geom) => results.push(_this.fallback(geom)));
27728 return presetCollection(utilArrayUniq(results));
27733 // modules/presets/category.js
27734 function presetCategory(categoryID, category, allPresets) {
27735 let _this = Object.assign({}, category);
27737 let _searchNameStripped;
27738 _this.id = categoryID;
27739 _this.members = presetCollection(
27740 (category.members || []).map((presetID) => allPresets[presetID]).filter(Boolean)
27742 _this.geometry = _this.members.collection.reduce((acc, preset) => {
27743 for (let i3 in preset.geometry) {
27744 const geometry = preset.geometry[i3];
27745 if (acc.indexOf(geometry) === -1) {
27746 acc.push(geometry);
27751 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27752 _this.matchAllGeometry = (geometries) => _this.members.collection.some((preset) => preset.matchAllGeometry(geometries));
27753 _this.matchScore = () => -1;
27754 _this.name = () => _t("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27755 _this.nameLabel = () => _t.append("_tagging.presets.categories.".concat(categoryID, ".name"), { "default": categoryID });
27756 _this.terms = () => [];
27757 _this.searchName = () => {
27758 if (!_searchName) {
27759 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27761 return _searchName;
27763 _this.searchNameStripped = () => {
27764 if (!_searchNameStripped) {
27765 _searchNameStripped = _this.searchName();
27766 if (_searchNameStripped.normalize) _searchNameStripped = _searchNameStripped.normalize("NFD");
27767 _searchNameStripped = _searchNameStripped.replace(/[\u0300-\u036f]/g, "");
27769 return _searchNameStripped;
27771 _this.searchAliases = () => [];
27772 _this.searchAliasesStripped = () => [];
27776 // modules/presets/field.js
27777 function presetField(fieldID, field, allFields) {
27778 allFields = allFields || {};
27779 let _this = Object.assign({}, field);
27780 _this.id = fieldID;
27781 _this.safeid = utilSafeClassName(fieldID);
27782 _this.matchGeometry = (geom) => !_this.geometry || _this.geometry.indexOf(geom) !== -1;
27783 _this.matchAllGeometry = (geometries) => {
27784 return !_this.geometry || geometries.every((geom) => _this.geometry.indexOf(geom) !== -1);
27786 _this.t = (scope, options2) => _t("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27787 _this.t.html = (scope, options2) => _t.html("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27788 _this.t.append = (scope, options2) => _t.append("_tagging.presets.fields.".concat(fieldID, ".").concat(scope), options2);
27789 _this.hasTextForStringId = (scope) => _mainLocalizer.hasTextForStringId("_tagging.presets.fields.".concat(fieldID, ".").concat(scope));
27790 _this.resolveReference = (which) => {
27791 const referenceRegex = /^\{(.*)\}$/;
27792 const match = (field[which] || "").match(referenceRegex);
27794 const field2 = allFields[match[1]];
27798 console.error("Unable to resolve referenced field: ".concat(match[1]));
27802 _this.title = () => _this.overrideLabel || _this.resolveReference("label").t("label", { "default": fieldID });
27803 _this.label = () => _this.overrideLabel ? (selection2) => selection2.text(_this.overrideLabel) : _this.resolveReference("label").t.append("label", { "default": fieldID });
27804 _this.placeholder = () => _this.resolveReference("placeholder").t("placeholder", { "default": "" });
27805 _this.originalTerms = (_this.terms || []).join();
27806 _this.terms = () => _this.resolveReference("label").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27807 _this.increment = _this.type === "number" ? _this.increment || 1 : void 0;
27811 // modules/presets/preset.js
27812 var import_lodash = __toESM(require_lodash());
27813 function presetPreset(presetID, preset, addable, allFields, allPresets) {
27814 allFields = allFields || {};
27815 allPresets = allPresets || {};
27816 let _this = Object.assign({}, preset);
27817 let _addable = addable || false;
27819 let _searchNameStripped;
27820 let _searchAliases;
27821 let _searchAliasesStripped;
27822 const referenceRegex = /^\{(.*)\}$/;
27823 _this.id = presetID;
27824 _this.safeid = utilSafeClassName(presetID);
27825 _this.originalTerms = (_this.terms || []).join();
27826 _this.originalName = _this.name || "";
27827 _this.originalAliases = (_this.aliases || []).join("\n");
27828 _this.originalScore = _this.matchScore || 1;
27829 _this.originalReference = _this.reference || {};
27830 _this.originalFields = _this.fields || [];
27831 _this.originalMoreFields = _this.moreFields || [];
27832 _this.fields = (loc) => resolveFields("fields", loc);
27833 _this.moreFields = (loc) => resolveFields("moreFields", loc);
27834 _this.tags = _this.tags || {};
27835 _this.addTags = _this.addTags || _this.tags;
27836 _this.removeTags = _this.removeTags || _this.addTags;
27837 _this.geometry = _this.geometry || [];
27838 _this.matchGeometry = (geom) => _this.geometry.indexOf(geom) >= 0;
27839 _this.matchAllGeometry = (geoms) => geoms.every(_this.matchGeometry);
27840 _this.matchScore = (entityTags) => {
27841 const tags = _this.tags;
27844 for (let k2 in tags) {
27846 if (entityTags[k2] === tags[k2]) {
27847 score += _this.originalScore;
27848 } else if (tags[k2] === "*" && k2 in entityTags) {
27849 score += _this.originalScore / 2;
27854 const addTags = _this.addTags;
27855 for (let k2 in addTags) {
27856 if (!seen[k2] && entityTags[k2] === addTags[k2]) {
27857 score += _this.originalScore;
27860 if (_this.searchable === false) {
27865 _this.t = (scope, options2) => {
27866 const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27867 return _t(textID, options2);
27869 _this.t.append = (scope, options2) => {
27870 const textID = "_tagging.presets.presets.".concat(presetID, ".").concat(scope);
27871 return _t.append(textID, options2);
27873 function resolveReference(which) {
27874 const match = (_this[which] || "").match(referenceRegex);
27876 const preset2 = allPresets[match[1]];
27880 console.error("Unable to resolve referenced preset: ".concat(match[1]));
27884 _this.name = () => {
27885 return resolveReference("originalName").t("name", { "default": _this.originalName || presetID });
27887 _this.nameLabel = () => {
27888 return resolveReference("originalName").t.append("name", { "default": _this.originalName || presetID });
27890 _this.subtitle = () => {
27891 if (_this.suggestion) {
27892 let path = presetID.split("/");
27894 return _t("_tagging.presets.presets." + path.join("/") + ".name");
27898 _this.subtitleLabel = () => {
27899 if (_this.suggestion) {
27900 let path = presetID.split("/");
27902 return _t.append("_tagging.presets.presets." + path.join("/") + ".name");
27906 _this.aliases = () => {
27907 return resolveReference("originalName").t("aliases", { "default": _this.originalAliases }).trim().split(/\s*[\r\n]+\s*/);
27909 _this.terms = () => {
27910 return resolveReference("originalName").t("terms", { "default": _this.originalTerms }).toLowerCase().trim().split(/\s*,+\s*/);
27912 _this.searchName = () => {
27913 if (!_searchName) {
27914 _searchName = (_this.suggestion ? _this.originalName : _this.name()).toLowerCase();
27916 return _searchName;
27918 _this.searchNameStripped = () => {
27919 if (!_searchNameStripped) {
27920 _searchNameStripped = stripDiacritics(_this.searchName());
27922 return _searchNameStripped;
27924 _this.searchAliases = () => {
27925 if (!_searchAliases) {
27926 _searchAliases = _this.aliases().map((alias) => alias.toLowerCase());
27928 return _searchAliases;
27930 _this.searchAliasesStripped = () => {
27931 if (!_searchAliasesStripped) {
27932 _searchAliasesStripped = _this.searchAliases();
27933 _searchAliasesStripped = _searchAliasesStripped.map(stripDiacritics);
27935 return _searchAliasesStripped;
27937 _this.isFallback = () => {
27938 const tagCount = Object.keys(_this.tags).length;
27939 return tagCount === 0 || tagCount === 1 && _this.tags.hasOwnProperty("area");
27941 _this.addable = function(val) {
27942 if (!arguments.length) return _addable;
27946 _this.reference = () => {
27947 const qid = _this.tags.wikidata || _this.tags["flag:wikidata"] || _this.tags["brand:wikidata"] || _this.tags["network:wikidata"] || _this.tags["operator:wikidata"];
27951 let key = _this.originalReference.key || Object.keys(utilObjectOmit(_this.tags, "name"))[0];
27952 let value = _this.originalReference.value || _this.tags[key];
27953 if (value === "*") {
27956 return { key, value };
27959 _this.unsetTags = (tags, geometry, ignoringKeys, skipFieldDefaults, loc) => {
27960 let removeTags = ignoringKeys ? utilObjectOmit(_this.removeTags, ignoringKeys) : _this.removeTags;
27961 tags = utilObjectOmit(tags, Object.keys(removeTags));
27962 if (geometry && !skipFieldDefaults) {
27963 _this.fields(loc).forEach((field) => {
27964 if (field.matchGeometry(geometry) && field.key && field.default === tags[field.key] && (!ignoringKeys || ignoringKeys.indexOf(field.key) === -1)) {
27965 delete tags[field.key];
27972 _this.setTags = (tags, geometry, skipFieldDefaults, loc) => {
27973 const addTags = _this.addTags;
27974 tags = Object.assign({}, tags);
27975 for (let k2 in addTags) {
27976 if (addTags[k2] === "*") {
27977 if (_this.tags[k2] || !tags[k2]) {
27981 tags[k2] = addTags[k2];
27984 if (!addTags.hasOwnProperty("area")) {
27986 if (geometry === "area") {
27987 let needsAreaTag = true;
27988 for (let k2 in addTags) {
27989 if (_this.geometry.indexOf("line") === -1 && k2 in osmAreaKeys || k2 in osmAreaKeysExceptions && addTags[k2] in osmAreaKeysExceptions[k2]) {
27990 needsAreaTag = false;
27994 if (needsAreaTag) {
27999 if (geometry && !skipFieldDefaults) {
28000 _this.fields(loc).forEach((field) => {
28001 if (field.matchGeometry(geometry) && field.key && !tags[field.key] && field.default) {
28002 tags[field.key] = field.default;
28008 function resolveFields(which, loc) {
28009 const fieldIDs = which === "fields" ? _this.originalFields : _this.originalMoreFields;
28011 fieldIDs.forEach((fieldID) => {
28012 const match = fieldID.match(referenceRegex);
28013 if (match !== null) {
28014 resolved = resolved.concat(inheritFields(allPresets[match[1]], which));
28015 } else if (allFields[fieldID]) {
28016 resolved.push(allFields[fieldID]);
28018 console.log('Cannot resolve "'.concat(fieldID, '" found in ').concat(_this.id, ".").concat(which));
28021 if (!resolved.length) {
28022 const endIndex = _this.id.lastIndexOf("/");
28023 const parentID = endIndex && _this.id.substring(0, endIndex);
28025 let parent = allPresets[parentID];
28027 const validHere = _sharedLocationManager.locationSetsAt(loc);
28028 if ((parent == null ? void 0 : parent.locationSetID) && !validHere[parent.locationSetID]) {
28029 const candidateIDs = Object.keys(allPresets).filter((k2) => k2.startsWith(parentID));
28030 parent = allPresets[candidateIDs.find((candidateID) => {
28031 const candidate = allPresets[candidateID];
28032 return validHere[candidate.locationSetID] && (0, import_lodash.isEqual)(candidate.tags, parent.tags);
28036 resolved = inheritFields(parent, which);
28039 return utilArrayUniq(resolved);
28040 function inheritFields(parent, which2) {
28041 if (!parent) return [];
28042 if (which2 === "fields") {
28043 return parent.fields().filter(shouldInherit);
28044 } else if (which2 === "moreFields") {
28045 return parent.moreFields();
28050 function shouldInherit(f2) {
28051 if (f2.key && _this.tags[f2.key] !== void 0 && // inherit anyway if multiple values are allowed or just a checkbox
28052 f2.type !== "multiCombo" && f2.type !== "semiCombo" && f2.type !== "manyCombo" && f2.type !== "check") return false;
28056 function stripDiacritics(s2) {
28057 if (s2.normalize) s2 = s2.normalize("NFD");
28058 s2 = s2.replace(/[\u0300-\u036f]/g, "");
28064 // modules/presets/index.js
28065 var _mainPresetIndex = presetIndex();
28066 function presetIndex() {
28067 const dispatch14 = dispatch_default("favoritePreset", "recentsChange");
28068 const MAXRECENTS = 30;
28069 const POINT = presetPreset("point", { name: "Point", tags: {}, geometry: ["point", "vertex"], matchScore: 0.1 });
28070 const LINE = presetPreset("line", { name: "Line", tags: {}, geometry: ["line"], matchScore: 0.1 });
28071 const AREA = presetPreset("area", { name: "Area", tags: { area: "yes" }, geometry: ["area"], matchScore: 0.1 });
28072 const RELATION = presetPreset("relation", { name: "Relation", tags: {}, geometry: ["relation"], matchScore: 0.1 });
28073 let _this = presetCollection([POINT, LINE, AREA, RELATION]);
28074 let _presets = { point: POINT, line: LINE, area: AREA, relation: RELATION };
28076 point: presetCollection([POINT]),
28077 vertex: presetCollection([POINT]),
28078 line: presetCollection([LINE]),
28079 area: presetCollection([AREA]),
28080 relation: presetCollection([RELATION])
28083 let _categories = {};
28084 let _universal = [];
28085 let _addablePresetIDs = null;
28088 let _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28090 _this.ensureLoaded = () => {
28091 if (_loadPromise) return _loadPromise;
28092 return _loadPromise = Promise.all([
28093 _mainFileFetcher.get("preset_categories"),
28094 _mainFileFetcher.get("preset_defaults"),
28095 _mainFileFetcher.get("preset_presets"),
28096 _mainFileFetcher.get("preset_fields")
28097 ]).then((vals) => {
28099 categories: vals[0],
28104 osmSetAreaKeys(_this.areaKeys());
28105 osmSetLineTags(_this.lineTags());
28106 osmSetPointTags(_this.pointTags());
28107 osmSetVertexTags(_this.vertexTags());
28110 _this.merge = (d2) => {
28111 let newLocationSets = [];
28113 Object.keys(d2.fields).forEach((fieldID) => {
28114 let f2 = d2.fields[fieldID];
28116 f2 = presetField(fieldID, f2, _fields);
28117 if (f2.locationSet) newLocationSets.push(f2);
28118 _fields[fieldID] = f2;
28120 delete _fields[fieldID];
28125 Object.keys(d2.presets).forEach((presetID) => {
28126 let p2 = d2.presets[presetID];
28128 const isAddable = !_addablePresetIDs || _addablePresetIDs.has(presetID);
28129 p2 = presetPreset(presetID, p2, isAddable, _fields, _presets);
28130 if (p2.locationSet) newLocationSets.push(p2);
28131 _presets[presetID] = p2;
28133 const existing = _presets[presetID];
28134 if (existing && !existing.isFallback()) {
28135 delete _presets[presetID];
28140 if (d2.categories) {
28141 Object.keys(d2.categories).forEach((categoryID) => {
28142 let c2 = d2.categories[categoryID];
28144 c2 = presetCategory(categoryID, c2, _presets);
28145 if (c2.locationSet) newLocationSets.push(c2);
28146 _categories[categoryID] = c2;
28148 delete _categories[categoryID];
28152 _this.collection = Object.values(_presets).concat(Object.values(_categories));
28154 Object.keys(d2.defaults).forEach((geometry) => {
28155 const def2 = d2.defaults[geometry];
28156 if (Array.isArray(def2)) {
28157 _defaults2[geometry] = presetCollection(
28158 def2.map((id2) => _presets[id2] || _categories[id2]).filter(Boolean)
28161 delete _defaults2[geometry];
28165 _universal = Object.values(_fields).filter((field) => field.universal);
28166 _geometryIndex = { point: {}, vertex: {}, line: {}, area: {}, relation: {} };
28167 _this.collection.forEach((preset) => {
28168 (preset.geometry || []).forEach((geometry) => {
28169 let g3 = _geometryIndex[geometry];
28170 for (let key in preset.tags) {
28171 g3[key] = g3[key] || {};
28172 let value = preset.tags[key];
28173 (g3[key][value] = g3[key][value] || []).push(preset);
28177 if (d2.featureCollection && Array.isArray(d2.featureCollection.features)) {
28178 _sharedLocationManager.mergeCustomGeoJSON(d2.featureCollection);
28180 if (newLocationSets.length) {
28181 _sharedLocationManager.mergeLocationSets(newLocationSets);
28185 _this.match = (entity, resolver) => {
28186 return resolver.transient(entity, "presetMatch", () => {
28187 let geometry = entity.geometry(resolver);
28188 if (geometry === "vertex" && entity.isOnAddressLine(resolver)) {
28189 geometry = "point";
28191 const entityExtent = entity.extent(resolver);
28192 return _this.matchTags(entity.tags, geometry, entityExtent.center());
28195 _this.matchTags = (tags, geometry, loc) => {
28196 const keyIndex = _geometryIndex[geometry];
28197 let bestScore = -1;
28199 let matchCandidates = [];
28200 for (let k2 in tags) {
28201 let indexMatches = [];
28202 let valueIndex = keyIndex[k2];
28203 if (!valueIndex) continue;
28204 let keyValueMatches = valueIndex[tags[k2]];
28205 if (keyValueMatches) indexMatches.push(...keyValueMatches);
28206 let keyStarMatches = valueIndex["*"];
28207 if (keyStarMatches) indexMatches.push(...keyStarMatches);
28208 if (indexMatches.length === 0) continue;
28209 for (let i3 = 0; i3 < indexMatches.length; i3++) {
28210 const candidate = indexMatches[i3];
28211 const score = candidate.matchScore(tags);
28212 if (score === -1) {
28215 matchCandidates.push({ score, candidate });
28216 if (score > bestScore) {
28218 bestMatch = candidate;
28222 if (bestMatch && bestMatch.locationSetID && bestMatch.locationSetID !== "+[Q2]" && Array.isArray(loc)) {
28223 const validHere = _sharedLocationManager.locationSetsAt(loc);
28224 if (!validHere[bestMatch.locationSetID]) {
28225 matchCandidates.sort((a2, b2) => a2.score < b2.score ? 1 : -1);
28226 for (let i3 = 0; i3 < matchCandidates.length; i3++) {
28227 const candidateScore = matchCandidates[i3];
28228 if (!candidateScore.candidate.locationSetID || validHere[candidateScore.candidate.locationSetID]) {
28229 bestMatch = candidateScore.candidate;
28230 bestScore = candidateScore.score;
28236 if (!bestMatch || bestMatch.isFallback()) {
28237 for (let k2 in tags) {
28238 if (/^addr:/.test(k2) && keyIndex["addr:*"] && keyIndex["addr:*"]["*"]) {
28239 bestMatch = keyIndex["addr:*"]["*"][0];
28244 return bestMatch || _this.fallback(geometry);
28246 _this.allowsVertex = (entity, resolver) => {
28247 if (entity.type !== "node") return false;
28248 if (Object.keys(entity.tags).length === 0) return true;
28249 return resolver.transient(entity, "vertexMatch", () => {
28250 if (entity.isOnAddressLine(resolver)) return true;
28251 const geometries = osmNodeGeometriesForTags(entity.tags);
28252 if (geometries.vertex) return true;
28253 if (geometries.point) return false;
28257 _this.areaKeys = () => {
28267 const presets = _this.collection.filter((p2) => !p2.suggestion && !p2.replacement);
28268 presets.forEach((p2) => {
28269 const keys2 = p2.tags && Object.keys(p2.tags);
28270 const key = keys2 && keys2.length && keys2[0];
28272 if (ignore[key]) return;
28273 if (p2.geometry.indexOf("area") !== -1) {
28274 areaKeys[key] = areaKeys[key] || {};
28277 presets.forEach((p2) => {
28279 for (key in p2.addTags) {
28280 const value = p2.addTags[key];
28281 if (key in areaKeys && // probably an area...
28282 p2.geometry.indexOf("line") !== -1 && // but sometimes a line
28284 areaKeys[key][value] = true;
28290 _this.lineTags = () => {
28291 return _this.collection.filter((lineTags, d2) => {
28292 if (d2.suggestion || d2.replacement || d2.searchable === false) return lineTags;
28293 const keys2 = d2.tags && Object.keys(d2.tags);
28294 const key = keys2 && keys2.length && keys2[0];
28295 if (!key) return lineTags;
28296 if (d2.geometry.indexOf("line") !== -1) {
28297 lineTags[key] = lineTags[key] || [];
28298 lineTags[key].push(d2.tags);
28303 _this.pointTags = () => {
28304 return _this.collection.reduce((pointTags, d2) => {
28305 if (d2.suggestion || d2.replacement || d2.searchable === false) return pointTags;
28306 const keys2 = d2.tags && Object.keys(d2.tags);
28307 const key = keys2 && keys2.length && keys2[0];
28308 if (!key) return pointTags;
28309 if (d2.geometry.indexOf("point") !== -1) {
28310 pointTags[key] = pointTags[key] || {};
28311 pointTags[key][d2.tags[key]] = true;
28316 _this.vertexTags = () => {
28317 return _this.collection.reduce((vertexTags, d2) => {
28318 if (d2.suggestion || d2.replacement || d2.searchable === false) return vertexTags;
28319 const keys2 = d2.tags && Object.keys(d2.tags);
28320 const key = keys2 && keys2.length && keys2[0];
28321 if (!key) return vertexTags;
28322 if (d2.geometry.indexOf("vertex") !== -1) {
28323 vertexTags[key] = vertexTags[key] || {};
28324 vertexTags[key][d2.tags[key]] = true;
28329 _this.field = (id2) => _fields[id2];
28330 _this.universal = () => _universal;
28331 _this.defaults = (geometry, n3, startWithRecents, loc, extraPresets) => {
28333 if (startWithRecents) {
28334 recents = _this.recent().matchGeometry(geometry).collection.slice(0, 4);
28337 if (_addablePresetIDs) {
28338 defaults = Array.from(_addablePresetIDs).map(function(id2) {
28339 var preset = _this.item(id2);
28340 if (preset && preset.matchGeometry(geometry)) return preset;
28342 }).filter(Boolean);
28344 defaults = _defaults2[geometry].collection.concat(_this.fallback(geometry));
28346 let result = presetCollection(
28347 utilArrayUniq(recents.concat(defaults).concat(extraPresets || [])).slice(0, n3 - 1)
28349 if (Array.isArray(loc)) {
28350 const validHere = _sharedLocationManager.locationSetsAt(loc);
28351 result.collection = result.collection.filter((a2) => !a2.locationSetID || validHere[a2.locationSetID]);
28355 _this.addablePresetIDs = function(val) {
28356 if (!arguments.length) return _addablePresetIDs;
28357 if (Array.isArray(val)) val = new Set(val);
28358 _addablePresetIDs = val;
28359 if (_addablePresetIDs) {
28360 _this.collection.forEach((p2) => {
28361 if (p2.addable) p2.addable(_addablePresetIDs.has(p2.id));
28364 _this.collection.forEach((p2) => {
28365 if (p2.addable) p2.addable(true);
28370 _this.recent = () => {
28371 return presetCollection(
28372 utilArrayUniq(_this.getRecents().map((d2) => d2.preset).filter((d2) => d2.searchable !== false))
28375 function RibbonItem(preset, source) {
28377 item.preset = preset;
28378 item.source = source;
28379 item.isFavorite = () => item.source === "favorite";
28380 item.isRecent = () => item.source === "recent";
28381 item.matches = (preset2) => item.preset.id === preset2.id;
28382 item.minified = () => ({ pID: item.preset.id });
28385 function ribbonItemForMinified(d2, source) {
28386 if (d2 && d2.pID) {
28387 const preset = _this.item(d2.pID);
28388 if (!preset) return null;
28389 return RibbonItem(preset, source);
28393 _this.getGenericRibbonItems = () => {
28394 return ["point", "line", "area"].map((id2) => RibbonItem(_this.item(id2), "generic"));
28396 _this.getAddable = () => {
28397 if (!_addablePresetIDs) return [];
28398 return _addablePresetIDs.map((id2) => {
28399 const preset = _this.item(id2);
28400 if (preset) return RibbonItem(preset, "addable");
28402 }).filter(Boolean);
28404 function setRecents(items) {
28406 const minifiedItems = items.map((d2) => d2.minified());
28407 corePreferences("preset_recents", JSON.stringify(minifiedItems));
28408 dispatch14.call("recentsChange");
28410 _this.getRecents = () => {
28412 _recents = (JSON.parse(corePreferences("preset_recents")) || []).reduce((acc, d2) => {
28413 let item = ribbonItemForMinified(d2, "recent");
28414 if (item && item.preset.addable()) acc.push(item);
28420 _this.addRecent = (preset, besidePreset, after) => {
28421 const recents = _this.getRecents();
28422 const beforeItem = _this.recentMatching(besidePreset);
28423 let toIndex = recents.indexOf(beforeItem);
28424 if (after) toIndex += 1;
28425 const newItem = RibbonItem(preset, "recent");
28426 recents.splice(toIndex, 0, newItem);
28427 setRecents(recents);
28429 _this.removeRecent = (preset) => {
28430 const item = _this.recentMatching(preset);
28432 let items = _this.getRecents();
28433 items.splice(items.indexOf(item), 1);
28437 _this.recentMatching = (preset) => {
28438 const items = _this.getRecents();
28439 for (let i3 in items) {
28440 if (items[i3].matches(preset)) {
28446 _this.moveItem = (items, fromIndex, toIndex) => {
28447 if (fromIndex === toIndex || fromIndex < 0 || toIndex < 0 || fromIndex >= items.length || toIndex >= items.length) return null;
28448 items.splice(toIndex, 0, items.splice(fromIndex, 1)[0]);
28451 _this.moveRecent = (item, beforeItem) => {
28452 const recents = _this.getRecents();
28453 const fromIndex = recents.indexOf(item);
28454 const toIndex = recents.indexOf(beforeItem);
28455 const items = _this.moveItem(recents, fromIndex, toIndex);
28456 if (items) setRecents(items);
28458 _this.setMostRecent = (preset) => {
28459 if (preset.searchable === false) return;
28460 let items = _this.getRecents();
28461 let item = _this.recentMatching(preset);
28463 items.splice(items.indexOf(item), 1);
28465 item = RibbonItem(preset, "recent");
28467 while (items.length >= MAXRECENTS) {
28470 items.unshift(item);
28473 function setFavorites(items) {
28474 _favorites = items;
28475 const minifiedItems = items.map((d2) => d2.minified());
28476 corePreferences("preset_favorites", JSON.stringify(minifiedItems));
28477 dispatch14.call("favoritePreset");
28479 _this.addFavorite = (preset, besidePreset, after) => {
28480 const favorites = _this.getFavorites();
28481 const beforeItem = _this.favoriteMatching(besidePreset);
28482 let toIndex = favorites.indexOf(beforeItem);
28483 if (after) toIndex += 1;
28484 const newItem = RibbonItem(preset, "favorite");
28485 favorites.splice(toIndex, 0, newItem);
28486 setFavorites(favorites);
28488 _this.toggleFavorite = (preset) => {
28489 const favs = _this.getFavorites();
28490 const favorite = _this.favoriteMatching(preset);
28492 favs.splice(favs.indexOf(favorite), 1);
28494 if (favs.length === 10) {
28497 favs.push(RibbonItem(preset, "favorite"));
28499 setFavorites(favs);
28501 _this.removeFavorite = (preset) => {
28502 const item = _this.favoriteMatching(preset);
28504 const items = _this.getFavorites();
28505 items.splice(items.indexOf(item), 1);
28506 setFavorites(items);
28509 _this.getFavorites = () => {
28511 let rawFavorites = JSON.parse(corePreferences("preset_favorites"));
28512 if (!rawFavorites) {
28514 corePreferences("preset_favorites", JSON.stringify(rawFavorites));
28516 _favorites = rawFavorites.reduce((output, d2) => {
28517 const item = ribbonItemForMinified(d2, "favorite");
28518 if (item && item.preset.addable()) output.push(item);
28524 _this.favoriteMatching = (preset) => {
28525 const favs = _this.getFavorites();
28526 for (let index in favs) {
28527 if (favs[index].matches(preset)) {
28528 return favs[index];
28533 return utilRebind(_this, dispatch14, "on");
28536 // modules/util/util.js
28537 function utilTagText(entity) {
28538 var obj = entity && entity.tags || {};
28539 return Object.keys(obj).map(function(k2) {
28540 return k2 + "=" + obj[k2];
28543 function utilTotalExtent(array2, graph) {
28544 var extent = geoExtent();
28546 for (var i3 = 0; i3 < array2.length; i3++) {
28548 entity = typeof val === "string" ? graph.hasEntity(val) : val;
28550 extent._extend(entity.extent(graph));
28555 function utilTagDiff(oldTags, newTags) {
28557 var keys2 = utilArrayUnion(Object.keys(oldTags), Object.keys(newTags)).sort();
28558 keys2.forEach(function(k2) {
28559 var oldVal = oldTags[k2];
28560 var newVal = newTags[k2];
28561 if ((oldVal || oldVal === "") && (newVal === void 0 || newVal !== oldVal)) {
28567 display: "- " + k2 + "=" + oldVal
28570 if ((newVal || newVal === "") && (oldVal === void 0 || newVal !== oldVal)) {
28576 display: "+ " + k2 + "=" + newVal
28582 function utilEntitySelector(ids) {
28583 return ids.length ? "." + ids.join(",.") : "nothing";
28585 function utilEntityOrMemberSelector(ids, graph) {
28586 var seen = new Set(ids);
28587 ids.forEach(collectShallowDescendants);
28588 return utilEntitySelector(Array.from(seen));
28589 function collectShallowDescendants(id2) {
28590 var entity = graph.hasEntity(id2);
28591 if (!entity || entity.type !== "relation") return;
28592 entity.members.map(function(member) {
28594 }).forEach(function(id3) {
28599 function utilEntityOrDeepMemberSelector(ids, graph) {
28600 return utilEntitySelector(utilEntityAndDeepMemberIDs(ids, graph));
28602 function utilEntityAndDeepMemberIDs(ids, graph) {
28603 var seen = /* @__PURE__ */ new Set();
28604 ids.forEach(collectDeepDescendants);
28605 return Array.from(seen);
28606 function collectDeepDescendants(id2) {
28607 if (seen.has(id2)) return;
28609 var entity = graph.hasEntity(id2);
28610 if (!entity || entity.type !== "relation") return;
28611 entity.members.map(function(member) {
28613 }).forEach(collectDeepDescendants);
28616 function utilDeepMemberSelector(ids, graph, skipMultipolgonMembers) {
28617 var idsSet = new Set(ids);
28618 var seen = /* @__PURE__ */ new Set();
28619 var returners = /* @__PURE__ */ new Set();
28620 ids.forEach(collectDeepDescendants);
28621 return utilEntitySelector(Array.from(returners));
28622 function collectDeepDescendants(id2) {
28623 if (seen.has(id2)) return;
28625 if (!idsSet.has(id2)) {
28626 returners.add(id2);
28628 var entity = graph.hasEntity(id2);
28629 if (!entity || entity.type !== "relation") return;
28630 if (skipMultipolgonMembers && entity.isMultipolygon()) return;
28631 entity.members.map(function(member) {
28633 }).forEach(collectDeepDescendants);
28636 function utilHighlightEntities(ids, highlighted, context) {
28637 context.surface().selectAll(utilEntityOrDeepMemberSelector(ids, context.graph())).classed("highlighted", highlighted);
28639 function utilGetAllNodes(ids, graph) {
28640 var seen = /* @__PURE__ */ new Set();
28641 var nodes = /* @__PURE__ */ new Set();
28642 ids.forEach(collectNodes);
28643 return Array.from(nodes);
28644 function collectNodes(id2) {
28645 if (seen.has(id2)) return;
28647 var entity = graph.hasEntity(id2);
28648 if (!entity) return;
28649 if (entity.type === "node") {
28651 } else if (entity.type === "way") {
28652 entity.nodes.forEach(collectNodes);
28654 entity.members.map(function(member) {
28656 }).forEach(collectNodes);
28660 function utilDisplayName(entity) {
28661 var localizedNameKey = "name:" + _mainLocalizer.languageCode().toLowerCase();
28662 var name = entity.tags[localizedNameKey] || entity.tags.name || "";
28663 if (name) return name;
28665 direction: entity.tags.direction,
28666 from: entity.tags.from,
28667 network: entity.tags.cycle_network || entity.tags.network,
28668 ref: entity.tags.ref,
28669 to: entity.tags.to,
28670 via: entity.tags.via
28672 var keyComponents = [];
28673 if (tags.network) {
28674 keyComponents.push("network");
28677 keyComponents.push("ref");
28679 if (entity.tags.route) {
28680 if (tags.direction) {
28681 keyComponents.push("direction");
28682 } else if (tags.from && tags.to) {
28683 keyComponents.push("from");
28684 keyComponents.push("to");
28686 keyComponents.push("via");
28690 if (keyComponents.length) {
28691 name = _t("inspector.display_name." + keyComponents.join("_"), tags);
28695 function utilDisplayNameForPath(entity) {
28696 var name = utilDisplayName(entity);
28697 var isFirefox = utilDetect().browser.toLowerCase().indexOf("firefox") > -1;
28698 var isNewChromium = Number(utilDetect().version.split(".")[0]) >= 96;
28699 if (!isFirefox && !isNewChromium && name && rtlRegex.test(name)) {
28700 name = fixRTLTextForSvg(name);
28704 function utilDisplayType(id2) {
28706 n: _t("inspector.node"),
28707 w: _t("inspector.way"),
28708 r: _t("inspector.relation")
28711 function utilDisplayLabel(entity, graphOrGeometry, verbose) {
28713 var displayName = utilDisplayName(entity);
28714 var preset = typeof graphOrGeometry === "string" ? _mainPresetIndex.matchTags(entity.tags, graphOrGeometry) : _mainPresetIndex.match(entity, graphOrGeometry);
28715 var presetName = preset && (preset.suggestion ? preset.subtitle() : preset.name());
28717 result = [presetName, displayName].filter(Boolean).join(" ");
28719 result = displayName || presetName;
28721 return result || utilDisplayType(entity.id);
28723 function utilEntityRoot(entityType) {
28730 function utilCombinedTags(entityIDs, graph) {
28732 var tagCounts = {};
28733 var allKeys = /* @__PURE__ */ new Set();
28734 var entities = entityIDs.map(function(entityID) {
28735 return graph.hasEntity(entityID);
28736 }).filter(Boolean);
28737 entities.forEach(function(entity) {
28738 var keys2 = Object.keys(entity.tags).filter(Boolean);
28739 keys2.forEach(function(key2) {
28743 entities.forEach(function(entity) {
28744 allKeys.forEach(function(key2) {
28745 var value = entity.tags[key2];
28746 if (!tags.hasOwnProperty(key2)) {
28747 tags[key2] = value;
28749 if (!Array.isArray(tags[key2])) {
28750 if (tags[key2] !== value) {
28751 tags[key2] = [tags[key2], value];
28754 if (tags[key2].indexOf(value) === -1) {
28755 tags[key2].push(value);
28759 var tagHash = key2 + "=" + value;
28760 if (!tagCounts[tagHash]) tagCounts[tagHash] = 0;
28761 tagCounts[tagHash] += 1;
28764 for (var key in tags) {
28765 if (!Array.isArray(tags[key])) continue;
28766 tags[key] = tags[key].sort(function(val12, val2) {
28768 var count2 = tagCounts[key2 + "=" + val2];
28769 var count1 = tagCounts[key2 + "=" + val12];
28770 if (count2 !== count1) {
28771 return count2 - count1;
28773 if (val2 && val12) {
28774 return val12.localeCompare(val2);
28776 return val12 ? 1 : -1;
28781 function utilStringQs(str) {
28783 while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
28784 str = str.slice(i3);
28785 return str.split("&").reduce(function(obj, pair3) {
28786 var parts = pair3.split("=");
28787 if (parts.length === 2) {
28788 obj[parts[0]] = null === parts[1] ? "" : decodeURIComponent(parts[1]);
28793 function utilQsString(obj, noencode) {
28794 function softEncode(s2) {
28795 return encodeURIComponent(s2).replace(/(%2F|%3A|%2C|%7B|%7D)/g, decodeURIComponent);
28797 return Object.keys(obj).sort().map(function(key) {
28798 return encodeURIComponent(key) + "=" + (noencode ? softEncode(obj[key]) : encodeURIComponent(obj[key]));
28801 function utilPrefixDOMProperty(property) {
28802 var prefixes2 = ["webkit", "ms", "moz", "o"];
28804 var n3 = prefixes2.length;
28805 var s2 = document.body;
28806 if (property in s2) return property;
28807 property = property.slice(0, 1).toUpperCase() + property.slice(1);
28808 while (++i3 < n3) {
28809 if (prefixes2[i3] + property in s2) {
28810 return prefixes2[i3] + property;
28815 function utilPrefixCSSProperty(property) {
28816 var prefixes2 = ["webkit", "ms", "Moz", "O"];
28818 var n3 = prefixes2.length;
28819 var s2 = document.body.style;
28820 if (property.toLowerCase() in s2) {
28821 return property.toLowerCase();
28823 while (++i3 < n3) {
28824 if (prefixes2[i3] + property in s2) {
28825 return "-" + prefixes2[i3].toLowerCase() + property.replace(/([A-Z])/g, "-$1").toLowerCase();
28830 var transformProperty;
28831 function utilSetTransform(el, x2, y2, scale) {
28832 var prop = transformProperty = transformProperty || utilPrefixCSSProperty("Transform");
28833 var translate = utilDetect().opera ? "translate(" + x2 + "px," + y2 + "px)" : "translate3d(" + x2 + "px," + y2 + "px,0)";
28834 return el.style(prop, translate + (scale ? " scale(" + scale + ")" : ""));
28836 function utilEditDistance(a2, b2) {
28837 a2 = (0, import_diacritics.remove)(a2.toLowerCase());
28838 b2 = (0, import_diacritics.remove)(b2.toLowerCase());
28839 if (a2.length === 0) return b2.length;
28840 if (b2.length === 0) return a2.length;
28843 for (i3 = 0; i3 <= b2.length; i3++) {
28846 for (j2 = 0; j2 <= a2.length; j2++) {
28847 matrix[0][j2] = j2;
28849 for (i3 = 1; i3 <= b2.length; i3++) {
28850 for (j2 = 1; j2 <= a2.length; j2++) {
28851 if (b2.charAt(i3 - 1) === a2.charAt(j2 - 1)) {
28852 matrix[i3][j2] = matrix[i3 - 1][j2 - 1];
28854 matrix[i3][j2] = Math.min(
28855 matrix[i3 - 1][j2 - 1] + 1,
28858 matrix[i3][j2 - 1] + 1,
28860 matrix[i3 - 1][j2] + 1
28866 return matrix[b2.length][a2.length];
28868 function utilFastMouse(container) {
28869 var rect = container.getBoundingClientRect();
28870 var rectLeft = rect.left;
28871 var rectTop = rect.top;
28872 var clientLeft = +container.clientLeft;
28873 var clientTop = +container.clientTop;
28874 return function(e3) {
28876 e3.clientX - rectLeft - clientLeft,
28877 e3.clientY - rectTop - clientTop
28881 function utilAsyncMap(inputs, func, callback) {
28882 var remaining = inputs.length;
28885 inputs.forEach(function(d2, i3) {
28886 func(d2, function done(err, data) {
28888 results[i3] = data;
28890 if (!remaining) callback(errors, results);
28894 function utilWrap(index, length2) {
28896 index += Math.ceil(-index / length2) * length2;
28898 return index % length2;
28900 function utilFunctor(value) {
28901 if (typeof value === "function") return value;
28902 return function() {
28906 function utilNoAuto(selection2) {
28907 var isText = selection2.size() && selection2.node().tagName.toLowerCase() === "textarea";
28908 return selection2.attr("autocomplete", "new-password").attr("autocorrect", "off").attr("autocapitalize", "off").attr("spellcheck", isText ? "true" : "false");
28910 function utilHashcode(str) {
28912 if (str.length === 0) {
28915 for (var i3 = 0; i3 < str.length; i3++) {
28916 var char = str.charCodeAt(i3);
28917 hash = (hash << 5) - hash + char;
28918 hash = hash & hash;
28922 function utilSafeClassName(str) {
28923 return str.toLowerCase().replace(/[^a-z0-9]+/g, "_");
28925 function utilUniqueDomId(val) {
28926 return "ideditor-" + utilSafeClassName(val.toString()) + "-" + (/* @__PURE__ */ new Date()).getTime().toString();
28928 function utilUnicodeCharsCount(str) {
28929 return Array.from(str).length;
28931 function utilUnicodeCharsTruncated(str, limit) {
28932 return Array.from(str).slice(0, limit).join("");
28934 function toNumericID(id2) {
28935 var match = id2.match(/^[cnwr](-?\d+)$/);
28937 return parseInt(match[1], 10);
28941 function compareNumericIDs(left, right) {
28942 if (isNaN(left) && isNaN(right)) return -1;
28943 if (isNaN(left)) return 1;
28944 if (isNaN(right)) return -1;
28945 if (Math.sign(left) !== Math.sign(right)) return -Math.sign(left);
28946 if (Math.sign(left) < 0) return Math.sign(right - left);
28947 return Math.sign(left - right);
28949 function utilCompareIDs(left, right) {
28950 return compareNumericIDs(toNumericID(left), toNumericID(right));
28952 function utilOldestID(ids) {
28953 if (ids.length === 0) {
28956 var oldestIDIndex = 0;
28957 var oldestID = toNumericID(ids[0]);
28958 for (var i3 = 1; i3 < ids.length; i3++) {
28959 var num = toNumericID(ids[i3]);
28960 if (compareNumericIDs(oldestID, num) === 1) {
28961 oldestIDIndex = i3;
28965 return ids[oldestIDIndex];
28967 function utilCleanOsmString(val, maxChars) {
28968 if (val === void 0 || val === null) {
28971 val = val.toString();
28974 if (val.normalize) val = val.normalize("NFC");
28975 return utilUnicodeCharsTruncated(val, maxChars);
28978 // modules/osm/entity.js
28979 function osmEntity(attrs) {
28980 if (this instanceof osmEntity) return;
28981 if (attrs && attrs.type) {
28982 return osmEntity[attrs.type].apply(this, arguments);
28983 } else if (attrs && attrs.id) {
28984 return osmEntity[osmEntity.id.type(attrs.id)].apply(this, arguments);
28986 return new osmEntity().initialize(arguments);
28988 osmEntity.id = function(type2) {
28989 return osmEntity.id.fromOSM(type2, osmEntity.id.next[type2]--);
28991 osmEntity.id.next = {
28997 osmEntity.id.fromOSM = function(type2, id2) {
28998 return type2[0] + id2;
29000 osmEntity.id.toOSM = function(id2) {
29001 var match = id2.match(/^[cnwr](-?\d+)$/);
29007 osmEntity.id.type = function(id2) {
29008 return { "c": "changeset", "n": "node", "w": "way", "r": "relation" }[id2[0]];
29010 osmEntity.key = function(entity) {
29011 return entity.id + "v" + (entity.v || 0);
29013 var _deprecatedTagValuesByKey;
29014 osmEntity.deprecatedTagValuesByKey = function(dataDeprecated) {
29015 if (!_deprecatedTagValuesByKey) {
29016 _deprecatedTagValuesByKey = {};
29017 dataDeprecated.forEach(function(d2) {
29018 var oldKeys = Object.keys(d2.old);
29019 if (oldKeys.length === 1) {
29020 var oldKey = oldKeys[0];
29021 var oldValue = d2.old[oldKey];
29022 if (oldValue !== "*") {
29023 if (!_deprecatedTagValuesByKey[oldKey]) {
29024 _deprecatedTagValuesByKey[oldKey] = [oldValue];
29026 _deprecatedTagValuesByKey[oldKey].push(oldValue);
29032 return _deprecatedTagValuesByKey;
29034 osmEntity.prototype = {
29036 initialize: function(sources) {
29037 for (var i3 = 0; i3 < sources.length; ++i3) {
29038 var source = sources[i3];
29039 for (var prop in source) {
29040 if (Object.prototype.hasOwnProperty.call(source, prop)) {
29041 if (source[prop] === void 0) {
29044 this[prop] = source[prop];
29049 if (!this.id && this.type) {
29050 this.id = osmEntity.id(this.type);
29052 if (!this.hasOwnProperty("visible")) {
29053 this.visible = true;
29056 Object.freeze(this);
29057 Object.freeze(this.tags);
29058 if (this.loc) Object.freeze(this.loc);
29059 if (this.nodes) Object.freeze(this.nodes);
29060 if (this.members) Object.freeze(this.members);
29064 copy: function(resolver, copies) {
29065 if (copies[this.id]) return copies[this.id];
29066 var copy2 = osmEntity(this, { id: void 0, user: void 0, version: void 0 });
29067 copies[this.id] = copy2;
29070 osmId: function() {
29071 return osmEntity.id.toOSM(this.id);
29073 isNew: function() {
29074 var osmId = osmEntity.id.toOSM(this.id);
29075 return osmId.length === 0 || osmId[0] === "-";
29077 update: function(attrs) {
29078 return osmEntity(this, attrs, { v: 1 + (this.v || 0) });
29080 mergeTags: function(tags) {
29081 var merged = Object.assign({}, this.tags);
29082 var changed = false;
29083 for (var k2 in tags) {
29084 var t1 = merged[k2];
29089 } else if (t1 !== t2) {
29091 merged[k2] = utilUnicodeCharsTruncated(
29092 utilArrayUnion(t1.split(/;\s*/), t2.split(/;\s*/)).join(";"),
29094 // avoid exceeding character limit; see also context.maxCharsForTagValue()
29098 return changed ? this.update({ tags: merged }) : this;
29100 intersects: function(extent, resolver) {
29101 return this.extent(resolver).intersects(extent);
29103 hasNonGeometryTags: function() {
29104 return Object.keys(this.tags).some(function(k2) {
29105 return k2 !== "area";
29108 hasParentRelations: function(resolver) {
29109 return resolver.parentRelations(this).length > 0;
29111 hasInterestingTags: function() {
29112 return Object.keys(this.tags).some(osmIsInterestingTag);
29114 isHighwayIntersection: function() {
29117 isDegenerate: function() {
29120 deprecatedTags: function(dataDeprecated) {
29121 var tags = this.tags;
29122 if (Object.keys(tags).length === 0) return [];
29123 var deprecated = [];
29124 dataDeprecated.forEach(function(d2) {
29125 var oldKeys = Object.keys(d2.old);
29127 var hasExistingValues = Object.keys(d2.replace).some(function(replaceKey) {
29128 if (!tags[replaceKey] || d2.old[replaceKey]) return false;
29129 var replaceValue = d2.replace[replaceKey];
29130 if (replaceValue === "*") return false;
29131 if (replaceValue === tags[replaceKey]) return false;
29134 if (hasExistingValues) return;
29136 var matchesDeprecatedTags = oldKeys.every(function(oldKey) {
29137 if (!tags[oldKey]) return false;
29138 if (d2.old[oldKey] === "*") return true;
29139 if (d2.old[oldKey] === tags[oldKey]) return true;
29140 var vals = tags[oldKey].split(";").filter(Boolean);
29141 if (vals.length === 0) {
29143 } else if (vals.length > 1) {
29144 return vals.indexOf(d2.old[oldKey]) !== -1;
29146 if (tags[oldKey] === d2.old[oldKey]) {
29147 if (d2.replace && d2.old[oldKey] === d2.replace[oldKey]) {
29148 var replaceKeys = Object.keys(d2.replace);
29149 return !replaceKeys.every(function(replaceKey) {
29150 return tags[replaceKey] === d2.replace[replaceKey];
29159 if (matchesDeprecatedTags) {
29160 deprecated.push(d2);
29167 // modules/osm/lanes.js
29168 function osmLanes(entity) {
29169 if (entity.type !== "way") return null;
29170 if (!entity.tags.highway) return null;
29171 var tags = entity.tags;
29172 var isOneWay = entity.isOneWay();
29173 var laneCount = getLaneCount(tags, isOneWay);
29174 var maxspeed = parseMaxspeed(tags);
29175 var laneDirections = parseLaneDirections(tags, isOneWay, laneCount);
29176 var forward = laneDirections.forward;
29177 var backward = laneDirections.backward;
29178 var bothways = laneDirections.bothways;
29179 var turnLanes = {};
29180 turnLanes.unspecified = parseTurnLanes(tags["turn:lanes"]);
29181 turnLanes.forward = parseTurnLanes(tags["turn:lanes:forward"]);
29182 turnLanes.backward = parseTurnLanes(tags["turn:lanes:backward"]);
29183 var maxspeedLanes = {};
29184 maxspeedLanes.unspecified = parseMaxspeedLanes(tags["maxspeed:lanes"], maxspeed);
29185 maxspeedLanes.forward = parseMaxspeedLanes(tags["maxspeed:lanes:forward"], maxspeed);
29186 maxspeedLanes.backward = parseMaxspeedLanes(tags["maxspeed:lanes:backward"], maxspeed);
29188 psvLanes.unspecified = parseMiscLanes(tags["psv:lanes"]);
29189 psvLanes.forward = parseMiscLanes(tags["psv:lanes:forward"]);
29190 psvLanes.backward = parseMiscLanes(tags["psv:lanes:backward"]);
29192 busLanes.unspecified = parseMiscLanes(tags["bus:lanes"]);
29193 busLanes.forward = parseMiscLanes(tags["bus:lanes:forward"]);
29194 busLanes.backward = parseMiscLanes(tags["bus:lanes:backward"]);
29195 var taxiLanes = {};
29196 taxiLanes.unspecified = parseMiscLanes(tags["taxi:lanes"]);
29197 taxiLanes.forward = parseMiscLanes(tags["taxi:lanes:forward"]);
29198 taxiLanes.backward = parseMiscLanes(tags["taxi:lanes:backward"]);
29200 hovLanes.unspecified = parseMiscLanes(tags["hov:lanes"]);
29201 hovLanes.forward = parseMiscLanes(tags["hov:lanes:forward"]);
29202 hovLanes.backward = parseMiscLanes(tags["hov:lanes:backward"]);
29204 hgvLanes.unspecified = parseMiscLanes(tags["hgv:lanes"]);
29205 hgvLanes.forward = parseMiscLanes(tags["hgv:lanes:forward"]);
29206 hgvLanes.backward = parseMiscLanes(tags["hgv:lanes:backward"]);
29207 var bicyclewayLanes = {};
29208 bicyclewayLanes.unspecified = parseBicycleWay(tags["bicycleway:lanes"]);
29209 bicyclewayLanes.forward = parseBicycleWay(tags["bicycleway:lanes:forward"]);
29210 bicyclewayLanes.backward = parseBicycleWay(tags["bicycleway:lanes:backward"]);
29216 mapToLanesObj(lanesObj, turnLanes, "turnLane");
29217 mapToLanesObj(lanesObj, maxspeedLanes, "maxspeed");
29218 mapToLanesObj(lanesObj, psvLanes, "psv");
29219 mapToLanesObj(lanesObj, busLanes, "bus");
29220 mapToLanesObj(lanesObj, taxiLanes, "taxi");
29221 mapToLanesObj(lanesObj, hovLanes, "hov");
29222 mapToLanesObj(lanesObj, hgvLanes, "hgv");
29223 mapToLanesObj(lanesObj, bicyclewayLanes, "bicycleway");
29244 function getLaneCount(tags, isOneWay) {
29247 count = parseInt(tags.lanes, 10);
29252 switch (tags.highway) {
29255 count = isOneWay ? 2 : 4;
29258 count = isOneWay ? 1 : 2;
29263 function parseMaxspeed(tags) {
29264 var maxspeed = tags.maxspeed;
29265 if (!maxspeed) return;
29266 var maxspeedRegex = /^([0-9][\.0-9]+?)(?:[ ]?(?:km\/h|kmh|kph|mph|knots))?$/;
29267 if (!maxspeedRegex.test(maxspeed)) return;
29268 return parseInt(maxspeed, 10);
29270 function parseLaneDirections(tags, isOneWay, laneCount) {
29271 var forward = parseInt(tags["lanes:forward"], 10);
29272 var backward = parseInt(tags["lanes:backward"], 10);
29273 var bothways = parseInt(tags["lanes:both_ways"], 10) > 0 ? 1 : 0;
29274 if (parseInt(tags.oneway, 10) === -1) {
29277 backward = laneCount;
29278 } else if (isOneWay) {
29279 forward = laneCount;
29282 } else if (isNaN(forward) && isNaN(backward)) {
29283 backward = Math.floor((laneCount - bothways) / 2);
29284 forward = laneCount - bothways - backward;
29285 } else if (isNaN(forward)) {
29286 if (backward > laneCount - bothways) {
29287 backward = laneCount - bothways;
29289 forward = laneCount - bothways - backward;
29290 } else if (isNaN(backward)) {
29291 if (forward > laneCount - bothways) {
29292 forward = laneCount - bothways;
29294 backward = laneCount - bothways - forward;
29302 function parseTurnLanes(tag2) {
29304 var validValues = [
29317 return tag2.split("|").map(function(s2) {
29318 if (s2 === "") s2 = "none";
29319 return s2.split(";").map(function(d2) {
29320 return validValues.indexOf(d2) === -1 ? "unknown" : d2;
29324 function parseMaxspeedLanes(tag2, maxspeed) {
29326 return tag2.split("|").map(function(s2) {
29327 if (s2 === "none") return s2;
29328 var m2 = parseInt(s2, 10);
29329 if (s2 === "" || m2 === maxspeed) return null;
29330 return isNaN(m2) ? "unknown" : m2;
29333 function parseMiscLanes(tag2) {
29335 var validValues = [
29340 return tag2.split("|").map(function(s2) {
29341 if (s2 === "") s2 = "no";
29342 return validValues.indexOf(s2) === -1 ? "unknown" : s2;
29345 function parseBicycleWay(tag2) {
29347 var validValues = [
29353 return tag2.split("|").map(function(s2) {
29354 if (s2 === "") s2 = "no";
29355 return validValues.indexOf(s2) === -1 ? "unknown" : s2;
29358 function mapToLanesObj(lanesObj, data, key) {
29359 if (data.forward) {
29360 data.forward.forEach(function(l2, i3) {
29361 if (!lanesObj.forward[i3]) lanesObj.forward[i3] = {};
29362 lanesObj.forward[i3][key] = l2;
29365 if (data.backward) {
29366 data.backward.forEach(function(l2, i3) {
29367 if (!lanesObj.backward[i3]) lanesObj.backward[i3] = {};
29368 lanesObj.backward[i3][key] = l2;
29371 if (data.unspecified) {
29372 data.unspecified.forEach(function(l2, i3) {
29373 if (!lanesObj.unspecified[i3]) lanesObj.unspecified[i3] = {};
29374 lanesObj.unspecified[i3][key] = l2;
29379 // modules/osm/way.js
29380 function osmWay() {
29381 if (!(this instanceof osmWay)) {
29382 return new osmWay().initialize(arguments);
29383 } else if (arguments.length) {
29384 this.initialize(arguments);
29387 osmEntity.way = osmWay;
29388 osmWay.prototype = Object.create(osmEntity.prototype);
29389 Object.assign(osmWay.prototype, {
29392 copy: function(resolver, copies) {
29393 if (copies[this.id]) return copies[this.id];
29394 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
29395 var nodes = this.nodes.map(function(id2) {
29396 return resolver.entity(id2).copy(resolver, copies).id;
29398 copy2 = copy2.update({ nodes });
29399 copies[this.id] = copy2;
29402 extent: function(resolver) {
29403 return resolver.transient(this, "extent", function() {
29404 var extent = geoExtent();
29405 for (var i3 = 0; i3 < this.nodes.length; i3++) {
29406 var node = resolver.hasEntity(this.nodes[i3]);
29408 extent._extend(node.extent());
29414 first: function() {
29415 return this.nodes[0];
29418 return this.nodes[this.nodes.length - 1];
29420 contains: function(node) {
29421 return this.nodes.indexOf(node) >= 0;
29423 affix: function(node) {
29424 if (this.nodes[0] === node) return "prefix";
29425 if (this.nodes[this.nodes.length - 1] === node) return "suffix";
29427 layer: function() {
29428 if (isFinite(this.tags.layer)) {
29429 return Math.max(-10, Math.min(+this.tags.layer, 10));
29431 if (this.tags.covered === "yes") return -1;
29432 if (this.tags.location === "overground") return 1;
29433 if (this.tags.location === "underground") return -1;
29434 if (this.tags.location === "underwater") return -10;
29435 if (this.tags.power === "line") return 10;
29436 if (this.tags.power === "minor_line") return 10;
29437 if (this.tags.aerialway) return 10;
29438 if (this.tags.bridge) return 1;
29439 if (this.tags.cutting) return -1;
29440 if (this.tags.tunnel) return -1;
29441 if (this.tags.waterway) return -1;
29442 if (this.tags.man_made === "pipeline") return -10;
29443 if (this.tags.boundary) return -10;
29446 // the approximate width of the line based on its tags except its `width` tag
29447 impliedLineWidthMeters: function() {
29448 var averageWidths = {
29450 // width is for single lane
29479 // width includes ties and rail bed, not just track gauge
29501 for (var key in averageWidths) {
29502 if (this.tags[key] && averageWidths[key][this.tags[key]]) {
29503 var width = averageWidths[key][this.tags[key]];
29504 if (key === "highway") {
29505 var laneCount = this.tags.lanes && parseInt(this.tags.lanes, 10);
29506 if (!laneCount) laneCount = this.isOneWay() ? 1 : 2;
29507 return width * laneCount;
29514 isOneWay: function() {
29519 "reversible": true,
29520 "alternating": true,
29524 if (values[this.tags.oneway] !== void 0) {
29525 return values[this.tags.oneway];
29527 for (var key in this.tags) {
29528 if (key in osmOneWayTags && this.tags[key] in osmOneWayTags[key]) {
29534 // Some identifier for tag that implies that this way is "sided",
29535 // i.e. the right side is the 'inside' (e.g. the right side of a
29536 // natural=cliff is lower).
29537 sidednessIdentifier: function() {
29538 for (const realKey in this.tags) {
29539 const value = this.tags[realKey];
29540 const key = osmRemoveLifecyclePrefix(realKey);
29541 if (key in osmRightSideIsInsideTags && value in osmRightSideIsInsideTags[key]) {
29542 if (osmRightSideIsInsideTags[key][value] === true) {
29545 return osmRightSideIsInsideTags[key][value];
29551 isSided: function() {
29552 if (this.tags.two_sided === "yes") {
29555 return this.sidednessIdentifier() !== null;
29557 lanes: function() {
29558 return osmLanes(this);
29560 isClosed: function() {
29561 return this.nodes.length > 1 && this.first() === this.last();
29563 isConvex: function(resolver) {
29564 if (!this.isClosed() || this.isDegenerate()) return null;
29565 var nodes = utilArrayUniq(resolver.childNodes(this));
29566 var coords = nodes.map(function(n3) {
29571 for (var i3 = 0; i3 < coords.length; i3++) {
29572 var o2 = coords[(i3 + 1) % coords.length];
29573 var a2 = coords[i3];
29574 var b2 = coords[(i3 + 2) % coords.length];
29575 var res = geoVecCross(a2, b2, o2);
29576 curr = res > 0 ? 1 : res < 0 ? -1 : 0;
29579 } else if (prev && curr !== prev) {
29586 // returns an object with the tag that implies this is an area, if any
29587 tagSuggestingArea: function() {
29588 return osmTagSuggestingArea(this.tags);
29590 isArea: function() {
29591 if (this.tags.area === "yes") return true;
29592 if (!this.isClosed() || this.tags.area === "no") return false;
29593 return this.tagSuggestingArea() !== null;
29595 isDegenerate: function() {
29596 return new Set(this.nodes).size < (this.isArea() ? 3 : 2);
29598 areAdjacent: function(n1, n22) {
29599 for (var i3 = 0; i3 < this.nodes.length; i3++) {
29600 if (this.nodes[i3] === n1) {
29601 if (this.nodes[i3 - 1] === n22) return true;
29602 if (this.nodes[i3 + 1] === n22) return true;
29607 geometry: function(graph) {
29608 return graph.transient(this, "geometry", function() {
29609 return this.isArea() ? "area" : "line";
29612 // returns an array of objects representing the segments between the nodes in this way
29613 segments: function(graph) {
29614 function segmentExtent(graph2) {
29615 var n1 = graph2.hasEntity(this.nodes[0]);
29616 var n22 = graph2.hasEntity(this.nodes[1]);
29617 return n1 && n22 && geoExtent([
29619 Math.min(n1.loc[0], n22.loc[0]),
29620 Math.min(n1.loc[1], n22.loc[1])
29623 Math.max(n1.loc[0], n22.loc[0]),
29624 Math.max(n1.loc[1], n22.loc[1])
29628 return graph.transient(this, "segments", function() {
29630 for (var i3 = 0; i3 < this.nodes.length - 1; i3++) {
29632 id: this.id + "-" + i3,
29635 nodes: [this.nodes[i3], this.nodes[i3 + 1]],
29636 extent: segmentExtent
29642 // If this way is not closed, append the beginning node to the end of the nodelist to close it.
29643 close: function() {
29644 if (this.isClosed() || !this.nodes.length) return this;
29645 var nodes = this.nodes.slice();
29646 nodes = nodes.filter(noRepeatNodes);
29647 nodes.push(nodes[0]);
29648 return this.update({ nodes });
29650 // If this way is closed, remove any connector nodes from the end of the nodelist to unclose it.
29651 unclose: function() {
29652 if (!this.isClosed()) return this;
29653 var nodes = this.nodes.slice();
29654 var connector = this.first();
29655 var i3 = nodes.length - 1;
29656 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29657 nodes.splice(i3, 1);
29658 i3 = nodes.length - 1;
29660 nodes = nodes.filter(noRepeatNodes);
29661 return this.update({ nodes });
29663 // Adds a node (id) in front of the node which is currently at position index.
29664 // If index is undefined, the node will be added to the end of the way for linear ways,
29665 // or just before the final connecting node for circular ways.
29666 // Consecutive duplicates are eliminated including existing ones.
29667 // Circularity is always preserved when adding a node.
29668 addNode: function(id2, index) {
29669 var nodes = this.nodes.slice();
29670 var isClosed = this.isClosed();
29671 var max3 = isClosed ? nodes.length - 1 : nodes.length;
29672 if (index === void 0) {
29675 if (index < 0 || index > max3) {
29676 throw new RangeError("index " + index + " out of range 0.." + max3);
29679 var connector = this.first();
29681 while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29682 nodes.splice(i3, 1);
29683 if (index > i3) index--;
29685 i3 = nodes.length - 1;
29686 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29687 nodes.splice(i3, 1);
29688 if (index > i3) index--;
29689 i3 = nodes.length - 1;
29692 nodes.splice(index, 0, id2);
29693 nodes = nodes.filter(noRepeatNodes);
29694 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29695 nodes.push(nodes[0]);
29697 return this.update({ nodes });
29699 // Replaces the node which is currently at position index with the given node (id).
29700 // Consecutive duplicates are eliminated including existing ones.
29701 // Circularity is preserved when updating a node.
29702 updateNode: function(id2, index) {
29703 var nodes = this.nodes.slice();
29704 var isClosed = this.isClosed();
29705 var max3 = nodes.length - 1;
29706 if (index === void 0 || index < 0 || index > max3) {
29707 throw new RangeError("index " + index + " out of range 0.." + max3);
29710 var connector = this.first();
29712 while (i3 < nodes.length && nodes.length > 2 && nodes[i3] === connector) {
29713 nodes.splice(i3, 1);
29714 if (index > i3) index--;
29716 i3 = nodes.length - 1;
29717 while (i3 > 0 && nodes.length > 1 && nodes[i3] === connector) {
29718 nodes.splice(i3, 1);
29719 if (index === i3) index = 0;
29720 i3 = nodes.length - 1;
29723 nodes.splice(index, 1, id2);
29724 nodes = nodes.filter(noRepeatNodes);
29725 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29726 nodes.push(nodes[0]);
29728 return this.update({ nodes });
29730 // Replaces each occurrence of node id needle with replacement.
29731 // Consecutive duplicates are eliminated including existing ones.
29732 // Circularity is preserved.
29733 replaceNode: function(needleID, replacementID) {
29734 var nodes = this.nodes.slice();
29735 var isClosed = this.isClosed();
29736 for (var i3 = 0; i3 < nodes.length; i3++) {
29737 if (nodes[i3] === needleID) {
29738 nodes[i3] = replacementID;
29741 nodes = nodes.filter(noRepeatNodes);
29742 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29743 nodes.push(nodes[0]);
29745 return this.update({ nodes });
29747 // Removes each occurrence of node id.
29748 // Consecutive duplicates are eliminated including existing ones.
29749 // Circularity is preserved.
29750 removeNode: function(id2) {
29751 var nodes = this.nodes.slice();
29752 var isClosed = this.isClosed();
29753 nodes = nodes.filter(function(node) {
29754 return node !== id2;
29755 }).filter(noRepeatNodes);
29756 if (isClosed && (nodes.length === 1 || nodes[0] !== nodes[nodes.length - 1])) {
29757 nodes.push(nodes[0]);
29759 return this.update({ nodes });
29761 asJXON: function(changeset_id) {
29764 "@id": this.osmId(),
29765 "@version": this.version || 0,
29766 nd: this.nodes.map(function(id2) {
29767 return { keyAttributes: { ref: osmEntity.id.toOSM(id2) } };
29769 tag: Object.keys(this.tags).map(function(k2) {
29770 return { keyAttributes: { k: k2, v: this.tags[k2] } };
29774 if (changeset_id) {
29775 r2.way["@changeset"] = changeset_id;
29779 asGeoJSON: function(resolver) {
29780 return resolver.transient(this, "GeoJSON", function() {
29781 var coordinates = resolver.childNodes(this).map(function(n3) {
29784 if (this.isArea() && this.isClosed()) {
29787 coordinates: [coordinates]
29791 type: "LineString",
29797 area: function(resolver) {
29798 return resolver.transient(this, "area", function() {
29799 var nodes = resolver.childNodes(this);
29802 coordinates: [nodes.map(function(n3) {
29806 if (!this.isClosed() && nodes.length) {
29807 json.coordinates[0].push(nodes[0].loc);
29809 var area = area_default(json);
29810 if (area > 2 * Math.PI) {
29811 json.coordinates[0] = json.coordinates[0].reverse();
29812 area = area_default(json);
29814 return isNaN(area) ? 0 : area;
29818 function noRepeatNodes(node, i3, arr) {
29819 return i3 === 0 || node !== arr[i3 - 1];
29822 // modules/osm/multipolygon.js
29823 function osmJoinWays(toJoin, graph) {
29824 function resolve(member) {
29825 return graph.childNodes(graph.entity(member.id));
29827 function reverse(item2) {
29828 var action = actionReverse(item2.id, { reverseOneway: true });
29829 sequences.actions.push(action);
29830 return item2 instanceof osmWay ? action(graph).entity(item2.id) : item2;
29832 toJoin = toJoin.filter(function(member) {
29833 return member.type === "way" && graph.hasEntity(member.id);
29836 var joinAsMembers = true;
29837 for (i3 = 0; i3 < toJoin.length; i3++) {
29838 if (toJoin[i3] instanceof osmWay) {
29839 joinAsMembers = false;
29843 var sequences = [];
29844 sequences.actions = [];
29845 while (toJoin.length) {
29846 var item = toJoin.shift();
29847 var currWays = [item];
29848 var currNodes = resolve(item).slice();
29849 while (toJoin.length) {
29850 var start2 = currNodes[0];
29851 var end = currNodes[currNodes.length - 1];
29854 for (i3 = 0; i3 < toJoin.length; i3++) {
29856 nodes = resolve(item);
29857 if (joinAsMembers && currWays.length === 1 && nodes[0] !== end && nodes[nodes.length - 1] !== end && (nodes[nodes.length - 1] === start2 || nodes[0] === start2)) {
29858 currWays[0] = reverse(currWays[0]);
29859 currNodes.reverse();
29860 start2 = currNodes[0];
29861 end = currNodes[currNodes.length - 1];
29863 if (nodes[0] === end) {
29864 fn = currNodes.push;
29865 nodes = nodes.slice(1);
29867 } else if (nodes[nodes.length - 1] === end) {
29868 fn = currNodes.push;
29869 nodes = nodes.slice(0, -1).reverse();
29870 item = reverse(item);
29872 } else if (nodes[nodes.length - 1] === start2) {
29873 fn = currNodes.unshift;
29874 nodes = nodes.slice(0, -1);
29876 } else if (nodes[0] === start2) {
29877 fn = currNodes.unshift;
29878 nodes = nodes.slice(1).reverse();
29879 item = reverse(item);
29888 fn.apply(currWays, [item]);
29889 fn.apply(currNodes, nodes);
29890 toJoin.splice(i3, 1);
29892 currWays.nodes = currNodes;
29893 sequences.push(currWays);
29898 // modules/actions/add_member.js
29899 function actionAddMember(relationId, member, memberIndex) {
29900 return function action(graph) {
29901 var relation = graph.entity(relationId);
29902 var isPTv2 = /stop|platform/.test(member.role);
29903 if (member.type === "way" && !isPTv2) {
29904 graph = addWayMember(relation, graph);
29906 if (isPTv2 && isNaN(memberIndex)) {
29909 graph = graph.replace(relation.addMember(member, memberIndex));
29913 function addWayMember(relation, graph) {
29914 var groups, item, i3, j2, k2;
29915 var PTv2members = [];
29917 for (i3 = 0; i3 < relation.members.length; i3++) {
29918 var m2 = relation.members[i3];
29919 if (/stop|platform/.test(m2.role)) {
29920 PTv2members.push(m2);
29925 relation = relation.update({ members });
29926 groups = utilArrayGroupBy(relation.members, "type");
29927 groups.way = groups.way || [];
29928 groups.way.push(member);
29929 members = withIndex(groups.way);
29930 var joined = osmJoinWays(members, graph);
29931 for (i3 = 0; i3 < joined.length; i3++) {
29932 var segment = joined[i3];
29933 var nodes = segment.nodes.slice();
29934 var startIndex = segment[0].index;
29935 for (j2 = 0; j2 < members.length; j2++) {
29936 if (members[j2].index === startIndex) {
29940 for (k2 = 0; k2 < segment.length; k2++) {
29941 item = segment[k2];
29942 var way = graph.entity(item.id);
29944 if (j2 + k2 >= members.length || item.index !== members[j2 + k2].index) {
29945 moveMember(members, item.index, j2 + k2);
29948 nodes.splice(0, way.nodes.length - 1);
29951 var wayMembers = [];
29952 for (i3 = 0; i3 < members.length; i3++) {
29953 item = members[i3];
29954 if (item.index === -1) continue;
29955 wayMembers.push(utilObjectOmit(item, ["index"]));
29957 var newMembers = PTv2members.concat(groups.node || [], wayMembers, groups.relation || []);
29958 return graph.replace(relation.update({ members: newMembers }));
29959 function moveMember(arr, findIndex, toIndex) {
29961 for (i4 = 0; i4 < arr.length; i4++) {
29962 if (arr[i4].index === findIndex) {
29966 var item2 = Object.assign({}, arr[i4]);
29967 arr[i4].index = -1;
29968 delete item2.index;
29969 arr.splice(toIndex, 0, item2);
29971 function withIndex(arr) {
29972 var result = new Array(arr.length);
29973 for (var i4 = 0; i4 < arr.length; i4++) {
29974 result[i4] = Object.assign({}, arr[i4]);
29975 result[i4].index = i4;
29982 // modules/actions/add_midpoint.js
29983 function actionAddMidpoint(midpoint, node) {
29984 return function(graph) {
29985 graph = graph.replace(node.move(midpoint.loc));
29986 var parents = utilArrayIntersection(
29987 graph.parentWays(graph.entity(midpoint.edge[0])),
29988 graph.parentWays(graph.entity(midpoint.edge[1]))
29990 parents.forEach(function(way) {
29991 for (var i3 = 0; i3 < way.nodes.length - 1; i3++) {
29992 if (geoEdgeEqual([way.nodes[i3], way.nodes[i3 + 1]], midpoint.edge)) {
29993 graph = graph.replace(graph.entity(way.id).addNode(node.id, i3 + 1));
30002 // modules/actions/add_vertex.js
30003 function actionAddVertex(wayId, nodeId, index) {
30004 return function(graph) {
30005 return graph.replace(graph.entity(wayId).addNode(nodeId, index));
30009 // modules/actions/change_member.js
30010 function actionChangeMember(relationId, member, memberIndex) {
30011 return function(graph) {
30012 return graph.replace(graph.entity(relationId).updateMember(member, memberIndex));
30016 // modules/actions/change_preset.js
30017 function actionChangePreset(entityID, oldPreset, newPreset, skipFieldDefaults) {
30018 return function action(graph) {
30019 var entity = graph.entity(entityID);
30020 var geometry = entity.geometry(graph);
30021 var tags = entity.tags;
30022 const loc = entity.extent(graph).center();
30026 if (newPreset.addTags) {
30027 preserveKeys = preserveKeys.concat(Object.keys(newPreset.addTags));
30029 if (oldPreset && !oldPreset.id.startsWith(newPreset.id)) {
30030 newPreset.fields(loc).concat(newPreset.moreFields(loc)).filter((f2) => f2.matchGeometry(geometry)).map((f2) => f2.key).filter(Boolean).forEach((key) => preserveKeys.push(key));
30033 if (oldPreset) tags = oldPreset.unsetTags(tags, geometry, preserveKeys, false, loc);
30034 if (newPreset) tags = newPreset.setTags(tags, geometry, skipFieldDefaults, loc);
30035 return graph.replace(entity.update({ tags }));
30039 // modules/actions/change_tags.js
30040 function actionChangeTags(entityId, tags) {
30041 return function(graph) {
30042 var entity = graph.entity(entityId);
30043 return graph.replace(entity.update({ tags }));
30047 // modules/osm/node.js
30051 northnortheast: 22,
30059 eastsoutheast: 112,
30063 southsoutheast: 157,
30067 southsouthwest: 202,
30071 westsouthwest: 247,
30075 westnorthwest: 292,
30079 northnorthwest: 337,
30082 function osmNode() {
30083 if (!(this instanceof osmNode)) {
30084 return new osmNode().initialize(arguments);
30085 } else if (arguments.length) {
30086 this.initialize(arguments);
30089 osmEntity.node = osmNode;
30090 osmNode.prototype = Object.create(osmEntity.prototype);
30091 Object.assign(osmNode.prototype, {
30094 extent: function() {
30095 return new geoExtent(this.loc);
30097 geometry: function(graph) {
30098 return graph.transient(this, "geometry", function() {
30099 return graph.isPoi(this) ? "point" : "vertex";
30102 move: function(loc) {
30103 return this.update({ loc });
30105 isDegenerate: function() {
30106 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);
30108 // Inspect tags and geometry to determine which direction(s) this node/vertex points
30109 directions: function(resolver, projection2) {
30112 if (this.isHighwayIntersection(resolver) && (this.tags.stop || "").toLowerCase() === "all") {
30115 val = (this.tags.direction || "").toLowerCase();
30116 var re3 = /:direction$/i;
30117 var keys2 = Object.keys(this.tags);
30118 for (i3 = 0; i3 < keys2.length; i3++) {
30119 if (re3.test(keys2[i3])) {
30120 val = this.tags[keys2[i3]].toLowerCase();
30125 if (val === "") return [];
30126 var values = val.split(";");
30128 values.forEach(function(v2) {
30129 if (cardinal[v2] !== void 0) {
30132 if (v2 !== "" && !isNaN(+v2)) {
30136 var lookBackward = this.tags["traffic_sign:backward"] || v2 === "backward" || v2 === "both" || v2 === "all";
30137 var lookForward = this.tags["traffic_sign:forward"] || v2 === "forward" || v2 === "both" || v2 === "all";
30138 if (!lookForward && !lookBackward) return;
30140 resolver.parentWays(this).forEach(function(parent) {
30141 var nodes = parent.nodes;
30142 for (i3 = 0; i3 < nodes.length; i3++) {
30143 if (nodes[i3] === this.id) {
30144 if (lookForward && i3 > 0) {
30145 nodeIds[nodes[i3 - 1]] = true;
30147 if (lookBackward && i3 < nodes.length - 1) {
30148 nodeIds[nodes[i3 + 1]] = true;
30153 Object.keys(nodeIds).forEach(function(nodeId) {
30155 geoAngle(this, resolver.entity(nodeId), projection2) * (180 / Math.PI) + 90
30159 return utilArrayUniq(results);
30161 isCrossing: function() {
30162 return this.tags.highway === "crossing" || this.tags.railway && this.tags.railway.indexOf("crossing") !== -1;
30164 isEndpoint: function(resolver) {
30165 return resolver.transient(this, "isEndpoint", function() {
30167 return resolver.parentWays(this).filter(function(parent) {
30168 return !parent.isClosed() && !!parent.affix(id2);
30172 isConnected: function(resolver) {
30173 return resolver.transient(this, "isConnected", function() {
30174 var parents = resolver.parentWays(this);
30175 if (parents.length > 1) {
30176 for (var i3 in parents) {
30177 if (parents[i3].geometry(resolver) === "line" && parents[i3].hasInterestingTags()) return true;
30179 } else if (parents.length === 1) {
30180 var way = parents[0];
30181 var nodes = way.nodes.slice();
30182 if (way.isClosed()) {
30185 return nodes.indexOf(this.id) !== nodes.lastIndexOf(this.id);
30190 parentIntersectionWays: function(resolver) {
30191 return resolver.transient(this, "parentIntersectionWays", function() {
30192 return resolver.parentWays(this).filter(function(parent) {
30193 return (parent.tags.highway || parent.tags.waterway || parent.tags.railway || parent.tags.aeroway) && parent.geometry(resolver) === "line";
30197 isIntersection: function(resolver) {
30198 return this.parentIntersectionWays(resolver).length > 1;
30200 isHighwayIntersection: function(resolver) {
30201 return resolver.transient(this, "isHighwayIntersection", function() {
30202 return resolver.parentWays(this).filter(function(parent) {
30203 return parent.tags.highway && parent.geometry(resolver) === "line";
30207 isOnAddressLine: function(resolver) {
30208 return resolver.transient(this, "isOnAddressLine", function() {
30209 return resolver.parentWays(this).filter(function(parent) {
30210 return parent.tags.hasOwnProperty("addr:interpolation") && parent.geometry(resolver) === "line";
30214 asJXON: function(changeset_id) {
30217 "@id": this.osmId(),
30218 "@lon": this.loc[0],
30219 "@lat": this.loc[1],
30220 "@version": this.version || 0,
30221 tag: Object.keys(this.tags).map(function(k2) {
30222 return { keyAttributes: { k: k2, v: this.tags[k2] } };
30226 if (changeset_id) r2.node["@changeset"] = changeset_id;
30229 asGeoJSON: function() {
30232 coordinates: this.loc
30237 // modules/actions/circularize.js
30238 function actionCircularize(wayId, projection2, maxAngle) {
30239 maxAngle = (maxAngle || 20) * Math.PI / 180;
30240 var action = function(graph, t2) {
30241 if (t2 === null || !isFinite(t2)) t2 = 1;
30242 t2 = Math.min(Math.max(+t2, 0), 1);
30243 var way = graph.entity(wayId);
30244 var origNodes = {};
30245 graph.childNodes(way).forEach(function(node2) {
30246 if (!origNodes[node2.id]) origNodes[node2.id] = node2;
30248 if (!way.isConvex(graph)) {
30249 graph = action.makeConvex(graph);
30251 var nodes = utilArrayUniq(graph.childNodes(way));
30252 var keyNodes = nodes.filter(function(n3) {
30253 return graph.parentWays(n3).length !== 1;
30255 var points = nodes.map(function(n3) {
30256 return projection2(n3.loc);
30258 var keyPoints = keyNodes.map(function(n3) {
30259 return projection2(n3.loc);
30261 var centroid = points.length === 2 ? geoVecInterp(points[0], points[1], 0.5) : centroid_default2(points);
30262 var radius = median(points, function(p2) {
30263 return geoVecLength(centroid, p2);
30265 var sign2 = area_default3(points) > 0 ? 1 : -1;
30266 var ids, i3, j2, k2;
30267 if (!keyNodes.length) {
30268 keyNodes = [nodes[0]];
30269 keyPoints = [points[0]];
30271 if (keyNodes.length === 1) {
30272 var index = nodes.indexOf(keyNodes[0]);
30273 var oppositeIndex = Math.floor((index + nodes.length / 2) % nodes.length);
30274 keyNodes.push(nodes[oppositeIndex]);
30275 keyPoints.push(points[oppositeIndex]);
30277 for (i3 = 0; i3 < keyPoints.length; i3++) {
30278 var nextKeyNodeIndex = (i3 + 1) % keyNodes.length;
30279 var startNode = keyNodes[i3];
30280 var endNode = keyNodes[nextKeyNodeIndex];
30281 var startNodeIndex = nodes.indexOf(startNode);
30282 var endNodeIndex = nodes.indexOf(endNode);
30283 var numberNewPoints = -1;
30284 var indexRange = endNodeIndex - startNodeIndex;
30285 var nearNodes = {};
30286 var inBetweenNodes = [];
30287 var startAngle, endAngle, totalAngle, eachAngle;
30288 var angle2, loc, node, origNode;
30289 if (indexRange < 0) {
30290 indexRange += nodes.length;
30292 var distance = geoVecLength(centroid, keyPoints[i3]) || 1e-4;
30294 centroid[0] + (keyPoints[i3][0] - centroid[0]) / distance * radius,
30295 centroid[1] + (keyPoints[i3][1] - centroid[1]) / distance * radius
30297 loc = projection2.invert(keyPoints[i3]);
30298 node = keyNodes[i3];
30299 origNode = origNodes[node.id];
30300 node = node.move(geoVecInterp(origNode.loc, loc, t2));
30301 graph = graph.replace(node);
30302 startAngle = Math.atan2(keyPoints[i3][1] - centroid[1], keyPoints[i3][0] - centroid[0]);
30303 endAngle = Math.atan2(keyPoints[nextKeyNodeIndex][1] - centroid[1], keyPoints[nextKeyNodeIndex][0] - centroid[0]);
30304 totalAngle = endAngle - startAngle;
30305 if (totalAngle * sign2 > 0) {
30306 totalAngle = -sign2 * (2 * Math.PI - Math.abs(totalAngle));
30310 eachAngle = totalAngle / (indexRange + numberNewPoints);
30311 } while (Math.abs(eachAngle) > maxAngle);
30312 for (j2 = 1; j2 < indexRange; j2++) {
30313 angle2 = startAngle + j2 * eachAngle;
30314 loc = projection2.invert([
30315 centroid[0] + Math.cos(angle2) * radius,
30316 centroid[1] + Math.sin(angle2) * radius
30318 node = nodes[(j2 + startNodeIndex) % nodes.length];
30319 origNode = origNodes[node.id];
30320 nearNodes[node.id] = angle2;
30321 node = node.move(geoVecInterp(origNode.loc, loc, t2));
30322 graph = graph.replace(node);
30324 for (j2 = 0; j2 < numberNewPoints; j2++) {
30325 angle2 = startAngle + (indexRange + j2) * eachAngle;
30326 loc = projection2.invert([
30327 centroid[0] + Math.cos(angle2) * radius,
30328 centroid[1] + Math.sin(angle2) * radius
30330 var min3 = Infinity;
30331 for (var nodeId in nearNodes) {
30332 var nearAngle = nearNodes[nodeId];
30333 var dist = Math.abs(nearAngle - angle2);
30336 origNode = origNodes[nodeId];
30339 node = osmNode({ loc: geoVecInterp(origNode.loc, loc, t2) });
30340 graph = graph.replace(node);
30341 nodes.splice(endNodeIndex + j2, 0, node);
30342 inBetweenNodes.push(node.id);
30344 if (indexRange === 1 && inBetweenNodes.length) {
30345 var startIndex1 = way.nodes.lastIndexOf(startNode.id);
30346 var endIndex1 = way.nodes.lastIndexOf(endNode.id);
30347 var wayDirection1 = endIndex1 - startIndex1;
30348 if (wayDirection1 < -1) {
30351 var parentWays = graph.parentWays(keyNodes[i3]);
30352 for (j2 = 0; j2 < parentWays.length; j2++) {
30353 var sharedWay = parentWays[j2];
30354 if (sharedWay === way) continue;
30355 if (sharedWay.areAdjacent(startNode.id, endNode.id)) {
30356 var startIndex2 = sharedWay.nodes.lastIndexOf(startNode.id);
30357 var endIndex2 = sharedWay.nodes.lastIndexOf(endNode.id);
30358 var wayDirection2 = endIndex2 - startIndex2;
30359 var insertAt = endIndex2;
30360 if (wayDirection2 < -1) {
30363 if (wayDirection1 !== wayDirection2) {
30364 inBetweenNodes.reverse();
30365 insertAt = startIndex2;
30367 for (k2 = 0; k2 < inBetweenNodes.length; k2++) {
30368 sharedWay = sharedWay.addNode(inBetweenNodes[k2], insertAt + k2);
30370 graph = graph.replace(sharedWay);
30375 ids = nodes.map(function(n3) {
30379 way = way.update({ nodes: ids });
30380 graph = graph.replace(way);
30383 action.makeConvex = function(graph) {
30384 var way = graph.entity(wayId);
30385 var nodes = utilArrayUniq(graph.childNodes(way));
30386 var points = nodes.map(function(n3) {
30387 return projection2(n3.loc);
30389 var sign2 = area_default3(points) > 0 ? 1 : -1;
30390 var hull = hull_default(points);
30392 if (sign2 === -1) {
30396 for (i3 = 0; i3 < hull.length - 1; i3++) {
30397 var startIndex = points.indexOf(hull[i3]);
30398 var endIndex = points.indexOf(hull[i3 + 1]);
30399 var indexRange = endIndex - startIndex;
30400 if (indexRange < 0) {
30401 indexRange += nodes.length;
30403 for (j2 = 1; j2 < indexRange; j2++) {
30404 var point = geoVecInterp(hull[i3], hull[i3 + 1], j2 / indexRange);
30405 var node = nodes[(j2 + startIndex) % nodes.length].move(projection2.invert(point));
30406 graph = graph.replace(node);
30411 action.disabled = function(graph) {
30412 if (!graph.entity(wayId).isClosed()) {
30413 return "not_closed";
30415 var way = graph.entity(wayId);
30416 var nodes = utilArrayUniq(graph.childNodes(way));
30417 var points = nodes.map(function(n3) {
30418 return projection2(n3.loc);
30420 var hull = hull_default(points);
30421 var epsilonAngle = Math.PI / 180;
30422 if (hull.length !== points.length || hull.length < 3) {
30425 var centroid = centroid_default2(points);
30426 var radius = geoVecLengthSquare(centroid, points[0]);
30427 var i3, actualPoint;
30428 for (i3 = 0; i3 < hull.length; i3++) {
30429 actualPoint = hull[i3];
30430 var actualDist = geoVecLengthSquare(actualPoint, centroid);
30431 var diff = Math.abs(actualDist - radius);
30432 if (diff > 0.05 * radius) {
30436 for (i3 = 0; i3 < hull.length; i3++) {
30437 actualPoint = hull[i3];
30438 var nextPoint = hull[(i3 + 1) % hull.length];
30439 var startAngle = Math.atan2(actualPoint[1] - centroid[1], actualPoint[0] - centroid[0]);
30440 var endAngle = Math.atan2(nextPoint[1] - centroid[1], nextPoint[0] - centroid[0]);
30441 var angle2 = endAngle - startAngle;
30445 if (angle2 > Math.PI) {
30446 angle2 = 2 * Math.PI - angle2;
30448 if (angle2 > maxAngle + epsilonAngle) {
30452 return "already_circular";
30454 action.transitionable = true;
30458 // modules/actions/delete_way.js
30459 function actionDeleteWay(wayID) {
30460 function canDeleteNode(node, graph) {
30461 if (graph.parentWays(node).length || graph.parentRelations(node).length) return false;
30462 var geometries = osmNodeGeometriesForTags(node.tags);
30463 if (geometries.point) return false;
30464 if (geometries.vertex) return true;
30465 return !node.hasInterestingTags();
30467 var action = function(graph) {
30468 var way = graph.entity(wayID);
30469 graph.parentRelations(way).forEach(function(parent) {
30470 parent = parent.removeMembersWithID(wayID);
30471 graph = graph.replace(parent);
30472 if (parent.isDegenerate()) {
30473 graph = actionDeleteRelation(parent.id)(graph);
30476 new Set(way.nodes).forEach(function(nodeID) {
30477 graph = graph.replace(way.removeNode(nodeID));
30478 var node = graph.entity(nodeID);
30479 if (canDeleteNode(node, graph)) {
30480 graph = graph.remove(node);
30483 return graph.remove(way);
30488 // modules/actions/delete_multiple.js
30489 function actionDeleteMultiple(ids) {
30491 way: actionDeleteWay,
30492 node: actionDeleteNode,
30493 relation: actionDeleteRelation
30495 var action = function(graph) {
30496 ids.forEach(function(id2) {
30497 if (graph.hasEntity(id2)) {
30498 graph = actions[graph.entity(id2).type](id2)(graph);
30506 // modules/actions/delete_relation.js
30507 function actionDeleteRelation(relationID, allowUntaggedMembers) {
30508 function canDeleteEntity(entity, graph) {
30509 return !graph.parentWays(entity).length && !graph.parentRelations(entity).length && (!entity.hasInterestingTags() && !allowUntaggedMembers);
30511 var action = function(graph) {
30512 var relation = graph.entity(relationID);
30513 graph.parentRelations(relation).forEach(function(parent) {
30514 parent = parent.removeMembersWithID(relationID);
30515 graph = graph.replace(parent);
30516 if (parent.isDegenerate()) {
30517 graph = actionDeleteRelation(parent.id)(graph);
30520 var memberIDs = utilArrayUniq(relation.members.map(function(m2) {
30523 memberIDs.forEach(function(memberID) {
30524 graph = graph.replace(relation.removeMembersWithID(memberID));
30525 var entity = graph.entity(memberID);
30526 if (canDeleteEntity(entity, graph)) {
30527 graph = actionDeleteMultiple([memberID])(graph);
30530 return graph.remove(relation);
30535 // modules/actions/delete_node.js
30536 function actionDeleteNode(nodeId) {
30537 var action = function(graph) {
30538 var node = graph.entity(nodeId);
30539 graph.parentWays(node).forEach(function(parent) {
30540 parent = parent.removeNode(nodeId);
30541 graph = graph.replace(parent);
30542 if (parent.isDegenerate()) {
30543 graph = actionDeleteWay(parent.id)(graph);
30546 graph.parentRelations(node).forEach(function(parent) {
30547 parent = parent.removeMembersWithID(nodeId);
30548 graph = graph.replace(parent);
30549 if (parent.isDegenerate()) {
30550 graph = actionDeleteRelation(parent.id)(graph);
30553 return graph.remove(node);
30558 // modules/actions/connect.js
30559 function actionConnect(nodeIDs) {
30560 var action = function(graph) {
30566 var interestingIDs = [];
30567 for (i3 = 0; i3 < nodeIDs.length; i3++) {
30568 node = graph.entity(nodeIDs[i3]);
30569 if (node.hasInterestingTags()) {
30570 if (!node.isNew()) {
30571 interestingIDs.push(node.id);
30575 survivor = graph.entity(utilOldestID(interestingIDs.length > 0 ? interestingIDs : nodeIDs));
30576 for (i3 = 0; i3 < nodeIDs.length; i3++) {
30577 node = graph.entity(nodeIDs[i3]);
30578 if (node.id === survivor.id) continue;
30579 parents = graph.parentWays(node);
30580 for (j2 = 0; j2 < parents.length; j2++) {
30581 graph = graph.replace(parents[j2].replaceNode(node.id, survivor.id));
30583 parents = graph.parentRelations(node);
30584 for (j2 = 0; j2 < parents.length; j2++) {
30585 graph = graph.replace(parents[j2].replaceMember(node, survivor));
30587 survivor = survivor.mergeTags(node.tags);
30588 graph = actionDeleteNode(node.id)(graph);
30590 graph = graph.replace(survivor);
30591 parents = graph.parentWays(survivor);
30592 for (i3 = 0; i3 < parents.length; i3++) {
30593 if (parents[i3].isDegenerate()) {
30594 graph = actionDeleteWay(parents[i3].id)(graph);
30599 action.disabled = function(graph) {
30601 var restrictionIDs = [];
30604 var relations, relation, role;
30606 survivor = graph.entity(utilOldestID(nodeIDs));
30607 for (i3 = 0; i3 < nodeIDs.length; i3++) {
30608 node = graph.entity(nodeIDs[i3]);
30609 relations = graph.parentRelations(node);
30610 for (j2 = 0; j2 < relations.length; j2++) {
30611 relation = relations[j2];
30612 role = relation.memberById(node.id).role || "";
30613 if (relation.hasFromViaTo()) {
30614 restrictionIDs.push(relation.id);
30616 if (seen[relation.id] !== void 0 && seen[relation.id] !== role) {
30619 seen[relation.id] = role;
30623 for (i3 = 0; i3 < nodeIDs.length; i3++) {
30624 node = graph.entity(nodeIDs[i3]);
30625 var parents = graph.parentWays(node);
30626 for (j2 = 0; j2 < parents.length; j2++) {
30627 var parent = parents[j2];
30628 relations = graph.parentRelations(parent);
30629 for (k2 = 0; k2 < relations.length; k2++) {
30630 relation = relations[k2];
30631 if (relation.hasFromViaTo()) {
30632 restrictionIDs.push(relation.id);
30637 restrictionIDs = utilArrayUniq(restrictionIDs);
30638 for (i3 = 0; i3 < restrictionIDs.length; i3++) {
30639 relation = graph.entity(restrictionIDs[i3]);
30640 if (!relation.isComplete(graph)) continue;
30641 var memberWays = relation.members.filter(function(m2) {
30642 return m2.type === "way";
30643 }).map(function(m2) {
30644 return graph.entity(m2.id);
30646 memberWays = utilArrayUniq(memberWays);
30647 var f2 = relation.memberByRole("from");
30648 var t2 = relation.memberByRole("to");
30649 var isUturn = f2.id === t2.id;
30650 var nodes = { from: [], via: [], to: [], keyfrom: [], keyto: [] };
30651 for (j2 = 0; j2 < relation.members.length; j2++) {
30652 collectNodes(relation.members[j2], nodes);
30654 nodes.keyfrom = utilArrayUniq(nodes.keyfrom.filter(hasDuplicates));
30655 nodes.keyto = utilArrayUniq(nodes.keyto.filter(hasDuplicates));
30656 var filter2 = keyNodeFilter(nodes.keyfrom, nodes.keyto);
30657 nodes.from = nodes.from.filter(filter2);
30658 nodes.via = nodes.via.filter(filter2);
30659 nodes.to = nodes.to.filter(filter2);
30660 var connectFrom = false;
30661 var connectVia = false;
30662 var connectTo = false;
30663 var connectKeyFrom = false;
30664 var connectKeyTo = false;
30665 for (j2 = 0; j2 < nodeIDs.length; j2++) {
30666 var n3 = nodeIDs[j2];
30667 if (nodes.from.indexOf(n3) !== -1) {
30668 connectFrom = true;
30670 if (nodes.via.indexOf(n3) !== -1) {
30673 if (nodes.to.indexOf(n3) !== -1) {
30676 if (nodes.keyfrom.indexOf(n3) !== -1) {
30677 connectKeyFrom = true;
30679 if (nodes.keyto.indexOf(n3) !== -1) {
30680 connectKeyTo = true;
30683 if (connectFrom && connectTo && !isUturn) {
30684 return "restriction";
30686 if (connectFrom && connectVia) {
30687 return "restriction";
30689 if (connectTo && connectVia) {
30690 return "restriction";
30692 if (connectKeyFrom || connectKeyTo) {
30693 if (nodeIDs.length !== 2) {
30694 return "restriction";
30698 for (j2 = 0; j2 < memberWays.length; j2++) {
30699 way = memberWays[j2];
30700 if (way.contains(nodeIDs[0])) {
30703 if (way.contains(nodeIDs[1])) {
30709 for (j2 = 0; j2 < memberWays.length; j2++) {
30710 way = memberWays[j2];
30711 if (way.areAdjacent(n0, n1)) {
30717 return "restriction";
30721 for (j2 = 0; j2 < memberWays.length; j2++) {
30722 way = memberWays[j2].update({});
30723 for (k2 = 0; k2 < nodeIDs.length; k2++) {
30724 if (nodeIDs[k2] === survivor.id) continue;
30725 if (way.areAdjacent(nodeIDs[k2], survivor.id)) {
30726 way = way.removeNode(nodeIDs[k2]);
30728 way = way.replaceNode(nodeIDs[k2], survivor.id);
30731 if (way.isDegenerate()) {
30732 return "restriction";
30737 function hasDuplicates(n4, i4, arr) {
30738 return arr.indexOf(n4) !== arr.lastIndexOf(n4);
30740 function keyNodeFilter(froms, tos) {
30741 return function(n4) {
30742 return froms.indexOf(n4) === -1 && tos.indexOf(n4) === -1;
30745 function collectNodes(member, collection) {
30746 var entity = graph.hasEntity(member.id);
30747 if (!entity) return;
30748 var role2 = member.role || "";
30749 if (!collection[role2]) {
30750 collection[role2] = [];
30752 if (member.type === "node") {
30753 collection[role2].push(member.id);
30754 if (role2 === "via") {
30755 collection.keyfrom.push(member.id);
30756 collection.keyto.push(member.id);
30758 } else if (member.type === "way") {
30759 collection[role2].push.apply(collection[role2], entity.nodes);
30760 if (role2 === "from" || role2 === "via") {
30761 collection.keyfrom.push(entity.first());
30762 collection.keyfrom.push(entity.last());
30764 if (role2 === "to" || role2 === "via") {
30765 collection.keyto.push(entity.first());
30766 collection.keyto.push(entity.last());
30774 // modules/actions/copy_entities.js
30775 function actionCopyEntities(ids, fromGraph) {
30777 var action = function(graph) {
30778 ids.forEach(function(id3) {
30779 fromGraph.entity(id3).copy(fromGraph, _copies);
30781 for (var id2 in _copies) {
30782 graph = graph.replace(_copies[id2]);
30786 action.copies = function() {
30792 // modules/actions/delete_member.js
30793 function actionDeleteMember(relationId, memberIndex) {
30794 return function(graph) {
30795 var relation = graph.entity(relationId).removeMember(memberIndex);
30796 graph = graph.replace(relation);
30797 if (relation.isDegenerate()) {
30798 graph = actionDeleteRelation(relation.id)(graph);
30804 // modules/actions/discard_tags.js
30805 function actionDiscardTags(difference2, discardTags) {
30806 discardTags = discardTags || {};
30807 return (graph) => {
30808 difference2.modified().forEach(checkTags);
30809 difference2.created().forEach(checkTags);
30811 function checkTags(entity) {
30812 const keys2 = Object.keys(entity.tags);
30813 let didDiscard = false;
30815 for (let i3 = 0; i3 < keys2.length; i3++) {
30816 const k2 = keys2[i3];
30817 if (discardTags[k2] || !entity.tags[k2]) {
30820 tags[k2] = entity.tags[k2];
30824 graph = graph.replace(entity.update({ tags }));
30830 // modules/actions/disconnect.js
30831 function actionDisconnect(nodeId, newNodeId) {
30833 var disconnectableRelationTypes = {
30834 "associatedStreet": true,
30835 "enforcement": true,
30838 var action = function(graph) {
30839 var node = graph.entity(nodeId);
30840 var connections = action.connections(graph);
30841 connections.forEach(function(connection) {
30842 var way = graph.entity(connection.wayID);
30843 var newNode = osmNode({ id: newNodeId, loc: node.loc, tags: node.tags });
30844 graph = graph.replace(newNode);
30845 if (connection.index === 0 && way.isArea()) {
30846 graph = graph.replace(way.replaceNode(way.nodes[0], newNode.id));
30847 } else if (way.isClosed() && connection.index === way.nodes.length - 1) {
30848 graph = graph.replace(way.unclose().addNode(newNode.id));
30850 graph = graph.replace(way.updateNode(newNode.id, connection.index));
30855 action.connections = function(graph) {
30856 var candidates = [];
30857 var keeping = false;
30858 var parentWays = graph.parentWays(graph.entity(nodeId));
30860 for (var i3 = 0; i3 < parentWays.length; i3++) {
30861 way = parentWays[i3];
30862 if (wayIds && wayIds.indexOf(way.id) === -1) {
30866 if (way.isArea() && way.nodes[0] === nodeId) {
30867 candidates.push({ wayID: way.id, index: 0 });
30869 for (var j2 = 0; j2 < way.nodes.length; j2++) {
30870 waynode = way.nodes[j2];
30871 if (waynode === nodeId) {
30872 if (way.isClosed() && parentWays.length > 1 && wayIds && wayIds.indexOf(way.id) !== -1 && j2 === way.nodes.length - 1) {
30875 candidates.push({ wayID: way.id, index: j2 });
30880 return keeping ? candidates : candidates.slice(1);
30882 action.disabled = function(graph) {
30883 var connections = action.connections(graph);
30884 if (connections.length === 0) return "not_connected";
30885 var parentWays = graph.parentWays(graph.entity(nodeId));
30886 var seenRelationIds = {};
30887 var sharedRelation;
30888 parentWays.forEach(function(way) {
30889 var relations = graph.parentRelations(way);
30890 relations.filter((relation) => !disconnectableRelationTypes[relation.tags.type]).forEach(function(relation) {
30891 if (relation.id in seenRelationIds) {
30893 if (wayIds.indexOf(way.id) !== -1 || wayIds.indexOf(seenRelationIds[relation.id]) !== -1) {
30894 sharedRelation = relation;
30897 sharedRelation = relation;
30900 seenRelationIds[relation.id] = way.id;
30904 if (sharedRelation) return "relation";
30906 action.limitWays = function(val) {
30907 if (!arguments.length) return wayIds;
30914 // modules/actions/extract.js
30915 function actionExtract(entityID, projection2) {
30916 var extractedNodeID;
30917 var action = function(graph) {
30918 var entity = graph.entity(entityID);
30919 if (entity.type === "node") {
30920 return extractFromNode(entity, graph);
30922 return extractFromWayOrRelation(entity, graph);
30924 function extractFromNode(node, graph) {
30925 extractedNodeID = node.id;
30926 var replacement = osmNode({ loc: node.loc });
30927 graph = graph.replace(replacement);
30928 graph = graph.parentWays(node).reduce(function(accGraph, parentWay) {
30929 return accGraph.replace(parentWay.replaceNode(entityID, replacement.id));
30931 return graph.parentRelations(node).reduce(function(accGraph, parentRel) {
30932 return accGraph.replace(parentRel.replaceMember(node, replacement));
30935 function extractFromWayOrRelation(entity, graph) {
30936 var fromGeometry = entity.geometry(graph);
30937 var keysToCopyAndRetain = ["source", "wheelchair"];
30938 var keysToRetain = ["area"];
30939 var buildingKeysToRetain = ["architect", "building", "height", "layer", "nycdoitt:bin"];
30940 var extractedLoc = path_default(projection2).centroid(entity.asGeoJSON(graph));
30941 extractedLoc = extractedLoc && projection2.invert(extractedLoc);
30942 if (!extractedLoc || !isFinite(extractedLoc[0]) || !isFinite(extractedLoc[1])) {
30943 extractedLoc = entity.extent(graph).center();
30945 var indoorAreaValues = {
30952 var isBuilding = entity.tags.building && entity.tags.building !== "no" || entity.tags["building:part"] && entity.tags["building:part"] !== "no";
30953 var isIndoorArea = fromGeometry === "area" && entity.tags.indoor && indoorAreaValues[entity.tags.indoor];
30954 var entityTags = Object.assign({}, entity.tags);
30955 var pointTags = {};
30956 for (var key in entityTags) {
30957 if (entity.type === "relation" && key === "type") {
30960 if (keysToRetain.indexOf(key) !== -1) {
30964 if (buildingKeysToRetain.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
30966 if (isIndoorArea && key === "indoor") {
30969 pointTags[key] = entityTags[key];
30970 if (keysToCopyAndRetain.indexOf(key) !== -1 || key.match(/^addr:.{1,}/)) {
30972 } else if (isIndoorArea && key === "level") {
30975 delete entityTags[key];
30977 if (!isBuilding && !isIndoorArea && fromGeometry === "area") {
30978 entityTags.area = "yes";
30980 var replacement = osmNode({ loc: extractedLoc, tags: pointTags });
30981 graph = graph.replace(replacement);
30982 extractedNodeID = replacement.id;
30983 return graph.replace(entity.update({ tags: entityTags }));
30985 action.getExtractedNodeID = function() {
30986 return extractedNodeID;
30991 // modules/actions/join.js
30992 function actionJoin(ids) {
30993 function groupEntitiesByGeometry(graph) {
30994 var entities = ids.map(function(id2) {
30995 return graph.entity(id2);
30997 return Object.assign(
30999 utilArrayGroupBy(entities, function(entity) {
31000 return entity.geometry(graph);
31004 var action = function(graph) {
31005 var ways = ids.map(graph.entity, graph);
31006 var survivorID = utilOldestID(ways.map((way) => way.id));
31007 ways.sort(function(a2, b2) {
31008 var aSided = a2.isSided();
31009 var bSided = b2.isSided();
31010 return aSided && !bSided ? -1 : bSided && !aSided ? 1 : 0;
31012 var sequences = osmJoinWays(ways, graph);
31013 var joined = sequences[0];
31014 graph = sequences.actions.reduce(function(g3, action2) {
31015 return action2(g3);
31017 var survivor = graph.entity(survivorID);
31018 survivor = survivor.update({ nodes: joined.nodes.map(function(n3) {
31021 graph = graph.replace(survivor);
31022 joined.forEach(function(way) {
31023 if (way.id === survivorID) return;
31024 graph.parentRelations(way).forEach(function(parent) {
31025 graph = graph.replace(parent.replaceMember(way, survivor));
31027 survivor = survivor.mergeTags(way.tags);
31028 graph = graph.replace(survivor);
31029 graph = actionDeleteWay(way.id)(graph);
31031 function checkForSimpleMultipolygon() {
31032 if (!survivor.isClosed()) return;
31033 var multipolygons = graph.parentMultipolygons(survivor).filter(function(multipolygon2) {
31034 return multipolygon2.members.length === 1;
31036 if (multipolygons.length !== 1) return;
31037 var multipolygon = multipolygons[0];
31038 for (var key in survivor.tags) {
31039 if (multipolygon.tags[key] && // don't collapse if tags cannot be cleanly merged
31040 multipolygon.tags[key] !== survivor.tags[key]) return;
31042 survivor = survivor.mergeTags(multipolygon.tags);
31043 graph = graph.replace(survivor);
31044 graph = actionDeleteRelation(
31047 /* allow untagged members */
31049 var tags = Object.assign({}, survivor.tags);
31050 if (survivor.geometry(graph) !== "area") {
31054 survivor = survivor.update({ tags });
31055 graph = graph.replace(survivor);
31057 checkForSimpleMultipolygon();
31060 action.resultingWayNodesLength = function(graph) {
31061 return ids.reduce(function(count, id2) {
31062 return count + graph.entity(id2).nodes.length;
31063 }, 0) - ids.length - 1;
31065 action.disabled = function(graph) {
31066 var geometries = groupEntitiesByGeometry(graph);
31067 if (ids.length < 2 || ids.length !== geometries.line.length) {
31068 return "not_eligible";
31070 var joined = osmJoinWays(ids.map(graph.entity, graph), graph);
31071 if (joined.length > 1) {
31072 return "not_adjacent";
31075 var sortedParentRelations = function(id2) {
31076 return graph.parentRelations(graph.entity(id2)).filter((rel) => !rel.isRestriction() && !rel.isConnectivity()).sort((a2, b2) => a2.id - b2.id);
31078 var relsA = sortedParentRelations(ids[0]);
31079 for (i3 = 1; i3 < ids.length; i3++) {
31080 var relsB = sortedParentRelations(ids[i3]);
31081 if (!utilArrayIdentical(relsA, relsB)) {
31082 return "conflicting_relations";
31085 for (i3 = 0; i3 < ids.length - 1; i3++) {
31086 for (var j2 = i3 + 1; j2 < ids.length; j2++) {
31087 var path1 = graph.childNodes(graph.entity(ids[i3])).map(function(e3) {
31090 var path2 = graph.childNodes(graph.entity(ids[j2])).map(function(e3) {
31093 var intersections = geoPathIntersections(path1, path2);
31094 var common = utilArrayIntersection(
31095 joined[0].nodes.map(function(n3) {
31096 return n3.loc.toString();
31098 intersections.map(function(n3) {
31099 return n3.toString();
31102 if (common.length !== intersections.length) {
31103 return "paths_intersect";
31107 var nodeIds = joined[0].nodes.map(function(n3) {
31112 var conflicting = false;
31113 joined[0].forEach(function(way) {
31114 var parents = graph.parentRelations(way);
31115 parents.forEach(function(parent) {
31116 if ((parent.isRestriction() || parent.isConnectivity()) && parent.members.some(function(m2) {
31117 return nodeIds.indexOf(m2.id) >= 0;
31122 for (var k2 in way.tags) {
31123 if (!(k2 in tags)) {
31124 tags[k2] = way.tags[k2];
31125 } else if (tags[k2] && osmIsInterestingTag(k2) && tags[k2] !== way.tags[k2]) {
31126 conflicting = true;
31131 return relation.isRestriction() ? "restriction" : "connectivity";
31134 return "conflicting_tags";
31140 // modules/actions/merge.js
31141 function actionMerge(ids) {
31142 function groupEntitiesByGeometry(graph) {
31143 var entities = ids.map(function(id2) {
31144 return graph.entity(id2);
31146 return Object.assign(
31147 { point: [], area: [], line: [], relation: [] },
31148 utilArrayGroupBy(entities, function(entity) {
31149 return entity.geometry(graph);
31153 var action = function(graph) {
31154 var geometries = groupEntitiesByGeometry(graph);
31155 var target = geometries.area[0] || geometries.line[0];
31156 var points = geometries.point;
31157 points.forEach(function(point) {
31158 target = target.mergeTags(point.tags);
31159 graph = graph.replace(target);
31160 graph.parentRelations(point).forEach(function(parent) {
31161 graph = graph.replace(parent.replaceMember(point, target));
31163 var nodes = utilArrayUniq(graph.childNodes(target));
31164 var removeNode = point;
31165 if (!point.isNew()) {
31166 var inserted = false;
31167 var canBeReplaced = function(node2) {
31168 return !(graph.parentWays(node2).length > 1 || graph.parentRelations(node2).length);
31170 var replaceNode = function(node2) {
31171 graph = graph.replace(point.update({ tags: node2.tags, loc: node2.loc }));
31172 target = target.replaceNode(node2.id, point.id);
31173 graph = graph.replace(target);
31174 removeNode = node2;
31179 for (i3 = 0; i3 < nodes.length; i3++) {
31181 if (canBeReplaced(node) && node.isNew()) {
31186 if (!inserted && point.hasInterestingTags()) {
31187 for (i3 = 0; i3 < nodes.length; i3++) {
31189 if (canBeReplaced(node) && !node.hasInterestingTags()) {
31195 for (i3 = 0; i3 < nodes.length; i3++) {
31197 if (canBeReplaced(node) && utilCompareIDs(point.id, node.id) < 0) {
31205 graph = graph.remove(removeNode);
31207 if (target.tags.area === "yes") {
31208 var tags = Object.assign({}, target.tags);
31210 if (osmTagSuggestingArea(tags)) {
31211 target = target.update({ tags });
31212 graph = graph.replace(target);
31217 action.disabled = function(graph) {
31218 var geometries = groupEntitiesByGeometry(graph);
31219 if (geometries.point.length === 0 || geometries.area.length + geometries.line.length !== 1 || geometries.relation.length !== 0) {
31220 return "not_eligible";
31226 // modules/actions/merge_nodes.js
31227 function actionMergeNodes(nodeIDs, loc) {
31228 function chooseLoc(graph) {
31229 if (!nodeIDs.length) return null;
31231 var interestingCount = 0;
31232 var interestingLoc;
31233 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31234 var node = graph.entity(nodeIDs[i3]);
31235 if (node.hasInterestingTags()) {
31236 interestingLoc = ++interestingCount === 1 ? node.loc : null;
31238 sum = geoVecAdd(sum, node.loc);
31240 return interestingLoc || geoVecScale(sum, 1 / nodeIDs.length);
31242 var action = function(graph) {
31243 if (nodeIDs.length < 2) return graph;
31246 toLoc = chooseLoc(graph);
31248 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31249 var node = graph.entity(nodeIDs[i3]);
31250 if (node.loc !== toLoc) {
31251 graph = graph.replace(node.move(toLoc));
31254 return actionConnect(nodeIDs)(graph);
31256 action.disabled = function(graph) {
31257 if (nodeIDs.length < 2) return "not_eligible";
31258 for (var i3 = 0; i3 < nodeIDs.length; i3++) {
31259 var entity = graph.entity(nodeIDs[i3]);
31260 if (entity.type !== "node") return "not_eligible";
31262 return actionConnect(nodeIDs).disabled(graph);
31267 // modules/osm/changeset.js
31268 function osmChangeset() {
31269 if (!(this instanceof osmChangeset)) {
31270 return new osmChangeset().initialize(arguments);
31271 } else if (arguments.length) {
31272 this.initialize(arguments);
31275 osmEntity.changeset = osmChangeset;
31276 osmChangeset.prototype = Object.create(osmEntity.prototype);
31277 Object.assign(osmChangeset.prototype, {
31279 extent: function() {
31280 return new geoExtent();
31282 geometry: function() {
31283 return "changeset";
31285 asJXON: function() {
31289 tag: Object.keys(this.tags).map(function(k2) {
31290 return { "@k": k2, "@v": this.tags[k2] };
31298 // Generate [osmChange](http://wiki.openstreetmap.org/wiki/OsmChange)
31299 // XML. Returns a string.
31300 osmChangeJXON: function(changes) {
31301 var changeset_id = this.id;
31302 function nest(x2, order) {
31304 for (var i3 = 0; i3 < x2.length; i3++) {
31305 var tagName = Object.keys(x2[i3])[0];
31306 if (!groups[tagName]) groups[tagName] = [];
31307 groups[tagName].push(x2[i3][tagName]);
31310 order.forEach(function(o2) {
31311 if (groups[o2]) ordered[o2] = groups[o2];
31315 function sort(changes2) {
31316 function resolve(item) {
31317 return relations.find(function(relation2) {
31318 return item.keyAttributes.type === "relation" && item.keyAttributes.ref === relation2["@id"];
31321 function isNew(item) {
31322 return !sorted[item["@id"]] && !processing.find(function(proc) {
31323 return proc["@id"] === item["@id"];
31326 var processing = [];
31328 var relations = changes2.relation;
31329 if (!relations) return changes2;
31330 for (var i3 = 0; i3 < relations.length; i3++) {
31331 var relation = relations[i3];
31332 if (!sorted[relation["@id"]]) {
31333 processing.push(relation);
31335 while (processing.length > 0) {
31336 var next = processing[0], deps = next.member.map(resolve).filter(Boolean).filter(isNew);
31337 if (deps.length === 0) {
31338 sorted[next["@id"]] = next;
31339 processing.shift();
31341 processing = deps.concat(processing);
31345 changes2.relation = Object.values(sorted);
31348 function rep(entity) {
31349 return entity.asJXON(changeset_id);
31354 "@generator": "iD",
31355 "create": sort(nest(changes.created.map(rep), ["node", "way", "relation"])),
31356 "modify": nest(changes.modified.map(rep), ["node", "way", "relation"]),
31357 "delete": Object.assign(nest(changes.deleted.map(rep), ["relation", "way", "node"]), { "@if-unused": true })
31361 asGeoJSON: function() {
31366 // modules/osm/note.js
31367 function osmNote() {
31368 if (!(this instanceof osmNote)) {
31369 return new osmNote().initialize(arguments);
31370 } else if (arguments.length) {
31371 this.initialize(arguments);
31374 osmNote.id = function() {
31375 return osmNote.id.next--;
31377 osmNote.id.next = -1;
31378 Object.assign(osmNote.prototype, {
31380 initialize: function(sources) {
31381 for (var i3 = 0; i3 < sources.length; ++i3) {
31382 var source = sources[i3];
31383 for (var prop in source) {
31384 if (Object.prototype.hasOwnProperty.call(source, prop)) {
31385 if (source[prop] === void 0) {
31388 this[prop] = source[prop];
31394 this.id = osmNote.id().toString();
31398 extent: function() {
31399 return new geoExtent(this.loc);
31401 update: function(attrs) {
31402 return osmNote(this, attrs);
31404 isNew: function() {
31405 return this.id < 0;
31407 move: function(loc) {
31408 return this.update({ loc });
31412 // modules/osm/relation.js
31413 function osmRelation() {
31414 if (!(this instanceof osmRelation)) {
31415 return new osmRelation().initialize(arguments);
31416 } else if (arguments.length) {
31417 this.initialize(arguments);
31420 osmEntity.relation = osmRelation;
31421 osmRelation.prototype = Object.create(osmEntity.prototype);
31422 osmRelation.creationOrder = function(a2, b2) {
31423 var aId = parseInt(osmEntity.id.toOSM(a2.id), 10);
31424 var bId = parseInt(osmEntity.id.toOSM(b2.id), 10);
31425 if (aId < 0 || bId < 0) return aId - bId;
31428 Object.assign(osmRelation.prototype, {
31431 copy: function(resolver, copies) {
31432 if (copies[this.id]) return copies[this.id];
31433 var copy2 = osmEntity.prototype.copy.call(this, resolver, copies);
31434 var members = this.members.map(function(member) {
31435 return Object.assign({}, member, { id: resolver.entity(member.id).copy(resolver, copies).id });
31437 copy2 = copy2.update({ members });
31438 copies[this.id] = copy2;
31441 extent: function(resolver, memo) {
31442 return resolver.transient(this, "extent", function() {
31443 if (memo && memo[this.id]) return geoExtent();
31445 memo[this.id] = true;
31446 var extent = geoExtent();
31447 for (var i3 = 0; i3 < this.members.length; i3++) {
31448 var member = resolver.hasEntity(this.members[i3].id);
31450 extent._extend(member.extent(resolver, memo));
31456 geometry: function(graph) {
31457 return graph.transient(this, "geometry", function() {
31458 return this.isMultipolygon() ? "area" : "relation";
31461 isDegenerate: function() {
31462 return this.members.length === 0;
31464 // Return an array of members, each extended with an 'index' property whose value
31465 // is the member index.
31466 indexedMembers: function() {
31467 var result = new Array(this.members.length);
31468 for (var i3 = 0; i3 < this.members.length; i3++) {
31469 result[i3] = Object.assign({}, this.members[i3], { index: i3 });
31473 // Return the first member with the given role. A copy of the member object
31474 // is returned, extended with an 'index' property whose value is the member index.
31475 memberByRole: function(role) {
31476 for (var i3 = 0; i3 < this.members.length; i3++) {
31477 if (this.members[i3].role === role) {
31478 return Object.assign({}, this.members[i3], { index: i3 });
31482 // Same as memberByRole, but returns all members with the given role
31483 membersByRole: function(role) {
31485 for (var i3 = 0; i3 < this.members.length; i3++) {
31486 if (this.members[i3].role === role) {
31487 result.push(Object.assign({}, this.members[i3], { index: i3 }));
31492 // Return the first member with the given id. A copy of the member object
31493 // is returned, extended with an 'index' property whose value is the member index.
31494 memberById: function(id2) {
31495 for (var i3 = 0; i3 < this.members.length; i3++) {
31496 if (this.members[i3].id === id2) {
31497 return Object.assign({}, this.members[i3], { index: i3 });
31501 // Return the first member with the given id and role. A copy of the member object
31502 // is returned, extended with an 'index' property whose value is the member index.
31503 memberByIdAndRole: function(id2, role) {
31504 for (var i3 = 0; i3 < this.members.length; i3++) {
31505 if (this.members[i3].id === id2 && this.members[i3].role === role) {
31506 return Object.assign({}, this.members[i3], { index: i3 });
31510 addMember: function(member, index) {
31511 var members = this.members.slice();
31512 members.splice(index === void 0 ? members.length : index, 0, member);
31513 return this.update({ members });
31515 updateMember: function(member, index) {
31516 var members = this.members.slice();
31517 members.splice(index, 1, Object.assign({}, members[index], member));
31518 return this.update({ members });
31520 removeMember: function(index) {
31521 var members = this.members.slice();
31522 members.splice(index, 1);
31523 return this.update({ members });
31525 removeMembersWithID: function(id2) {
31526 var members = this.members.filter(function(m2) {
31527 return m2.id !== id2;
31529 return this.update({ members });
31531 moveMember: function(fromIndex, toIndex) {
31532 var members = this.members.slice();
31533 members.splice(toIndex, 0, members.splice(fromIndex, 1)[0]);
31534 return this.update({ members });
31536 // Wherever a member appears with id `needle.id`, replace it with a member
31537 // with id `replacement.id`, type `replacement.type`, and the original role,
31538 // By default, adding a duplicate member (by id and role) is prevented.
31539 // Return an updated relation.
31540 replaceMember: function(needle, replacement, keepDuplicates) {
31541 if (!this.memberById(needle.id)) return this;
31543 for (var i3 = 0; i3 < this.members.length; i3++) {
31544 var member = this.members[i3];
31545 if (member.id !== needle.id) {
31546 members.push(member);
31547 } else if (keepDuplicates || !this.memberByIdAndRole(replacement.id, member.role)) {
31548 members.push({ id: replacement.id, type: replacement.type, role: member.role });
31551 return this.update({ members });
31553 asJXON: function(changeset_id) {
31556 "@id": this.osmId(),
31557 "@version": this.version || 0,
31558 member: this.members.map(function(member) {
31563 ref: osmEntity.id.toOSM(member.id)
31567 tag: Object.keys(this.tags).map(function(k2) {
31568 return { keyAttributes: { k: k2, v: this.tags[k2] } };
31572 if (changeset_id) {
31573 r2.relation["@changeset"] = changeset_id;
31577 asGeoJSON: function(resolver) {
31578 return resolver.transient(this, "GeoJSON", function() {
31579 if (this.isMultipolygon()) {
31581 type: "MultiPolygon",
31582 coordinates: this.multipolygon(resolver)
31586 type: "FeatureCollection",
31587 properties: this.tags,
31588 features: this.members.map(function(member) {
31589 return Object.assign({ role: member.role }, resolver.entity(member.id).asGeoJSON(resolver));
31595 area: function(resolver) {
31596 return resolver.transient(this, "area", function() {
31597 return area_default(this.asGeoJSON(resolver));
31600 isMultipolygon: function() {
31601 return this.tags.type === "multipolygon";
31603 isComplete: function(resolver) {
31604 for (var i3 = 0; i3 < this.members.length; i3++) {
31605 if (!resolver.hasEntity(this.members[i3].id)) {
31611 hasFromViaTo: function() {
31612 return this.members.some(function(m2) {
31613 return m2.role === "from";
31614 }) && this.members.some(function(m2) {
31615 return m2.role === "via";
31616 }) && this.members.some(function(m2) {
31617 return m2.role === "to";
31620 isRestriction: function() {
31621 return !!(this.tags.type && this.tags.type.match(/^restriction:?/));
31623 isValidRestriction: function() {
31624 if (!this.isRestriction()) return false;
31625 var froms = this.members.filter(function(m2) {
31626 return m2.role === "from";
31628 var vias = this.members.filter(function(m2) {
31629 return m2.role === "via";
31631 var tos = this.members.filter(function(m2) {
31632 return m2.role === "to";
31634 if (froms.length !== 1 && this.tags.restriction !== "no_entry") return false;
31635 if (froms.some(function(m2) {
31636 return m2.type !== "way";
31638 if (tos.length !== 1 && this.tags.restriction !== "no_exit") return false;
31639 if (tos.some(function(m2) {
31640 return m2.type !== "way";
31642 if (vias.length === 0) return false;
31643 if (vias.length > 1 && vias.some(function(m2) {
31644 return m2.type !== "way";
31648 isConnectivity: function() {
31649 return !!(this.tags.type && this.tags.type.match(/^connectivity:?/));
31651 // Returns an array [A0, ... An], each Ai being an array of node arrays [Nds0, ... Ndsm],
31652 // where Nds0 is an outer ring and subsequent Ndsi's (if any i > 0) being inner rings.
31654 // This corresponds to the structure needed for rendering a multipolygon path using a
31655 // `evenodd` fill rule, as well as the structure of a GeoJSON MultiPolygon geometry.
31657 // In the case of invalid geometries, this function will still return a result which
31658 // includes the nodes of all way members, but some Nds may be unclosed and some inner
31659 // rings not matched with the intended outer ring.
31661 multipolygon: function(resolver) {
31662 var outers = this.members.filter(function(m2) {
31663 return "outer" === (m2.role || "outer");
31665 var inners = this.members.filter(function(m2) {
31666 return "inner" === m2.role;
31668 outers = osmJoinWays(outers, resolver);
31669 inners = osmJoinWays(inners, resolver);
31670 var sequenceToLineString = function(sequence) {
31671 if (sequence.nodes.length > 2 && sequence.nodes[0] !== sequence.nodes[sequence.nodes.length - 1]) {
31672 sequence.nodes.push(sequence.nodes[0]);
31674 return sequence.nodes.map(function(node) {
31678 outers = outers.map(sequenceToLineString);
31679 inners = inners.map(sequenceToLineString);
31680 var result = outers.map(function(o3) {
31681 return [area_default({ type: "Polygon", coordinates: [o3] }) > 2 * Math.PI ? o3.reverse() : o3];
31683 function findOuter(inner2) {
31685 for (o3 = 0; o3 < outers.length; o3++) {
31686 outer = outers[o3];
31687 if (geoPolygonContainsPolygon(outer, inner2)) {
31691 for (o3 = 0; o3 < outers.length; o3++) {
31692 outer = outers[o3];
31693 if (geoPolygonIntersectsPolygon(outer, inner2, false)) {
31698 for (var i3 = 0; i3 < inners.length; i3++) {
31699 var inner = inners[i3];
31700 if (area_default({ type: "Polygon", coordinates: [inner] }) < 2 * Math.PI) {
31701 inner = inner.reverse();
31703 var o2 = findOuter(inners[i3]);
31704 if (o2 !== void 0) {
31705 result[o2].push(inners[i3]);
31707 result.push([inners[i3]]);
31714 // modules/osm/qa_item.js
31715 var QAItem = class _QAItem {
31716 constructor(loc, service, itemType, id2, props) {
31718 this.service = service.title;
31719 this.itemType = itemType;
31720 this.id = id2 ? id2 : "".concat(_QAItem.id());
31721 this.update(props);
31722 if (service && typeof service.getIcon === "function") {
31723 this.icon = service.getIcon(itemType);
31727 const { loc, service, itemType, id: id2 } = this;
31728 Object.keys(props).forEach((prop) => this[prop] = props[prop]);
31730 this.service = service;
31731 this.itemType = itemType;
31735 // Generic handling for newly created QAItems
31737 return this.nextId--;
31740 QAItem.nextId = -1;
31742 // modules/actions/split.js
31743 function actionSplit(nodeIds, newWayIds) {
31744 if (typeof nodeIds === "string") nodeIds = [nodeIds];
31746 var _keepHistoryOn = "longest";
31747 const circularJunctions = ["roundabout", "circular"];
31748 var _createdWayIDs = [];
31749 function dist(graph, nA, nB) {
31750 var locA = graph.entity(nA).loc;
31751 var locB = graph.entity(nB).loc;
31752 var epsilon3 = 1e-6;
31753 return locA && locB ? geoSphericalDistance(locA, locB) : epsilon3;
31755 function splitArea(nodes, idxA, graph) {
31756 var lengths = new Array(nodes.length);
31761 function wrap2(index) {
31762 return utilWrap(index, nodes.length);
31765 for (i3 = wrap2(idxA + 1); i3 !== idxA; i3 = wrap2(i3 + 1)) {
31766 length2 += dist(graph, nodes[i3], nodes[wrap2(i3 - 1)]);
31767 lengths[i3] = length2;
31770 for (i3 = wrap2(idxA - 1); i3 !== idxA; i3 = wrap2(i3 - 1)) {
31771 length2 += dist(graph, nodes[i3], nodes[wrap2(i3 + 1)]);
31772 if (length2 < lengths[i3]) {
31773 lengths[i3] = length2;
31776 for (i3 = 0; i3 < nodes.length; i3++) {
31777 var cost = lengths[i3] / dist(graph, nodes[idxA], nodes[i3]);
31785 function totalLengthBetweenNodes(graph, nodes) {
31786 var totalLength = 0;
31787 for (var i3 = 0; i3 < nodes.length - 1; i3++) {
31788 totalLength += dist(graph, nodes[i3], nodes[i3 + 1]);
31790 return totalLength;
31792 function split(graph, nodeId, wayA, newWayId) {
31793 var wayB = osmWay({ id: newWayId, tags: wayA.tags });
31796 var isArea = wayA.isArea();
31797 if (wayA.isClosed()) {
31798 var nodes = wayA.nodes.slice(0, -1);
31799 var idxA = nodes.indexOf(nodeId);
31800 var idxB = splitArea(nodes, idxA, graph);
31802 nodesA = nodes.slice(idxA).concat(nodes.slice(0, idxB + 1));
31803 nodesB = nodes.slice(idxB, idxA + 1);
31805 nodesA = nodes.slice(idxA, idxB + 1);
31806 nodesB = nodes.slice(idxB).concat(nodes.slice(0, idxA + 1));
31809 var idx = wayA.nodes.indexOf(nodeId, 1);
31810 nodesA = wayA.nodes.slice(0, idx + 1);
31811 nodesB = wayA.nodes.slice(idx);
31813 var lengthA = totalLengthBetweenNodes(graph, nodesA);
31814 var lengthB = totalLengthBetweenNodes(graph, nodesB);
31815 if (_keepHistoryOn === "longest" && lengthB > lengthA) {
31816 wayA = wayA.update({ nodes: nodesB });
31817 wayB = wayB.update({ nodes: nodesA });
31818 var temp = lengthA;
31822 wayA = wayA.update({ nodes: nodesA });
31823 wayB = wayB.update({ nodes: nodesB });
31825 if (wayA.tags.step_count) {
31826 var stepCount = Number(wayA.tags.step_count);
31827 if (stepCount && // ensure a number
31828 isFinite(stepCount) && // ensure positive
31829 stepCount > 0 && // ensure integer
31830 Math.round(stepCount) === stepCount) {
31831 var tagsA = Object.assign({}, wayA.tags);
31832 var tagsB = Object.assign({}, wayB.tags);
31833 var ratioA = lengthA / (lengthA + lengthB);
31834 var countA = Math.round(stepCount * ratioA);
31835 tagsA.step_count = countA.toString();
31836 tagsB.step_count = (stepCount - countA).toString();
31837 wayA = wayA.update({ tags: tagsA });
31838 wayB = wayB.update({ tags: tagsB });
31841 graph = graph.replace(wayA);
31842 graph = graph.replace(wayB);
31843 graph.parentRelations(wayA).forEach(function(relation) {
31844 if (relation.hasFromViaTo()) {
31845 var f2 = relation.memberByRole("from");
31846 var v2 = relation.membersByRole("via");
31847 var t2 = relation.memberByRole("to");
31849 if (f2.id === wayA.id || t2.id === wayA.id) {
31851 if (v2.length === 1 && v2[0].type === "node") {
31852 keepB = wayB.contains(v2[0].id);
31854 for (i3 = 0; i3 < v2.length; i3++) {
31855 if (v2[i3].type === "way") {
31856 var wayVia = graph.hasEntity(v2[i3].id);
31857 if (wayVia && utilArrayIntersection(wayB.nodes, wayVia.nodes).length) {
31865 relation = relation.replaceMember(wayA, wayB);
31866 graph = graph.replace(relation);
31869 for (i3 = 0; i3 < v2.length; i3++) {
31870 if (v2[i3].type === "way" && v2[i3].id === wayA.id) {
31871 graph = splitWayMember(graph, relation.id, wayA, wayB);
31876 graph = splitWayMember(graph, relation.id, wayA, wayB);
31880 var multipolygon = osmRelation({
31881 tags: Object.assign({}, wayA.tags, { type: "multipolygon" }),
31883 { id: wayA.id, role: "outer", type: "way" },
31884 { id: wayB.id, role: "outer", type: "way" }
31887 graph = graph.replace(multipolygon);
31888 graph = graph.replace(wayA.update({ tags: {} }));
31889 graph = graph.replace(wayB.update({ tags: {} }));
31891 _createdWayIDs.push(wayB.id);
31894 function splitWayMember(graph, relationId, wayA, wayB) {
31895 function connects(way1, way2) {
31896 if (way1.nodes.length < 2 || way2.nodes.length < 2) return false;
31897 if (circularJunctions.includes(way1.tags.junction) && way1.isClosed()) {
31898 return way1.nodes.some((nodeId) => nodeId === way2.nodes[0] || nodeId === way2.nodes[way2.nodes.length - 1]);
31899 } else if (circularJunctions.includes(way2.tags.junction) && way2.isClosed()) {
31900 return way2.nodes.some((nodeId) => nodeId === way1.nodes[0] || nodeId === way1.nodes[way1.nodes.length - 1]);
31902 if (way1.nodes[0] === way2.nodes[0]) return true;
31903 if (way1.nodes[0] === way2.nodes[way2.nodes.length - 1]) return true;
31904 if (way1.nodes[way1.nodes.length - 1] === way2.nodes[way2.nodes.length - 1]) return true;
31905 if (way1.nodes[way1.nodes.length - 1] === way2.nodes[0]) return true;
31908 let relation = graph.entity(relationId);
31909 const insertMembers = [];
31910 const members = relation.members;
31911 for (let i3 = 0; i3 < members.length; i3++) {
31912 const member = members[i3];
31913 if (member.id === wayA.id) {
31914 let wayAconnectsPrev = false;
31915 let wayAconnectsNext = false;
31916 let wayBconnectsPrev = false;
31917 let wayBconnectsNext = false;
31918 if (i3 > 0 && graph.hasEntity(members[i3 - 1].id)) {
31919 const prevEntity = graph.entity(members[i3 - 1].id);
31920 if (prevEntity.type === "way") {
31921 wayAconnectsPrev = connects(prevEntity, wayA);
31922 wayBconnectsPrev = connects(prevEntity, wayB);
31925 if (i3 < members.length - 1 && graph.hasEntity(members[i3 + 1].id)) {
31926 const nextEntity = graph.entity(members[i3 + 1].id);
31927 if (nextEntity.type === "way") {
31928 wayAconnectsNext = connects(nextEntity, wayA);
31929 wayBconnectsNext = connects(nextEntity, wayB);
31932 if (wayAconnectsPrev && !wayAconnectsNext || !wayBconnectsPrev && wayBconnectsNext && !(!wayAconnectsPrev && wayAconnectsNext)) {
31933 insertMembers.push({ at: i3 + 1, role: member.role });
31936 if (!wayAconnectsPrev && wayAconnectsNext || wayBconnectsPrev && !wayBconnectsNext && !(wayAconnectsPrev && !wayAconnectsNext)) {
31937 insertMembers.push({ at: i3, role: member.role });
31940 if (wayAconnectsPrev && wayBconnectsPrev && wayAconnectsNext && wayBconnectsNext) {
31941 if (i3 > 2 && graph.hasEntity(members[i3 - 2].id)) {
31942 const prev2Entity = graph.entity(members[i3 - 2].id);
31943 if (connects(prev2Entity, wayA) && !connects(prev2Entity, wayB)) {
31944 insertMembers.push({ at: i3, role: member.role });
31947 if (connects(prev2Entity, wayB) && !connects(prev2Entity, wayA)) {
31948 insertMembers.push({ at: i3 + 1, role: member.role });
31952 if (i3 < members.length - 2 && graph.hasEntity(members[i3 + 2].id)) {
31953 const next2Entity = graph.entity(members[i3 + 2].id);
31954 if (connects(next2Entity, wayA) && !connects(next2Entity, wayB)) {
31955 insertMembers.push({ at: i3 + 1, role: member.role });
31958 if (connects(next2Entity, wayB) && !connects(next2Entity, wayA)) {
31959 insertMembers.push({ at: i3, role: member.role });
31964 if (wayA.nodes[wayA.nodes.length - 1] === wayB.nodes[0]) {
31965 insertMembers.push({ at: i3 + 1, role: member.role });
31967 insertMembers.push({ at: i3, role: member.role });
31971 insertMembers.reverse().forEach((item) => {
31972 graph = graph.replace(relation.addMember({
31977 relation = graph.entity(relation.id);
31981 var action = function(graph) {
31982 _createdWayIDs = [];
31983 var newWayIndex = 0;
31984 for (var i3 = 0; i3 < nodeIds.length; i3++) {
31985 var nodeId = nodeIds[i3];
31986 var candidates = action.waysForNode(nodeId, graph);
31987 for (var j2 = 0; j2 < candidates.length; j2++) {
31988 graph = split(graph, nodeId, candidates[j2], newWayIds && newWayIds[newWayIndex]);
31994 action.getCreatedWayIDs = function() {
31995 return _createdWayIDs;
31997 action.waysForNode = function(nodeId, graph) {
31998 var node = graph.entity(nodeId);
31999 var splittableParents = graph.parentWays(node).filter(isSplittable);
32001 var hasLine = splittableParents.some(function(parent) {
32002 return parent.geometry(graph) === "line";
32005 return splittableParents.filter(function(parent) {
32006 return parent.geometry(graph) === "line";
32010 return splittableParents;
32011 function isSplittable(parent) {
32012 if (_wayIDs && _wayIDs.indexOf(parent.id) === -1) return false;
32013 if (parent.isClosed()) return true;
32014 for (var i3 = 1; i3 < parent.nodes.length - 1; i3++) {
32015 if (parent.nodes[i3] === nodeId) return true;
32020 action.ways = function(graph) {
32021 return utilArrayUniq([].concat.apply([], nodeIds.map(function(nodeId) {
32022 return action.waysForNode(nodeId, graph);
32025 action.disabled = function(graph) {
32026 for (const nodeId of nodeIds) {
32027 const candidates = action.waysForNode(nodeId, graph);
32028 if (candidates.length === 0 || _wayIDs && _wayIDs.length !== candidates.length) {
32029 return "not_eligible";
32031 for (const way of candidates) {
32032 const parentRelations = graph.parentRelations(way);
32033 for (const parentRelation of parentRelations) {
32034 if (parentRelation.hasFromViaTo()) {
32035 const vias = parentRelation.membersByRole("via");
32036 if (!vias.every((via) => graph.hasEntity(via.id))) {
32037 return "parent_incomplete";
32040 for (let i3 = 0; i3 < parentRelation.members.length; i3++) {
32041 if (parentRelation.members[i3].id === way.id) {
32042 const memberBeforePresent = i3 > 0 && graph.hasEntity(parentRelation.members[i3 - 1].id);
32043 const memberAfterPresent = i3 < parentRelation.members.length - 1 && graph.hasEntity(parentRelation.members[i3 + 1].id);
32044 if (!memberBeforePresent && !memberAfterPresent && parentRelation.members.length > 1) {
32045 return "parent_incomplete";
32050 const relTypesExceptions = ["junction", "enforcement"];
32051 if (circularJunctions.includes(way.tags.junction) && way.isClosed() && !relTypesExceptions.includes(parentRelation.tags.type)) {
32052 return "simple_roundabout";
32058 action.limitWays = function(val) {
32059 if (!arguments.length) return _wayIDs;
32063 action.keepHistoryOn = function(val) {
32064 if (!arguments.length) return _keepHistoryOn;
32065 _keepHistoryOn = val;
32071 // modules/core/graph.js
32072 function coreGraph(other, mutable) {
32073 if (!(this instanceof coreGraph)) return new coreGraph(other, mutable);
32074 if (other instanceof coreGraph) {
32075 var base = other.base();
32076 this.entities = Object.assign(Object.create(base.entities), other.entities);
32077 this._parentWays = Object.assign(Object.create(base.parentWays), other._parentWays);
32078 this._parentRels = Object.assign(Object.create(base.parentRels), other._parentRels);
32080 this.entities = /* @__PURE__ */ Object.create({});
32081 this._parentWays = /* @__PURE__ */ Object.create({});
32082 this._parentRels = /* @__PURE__ */ Object.create({});
32083 this.rebase(other || [], [this]);
32085 this.transients = {};
32086 this._childNodes = {};
32087 this.frozen = !mutable;
32089 coreGraph.prototype = {
32090 hasEntity: function(id2) {
32091 return this.entities[id2];
32093 entity: function(id2) {
32094 var entity = this.entities[id2];
32096 entity = this.entities.__proto__[id2];
32099 throw new Error("entity " + id2 + " not found");
32103 geometry: function(id2) {
32104 return this.entity(id2).geometry(this);
32106 transient: function(entity, key, fn) {
32107 var id2 = entity.id;
32108 var transients = this.transients[id2] || (this.transients[id2] = {});
32109 if (transients[key] !== void 0) {
32110 return transients[key];
32112 transients[key] = fn.call(entity);
32113 return transients[key];
32115 parentWays: function(entity) {
32116 var parents = this._parentWays[entity.id];
32119 parents.forEach(function(id2) {
32120 result.push(this.entity(id2));
32125 isPoi: function(entity) {
32126 var parents = this._parentWays[entity.id];
32127 return !parents || parents.size === 0;
32129 isShared: function(entity) {
32130 var parents = this._parentWays[entity.id];
32131 return parents && parents.size > 1;
32133 parentRelations: function(entity) {
32134 var parents = this._parentRels[entity.id];
32137 parents.forEach(function(id2) {
32138 result.push(this.entity(id2));
32143 parentMultipolygons: function(entity) {
32144 return this.parentRelations(entity).filter(function(relation) {
32145 return relation.isMultipolygon();
32148 childNodes: function(entity) {
32149 if (this._childNodes[entity.id]) return this._childNodes[entity.id];
32150 if (!entity.nodes) return [];
32152 for (var i3 = 0; i3 < entity.nodes.length; i3++) {
32153 nodes[i3] = this.entity(entity.nodes[i3]);
32155 if (debug) Object.freeze(nodes);
32156 this._childNodes[entity.id] = nodes;
32157 return this._childNodes[entity.id];
32161 "entities": Object.getPrototypeOf(this.entities),
32162 "parentWays": Object.getPrototypeOf(this._parentWays),
32163 "parentRels": Object.getPrototypeOf(this._parentRels)
32166 // Unlike other graph methods, rebase mutates in place. This is because it
32167 // is used only during the history operation that merges newly downloaded
32168 // data into each state. To external consumers, it should appear as if the
32169 // graph always contained the newly downloaded data.
32170 rebase: function(entities, stack, force) {
32171 var base = this.base();
32172 var i3, j2, k2, id2;
32173 for (i3 = 0; i3 < entities.length; i3++) {
32174 var entity = entities[i3];
32175 if (!entity.visible || !force && base.entities[entity.id]) continue;
32176 base.entities[entity.id] = entity;
32177 this._updateCalculated(void 0, entity, base.parentWays, base.parentRels);
32178 if (entity.type === "way") {
32179 for (j2 = 0; j2 < entity.nodes.length; j2++) {
32180 id2 = entity.nodes[j2];
32181 for (k2 = 1; k2 < stack.length; k2++) {
32182 var ents = stack[k2].entities;
32183 if (ents.hasOwnProperty(id2) && ents[id2] === void 0) {
32190 for (i3 = 0; i3 < stack.length; i3++) {
32191 stack[i3]._updateRebased();
32194 _updateRebased: function() {
32195 var base = this.base();
32196 Object.keys(this._parentWays).forEach(function(child) {
32197 if (base.parentWays[child]) {
32198 base.parentWays[child].forEach(function(id2) {
32199 if (!this.entities.hasOwnProperty(id2)) {
32200 this._parentWays[child].add(id2);
32205 Object.keys(this._parentRels).forEach(function(child) {
32206 if (base.parentRels[child]) {
32207 base.parentRels[child].forEach(function(id2) {
32208 if (!this.entities.hasOwnProperty(id2)) {
32209 this._parentRels[child].add(id2);
32214 this.transients = {};
32216 // Updates calculated properties (parentWays, parentRels) for the specified change
32217 _updateCalculated: function(oldentity, entity, parentWays, parentRels) {
32218 parentWays = parentWays || this._parentWays;
32219 parentRels = parentRels || this._parentRels;
32220 var type2 = entity && entity.type || oldentity && oldentity.type;
32221 var removed, added, i3;
32222 if (type2 === "way") {
32223 if (oldentity && entity) {
32224 removed = utilArrayDifference(oldentity.nodes, entity.nodes);
32225 added = utilArrayDifference(entity.nodes, oldentity.nodes);
32226 } else if (oldentity) {
32227 removed = oldentity.nodes;
32229 } else if (entity) {
32231 added = entity.nodes;
32233 for (i3 = 0; i3 < removed.length; i3++) {
32234 parentWays[removed[i3]] = new Set(parentWays[removed[i3]]);
32235 parentWays[removed[i3]].delete(oldentity.id);
32237 for (i3 = 0; i3 < added.length; i3++) {
32238 parentWays[added[i3]] = new Set(parentWays[added[i3]]);
32239 parentWays[added[i3]].add(entity.id);
32241 } else if (type2 === "relation") {
32242 var oldentityMemberIDs = oldentity ? oldentity.members.map(function(m2) {
32245 var entityMemberIDs = entity ? entity.members.map(function(m2) {
32248 if (oldentity && entity) {
32249 removed = utilArrayDifference(oldentityMemberIDs, entityMemberIDs);
32250 added = utilArrayDifference(entityMemberIDs, oldentityMemberIDs);
32251 } else if (oldentity) {
32252 removed = oldentityMemberIDs;
32254 } else if (entity) {
32256 added = entityMemberIDs;
32258 for (i3 = 0; i3 < removed.length; i3++) {
32259 parentRels[removed[i3]] = new Set(parentRels[removed[i3]]);
32260 parentRels[removed[i3]].delete(oldentity.id);
32262 for (i3 = 0; i3 < added.length; i3++) {
32263 parentRels[added[i3]] = new Set(parentRels[added[i3]]);
32264 parentRels[added[i3]].add(entity.id);
32268 replace: function(entity) {
32269 if (this.entities[entity.id] === entity) return this;
32270 return this.update(function() {
32271 this._updateCalculated(this.entities[entity.id], entity);
32272 this.entities[entity.id] = entity;
32275 remove: function(entity) {
32276 return this.update(function() {
32277 this._updateCalculated(entity, void 0);
32278 this.entities[entity.id] = void 0;
32281 revert: function(id2) {
32282 var baseEntity = this.base().entities[id2];
32283 var headEntity = this.entities[id2];
32284 if (headEntity === baseEntity) return this;
32285 return this.update(function() {
32286 this._updateCalculated(headEntity, baseEntity);
32287 delete this.entities[id2];
32290 update: function() {
32291 var graph = this.frozen ? coreGraph(this, true) : this;
32292 for (var i3 = 0; i3 < arguments.length; i3++) {
32293 arguments[i3].call(graph, graph);
32295 if (this.frozen) graph.frozen = true;
32298 // Obliterates any existing entities
32299 load: function(entities) {
32300 var base = this.base();
32301 this.entities = Object.create(base.entities);
32302 for (var i3 in entities) {
32303 this.entities[i3] = entities[i3];
32304 this._updateCalculated(base.entities[i3], this.entities[i3]);
32310 // modules/osm/intersection.js
32311 function osmTurn(turn) {
32312 if (!(this instanceof osmTurn)) {
32313 return new osmTurn(turn);
32315 Object.assign(this, turn);
32317 function osmIntersection(graph, startVertexId, maxDistance) {
32318 maxDistance = maxDistance || 30;
32319 var vgraph = coreGraph();
32321 function memberOfRestriction(entity) {
32322 return graph.parentRelations(entity).some(function(r2) {
32323 return r2.isRestriction();
32326 function isRoad(way2) {
32327 if (way2.isArea() || way2.isDegenerate()) return false;
32330 "motorway_link": true,
32332 "trunk_link": true,
32334 "primary_link": true,
32336 "secondary_link": true,
32338 "tertiary_link": true,
32339 "residential": true,
32340 "unclassified": true,
32341 "living_street": true,
32347 return roads[way2.tags.highway];
32349 var startNode = graph.entity(startVertexId);
32350 var checkVertices = [startNode];
32353 var vertexIds = [];
32363 while (checkVertices.length) {
32364 vertex = checkVertices.pop();
32365 checkWays = graph.parentWays(vertex);
32366 var hasWays = false;
32367 for (i3 = 0; i3 < checkWays.length; i3++) {
32368 way = checkWays[i3];
32369 if (!isRoad(way) && !memberOfRestriction(way)) continue;
32372 nodes = utilArrayUniq(graph.childNodes(way));
32373 for (j2 = 0; j2 < nodes.length; j2++) {
32375 if (node === vertex) continue;
32376 if (vertices.indexOf(node) !== -1) continue;
32377 if (geoSphericalDistance(node.loc, startNode.loc) > maxDistance) continue;
32378 var hasParents = false;
32379 parents = graph.parentWays(node);
32380 for (k2 = 0; k2 < parents.length; k2++) {
32381 parent = parents[k2];
32382 if (parent === way) continue;
32383 if (ways.indexOf(parent) !== -1) continue;
32384 if (!isRoad(parent)) continue;
32389 checkVertices.push(node);
32394 vertices.push(vertex);
32397 vertices = utilArrayUniq(vertices);
32398 ways = utilArrayUniq(ways);
32399 ways.forEach(function(way2) {
32400 graph.childNodes(way2).forEach(function(node2) {
32401 vgraph = vgraph.replace(node2);
32403 vgraph = vgraph.replace(way2);
32404 graph.parentRelations(way2).forEach(function(relation) {
32405 if (relation.isRestriction()) {
32406 if (relation.isValidRestriction(graph)) {
32407 vgraph = vgraph.replace(relation);
32408 } else if (relation.isComplete(graph)) {
32409 actions.push(actionDeleteRelation(relation.id));
32414 ways.forEach(function(w2) {
32415 var way2 = vgraph.entity(w2.id);
32416 if (way2.tags.oneway === "-1") {
32417 var action = actionReverse(way2.id, { reverseOneway: true });
32418 actions.push(action);
32419 vgraph = action(vgraph);
32422 var origCount = osmEntity.id.next.way;
32423 vertices.forEach(function(v2) {
32424 var splitAll = actionSplit([v2.id]).keepHistoryOn("first");
32425 if (!splitAll.disabled(vgraph)) {
32426 splitAll.ways(vgraph).forEach(function(way2) {
32427 var splitOne = actionSplit([v2.id]).limitWays([way2.id]).keepHistoryOn("first");
32428 actions.push(splitOne);
32429 vgraph = splitOne(vgraph);
32433 osmEntity.id.next.way = origCount;
32434 vertexIds = vertices.map(function(v2) {
32439 vertexIds.forEach(function(id2) {
32440 var vertex2 = vgraph.entity(id2);
32441 var parents2 = vgraph.parentWays(vertex2);
32442 vertices.push(vertex2);
32443 ways = ways.concat(parents2);
32445 vertices = utilArrayUniq(vertices);
32446 ways = utilArrayUniq(ways);
32447 vertexIds = vertices.map(function(v2) {
32450 wayIds = ways.map(function(w2) {
32453 function withMetadata(way2, vertexIds2) {
32454 var __oneWay = way2.isOneWay();
32455 var __first = vertexIds2.indexOf(way2.first()) !== -1;
32456 var __last = vertexIds2.indexOf(way2.last()) !== -1;
32457 var __via = __first && __last;
32458 var __from = __first && !__oneWay || __last;
32459 var __to = __first || __last && !__oneWay;
32460 return way2.update({
32470 wayIds.forEach(function(id2) {
32471 var way2 = withMetadata(vgraph.entity(id2), vertexIds);
32472 vgraph = vgraph.replace(way2);
32476 var removeWayIds = [];
32477 var removeVertexIds = [];
32480 checkVertices = vertexIds.slice();
32481 for (i3 = 0; i3 < checkVertices.length; i3++) {
32482 var vertexId = checkVertices[i3];
32483 vertex = vgraph.hasEntity(vertexId);
32485 if (vertexIds.indexOf(vertexId) !== -1) {
32486 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32488 removeVertexIds.push(vertexId);
32491 parents = vgraph.parentWays(vertex);
32492 if (parents.length < 3) {
32493 if (vertexIds.indexOf(vertexId) !== -1) {
32494 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32497 if (parents.length === 2) {
32498 var a2 = parents[0];
32499 var b2 = parents[1];
32500 var aIsLeaf = a2 && !a2.__via;
32501 var bIsLeaf = b2 && !b2.__via;
32502 var leaf, survivor;
32503 if (aIsLeaf && !bIsLeaf) {
32506 } else if (!aIsLeaf && bIsLeaf) {
32510 if (leaf && survivor) {
32511 survivor = withMetadata(survivor, vertexIds);
32512 vgraph = vgraph.replace(survivor).remove(leaf);
32513 removeWayIds.push(leaf.id);
32517 parents = vgraph.parentWays(vertex);
32518 if (parents.length < 2) {
32519 if (vertexIds.indexOf(vertexId) !== -1) {
32520 vertexIds.splice(vertexIds.indexOf(vertexId), 1);
32522 removeVertexIds.push(vertexId);
32525 if (parents.length < 1) {
32526 vgraph = vgraph.remove(vertex);
32529 } while (keepGoing);
32530 vertices = vertices.filter(function(vertex2) {
32531 return removeVertexIds.indexOf(vertex2.id) === -1;
32532 }).map(function(vertex2) {
32533 return vgraph.entity(vertex2.id);
32535 ways = ways.filter(function(way2) {
32536 return removeWayIds.indexOf(way2.id) === -1;
32537 }).map(function(way2) {
32538 return vgraph.entity(way2.id);
32540 var intersection2 = {
32546 intersection2.turns = function(fromWayId, maxViaWay) {
32547 if (!fromWayId) return [];
32548 if (!maxViaWay) maxViaWay = 0;
32549 var vgraph2 = intersection2.graph;
32550 var keyVertexIds = intersection2.vertices.map(function(v2) {
32553 var start2 = vgraph2.entity(fromWayId);
32554 if (!start2 || !(start2.__from || start2.__via)) return [];
32555 var maxPathLength = maxViaWay * 2 + 3;
32559 function step(entity, currPath, currRestrictions, matchedRestriction) {
32560 currPath = (currPath || []).slice();
32561 if (currPath.length >= maxPathLength) return;
32562 currPath.push(entity.id);
32563 currRestrictions = (currRestrictions || []).slice();
32564 if (entity.type === "node") {
32565 stepNode(entity, currPath, currRestrictions);
32567 stepWay(entity, currPath, currRestrictions, matchedRestriction);
32570 function stepNode(entity, currPath, currRestrictions) {
32572 var parents2 = vgraph2.parentWays(entity);
32574 for (i4 = 0; i4 < parents2.length; i4++) {
32575 var way2 = parents2[i4];
32576 if (way2.__oneWay && way2.nodes[0] !== entity.id) continue;
32577 if (currPath.indexOf(way2.id) !== -1 && currPath.length >= 3) continue;
32578 var restrict = null;
32579 for (j3 = 0; j3 < currRestrictions.length; j3++) {
32580 var restriction = currRestrictions[j3];
32581 var f2 = restriction.memberByRole("from");
32582 var v2 = restriction.membersByRole("via");
32583 var t2 = restriction.memberByRole("to");
32584 var isNo = /^no_/.test(restriction.tags.restriction);
32585 var isOnly = /^only_/.test(restriction.tags.restriction);
32586 if (!(isNo || isOnly)) {
32589 var matchesFrom = f2.id === fromWayId;
32590 var matchesViaTo = false;
32591 var isAlongOnlyPath = false;
32592 if (t2.id === way2.id) {
32593 if (v2.length === 1 && v2[0].type === "node") {
32594 matchesViaTo = v2[0].id === entity.id && (matchesFrom && currPath.length === 2 || !matchesFrom && currPath.length > 2);
32597 for (k2 = 2; k2 < currPath.length; k2 += 2) {
32598 pathVias.push(currPath[k2]);
32600 var restrictionVias = [];
32601 for (k2 = 0; k2 < v2.length; k2++) {
32602 if (v2[k2].type === "way") {
32603 restrictionVias.push(v2[k2].id);
32606 var diff = utilArrayDifference(pathVias, restrictionVias);
32607 matchesViaTo = !diff.length;
32609 } else if (isOnly) {
32610 for (k2 = 0; k2 < v2.length; k2++) {
32611 if (v2[k2].type === "way" && v2[k2].id === way2.id) {
32612 isAlongOnlyPath = true;
32617 if (matchesViaTo) {
32619 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, only: true, end: true };
32621 restrict = { id: restriction.id, direct: matchesFrom, from: f2.id, no: true, end: true };
32624 if (isAlongOnlyPath) {
32625 restrict = { id: restriction.id, direct: false, from: f2.id, only: true, end: false };
32626 } else if (isOnly) {
32627 restrict = { id: restriction.id, direct: false, from: f2.id, no: true, end: true };
32630 if (restrict && restrict.direct) break;
32632 nextWays.push({ way: way2, restrict });
32634 nextWays.forEach(function(nextWay) {
32635 step(nextWay.way, currPath, currRestrictions, nextWay.restrict);
32638 function stepWay(entity, currPath, currRestrictions, matchedRestriction) {
32640 if (currPath.length >= 3) {
32641 var turnPath = currPath.slice();
32642 if (matchedRestriction && matchedRestriction.direct === false) {
32643 for (i4 = 0; i4 < turnPath.length; i4++) {
32644 if (turnPath[i4] === matchedRestriction.from) {
32645 turnPath = turnPath.slice(i4);
32650 var turn = pathToTurn(turnPath);
32652 if (matchedRestriction) {
32653 turn.restrictionID = matchedRestriction.id;
32654 turn.no = matchedRestriction.no;
32655 turn.only = matchedRestriction.only;
32656 turn.direct = matchedRestriction.direct;
32658 turns.push(osmTurn(turn));
32660 if (currPath[0] === currPath[2]) return;
32662 if (matchedRestriction && matchedRestriction.end) return;
32663 var n1 = vgraph2.entity(entity.first());
32664 var n22 = vgraph2.entity(entity.last());
32665 var dist = geoSphericalDistance(n1.loc, n22.loc);
32666 var nextNodes = [];
32667 if (currPath.length > 1) {
32668 if (dist > maxDistance) return;
32669 if (!entity.__via) return;
32671 if (!entity.__oneWay && // bidirectional..
32672 keyVertexIds.indexOf(n1.id) !== -1 && // key vertex..
32673 currPath.indexOf(n1.id) === -1) {
32674 nextNodes.push(n1);
32676 if (keyVertexIds.indexOf(n22.id) !== -1 && // key vertex..
32677 currPath.indexOf(n22.id) === -1) {
32678 nextNodes.push(n22);
32680 nextNodes.forEach(function(nextNode) {
32681 var fromRestrictions = vgraph2.parentRelations(entity).filter(function(r2) {
32682 if (!r2.isRestriction()) return false;
32683 var f2 = r2.memberByRole("from");
32684 if (!f2 || f2.id !== entity.id) return false;
32685 var isOnly = /^only_/.test(r2.tags.restriction);
32686 if (!isOnly) return true;
32687 var isOnlyVia = false;
32688 var v2 = r2.membersByRole("via");
32689 if (v2.length === 1 && v2[0].type === "node") {
32690 isOnlyVia = v2[0].id === nextNode.id;
32692 for (var i5 = 0; i5 < v2.length; i5++) {
32693 if (v2[i5].type !== "way") continue;
32694 var viaWay = vgraph2.entity(v2[i5].id);
32695 if (viaWay.first() === nextNode.id || viaWay.last() === nextNode.id) {
32703 step(nextNode, currPath, currRestrictions.concat(fromRestrictions), false);
32706 function pathToTurn(path) {
32707 if (path.length < 3) return;
32708 var fromWayId2, fromNodeId, fromVertexId;
32709 var toWayId, toNodeId, toVertexId;
32710 var viaWayIds, viaNodeId, isUturn;
32711 fromWayId2 = path[0];
32712 toWayId = path[path.length - 1];
32713 if (path.length === 3 && fromWayId2 === toWayId) {
32714 var way2 = vgraph2.entity(fromWayId2);
32715 if (way2.__oneWay) return null;
32717 viaNodeId = fromVertexId = toVertexId = path[1];
32718 fromNodeId = toNodeId = adjacentNode(fromWayId2, viaNodeId);
32721 fromVertexId = path[1];
32722 fromNodeId = adjacentNode(fromWayId2, fromVertexId);
32723 toVertexId = path[path.length - 2];
32724 toNodeId = adjacentNode(toWayId, toVertexId);
32725 if (path.length === 3) {
32726 viaNodeId = path[1];
32728 viaWayIds = path.filter(function(entityId) {
32729 return entityId[0] === "w";
32731 viaWayIds = viaWayIds.slice(1, viaWayIds.length - 1);
32735 key: path.join("_"),
32737 from: { node: fromNodeId, way: fromWayId2, vertex: fromVertexId },
32738 via: { node: viaNodeId, ways: viaWayIds },
32739 to: { node: toNodeId, way: toWayId, vertex: toVertexId },
32742 function adjacentNode(wayId, affixId) {
32743 var nodes2 = vgraph2.entity(wayId).nodes;
32744 return affixId === nodes2[0] ? nodes2[1] : nodes2[nodes2.length - 2];
32748 return intersection2;
32750 function osmInferRestriction(graph, turn, projection2) {
32751 var fromWay = graph.entity(turn.from.way);
32752 var fromNode = graph.entity(turn.from.node);
32753 var fromVertex = graph.entity(turn.from.vertex);
32754 var toWay = graph.entity(turn.to.way);
32755 var toNode = graph.entity(turn.to.node);
32756 var toVertex = graph.entity(turn.to.vertex);
32757 var fromOneWay = fromWay.tags.oneway === "yes";
32758 var toOneWay = toWay.tags.oneway === "yes";
32759 var angle2 = (geoAngle(fromVertex, fromNode, projection2) - geoAngle(toVertex, toNode, projection2)) * 180 / Math.PI;
32760 while (angle2 < 0) {
32763 if (fromNode === toNode) {
32764 return "no_u_turn";
32766 if ((angle2 < 23 || angle2 > 336) && fromOneWay && toOneWay) {
32767 return "no_u_turn";
32769 if ((angle2 < 40 || angle2 > 319) && fromOneWay && toOneWay && turn.from.vertex !== turn.to.vertex) {
32770 return "no_u_turn";
32772 if (angle2 < 158) {
32773 return "no_right_turn";
32775 if (angle2 > 202) {
32776 return "no_left_turn";
32778 return "no_straight_on";
32781 // modules/actions/merge_polygon.js
32782 function actionMergePolygon(ids, newRelationId) {
32783 function groupEntities(graph) {
32784 var entities = ids.map(function(id2) {
32785 return graph.entity(id2);
32787 var geometryGroups = utilArrayGroupBy(entities, function(entity) {
32788 if (entity.type === "way" && entity.isClosed()) {
32789 return "closedWay";
32790 } else if (entity.type === "relation" && entity.isMultipolygon()) {
32791 return "multipolygon";
32796 return Object.assign(
32797 { closedWay: [], multipolygon: [], other: [] },
32801 var action = function(graph) {
32802 var entities = groupEntities(graph);
32803 var polygons = entities.multipolygon.reduce(function(polygons2, m2) {
32804 return polygons2.concat(osmJoinWays(m2.members, graph));
32805 }, []).concat(entities.closedWay.map(function(d2) {
32806 var member = [{ id: d2.id }];
32807 member.nodes = graph.childNodes(d2);
32810 var contained = polygons.map(function(w2, i3) {
32811 return polygons.map(function(d2, n3) {
32812 if (i3 === n3) return null;
32813 return geoPolygonContainsPolygon(
32814 d2.nodes.map(function(n4) {
32817 w2.nodes.map(function(n4) {
32825 while (polygons.length) {
32826 extractUncontained(polygons);
32827 polygons = polygons.filter(isContained);
32828 contained = contained.filter(isContained).map(filterContained);
32830 function isContained(d2, i3) {
32831 return contained[i3].some(function(val) {
32835 function filterContained(d2) {
32836 return d2.filter(isContained);
32838 function extractUncontained(polygons2) {
32839 polygons2.forEach(function(d2, i3) {
32840 if (!isContained(d2, i3)) {
32841 d2.forEach(function(member) {
32845 role: outer ? "outer" : "inner"
32853 if (entities.multipolygon.length > 0) {
32854 var oldestID = utilOldestID(entities.multipolygon.map((entity) => entity.id));
32855 relation = entities.multipolygon.find((entity) => entity.id === oldestID);
32857 relation = osmRelation({ id: newRelationId, tags: { type: "multipolygon" } });
32859 entities.multipolygon.forEach(function(m2) {
32860 if (m2.id !== relation.id) {
32861 relation = relation.mergeTags(m2.tags);
32862 graph = graph.remove(m2);
32865 entities.closedWay.forEach(function(way) {
32866 function isThisOuter(m2) {
32867 return m2.id === way.id && m2.role !== "inner";
32869 if (members.some(isThisOuter)) {
32870 relation = relation.mergeTags(way.tags);
32871 graph = graph.replace(way.update({ tags: {} }));
32874 return graph.replace(relation.update({
32876 tags: utilObjectOmit(relation.tags, ["area"])
32879 action.disabled = function(graph) {
32880 var entities = groupEntities(graph);
32881 if (entities.other.length > 0 || entities.closedWay.length + entities.multipolygon.length < 2) {
32882 return "not_eligible";
32884 if (!entities.multipolygon.every(function(r2) {
32885 return r2.isComplete(graph);
32887 return "incomplete_relation";
32889 if (!entities.multipolygon.length) {
32890 var sharedMultipolygons = [];
32891 entities.closedWay.forEach(function(way, i3) {
32893 sharedMultipolygons = graph.parentMultipolygons(way);
32895 sharedMultipolygons = utilArrayIntersection(sharedMultipolygons, graph.parentMultipolygons(way));
32898 sharedMultipolygons = sharedMultipolygons.filter(function(relation) {
32899 return relation.members.length === entities.closedWay.length;
32901 if (sharedMultipolygons.length) {
32902 return "not_eligible";
32904 } else if (entities.closedWay.some(function(way) {
32905 return utilArrayIntersection(graph.parentMultipolygons(way), entities.multipolygon).length;
32907 return "not_eligible";
32913 // modules/actions/merge_remote_changes.js
32914 var import_fast_deep_equal = __toESM(require_fast_deep_equal());
32916 // node_modules/node-diff3/index.mjs
32917 function LCS(buffer1, buffer2) {
32918 let equivalenceClasses = {};
32919 for (let j2 = 0; j2 < buffer2.length; j2++) {
32920 const item = buffer2[j2];
32921 if (equivalenceClasses[item]) {
32922 equivalenceClasses[item].push(j2);
32924 equivalenceClasses[item] = [j2];
32927 const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
32928 let candidates = [NULLRESULT];
32929 for (let i3 = 0; i3 < buffer1.length; i3++) {
32930 const item = buffer1[i3];
32931 const buffer2indices = equivalenceClasses[item] || [];
32933 let c2 = candidates[0];
32934 for (let jx = 0; jx < buffer2indices.length; jx++) {
32935 const j2 = buffer2indices[jx];
32937 for (s2 = r2; s2 < candidates.length; s2++) {
32938 if (candidates[s2].buffer2index < j2 && (s2 === candidates.length - 1 || candidates[s2 + 1].buffer2index > j2)) {
32942 if (s2 < candidates.length) {
32943 const newCandidate = { buffer1index: i3, buffer2index: j2, chain: candidates[s2] };
32944 if (r2 === candidates.length) {
32945 candidates.push(c2);
32947 candidates[r2] = c2;
32951 if (r2 === candidates.length) {
32956 candidates[r2] = c2;
32958 return candidates[candidates.length - 1];
32960 function diffIndices(buffer1, buffer2) {
32961 const lcs = LCS(buffer1, buffer2);
32963 let tail1 = buffer1.length;
32964 let tail2 = buffer2.length;
32965 for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
32966 const mismatchLength1 = tail1 - candidate.buffer1index - 1;
32967 const mismatchLength2 = tail2 - candidate.buffer2index - 1;
32968 tail1 = candidate.buffer1index;
32969 tail2 = candidate.buffer2index;
32970 if (mismatchLength1 || mismatchLength2) {
32972 buffer1: [tail1 + 1, mismatchLength1],
32973 buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
32974 buffer2: [tail2 + 1, mismatchLength2],
32975 buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
32982 function diff3MergeRegions(a2, o2, b2) {
32984 function addHunk(h2, ab) {
32987 oStart: h2.buffer1[0],
32988 oLength: h2.buffer1[1],
32989 // length of o to remove
32990 abStart: h2.buffer2[0],
32991 abLength: h2.buffer2[1]
32992 // length of a/b to insert
32993 // abContent: (ab === 'a' ? a : b).slice(h.buffer2[0], h.buffer2[0] + h.buffer2[1])
32996 diffIndices(o2, a2).forEach((item) => addHunk(item, "a"));
32997 diffIndices(o2, b2).forEach((item) => addHunk(item, "b"));
32998 hunks.sort((x2, y2) => x2.oStart - y2.oStart);
33000 let currOffset = 0;
33001 function advanceTo(endOffset) {
33002 if (endOffset > currOffset) {
33006 bufferStart: currOffset,
33007 bufferLength: endOffset - currOffset,
33008 bufferContent: o2.slice(currOffset, endOffset)
33010 currOffset = endOffset;
33013 while (hunks.length) {
33014 let hunk = hunks.shift();
33015 let regionStart = hunk.oStart;
33016 let regionEnd = hunk.oStart + hunk.oLength;
33017 let regionHunks = [hunk];
33018 advanceTo(regionStart);
33019 while (hunks.length) {
33020 const nextHunk = hunks[0];
33021 const nextHunkStart = nextHunk.oStart;
33022 if (nextHunkStart > regionEnd) break;
33023 regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
33024 regionHunks.push(hunks.shift());
33026 if (regionHunks.length === 1) {
33027 if (hunk.abLength > 0) {
33028 const buffer = hunk.ab === "a" ? a2 : b2;
33032 bufferStart: hunk.abStart,
33033 bufferLength: hunk.abLength,
33034 bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
33039 a: [a2.length, -1, o2.length, -1],
33040 b: [b2.length, -1, o2.length, -1]
33042 while (regionHunks.length) {
33043 hunk = regionHunks.shift();
33044 const oStart = hunk.oStart;
33045 const oEnd = oStart + hunk.oLength;
33046 const abStart = hunk.abStart;
33047 const abEnd = abStart + hunk.abLength;
33048 let b3 = bounds[hunk.ab];
33049 b3[0] = Math.min(abStart, b3[0]);
33050 b3[1] = Math.max(abEnd, b3[1]);
33051 b3[2] = Math.min(oStart, b3[2]);
33052 b3[3] = Math.max(oEnd, b3[3]);
33054 const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
33055 const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
33056 const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
33057 const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
33061 aLength: aEnd - aStart,
33062 aContent: a2.slice(aStart, aEnd),
33063 oStart: regionStart,
33064 oLength: regionEnd - regionStart,
33065 oContent: o2.slice(regionStart, regionEnd),
33067 bLength: bEnd - bStart,
33068 bContent: b2.slice(bStart, bEnd)
33070 results.push(result);
33072 currOffset = regionEnd;
33074 advanceTo(o2.length);
33077 function diff3Merge(a2, o2, b2, options2) {
33079 excludeFalseConflicts: true,
33080 stringSeparator: /\s+/
33082 options2 = Object.assign(defaults, options2);
33083 if (typeof a2 === "string") a2 = a2.split(options2.stringSeparator);
33084 if (typeof o2 === "string") o2 = o2.split(options2.stringSeparator);
33085 if (typeof b2 === "string") b2 = b2.split(options2.stringSeparator);
33087 const regions = diff3MergeRegions(a2, o2, b2);
33089 function flushOk() {
33090 if (okBuffer.length) {
33091 results.push({ ok: okBuffer });
33095 function isFalseConflict(a3, b3) {
33096 if (a3.length !== b3.length) return false;
33097 for (let i3 = 0; i3 < a3.length; i3++) {
33098 if (a3[i3] !== b3[i3]) return false;
33102 regions.forEach((region) => {
33103 if (region.stable) {
33104 okBuffer.push(...region.bufferContent);
33106 if (options2.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
33107 okBuffer.push(...region.aContent);
33112 a: region.aContent,
33113 aIndex: region.aStart,
33114 o: region.oContent,
33115 oIndex: region.oStart,
33116 b: region.bContent,
33117 bIndex: region.bStart
33127 // modules/actions/merge_remote_changes.js
33128 var import_lodash2 = __toESM(require_lodash());
33129 function actionMergeRemoteChanges(id2, localGraph, remoteGraph, discardTags, formatUser) {
33130 discardTags = discardTags || {};
33131 var _option = "safe";
33132 var _conflicts = [];
33133 function user(d2) {
33134 return typeof formatUser === "function" ? formatUser(d2) : (0, import_lodash2.escape)(d2);
33136 function mergeLocation(remote, target) {
33137 function pointEqual(a2, b2) {
33138 var epsilon3 = 1e-6;
33139 return Math.abs(a2[0] - b2[0]) < epsilon3 && Math.abs(a2[1] - b2[1]) < epsilon3;
33141 if (_option === "force_local" || pointEqual(target.loc, remote.loc)) {
33144 if (_option === "force_remote") {
33145 return target.update({ loc: remote.loc });
33147 _conflicts.push(_t.html("merge_remote_changes.conflict.location", { user: { html: user(remote.user) } }));
33150 function mergeNodes(base, remote, target) {
33151 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.nodes, remote.nodes)) {
33154 if (_option === "force_remote") {
33155 return target.update({ nodes: remote.nodes });
33157 var ccount = _conflicts.length;
33158 var o2 = base.nodes || [];
33159 var a2 = target.nodes || [];
33160 var b2 = remote.nodes || [];
33162 var hunks = diff3Merge(a2, o2, b2, { excludeFalseConflicts: true });
33163 for (var i3 = 0; i3 < hunks.length; i3++) {
33164 var hunk = hunks[i3];
33166 nodes.push.apply(nodes, hunk.ok);
33168 var c2 = hunk.conflict;
33169 if ((0, import_fast_deep_equal.default)(c2.o, c2.a)) {
33170 nodes.push.apply(nodes, c2.b);
33171 } else if ((0, import_fast_deep_equal.default)(c2.o, c2.b)) {
33172 nodes.push.apply(nodes, c2.a);
33174 _conflicts.push(_t.html("merge_remote_changes.conflict.nodelist", { user: { html: user(remote.user) } }));
33179 return _conflicts.length === ccount ? target.update({ nodes }) : target;
33181 function mergeChildren(targetWay, children2, updates, graph) {
33182 function isUsed(node2, targetWay2) {
33183 var hasInterestingParent = graph.parentWays(node2).some(function(way) {
33184 return way.id !== targetWay2.id;
33186 return node2.hasInterestingTags() || hasInterestingParent || graph.parentRelations(node2).length > 0;
33188 var ccount = _conflicts.length;
33189 for (var i3 = 0; i3 < children2.length; i3++) {
33190 var id3 = children2[i3];
33191 var node = graph.hasEntity(id3);
33192 if (targetWay.nodes.indexOf(id3) === -1) {
33193 if (node && !isUsed(node, targetWay)) {
33194 updates.removeIds.push(id3);
33198 var local = localGraph.hasEntity(id3);
33199 var remote = remoteGraph.hasEntity(id3);
33201 if (_option === "force_remote" && remote && remote.visible) {
33202 updates.replacements.push(remote);
33203 } else if (_option === "force_local" && local) {
33204 target = osmEntity(local);
33206 target = target.update({ version: remote.version });
33208 updates.replacements.push(target);
33209 } else if (_option === "safe" && local && remote && local.version !== remote.version) {
33210 target = osmEntity(local, { version: remote.version });
33211 if (remote.visible) {
33212 target = mergeLocation(remote, target);
33214 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
33216 if (_conflicts.length !== ccount) break;
33217 updates.replacements.push(target);
33222 function updateChildren(updates, graph) {
33223 for (var i3 = 0; i3 < updates.replacements.length; i3++) {
33224 graph = graph.replace(updates.replacements[i3]);
33226 if (updates.removeIds.length) {
33227 graph = actionDeleteMultiple(updates.removeIds)(graph);
33231 function mergeMembers(remote, target) {
33232 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.members, remote.members)) {
33235 if (_option === "force_remote") {
33236 return target.update({ members: remote.members });
33238 _conflicts.push(_t.html("merge_remote_changes.conflict.memberlist", { user: { html: user(remote.user) } }));
33241 function mergeTags(base, remote, target) {
33242 if (_option === "force_local" || (0, import_fast_deep_equal.default)(target.tags, remote.tags)) {
33245 if (_option === "force_remote") {
33246 return target.update({ tags: remote.tags });
33248 var ccount = _conflicts.length;
33249 var o2 = base.tags || {};
33250 var a2 = target.tags || {};
33251 var b2 = remote.tags || {};
33252 var keys2 = utilArrayUnion(utilArrayUnion(Object.keys(o2), Object.keys(a2)), Object.keys(b2)).filter(function(k3) {
33253 return !discardTags[k3];
33255 var tags = Object.assign({}, a2);
33256 var changed = false;
33257 for (var i3 = 0; i3 < keys2.length; i3++) {
33258 var k2 = keys2[i3];
33259 if (o2[k2] !== b2[k2] && a2[k2] !== b2[k2]) {
33260 if (o2[k2] !== a2[k2]) {
33261 _conflicts.push(_t.html(
33262 "merge_remote_changes.conflict.tags",
33263 { tag: k2, local: a2[k2], remote: b2[k2], user: { html: user(remote.user) } }
33266 if (b2.hasOwnProperty(k2)) {
33275 return changed && _conflicts.length === ccount ? target.update({ tags }) : target;
33277 var action = function(graph) {
33278 var updates = { replacements: [], removeIds: [] };
33279 var base = graph.base().entities[id2];
33280 var local = localGraph.entity(id2);
33281 var remote = remoteGraph.entity(id2);
33282 var target = osmEntity(local, { version: remote.version });
33283 if (!remote.visible) {
33284 if (_option === "force_remote") {
33285 return actionDeleteMultiple([id2])(graph);
33286 } else if (_option === "force_local") {
33287 if (target.type === "way") {
33288 target = mergeChildren(target, utilArrayUniq(local.nodes), updates, graph);
33289 graph = updateChildren(updates, graph);
33291 return graph.replace(target);
33293 _conflicts.push(_t.html("merge_remote_changes.conflict.deleted", { user: { html: user(remote.user) } }));
33297 if (target.type === "node") {
33298 target = mergeLocation(remote, target);
33299 } else if (target.type === "way") {
33300 graph.rebase(remoteGraph.childNodes(remote), [graph], false);
33301 target = mergeNodes(base, remote, target);
33302 target = mergeChildren(target, utilArrayUnion(local.nodes, remote.nodes), updates, graph);
33303 } else if (target.type === "relation") {
33304 target = mergeMembers(remote, target);
33306 target = mergeTags(base, remote, target);
33307 if (!_conflicts.length) {
33308 graph = updateChildren(updates, graph).replace(target);
33312 action.withOption = function(opt) {
33316 action.conflicts = function() {
33322 // modules/actions/move.js
33323 function actionMove(moveIDs, tryDelta, projection2, cache) {
33324 var _delta = tryDelta;
33325 function setupCache(graph) {
33326 function canMove(nodeID) {
33327 if (moveIDs.indexOf(nodeID) !== -1) return true;
33328 var parents = graph.parentWays(graph.entity(nodeID));
33329 if (parents.length < 3) return true;
33330 var parentsMoving = parents.every(function(way) {
33331 return cache.moving[way.id];
33333 if (!parentsMoving) delete cache.moving[nodeID];
33334 return parentsMoving;
33336 function cacheEntities(ids) {
33337 for (var i3 = 0; i3 < ids.length; i3++) {
33339 if (cache.moving[id2]) continue;
33340 cache.moving[id2] = true;
33341 var entity = graph.hasEntity(id2);
33342 if (!entity) continue;
33343 if (entity.type === "node") {
33344 cache.nodes.push(id2);
33345 cache.startLoc[id2] = entity.loc;
33346 } else if (entity.type === "way") {
33347 cache.ways.push(id2);
33348 cacheEntities(entity.nodes);
33350 cacheEntities(entity.members.map(function(member) {
33356 function cacheIntersections(ids) {
33357 function isEndpoint(way2, id3) {
33358 return !way2.isClosed() && !!way2.affix(id3);
33360 for (var i3 = 0; i3 < ids.length; i3++) {
33362 var childNodes = graph.childNodes(graph.entity(id2));
33363 for (var j2 = 0; j2 < childNodes.length; j2++) {
33364 var node = childNodes[j2];
33365 var parents = graph.parentWays(node);
33366 if (parents.length !== 2) continue;
33367 var moved = graph.entity(id2);
33368 var unmoved = null;
33369 for (var k2 = 0; k2 < parents.length; k2++) {
33370 var way = parents[k2];
33371 if (!cache.moving[way.id]) {
33376 if (!unmoved) continue;
33377 if (utilArrayIntersection(moved.nodes, unmoved.nodes).length > 2) continue;
33378 if (moved.isArea() || unmoved.isArea()) continue;
33379 cache.intersections.push({
33382 unmovedId: unmoved.id,
33383 movedIsEP: isEndpoint(moved, node.id),
33384 unmovedIsEP: isEndpoint(unmoved, node.id)
33394 cache.intersections = [];
33395 cache.replacedVertex = {};
33396 cache.startLoc = {};
33399 cacheEntities(moveIDs);
33400 cacheIntersections(cache.ways);
33401 cache.nodes = cache.nodes.filter(canMove);
33405 function replaceMovedVertex(nodeId, wayId, graph, delta) {
33406 var way = graph.entity(wayId);
33407 var moved = graph.entity(nodeId);
33408 var movedIndex = way.nodes.indexOf(nodeId);
33409 var len, prevIndex, nextIndex;
33410 if (way.isClosed()) {
33411 len = way.nodes.length - 1;
33412 prevIndex = (movedIndex + len - 1) % len;
33413 nextIndex = (movedIndex + len + 1) % len;
33415 len = way.nodes.length;
33416 prevIndex = movedIndex - 1;
33417 nextIndex = movedIndex + 1;
33419 var prev = graph.hasEntity(way.nodes[prevIndex]);
33420 var next = graph.hasEntity(way.nodes[nextIndex]);
33421 if (!prev || !next) return graph;
33422 var key = wayId + "_" + nodeId;
33423 var orig = cache.replacedVertex[key];
33426 cache.replacedVertex[key] = orig;
33427 cache.startLoc[orig.id] = cache.startLoc[nodeId];
33431 start2 = projection2(cache.startLoc[nodeId]);
33432 end = projection2.invert(geoVecAdd(start2, delta));
33434 end = cache.startLoc[nodeId];
33436 orig = orig.move(end);
33437 var angle2 = Math.abs(geoAngle(orig, prev, projection2) - geoAngle(orig, next, projection2)) * 180 / Math.PI;
33438 if (angle2 > 175 && angle2 < 185) return graph;
33439 var p1 = [prev.loc, orig.loc, moved.loc, next.loc].map(projection2);
33440 var p2 = [prev.loc, moved.loc, orig.loc, next.loc].map(projection2);
33441 var d1 = geoPathLength(p1);
33442 var d2 = geoPathLength(p2);
33443 var insertAt = d1 <= d2 ? movedIndex : nextIndex;
33444 if (way.isClosed() && insertAt === 0) insertAt = len;
33445 way = way.addNode(orig.id, insertAt);
33446 return graph.replace(orig).replace(way);
33448 function removeDuplicateVertices(wayId, graph) {
33449 var way = graph.entity(wayId);
33450 var epsilon3 = 1e-6;
33452 function isInteresting(node, graph2) {
33453 return graph2.parentWays(node).length > 1 || graph2.parentRelations(node).length || node.hasInterestingTags();
33455 for (var i3 = 0; i3 < way.nodes.length; i3++) {
33456 curr = graph.entity(way.nodes[i3]);
33457 if (prev && curr && geoVecEqual(prev.loc, curr.loc, epsilon3)) {
33458 if (!isInteresting(prev, graph)) {
33459 way = way.removeNode(prev.id);
33460 graph = graph.replace(way).remove(prev);
33461 } else if (!isInteresting(curr, graph)) {
33462 way = way.removeNode(curr.id);
33463 graph = graph.replace(way).remove(curr);
33470 function unZorroIntersection(intersection2, graph) {
33471 var vertex = graph.entity(intersection2.nodeId);
33472 var way1 = graph.entity(intersection2.movedId);
33473 var way2 = graph.entity(intersection2.unmovedId);
33474 var isEP1 = intersection2.movedIsEP;
33475 var isEP2 = intersection2.unmovedIsEP;
33476 if (isEP1 && isEP2) return graph;
33477 var nodes1 = graph.childNodes(way1).filter(function(n3) {
33478 return n3 !== vertex;
33480 var nodes2 = graph.childNodes(way2).filter(function(n3) {
33481 return n3 !== vertex;
33483 if (way1.isClosed() && way1.first() === vertex.id) nodes1.push(nodes1[0]);
33484 if (way2.isClosed() && way2.first() === vertex.id) nodes2.push(nodes2[0]);
33485 var edge1 = !isEP1 && geoChooseEdge(nodes1, projection2(vertex.loc), projection2);
33486 var edge2 = !isEP2 && geoChooseEdge(nodes2, projection2(vertex.loc), projection2);
33488 if (!isEP1 && !isEP2) {
33489 var epsilon3 = 1e-6, maxIter = 10;
33490 for (var i3 = 0; i3 < maxIter; i3++) {
33491 loc = geoVecInterp(edge1.loc, edge2.loc, 0.5);
33492 edge1 = geoChooseEdge(nodes1, projection2(loc), projection2);
33493 edge2 = geoChooseEdge(nodes2, projection2(loc), projection2);
33494 if (Math.abs(edge1.distance - edge2.distance) < epsilon3) break;
33496 } else if (!isEP1) {
33501 graph = graph.replace(vertex.move(loc));
33502 if (!isEP1 && edge1.index !== way1.nodes.indexOf(vertex.id)) {
33503 way1 = way1.removeNode(vertex.id).addNode(vertex.id, edge1.index);
33504 graph = graph.replace(way1);
33506 if (!isEP2 && edge2.index !== way2.nodes.indexOf(vertex.id)) {
33507 way2 = way2.removeNode(vertex.id).addNode(vertex.id, edge2.index);
33508 graph = graph.replace(way2);
33512 function cleanupIntersections(graph) {
33513 for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33514 var obj = cache.intersections[i3];
33515 graph = replaceMovedVertex(obj.nodeId, obj.movedId, graph, _delta);
33516 graph = replaceMovedVertex(obj.nodeId, obj.unmovedId, graph, null);
33517 graph = unZorroIntersection(obj, graph);
33518 graph = removeDuplicateVertices(obj.movedId, graph);
33519 graph = removeDuplicateVertices(obj.unmovedId, graph);
33523 function limitDelta(graph) {
33524 function moveNode(loc) {
33525 return geoVecAdd(projection2(loc), _delta);
33527 for (var i3 = 0; i3 < cache.intersections.length; i3++) {
33528 var obj = cache.intersections[i3];
33529 if (obj.movedIsEP && obj.unmovedIsEP) continue;
33530 if (!obj.movedIsEP) continue;
33531 var node = graph.entity(obj.nodeId);
33532 var start2 = projection2(node.loc);
33533 var end = geoVecAdd(start2, _delta);
33534 var movedNodes = graph.childNodes(graph.entity(obj.movedId));
33535 var movedPath = movedNodes.map(function(n3) {
33536 return moveNode(n3.loc);
33538 var unmovedNodes = graph.childNodes(graph.entity(obj.unmovedId));
33539 var unmovedPath = unmovedNodes.map(function(n3) {
33540 return projection2(n3.loc);
33542 var hits = geoPathIntersections(movedPath, unmovedPath);
33543 for (var j2 = 0; i3 < hits.length; i3++) {
33544 if (geoVecEqual(hits[j2], end)) continue;
33545 var edge = geoChooseEdge(unmovedNodes, end, projection2);
33546 _delta = geoVecSubtract(projection2(edge.loc), start2);
33550 var action = function(graph) {
33551 if (_delta[0] === 0 && _delta[1] === 0) return graph;
33553 if (cache.intersections.length) {
33556 for (var i3 = 0; i3 < cache.nodes.length; i3++) {
33557 var node = graph.entity(cache.nodes[i3]);
33558 var start2 = projection2(node.loc);
33559 var end = geoVecAdd(start2, _delta);
33560 graph = graph.replace(node.move(projection2.invert(end)));
33562 if (cache.intersections.length) {
33563 graph = cleanupIntersections(graph);
33567 action.delta = function() {
33573 // modules/actions/move_member.js
33574 function actionMoveMember(relationId, fromIndex, toIndex) {
33575 return function(graph) {
33576 return graph.replace(graph.entity(relationId).moveMember(fromIndex, toIndex));
33580 // modules/actions/move_node.js
33581 function actionMoveNode(nodeID, toLoc) {
33582 var action = function(graph, t2) {
33583 if (t2 === null || !isFinite(t2)) t2 = 1;
33584 t2 = Math.min(Math.max(+t2, 0), 1);
33585 var node = graph.entity(nodeID);
33586 return graph.replace(
33587 node.move(geoVecInterp(node.loc, toLoc, t2))
33590 action.transitionable = true;
33594 // modules/actions/noop.js
33595 function actionNoop() {
33596 return function(graph) {
33601 // modules/actions/orthogonalize.js
33602 function actionOrthogonalize(wayID, projection2, vertexID, degThresh, ep) {
33603 var epsilon3 = ep || 1e-4;
33604 var threshold = degThresh || 13;
33605 var lowerThreshold = Math.cos((90 - threshold) * Math.PI / 180);
33606 var upperThreshold = Math.cos(threshold * Math.PI / 180);
33607 var action = function(graph, t2) {
33608 if (t2 === null || !isFinite(t2)) t2 = 1;
33609 t2 = Math.min(Math.max(+t2, 0), 1);
33610 var way = graph.entity(wayID);
33611 way = way.removeNode("");
33612 if (way.tags.nonsquare) {
33613 var tags = Object.assign({}, way.tags);
33614 delete tags.nonsquare;
33615 way = way.update({ tags });
33617 graph = graph.replace(way);
33618 var isClosed = way.isClosed();
33619 var nodes = graph.childNodes(way).slice();
33620 if (isClosed) nodes.pop();
33621 if (vertexID !== void 0) {
33622 nodes = nodeSubset(nodes, vertexID, isClosed);
33623 if (nodes.length !== 3) return graph;
33625 var nodeCount = {};
33627 var corner = { i: 0, dotp: 1 };
33628 var node, point, loc, score, motions, i3, j2;
33629 for (i3 = 0; i3 < nodes.length; i3++) {
33631 nodeCount[node.id] = (nodeCount[node.id] || 0) + 1;
33632 points.push({ id: node.id, coord: projection2(node.loc) });
33634 if (points.length === 3) {
33635 for (i3 = 0; i3 < 1e3; i3++) {
33636 motions = points.map(calcMotion);
33637 points[corner.i].coord = geoVecAdd(points[corner.i].coord, motions[corner.i]);
33638 score = corner.dotp;
33639 if (score < epsilon3) {
33643 node = graph.entity(nodes[corner.i].id);
33644 loc = projection2.invert(points[corner.i].coord);
33645 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33647 var straights = [];
33648 var simplified = [];
33649 for (i3 = 0; i3 < points.length; i3++) {
33650 point = points[i3];
33652 if (isClosed || i3 > 0 && i3 < points.length - 1) {
33653 var a2 = points[(i3 - 1 + points.length) % points.length];
33654 var b2 = points[(i3 + 1) % points.length];
33655 dotp = Math.abs(geoOrthoNormalizedDotProduct(a2.coord, b2.coord, point.coord));
33657 if (dotp > upperThreshold) {
33658 straights.push(point);
33660 simplified.push(point);
33663 var bestPoints = clonePoints(simplified);
33664 var originalPoints = clonePoints(simplified);
33666 for (i3 = 0; i3 < 1e3; i3++) {
33667 motions = simplified.map(calcMotion);
33668 for (j2 = 0; j2 < motions.length; j2++) {
33669 simplified[j2].coord = geoVecAdd(simplified[j2].coord, motions[j2]);
33671 var newScore = geoOrthoCalcScore(simplified, isClosed, epsilon3, threshold);
33672 if (newScore < score) {
33673 bestPoints = clonePoints(simplified);
33676 if (score < epsilon3) {
33680 var bestCoords = bestPoints.map(function(p2) {
33683 if (isClosed) bestCoords.push(bestCoords[0]);
33684 for (i3 = 0; i3 < bestPoints.length; i3++) {
33685 point = bestPoints[i3];
33686 if (!geoVecEqual(originalPoints[i3].coord, point.coord)) {
33687 node = graph.entity(point.id);
33688 loc = projection2.invert(point.coord);
33689 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33692 for (i3 = 0; i3 < straights.length; i3++) {
33693 point = straights[i3];
33694 if (nodeCount[point.id] > 1) continue;
33695 node = graph.entity(point.id);
33696 if (t2 === 1 && graph.parentWays(node).length === 1 && graph.parentRelations(node).length === 0 && !node.hasInterestingTags()) {
33697 graph = actionDeleteNode(node.id)(graph);
33699 var choice = geoVecProject(point.coord, bestCoords);
33701 loc = projection2.invert(choice.target);
33702 graph = graph.replace(node.move(geoVecInterp(node.loc, loc, t2)));
33708 function clonePoints(array2) {
33709 return array2.map(function(p2) {
33710 return { id: p2.id, coord: [p2.coord[0], p2.coord[1]] };
33713 function calcMotion(point2, i4, array2) {
33714 if (!isClosed && (i4 === 0 || i4 === array2.length - 1)) return [0, 0];
33715 if (nodeCount[array2[i4].id] > 1) return [0, 0];
33716 var a3 = array2[(i4 - 1 + array2.length) % array2.length].coord;
33717 var origin = point2.coord;
33718 var b3 = array2[(i4 + 1) % array2.length].coord;
33719 var p2 = geoVecSubtract(a3, origin);
33720 var q2 = geoVecSubtract(b3, origin);
33721 var scale = 2 * Math.min(geoVecLength(p2), geoVecLength(q2));
33722 p2 = geoVecNormalize(p2);
33723 q2 = geoVecNormalize(q2);
33724 var dotp2 = p2[0] * q2[0] + p2[1] * q2[1];
33725 var val = Math.abs(dotp2);
33726 if (val < lowerThreshold) {
33729 var vec = geoVecNormalize(geoVecAdd(p2, q2));
33730 return geoVecScale(vec, 0.1 * dotp2 * scale);
33735 function nodeSubset(nodes, vertexID2, isClosed) {
33736 var first = isClosed ? 0 : 1;
33737 var last = isClosed ? nodes.length : nodes.length - 1;
33738 for (var i3 = first; i3 < last; i3++) {
33739 if (nodes[i3].id === vertexID2) {
33741 nodes[(i3 - 1 + nodes.length) % nodes.length],
33743 nodes[(i3 + 1) % nodes.length]
33749 action.disabled = function(graph) {
33750 var way = graph.entity(wayID);
33751 way = way.removeNode("");
33752 graph = graph.replace(way);
33753 var isClosed = way.isClosed();
33754 var nodes = graph.childNodes(way).slice();
33755 if (isClosed) nodes.pop();
33756 var allowStraightAngles = false;
33757 if (vertexID !== void 0) {
33758 allowStraightAngles = true;
33759 nodes = nodeSubset(nodes, vertexID, isClosed);
33760 if (nodes.length !== 3) return "end_vertex";
33762 var coords = nodes.map(function(n3) {
33763 return projection2(n3.loc);
33765 var score = geoOrthoCanOrthogonalize(coords, isClosed, epsilon3, threshold, allowStraightAngles);
33766 if (score === null) {
33767 return "not_squarish";
33768 } else if (score === 0) {
33769 return "square_enough";
33774 action.transitionable = true;
33778 // modules/actions/restrict_turn.js
33779 function actionRestrictTurn(turn, restrictionType, restrictionID) {
33780 return function(graph) {
33781 var fromWay = graph.entity(turn.from.way);
33782 var toWay = graph.entity(turn.to.way);
33783 var viaNode = turn.via.node && graph.entity(turn.via.node);
33784 var viaWays = turn.via.ways && turn.via.ways.map(function(id2) {
33785 return graph.entity(id2);
33788 members.push({ id: fromWay.id, type: "way", role: "from" });
33790 members.push({ id: viaNode.id, type: "node", role: "via" });
33791 } else if (viaWays) {
33792 viaWays.forEach(function(viaWay) {
33793 members.push({ id: viaWay.id, type: "way", role: "via" });
33796 members.push({ id: toWay.id, type: "way", role: "to" });
33797 return graph.replace(osmRelation({
33800 type: "restriction",
33801 restriction: restrictionType
33808 // modules/actions/revert.js
33809 function actionRevert(id2) {
33810 var action = function(graph) {
33811 var entity = graph.hasEntity(id2), base = graph.base().entities[id2];
33812 if (entity && !base) {
33813 if (entity.type === "node") {
33814 graph.parentWays(entity).forEach(function(parent) {
33815 parent = parent.removeNode(id2);
33816 graph = graph.replace(parent);
33817 if (parent.isDegenerate()) {
33818 graph = actionDeleteWay(parent.id)(graph);
33822 graph.parentRelations(entity).forEach(function(parent) {
33823 parent = parent.removeMembersWithID(id2);
33824 graph = graph.replace(parent);
33825 if (parent.isDegenerate()) {
33826 graph = actionDeleteRelation(parent.id)(graph);
33830 return graph.revert(id2);
33835 // modules/actions/rotate.js
33836 function actionRotate(rotateIds, pivot, angle2, projection2) {
33837 var action = function(graph) {
33838 return graph.update(function(graph2) {
33839 utilGetAllNodes(rotateIds, graph2).forEach(function(node) {
33840 var point = geoRotate([projection2(node.loc)], angle2, pivot)[0];
33841 graph2 = graph2.replace(node.move(projection2.invert(point)));
33848 // modules/actions/scale.js
33849 function actionScale(ids, pivotLoc, scaleFactor, projection2) {
33850 return function(graph) {
33851 return graph.update(function(graph2) {
33853 utilGetAllNodes(ids, graph2).forEach(function(node) {
33854 point = projection2(node.loc);
33856 point[0] - pivotLoc[0],
33857 point[1] - pivotLoc[1]
33860 pivotLoc[0] + scaleFactor * radial[0],
33861 pivotLoc[1] + scaleFactor * radial[1]
33863 graph2 = graph2.replace(node.move(projection2.invert(point)));
33869 // modules/actions/straighten_nodes.js
33870 function actionStraightenNodes(nodeIDs, projection2) {
33871 function positionAlongWay(a2, o2, b2) {
33872 return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33874 function getEndpoints(points) {
33875 var ssr = geoGetSmallestSurroundingRectangle(points);
33876 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
33877 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
33878 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
33879 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
33880 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
33886 var action = function(graph, t2) {
33887 if (t2 === null || !isFinite(t2)) t2 = 1;
33888 t2 = Math.min(Math.max(+t2, 0), 1);
33889 var nodes = nodeIDs.map(function(id2) {
33890 return graph.entity(id2);
33892 var points = nodes.map(function(n3) {
33893 return projection2(n3.loc);
33895 var endpoints = getEndpoints(points);
33896 var startPoint = endpoints[0];
33897 var endPoint = endpoints[1];
33898 for (var i3 = 0; i3 < points.length; i3++) {
33899 var node = nodes[i3];
33900 var point = points[i3];
33901 var u2 = positionAlongWay(point, startPoint, endPoint);
33902 var point2 = geoVecInterp(startPoint, endPoint, u2);
33903 var loc2 = projection2.invert(point2);
33904 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
33908 action.disabled = function(graph) {
33909 var nodes = nodeIDs.map(function(id2) {
33910 return graph.entity(id2);
33912 var points = nodes.map(function(n3) {
33913 return projection2(n3.loc);
33915 var endpoints = getEndpoints(points);
33916 var startPoint = endpoints[0];
33917 var endPoint = endpoints[1];
33918 var maxDistance = 0;
33919 for (var i3 = 0; i3 < points.length; i3++) {
33920 var point = points[i3];
33921 var u2 = positionAlongWay(point, startPoint, endPoint);
33922 var p2 = geoVecInterp(startPoint, endPoint, u2);
33923 var dist = geoVecLength(p2, point);
33924 if (!isNaN(dist) && dist > maxDistance) {
33925 maxDistance = dist;
33928 if (maxDistance < 1e-4) {
33929 return "straight_enough";
33932 action.transitionable = true;
33936 // modules/actions/straighten_way.js
33937 function actionStraightenWay(selectedIDs, projection2) {
33938 function positionAlongWay(a2, o2, b2) {
33939 return geoVecDot(a2, b2, o2) / geoVecDot(b2, b2, o2);
33941 function allNodes(graph) {
33943 var startNodes = [];
33945 var remainingWays = [];
33946 var selectedWays = selectedIDs.filter(function(w2) {
33947 return graph.entity(w2).type === "way";
33949 var selectedNodes = selectedIDs.filter(function(n3) {
33950 return graph.entity(n3).type === "node";
33952 for (var i3 = 0; i3 < selectedWays.length; i3++) {
33953 var way = graph.entity(selectedWays[i3]);
33954 nodes = way.nodes.slice(0);
33955 remainingWays.push(nodes);
33956 startNodes.push(nodes[0]);
33957 endNodes.push(nodes[nodes.length - 1]);
33959 startNodes = startNodes.filter(function(n3) {
33960 return startNodes.indexOf(n3) === startNodes.lastIndexOf(n3);
33962 endNodes = endNodes.filter(function(n3) {
33963 return endNodes.indexOf(n3) === endNodes.lastIndexOf(n3);
33965 var currNode = utilArrayDifference(startNodes, endNodes).concat(utilArrayDifference(endNodes, startNodes))[0];
33968 var getNextWay = function(currNode2, remainingWays2) {
33969 return remainingWays2.filter(function(way2) {
33970 return way2[0] === currNode2 || way2[way2.length - 1] === currNode2;
33973 while (remainingWays.length) {
33974 nextWay = getNextWay(currNode, remainingWays);
33975 remainingWays = utilArrayDifference(remainingWays, [nextWay]);
33976 if (nextWay[0] !== currNode) {
33979 nodes = nodes.concat(nextWay);
33980 currNode = nodes[nodes.length - 1];
33982 if (selectedNodes.length === 2) {
33983 var startNodeIdx = nodes.indexOf(selectedNodes[0]);
33984 var endNodeIdx = nodes.indexOf(selectedNodes[1]);
33985 var sortedStartEnd = [startNodeIdx, endNodeIdx];
33986 sortedStartEnd.sort(function(a2, b2) {
33989 nodes = nodes.slice(sortedStartEnd[0], sortedStartEnd[1] + 1);
33991 return nodes.map(function(n3) {
33992 return graph.entity(n3);
33995 function shouldKeepNode(node, graph) {
33996 return graph.parentWays(node).length > 1 || graph.parentRelations(node).length || node.hasInterestingTags();
33998 var action = function(graph, t2) {
33999 if (t2 === null || !isFinite(t2)) t2 = 1;
34000 t2 = Math.min(Math.max(+t2, 0), 1);
34001 var nodes = allNodes(graph);
34002 var points = nodes.map(function(n3) {
34003 return projection2(n3.loc);
34005 var startPoint = points[0];
34006 var endPoint = points[points.length - 1];
34009 for (i3 = 1; i3 < points.length - 1; i3++) {
34010 var node = nodes[i3];
34011 var point = points[i3];
34012 if (t2 < 1 || shouldKeepNode(node, graph)) {
34013 var u2 = positionAlongWay(point, startPoint, endPoint);
34014 var p2 = geoVecInterp(startPoint, endPoint, u2);
34015 var loc2 = projection2.invert(p2);
34016 graph = graph.replace(node.move(geoVecInterp(node.loc, loc2, t2)));
34018 if (toDelete.indexOf(node) === -1) {
34019 toDelete.push(node);
34023 for (i3 = 0; i3 < toDelete.length; i3++) {
34024 graph = actionDeleteNode(toDelete[i3].id)(graph);
34028 action.disabled = function(graph) {
34029 var nodes = allNodes(graph);
34030 var points = nodes.map(function(n3) {
34031 return projection2(n3.loc);
34033 var startPoint = points[0];
34034 var endPoint = points[points.length - 1];
34035 var threshold = 0.2 * geoVecLength(startPoint, endPoint);
34037 if (threshold === 0) {
34038 return "too_bendy";
34040 var maxDistance = 0;
34041 for (i3 = 1; i3 < points.length - 1; i3++) {
34042 var point = points[i3];
34043 var u2 = positionAlongWay(point, startPoint, endPoint);
34044 var p2 = geoVecInterp(startPoint, endPoint, u2);
34045 var dist = geoVecLength(p2, point);
34046 if (isNaN(dist) || dist > threshold) {
34047 return "too_bendy";
34048 } else if (dist > maxDistance) {
34049 maxDistance = dist;
34052 var keepingAllNodes = nodes.every(function(node, i4) {
34053 return i4 === 0 || i4 === nodes.length - 1 || shouldKeepNode(node, graph);
34055 if (maxDistance < 1e-4 && // Allow straightening even if already straight in order to remove extraneous nodes
34057 return "straight_enough";
34060 action.transitionable = true;
34064 // modules/actions/unrestrict_turn.js
34065 function actionUnrestrictTurn(turn) {
34066 return function(graph) {
34067 return actionDeleteRelation(turn.restrictionID)(graph);
34071 // modules/actions/reflect.js
34072 function actionReflect(reflectIds, projection2) {
34073 var _useLongAxis = true;
34074 var action = function(graph, t2) {
34075 if (t2 === null || !isFinite(t2)) t2 = 1;
34076 t2 = Math.min(Math.max(+t2, 0), 1);
34077 var nodes = utilGetAllNodes(reflectIds, graph);
34078 var points = nodes.map(function(n3) {
34079 return projection2(n3.loc);
34081 var ssr = geoGetSmallestSurroundingRectangle(points);
34082 var p1 = [(ssr.poly[0][0] + ssr.poly[1][0]) / 2, (ssr.poly[0][1] + ssr.poly[1][1]) / 2];
34083 var q1 = [(ssr.poly[2][0] + ssr.poly[3][0]) / 2, (ssr.poly[2][1] + ssr.poly[3][1]) / 2];
34084 var p2 = [(ssr.poly[3][0] + ssr.poly[4][0]) / 2, (ssr.poly[3][1] + ssr.poly[4][1]) / 2];
34085 var q2 = [(ssr.poly[1][0] + ssr.poly[2][0]) / 2, (ssr.poly[1][1] + ssr.poly[2][1]) / 2];
34087 var isLong = geoVecLength(p1, q1) > geoVecLength(p2, q2);
34088 if (_useLongAxis && isLong || !_useLongAxis && !isLong) {
34095 var dx = q3[0] - p3[0];
34096 var dy = q3[1] - p3[1];
34097 var a2 = (dx * dx - dy * dy) / (dx * dx + dy * dy);
34098 var b2 = 2 * dx * dy / (dx * dx + dy * dy);
34099 for (var i3 = 0; i3 < nodes.length; i3++) {
34100 var node = nodes[i3];
34101 var c2 = projection2(node.loc);
34103 a2 * (c2[0] - p3[0]) + b2 * (c2[1] - p3[1]) + p3[0],
34104 b2 * (c2[0] - p3[0]) - a2 * (c2[1] - p3[1]) + p3[1]
34106 var loc2 = projection2.invert(c22);
34107 node = node.move(geoVecInterp(node.loc, loc2, t2));
34108 graph = graph.replace(node);
34112 action.useLongAxis = function(val) {
34113 if (!arguments.length) return _useLongAxis;
34114 _useLongAxis = val;
34117 action.transitionable = true;
34121 // modules/actions/upgrade_tags.js
34122 function actionUpgradeTags(entityId, oldTags, replaceTags) {
34123 return function(graph) {
34124 var entity = graph.entity(entityId);
34125 var tags = Object.assign({}, entity.tags);
34128 for (var oldTagKey in oldTags) {
34129 if (!(oldTagKey in tags)) continue;
34130 if (oldTags[oldTagKey] === "*") {
34131 transferValue = tags[oldTagKey];
34132 delete tags[oldTagKey];
34133 } else if (oldTags[oldTagKey] === tags[oldTagKey]) {
34134 delete tags[oldTagKey];
34136 var vals = tags[oldTagKey].split(";").filter(Boolean);
34137 var oldIndex = vals.indexOf(oldTags[oldTagKey]);
34138 if (vals.length === 1 || oldIndex === -1) {
34139 delete tags[oldTagKey];
34141 if (replaceTags && replaceTags[oldTagKey]) {
34142 semiIndex = oldIndex;
34144 vals.splice(oldIndex, 1);
34145 tags[oldTagKey] = vals.join(";");
34150 for (var replaceKey in replaceTags) {
34151 var replaceValue = replaceTags[replaceKey];
34152 if (replaceValue === "*") {
34153 if (tags[replaceKey] && tags[replaceKey] !== "no") {
34156 tags[replaceKey] = "yes";
34158 } else if (replaceValue === "$1") {
34159 tags[replaceKey] = transferValue;
34161 if (tags[replaceKey] && oldTags[replaceKey] && semiIndex !== void 0) {
34162 var existingVals = tags[replaceKey].split(";").filter(Boolean);
34163 if (existingVals.indexOf(replaceValue) === -1) {
34164 existingVals.splice(semiIndex, 0, replaceValue);
34165 tags[replaceKey] = existingVals.join(";");
34168 tags[replaceKey] = replaceValue;
34173 return graph.replace(entity.update({ tags }));
34177 // modules/behavior/edit.js
34178 function behaviorEdit(context) {
34179 function behavior() {
34180 context.map().minzoom(context.minEditableZoom());
34182 behavior.off = function() {
34183 context.map().minzoom(0);
34188 // modules/behavior/hover.js
34189 function behaviorHover(context) {
34190 var dispatch14 = dispatch_default("hover");
34191 var _selection = select_default2(null);
34192 var _newNodeId = null;
34193 var _initialNodeID = null;
34197 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
34198 function keydown(d3_event) {
34199 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
34200 _selection.selectAll(".hover").classed("hover-suppressed", true).classed("hover", false);
34201 _selection.classed("hover-disabled", true);
34202 dispatch14.call("hover", this, null);
34205 function keyup(d3_event) {
34206 if (_altDisables && d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
34207 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false).classed("hover", true);
34208 _selection.classed("hover-disabled", false);
34209 dispatch14.call("hover", this, _targets);
34212 function behavior(selection2) {
34213 _selection = selection2;
34215 if (_initialNodeID) {
34216 _newNodeId = _initialNodeID;
34217 _initialNodeID = null;
34221 _selection.on(_pointerPrefix + "over.hover", pointerover).on(_pointerPrefix + "out.hover", pointerout).on(_pointerPrefix + "down.hover", pointerover);
34222 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", pointerout, true).on("keydown.hover", keydown).on("keyup.hover", keyup);
34223 function eventTarget(d3_event) {
34224 var datum2 = d3_event.target && d3_event.target.__data__;
34225 if (typeof datum2 !== "object") return null;
34226 if (!(datum2 instanceof osmEntity) && datum2.properties && datum2.properties.entity instanceof osmEntity) {
34227 return datum2.properties.entity;
34231 function pointerover(d3_event) {
34232 if (context.mode().id.indexOf("drag") === -1 && (!d3_event.pointerType || d3_event.pointerType === "mouse") && d3_event.buttons) return;
34233 var target = eventTarget(d3_event);
34234 if (target && _targets.indexOf(target) === -1) {
34235 _targets.push(target);
34236 updateHover(d3_event, _targets);
34239 function pointerout(d3_event) {
34240 var target = eventTarget(d3_event);
34241 var index = _targets.indexOf(target);
34242 if (index !== -1) {
34243 _targets.splice(index);
34244 updateHover(d3_event, _targets);
34247 function allowsVertex(d2) {
34248 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34250 function modeAllowsHover(target) {
34251 var mode = context.mode();
34252 if (mode.id === "add-point") {
34253 return mode.preset.matchGeometry("vertex") || target.type !== "way" && target.geometry(context.graph()) !== "vertex";
34257 function updateHover(d3_event, targets) {
34258 _selection.selectAll(".hover").classed("hover", false);
34259 _selection.selectAll(".hover-suppressed").classed("hover-suppressed", false);
34260 var mode = context.mode();
34261 if (!_newNodeId && (mode.id === "draw-line" || mode.id === "draw-area")) {
34262 var node = targets.find(function(target) {
34263 return target instanceof osmEntity && target.type === "node";
34265 _newNodeId = node && node.id;
34267 targets = targets.filter(function(datum3) {
34268 if (datum3 instanceof osmEntity) {
34269 return datum3.id !== _newNodeId && (datum3.type !== "node" || !_ignoreVertex || allowsVertex(datum3)) && modeAllowsHover(datum3);
34274 for (var i3 in targets) {
34275 var datum2 = targets[i3];
34276 if (datum2.__featurehash__) {
34277 selector += ", .data" + datum2.__featurehash__;
34278 } else if (datum2 instanceof QAItem) {
34279 selector += ", ." + datum2.service + ".itemId-" + datum2.id;
34280 } else if (datum2 instanceof osmNote) {
34281 selector += ", .note-" + datum2.id;
34282 } else if (datum2 instanceof osmEntity) {
34283 selector += ", ." + datum2.id;
34284 if (datum2.type === "relation") {
34285 for (var j2 in datum2.members) {
34286 selector += ", ." + datum2.members[j2].id;
34291 var suppressed = _altDisables && d3_event && d3_event.altKey;
34292 if (selector.trim().length) {
34293 selector = selector.slice(1);
34294 _selection.selectAll(selector).classed(suppressed ? "hover-suppressed" : "hover", true);
34296 dispatch14.call("hover", this, !suppressed && targets);
34299 behavior.off = function(selection2) {
34300 selection2.selectAll(".hover").classed("hover", false);
34301 selection2.selectAll(".hover-suppressed").classed("hover-suppressed", false);
34302 selection2.classed("hover-disabled", false);
34303 selection2.on(_pointerPrefix + "over.hover", null).on(_pointerPrefix + "out.hover", null).on(_pointerPrefix + "down.hover", null);
34304 select_default2(window).on(_pointerPrefix + "up.hover pointercancel.hover", null, true).on("keydown.hover", null).on("keyup.hover", null);
34306 behavior.altDisables = function(val) {
34307 if (!arguments.length) return _altDisables;
34308 _altDisables = val;
34311 behavior.ignoreVertex = function(val) {
34312 if (!arguments.length) return _ignoreVertex;
34313 _ignoreVertex = val;
34316 behavior.initialNodeID = function(nodeId) {
34317 _initialNodeID = nodeId;
34320 return utilRebind(behavior, dispatch14, "on");
34323 // modules/behavior/draw.js
34324 var _disableSpace = false;
34325 var _lastSpace = null;
34326 function behaviorDraw(context) {
34327 var dispatch14 = dispatch_default(
34338 var keybinding = utilKeybinding("draw");
34339 var _hover = behaviorHover(context).altDisables(true).ignoreVertex(true).on("hover", context.ui().sidebar.hover);
34340 var _edit = behaviorEdit(context);
34341 var _closeTolerance = 4;
34342 var _tolerance = 12;
34343 var _mouseLeave = false;
34344 var _lastMouse = null;
34345 var _lastPointerUpEvent;
34347 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
34348 function datum2(d3_event) {
34349 var mode = context.mode();
34350 var isNote = mode && mode.id.indexOf("note") !== -1;
34351 if (d3_event.altKey || isNote) return {};
34353 if (d3_event.type === "keydown") {
34354 element = _lastMouse && _lastMouse.target;
34356 element = d3_event.target;
34358 var d2 = element.__data__;
34359 return d2 && d2.properties && d2.properties.target ? d2 : {};
34361 function pointerdown(d3_event) {
34362 if (_downPointer) return;
34363 var pointerLocGetter = utilFastMouse(this);
34365 id: d3_event.pointerId || "mouse",
34367 downTime: +/* @__PURE__ */ new Date(),
34368 downLoc: pointerLocGetter(d3_event)
34370 dispatch14.call("down", this, d3_event, datum2(d3_event));
34372 function pointerup(d3_event) {
34373 if (!_downPointer || _downPointer.id !== (d3_event.pointerId || "mouse")) return;
34374 var downPointer = _downPointer;
34375 _downPointer = null;
34376 _lastPointerUpEvent = d3_event;
34377 if (downPointer.isCancelled) return;
34378 var t2 = +/* @__PURE__ */ new Date();
34379 var p2 = downPointer.pointerLocGetter(d3_event);
34380 var dist = geoVecLength(downPointer.downLoc, p2);
34381 if (dist < _closeTolerance || dist < _tolerance && t2 - downPointer.downTime < 500) {
34382 select_default2(window).on("click.draw-block", function() {
34383 d3_event.stopPropagation();
34385 context.map().dblclickZoomEnable(false);
34386 window.setTimeout(function() {
34387 context.map().dblclickZoomEnable(true);
34388 select_default2(window).on("click.draw-block", null);
34390 click(d3_event, p2);
34393 function pointermove(d3_event) {
34394 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse") && !_downPointer.isCancelled) {
34395 var p2 = _downPointer.pointerLocGetter(d3_event);
34396 var dist = geoVecLength(_downPointer.downLoc, p2);
34397 if (dist >= _closeTolerance) {
34398 _downPointer.isCancelled = true;
34399 dispatch14.call("downcancel", this);
34402 if (d3_event.pointerType && d3_event.pointerType !== "mouse" || d3_event.buttons || _downPointer) return;
34403 if (_lastPointerUpEvent && _lastPointerUpEvent.pointerType !== "mouse" && d3_event.timeStamp - _lastPointerUpEvent.timeStamp < 100) return;
34404 _lastMouse = d3_event;
34405 dispatch14.call("move", this, d3_event, datum2(d3_event));
34407 function pointercancel(d3_event) {
34408 if (_downPointer && _downPointer.id === (d3_event.pointerId || "mouse")) {
34409 if (!_downPointer.isCancelled) {
34410 dispatch14.call("downcancel", this);
34412 _downPointer = null;
34415 function mouseenter() {
34416 _mouseLeave = false;
34418 function mouseleave() {
34419 _mouseLeave = true;
34421 function allowsVertex(d2) {
34422 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
34424 function click(d3_event, loc) {
34425 var d2 = datum2(d3_event);
34426 var target = d2 && d2.properties && d2.properties.entity;
34427 var mode = context.mode();
34428 if (target && target.type === "node" && allowsVertex(target)) {
34429 dispatch14.call("clickNode", this, target, d2);
34431 } else if (target && target.type === "way" && (mode.id !== "add-point" || mode.preset.matchGeometry("vertex"))) {
34432 var choice = geoChooseEdge(
34433 context.graph().childNodes(target),
34435 context.projection,
34439 var edge = [target.nodes[choice.index - 1], target.nodes[choice.index]];
34440 dispatch14.call("clickWay", this, choice.loc, edge, d2);
34443 } else if (mode.id !== "add-point" || mode.preset.matchGeometry("point")) {
34444 var locLatLng = context.projection.invert(loc);
34445 dispatch14.call("click", this, locLatLng, d2);
34448 function space(d3_event) {
34449 d3_event.preventDefault();
34450 d3_event.stopPropagation();
34451 var currSpace = context.map().mouse();
34452 if (_disableSpace && _lastSpace) {
34453 var dist = geoVecLength(_lastSpace, currSpace);
34454 if (dist > _tolerance) {
34455 _disableSpace = false;
34458 if (_disableSpace || _mouseLeave || !_lastMouse) return;
34459 _lastSpace = currSpace;
34460 _disableSpace = true;
34461 select_default2(window).on("keyup.space-block", function() {
34462 d3_event.preventDefault();
34463 d3_event.stopPropagation();
34464 _disableSpace = false;
34465 select_default2(window).on("keyup.space-block", null);
34467 var loc = context.map().mouse() || // or the map center if the mouse has never entered the map
34468 context.projection(context.map().center());
34469 click(d3_event, loc);
34471 function backspace(d3_event) {
34472 d3_event.preventDefault();
34473 dispatch14.call("undo");
34475 function del(d3_event) {
34476 d3_event.preventDefault();
34477 dispatch14.call("cancel");
34479 function ret(d3_event) {
34480 d3_event.preventDefault();
34481 dispatch14.call("finish");
34483 function behavior(selection2) {
34484 context.install(_hover);
34485 context.install(_edit);
34486 _downPointer = null;
34487 keybinding.on("\u232B", backspace).on("\u2326", del).on("\u238B", ret).on("\u21A9", ret).on("space", space).on("\u2325space", space);
34488 selection2.on("mouseenter.draw", mouseenter).on("mouseleave.draw", mouseleave).on(_pointerPrefix + "down.draw", pointerdown).on(_pointerPrefix + "move.draw", pointermove);
34489 select_default2(window).on(_pointerPrefix + "up.draw", pointerup, true).on("pointercancel.draw", pointercancel, true);
34490 select_default2(document).call(keybinding);
34493 behavior.off = function(selection2) {
34494 context.ui().sidebar.hover.cancel();
34495 context.uninstall(_hover);
34496 context.uninstall(_edit);
34497 selection2.on("mouseenter.draw", null).on("mouseleave.draw", null).on(_pointerPrefix + "down.draw", null).on(_pointerPrefix + "move.draw", null);
34498 select_default2(window).on(_pointerPrefix + "up.draw", null).on("pointercancel.draw", null);
34499 select_default2(document).call(keybinding.unbind);
34501 behavior.hover = function() {
34504 return utilRebind(behavior, dispatch14, "on");
34507 // modules/behavior/breathe.js
34508 var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
34510 // node_modules/d3-scale/src/init.js
34511 function initRange(domain, range3) {
34512 switch (arguments.length) {
34516 this.range(domain);
34519 this.range(range3).domain(domain);
34525 // node_modules/d3-scale/src/constant.js
34526 function constants(x2) {
34527 return function() {
34532 // node_modules/d3-scale/src/number.js
34533 function number2(x2) {
34537 // node_modules/d3-scale/src/continuous.js
34539 function identity3(x2) {
34542 function normalize(a2, b2) {
34543 return (b2 -= a2 = +a2) ? function(x2) {
34544 return (x2 - a2) / b2;
34545 } : constants(isNaN(b2) ? NaN : 0.5);
34547 function clamper(a2, b2) {
34549 if (a2 > b2) t2 = a2, a2 = b2, b2 = t2;
34550 return function(x2) {
34551 return Math.max(a2, Math.min(b2, x2));
34554 function bimap(domain, range3, interpolate) {
34555 var d0 = domain[0], d1 = domain[1], r0 = range3[0], r1 = range3[1];
34556 if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0);
34557 else d0 = normalize(d0, d1), r0 = interpolate(r0, r1);
34558 return function(x2) {
34562 function polymap(domain, range3, interpolate) {
34563 var j2 = Math.min(domain.length, range3.length) - 1, d2 = new Array(j2), r2 = new Array(j2), i3 = -1;
34564 if (domain[j2] < domain[0]) {
34565 domain = domain.slice().reverse();
34566 range3 = range3.slice().reverse();
34568 while (++i3 < j2) {
34569 d2[i3] = normalize(domain[i3], domain[i3 + 1]);
34570 r2[i3] = interpolate(range3[i3], range3[i3 + 1]);
34572 return function(x2) {
34573 var i4 = bisect_default(domain, x2, 1, j2) - 1;
34574 return r2[i4](d2[i4](x2));
34577 function copy(source, target) {
34578 return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
34580 function transformer2() {
34581 var domain = unit, range3 = unit, interpolate = value_default, transform2, untransform, unknown, clamp3 = identity3, piecewise, output, input;
34582 function rescale() {
34583 var n3 = Math.min(domain.length, range3.length);
34584 if (clamp3 !== identity3) clamp3 = clamper(domain[0], domain[n3 - 1]);
34585 piecewise = n3 > 2 ? polymap : bimap;
34586 output = input = null;
34589 function scale(x2) {
34590 return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise(domain.map(transform2), range3, interpolate)))(transform2(clamp3(x2)));
34592 scale.invert = function(y2) {
34593 return clamp3(untransform((input || (input = piecewise(range3, domain.map(transform2), number_default)))(y2)));
34595 scale.domain = function(_2) {
34596 return arguments.length ? (domain = Array.from(_2, number2), rescale()) : domain.slice();
34598 scale.range = function(_2) {
34599 return arguments.length ? (range3 = Array.from(_2), rescale()) : range3.slice();
34601 scale.rangeRound = function(_2) {
34602 return range3 = Array.from(_2), interpolate = round_default, rescale();
34604 scale.clamp = function(_2) {
34605 return arguments.length ? (clamp3 = _2 ? true : identity3, rescale()) : clamp3 !== identity3;
34607 scale.interpolate = function(_2) {
34608 return arguments.length ? (interpolate = _2, rescale()) : interpolate;
34610 scale.unknown = function(_2) {
34611 return arguments.length ? (unknown = _2, scale) : unknown;
34613 return function(t2, u2) {
34614 transform2 = t2, untransform = u2;
34618 function continuous() {
34619 return transformer2()(identity3, identity3);
34622 // node_modules/d3-format/src/formatDecimal.js
34623 function formatDecimal_default(x2) {
34624 return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10);
34626 function formatDecimalParts(x2, p2) {
34627 if ((i3 = (x2 = p2 ? x2.toExponential(p2 - 1) : x2.toExponential()).indexOf("e")) < 0) return null;
34628 var i3, coefficient = x2.slice(0, i3);
34630 coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
34635 // node_modules/d3-format/src/exponent.js
34636 function exponent_default(x2) {
34637 return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN;
34640 // node_modules/d3-format/src/formatGroup.js
34641 function formatGroup_default(grouping, thousands) {
34642 return function(value, width) {
34643 var i3 = value.length, t2 = [], j2 = 0, g3 = grouping[0], length2 = 0;
34644 while (i3 > 0 && g3 > 0) {
34645 if (length2 + g3 + 1 > width) g3 = Math.max(1, width - length2);
34646 t2.push(value.substring(i3 -= g3, i3 + g3));
34647 if ((length2 += g3 + 1) > width) break;
34648 g3 = grouping[j2 = (j2 + 1) % grouping.length];
34650 return t2.reverse().join(thousands);
34654 // node_modules/d3-format/src/formatNumerals.js
34655 function formatNumerals_default(numerals) {
34656 return function(value) {
34657 return value.replace(/[0-9]/g, function(i3) {
34658 return numerals[+i3];
34663 // node_modules/d3-format/src/formatSpecifier.js
34664 var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
34665 function formatSpecifier(specifier) {
34666 if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
34668 return new FormatSpecifier({
34676 precision: match[8] && match[8].slice(1),
34681 formatSpecifier.prototype = FormatSpecifier.prototype;
34682 function FormatSpecifier(specifier) {
34683 this.fill = specifier.fill === void 0 ? " " : specifier.fill + "";
34684 this.align = specifier.align === void 0 ? ">" : specifier.align + "";
34685 this.sign = specifier.sign === void 0 ? "-" : specifier.sign + "";
34686 this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + "";
34687 this.zero = !!specifier.zero;
34688 this.width = specifier.width === void 0 ? void 0 : +specifier.width;
34689 this.comma = !!specifier.comma;
34690 this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision;
34691 this.trim = !!specifier.trim;
34692 this.type = specifier.type === void 0 ? "" : specifier.type + "";
34694 FormatSpecifier.prototype.toString = function() {
34695 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;
34698 // node_modules/d3-format/src/formatTrim.js
34699 function formatTrim_default(s2) {
34700 out: for (var n3 = s2.length, i3 = 1, i0 = -1, i1; i3 < n3; ++i3) {
34706 if (i0 === 0) i0 = i3;
34710 if (!+s2[i3]) break out;
34711 if (i0 > 0) i0 = 0;
34715 return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2;
34718 // node_modules/d3-format/src/formatPrefixAuto.js
34719 var prefixExponent;
34720 function formatPrefixAuto_default(x2, p2) {
34721 var d2 = formatDecimalParts(x2, p2);
34722 if (!d2) return x2 + "";
34723 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;
34724 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];
34727 // node_modules/d3-format/src/formatRounded.js
34728 function formatRounded_default(x2, p2) {
34729 var d2 = formatDecimalParts(x2, p2);
34730 if (!d2) return x2 + "";
34731 var coefficient = d2[0], exponent = d2[1];
34732 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");
34735 // node_modules/d3-format/src/formatTypes.js
34736 var formatTypes_default = {
34737 "%": (x2, p2) => (x2 * 100).toFixed(p2),
34738 "b": (x2) => Math.round(x2).toString(2),
34739 "c": (x2) => x2 + "",
34740 "d": formatDecimal_default,
34741 "e": (x2, p2) => x2.toExponential(p2),
34742 "f": (x2, p2) => x2.toFixed(p2),
34743 "g": (x2, p2) => x2.toPrecision(p2),
34744 "o": (x2) => Math.round(x2).toString(8),
34745 "p": (x2, p2) => formatRounded_default(x2 * 100, p2),
34746 "r": formatRounded_default,
34747 "s": formatPrefixAuto_default,
34748 "X": (x2) => Math.round(x2).toString(16).toUpperCase(),
34749 "x": (x2) => Math.round(x2).toString(16)
34752 // node_modules/d3-format/src/identity.js
34753 function identity_default4(x2) {
34757 // node_modules/d3-format/src/locale.js
34758 var map = Array.prototype.map;
34759 var prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
34760 function locale_default(locale2) {
34761 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 + "";
34762 function newFormat(specifier) {
34763 specifier = formatSpecifier(specifier);
34764 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;
34765 if (type2 === "n") comma = true, type2 = "g";
34766 else if (!formatTypes_default[type2]) precision3 === void 0 && (precision3 = 12), trim = true, type2 = "g";
34767 if (zero3 || fill === "0" && align === "=") zero3 = true, fill = "0", align = "=";
34768 var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : "";
34769 var formatType = formatTypes_default[type2], maybeSuffix = /[defgprs%]/.test(type2);
34770 precision3 = precision3 === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision3)) : Math.max(0, Math.min(20, precision3));
34771 function format2(value) {
34772 var valuePrefix = prefix, valueSuffix = suffix, i3, n3, c2;
34773 if (type2 === "c") {
34774 valueSuffix = formatType(value) + valueSuffix;
34778 var valueNegative = value < 0 || 1 / value < 0;
34779 value = isNaN(value) ? nan : formatType(Math.abs(value), precision3);
34780 if (trim) value = formatTrim_default(value);
34781 if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false;
34782 valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix;
34783 valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : "");
34785 i3 = -1, n3 = value.length;
34786 while (++i3 < n3) {
34787 if (c2 = value.charCodeAt(i3), 48 > c2 || c2 > 57) {
34788 valueSuffix = (c2 === 46 ? decimal + value.slice(i3 + 1) : value.slice(i3)) + valueSuffix;
34789 value = value.slice(0, i3);
34795 if (comma && !zero3) value = group(value, Infinity);
34796 var length2 = valuePrefix.length + value.length + valueSuffix.length, padding = length2 < width ? new Array(width - length2 + 1).join(fill) : "";
34797 if (comma && zero3) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = "";
34800 value = valuePrefix + value + valueSuffix + padding;
34803 value = valuePrefix + padding + value + valueSuffix;
34806 value = padding.slice(0, length2 = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length2);
34809 value = padding + valuePrefix + value + valueSuffix;
34812 return numerals(value);
34814 format2.toString = function() {
34815 return specifier + "";
34819 function formatPrefix2(specifier, value) {
34820 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];
34821 return function(value2) {
34822 return f2(k2 * value2) + prefix;
34827 formatPrefix: formatPrefix2
34831 // node_modules/d3-format/src/defaultLocale.js
34838 currency: ["$", ""]
34840 function defaultLocale(definition) {
34841 locale = locale_default(definition);
34842 format = locale.format;
34843 formatPrefix = locale.formatPrefix;
34847 // node_modules/d3-format/src/precisionFixed.js
34848 function precisionFixed_default(step) {
34849 return Math.max(0, -exponent_default(Math.abs(step)));
34852 // node_modules/d3-format/src/precisionPrefix.js
34853 function precisionPrefix_default(step, value) {
34854 return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent_default(value) / 3))) * 3 - exponent_default(Math.abs(step)));
34857 // node_modules/d3-format/src/precisionRound.js
34858 function precisionRound_default(step, max3) {
34859 step = Math.abs(step), max3 = Math.abs(max3) - step;
34860 return Math.max(0, exponent_default(max3) - exponent_default(step)) + 1;
34863 // node_modules/d3-scale/src/tickFormat.js
34864 function tickFormat(start2, stop, count, specifier) {
34865 var step = tickStep(start2, stop, count), precision3;
34866 specifier = formatSpecifier(specifier == null ? ",f" : specifier);
34867 switch (specifier.type) {
34869 var value = Math.max(Math.abs(start2), Math.abs(stop));
34870 if (specifier.precision == null && !isNaN(precision3 = precisionPrefix_default(step, value))) specifier.precision = precision3;
34871 return formatPrefix(specifier, value);
34878 if (specifier.precision == null && !isNaN(precision3 = precisionRound_default(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision3 - (specifier.type === "e");
34883 if (specifier.precision == null && !isNaN(precision3 = precisionFixed_default(step))) specifier.precision = precision3 - (specifier.type === "%") * 2;
34887 return format(specifier);
34890 // node_modules/d3-scale/src/linear.js
34891 function linearish(scale) {
34892 var domain = scale.domain;
34893 scale.ticks = function(count) {
34895 return ticks(d2[0], d2[d2.length - 1], count == null ? 10 : count);
34897 scale.tickFormat = function(count, specifier) {
34899 return tickFormat(d2[0], d2[d2.length - 1], count == null ? 10 : count, specifier);
34901 scale.nice = function(count) {
34902 if (count == null) count = 10;
34905 var i1 = d2.length - 1;
34906 var start2 = d2[i0];
34911 if (stop < start2) {
34912 step = start2, start2 = stop, stop = step;
34913 step = i0, i0 = i1, i1 = step;
34915 while (maxIter-- > 0) {
34916 step = tickIncrement(start2, stop, count);
34917 if (step === prestep) {
34921 } else if (step > 0) {
34922 start2 = Math.floor(start2 / step) * step;
34923 stop = Math.ceil(stop / step) * step;
34924 } else if (step < 0) {
34925 start2 = Math.ceil(start2 * step) / step;
34926 stop = Math.floor(stop * step) / step;
34936 function linear3() {
34937 var scale = continuous();
34938 scale.copy = function() {
34939 return copy(scale, linear3());
34941 initRange.apply(scale, arguments);
34942 return linearish(scale);
34945 // node_modules/d3-scale/src/quantize.js
34946 function quantize() {
34947 var x05 = 0, x12 = 1, n3 = 1, domain = [0.5], range3 = [0, 1], unknown;
34948 function scale(x2) {
34949 return x2 != null && x2 <= x2 ? range3[bisect_default(domain, x2, 0, n3)] : unknown;
34951 function rescale() {
34953 domain = new Array(n3);
34954 while (++i3 < n3) domain[i3] = ((i3 + 1) * x12 - (i3 - n3) * x05) / (n3 + 1);
34957 scale.domain = function(_2) {
34958 return arguments.length ? ([x05, x12] = _2, x05 = +x05, x12 = +x12, rescale()) : [x05, x12];
34960 scale.range = function(_2) {
34961 return arguments.length ? (n3 = (range3 = Array.from(_2)).length - 1, rescale()) : range3.slice();
34963 scale.invertExtent = function(y2) {
34964 var i3 = range3.indexOf(y2);
34965 return i3 < 0 ? [NaN, NaN] : i3 < 1 ? [x05, domain[0]] : i3 >= n3 ? [domain[n3 - 1], x12] : [domain[i3 - 1], domain[i3]];
34967 scale.unknown = function(_2) {
34968 return arguments.length ? (unknown = _2, scale) : scale;
34970 scale.thresholds = function() {
34971 return domain.slice();
34973 scale.copy = function() {
34974 return quantize().domain([x05, x12]).range(range3).unknown(unknown);
34976 return initRange.apply(linearish(scale), arguments);
34979 // modules/behavior/breathe.js
34980 function behaviorBreathe() {
34981 var duration = 800;
34983 var selector = ".selected.shadow, .selected .shadow";
34984 var _selected = select_default2(null);
34989 function ratchetyInterpolator(a2, b2, steps2, units) {
34992 var sample = quantize().domain([0, 1]).range(quantize_default(number_default(a2, b2), steps2));
34993 return function(t2) {
34994 return String(sample(t2)) + (units || "");
34997 function reset(selection2) {
34998 selection2.style("stroke-opacity", null).style("stroke-width", null).style("fill-opacity", null).style("r", null);
35000 function setAnimationParams(transition2, fromTo) {
35001 var toFrom = fromTo === "from" ? "to" : "from";
35002 transition2.styleTween("stroke-opacity", function(d2) {
35003 return ratchetyInterpolator(
35004 _params[d2.id][toFrom].opacity,
35005 _params[d2.id][fromTo].opacity,
35008 }).styleTween("stroke-width", function(d2) {
35009 return ratchetyInterpolator(
35010 _params[d2.id][toFrom].width,
35011 _params[d2.id][fromTo].width,
35015 }).styleTween("fill-opacity", function(d2) {
35016 return ratchetyInterpolator(
35017 _params[d2.id][toFrom].opacity,
35018 _params[d2.id][fromTo].opacity,
35021 }).styleTween("r", function(d2) {
35022 return ratchetyInterpolator(
35023 _params[d2.id][toFrom].width,
35024 _params[d2.id][fromTo].width,
35030 function calcAnimationParams(selection2) {
35031 selection2.call(reset).each(function(d2) {
35032 var s2 = select_default2(this);
35033 var tag2 = s2.node().tagName;
35034 var p2 = { "from": {}, "to": {} };
35037 if (tag2 === "circle") {
35038 opacity = Number(s2.style("fill-opacity") || 0.5);
35039 width = Number(s2.style("r") || 15.5);
35041 opacity = Number(s2.style("stroke-opacity") || 0.7);
35042 width = Number(s2.style("stroke-width") || 10);
35045 p2.from.opacity = opacity * 0.6;
35046 p2.to.opacity = opacity * 1.25;
35047 p2.from.width = width * 0.7;
35048 p2.to.width = width * (tag2 === "circle" ? 1.5 : 1);
35049 _params[d2.id] = p2;
35052 function run(surface, fromTo) {
35053 var toFrom = fromTo === "from" ? "to" : "from";
35054 var currSelected = surface.selectAll(selector);
35055 var currClassed = surface.attr("class");
35056 if (_done || currSelected.empty()) {
35057 _selected.call(reset);
35058 _selected = select_default2(null);
35061 if (!(0, import_fast_deep_equal2.default)(currSelected.data(), _selected.data()) || currClassed !== _classed) {
35062 _selected.call(reset);
35063 _classed = currClassed;
35064 _selected = currSelected.call(calcAnimationParams);
35066 var didCallNextRun = false;
35067 _selected.transition().duration(duration).call(setAnimationParams, fromTo).on("end", function() {
35068 if (!didCallNextRun) {
35069 surface.call(run, toFrom);
35070 didCallNextRun = true;
35072 if (!select_default2(this).classed("selected")) {
35073 reset(select_default2(this));
35077 function behavior(surface) {
35079 _timer = timer(function() {
35080 if (surface.selectAll(selector).empty()) {
35083 surface.call(run, "from");
35088 behavior.restartIfNeeded = function(surface) {
35089 if (_selected.empty()) {
35090 surface.call(run, "from");
35096 behavior.off = function() {
35101 _selected.interrupt().call(reset);
35106 // modules/behavior/operation.js
35107 function behaviorOperation(context) {
35109 function keypress(d3_event) {
35110 if (!context.map().withinEditableZoom()) return;
35111 if (_operation.availableForKeypress && !_operation.availableForKeypress()) return;
35112 d3_event.preventDefault();
35113 var disabled = _operation.disabled();
35115 context.ui().flash.duration(4e3).iconName("#iD-operation-" + _operation.id).iconClass("operation disabled").label(_operation.tooltip())();
35117 context.ui().flash.duration(2e3).iconName("#iD-operation-" + _operation.id).iconClass("operation").label(_operation.annotation() || _operation.title)();
35118 if (_operation.point) _operation.point(null);
35122 function behavior() {
35123 if (_operation && _operation.available()) {
35124 context.keybinding().on(_operation.keys, keypress);
35128 behavior.off = function() {
35129 context.keybinding().off(_operation.keys);
35131 behavior.which = function(_2) {
35132 if (!arguments.length) return _operation;
35139 // modules/operations/circularize.js
35140 function operationCircularize(context, selectedIDs) {
35142 var _actions = selectedIDs.map(getAction).filter(Boolean);
35143 var _amount = _actions.length === 1 ? "single" : "multiple";
35144 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35147 function getAction(entityID) {
35148 var entity = context.entity(entityID);
35149 if (entity.type !== "way" || new Set(entity.nodes).size <= 1) return null;
35151 _extent = entity.extent(context.graph());
35153 _extent = _extent.extend(entity.extent(context.graph()));
35155 return actionCircularize(entityID, context.projection);
35157 var operation2 = function() {
35158 if (!_actions.length) return;
35159 var combinedAction = function(graph, t2) {
35160 _actions.forEach(function(action) {
35161 if (!action.disabled(graph)) {
35162 graph = action(graph, t2);
35167 combinedAction.transitionable = true;
35168 context.perform(combinedAction, operation2.annotation());
35169 window.setTimeout(function() {
35170 context.validator().validate();
35173 operation2.available = function() {
35174 return _actions.length && selectedIDs.length === _actions.length;
35176 operation2.disabled = function() {
35177 if (!_actions.length) return "";
35178 var actionDisableds = _actions.map(function(action) {
35179 return action.disabled(context.graph());
35180 }).filter(Boolean);
35181 if (actionDisableds.length === _actions.length) {
35182 if (new Set(actionDisableds).size > 1) {
35183 return "multiple_blockers";
35185 return actionDisableds[0];
35186 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
35187 return "too_large";
35188 } else if (someMissing()) {
35189 return "not_downloaded";
35190 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35191 return "connected_to_hidden";
35194 function someMissing() {
35195 if (context.inIntro()) return false;
35196 var osm = context.connection();
35198 var missing = _coords.filter(function(loc) {
35199 return !osm.isDataLoaded(loc);
35201 if (missing.length) {
35202 missing.forEach(function(loc) {
35203 context.loadTileAtLoc(loc);
35211 operation2.tooltip = function() {
35212 var disable = operation2.disabled();
35213 return disable ? _t.append("operations.circularize." + disable + "." + _amount) : _t.append("operations.circularize.description." + _amount);
35215 operation2.annotation = function() {
35216 return _t("operations.circularize.annotation.feature", { n: _actions.length });
35218 operation2.id = "circularize";
35219 operation2.keys = [_t("operations.circularize.key")];
35220 operation2.title = _t.append("operations.circularize.title");
35221 operation2.behavior = behaviorOperation(context).which(operation2);
35225 // modules/ui/cmd.js
35226 var uiCmd = function(code) {
35227 var detected = utilDetect();
35228 if (detected.os === "mac") {
35231 if (detected.os === "win") {
35232 if (code === "\u2318\u21E7Z") return "Ctrl+Y";
35234 var result = "", replacements = {
35238 "\u232B": "Backspace",
35241 for (var i3 = 0; i3 < code.length; i3++) {
35242 if (code[i3] in replacements) {
35243 result += replacements[code[i3]] + (i3 < code.length - 1 ? "+" : "");
35245 result += code[i3];
35250 uiCmd.display = function(code) {
35251 if (code.length !== 1) return code;
35252 var detected = utilDetect();
35253 var mac = detected.os === "mac";
35254 var replacements = {
35255 "\u2318": mac ? "\u2318 " + _t("shortcuts.key.cmd") : _t("shortcuts.key.ctrl"),
35256 "\u21E7": mac ? "\u21E7 " + _t("shortcuts.key.shift") : _t("shortcuts.key.shift"),
35257 "\u2325": mac ? "\u2325 " + _t("shortcuts.key.option") : _t("shortcuts.key.alt"),
35258 "\u2303": mac ? "\u2303 " + _t("shortcuts.key.ctrl") : _t("shortcuts.key.ctrl"),
35259 "\u232B": mac ? "\u232B " + _t("shortcuts.key.delete") : _t("shortcuts.key.backspace"),
35260 "\u2326": mac ? "\u2326 " + _t("shortcuts.key.del") : _t("shortcuts.key.del"),
35261 "\u2196": mac ? "\u2196 " + _t("shortcuts.key.pgup") : _t("shortcuts.key.pgup"),
35262 "\u2198": mac ? "\u2198 " + _t("shortcuts.key.pgdn") : _t("shortcuts.key.pgdn"),
35263 "\u21DE": mac ? "\u21DE " + _t("shortcuts.key.home") : _t("shortcuts.key.home"),
35264 "\u21DF": mac ? "\u21DF " + _t("shortcuts.key.end") : _t("shortcuts.key.end"),
35265 "\u21B5": mac ? "\u23CE " + _t("shortcuts.key.return") : _t("shortcuts.key.enter"),
35266 "\u238B": mac ? "\u238B " + _t("shortcuts.key.esc") : _t("shortcuts.key.esc"),
35267 "\u2630": mac ? "\u2630 " + _t("shortcuts.key.menu") : _t("shortcuts.key.menu")
35269 return replacements[code] || code;
35272 // modules/operations/delete.js
35273 function operationDelete(context, selectedIDs) {
35274 var multi = selectedIDs.length === 1 ? "single" : "multiple";
35275 var action = actionDeleteMultiple(selectedIDs);
35276 var nodes = utilGetAllNodes(selectedIDs, context.graph());
35277 var coords = nodes.map(function(n3) {
35280 var extent = utilTotalExtent(selectedIDs, context.graph());
35281 var operation2 = function() {
35282 var nextSelectedID;
35283 var nextSelectedLoc;
35284 if (selectedIDs.length === 1) {
35285 var id2 = selectedIDs[0];
35286 var entity = context.entity(id2);
35287 var geometry = entity.geometry(context.graph());
35288 var parents = context.graph().parentWays(entity);
35289 var parent = parents[0];
35290 if (geometry === "vertex") {
35291 var nodes2 = parent.nodes;
35292 var i3 = nodes2.indexOf(id2);
35295 } else if (i3 === nodes2.length - 1) {
35298 var a2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 - 1]).loc);
35299 var b2 = geoSphericalDistance(entity.loc, context.entity(nodes2[i3 + 1]).loc);
35300 i3 = a2 < b2 ? i3 - 1 : i3 + 1;
35302 nextSelectedID = nodes2[i3];
35303 nextSelectedLoc = context.entity(nextSelectedID).loc;
35306 context.perform(action, operation2.annotation());
35307 context.validator().validate();
35308 if (nextSelectedID && nextSelectedLoc) {
35309 if (context.hasEntity(nextSelectedID)) {
35310 context.enter(modeSelect(context, [nextSelectedID]).follow(true));
35312 context.map().centerEase(nextSelectedLoc);
35313 context.enter(modeBrowse(context));
35316 context.enter(modeBrowse(context));
35319 operation2.available = function() {
35322 operation2.disabled = function() {
35323 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35324 return "too_large";
35325 } else if (someMissing()) {
35326 return "not_downloaded";
35327 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35328 return "connected_to_hidden";
35329 } else if (selectedIDs.some(protectedMember)) {
35330 return "part_of_relation";
35331 } else if (selectedIDs.some(incompleteRelation)) {
35332 return "incomplete_relation";
35333 } else if (selectedIDs.some(hasWikidataTag)) {
35334 return "has_wikidata_tag";
35337 function someMissing() {
35338 if (context.inIntro()) return false;
35339 var osm = context.connection();
35341 var missing = coords.filter(function(loc) {
35342 return !osm.isDataLoaded(loc);
35344 if (missing.length) {
35345 missing.forEach(function(loc) {
35346 context.loadTileAtLoc(loc);
35353 function hasWikidataTag(id2) {
35354 var entity = context.entity(id2);
35355 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
35357 function incompleteRelation(id2) {
35358 var entity = context.entity(id2);
35359 return entity.type === "relation" && !entity.isComplete(context.graph());
35361 function protectedMember(id2) {
35362 var entity = context.entity(id2);
35363 if (entity.type !== "way") return false;
35364 var parents = context.graph().parentRelations(entity);
35365 for (var i3 = 0; i3 < parents.length; i3++) {
35366 var parent = parents[i3];
35367 var type2 = parent.tags.type;
35368 var role = parent.memberById(id2).role || "outer";
35369 if (type2 === "route" || type2 === "boundary" || type2 === "multipolygon" && role === "outer") {
35376 operation2.tooltip = function() {
35377 var disable = operation2.disabled();
35378 return disable ? _t.append("operations.delete." + disable + "." + multi) : _t.append("operations.delete.description." + multi);
35380 operation2.annotation = function() {
35381 return selectedIDs.length === 1 ? _t("operations.delete.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.delete.annotation.feature", { n: selectedIDs.length });
35383 operation2.id = "delete";
35384 operation2.keys = [uiCmd("\u2318\u232B"), uiCmd("\u2318\u2326"), uiCmd("\u2326")];
35385 operation2.title = _t.append("operations.delete.title");
35386 operation2.behavior = behaviorOperation(context).which(operation2);
35390 // modules/operations/orthogonalize.js
35391 function operationOrthogonalize(context, selectedIDs) {
35394 var _actions = selectedIDs.map(chooseAction).filter(Boolean);
35395 var _amount = _actions.length === 1 ? "single" : "multiple";
35396 var _coords = utilGetAllNodes(selectedIDs, context.graph()).map(function(n3) {
35399 function chooseAction(entityID) {
35400 var entity = context.entity(entityID);
35401 var geometry = entity.geometry(context.graph());
35403 _extent = entity.extent(context.graph());
35405 _extent = _extent.extend(entity.extent(context.graph()));
35407 if (entity.type === "way" && new Set(entity.nodes).size > 2) {
35408 if (_type && _type !== "feature") return null;
35410 return actionOrthogonalize(entityID, context.projection);
35411 } else if (geometry === "vertex") {
35412 if (_type && _type !== "corner") return null;
35414 var graph = context.graph();
35415 var parents = graph.parentWays(entity);
35416 if (parents.length === 1) {
35417 var way = parents[0];
35418 if (way.nodes.indexOf(entityID) !== -1) {
35419 return actionOrthogonalize(way.id, context.projection, entityID);
35425 var operation2 = function() {
35426 if (!_actions.length) return;
35427 var combinedAction = function(graph, t2) {
35428 _actions.forEach(function(action) {
35429 if (!action.disabled(graph)) {
35430 graph = action(graph, t2);
35435 combinedAction.transitionable = true;
35436 context.perform(combinedAction, operation2.annotation());
35437 window.setTimeout(function() {
35438 context.validator().validate();
35441 operation2.available = function() {
35442 return _actions.length && selectedIDs.length === _actions.length;
35444 operation2.disabled = function() {
35445 if (!_actions.length) return "";
35446 var actionDisableds = _actions.map(function(action) {
35447 return action.disabled(context.graph());
35448 }).filter(Boolean);
35449 if (actionDisableds.length === _actions.length) {
35450 if (new Set(actionDisableds).size > 1) {
35451 return "multiple_blockers";
35453 return actionDisableds[0];
35454 } else if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
35455 return "too_large";
35456 } else if (someMissing()) {
35457 return "not_downloaded";
35458 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35459 return "connected_to_hidden";
35462 function someMissing() {
35463 if (context.inIntro()) return false;
35464 var osm = context.connection();
35466 var missing = _coords.filter(function(loc) {
35467 return !osm.isDataLoaded(loc);
35469 if (missing.length) {
35470 missing.forEach(function(loc) {
35471 context.loadTileAtLoc(loc);
35479 operation2.tooltip = function() {
35480 var disable = operation2.disabled();
35481 return disable ? _t.append("operations.orthogonalize." + disable + "." + _amount) : _t.append("operations.orthogonalize.description." + _type + "." + _amount);
35483 operation2.annotation = function() {
35484 return _t("operations.orthogonalize.annotation." + _type, { n: _actions.length });
35486 operation2.id = "orthogonalize";
35487 operation2.keys = [_t("operations.orthogonalize.key")];
35488 operation2.title = _t.append("operations.orthogonalize.title");
35489 operation2.behavior = behaviorOperation(context).which(operation2);
35493 // modules/operations/reflect.js
35494 function operationReflectShort(context, selectedIDs) {
35495 return operationReflect(context, selectedIDs, "short");
35497 function operationReflectLong(context, selectedIDs) {
35498 return operationReflect(context, selectedIDs, "long");
35500 function operationReflect(context, selectedIDs, axis) {
35501 axis = axis || "long";
35502 var multi = selectedIDs.length === 1 ? "single" : "multiple";
35503 var nodes = utilGetAllNodes(selectedIDs, context.graph());
35504 var coords = nodes.map(function(n3) {
35507 var extent = utilTotalExtent(selectedIDs, context.graph());
35508 var operation2 = function() {
35509 var action = actionReflect(selectedIDs, context.projection).useLongAxis(Boolean(axis === "long"));
35510 context.perform(action, operation2.annotation());
35511 window.setTimeout(function() {
35512 context.validator().validate();
35515 operation2.available = function() {
35516 return nodes.length >= 3;
35518 operation2.disabled = function() {
35519 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35520 return "too_large";
35521 } else if (someMissing()) {
35522 return "not_downloaded";
35523 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35524 return "connected_to_hidden";
35525 } else if (selectedIDs.some(incompleteRelation)) {
35526 return "incomplete_relation";
35529 function someMissing() {
35530 if (context.inIntro()) return false;
35531 var osm = context.connection();
35533 var missing = coords.filter(function(loc) {
35534 return !osm.isDataLoaded(loc);
35536 if (missing.length) {
35537 missing.forEach(function(loc) {
35538 context.loadTileAtLoc(loc);
35545 function incompleteRelation(id2) {
35546 var entity = context.entity(id2);
35547 return entity.type === "relation" && !entity.isComplete(context.graph());
35550 operation2.tooltip = function() {
35551 var disable = operation2.disabled();
35552 return disable ? _t.append("operations.reflect." + disable + "." + multi) : _t.append("operations.reflect.description." + axis + "." + multi);
35554 operation2.annotation = function() {
35555 return _t("operations.reflect.annotation." + axis + ".feature", { n: selectedIDs.length });
35557 operation2.id = "reflect-" + axis;
35558 operation2.keys = [_t("operations.reflect.key." + axis)];
35559 operation2.title = _t.append("operations.reflect.title." + axis);
35560 operation2.behavior = behaviorOperation(context).which(operation2);
35564 // modules/operations/move.js
35565 function operationMove(context, selectedIDs) {
35566 var multi = selectedIDs.length === 1 ? "single" : "multiple";
35567 var nodes = utilGetAllNodes(selectedIDs, context.graph());
35568 var coords = nodes.map(function(n3) {
35571 var extent = utilTotalExtent(selectedIDs, context.graph());
35572 var operation2 = function() {
35573 context.enter(modeMove(context, selectedIDs));
35575 operation2.available = function() {
35576 return selectedIDs.length > 0;
35578 operation2.disabled = function() {
35579 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35580 return "too_large";
35581 } else if (someMissing()) {
35582 return "not_downloaded";
35583 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35584 return "connected_to_hidden";
35585 } else if (selectedIDs.some(incompleteRelation)) {
35586 return "incomplete_relation";
35589 function someMissing() {
35590 if (context.inIntro()) return false;
35591 var osm = context.connection();
35593 var missing = coords.filter(function(loc) {
35594 return !osm.isDataLoaded(loc);
35596 if (missing.length) {
35597 missing.forEach(function(loc) {
35598 context.loadTileAtLoc(loc);
35605 function incompleteRelation(id2) {
35606 var entity = context.entity(id2);
35607 return entity.type === "relation" && !entity.isComplete(context.graph());
35610 operation2.tooltip = function() {
35611 var disable = operation2.disabled();
35612 return disable ? _t.append("operations.move." + disable + "." + multi) : _t.append("operations.move.description." + multi);
35614 operation2.annotation = function() {
35615 return selectedIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.move.annotation.feature", { n: selectedIDs.length });
35617 operation2.id = "move";
35618 operation2.keys = [_t("operations.move.key")];
35619 operation2.title = _t.append("operations.move.title");
35620 operation2.behavior = behaviorOperation(context).which(operation2);
35621 operation2.mouseOnly = true;
35625 // modules/modes/rotate.js
35626 function modeRotate(context, entityIDs) {
35627 var _tolerancePx = 4;
35632 var keybinding = utilKeybinding("rotate");
35634 behaviorEdit(context),
35635 operationCircularize(context, entityIDs).behavior,
35636 operationDelete(context, entityIDs).behavior,
35637 operationMove(context, entityIDs).behavior,
35638 operationOrthogonalize(context, entityIDs).behavior,
35639 operationReflectLong(context, entityIDs).behavior,
35640 operationReflectShort(context, entityIDs).behavior
35642 var annotation = entityIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.rotate.annotation.feature", { n: entityIDs.length });
35645 var _prevTransform;
35647 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35648 function doRotate(d3_event) {
35650 if (context.graph() !== _prevGraph) {
35651 fn = context.perform;
35653 fn = context.replace;
35655 var projection2 = context.projection;
35656 var currTransform = projection2.transform();
35657 if (!_prevTransform || currTransform.k !== _prevTransform.k || currTransform.x !== _prevTransform.x || currTransform.y !== _prevTransform.y) {
35658 var nodes = utilGetAllNodes(entityIDs, context.graph());
35659 var points = nodes.map(function(n3) {
35660 return projection2(n3.loc);
35662 _pivot = getPivot(points);
35663 _prevAngle = void 0;
35665 var currMouse = context.map().mouse(d3_event);
35666 var currAngle = Math.atan2(currMouse[1] - _pivot[1], currMouse[0] - _pivot[0]);
35667 if (typeof _prevAngle === "undefined") _prevAngle = currAngle;
35668 var delta = currAngle - _prevAngle;
35669 fn(actionRotate(entityIDs, _pivot, delta, projection2));
35670 _prevTransform = currTransform;
35671 _prevAngle = currAngle;
35672 _prevGraph = context.graph();
35674 function getPivot(points) {
35676 if (points.length === 1) {
35677 _pivot2 = points[0];
35678 } else if (points.length === 2) {
35679 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35681 var polygonHull = hull_default(points);
35682 if (polygonHull.length === 2) {
35683 _pivot2 = geoVecInterp(points[0], points[1], 0.5);
35685 _pivot2 = centroid_default2(hull_default(points));
35690 function finish(d3_event) {
35691 d3_event.stopPropagation();
35692 context.replace(actionNoop(), annotation);
35693 context.enter(modeSelect(context, entityIDs));
35695 function cancel() {
35696 if (_prevGraph) context.pop();
35697 context.enter(modeSelect(context, entityIDs));
35699 function undone() {
35700 context.enter(modeBrowse(context));
35702 mode.enter = function() {
35704 context.features().forceVisible(entityIDs);
35705 behaviors.forEach(context.install);
35707 context.surface().on(_pointerPrefix + "down.modeRotate", function(d3_event) {
35708 downEvent = d3_event;
35710 select_default2(window).on(_pointerPrefix + "move.modeRotate", doRotate, true).on(_pointerPrefix + "up.modeRotate", function(d3_event) {
35711 if (!downEvent) return;
35712 var mapNode = context.container().select(".main-map").node();
35713 var pointGetter = utilFastMouse(mapNode);
35714 var p1 = pointGetter(downEvent);
35715 var p2 = pointGetter(d3_event);
35716 var dist = geoVecLength(p1, p2);
35717 if (dist <= _tolerancePx) finish(d3_event);
35720 context.history().on("undone.modeRotate", undone);
35721 keybinding.on("\u238B", cancel).on("\u21A9", finish);
35722 select_default2(document).call(keybinding);
35724 mode.exit = function() {
35725 behaviors.forEach(context.uninstall);
35726 context.surface().on(_pointerPrefix + "down.modeRotate", null);
35727 select_default2(window).on(_pointerPrefix + "move.modeRotate", null, true).on(_pointerPrefix + "up.modeRotate", null, true);
35728 context.history().on("undone.modeRotate", null);
35729 select_default2(document).call(keybinding.unbind);
35730 context.features().forceVisible([]);
35732 mode.selectedIDs = function() {
35733 if (!arguments.length) return entityIDs;
35739 // modules/operations/rotate.js
35740 function operationRotate(context, selectedIDs) {
35741 var multi = selectedIDs.length === 1 ? "single" : "multiple";
35742 var nodes = utilGetAllNodes(selectedIDs, context.graph());
35743 var coords = nodes.map(function(n3) {
35746 var extent = utilTotalExtent(selectedIDs, context.graph());
35747 var operation2 = function() {
35748 context.enter(modeRotate(context, selectedIDs));
35750 operation2.available = function() {
35751 return nodes.length >= 2;
35753 operation2.disabled = function() {
35754 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
35755 return "too_large";
35756 } else if (someMissing()) {
35757 return "not_downloaded";
35758 } else if (selectedIDs.some(context.hasHiddenConnections)) {
35759 return "connected_to_hidden";
35760 } else if (selectedIDs.some(incompleteRelation)) {
35761 return "incomplete_relation";
35764 function someMissing() {
35765 if (context.inIntro()) return false;
35766 var osm = context.connection();
35768 var missing = coords.filter(function(loc) {
35769 return !osm.isDataLoaded(loc);
35771 if (missing.length) {
35772 missing.forEach(function(loc) {
35773 context.loadTileAtLoc(loc);
35780 function incompleteRelation(id2) {
35781 var entity = context.entity(id2);
35782 return entity.type === "relation" && !entity.isComplete(context.graph());
35785 operation2.tooltip = function() {
35786 var disable = operation2.disabled();
35787 return disable ? _t.append("operations.rotate." + disable + "." + multi) : _t.append("operations.rotate.description." + multi);
35789 operation2.annotation = function() {
35790 return selectedIDs.length === 1 ? _t("operations.rotate.annotation." + context.graph().geometry(selectedIDs[0])) : _t("operations.rotate.annotation.feature", { n: selectedIDs.length });
35792 operation2.id = "rotate";
35793 operation2.keys = [_t("operations.rotate.key")];
35794 operation2.title = _t.append("operations.rotate.title");
35795 operation2.behavior = behaviorOperation(context).which(operation2);
35796 operation2.mouseOnly = true;
35800 // modules/modes/move.js
35801 function modeMove(context, entityIDs, baseGraph) {
35802 var _tolerancePx = 4;
35807 var keybinding = utilKeybinding("move");
35809 behaviorEdit(context),
35810 operationCircularize(context, entityIDs).behavior,
35811 operationDelete(context, entityIDs).behavior,
35812 operationOrthogonalize(context, entityIDs).behavior,
35813 operationReflectLong(context, entityIDs).behavior,
35814 operationReflectShort(context, entityIDs).behavior,
35815 operationRotate(context, entityIDs).behavior
35817 var annotation = entityIDs.length === 1 ? _t("operations.move.annotation." + context.graph().geometry(entityIDs[0])) : _t("operations.move.annotation.feature", { n: entityIDs.length });
35821 var _nudgeInterval;
35822 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35823 function doMove(nudge) {
35824 nudge = nudge || [0, 0];
35826 if (_prevGraph !== context.graph()) {
35828 _origin = context.map().mouseCoordinates();
35829 fn = context.perform;
35831 fn = context.overwrite;
35833 var currMouse = context.map().mouse();
35834 var origMouse = context.projection(_origin);
35835 var delta = geoVecSubtract(geoVecSubtract(currMouse, origMouse), nudge);
35836 fn(actionMove(entityIDs, delta, context.projection, _cache5));
35837 _prevGraph = context.graph();
35839 function startNudge(nudge) {
35840 if (_nudgeInterval) window.clearInterval(_nudgeInterval);
35841 _nudgeInterval = window.setInterval(function() {
35842 context.map().pan(nudge);
35846 function stopNudge() {
35847 if (_nudgeInterval) {
35848 window.clearInterval(_nudgeInterval);
35849 _nudgeInterval = null;
35854 var nudge = geoViewportEdge(context.map().mouse(), context.map().dimensions());
35861 function finish(d3_event) {
35862 d3_event.stopPropagation();
35863 context.replace(actionNoop(), annotation);
35864 context.enter(modeSelect(context, entityIDs));
35867 function cancel() {
35869 while (context.graph() !== baseGraph) context.pop();
35870 context.enter(modeBrowse(context));
35872 if (_prevGraph) context.pop();
35873 context.enter(modeSelect(context, entityIDs));
35877 function undone() {
35878 context.enter(modeBrowse(context));
35880 mode.enter = function() {
35881 _origin = context.map().mouseCoordinates();
35884 context.features().forceVisible(entityIDs);
35885 behaviors.forEach(context.install);
35887 context.surface().on(_pointerPrefix + "down.modeMove", function(d3_event) {
35888 downEvent = d3_event;
35890 select_default2(window).on(_pointerPrefix + "move.modeMove", move, true).on(_pointerPrefix + "up.modeMove", function(d3_event) {
35891 if (!downEvent) return;
35892 var mapNode = context.container().select(".main-map").node();
35893 var pointGetter = utilFastMouse(mapNode);
35894 var p1 = pointGetter(downEvent);
35895 var p2 = pointGetter(d3_event);
35896 var dist = geoVecLength(p1, p2);
35897 if (dist <= _tolerancePx) finish(d3_event);
35900 context.history().on("undone.modeMove", undone);
35901 keybinding.on("\u238B", cancel).on("\u21A9", finish);
35902 select_default2(document).call(keybinding);
35904 mode.exit = function() {
35906 behaviors.forEach(function(behavior) {
35907 context.uninstall(behavior);
35909 context.surface().on(_pointerPrefix + "down.modeMove", null);
35910 select_default2(window).on(_pointerPrefix + "move.modeMove", null, true).on(_pointerPrefix + "up.modeMove", null, true);
35911 context.history().on("undone.modeMove", null);
35912 select_default2(document).call(keybinding.unbind);
35913 context.features().forceVisible([]);
35915 mode.selectedIDs = function() {
35916 if (!arguments.length) return entityIDs;
35922 // modules/behavior/paste.js
35923 function behaviorPaste(context) {
35924 function doPaste(d3_event) {
35925 if (!context.map().withinEditableZoom()) return;
35926 d3_event.preventDefault();
35927 var baseGraph = context.graph();
35928 var mouse = context.map().mouse();
35929 var projection2 = context.projection;
35930 var viewport = geoExtent(projection2.clipExtent()).polygon();
35931 if (!geoPointInPolygon(mouse, viewport)) return;
35932 var oldIDs = context.copyIDs();
35933 if (!oldIDs.length) return;
35934 var extent = geoExtent();
35935 var oldGraph = context.copyGraph();
35937 var action = actionCopyEntities(oldIDs, oldGraph);
35938 context.perform(action);
35939 var copies = action.copies();
35940 var originals = /* @__PURE__ */ new Set();
35941 Object.values(copies).forEach(function(entity) {
35942 originals.add(entity.id);
35944 for (var id2 in copies) {
35945 var oldEntity = oldGraph.entity(id2);
35946 var newEntity = copies[id2];
35947 extent._extend(oldEntity.extent(oldGraph));
35948 var parents = context.graph().parentWays(newEntity);
35949 var parentCopied = parents.some(function(parent) {
35950 return originals.has(parent.id);
35952 if (!parentCopied) {
35953 newIDs.push(newEntity.id);
35956 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
35957 var delta = geoVecSubtract(mouse, copyPoint);
35958 context.perform(actionMove(newIDs, delta, projection2));
35959 context.enter(modeMove(context, newIDs, baseGraph));
35961 function behavior() {
35962 context.keybinding().on(uiCmd("\u2318V"), doPaste);
35965 behavior.off = function() {
35966 context.keybinding().off(uiCmd("\u2318V"));
35971 // modules/behavior/drag.js
35972 function behaviorDrag() {
35973 var dispatch14 = dispatch_default("start", "move", "end");
35974 var _tolerancePx = 1;
35975 var _penTolerancePx = 4;
35976 var _origin = null;
35977 var _selector = "";
35982 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
35983 var d3_event_userSelectProperty = utilPrefixCSSProperty("UserSelect");
35984 var d3_event_userSelectSuppress = function() {
35985 var selection2 = selection_default();
35986 var select = selection2.style(d3_event_userSelectProperty);
35987 selection2.style(d3_event_userSelectProperty, "none");
35988 return function() {
35989 selection2.style(d3_event_userSelectProperty, select);
35992 function pointerdown(d3_event) {
35993 if (_pointerId) return;
35994 _pointerId = d3_event.pointerId || "mouse";
35995 _targetNode = this;
35996 var pointerLocGetter = utilFastMouse(_surface || _targetNode.parentNode);
35998 var startOrigin = pointerLocGetter(d3_event);
35999 var started = false;
36000 var selectEnable = d3_event_userSelectSuppress();
36001 select_default2(window).on(_pointerPrefix + "move.drag", pointermove).on(_pointerPrefix + "up.drag pointercancel.drag", pointerup, true);
36003 offset = _origin.call(_targetNode, _targetEntity);
36004 offset = [offset[0] - startOrigin[0], offset[1] - startOrigin[1]];
36008 d3_event.stopPropagation();
36009 function pointermove(d3_event2) {
36010 if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36011 var p2 = pointerLocGetter(d3_event2);
36013 var dist = geoVecLength(startOrigin, p2);
36014 var tolerance = d3_event2.pointerType === "pen" ? _penTolerancePx : _tolerancePx;
36015 if (dist < tolerance) return;
36017 dispatch14.call("start", this, d3_event2, _targetEntity);
36020 d3_event2.stopPropagation();
36021 d3_event2.preventDefault();
36022 var dx = p2[0] - startOrigin[0];
36023 var dy = p2[1] - startOrigin[1];
36024 dispatch14.call("move", this, d3_event2, _targetEntity, [p2[0] + offset[0], p2[1] + offset[1]], [dx, dy]);
36027 function pointerup(d3_event2) {
36028 if (_pointerId !== (d3_event2.pointerId || "mouse")) return;
36031 dispatch14.call("end", this, d3_event2, _targetEntity);
36032 d3_event2.preventDefault();
36034 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36038 function behavior(selection2) {
36039 var matchesSelector = utilPrefixDOMProperty("matchesSelector");
36040 var delegate = pointerdown;
36042 delegate = function(d3_event) {
36044 var target = d3_event.target;
36045 for (; target && target !== root3; target = target.parentNode) {
36046 var datum2 = target.__data__;
36047 _targetEntity = datum2 instanceof osmNote ? datum2 : datum2 && datum2.properties && datum2.properties.entity;
36048 if (_targetEntity && target[matchesSelector](_selector)) {
36049 return pointerdown.call(target, d3_event);
36054 selection2.on(_pointerPrefix + "down.drag" + _selector, delegate);
36056 behavior.off = function(selection2) {
36057 selection2.on(_pointerPrefix + "down.drag" + _selector, null);
36059 behavior.selector = function(_2) {
36060 if (!arguments.length) return _selector;
36064 behavior.origin = function(_2) {
36065 if (!arguments.length) return _origin;
36069 behavior.cancel = function() {
36070 select_default2(window).on(_pointerPrefix + "move.drag", null).on(_pointerPrefix + "up.drag pointercancel.drag", null);
36073 behavior.targetNode = function(_2) {
36074 if (!arguments.length) return _targetNode;
36078 behavior.targetEntity = function(_2) {
36079 if (!arguments.length) return _targetEntity;
36080 _targetEntity = _2;
36083 behavior.surface = function(_2) {
36084 if (!arguments.length) return _surface;
36088 return utilRebind(behavior, dispatch14, "on");
36091 // modules/modes/drag_node.js
36092 function modeDragNode(context) {
36097 var hover = behaviorHover(context).altDisables(true).on("hover", context.ui().sidebar.hover);
36098 var edit2 = behaviorEdit(context);
36099 var _nudgeInterval;
36100 var _restoreSelectedIDs = [];
36101 var _wasMidpoint = false;
36102 var _isCancelled = false;
36106 function startNudge(d3_event, entity, nudge) {
36107 if (_nudgeInterval) window.clearInterval(_nudgeInterval);
36108 _nudgeInterval = window.setInterval(function() {
36109 context.map().pan(nudge);
36110 doMove(d3_event, entity, nudge);
36113 function stopNudge() {
36114 if (_nudgeInterval) {
36115 window.clearInterval(_nudgeInterval);
36116 _nudgeInterval = null;
36119 function moveAnnotation(entity) {
36120 return _t("operations.move.annotation." + entity.geometry(context.graph()));
36122 function connectAnnotation(nodeEntity, targetEntity) {
36123 var nodeGeometry = nodeEntity.geometry(context.graph());
36124 var targetGeometry = targetEntity.geometry(context.graph());
36125 if (nodeGeometry === "vertex" && targetGeometry === "vertex") {
36126 var nodeParentWayIDs = context.graph().parentWays(nodeEntity);
36127 var targetParentWayIDs = context.graph().parentWays(targetEntity);
36128 var sharedParentWays = utilArrayIntersection(nodeParentWayIDs, targetParentWayIDs);
36129 if (sharedParentWays.length !== 0) {
36130 if (sharedParentWays[0].areAdjacent(nodeEntity.id, targetEntity.id)) {
36131 return _t("operations.connect.annotation.from_vertex.to_adjacent_vertex");
36133 return _t("operations.connect.annotation.from_vertex.to_sibling_vertex");
36136 return _t("operations.connect.annotation.from_" + nodeGeometry + ".to_" + targetGeometry);
36138 function shouldSnapToNode(target) {
36139 if (!_activeEntity) return false;
36140 return _activeEntity.geometry(context.graph()) !== "vertex" || (target.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(target, context.graph()));
36142 function origin(entity) {
36143 return context.projection(entity.loc);
36145 function keydown(d3_event) {
36146 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36147 if (context.surface().classed("nope")) {
36148 context.surface().classed("nope-suppressed", true);
36150 context.surface().classed("nope", false).classed("nope-disabled", true);
36153 function keyup(d3_event) {
36154 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
36155 if (context.surface().classed("nope-suppressed")) {
36156 context.surface().classed("nope", true);
36158 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
36161 function start2(d3_event, entity) {
36162 _wasMidpoint = entity.type === "midpoint";
36163 var hasHidden = context.features().hasHiddenConnections(entity, context.graph());
36164 _isCancelled = !context.editable() || d3_event.shiftKey || hasHidden;
36165 if (_isCancelled) {
36167 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("modes.drag_node.connected_to_hidden"))();
36169 return drag.cancel();
36171 if (_wasMidpoint) {
36172 var midpoint = entity;
36173 entity = osmNode();
36174 context.perform(actionAddMidpoint(midpoint, entity));
36175 entity = context.entity(entity.id);
36176 var vertex = context.surface().selectAll("." + entity.id);
36177 drag.targetNode(vertex.node()).targetEntity(entity);
36179 context.perform(actionNoop());
36181 _activeEntity = entity;
36182 _startLoc = entity.loc;
36183 hover.ignoreVertex(entity.geometry(context.graph()) === "vertex");
36184 context.surface().selectAll("." + _activeEntity.id).classed("active", true);
36185 context.enter(mode);
36187 function datum2(d3_event) {
36188 if (!d3_event || d3_event.altKey) {
36191 var d2 = d3_event.target.__data__;
36192 return d2 && d2.properties && d2.properties.target ? d2 : {};
36195 function doMove(d3_event, entity, nudge) {
36196 nudge = nudge || [0, 0];
36197 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
36198 var currMouse = geoVecSubtract(currPoint, nudge);
36199 var loc = context.projection.invert(currMouse);
36201 if (!_nudgeInterval) {
36202 var d2 = datum2(d3_event);
36203 target = d2 && d2.properties && d2.properties.entity;
36204 var targetLoc = target && target.loc;
36205 var targetNodes = d2 && d2.properties && d2.properties.nodes;
36207 if (shouldSnapToNode(target)) {
36210 } else if (targetNodes) {
36211 edge = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, end.id);
36218 actionMoveNode(entity.id, loc)
36220 var isInvalid = false;
36222 isInvalid = hasRelationConflict(entity, target, edge, context.graph());
36225 isInvalid = hasInvalidGeometry(entity, context.graph());
36227 var nope = context.surface().classed("nope");
36228 if (isInvalid === "relation" || isInvalid === "restriction") {
36230 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append(
36231 "operations.connect." + isInvalid,
36232 { relation: _mainPresetIndex.item("type/restriction").name() }
36235 } else if (isInvalid) {
36236 var errorID = isInvalid === "line" ? "lines" : "areas";
36237 context.ui().flash.duration(3e3).iconName("#iD-icon-no").label(_t.append("self_intersection.error." + errorID))();
36240 context.ui().flash.duration(1).label("")();
36243 var nopeDisabled = context.surface().classed("nope-disabled");
36244 if (nopeDisabled) {
36245 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
36247 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
36251 function hasRelationConflict(entity, target, edge, graph) {
36252 var testGraph = graph.update();
36254 var midpoint = osmNode();
36255 var action = actionAddMidpoint({
36257 edge: [target.nodes[edge.index - 1], target.nodes[edge.index]]
36259 testGraph = action(testGraph);
36262 var ids = [entity.id, target.id];
36263 return actionConnect(ids).disabled(testGraph);
36265 function hasInvalidGeometry(entity, graph) {
36266 var parents = graph.parentWays(entity);
36268 for (i3 = 0; i3 < parents.length; i3++) {
36269 var parent = parents[i3];
36271 var activeIndex = null;
36272 var relations = graph.parentRelations(parent);
36273 for (j2 = 0; j2 < relations.length; j2++) {
36274 if (!relations[j2].isMultipolygon()) continue;
36275 var rings = osmJoinWays(relations[j2].members, graph);
36276 for (k2 = 0; k2 < rings.length; k2++) {
36277 nodes = rings[k2].nodes;
36278 if (nodes.find(function(n3) {
36279 return n3.id === entity.id;
36282 if (geoHasSelfIntersections(nodes, entity.id)) {
36283 return "multipolygonMember";
36286 rings[k2].coords = nodes.map(function(n3) {
36290 for (k2 = 0; k2 < rings.length; k2++) {
36291 if (k2 === activeIndex) continue;
36292 if (geoHasLineIntersections(rings[activeIndex].nodes, rings[k2].nodes, entity.id)) {
36293 return "multipolygonRing";
36297 if (activeIndex === null) {
36298 nodes = parent.nodes.map(function(nodeID) {
36299 return graph.entity(nodeID);
36301 if (nodes.length && geoHasSelfIntersections(nodes, entity.id)) {
36302 return parent.geometry(graph);
36308 function move(d3_event, entity, point) {
36309 if (_isCancelled) return;
36310 d3_event.stopPropagation();
36311 context.surface().classed("nope-disabled", d3_event.altKey);
36312 _lastLoc = context.projection.invert(point);
36313 doMove(d3_event, entity);
36314 var nudge = geoViewportEdge(point, context.map().dimensions());
36316 startNudge(d3_event, entity, nudge);
36321 function end(d3_event, entity) {
36322 if (_isCancelled) return;
36323 var wasPoint = entity.geometry(context.graph()) === "point";
36324 var d2 = datum2(d3_event);
36325 var nope = d2 && d2.properties && d2.properties.nope || context.surface().classed("nope");
36326 var target = d2 && d2.properties && d2.properties.entity;
36329 _actionBounceBack(entity.id, _startLoc)
36331 } else if (target && target.type === "way") {
36332 var choice = geoChooseEdge(context.graph().childNodes(target), context.map().mouse(), context.projection, entity.id);
36334 actionAddMidpoint({
36336 edge: [target.nodes[choice.index - 1], target.nodes[choice.index]]
36338 connectAnnotation(entity, target)
36340 } else if (target && target.type === "node" && shouldSnapToNode(target)) {
36342 actionConnect([target.id, entity.id]),
36343 connectAnnotation(entity, target)
36345 } else if (_wasMidpoint) {
36348 _t("operations.add.annotation.vertex")
36353 moveAnnotation(entity)
36357 context.enter(modeSelect(context, [entity.id]));
36359 var reselection = _restoreSelectedIDs.filter(function(id2) {
36360 return context.graph().hasEntity(id2);
36362 if (reselection.length) {
36363 context.enter(modeSelect(context, reselection));
36365 context.enter(modeBrowse(context));
36369 function _actionBounceBack(nodeID, toLoc) {
36370 var moveNode = actionMoveNode(nodeID, toLoc);
36371 var action = function(graph, t2) {
36372 if (t2 === 1) context.pop();
36373 return moveNode(graph, t2);
36375 action.transitionable = true;
36378 function cancel() {
36380 context.enter(modeBrowse(context));
36382 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);
36383 mode.enter = function() {
36384 context.install(hover);
36385 context.install(edit2);
36386 select_default2(window).on("keydown.dragNode", keydown).on("keyup.dragNode", keyup);
36387 context.history().on("undone.drag-node", cancel);
36389 mode.exit = function() {
36390 context.ui().sidebar.hover.cancel();
36391 context.uninstall(hover);
36392 context.uninstall(edit2);
36393 select_default2(window).on("keydown.dragNode", null).on("keyup.dragNode", null);
36394 context.history().on("undone.drag-node", null);
36395 _activeEntity = null;
36396 context.surface().classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false).selectAll(".active").classed("active", false);
36399 mode.selectedIDs = function() {
36400 if (!arguments.length) return _activeEntity ? [_activeEntity.id] : [];
36403 mode.activeID = function() {
36404 if (!arguments.length) return _activeEntity && _activeEntity.id;
36407 mode.restoreSelectedIDs = function(_2) {
36408 if (!arguments.length) return _restoreSelectedIDs;
36409 _restoreSelectedIDs = _2;
36412 mode.behavior = drag;
36416 // node_modules/quickselect/index.js
36417 function quickselect2(arr, k2, left, right, compare2) {
36418 quickselectStep(arr, k2, left || 0, right || arr.length - 1, compare2 || defaultCompare);
36420 function quickselectStep(arr, k2, left, right, compare2) {
36421 while (right > left) {
36422 if (right - left > 600) {
36423 var n3 = right - left + 1;
36424 var m2 = k2 - left + 1;
36425 var z2 = Math.log(n3);
36426 var s2 = 0.5 * Math.exp(2 * z2 / 3);
36427 var sd = 0.5 * Math.sqrt(z2 * s2 * (n3 - s2) / n3) * (m2 - n3 / 2 < 0 ? -1 : 1);
36428 var newLeft = Math.max(left, Math.floor(k2 - m2 * s2 / n3 + sd));
36429 var newRight = Math.min(right, Math.floor(k2 + (n3 - m2) * s2 / n3 + sd));
36430 quickselectStep(arr, k2, newLeft, newRight, compare2);
36435 swap2(arr, left, k2);
36436 if (compare2(arr[right], t2) > 0) swap2(arr, left, right);
36438 swap2(arr, i3, j2);
36441 while (compare2(arr[i3], t2) < 0) i3++;
36442 while (compare2(arr[j2], t2) > 0) j2--;
36444 if (compare2(arr[left], t2) === 0) swap2(arr, left, j2);
36447 swap2(arr, j2, right);
36449 if (j2 <= k2) left = j2 + 1;
36450 if (k2 <= j2) right = j2 - 1;
36453 function swap2(arr, i3, j2) {
36458 function defaultCompare(a2, b2) {
36459 return a2 < b2 ? -1 : a2 > b2 ? 1 : 0;
36462 // node_modules/rbush/index.js
36463 var RBush = class {
36464 constructor(maxEntries = 9) {
36465 this._maxEntries = Math.max(4, maxEntries);
36466 this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
36470 return this._all(this.data, []);
36473 let node = this.data;
36475 if (!intersects(bbox2, node)) return result;
36476 const toBBox = this.toBBox;
36477 const nodesToSearch = [];
36479 for (let i3 = 0; i3 < node.children.length; i3++) {
36480 const child = node.children[i3];
36481 const childBBox = node.leaf ? toBBox(child) : child;
36482 if (intersects(bbox2, childBBox)) {
36483 if (node.leaf) result.push(child);
36484 else if (contains(bbox2, childBBox)) this._all(child, result);
36485 else nodesToSearch.push(child);
36488 node = nodesToSearch.pop();
36493 let node = this.data;
36494 if (!intersects(bbox2, node)) return false;
36495 const nodesToSearch = [];
36497 for (let i3 = 0; i3 < node.children.length; i3++) {
36498 const child = node.children[i3];
36499 const childBBox = node.leaf ? this.toBBox(child) : child;
36500 if (intersects(bbox2, childBBox)) {
36501 if (node.leaf || contains(bbox2, childBBox)) return true;
36502 nodesToSearch.push(child);
36505 node = nodesToSearch.pop();
36510 if (!(data && data.length)) return this;
36511 if (data.length < this._minEntries) {
36512 for (let i3 = 0; i3 < data.length; i3++) {
36513 this.insert(data[i3]);
36517 let node = this._build(data.slice(), 0, data.length - 1, 0);
36518 if (!this.data.children.length) {
36520 } else if (this.data.height === node.height) {
36521 this._splitRoot(this.data, node);
36523 if (this.data.height < node.height) {
36524 const tmpNode = this.data;
36528 this._insert(node, this.data.height - node.height - 1, true);
36533 if (item) this._insert(item, this.data.height - 1);
36537 this.data = createNode([]);
36540 remove(item, equalsFn) {
36541 if (!item) return this;
36542 let node = this.data;
36543 const bbox2 = this.toBBox(item);
36545 const indexes = [];
36546 let i3, parent, goingUp;
36547 while (node || path.length) {
36550 parent = path[path.length - 1];
36551 i3 = indexes.pop();
36555 const index = findItem(item, node.children, equalsFn);
36556 if (index !== -1) {
36557 node.children.splice(index, 1);
36559 this._condense(path);
36563 if (!goingUp && !node.leaf && contains(node, bbox2)) {
36568 node = node.children[0];
36569 } else if (parent) {
36571 node = parent.children[i3];
36573 } else node = null;
36580 compareMinX(a2, b2) {
36581 return a2.minX - b2.minX;
36583 compareMinY(a2, b2) {
36584 return a2.minY - b2.minY;
36593 _all(node, result) {
36594 const nodesToSearch = [];
36596 if (node.leaf) result.push(...node.children);
36597 else nodesToSearch.push(...node.children);
36598 node = nodesToSearch.pop();
36602 _build(items, left, right, height) {
36603 const N2 = right - left + 1;
36604 let M2 = this._maxEntries;
36607 node = createNode(items.slice(left, right + 1));
36608 calcBBox(node, this.toBBox);
36612 height = Math.ceil(Math.log(N2) / Math.log(M2));
36613 M2 = Math.ceil(N2 / Math.pow(M2, height - 1));
36615 node = createNode([]);
36617 node.height = height;
36618 const N22 = Math.ceil(N2 / M2);
36619 const N1 = N22 * Math.ceil(Math.sqrt(M2));
36620 multiSelect(items, left, right, N1, this.compareMinX);
36621 for (let i3 = left; i3 <= right; i3 += N1) {
36622 const right2 = Math.min(i3 + N1 - 1, right);
36623 multiSelect(items, i3, right2, N22, this.compareMinY);
36624 for (let j2 = i3; j2 <= right2; j2 += N22) {
36625 const right3 = Math.min(j2 + N22 - 1, right2);
36626 node.children.push(this._build(items, j2, right3, height - 1));
36629 calcBBox(node, this.toBBox);
36632 _chooseSubtree(bbox2, node, level, path) {
36635 if (node.leaf || path.length - 1 === level) break;
36636 let minArea = Infinity;
36637 let minEnlargement = Infinity;
36639 for (let i3 = 0; i3 < node.children.length; i3++) {
36640 const child = node.children[i3];
36641 const area = bboxArea(child);
36642 const enlargement = enlargedArea(bbox2, child) - area;
36643 if (enlargement < minEnlargement) {
36644 minEnlargement = enlargement;
36645 minArea = area < minArea ? area : minArea;
36646 targetNode = child;
36647 } else if (enlargement === minEnlargement) {
36648 if (area < minArea) {
36650 targetNode = child;
36654 node = targetNode || node.children[0];
36658 _insert(item, level, isNode) {
36659 const bbox2 = isNode ? item : this.toBBox(item);
36660 const insertPath = [];
36661 const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
36662 node.children.push(item);
36663 extend2(node, bbox2);
36664 while (level >= 0) {
36665 if (insertPath[level].children.length > this._maxEntries) {
36666 this._split(insertPath, level);
36670 this._adjustParentBBoxes(bbox2, insertPath, level);
36672 // split overflowed node into two
36673 _split(insertPath, level) {
36674 const node = insertPath[level];
36675 const M2 = node.children.length;
36676 const m2 = this._minEntries;
36677 this._chooseSplitAxis(node, m2, M2);
36678 const splitIndex = this._chooseSplitIndex(node, m2, M2);
36679 const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
36680 newNode.height = node.height;
36681 newNode.leaf = node.leaf;
36682 calcBBox(node, this.toBBox);
36683 calcBBox(newNode, this.toBBox);
36684 if (level) insertPath[level - 1].children.push(newNode);
36685 else this._splitRoot(node, newNode);
36687 _splitRoot(node, newNode) {
36688 this.data = createNode([node, newNode]);
36689 this.data.height = node.height + 1;
36690 this.data.leaf = false;
36691 calcBBox(this.data, this.toBBox);
36693 _chooseSplitIndex(node, m2, M2) {
36695 let minOverlap = Infinity;
36696 let minArea = Infinity;
36697 for (let i3 = m2; i3 <= M2 - m2; i3++) {
36698 const bbox1 = distBBox(node, 0, i3, this.toBBox);
36699 const bbox2 = distBBox(node, i3, M2, this.toBBox);
36700 const overlap = intersectionArea(bbox1, bbox2);
36701 const area = bboxArea(bbox1) + bboxArea(bbox2);
36702 if (overlap < minOverlap) {
36703 minOverlap = overlap;
36705 minArea = area < minArea ? area : minArea;
36706 } else if (overlap === minOverlap) {
36707 if (area < minArea) {
36713 return index || M2 - m2;
36715 // sorts node children by the best axis for split
36716 _chooseSplitAxis(node, m2, M2) {
36717 const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
36718 const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
36719 const xMargin = this._allDistMargin(node, m2, M2, compareMinX);
36720 const yMargin = this._allDistMargin(node, m2, M2, compareMinY);
36721 if (xMargin < yMargin) node.children.sort(compareMinX);
36723 // total margin of all possible split distributions where each node is at least m full
36724 _allDistMargin(node, m2, M2, compare2) {
36725 node.children.sort(compare2);
36726 const toBBox = this.toBBox;
36727 const leftBBox = distBBox(node, 0, m2, toBBox);
36728 const rightBBox = distBBox(node, M2 - m2, M2, toBBox);
36729 let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
36730 for (let i3 = m2; i3 < M2 - m2; i3++) {
36731 const child = node.children[i3];
36732 extend2(leftBBox, node.leaf ? toBBox(child) : child);
36733 margin += bboxMargin(leftBBox);
36735 for (let i3 = M2 - m2 - 1; i3 >= m2; i3--) {
36736 const child = node.children[i3];
36737 extend2(rightBBox, node.leaf ? toBBox(child) : child);
36738 margin += bboxMargin(rightBBox);
36742 _adjustParentBBoxes(bbox2, path, level) {
36743 for (let i3 = level; i3 >= 0; i3--) {
36744 extend2(path[i3], bbox2);
36748 for (let i3 = path.length - 1, siblings; i3 >= 0; i3--) {
36749 if (path[i3].children.length === 0) {
36751 siblings = path[i3 - 1].children;
36752 siblings.splice(siblings.indexOf(path[i3]), 1);
36753 } else this.clear();
36754 } else calcBBox(path[i3], this.toBBox);
36758 function findItem(item, items, equalsFn) {
36759 if (!equalsFn) return items.indexOf(item);
36760 for (let i3 = 0; i3 < items.length; i3++) {
36761 if (equalsFn(item, items[i3])) return i3;
36765 function calcBBox(node, toBBox) {
36766 distBBox(node, 0, node.children.length, toBBox, node);
36768 function distBBox(node, k2, p2, toBBox, destNode) {
36769 if (!destNode) destNode = createNode(null);
36770 destNode.minX = Infinity;
36771 destNode.minY = Infinity;
36772 destNode.maxX = -Infinity;
36773 destNode.maxY = -Infinity;
36774 for (let i3 = k2; i3 < p2; i3++) {
36775 const child = node.children[i3];
36776 extend2(destNode, node.leaf ? toBBox(child) : child);
36780 function extend2(a2, b2) {
36781 a2.minX = Math.min(a2.minX, b2.minX);
36782 a2.minY = Math.min(a2.minY, b2.minY);
36783 a2.maxX = Math.max(a2.maxX, b2.maxX);
36784 a2.maxY = Math.max(a2.maxY, b2.maxY);
36787 function compareNodeMinX(a2, b2) {
36788 return a2.minX - b2.minX;
36790 function compareNodeMinY(a2, b2) {
36791 return a2.minY - b2.minY;
36793 function bboxArea(a2) {
36794 return (a2.maxX - a2.minX) * (a2.maxY - a2.minY);
36796 function bboxMargin(a2) {
36797 return a2.maxX - a2.minX + (a2.maxY - a2.minY);
36799 function enlargedArea(a2, b2) {
36800 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));
36802 function intersectionArea(a2, b2) {
36803 const minX = Math.max(a2.minX, b2.minX);
36804 const minY = Math.max(a2.minY, b2.minY);
36805 const maxX = Math.min(a2.maxX, b2.maxX);
36806 const maxY = Math.min(a2.maxY, b2.maxY);
36807 return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
36809 function contains(a2, b2) {
36810 return a2.minX <= b2.minX && a2.minY <= b2.minY && b2.maxX <= a2.maxX && b2.maxY <= a2.maxY;
36812 function intersects(a2, b2) {
36813 return b2.minX <= a2.maxX && b2.minY <= a2.maxY && b2.maxX >= a2.minX && b2.maxY >= a2.minY;
36815 function createNode(children2) {
36817 children: children2,
36826 function multiSelect(arr, left, right, n3, compare2) {
36827 const stack = [left, right];
36828 while (stack.length) {
36829 right = stack.pop();
36830 left = stack.pop();
36831 if (right - left <= n3) continue;
36832 const mid = left + Math.ceil((right - left) / n3 / 2) * n3;
36833 quickselect2(arr, mid, left, right, compare2);
36834 stack.push(left, mid, mid, right);
36838 // node_modules/d3-fetch/src/text.js
36839 function responseText(response) {
36840 if (!response.ok) throw new Error(response.status + " " + response.statusText);
36841 return response.text();
36843 function text_default3(input, init2) {
36844 return fetch(input, init2).then(responseText);
36847 // node_modules/d3-fetch/src/json.js
36848 function responseJson(response) {
36849 if (!response.ok) throw new Error(response.status + " " + response.statusText);
36850 if (response.status === 204 || response.status === 205) return;
36851 return response.json();
36853 function json_default(input, init2) {
36854 return fetch(input, init2).then(responseJson);
36857 // node_modules/d3-fetch/src/xml.js
36858 function parser(type2) {
36859 return (input, init2) => text_default3(input, init2).then((text) => new DOMParser().parseFromString(text, type2));
36861 var xml_default = parser("application/xml");
36862 var html = parser("text/html");
36863 var svg = parser("image/svg+xml");
36865 // modules/services/keepRight.js
36866 var tiler = utilTiler();
36867 var dispatch2 = dispatch_default("loaded");
36868 var _tileZoom = 14;
36869 var _krUrlRoot = "https://www.keepright.at";
36870 var _krData = { errorTypes: {}, localizeStrings: {} };
36873 // no 20 - multiple node on same spot - these are mostly boundaries overlapping roads
36946 function abortRequest(controller) {
36948 controller.abort();
36951 function abortUnwantedRequests(cache, tiles) {
36952 Object.keys(cache.inflightTile).forEach((k2) => {
36953 const wanted = tiles.find((tile) => k2 === tile.id);
36955 abortRequest(cache.inflightTile[k2]);
36956 delete cache.inflightTile[k2];
36960 function encodeIssueRtree(d2) {
36961 return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
36963 function updateRtree(item, replace) {
36964 _cache.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
36966 _cache.rtree.insert(item);
36969 function tokenReplacements(d2) {
36970 if (!(d2 instanceof QAItem)) return;
36971 const replacements = {};
36972 const issueTemplate = _krData.errorTypes[d2.whichType];
36973 if (!issueTemplate) {
36974 console.log("No Template: ", d2.whichType);
36975 console.log(" ", d2.description);
36978 if (!issueTemplate.regex) return;
36979 const errorRegex = new RegExp(issueTemplate.regex, "i");
36980 const errorMatch = errorRegex.exec(d2.description);
36982 console.log("Unmatched: ", d2.whichType);
36983 console.log(" ", d2.description);
36984 console.log(" ", errorRegex);
36987 for (let i3 = 1; i3 < errorMatch.length; i3++) {
36988 let capture = errorMatch[i3];
36990 idType = "IDs" in issueTemplate ? issueTemplate.IDs[i3 - 1] : "";
36991 if (idType && capture) {
36992 capture = parseError(capture, idType);
36994 const compare2 = capture.toLowerCase();
36995 if (_krData.localizeStrings[compare2]) {
36996 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
36998 capture = unescape_default(capture);
37001 replacements["var" + i3] = capture;
37003 return replacements;
37005 function parseError(capture, idType) {
37006 const compare2 = capture.toLowerCase();
37007 if (_krData.localizeStrings[compare2]) {
37008 capture = _t("QA.keepRight.error_parts." + _krData.localizeStrings[compare2]);
37011 // link a string like "this node"
37013 capture = linkErrorObject(capture);
37016 capture = linkURL(capture);
37018 // link an entity ID
37022 capture = linkEntity(idType + capture);
37024 // some errors have more complex ID lists/variance
37026 capture = parse20(capture);
37029 capture = parse211(capture);
37032 capture = parse231(capture);
37035 capture = parse294(capture);
37038 capture = parse370(capture);
37042 function linkErrorObject(d2) {
37043 return { html: '<a class="error_object_link">'.concat(d2, "</a>") };
37045 function linkEntity(d2) {
37046 return { html: '<a class="error_entity_link">'.concat(d2, "</a>") };
37048 function linkURL(d2) {
37049 return { html: '<a class="kr_external_link" target="_blank" href="'.concat(d2, '">').concat(d2, "</a>") };
37051 function parse211(capture2) {
37053 const items = capture2.split(", ");
37054 items.forEach((item) => {
37055 let id2 = linkEntity("n" + item.slice(1));
37058 return newList.join(", ");
37060 function parse231(capture2) {
37062 const items = capture2.split("),");
37063 items.forEach((item) => {
37064 const match = item.match(/\#(\d+)\((.+)\)?/);
37065 if (match !== null && match.length > 2) {
37067 linkEntity("w" + match[1]) + " " + _t("QA.keepRight.errorTypes.231.layer", { layer: match[2] })
37071 return newList.join(", ");
37073 function parse294(capture2) {
37075 const items = capture2.split(",");
37076 items.forEach((item) => {
37077 item = item.split(" ");
37078 const role = '"'.concat(item[0], '"');
37079 const idType2 = item[1].slice(0, 1);
37080 let id2 = item[2].slice(1);
37081 id2 = linkEntity(idType2 + id2);
37082 newList.push("".concat(role, " ").concat(item[1], " ").concat(id2));
37084 return newList.join(", ");
37086 function parse370(capture2) {
37087 if (!capture2) return "";
37088 const match = capture2.match(/\(including the name (\'.+\')\)/);
37089 if (match && match.length) {
37090 return _t("QA.keepRight.errorTypes.370.including_the_name", { name: match[1] });
37094 function parse20(capture2) {
37096 const items = capture2.split(",");
37097 items.forEach((item) => {
37098 const id2 = linkEntity("n" + item.slice(1));
37101 return newList.join(", ");
37104 var keepRight_default = {
37105 title: "keepRight",
37107 _mainFileFetcher.get("keepRight").then((d2) => _krData = d2);
37111 this.event = utilRebind(this, dispatch2, "on");
37115 Object.values(_cache.inflightTile).forEach(abortRequest);
37126 // KeepRight API: http://osm.mueschelsoft.de/keepright/interfacing.php
37127 loadIssues(projection2) {
37132 const tiles = tiler.zoomExtent([_tileZoom, _tileZoom]).getTiles(projection2);
37133 abortUnwantedRequests(_cache, tiles);
37134 tiles.forEach((tile) => {
37135 if (_cache.loadedTile[tile.id] || _cache.inflightTile[tile.id]) return;
37136 const [left, top, right, bottom] = tile.extent.rectangle();
37137 const params = Object.assign({}, options2, { left, bottom, right, top });
37138 const url = "".concat(_krUrlRoot, "/export.php?") + utilQsString(params);
37139 const controller = new AbortController();
37140 _cache.inflightTile[tile.id] = controller;
37141 json_default(url, { signal: controller.signal }).then((data) => {
37142 delete _cache.inflightTile[tile.id];
37143 _cache.loadedTile[tile.id] = true;
37144 if (!data || !data.features || !data.features.length) {
37145 throw new Error("No Data");
37147 data.features.forEach((feature3) => {
37150 error_type: itemType,
37153 object_id: objectId,
37154 object_type: objectType,
37160 geometry: { coordinates: loc },
37161 properties: { description = "" }
37163 const issueTemplate = _krData.errorTypes[itemType];
37164 const parentIssueType = (Math.floor(itemType / 10) * 10).toString();
37165 const whichType = issueTemplate ? itemType : parentIssueType;
37166 const whichTemplate = _krData.errorTypes[whichType];
37167 switch (whichType) {
37169 description = "This feature has a FIXME tag: ".concat(description);
37173 description = description.replace("A turn-", "This turn-");
37180 description = "This turn-restriction~".concat(description);
37183 description = "This highway is missing a maxspeed tag";
37188 description = "This feature~".concat(description);
37191 let coincident = false;
37193 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
37194 loc = geoVecAdd(loc, delta);
37195 let bbox2 = geoExtent(loc).bbox();
37196 coincident = _cache.rtree.search(bbox2).length;
37197 } while (coincident);
37198 let d2 = new QAItem(loc, this, itemType, id2, {
37203 severity: whichTemplate.severity || "error",
37209 d2.replacements = tokenReplacements(d2);
37210 _cache.data[id2] = d2;
37211 _cache.rtree.insert(encodeIssueRtree(d2));
37213 dispatch2.call("loaded");
37215 delete _cache.inflightTile[tile.id];
37216 _cache.loadedTile[tile.id] = true;
37220 postUpdate(d2, callback) {
37221 if (_cache.inflightPost[d2.id]) {
37222 return callback({ message: "Error update already inflight", status: -2 }, d2);
37224 const params = { schema: d2.schema, id: d2.id };
37225 if (d2.newStatus) {
37226 params.st = d2.newStatus;
37228 if (d2.newComment !== void 0) {
37229 params.co = d2.newComment;
37231 const url = "".concat(_krUrlRoot, "/comment.php?") + utilQsString(params);
37232 const controller = new AbortController();
37233 _cache.inflightPost[d2.id] = controller;
37234 json_default(url, { signal: controller.signal }).finally(() => {
37235 delete _cache.inflightPost[d2.id];
37236 if (d2.newStatus === "ignore") {
37237 this.removeItem(d2);
37238 } else if (d2.newStatus === "ignore_t") {
37239 this.removeItem(d2);
37240 _cache.closed["".concat(d2.schema, ":").concat(d2.id)] = true;
37242 d2 = this.replaceItem(d2.update({
37243 comment: d2.newComment,
37244 newComment: void 0,
37248 if (callback) callback(null, d2);
37251 // Get all cached QAItems covering the viewport
37252 getItems(projection2) {
37253 const viewport = projection2.clipExtent();
37254 const min3 = [viewport[0][0], viewport[1][1]];
37255 const max3 = [viewport[1][0], viewport[0][1]];
37256 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
37257 return _cache.rtree.search(bbox2).map((d2) => d2.data);
37259 // Get a QAItem from cache
37260 // NOTE: Don't change method name until UI v3 is merged
37262 return _cache.data[id2];
37264 // Replace a single QAItem in the cache
37265 replaceItem(item) {
37266 if (!(item instanceof QAItem) || !item.id) return;
37267 _cache.data[item.id] = item;
37268 updateRtree(encodeIssueRtree(item), true);
37271 // Remove a single QAItem from the cache
37273 if (!(item instanceof QAItem) || !item.id) return;
37274 delete _cache.data[item.id];
37275 updateRtree(encodeIssueRtree(item), false);
37278 return "".concat(_krUrlRoot, "/report_map.php?schema=").concat(item.schema, "&error=").concat(item.id);
37280 // Get an array of issues closed during this session.
37281 // Used to populate `closed:keepright` changeset tag
37283 return Object.keys(_cache.closed).sort();
37287 // node_modules/marked/lib/marked.esm.js
37288 function _getDefaults() {
37302 var _defaults = _getDefaults();
37303 function changeDefaults(newDefaults) {
37304 _defaults = newDefaults;
37306 var escapeTest = /[&<>"']/;
37307 var escapeReplace = new RegExp(escapeTest.source, "g");
37308 var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
37309 var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
37310 var escapeReplacements = {
37317 var getEscapeReplacement = (ch) => escapeReplacements[ch];
37318 function escape$1(html3, encode) {
37320 if (escapeTest.test(html3)) {
37321 return html3.replace(escapeReplace, getEscapeReplacement);
37324 if (escapeTestNoEncode.test(html3)) {
37325 return html3.replace(escapeReplaceNoEncode, getEscapeReplacement);
37330 var caret = /(^|[^\[])\^/g;
37331 function edit(regex, opt) {
37332 let source = typeof regex === "string" ? regex : regex.source;
37335 replace: (name, val) => {
37336 let valSource = typeof val === "string" ? val : val.source;
37337 valSource = valSource.replace(caret, "$1");
37338 source = source.replace(name, valSource);
37342 return new RegExp(source, opt);
37347 function cleanUrl(href) {
37349 href = encodeURI(href).replace(/%25/g, "%");
37355 var noopTest = { exec: () => null };
37356 function splitCells(tableRow, count) {
37357 const row = tableRow.replace(/\|/g, (match, offset, str) => {
37358 let escaped = false;
37360 while (--curr >= 0 && str[curr] === "\\")
37361 escaped = !escaped;
37367 }), cells = row.split(/ \|/);
37369 if (!cells[0].trim()) {
37372 if (cells.length > 0 && !cells[cells.length - 1].trim()) {
37376 if (cells.length > count) {
37377 cells.splice(count);
37379 while (cells.length < count)
37383 for (; i3 < cells.length; i3++) {
37384 cells[i3] = cells[i3].trim().replace(/\\\|/g, "|");
37388 function rtrim(str, c2, invert) {
37389 const l2 = str.length;
37394 while (suffLen < l2) {
37395 const currChar = str.charAt(l2 - suffLen - 1);
37396 if (currChar === c2 && !invert) {
37398 } else if (currChar !== c2 && invert) {
37404 return str.slice(0, l2 - suffLen);
37406 function findClosingBracket(str, b2) {
37407 if (str.indexOf(b2[1]) === -1) {
37411 for (let i3 = 0; i3 < str.length; i3++) {
37412 if (str[i3] === "\\") {
37414 } else if (str[i3] === b2[0]) {
37416 } else if (str[i3] === b2[1]) {
37425 function outputLink(cap, link3, raw, lexer2) {
37426 const href = link3.href;
37427 const title = link3.title ? escape$1(link3.title) : null;
37428 const text = cap[1].replace(/\\([\[\]])/g, "$1");
37429 if (cap[0].charAt(0) !== "!") {
37430 lexer2.state.inLink = true;
37437 tokens: lexer2.inlineTokens(text)
37439 lexer2.state.inLink = false;
37447 text: escape$1(text)
37450 function indentCodeCompensation(raw, text) {
37451 const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
37452 if (matchIndentToCode === null) {
37455 const indentToCode = matchIndentToCode[1];
37456 return text.split("\n").map((node) => {
37457 const matchIndentInNode = node.match(/^\s+/);
37458 if (matchIndentInNode === null) {
37461 const [indentInNode] = matchIndentInNode;
37462 if (indentInNode.length >= indentToCode.length) {
37463 return node.slice(indentToCode.length);
37468 var _Tokenizer = class {
37469 // set by the lexer
37470 constructor(options2) {
37471 __publicField(this, "options");
37472 __publicField(this, "rules");
37473 // set by the lexer
37474 __publicField(this, "lexer");
37475 this.options = options2 || _defaults;
37478 const cap = this.rules.block.newline.exec(src);
37479 if (cap && cap[0].length > 0) {
37487 const cap = this.rules.block.code.exec(src);
37489 const text = cap[0].replace(/^ {1,4}/gm, "");
37493 codeBlockStyle: "indented",
37494 text: !this.options.pedantic ? rtrim(text, "\n") : text
37499 const cap = this.rules.block.fences.exec(src);
37501 const raw = cap[0];
37502 const text = indentCodeCompensation(raw, cap[3] || "");
37506 lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
37512 const cap = this.rules.block.heading.exec(src);
37514 let text = cap[2].trim();
37515 if (/#$/.test(text)) {
37516 const trimmed = rtrim(text, "#");
37517 if (this.options.pedantic) {
37518 text = trimmed.trim();
37519 } else if (!trimmed || / $/.test(trimmed)) {
37520 text = trimmed.trim();
37526 depth: cap[1].length,
37528 tokens: this.lexer.inline(text)
37533 const cap = this.rules.block.hr.exec(src);
37537 raw: rtrim(cap[0], "\n")
37542 const cap = this.rules.block.blockquote.exec(src);
37544 let lines = rtrim(cap[0], "\n").split("\n");
37548 while (lines.length > 0) {
37549 let inBlockquote = false;
37550 const currentLines = [];
37552 for (i3 = 0; i3 < lines.length; i3++) {
37553 if (/^ {0,3}>/.test(lines[i3])) {
37554 currentLines.push(lines[i3]);
37555 inBlockquote = true;
37556 } else if (!inBlockquote) {
37557 currentLines.push(lines[i3]);
37562 lines = lines.slice(i3);
37563 const currentRaw = currentLines.join("\n");
37564 const currentText = currentRaw.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n $1").replace(/^ {0,3}>[ \t]?/gm, "");
37565 raw = raw ? "".concat(raw, "\n").concat(currentRaw) : currentRaw;
37566 text = text ? "".concat(text, "\n").concat(currentText) : currentText;
37567 const top = this.lexer.state.top;
37568 this.lexer.state.top = true;
37569 this.lexer.blockTokens(currentText, tokens, true);
37570 this.lexer.state.top = top;
37571 if (lines.length === 0) {
37574 const lastToken = tokens[tokens.length - 1];
37575 if ((lastToken == null ? void 0 : lastToken.type) === "code") {
37577 } else if ((lastToken == null ? void 0 : lastToken.type) === "blockquote") {
37578 const oldToken = lastToken;
37579 const newText = oldToken.raw + "\n" + lines.join("\n");
37580 const newToken = this.blockquote(newText);
37581 tokens[tokens.length - 1] = newToken;
37582 raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
37583 text = text.substring(0, text.length - oldToken.text.length) + newToken.text;
37585 } else if ((lastToken == null ? void 0 : lastToken.type) === "list") {
37586 const oldToken = lastToken;
37587 const newText = oldToken.raw + "\n" + lines.join("\n");
37588 const newToken = this.list(newText);
37589 tokens[tokens.length - 1] = newToken;
37590 raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
37591 text = text.substring(0, text.length - oldToken.raw.length) + newToken.raw;
37592 lines = newText.substring(tokens[tokens.length - 1].raw.length).split("\n");
37597 type: "blockquote",
37605 let cap = this.rules.block.list.exec(src);
37607 let bull = cap[1].trim();
37608 const isordered = bull.length > 1;
37612 ordered: isordered,
37613 start: isordered ? +bull.slice(0, -1) : "",
37617 bull = isordered ? "\\d{1,9}\\".concat(bull.slice(-1)) : "\\".concat(bull);
37618 if (this.options.pedantic) {
37619 bull = isordered ? bull : "[*+-]";
37621 const itemRegex = new RegExp("^( {0,3}".concat(bull, ")((?:[ ][^\\n]*)?(?:\\n|$))"));
37622 let endsWithBlankLine = false;
37624 let endEarly = false;
37626 let itemContents = "";
37627 if (!(cap = itemRegex.exec(src))) {
37630 if (this.rules.block.hr.test(src)) {
37634 src = src.substring(raw.length);
37635 let line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t2) => " ".repeat(3 * t2.length));
37636 let nextLine = src.split("\n", 1)[0];
37637 let blankLine = !line.trim();
37639 if (this.options.pedantic) {
37641 itemContents = line.trimStart();
37642 } else if (blankLine) {
37643 indent = cap[1].length + 1;
37645 indent = cap[2].search(/[^ ]/);
37646 indent = indent > 4 ? 1 : indent;
37647 itemContents = line.slice(indent);
37648 indent += cap[1].length;
37650 if (blankLine && /^ *$/.test(nextLine)) {
37651 raw += nextLine + "\n";
37652 src = src.substring(nextLine.length + 1);
37656 const nextBulletRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))"));
37657 const hrRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)"));
37658 const fencesBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}(?:```|~~~)"));
37659 const headingBeginRegex = new RegExp("^ {0,".concat(Math.min(3, indent - 1), "}#"));
37661 const rawLine = src.split("\n", 1)[0];
37662 nextLine = rawLine;
37663 if (this.options.pedantic) {
37664 nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
37666 if (fencesBeginRegex.test(nextLine)) {
37669 if (headingBeginRegex.test(nextLine)) {
37672 if (nextBulletRegex.test(nextLine)) {
37675 if (hrRegex.test(src)) {
37678 if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
37679 itemContents += "\n" + nextLine.slice(indent);
37684 if (line.search(/[^ ]/) >= 4) {
37687 if (fencesBeginRegex.test(line)) {
37690 if (headingBeginRegex.test(line)) {
37693 if (hrRegex.test(line)) {
37696 itemContents += "\n" + nextLine;
37698 if (!blankLine && !nextLine.trim()) {
37701 raw += rawLine + "\n";
37702 src = src.substring(rawLine.length + 1);
37703 line = nextLine.slice(indent);
37706 if (!list2.loose) {
37707 if (endsWithBlankLine) {
37708 list2.loose = true;
37709 } else if (/\n *\n *$/.test(raw)) {
37710 endsWithBlankLine = true;
37715 if (this.options.gfm) {
37716 istask = /^\[[ xX]\] /.exec(itemContents);
37718 ischecked = istask[0] !== "[ ] ";
37719 itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
37726 checked: ischecked,
37728 text: itemContents,
37733 list2.items[list2.items.length - 1].raw = list2.items[list2.items.length - 1].raw.trimEnd();
37734 list2.items[list2.items.length - 1].text = list2.items[list2.items.length - 1].text.trimEnd();
37735 list2.raw = list2.raw.trimEnd();
37736 for (let i3 = 0; i3 < list2.items.length; i3++) {
37737 this.lexer.state.top = false;
37738 list2.items[i3].tokens = this.lexer.blockTokens(list2.items[i3].text, []);
37739 if (!list2.loose) {
37740 const spacers = list2.items[i3].tokens.filter((t2) => t2.type === "space");
37741 const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t2) => /\n.*\n/.test(t2.raw));
37742 list2.loose = hasMultipleLineBreaks;
37746 for (let i3 = 0; i3 < list2.items.length; i3++) {
37747 list2.items[i3].loose = true;
37754 const cap = this.rules.block.html.exec(src);
37760 pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
37767 const cap = this.rules.block.def.exec(src);
37769 const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
37770 const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
37771 const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
37782 const cap = this.rules.block.table.exec(src);
37786 if (!/[:|]/.test(cap[2])) {
37789 const headers = splitCells(cap[1]);
37790 const aligns = cap[2].replace(/^\||\| *$/g, "").split("|");
37791 const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [];
37799 if (headers.length !== aligns.length) {
37802 for (const align of aligns) {
37803 if (/^ *-+: *$/.test(align)) {
37804 item.align.push("right");
37805 } else if (/^ *:-+: *$/.test(align)) {
37806 item.align.push("center");
37807 } else if (/^ *:-+ *$/.test(align)) {
37808 item.align.push("left");
37810 item.align.push(null);
37813 for (let i3 = 0; i3 < headers.length; i3++) {
37816 tokens: this.lexer.inline(headers[i3]),
37818 align: item.align[i3]
37821 for (const row of rows) {
37822 item.rows.push(splitCells(row, item.header.length).map((cell, i3) => {
37825 tokens: this.lexer.inline(cell),
37827 align: item.align[i3]
37834 const cap = this.rules.block.lheading.exec(src);
37839 depth: cap[2].charAt(0) === "=" ? 1 : 2,
37841 tokens: this.lexer.inline(cap[1])
37846 const cap = this.rules.block.paragraph.exec(src);
37848 const text = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
37853 tokens: this.lexer.inline(text)
37858 const cap = this.rules.block.text.exec(src);
37864 tokens: this.lexer.inline(cap[0])
37869 const cap = this.rules.inline.escape.exec(src);
37874 text: escape$1(cap[1])
37879 const cap = this.rules.inline.tag.exec(src);
37881 if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
37882 this.lexer.state.inLink = true;
37883 } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
37884 this.lexer.state.inLink = false;
37886 if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37887 this.lexer.state.inRawBlock = true;
37888 } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
37889 this.lexer.state.inRawBlock = false;
37894 inLink: this.lexer.state.inLink,
37895 inRawBlock: this.lexer.state.inRawBlock,
37902 const cap = this.rules.inline.link.exec(src);
37904 const trimmedUrl = cap[2].trim();
37905 if (!this.options.pedantic && /^</.test(trimmedUrl)) {
37906 if (!/>$/.test(trimmedUrl)) {
37909 const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
37910 if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
37914 const lastParenIndex = findClosingBracket(cap[2], "()");
37915 if (lastParenIndex > -1) {
37916 const start2 = cap[0].indexOf("!") === 0 ? 5 : 4;
37917 const linkLen = start2 + cap[1].length + lastParenIndex;
37918 cap[2] = cap[2].substring(0, lastParenIndex);
37919 cap[0] = cap[0].substring(0, linkLen).trim();
37925 if (this.options.pedantic) {
37926 const link3 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
37932 title = cap[3] ? cap[3].slice(1, -1) : "";
37934 href = href.trim();
37935 if (/^</.test(href)) {
37936 if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
37937 href = href.slice(1);
37939 href = href.slice(1, -1);
37942 return outputLink(cap, {
37943 href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
37944 title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
37945 }, cap[0], this.lexer);
37948 reflink(src, links) {
37950 if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
37951 const linkString = (cap[2] || cap[1]).replace(/\s+/g, " ");
37952 const link3 = links[linkString.toLowerCase()];
37954 const text = cap[0].charAt(0);
37961 return outputLink(cap, link3, cap[0], this.lexer);
37964 emStrong(src, maskedSrc, prevChar = "") {
37965 let match = this.rules.inline.emStrongLDelim.exec(src);
37968 if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
37970 const nextChar = match[1] || match[2] || "";
37971 if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
37972 const lLength = [...match[0]].length - 1;
37973 let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
37974 const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
37975 endReg.lastIndex = 0;
37976 maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
37977 while ((match = endReg.exec(maskedSrc)) != null) {
37978 rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
37981 rLength = [...rDelim].length;
37982 if (match[3] || match[4]) {
37983 delimTotal += rLength;
37985 } else if (match[5] || match[6]) {
37986 if (lLength % 3 && !((lLength + rLength) % 3)) {
37987 midDelimTotal += rLength;
37991 delimTotal -= rLength;
37992 if (delimTotal > 0)
37994 rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
37995 const lastCharLength = [...match[0]][0].length;
37996 const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
37997 if (Math.min(lLength, rLength) % 2) {
37998 const text2 = raw.slice(1, -1);
38003 tokens: this.lexer.inlineTokens(text2)
38006 const text = raw.slice(2, -2);
38011 tokens: this.lexer.inlineTokens(text)
38017 const cap = this.rules.inline.code.exec(src);
38019 let text = cap[2].replace(/\n/g, " ");
38020 const hasNonSpaceChars = /[^ ]/.test(text);
38021 const hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
38022 if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
38023 text = text.substring(1, text.length - 1);
38025 text = escape$1(text, true);
38034 const cap = this.rules.inline.br.exec(src);
38043 const cap = this.rules.inline.del.exec(src);
38049 tokens: this.lexer.inlineTokens(cap[2])
38054 const cap = this.rules.inline.autolink.exec(src);
38057 if (cap[2] === "@") {
38058 text = escape$1(cap[1]);
38059 href = "mailto:" + text;
38061 text = escape$1(cap[1]);
38082 if (cap = this.rules.inline.url.exec(src)) {
38084 if (cap[2] === "@") {
38085 text = escape$1(cap[0]);
38086 href = "mailto:" + text;
38090 prevCapZero = cap[0];
38091 cap[0] = (_b3 = (_a3 = this.rules.inline._backpedal.exec(cap[0])) == null ? void 0 : _a3[0]) != null ? _b3 : "";
38092 } while (prevCapZero !== cap[0]);
38093 text = escape$1(cap[0]);
38094 if (cap[1] === "www.") {
38095 href = "http://" + cap[0];
38116 const cap = this.rules.inline.text.exec(src);
38119 if (this.lexer.state.inRawBlock) {
38122 text = escape$1(cap[0]);
38132 var newline = /^(?: *(?:\n|$))+/;
38133 var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
38134 var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
38135 var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
38136 var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
38137 var bullet = /(?:[*+-]|\d{1,9}[.)])/;
38138 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();
38139 var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
38140 var blockText = /^[^\n]+/;
38141 var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
38142 var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
38143 var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
38144 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";
38145 var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
38146 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();
38147 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();
38148 var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
38149 var blockNormal = {
38164 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();
38168 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()
38170 var blockPedantic = {
38172 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(),
38173 def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
38174 heading: /^(#{1,6})(.*)(?:\n+|$)/,
38176 // fences not supported
38177 lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
38178 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()
38180 var escape4 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
38181 var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
38182 var br = /^( {2,}|\\)\n(?!\s*$)/;
38183 var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
38184 var _punctuation = "\\p{P}\\p{S}";
38185 var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
38186 var blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
38187 var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
38188 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();
38189 var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
38190 var anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
38191 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();
38192 var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
38193 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();
38194 var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
38195 var link2 = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
38196 var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
38197 var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
38198 var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
38199 var inlineNormal = {
38200 _backpedal: noopTest,
38201 // only used for GFM url
38221 var inlinePedantic = {
38223 link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
38224 reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
38228 escape: edit(escape4).replace("])", "~|])").getRegex(),
38229 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(),
38230 _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
38231 del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
38232 text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
38234 var inlineBreaks = {
38236 br: edit(br).replace("{2,}", "*").getRegex(),
38237 text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
38240 normal: blockNormal,
38242 pedantic: blockPedantic
38245 normal: inlineNormal,
38247 breaks: inlineBreaks,
38248 pedantic: inlinePedantic
38250 var _Lexer = class __Lexer {
38251 constructor(options2) {
38252 __publicField(this, "tokens");
38253 __publicField(this, "options");
38254 __publicField(this, "state");
38255 __publicField(this, "tokenizer");
38256 __publicField(this, "inlineQueue");
38258 this.tokens.links = /* @__PURE__ */ Object.create(null);
38259 this.options = options2 || _defaults;
38260 this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
38261 this.tokenizer = this.options.tokenizer;
38262 this.tokenizer.options = this.options;
38263 this.tokenizer.lexer = this;
38264 this.inlineQueue = [];
38271 block: block.normal,
38272 inline: inline.normal
38274 if (this.options.pedantic) {
38275 rules.block = block.pedantic;
38276 rules.inline = inline.pedantic;
38277 } else if (this.options.gfm) {
38278 rules.block = block.gfm;
38279 if (this.options.breaks) {
38280 rules.inline = inline.breaks;
38282 rules.inline = inline.gfm;
38285 this.tokenizer.rules = rules;
38290 static get rules() {
38297 * Static Lex Method
38299 static lex(src, options2) {
38300 const lexer2 = new __Lexer(options2);
38301 return lexer2.lex(src);
38304 * Static Lex Inline Method
38306 static lexInline(src, options2) {
38307 const lexer2 = new __Lexer(options2);
38308 return lexer2.inlineTokens(src);
38314 src = src.replace(/\r\n|\r/g, "\n");
38315 this.blockTokens(src, this.tokens);
38316 for (let i3 = 0; i3 < this.inlineQueue.length; i3++) {
38317 const next = this.inlineQueue[i3];
38318 this.inlineTokens(next.src, next.tokens);
38320 this.inlineQueue = [];
38321 return this.tokens;
38323 blockTokens(src, tokens = [], lastParagraphClipped = false) {
38324 if (this.options.pedantic) {
38325 src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
38327 src = src.replace(/^( *)(\t+)/gm, (_2, leading, tabs) => {
38328 return leading + " ".repeat(tabs.length);
38335 if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
38336 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38337 src = src.substring(token.raw.length);
38338 tokens.push(token);
38345 if (token = this.tokenizer.space(src)) {
38346 src = src.substring(token.raw.length);
38347 if (token.raw.length === 1 && tokens.length > 0) {
38348 tokens[tokens.length - 1].raw += "\n";
38350 tokens.push(token);
38354 if (token = this.tokenizer.code(src)) {
38355 src = src.substring(token.raw.length);
38356 lastToken = tokens[tokens.length - 1];
38357 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38358 lastToken.raw += "\n" + token.raw;
38359 lastToken.text += "\n" + token.text;
38360 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38362 tokens.push(token);
38366 if (token = this.tokenizer.fences(src)) {
38367 src = src.substring(token.raw.length);
38368 tokens.push(token);
38371 if (token = this.tokenizer.heading(src)) {
38372 src = src.substring(token.raw.length);
38373 tokens.push(token);
38376 if (token = this.tokenizer.hr(src)) {
38377 src = src.substring(token.raw.length);
38378 tokens.push(token);
38381 if (token = this.tokenizer.blockquote(src)) {
38382 src = src.substring(token.raw.length);
38383 tokens.push(token);
38386 if (token = this.tokenizer.list(src)) {
38387 src = src.substring(token.raw.length);
38388 tokens.push(token);
38391 if (token = this.tokenizer.html(src)) {
38392 src = src.substring(token.raw.length);
38393 tokens.push(token);
38396 if (token = this.tokenizer.def(src)) {
38397 src = src.substring(token.raw.length);
38398 lastToken = tokens[tokens.length - 1];
38399 if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
38400 lastToken.raw += "\n" + token.raw;
38401 lastToken.text += "\n" + token.raw;
38402 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38403 } else if (!this.tokens.links[token.tag]) {
38404 this.tokens.links[token.tag] = {
38411 if (token = this.tokenizer.table(src)) {
38412 src = src.substring(token.raw.length);
38413 tokens.push(token);
38416 if (token = this.tokenizer.lheading(src)) {
38417 src = src.substring(token.raw.length);
38418 tokens.push(token);
38422 if (this.options.extensions && this.options.extensions.startBlock) {
38423 let startIndex = Infinity;
38424 const tempSrc = src.slice(1);
38426 this.options.extensions.startBlock.forEach((getStartIndex) => {
38427 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38428 if (typeof tempStart === "number" && tempStart >= 0) {
38429 startIndex = Math.min(startIndex, tempStart);
38432 if (startIndex < Infinity && startIndex >= 0) {
38433 cutSrc = src.substring(0, startIndex + 1);
38436 if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
38437 lastToken = tokens[tokens.length - 1];
38438 if (lastParagraphClipped && (lastToken == null ? void 0 : lastToken.type) === "paragraph") {
38439 lastToken.raw += "\n" + token.raw;
38440 lastToken.text += "\n" + token.text;
38441 this.inlineQueue.pop();
38442 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38444 tokens.push(token);
38446 lastParagraphClipped = cutSrc.length !== src.length;
38447 src = src.substring(token.raw.length);
38450 if (token = this.tokenizer.text(src)) {
38451 src = src.substring(token.raw.length);
38452 lastToken = tokens[tokens.length - 1];
38453 if (lastToken && lastToken.type === "text") {
38454 lastToken.raw += "\n" + token.raw;
38455 lastToken.text += "\n" + token.text;
38456 this.inlineQueue.pop();
38457 this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
38459 tokens.push(token);
38464 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38465 if (this.options.silent) {
38466 console.error(errMsg);
38469 throw new Error(errMsg);
38473 this.state.top = true;
38476 inline(src, tokens = []) {
38477 this.inlineQueue.push({ src, tokens });
38483 inlineTokens(src, tokens = []) {
38484 let token, lastToken, cutSrc;
38485 let maskedSrc = src;
38487 let keepPrevChar, prevChar;
38488 if (this.tokens.links) {
38489 const links = Object.keys(this.tokens.links);
38490 if (links.length > 0) {
38491 while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
38492 if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
38493 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
38498 while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
38499 maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
38501 while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
38502 maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
38505 if (!keepPrevChar) {
38508 keepPrevChar = false;
38509 if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
38510 if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
38511 src = src.substring(token.raw.length);
38512 tokens.push(token);
38519 if (token = this.tokenizer.escape(src)) {
38520 src = src.substring(token.raw.length);
38521 tokens.push(token);
38524 if (token = this.tokenizer.tag(src)) {
38525 src = src.substring(token.raw.length);
38526 lastToken = tokens[tokens.length - 1];
38527 if (lastToken && token.type === "text" && lastToken.type === "text") {
38528 lastToken.raw += token.raw;
38529 lastToken.text += token.text;
38531 tokens.push(token);
38535 if (token = this.tokenizer.link(src)) {
38536 src = src.substring(token.raw.length);
38537 tokens.push(token);
38540 if (token = this.tokenizer.reflink(src, this.tokens.links)) {
38541 src = src.substring(token.raw.length);
38542 lastToken = tokens[tokens.length - 1];
38543 if (lastToken && token.type === "text" && lastToken.type === "text") {
38544 lastToken.raw += token.raw;
38545 lastToken.text += token.text;
38547 tokens.push(token);
38551 if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
38552 src = src.substring(token.raw.length);
38553 tokens.push(token);
38556 if (token = this.tokenizer.codespan(src)) {
38557 src = src.substring(token.raw.length);
38558 tokens.push(token);
38561 if (token = this.tokenizer.br(src)) {
38562 src = src.substring(token.raw.length);
38563 tokens.push(token);
38566 if (token = this.tokenizer.del(src)) {
38567 src = src.substring(token.raw.length);
38568 tokens.push(token);
38571 if (token = this.tokenizer.autolink(src)) {
38572 src = src.substring(token.raw.length);
38573 tokens.push(token);
38576 if (!this.state.inLink && (token = this.tokenizer.url(src))) {
38577 src = src.substring(token.raw.length);
38578 tokens.push(token);
38582 if (this.options.extensions && this.options.extensions.startInline) {
38583 let startIndex = Infinity;
38584 const tempSrc = src.slice(1);
38586 this.options.extensions.startInline.forEach((getStartIndex) => {
38587 tempStart = getStartIndex.call({ lexer: this }, tempSrc);
38588 if (typeof tempStart === "number" && tempStart >= 0) {
38589 startIndex = Math.min(startIndex, tempStart);
38592 if (startIndex < Infinity && startIndex >= 0) {
38593 cutSrc = src.substring(0, startIndex + 1);
38596 if (token = this.tokenizer.inlineText(cutSrc)) {
38597 src = src.substring(token.raw.length);
38598 if (token.raw.slice(-1) !== "_") {
38599 prevChar = token.raw.slice(-1);
38601 keepPrevChar = true;
38602 lastToken = tokens[tokens.length - 1];
38603 if (lastToken && lastToken.type === "text") {
38604 lastToken.raw += token.raw;
38605 lastToken.text += token.text;
38607 tokens.push(token);
38612 const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
38613 if (this.options.silent) {
38614 console.error(errMsg);
38617 throw new Error(errMsg);
38624 var _Renderer = class {
38625 // set by the parser
38626 constructor(options2) {
38627 __publicField(this, "options");
38628 __publicField(this, "parser");
38629 this.options = options2 || _defaults;
38634 code({ text, lang, escaped }) {
38636 const langString = (_a3 = (lang || "").match(/^\S*/)) == null ? void 0 : _a3[0];
38637 const code = text.replace(/\n$/, "") + "\n";
38639 return "<pre><code>" + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
38641 return '<pre><code class="language-' + escape$1(langString) + '">' + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
38643 blockquote({ tokens }) {
38644 const body = this.parser.parse(tokens);
38645 return "<blockquote>\n".concat(body, "</blockquote>\n");
38650 heading({ tokens, depth }) {
38651 return "<h".concat(depth, ">").concat(this.parser.parseInline(tokens), "</h").concat(depth, ">\n");
38657 const ordered = token.ordered;
38658 const start2 = token.start;
38660 for (let j2 = 0; j2 < token.items.length; j2++) {
38661 const item = token.items[j2];
38662 body += this.listitem(item);
38664 const type2 = ordered ? "ol" : "ul";
38665 const startAttr = ordered && start2 !== 1 ? ' start="' + start2 + '"' : "";
38666 return "<" + type2 + startAttr + ">\n" + body + "</" + type2 + ">\n";
38671 const checkbox = this.checkbox({ checked: !!item.checked });
38673 if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
38674 item.tokens[0].text = checkbox + " " + item.tokens[0].text;
38675 if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
38676 item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
38679 item.tokens.unshift({
38681 raw: checkbox + " ",
38682 text: checkbox + " "
38686 itemBody += checkbox + " ";
38689 itemBody += this.parser.parse(item.tokens, !!item.loose);
38690 return "<li>".concat(itemBody, "</li>\n");
38692 checkbox({ checked }) {
38693 return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
38695 paragraph({ tokens }) {
38696 return "<p>".concat(this.parser.parseInline(tokens), "</p>\n");
38701 for (let j2 = 0; j2 < token.header.length; j2++) {
38702 cell += this.tablecell(token.header[j2]);
38704 header += this.tablerow({ text: cell });
38706 for (let j2 = 0; j2 < token.rows.length; j2++) {
38707 const row = token.rows[j2];
38709 for (let k2 = 0; k2 < row.length; k2++) {
38710 cell += this.tablecell(row[k2]);
38712 body += this.tablerow({ text: cell });
38715 body = "<tbody>".concat(body, "</tbody>");
38716 return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
38718 tablerow({ text }) {
38719 return "<tr>\n".concat(text, "</tr>\n");
38722 const content = this.parser.parseInline(token.tokens);
38723 const type2 = token.header ? "th" : "td";
38724 const tag2 = token.align ? "<".concat(type2, ' align="').concat(token.align, '">') : "<".concat(type2, ">");
38725 return tag2 + content + "</".concat(type2, ">\n");
38728 * span level renderer
38730 strong({ tokens }) {
38731 return "<strong>".concat(this.parser.parseInline(tokens), "</strong>");
38734 return "<em>".concat(this.parser.parseInline(tokens), "</em>");
38736 codespan({ text }) {
38737 return "<code>".concat(text, "</code>");
38743 return "<del>".concat(this.parser.parseInline(tokens), "</del>");
38745 link({ href, title, tokens }) {
38746 const text = this.parser.parseInline(tokens);
38747 const cleanHref = cleanUrl(href);
38748 if (cleanHref === null) {
38752 let out = '<a href="' + href + '"';
38754 out += ' title="' + title + '"';
38756 out += ">" + text + "</a>";
38759 image({ href, title, text }) {
38760 const cleanHref = cleanUrl(href);
38761 if (cleanHref === null) {
38765 let out = '<img src="'.concat(href, '" alt="').concat(text, '"');
38767 out += ' title="'.concat(title, '"');
38773 return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
38776 var _TextRenderer = class {
38777 // no need for block level renderers
38784 codespan({ text }) {
38806 var _Parser = class __Parser {
38807 constructor(options2) {
38808 __publicField(this, "options");
38809 __publicField(this, "renderer");
38810 __publicField(this, "textRenderer");
38811 this.options = options2 || _defaults;
38812 this.options.renderer = this.options.renderer || new _Renderer();
38813 this.renderer = this.options.renderer;
38814 this.renderer.options = this.options;
38815 this.renderer.parser = this;
38816 this.textRenderer = new _TextRenderer();
38819 * Static Parse Method
38821 static parse(tokens, options2) {
38822 const parser3 = new __Parser(options2);
38823 return parser3.parse(tokens);
38826 * Static Parse Inline Method
38828 static parseInline(tokens, options2) {
38829 const parser3 = new __Parser(options2);
38830 return parser3.parseInline(tokens);
38835 parse(tokens, top = true) {
38837 for (let i3 = 0; i3 < tokens.length; i3++) {
38838 const anyToken = tokens[i3];
38839 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
38840 const genericToken = anyToken;
38841 const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
38842 if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
38847 const token = anyToken;
38848 switch (token.type) {
38850 out += this.renderer.space(token);
38854 out += this.renderer.hr(token);
38858 out += this.renderer.heading(token);
38862 out += this.renderer.code(token);
38866 out += this.renderer.table(token);
38869 case "blockquote": {
38870 out += this.renderer.blockquote(token);
38874 out += this.renderer.list(token);
38878 out += this.renderer.html(token);
38881 case "paragraph": {
38882 out += this.renderer.paragraph(token);
38886 let textToken = token;
38887 let body = this.renderer.text(textToken);
38888 while (i3 + 1 < tokens.length && tokens[i3 + 1].type === "text") {
38889 textToken = tokens[++i3];
38890 body += "\n" + this.renderer.text(textToken);
38893 out += this.renderer.paragraph({
38897 tokens: [{ type: "text", raw: body, text: body }]
38905 const errMsg = 'Token with "' + token.type + '" type was not found.';
38906 if (this.options.silent) {
38907 console.error(errMsg);
38910 throw new Error(errMsg);
38918 * Parse Inline Tokens
38920 parseInline(tokens, renderer) {
38921 renderer = renderer || this.renderer;
38923 for (let i3 = 0; i3 < tokens.length; i3++) {
38924 const anyToken = tokens[i3];
38925 if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
38926 const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
38927 if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
38932 const token = anyToken;
38933 switch (token.type) {
38935 out += renderer.text(token);
38939 out += renderer.html(token);
38943 out += renderer.link(token);
38947 out += renderer.image(token);
38951 out += renderer.strong(token);
38955 out += renderer.em(token);
38959 out += renderer.codespan(token);
38963 out += renderer.br(token);
38967 out += renderer.del(token);
38971 out += renderer.text(token);
38975 const errMsg = 'Token with "' + token.type + '" type was not found.';
38976 if (this.options.silent) {
38977 console.error(errMsg);
38980 throw new Error(errMsg);
38988 var _Hooks = class {
38989 constructor(options2) {
38990 __publicField(this, "options");
38991 this.options = options2 || _defaults;
38994 * Process markdown before marked
38996 preprocess(markdown) {
39000 * Process HTML after marked is finished
39002 postprocess(html3) {
39006 * Process all tokens before walk tokens
39008 processAllTokens(tokens) {
39012 __publicField(_Hooks, "passThroughHooks", /* @__PURE__ */ new Set([
39017 var Marked = class {
39018 constructor(...args) {
39019 __publicField(this, "defaults", _getDefaults());
39020 __publicField(this, "options", this.setOptions);
39021 __publicField(this, "parse", this.parseMarkdown(_Lexer.lex, _Parser.parse));
39022 __publicField(this, "parseInline", this.parseMarkdown(_Lexer.lexInline, _Parser.parseInline));
39023 __publicField(this, "Parser", _Parser);
39024 __publicField(this, "Renderer", _Renderer);
39025 __publicField(this, "TextRenderer", _TextRenderer);
39026 __publicField(this, "Lexer", _Lexer);
39027 __publicField(this, "Tokenizer", _Tokenizer);
39028 __publicField(this, "Hooks", _Hooks);
39032 * Run callback for every token
39034 walkTokens(tokens, callback) {
39037 for (const token of tokens) {
39038 values = values.concat(callback.call(this, token));
39039 switch (token.type) {
39041 const tableToken = token;
39042 for (const cell of tableToken.header) {
39043 values = values.concat(this.walkTokens(cell.tokens, callback));
39045 for (const row of tableToken.rows) {
39046 for (const cell of row) {
39047 values = values.concat(this.walkTokens(cell.tokens, callback));
39053 const listToken = token;
39054 values = values.concat(this.walkTokens(listToken.items, callback));
39058 const genericToken = token;
39059 if ((_b3 = (_a3 = this.defaults.extensions) == null ? void 0 : _a3.childTokens) == null ? void 0 : _b3[genericToken.type]) {
39060 this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
39061 const tokens2 = genericToken[childTokens].flat(Infinity);
39062 values = values.concat(this.walkTokens(tokens2, callback));
39064 } else if (genericToken.tokens) {
39065 values = values.concat(this.walkTokens(genericToken.tokens, callback));
39073 const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
39074 args.forEach((pack) => {
39075 const opts = { ...pack };
39076 opts.async = this.defaults.async || opts.async || false;
39077 if (pack.extensions) {
39078 pack.extensions.forEach((ext) => {
39080 throw new Error("extension name required");
39082 if ("renderer" in ext) {
39083 const prevRenderer = extensions.renderers[ext.name];
39084 if (prevRenderer) {
39085 extensions.renderers[ext.name] = function(...args2) {
39086 let ret = ext.renderer.apply(this, args2);
39087 if (ret === false) {
39088 ret = prevRenderer.apply(this, args2);
39093 extensions.renderers[ext.name] = ext.renderer;
39096 if ("tokenizer" in ext) {
39097 if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
39098 throw new Error("extension level must be 'block' or 'inline'");
39100 const extLevel = extensions[ext.level];
39102 extLevel.unshift(ext.tokenizer);
39104 extensions[ext.level] = [ext.tokenizer];
39107 if (ext.level === "block") {
39108 if (extensions.startBlock) {
39109 extensions.startBlock.push(ext.start);
39111 extensions.startBlock = [ext.start];
39113 } else if (ext.level === "inline") {
39114 if (extensions.startInline) {
39115 extensions.startInline.push(ext.start);
39117 extensions.startInline = [ext.start];
39122 if ("childTokens" in ext && ext.childTokens) {
39123 extensions.childTokens[ext.name] = ext.childTokens;
39126 opts.extensions = extensions;
39128 if (pack.renderer) {
39129 const renderer = this.defaults.renderer || new _Renderer(this.defaults);
39130 for (const prop in pack.renderer) {
39131 if (!(prop in renderer)) {
39132 throw new Error("renderer '".concat(prop, "' does not exist"));
39134 if (["options", "parser"].includes(prop)) {
39137 const rendererProp = prop;
39138 const rendererFunc = pack.renderer[rendererProp];
39139 const prevRenderer = renderer[rendererProp];
39140 renderer[rendererProp] = (...args2) => {
39141 let ret = rendererFunc.apply(renderer, args2);
39142 if (ret === false) {
39143 ret = prevRenderer.apply(renderer, args2);
39148 opts.renderer = renderer;
39150 if (pack.tokenizer) {
39151 const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
39152 for (const prop in pack.tokenizer) {
39153 if (!(prop in tokenizer)) {
39154 throw new Error("tokenizer '".concat(prop, "' does not exist"));
39156 if (["options", "rules", "lexer"].includes(prop)) {
39159 const tokenizerProp = prop;
39160 const tokenizerFunc = pack.tokenizer[tokenizerProp];
39161 const prevTokenizer = tokenizer[tokenizerProp];
39162 tokenizer[tokenizerProp] = (...args2) => {
39163 let ret = tokenizerFunc.apply(tokenizer, args2);
39164 if (ret === false) {
39165 ret = prevTokenizer.apply(tokenizer, args2);
39170 opts.tokenizer = tokenizer;
39173 const hooks = this.defaults.hooks || new _Hooks();
39174 for (const prop in pack.hooks) {
39175 if (!(prop in hooks)) {
39176 throw new Error("hook '".concat(prop, "' does not exist"));
39178 if (prop === "options") {
39181 const hooksProp = prop;
39182 const hooksFunc = pack.hooks[hooksProp];
39183 const prevHook = hooks[hooksProp];
39184 if (_Hooks.passThroughHooks.has(prop)) {
39185 hooks[hooksProp] = (arg) => {
39186 if (this.defaults.async) {
39187 return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
39188 return prevHook.call(hooks, ret2);
39191 const ret = hooksFunc.call(hooks, arg);
39192 return prevHook.call(hooks, ret);
39195 hooks[hooksProp] = (...args2) => {
39196 let ret = hooksFunc.apply(hooks, args2);
39197 if (ret === false) {
39198 ret = prevHook.apply(hooks, args2);
39204 opts.hooks = hooks;
39206 if (pack.walkTokens) {
39207 const walkTokens2 = this.defaults.walkTokens;
39208 const packWalktokens = pack.walkTokens;
39209 opts.walkTokens = function(token) {
39211 values.push(packWalktokens.call(this, token));
39213 values = values.concat(walkTokens2.call(this, token));
39218 this.defaults = { ...this.defaults, ...opts };
39223 this.defaults = { ...this.defaults, ...opt };
39226 lexer(src, options2) {
39227 return _Lexer.lex(src, options2 != null ? options2 : this.defaults);
39229 parser(tokens, options2) {
39230 return _Parser.parse(tokens, options2 != null ? options2 : this.defaults);
39232 parseMarkdown(lexer2, parser3) {
39233 const parse = (src, options2) => {
39234 const origOpt = { ...options2 };
39235 const opt = { ...this.defaults, ...origOpt };
39236 const throwError = this.onError(!!opt.silent, !!opt.async);
39237 if (this.defaults.async === true && origOpt.async === false) {
39238 return throwError(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
39240 if (typeof src === "undefined" || src === null) {
39241 return throwError(new Error("marked(): input parameter is undefined or null"));
39243 if (typeof src !== "string") {
39244 return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
39247 opt.hooks.options = opt;
39250 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);
39254 src = opt.hooks.preprocess(src);
39256 let tokens = lexer2(src, opt);
39258 tokens = opt.hooks.processAllTokens(tokens);
39260 if (opt.walkTokens) {
39261 this.walkTokens(tokens, opt.walkTokens);
39263 let html3 = parser3(tokens, opt);
39265 html3 = opt.hooks.postprocess(html3);
39269 return throwError(e3);
39274 onError(silent, async) {
39276 e3.message += "\nPlease report this to https://github.com/markedjs/marked.";
39278 const msg = "<p>An error occurred:</p><pre>" + escape$1(e3.message + "", true) + "</pre>";
39280 return Promise.resolve(msg);
39285 return Promise.reject(e3);
39291 var markedInstance = new Marked();
39292 function marked(src, opt) {
39293 return markedInstance.parse(src, opt);
39295 marked.options = marked.setOptions = function(options2) {
39296 markedInstance.setOptions(options2);
39297 marked.defaults = markedInstance.defaults;
39298 changeDefaults(marked.defaults);
39301 marked.getDefaults = _getDefaults;
39302 marked.defaults = _defaults;
39303 marked.use = function(...args) {
39304 markedInstance.use(...args);
39305 marked.defaults = markedInstance.defaults;
39306 changeDefaults(marked.defaults);
39309 marked.walkTokens = function(tokens, callback) {
39310 return markedInstance.walkTokens(tokens, callback);
39312 marked.parseInline = markedInstance.parseInline;
39313 marked.Parser = _Parser;
39314 marked.parser = _Parser.parse;
39315 marked.Renderer = _Renderer;
39316 marked.TextRenderer = _TextRenderer;
39317 marked.Lexer = _Lexer;
39318 marked.lexer = _Lexer.lex;
39319 marked.Tokenizer = _Tokenizer;
39320 marked.Hooks = _Hooks;
39321 marked.parse = marked;
39322 var options = marked.options;
39323 var setOptions = marked.setOptions;
39324 var use = marked.use;
39325 var walkTokens = marked.walkTokens;
39326 var parseInline = marked.parseInline;
39327 var parser2 = _Parser.parse;
39328 var lexer = _Lexer.lex;
39330 // modules/services/osmose.js
39331 var tiler2 = utilTiler();
39332 var dispatch3 = dispatch_default("loaded");
39333 var _tileZoom2 = 14;
39334 var _osmoseUrlRoot = "https://osmose.openstreetmap.fr/api/0.3";
39335 var _osmoseData = { icons: {}, items: [] };
39337 function abortRequest2(controller) {
39339 controller.abort();
39342 function abortUnwantedRequests2(cache, tiles) {
39343 Object.keys(cache.inflightTile).forEach((k2) => {
39344 let wanted = tiles.find((tile) => k2 === tile.id);
39346 abortRequest2(cache.inflightTile[k2]);
39347 delete cache.inflightTile[k2];
39351 function encodeIssueRtree2(d2) {
39352 return { minX: d2.loc[0], minY: d2.loc[1], maxX: d2.loc[0], maxY: d2.loc[1], data: d2 };
39354 function updateRtree2(item, replace) {
39355 _cache2.rtree.remove(item, (a2, b2) => a2.data.id === b2.data.id);
39357 _cache2.rtree.insert(item);
39360 function preventCoincident(loc) {
39361 let coincident = false;
39363 let delta = coincident ? [1e-5, 0] : [0, 1e-5];
39364 loc = geoVecAdd(loc, delta);
39365 let bbox2 = geoExtent(loc).bbox();
39366 coincident = _cache2.rtree.search(bbox2).length;
39367 } while (coincident);
39370 var osmose_default = {
39373 _mainFileFetcher.get("qa_data").then((d2) => {
39374 _osmoseData = d2.osmose;
39375 _osmoseData.items = Object.keys(d2.osmose.icons).map((s2) => s2.split("-")[0]).reduce((unique, item) => unique.indexOf(item) !== -1 ? unique : [...unique, item], []);
39380 this.event = utilRebind(this, dispatch3, "on");
39386 Object.values(_cache2.inflightTile).forEach(abortRequest2);
39387 _strings = _cache2.strings;
39388 _colors = _cache2.colors;
39396 rtree: new RBush(),
39401 loadIssues(projection2) {
39403 // Tiles return a maximum # of issues
39404 // So we want to filter our request for only types iD supports
39405 item: _osmoseData.items
39407 let tiles = tiler2.zoomExtent([_tileZoom2, _tileZoom2]).getTiles(projection2);
39408 abortUnwantedRequests2(_cache2, tiles);
39409 tiles.forEach((tile) => {
39410 if (_cache2.loadedTile[tile.id] || _cache2.inflightTile[tile.id]) return;
39411 let [x2, y2, z2] = tile.xyz;
39412 let url = "".concat(_osmoseUrlRoot, "/issues/").concat(z2, "/").concat(x2, "/").concat(y2, ".geojson?") + utilQsString(params);
39413 let controller = new AbortController();
39414 _cache2.inflightTile[tile.id] = controller;
39415 json_default(url, { signal: controller.signal }).then((data) => {
39416 delete _cache2.inflightTile[tile.id];
39417 _cache2.loadedTile[tile.id] = true;
39418 if (data.features) {
39419 data.features.forEach((issue) => {
39420 const { item, class: cl, uuid: id2 } = issue.properties;
39421 const itemType = "".concat(item, "-").concat(cl);
39422 if (itemType in _osmoseData.icons) {
39423 let loc = issue.geometry.coordinates;
39424 loc = preventCoincident(loc);
39425 let d2 = new QAItem(loc, this, itemType, id2, { item });
39426 if (item === 8300 || item === 8360) {
39429 _cache2.data[d2.id] = d2;
39430 _cache2.rtree.insert(encodeIssueRtree2(d2));
39434 dispatch3.call("loaded");
39436 delete _cache2.inflightTile[tile.id];
39437 _cache2.loadedTile[tile.id] = true;
39441 loadIssueDetail(issue) {
39442 if (issue.elems !== void 0) {
39443 return Promise.resolve(issue);
39445 const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "?langs=").concat(_mainLocalizer.localeCode());
39446 const cacheDetails = (data) => {
39447 issue.elems = data.elems.map((e3) => e3.type.substring(0, 1) + e3.id);
39448 issue.detail = data.subtitle ? marked(data.subtitle.auto) : "";
39449 this.replaceItem(issue);
39451 return json_default(url).then(cacheDetails).then(() => issue);
39453 loadStrings(locale2 = _mainLocalizer.localeCode()) {
39454 const items = Object.keys(_osmoseData.icons);
39455 if (locale2 in _cache2.strings && Object.keys(_cache2.strings[locale2]).length === items.length) {
39456 return Promise.resolve(_cache2.strings[locale2]);
39458 if (!(locale2 in _cache2.strings)) {
39459 _cache2.strings[locale2] = {};
39461 const allRequests = items.map((itemType) => {
39462 if (itemType in _cache2.strings[locale2]) return null;
39463 const cacheData = (data) => {
39464 const [cat = { items: [] }] = data.categories;
39465 const [item2 = { class: [] }] = cat.items;
39466 const [cl2 = null] = item2.class;
39468 console.log("Osmose strings request (".concat(itemType, ") had unexpected data"));
39471 const { item: itemInt, color: color2 } = item2;
39472 if (/^#[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}/.test(color2)) {
39473 _cache2.colors[itemInt] = color2;
39475 const { title, detail, fix, trap } = cl2;
39476 let issueStrings = {};
39477 if (title) issueStrings.title = title.auto;
39478 if (detail) issueStrings.detail = marked(detail.auto);
39479 if (trap) issueStrings.trap = marked(trap.auto);
39480 if (fix) issueStrings.fix = marked(fix.auto);
39481 _cache2.strings[locale2][itemType] = issueStrings;
39483 const [item, cl] = itemType.split("-");
39484 const url = "".concat(_osmoseUrlRoot, "/items/").concat(item, "/class/").concat(cl, "?langs=").concat(locale2);
39485 return json_default(url).then(cacheData);
39486 }).filter(Boolean);
39487 return Promise.all(allRequests).then(() => _cache2.strings[locale2]);
39489 getStrings(itemType, locale2 = _mainLocalizer.localeCode()) {
39490 return locale2 in _cache2.strings ? _cache2.strings[locale2][itemType] : {};
39492 getColor(itemType) {
39493 return itemType in _cache2.colors ? _cache2.colors[itemType] : "#FFFFFF";
39495 postUpdate(issue, callback) {
39496 if (_cache2.inflightPost[issue.id]) {
39497 return callback({ message: "Issue update already inflight", status: -2 }, issue);
39499 const url = "".concat(_osmoseUrlRoot, "/issue/").concat(issue.id, "/").concat(issue.newStatus);
39500 const controller = new AbortController();
39501 const after = () => {
39502 delete _cache2.inflightPost[issue.id];
39503 this.removeItem(issue);
39504 if (issue.newStatus === "done") {
39505 if (!(issue.item in _cache2.closed)) {
39506 _cache2.closed[issue.item] = 0;
39508 _cache2.closed[issue.item] += 1;
39510 if (callback) callback(null, issue);
39512 _cache2.inflightPost[issue.id] = controller;
39513 fetch(url, { signal: controller.signal }).then(after).catch((err) => {
39514 delete _cache2.inflightPost[issue.id];
39515 if (callback) callback(err.message);
39518 // Get all cached QAItems covering the viewport
39519 getItems(projection2) {
39520 const viewport = projection2.clipExtent();
39521 const min3 = [viewport[0][0], viewport[1][1]];
39522 const max3 = [viewport[1][0], viewport[0][1]];
39523 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
39524 return _cache2.rtree.search(bbox2).map((d2) => d2.data);
39526 // Get a QAItem from cache
39527 // NOTE: Don't change method name until UI v3 is merged
39529 return _cache2.data[id2];
39531 // get the name of the icon to display for this item
39532 getIcon(itemType) {
39533 return _osmoseData.icons[itemType];
39535 // Replace a single QAItem in the cache
39536 replaceItem(item) {
39537 if (!(item instanceof QAItem) || !item.id) return;
39538 _cache2.data[item.id] = item;
39539 updateRtree2(encodeIssueRtree2(item), true);
39542 // Remove a single QAItem from the cache
39544 if (!(item instanceof QAItem) || !item.id) return;
39545 delete _cache2.data[item.id];
39546 updateRtree2(encodeIssueRtree2(item), false);
39548 // Used to populate `closed:osmose:*` changeset tags
39549 getClosedCounts() {
39550 return _cache2.closed;
39553 return "https://osmose.openstreetmap.fr/en/error/".concat(item.id);
39557 // node_modules/pbf/index.js
39558 var SHIFT_LEFT_32 = (1 << 16) * (1 << 16);
39559 var SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
39560 var TEXT_DECODER_MIN_LENGTH = 12;
39561 var utf8TextDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder("utf-8");
39562 var PBF_VARINT = 0;
39563 var PBF_FIXED64 = 1;
39565 var PBF_FIXED32 = 5;
39568 * @param {Uint8Array | ArrayBuffer} [buf]
39570 constructor(buf = new Uint8Array(16)) {
39571 this.buf = ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf);
39572 this.dataView = new DataView(this.buf.buffer);
39575 this.length = this.buf.length;
39577 // === READING =================================================================
39580 * @param {(tag: number, result: T, pbf: Pbf) => void} readField
39581 * @param {T} result
39582 * @param {number} [end]
39584 readFields(readField, result, end = this.length) {
39585 while (this.pos < end) {
39586 const val = this.readVarint(), tag2 = val >> 3, startPos = this.pos;
39587 this.type = val & 7;
39588 readField(tag2, result, this);
39589 if (this.pos === startPos) this.skip(val);
39595 * @param {(tag: number, result: T, pbf: Pbf) => void} readField
39596 * @param {T} result
39598 readMessage(readField, result) {
39599 return this.readFields(readField, result, this.readVarint() + this.pos);
39602 const val = this.dataView.getUint32(this.pos, true);
39607 const val = this.dataView.getInt32(this.pos, true);
39611 // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
39613 const val = this.dataView.getUint32(this.pos, true) + this.dataView.getUint32(this.pos + 4, true) * SHIFT_LEFT_32;
39618 const val = this.dataView.getUint32(this.pos, true) + this.dataView.getInt32(this.pos + 4, true) * SHIFT_LEFT_32;
39623 const val = this.dataView.getFloat32(this.pos, true);
39628 const val = this.dataView.getFloat64(this.pos, true);
39633 * @param {boolean} [isSigned]
39635 readVarint(isSigned) {
39636 const buf = this.buf;
39638 b2 = buf[this.pos++];
39640 if (b2 < 128) return val;
39641 b2 = buf[this.pos++];
39642 val |= (b2 & 127) << 7;
39643 if (b2 < 128) return val;
39644 b2 = buf[this.pos++];
39645 val |= (b2 & 127) << 14;
39646 if (b2 < 128) return val;
39647 b2 = buf[this.pos++];
39648 val |= (b2 & 127) << 21;
39649 if (b2 < 128) return val;
39650 b2 = buf[this.pos];
39651 val |= (b2 & 15) << 28;
39652 return readVarintRemainder(val, isSigned, this);
39655 return this.readVarint(true);
39658 const num = this.readVarint();
39659 return num % 2 === 1 ? (num + 1) / -2 : num / 2;
39662 return Boolean(this.readVarint());
39665 const end = this.readVarint() + this.pos;
39666 const pos = this.pos;
39668 if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
39669 return utf8TextDecoder.decode(this.buf.subarray(pos, end));
39671 return readUtf8(this.buf, pos, end);
39674 const end = this.readVarint() + this.pos, buffer = this.buf.subarray(this.pos, end);
39678 // verbose for performance reasons; doesn't affect gzipped size
39680 * @param {number[]} [arr]
39681 * @param {boolean} [isSigned]
39683 readPackedVarint(arr = [], isSigned) {
39684 const end = this.readPackedEnd();
39685 while (this.pos < end) arr.push(this.readVarint(isSigned));
39688 /** @param {number[]} [arr] */
39689 readPackedSVarint(arr = []) {
39690 const end = this.readPackedEnd();
39691 while (this.pos < end) arr.push(this.readSVarint());
39694 /** @param {boolean[]} [arr] */
39695 readPackedBoolean(arr = []) {
39696 const end = this.readPackedEnd();
39697 while (this.pos < end) arr.push(this.readBoolean());
39700 /** @param {number[]} [arr] */
39701 readPackedFloat(arr = []) {
39702 const end = this.readPackedEnd();
39703 while (this.pos < end) arr.push(this.readFloat());
39706 /** @param {number[]} [arr] */
39707 readPackedDouble(arr = []) {
39708 const end = this.readPackedEnd();
39709 while (this.pos < end) arr.push(this.readDouble());
39712 /** @param {number[]} [arr] */
39713 readPackedFixed32(arr = []) {
39714 const end = this.readPackedEnd();
39715 while (this.pos < end) arr.push(this.readFixed32());
39718 /** @param {number[]} [arr] */
39719 readPackedSFixed32(arr = []) {
39720 const end = this.readPackedEnd();
39721 while (this.pos < end) arr.push(this.readSFixed32());
39724 /** @param {number[]} [arr] */
39725 readPackedFixed64(arr = []) {
39726 const end = this.readPackedEnd();
39727 while (this.pos < end) arr.push(this.readFixed64());
39730 /** @param {number[]} [arr] */
39731 readPackedSFixed64(arr = []) {
39732 const end = this.readPackedEnd();
39733 while (this.pos < end) arr.push(this.readSFixed64());
39737 return this.type === PBF_BYTES ? this.readVarint() + this.pos : this.pos + 1;
39739 /** @param {number} val */
39741 const type2 = val & 7;
39742 if (type2 === PBF_VARINT) while (this.buf[this.pos++] > 127) {
39744 else if (type2 === PBF_BYTES) this.pos = this.readVarint() + this.pos;
39745 else if (type2 === PBF_FIXED32) this.pos += 4;
39746 else if (type2 === PBF_FIXED64) this.pos += 8;
39747 else throw new Error("Unimplemented type: ".concat(type2));
39749 // === WRITING =================================================================
39751 * @param {number} tag
39752 * @param {number} type
39754 writeTag(tag2, type2) {
39755 this.writeVarint(tag2 << 3 | type2);
39757 /** @param {number} min */
39759 let length2 = this.length || 16;
39760 while (length2 < this.pos + min3) length2 *= 2;
39761 if (length2 !== this.length) {
39762 const buf = new Uint8Array(length2);
39765 this.dataView = new DataView(buf.buffer);
39766 this.length = length2;
39770 this.length = this.pos;
39772 return this.buf.subarray(0, this.length);
39774 /** @param {number} val */
39775 writeFixed32(val) {
39777 this.dataView.setInt32(this.pos, val, true);
39780 /** @param {number} val */
39781 writeSFixed32(val) {
39783 this.dataView.setInt32(this.pos, val, true);
39786 /** @param {number} val */
39787 writeFixed64(val) {
39789 this.dataView.setInt32(this.pos, val & -1, true);
39790 this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
39793 /** @param {number} val */
39794 writeSFixed64(val) {
39796 this.dataView.setInt32(this.pos, val & -1, true);
39797 this.dataView.setInt32(this.pos + 4, Math.floor(val * SHIFT_RIGHT_32), true);
39800 /** @param {number} val */
39803 if (val > 268435455 || val < 0) {
39804 writeBigVarint(val, this);
39808 this.buf[this.pos++] = val & 127 | (val > 127 ? 128 : 0);
39809 if (val <= 127) return;
39810 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
39811 if (val <= 127) return;
39812 this.buf[this.pos++] = (val >>>= 7) & 127 | (val > 127 ? 128 : 0);
39813 if (val <= 127) return;
39814 this.buf[this.pos++] = val >>> 7 & 127;
39816 /** @param {number} val */
39817 writeSVarint(val) {
39818 this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
39820 /** @param {boolean} val */
39821 writeBoolean(val) {
39822 this.writeVarint(+val);
39824 /** @param {string} str */
39827 this.realloc(str.length * 4);
39829 const startPos = this.pos;
39830 this.pos = writeUtf8(this.buf, str, this.pos);
39831 const len = this.pos - startPos;
39832 if (len >= 128) makeRoomForExtraLength(startPos, len, this);
39833 this.pos = startPos - 1;
39834 this.writeVarint(len);
39837 /** @param {number} val */
39840 this.dataView.setFloat32(this.pos, val, true);
39843 /** @param {number} val */
39846 this.dataView.setFloat64(this.pos, val, true);
39849 /** @param {Uint8Array} buffer */
39850 writeBytes(buffer) {
39851 const len = buffer.length;
39852 this.writeVarint(len);
39854 for (let i3 = 0; i3 < len; i3++) this.buf[this.pos++] = buffer[i3];
39858 * @param {(obj: T, pbf: Pbf) => void} fn
39861 writeRawMessage(fn, obj) {
39863 const startPos = this.pos;
39865 const len = this.pos - startPos;
39866 if (len >= 128) makeRoomForExtraLength(startPos, len, this);
39867 this.pos = startPos - 1;
39868 this.writeVarint(len);
39873 * @param {number} tag
39874 * @param {(obj: T, pbf: Pbf) => void} fn
39877 writeMessage(tag2, fn, obj) {
39878 this.writeTag(tag2, PBF_BYTES);
39879 this.writeRawMessage(fn, obj);
39882 * @param {number} tag
39883 * @param {number[]} arr
39885 writePackedVarint(tag2, arr) {
39886 if (arr.length) this.writeMessage(tag2, writePackedVarint, arr);
39889 * @param {number} tag
39890 * @param {number[]} arr
39892 writePackedSVarint(tag2, arr) {
39893 if (arr.length) this.writeMessage(tag2, writePackedSVarint, arr);
39896 * @param {number} tag
39897 * @param {boolean[]} arr
39899 writePackedBoolean(tag2, arr) {
39900 if (arr.length) this.writeMessage(tag2, writePackedBoolean, arr);
39903 * @param {number} tag
39904 * @param {number[]} arr
39906 writePackedFloat(tag2, arr) {
39907 if (arr.length) this.writeMessage(tag2, writePackedFloat, arr);
39910 * @param {number} tag
39911 * @param {number[]} arr
39913 writePackedDouble(tag2, arr) {
39914 if (arr.length) this.writeMessage(tag2, writePackedDouble, arr);
39917 * @param {number} tag
39918 * @param {number[]} arr
39920 writePackedFixed32(tag2, arr) {
39921 if (arr.length) this.writeMessage(tag2, writePackedFixed32, arr);
39924 * @param {number} tag
39925 * @param {number[]} arr
39927 writePackedSFixed32(tag2, arr) {
39928 if (arr.length) this.writeMessage(tag2, writePackedSFixed32, arr);
39931 * @param {number} tag
39932 * @param {number[]} arr
39934 writePackedFixed64(tag2, arr) {
39935 if (arr.length) this.writeMessage(tag2, writePackedFixed64, arr);
39938 * @param {number} tag
39939 * @param {number[]} arr
39941 writePackedSFixed64(tag2, arr) {
39942 if (arr.length) this.writeMessage(tag2, writePackedSFixed64, arr);
39945 * @param {number} tag
39946 * @param {Uint8Array} buffer
39948 writeBytesField(tag2, buffer) {
39949 this.writeTag(tag2, PBF_BYTES);
39950 this.writeBytes(buffer);
39953 * @param {number} tag
39954 * @param {number} val
39956 writeFixed32Field(tag2, val) {
39957 this.writeTag(tag2, PBF_FIXED32);
39958 this.writeFixed32(val);
39961 * @param {number} tag
39962 * @param {number} val
39964 writeSFixed32Field(tag2, val) {
39965 this.writeTag(tag2, PBF_FIXED32);
39966 this.writeSFixed32(val);
39969 * @param {number} tag
39970 * @param {number} val
39972 writeFixed64Field(tag2, val) {
39973 this.writeTag(tag2, PBF_FIXED64);
39974 this.writeFixed64(val);
39977 * @param {number} tag
39978 * @param {number} val
39980 writeSFixed64Field(tag2, val) {
39981 this.writeTag(tag2, PBF_FIXED64);
39982 this.writeSFixed64(val);
39985 * @param {number} tag
39986 * @param {number} val
39988 writeVarintField(tag2, val) {
39989 this.writeTag(tag2, PBF_VARINT);
39990 this.writeVarint(val);
39993 * @param {number} tag
39994 * @param {number} val
39996 writeSVarintField(tag2, val) {
39997 this.writeTag(tag2, PBF_VARINT);
39998 this.writeSVarint(val);
40001 * @param {number} tag
40002 * @param {string} str
40004 writeStringField(tag2, str) {
40005 this.writeTag(tag2, PBF_BYTES);
40006 this.writeString(str);
40009 * @param {number} tag
40010 * @param {number} val
40012 writeFloatField(tag2, val) {
40013 this.writeTag(tag2, PBF_FIXED32);
40014 this.writeFloat(val);
40017 * @param {number} tag
40018 * @param {number} val
40020 writeDoubleField(tag2, val) {
40021 this.writeTag(tag2, PBF_FIXED64);
40022 this.writeDouble(val);
40025 * @param {number} tag
40026 * @param {boolean} val
40028 writeBooleanField(tag2, val) {
40029 this.writeVarintField(tag2, +val);
40032 function readVarintRemainder(l2, s2, p2) {
40033 const buf = p2.buf;
40035 b2 = buf[p2.pos++];
40036 h2 = (b2 & 112) >> 4;
40037 if (b2 < 128) return toNum(l2, h2, s2);
40038 b2 = buf[p2.pos++];
40039 h2 |= (b2 & 127) << 3;
40040 if (b2 < 128) return toNum(l2, h2, s2);
40041 b2 = buf[p2.pos++];
40042 h2 |= (b2 & 127) << 10;
40043 if (b2 < 128) return toNum(l2, h2, s2);
40044 b2 = buf[p2.pos++];
40045 h2 |= (b2 & 127) << 17;
40046 if (b2 < 128) return toNum(l2, h2, s2);
40047 b2 = buf[p2.pos++];
40048 h2 |= (b2 & 127) << 24;
40049 if (b2 < 128) return toNum(l2, h2, s2);
40050 b2 = buf[p2.pos++];
40051 h2 |= (b2 & 1) << 31;
40052 if (b2 < 128) return toNum(l2, h2, s2);
40053 throw new Error("Expected varint not more than 10 bytes");
40055 function toNum(low, high, isSigned) {
40056 return isSigned ? high * 4294967296 + (low >>> 0) : (high >>> 0) * 4294967296 + (low >>> 0);
40058 function writeBigVarint(val, pbf) {
40061 low = val % 4294967296 | 0;
40062 high = val / 4294967296 | 0;
40064 low = ~(-val % 4294967296);
40065 high = ~(-val / 4294967296);
40066 if (low ^ 4294967295) {
40070 high = high + 1 | 0;
40073 if (val >= 18446744073709552e3 || val < -18446744073709552e3) {
40074 throw new Error("Given varint doesn't fit into 10 bytes");
40077 writeBigVarintLow(low, high, pbf);
40078 writeBigVarintHigh(high, pbf);
40080 function writeBigVarintLow(low, high, pbf) {
40081 pbf.buf[pbf.pos++] = low & 127 | 128;
40083 pbf.buf[pbf.pos++] = low & 127 | 128;
40085 pbf.buf[pbf.pos++] = low & 127 | 128;
40087 pbf.buf[pbf.pos++] = low & 127 | 128;
40089 pbf.buf[pbf.pos] = low & 127;
40091 function writeBigVarintHigh(high, pbf) {
40092 const lsb = (high & 7) << 4;
40093 pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 128 : 0);
40095 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40097 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40099 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40101 pbf.buf[pbf.pos++] = high & 127 | ((high >>>= 7) ? 128 : 0);
40103 pbf.buf[pbf.pos++] = high & 127;
40105 function makeRoomForExtraLength(startPos, len, pbf) {
40106 const extraLen = len <= 16383 ? 1 : len <= 2097151 ? 2 : len <= 268435455 ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
40107 pbf.realloc(extraLen);
40108 for (let i3 = pbf.pos - 1; i3 >= startPos; i3--) pbf.buf[i3 + extraLen] = pbf.buf[i3];
40110 function writePackedVarint(arr, pbf) {
40111 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeVarint(arr[i3]);
40113 function writePackedSVarint(arr, pbf) {
40114 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSVarint(arr[i3]);
40116 function writePackedFloat(arr, pbf) {
40117 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFloat(arr[i3]);
40119 function writePackedDouble(arr, pbf) {
40120 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeDouble(arr[i3]);
40122 function writePackedBoolean(arr, pbf) {
40123 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeBoolean(arr[i3]);
40125 function writePackedFixed32(arr, pbf) {
40126 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed32(arr[i3]);
40128 function writePackedSFixed32(arr, pbf) {
40129 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed32(arr[i3]);
40131 function writePackedFixed64(arr, pbf) {
40132 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeFixed64(arr[i3]);
40134 function writePackedSFixed64(arr, pbf) {
40135 for (let i3 = 0; i3 < arr.length; i3++) pbf.writeSFixed64(arr[i3]);
40137 function readUtf8(buf, pos, end) {
40141 const b0 = buf[i3];
40143 let bytesPerSequence = b0 > 239 ? 4 : b0 > 223 ? 3 : b0 > 191 ? 2 : 1;
40144 if (i3 + bytesPerSequence > end) break;
40146 if (bytesPerSequence === 1) {
40150 } else if (bytesPerSequence === 2) {
40152 if ((b1 & 192) === 128) {
40153 c2 = (b0 & 31) << 6 | b1 & 63;
40158 } else if (bytesPerSequence === 3) {
40161 if ((b1 & 192) === 128 && (b2 & 192) === 128) {
40162 c2 = (b0 & 15) << 12 | (b1 & 63) << 6 | b2 & 63;
40163 if (c2 <= 2047 || c2 >= 55296 && c2 <= 57343) {
40167 } else if (bytesPerSequence === 4) {
40171 if ((b1 & 192) === 128 && (b2 & 192) === 128 && (b3 & 192) === 128) {
40172 c2 = (b0 & 15) << 18 | (b1 & 63) << 12 | (b2 & 63) << 6 | b3 & 63;
40173 if (c2 <= 65535 || c2 >= 1114112) {
40180 bytesPerSequence = 1;
40181 } else if (c2 > 65535) {
40183 str += String.fromCharCode(c2 >>> 10 & 1023 | 55296);
40184 c2 = 56320 | c2 & 1023;
40186 str += String.fromCharCode(c2);
40187 i3 += bytesPerSequence;
40191 function writeUtf8(buf, str, pos) {
40192 for (let i3 = 0, c2, lead; i3 < str.length; i3++) {
40193 c2 = str.charCodeAt(i3);
40194 if (c2 > 55295 && c2 < 57344) {
40203 c2 = lead - 55296 << 10 | c2 - 56320 | 65536;
40207 if (c2 > 56319 || i3 + 1 === str.length) {
40226 buf[pos++] = c2 >> 6 | 192;
40229 buf[pos++] = c2 >> 12 | 224;
40231 buf[pos++] = c2 >> 18 | 240;
40232 buf[pos++] = c2 >> 12 & 63 | 128;
40234 buf[pos++] = c2 >> 6 & 63 | 128;
40236 buf[pos++] = c2 & 63 | 128;
40242 // node_modules/@mapbox/point-geometry/index.js
40243 function Point(x2, y2) {
40247 Point.prototype = {
40249 * Clone this point, returning a new point that can be modified
40250 * without affecting the old one.
40251 * @return {Point} the clone
40254 return new Point(this.x, this.y);
40257 * Add this point's x & y coordinates to another point,
40258 * yielding a new point.
40259 * @param {Point} p the other point
40260 * @return {Point} output point
40263 return this.clone()._add(p2);
40266 * Subtract this point's x & y coordinates to from point,
40267 * yielding a new point.
40268 * @param {Point} p the other point
40269 * @return {Point} output point
40272 return this.clone()._sub(p2);
40275 * Multiply this point's x & y coordinates by point,
40276 * yielding a new point.
40277 * @param {Point} p the other point
40278 * @return {Point} output point
40281 return this.clone()._multByPoint(p2);
40284 * Divide this point's x & y coordinates by point,
40285 * yielding a new point.
40286 * @param {Point} p the other point
40287 * @return {Point} output point
40290 return this.clone()._divByPoint(p2);
40293 * Multiply this point's x & y coordinates by a factor,
40294 * yielding a new point.
40295 * @param {number} k factor
40296 * @return {Point} output point
40299 return this.clone()._mult(k2);
40302 * Divide this point's x & y coordinates by a factor,
40303 * yielding a new point.
40304 * @param {number} k factor
40305 * @return {Point} output point
40308 return this.clone()._div(k2);
40311 * Rotate this point around the 0, 0 origin by an angle a,
40313 * @param {number} a angle to rotate around, in radians
40314 * @return {Point} output point
40317 return this.clone()._rotate(a2);
40320 * Rotate this point around p point by an angle a,
40322 * @param {number} a angle to rotate around, in radians
40323 * @param {Point} p Point to rotate around
40324 * @return {Point} output point
40326 rotateAround(a2, p2) {
40327 return this.clone()._rotateAround(a2, p2);
40330 * Multiply this point by a 4x1 transformation matrix
40331 * @param {[number, number, number, number]} m transformation matrix
40332 * @return {Point} output point
40335 return this.clone()._matMult(m2);
40338 * Calculate this point but as a unit vector from 0, 0, meaning
40339 * that the distance from the resulting point to the 0, 0
40340 * coordinate will be equal to 1 and the angle from the resulting
40341 * point to the 0, 0 coordinate will be the same as before.
40342 * @return {Point} unit vector point
40345 return this.clone()._unit();
40348 * Compute a perpendicular point, where the new y coordinate
40349 * is the old x coordinate and the new x coordinate is the old y
40350 * coordinate multiplied by -1
40351 * @return {Point} perpendicular point
40354 return this.clone()._perp();
40357 * Return a version of this point with the x & y coordinates
40358 * rounded to integers.
40359 * @return {Point} rounded point
40362 return this.clone()._round();
40365 * Return the magnitude of this point: this is the Euclidean
40366 * distance from the 0, 0 coordinate to this point's x and y
40368 * @return {number} magnitude
40371 return Math.sqrt(this.x * this.x + this.y * this.y);
40374 * Judge whether this point is equal to another point, returning
40376 * @param {Point} other the other point
40377 * @return {boolean} whether the points are equal
40380 return this.x === other.x && this.y === other.y;
40383 * Calculate the distance from this point to another point
40384 * @param {Point} p the other point
40385 * @return {number} distance
40388 return Math.sqrt(this.distSqr(p2));
40391 * Calculate the distance from this point to another point,
40392 * without the square root step. Useful if you're comparing
40393 * relative distances.
40394 * @param {Point} p the other point
40395 * @return {number} distance
40398 const dx = p2.x - this.x, dy = p2.y - this.y;
40399 return dx * dx + dy * dy;
40402 * Get the angle from the 0, 0 coordinate to this point, in radians
40404 * @return {number} angle
40407 return Math.atan2(this.y, this.x);
40410 * Get the angle from this point to another point, in radians
40411 * @param {Point} b the other point
40412 * @return {number} angle
40415 return Math.atan2(this.y - b2.y, this.x - b2.x);
40418 * Get the angle between this point and another point, in radians
40419 * @param {Point} b the other point
40420 * @return {number} angle
40423 return this.angleWithSep(b2.x, b2.y);
40426 * Find the angle of the two vectors, solving the formula for
40427 * the cross product a x b = |a||b|sin(θ) for θ.
40428 * @param {number} x the x-coordinate
40429 * @param {number} y the y-coordinate
40430 * @return {number} the angle in radians
40432 angleWithSep(x2, y2) {
40434 this.x * y2 - this.y * x2,
40435 this.x * x2 + this.y * y2
40438 /** @param {[number, number, number, number]} m */
40440 const x2 = m2[0] * this.x + m2[1] * this.y, y2 = m2[2] * this.x + m2[3] * this.y;
40445 /** @param {Point} p */
40451 /** @param {Point} p */
40457 /** @param {number} k */
40463 /** @param {number} k */
40469 /** @param {Point} p */
40475 /** @param {Point} p */
40482 this._div(this.mag());
40491 /** @param {number} angle */
40493 const cos2 = Math.cos(angle2), sin2 = Math.sin(angle2), x2 = cos2 * this.x - sin2 * this.y, y2 = sin2 * this.x + cos2 * this.y;
40499 * @param {number} angle
40502 _rotateAround(angle2, p2) {
40503 const 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);
40509 this.x = Math.round(this.x);
40510 this.y = Math.round(this.y);
40515 Point.convert = function(p2) {
40516 if (p2 instanceof Point) {
40518 /** @type {Point} */
40522 if (Array.isArray(p2)) {
40523 return new Point(+p2[0], +p2[1]);
40525 if (p2.x !== void 0 && p2.y !== void 0) {
40526 return new Point(+p2.x, +p2.y);
40528 throw new Error("Expected [x, y] or {x, y} point format");
40531 // node_modules/@mapbox/vector-tile/index.js
40532 var VectorTileFeature = class {
40535 * @param {number} end
40536 * @param {number} extent
40537 * @param {string[]} keys
40538 * @param {unknown[]} values
40540 constructor(pbf, end, extent, keys2, values) {
40541 this.properties = {};
40542 this.extent = extent;
40546 this._geometry = -1;
40547 this._keys = keys2;
40548 this._values = values;
40549 pbf.readFields(readFeature, this, end);
40552 const pbf = this._pbf;
40553 pbf.pos = this._geometry;
40554 const end = pbf.readVarint() + pbf.pos;
40561 while (pbf.pos < end) {
40562 if (length2 <= 0) {
40563 const cmdLen = pbf.readVarint();
40565 length2 = cmdLen >> 3;
40568 if (cmd === 1 || cmd === 2) {
40569 x2 += pbf.readSVarint();
40570 y2 += pbf.readSVarint();
40572 if (line) lines.push(line);
40575 if (line) line.push(new Point(x2, y2));
40576 } else if (cmd === 7) {
40578 line.push(line[0].clone());
40581 throw new Error("unknown command ".concat(cmd));
40584 if (line) lines.push(line);
40588 const pbf = this._pbf;
40589 pbf.pos = this._geometry;
40590 const end = pbf.readVarint() + pbf.pos;
40591 let cmd = 1, length2 = 0, x2 = 0, y2 = 0, x12 = Infinity, x22 = -Infinity, y12 = Infinity, y22 = -Infinity;
40592 while (pbf.pos < end) {
40593 if (length2 <= 0) {
40594 const cmdLen = pbf.readVarint();
40596 length2 = cmdLen >> 3;
40599 if (cmd === 1 || cmd === 2) {
40600 x2 += pbf.readSVarint();
40601 y2 += pbf.readSVarint();
40602 if (x2 < x12) x12 = x2;
40603 if (x2 > x22) x22 = x2;
40604 if (y2 < y12) y12 = y2;
40605 if (y2 > y22) y22 = y2;
40606 } else if (cmd !== 7) {
40607 throw new Error("unknown command ".concat(cmd));
40610 return [x12, y12, x22, y22];
40613 * @param {number} x
40614 * @param {number} y
40615 * @param {number} z
40616 * @return {Feature}
40618 toGeoJSON(x2, y2, z2) {
40619 const size = this.extent * Math.pow(2, z2), x05 = this.extent * x2, y05 = this.extent * y2, vtCoords = this.loadGeometry();
40620 function projectPoint(p2) {
40622 (p2.x + x05) * 360 / size - 180,
40623 360 / Math.PI * Math.atan(Math.exp((1 - (p2.y + y05) * 2 / size) * Math.PI)) - 90
40626 function projectLine(line) {
40627 return line.map(projectPoint);
40630 if (this.type === 1) {
40632 for (const line of vtCoords) {
40633 points.push(line[0]);
40635 const coordinates = projectLine(points);
40636 geometry = points.length === 1 ? { type: "Point", coordinates: coordinates[0] } : { type: "MultiPoint", coordinates };
40637 } else if (this.type === 2) {
40638 const coordinates = vtCoords.map(projectLine);
40639 geometry = coordinates.length === 1 ? { type: "LineString", coordinates: coordinates[0] } : { type: "MultiLineString", coordinates };
40640 } else if (this.type === 3) {
40641 const polygons = classifyRings(vtCoords);
40642 const coordinates = [];
40643 for (const polygon2 of polygons) {
40644 coordinates.push(polygon2.map(projectLine));
40646 geometry = coordinates.length === 1 ? { type: "Polygon", coordinates: coordinates[0] } : { type: "MultiPolygon", coordinates };
40648 throw new Error("unknown feature type");
40653 properties: this.properties
40655 if (this.id != null) {
40656 result.id = this.id;
40661 VectorTileFeature.types = ["Unknown", "Point", "LineString", "Polygon"];
40662 function readFeature(tag2, feature3, pbf) {
40663 if (tag2 === 1) feature3.id = pbf.readVarint();
40664 else if (tag2 === 2) readTag(pbf, feature3);
40665 else if (tag2 === 3) feature3.type = /** @type {0 | 1 | 2 | 3} */
40667 else if (tag2 === 4) feature3._geometry = pbf.pos;
40669 function readTag(pbf, feature3) {
40670 const end = pbf.readVarint() + pbf.pos;
40671 while (pbf.pos < end) {
40672 const key = feature3._keys[pbf.readVarint()], value = feature3._values[pbf.readVarint()];
40673 feature3.properties[key] = value;
40676 function classifyRings(rings) {
40677 const len = rings.length;
40678 if (len <= 1) return [rings];
40679 const polygons = [];
40681 for (let i3 = 0; i3 < len; i3++) {
40682 const area = signedArea(rings[i3]);
40683 if (area === 0) continue;
40684 if (ccw === void 0) ccw = area < 0;
40685 if (ccw === area < 0) {
40686 if (polygon2) polygons.push(polygon2);
40687 polygon2 = [rings[i3]];
40688 } else if (polygon2) {
40689 polygon2.push(rings[i3]);
40692 if (polygon2) polygons.push(polygon2);
40695 function signedArea(ring) {
40697 for (let i3 = 0, len = ring.length, j2 = len - 1, p1, p2; i3 < len; j2 = i3++) {
40700 sum += (p2.x - p1.x) * (p1.y + p2.y);
40704 var VectorTileLayer = class {
40707 * @param {number} [end]
40709 constructor(pbf, end) {
40712 this.extent = 4096;
40717 this._features = [];
40718 pbf.readFields(readLayer, this, end);
40719 this.length = this._features.length;
40721 /** return feature `i` from this layer as a `VectorTileFeature`
40722 * @param {number} i
40725 if (i3 < 0 || i3 >= this._features.length) throw new Error("feature index out of bounds");
40726 this._pbf.pos = this._features[i3];
40727 const end = this._pbf.readVarint() + this._pbf.pos;
40728 return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
40731 function readLayer(tag2, layer, pbf) {
40732 if (tag2 === 15) layer.version = pbf.readVarint();
40733 else if (tag2 === 1) layer.name = pbf.readString();
40734 else if (tag2 === 5) layer.extent = pbf.readVarint();
40735 else if (tag2 === 2) layer._features.push(pbf.pos);
40736 else if (tag2 === 3) layer._keys.push(pbf.readString());
40737 else if (tag2 === 4) layer._values.push(readValueMessage(pbf));
40739 function readValueMessage(pbf) {
40741 const end = pbf.readVarint() + pbf.pos;
40742 while (pbf.pos < end) {
40743 const tag2 = pbf.readVarint() >> 3;
40744 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;
40748 var VectorTile = class {
40751 * @param {number} [end]
40753 constructor(pbf, end) {
40754 this.layers = pbf.readFields(readTile, {}, end);
40757 function readTile(tag2, layers, pbf) {
40759 const layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
40760 if (layer.length) layers[layer.name] = layer;
40764 // modules/services/mapillary.js
40765 var accessToken = "MLY|4100327730013843|5bb78b81720791946a9a7b956c57b7cf";
40766 var apiUrl = "https://graph.mapillary.com/";
40767 var baseTileUrl = "https://tiles.mapillary.com/maps/vtp";
40768 var mapFeatureTileUrl = "".concat(baseTileUrl, "/mly_map_feature_point/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40769 var tileUrl = "".concat(baseTileUrl, "/mly1_public/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40770 var trafficSignTileUrl = "".concat(baseTileUrl, "/mly_map_feature_traffic_sign/2/{z}/{x}/{y}?access_token=").concat(accessToken);
40771 var viewercss = "mapillary-js/mapillary.css";
40772 var viewerjs = "mapillary-js/mapillary.js";
40774 var dispatch4 = dispatch_default("change", "loadedImages", "loadedSigns", "loadedMapFeatures", "bearingChanged", "imageChanged");
40775 var _loadViewerPromise;
40776 var _mlyActiveImage;
40778 var _mlyFallback = false;
40779 var _mlyHighlightedDetection;
40780 var _mlyShowFeatureDetections = false;
40781 var _mlyShowSignDetections = false;
40783 var _mlyViewerFilter = ["all"];
40784 var _isViewerOpen = false;
40785 function loadTiles(which, url, maxZoom2, projection2) {
40786 const tiler8 = utilTiler().zoomExtent([minZoom, maxZoom2]).skipNullIsland(true);
40787 const tiles = tiler8.getTiles(projection2);
40788 tiles.forEach(function(tile) {
40789 loadTile(which, url, tile);
40792 function loadTile(which, url, tile) {
40793 const cache = _mlyCache.requests;
40794 const tileId = "".concat(tile.id, "-").concat(which);
40795 if (cache.loaded[tileId] || cache.inflight[tileId]) return;
40796 const controller = new AbortController();
40797 cache.inflight[tileId] = controller;
40798 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
40799 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
40800 if (!response.ok) {
40801 throw new Error(response.status + " " + response.statusText);
40803 cache.loaded[tileId] = true;
40804 delete cache.inflight[tileId];
40805 return response.arrayBuffer();
40806 }).then(function(data) {
40808 throw new Error("No Data");
40810 loadTileDataToCache(data, tile, which);
40811 if (which === "images") {
40812 dispatch4.call("loadedImages");
40813 } else if (which === "signs") {
40814 dispatch4.call("loadedSigns");
40815 } else if (which === "points") {
40816 dispatch4.call("loadedMapFeatures");
40818 }).catch(function() {
40819 cache.loaded[tileId] = true;
40820 delete cache.inflight[tileId];
40823 function loadTileDataToCache(data, tile, which) {
40824 const vectorTile = new VectorTile(new Pbf(data));
40825 let features, cache, layer, i3, feature3, loc, d2;
40826 if (vectorTile.layers.hasOwnProperty("image")) {
40828 cache = _mlyCache.images;
40829 layer = vectorTile.layers.image;
40830 for (i3 = 0; i3 < layer.length; i3++) {
40831 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40832 loc = feature3.geometry.coordinates;
40835 captured_at: feature3.properties.captured_at,
40836 ca: feature3.properties.compass_angle,
40837 id: feature3.properties.id,
40838 is_pano: feature3.properties.is_pano,
40839 sequence_id: feature3.properties.sequence_id
40841 cache.forImageId[d2.id] = d2;
40851 cache.rtree.load(features);
40854 if (vectorTile.layers.hasOwnProperty("sequence")) {
40856 cache = _mlyCache.sequences;
40857 layer = vectorTile.layers.sequence;
40858 for (i3 = 0; i3 < layer.length; i3++) {
40859 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40860 if (cache.lineString[feature3.properties.id]) {
40861 cache.lineString[feature3.properties.id].push(feature3);
40863 cache.lineString[feature3.properties.id] = [feature3];
40867 if (vectorTile.layers.hasOwnProperty("point")) {
40869 cache = _mlyCache[which];
40870 layer = vectorTile.layers.point;
40871 for (i3 = 0; i3 < layer.length; i3++) {
40872 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40873 loc = feature3.geometry.coordinates;
40876 id: feature3.properties.id,
40877 first_seen_at: feature3.properties.first_seen_at,
40878 last_seen_at: feature3.properties.last_seen_at,
40879 value: feature3.properties.value
40890 cache.rtree.load(features);
40893 if (vectorTile.layers.hasOwnProperty("traffic_sign")) {
40895 cache = _mlyCache[which];
40896 layer = vectorTile.layers.traffic_sign;
40897 for (i3 = 0; i3 < layer.length; i3++) {
40898 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
40899 loc = feature3.geometry.coordinates;
40902 id: feature3.properties.id,
40903 first_seen_at: feature3.properties.first_seen_at,
40904 last_seen_at: feature3.properties.last_seen_at,
40905 value: feature3.properties.value
40916 cache.rtree.load(features);
40920 function loadData(url) {
40921 return fetch(url).then(function(response) {
40922 if (!response.ok) {
40923 throw new Error(response.status + " " + response.statusText);
40925 return response.json();
40926 }).then(function(result) {
40930 return result.data || [];
40933 function partitionViewport(projection2) {
40934 const z2 = geoScaleToZoom(projection2.scale());
40935 const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
40936 const tiler8 = utilTiler().zoomExtent([z22, z22]);
40937 return tiler8.getTiles(projection2).map(function(tile) {
40938 return tile.extent;
40941 function searchLimited(limit, projection2, rtree) {
40942 limit = limit || 5;
40943 return partitionViewport(projection2).reduce(function(result, extent) {
40944 const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
40947 return found.length ? result.concat(found) : result;
40950 var mapillary_default = {
40951 // Initialize Mapillary
40956 this.event = utilRebind(this, dispatch4, "on");
40958 // Reset cache and state
40959 reset: function() {
40961 Object.values(_mlyCache.requests.inflight).forEach(function(request3) {
40966 images: { rtree: new RBush(), forImageId: {} },
40967 image_detections: { forImageId: {} },
40968 signs: { rtree: new RBush() },
40969 points: { rtree: new RBush() },
40970 sequences: { rtree: new RBush(), lineString: {} },
40971 requests: { loaded: {}, inflight: {} }
40973 _mlyActiveImage = null;
40975 // Get visible images
40976 images: function(projection2) {
40978 return searchLimited(limit, projection2, _mlyCache.images.rtree);
40980 // Get visible traffic signs
40981 signs: function(projection2) {
40983 return searchLimited(limit, projection2, _mlyCache.signs.rtree);
40985 // Get visible map (point) features
40986 mapFeatures: function(projection2) {
40988 return searchLimited(limit, projection2, _mlyCache.points.rtree);
40990 // Get cached image by id
40991 cachedImage: function(imageId) {
40992 return _mlyCache.images.forImageId[imageId];
40994 // Get visible sequences
40995 sequences: function(projection2) {
40996 const viewport = projection2.clipExtent();
40997 const min3 = [viewport[0][0], viewport[1][1]];
40998 const max3 = [viewport[1][0], viewport[0][1]];
40999 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
41000 const sequenceIds = {};
41001 let lineStrings = [];
41002 _mlyCache.images.rtree.search(bbox2).forEach(function(d2) {
41003 if (d2.data.sequence_id) {
41004 sequenceIds[d2.data.sequence_id] = true;
41007 Object.keys(sequenceIds).forEach(function(sequenceId) {
41008 if (_mlyCache.sequences.lineString[sequenceId]) {
41009 lineStrings = lineStrings.concat(_mlyCache.sequences.lineString[sequenceId]);
41012 return lineStrings;
41014 // Load images in the visible area
41015 loadImages: function(projection2) {
41016 loadTiles("images", tileUrl, 14, projection2);
41018 // Load traffic signs in the visible area
41019 loadSigns: function(projection2) {
41020 loadTiles("signs", trafficSignTileUrl, 14, projection2);
41022 // Load map (point) features in the visible area
41023 loadMapFeatures: function(projection2) {
41024 loadTiles("points", mapFeatureTileUrl, 14, projection2);
41026 // Return a promise that resolves when the image viewer (Mapillary JS) library has finished loading
41027 ensureViewerLoaded: function(context) {
41028 if (_loadViewerPromise) return _loadViewerPromise;
41029 const wrap2 = context.container().select(".photoviewer").selectAll(".mly-wrapper").data([0]);
41030 wrap2.enter().append("div").attr("id", "ideditor-mly").attr("class", "photo-wrapper mly-wrapper").classed("hide", true);
41032 _loadViewerPromise = new Promise((resolve, reject) => {
41033 let loadedCount = 0;
41034 function loaded() {
41036 if (loadedCount === 2) resolve();
41038 const head = select_default2("head");
41039 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() {
41042 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() {
41045 }).catch(function() {
41046 _loadViewerPromise = null;
41047 }).then(function() {
41048 that.initViewer(context);
41050 return _loadViewerPromise;
41052 // Load traffic sign image sprites
41053 loadSignResources: function(context) {
41054 context.ui().svgDefs.addSprites(
41055 ["mapillary-sprite"],
41057 /* don't override colors */
41061 // Load map (point) feature image sprites
41062 loadObjectResources: function(context) {
41063 context.ui().svgDefs.addSprites(
41064 ["mapillary-object-sprite"],
41066 /* don't override colors */
41070 // Remove previous detections in image viewer
41071 resetTags: function() {
41072 if (_mlyViewer && !_mlyFallback) {
41073 _mlyViewer.getComponent("tag").removeAll();
41076 // Show map feature detections in image viewer
41077 showFeatureDetections: function(value) {
41078 _mlyShowFeatureDetections = value;
41079 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41083 // Show traffic sign detections in image viewer
41084 showSignDetections: function(value) {
41085 _mlyShowSignDetections = value;
41086 if (!_mlyShowFeatureDetections && !_mlyShowSignDetections) {
41090 // Apply filter to image viewer
41091 filterViewer: function(context) {
41092 const showsPano = context.photos().showsPanoramic();
41093 const showsFlat = context.photos().showsFlat();
41094 const fromDate = context.photos().fromDate();
41095 const toDate = context.photos().toDate();
41096 const filter2 = ["all"];
41097 if (!showsPano) filter2.push(["!=", "cameraType", "spherical"]);
41098 if (!showsFlat && showsPano) filter2.push(["==", "pano", true]);
41100 filter2.push([">=", "capturedAt", new Date(fromDate).getTime()]);
41103 filter2.push([">=", "capturedAt", new Date(toDate).getTime()]);
41106 _mlyViewer.setFilter(filter2);
41108 _mlyViewerFilter = filter2;
41111 // Make the image viewer visible
41112 showViewer: function(context) {
41113 const wrap2 = context.container().select(".photoviewer").classed("hide", false);
41114 const isHidden = wrap2.selectAll(".photo-wrapper.mly-wrapper.hide").size();
41115 if (isHidden && _mlyViewer) {
41116 wrap2.selectAll(".photo-wrapper:not(.mly-wrapper)").classed("hide", true);
41117 wrap2.selectAll(".photo-wrapper.mly-wrapper").classed("hide", false);
41118 _mlyViewer.resize();
41120 _isViewerOpen = true;
41123 // Hide the image viewer and resets map markers
41124 hideViewer: function(context) {
41125 _mlyActiveImage = null;
41126 if (!_mlyFallback && _mlyViewer) {
41127 _mlyViewer.getComponent("sequence").stop();
41129 const viewer = context.container().select(".photoviewer");
41130 if (!viewer.empty()) viewer.datum(null);
41131 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
41132 this.updateUrlImage(null);
41133 dispatch4.call("imageChanged");
41134 dispatch4.call("loadedMapFeatures");
41135 dispatch4.call("loadedSigns");
41136 _isViewerOpen = false;
41137 return this.setStyles(context, null);
41139 // Get viewer status
41140 isViewerOpen: function() {
41141 return _isViewerOpen;
41143 // Update the URL with current image id
41144 updateUrlImage: function(imageId) {
41145 if (!window.mocha) {
41146 const hash = utilStringQs(window.location.hash);
41148 hash.photo = "mapillary/" + imageId;
41152 window.location.replace("#" + utilQsString(hash, true));
41155 // Highlight the detection in the viewer that is related to the clicked map feature
41156 highlightDetection: function(detection) {
41158 _mlyHighlightedDetection = detection.id;
41162 // Initialize image viewer (Mapillar JS)
41163 initViewer: function(context) {
41165 if (!window.mapillary) return;
41173 container: "ideditor-mly"
41175 if (!mapillary.isSupported() && mapillary.isFallbackSupported()) {
41176 _mlyFallback = true;
41191 _mlyViewer = new mapillary.Viewer(opts);
41192 _mlyViewer.on("image", imageChanged);
41193 _mlyViewer.on("bearing", bearingChanged);
41194 if (_mlyViewerFilter) {
41195 _mlyViewer.setFilter(_mlyViewerFilter);
41197 context.ui().photoviewer.on("resize.mapillary", function() {
41198 if (_mlyViewer) _mlyViewer.resize();
41200 function imageChanged(node) {
41202 const image = node.image;
41203 that.setActiveImage(image);
41204 that.setStyles(context, null);
41205 const loc = [image.originalLngLat.lng, image.originalLngLat.lat];
41206 context.map().centerEase(loc);
41207 that.updateUrlImage(image.id);
41208 if (_mlyShowFeatureDetections || _mlyShowSignDetections) {
41209 that.updateDetections(image.id, "".concat(apiUrl, "/").concat(image.id, "/detections?access_token=").concat(accessToken, "&fields=id,image,geometry,value"));
41211 dispatch4.call("imageChanged");
41213 function bearingChanged(e3) {
41214 dispatch4.call("bearingChanged", void 0, e3);
41217 // Move to an image
41218 selectImage: function(context, imageId) {
41219 if (_mlyViewer && imageId) {
41220 _mlyViewer.moveTo(imageId).catch(function(e3) {
41221 console.error("mly3", e3);
41226 // Return the currently displayed image
41227 getActiveImage: function() {
41228 return _mlyActiveImage;
41230 // Return a list of detection objects for the given id
41231 getDetections: function(id2) {
41232 return loadData("".concat(apiUrl, "/").concat(id2, "/detections?access_token=").concat(accessToken, "&fields=id,value,image"));
41234 // Set the currently visible image
41235 setActiveImage: function(image) {
41237 _mlyActiveImage = {
41238 ca: image.originalCompassAngle,
41240 loc: [image.originalLngLat.lng, image.originalLngLat.lat],
41241 is_pano: image.cameraType === "spherical",
41242 sequence_id: image.sequenceId
41245 _mlyActiveImage = null;
41248 // Update the currently highlighted sequence and selected bubble.
41249 setStyles: function(context, hovered) {
41250 const hoveredImageId = hovered && hovered.id;
41251 const hoveredSequenceId = hovered && hovered.sequence_id;
41252 const selectedSequenceId = _mlyActiveImage && _mlyActiveImage.sequence_id;
41253 context.container().selectAll(".layer-mapillary .viewfield-group").classed("highlighted", function(d2) {
41254 return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
41255 }).classed("hovered", function(d2) {
41256 return d2.id === hoveredImageId;
41258 context.container().selectAll(".layer-mapillary .sequence").classed("highlighted", function(d2) {
41259 return d2.properties.id === hoveredSequenceId;
41260 }).classed("currentView", function(d2) {
41261 return d2.properties.id === selectedSequenceId;
41265 // Get detections for the current image and shows them in the image viewer
41266 updateDetections: function(imageId, url) {
41267 if (!_mlyViewer || _mlyFallback) return;
41268 if (!imageId) return;
41269 const cache = _mlyCache.image_detections;
41270 if (cache.forImageId[imageId]) {
41271 showDetections(_mlyCache.image_detections.forImageId[imageId]);
41273 loadData(url).then((detections) => {
41274 detections.forEach(function(detection) {
41275 if (!cache.forImageId[imageId]) {
41276 cache.forImageId[imageId] = [];
41278 cache.forImageId[imageId].push({
41279 geometry: detection.geometry,
41282 value: detection.value
41285 showDetections(_mlyCache.image_detections.forImageId[imageId] || []);
41288 function showDetections(detections) {
41289 const tagComponent = _mlyViewer.getComponent("tag");
41290 detections.forEach(function(data) {
41291 const tag2 = makeTag(data);
41293 tagComponent.add([tag2]);
41297 function makeTag(data) {
41298 const valueParts = data.value.split("--");
41299 if (!valueParts.length) return;
41302 let color2 = 16777215;
41303 if (_mlyHighlightedDetection === data.id) {
41305 text = valueParts[1];
41306 if (text === "flat" || text === "discrete" || text === "sign") {
41307 text = valueParts[2];
41309 text = text.replace(/-/g, " ");
41310 text = text.charAt(0).toUpperCase() + text.slice(1);
41311 _mlyHighlightedDetection = null;
41313 var decodedGeometry = window.atob(data.geometry);
41314 var uintArray = new Uint8Array(decodedGeometry.length);
41315 for (var i3 = 0; i3 < decodedGeometry.length; i3++) {
41316 uintArray[i3] = decodedGeometry.charCodeAt(i3);
41318 const tile = new VectorTile(new Pbf(uintArray.buffer));
41319 const layer = tile.layers["mpy-or"];
41320 const geometries = layer.feature(0).loadGeometry();
41321 const polygon2 = geometries.map((ring) => ring.map((point) => [point.x / layer.extent, point.y / layer.extent]));
41322 tag2 = new mapillary.OutlineTag(
41324 new mapillary.PolygonGeometry(polygon2[0]),
41337 // Return the current cache
41338 cache: function() {
41343 // modules/core/validation/models.js
41344 function validationIssue(attrs) {
41345 this.type = attrs.type;
41346 this.subtype = attrs.subtype;
41347 this.severity = attrs.severity;
41348 this.message = attrs.message;
41349 this.reference = attrs.reference;
41350 this.entityIds = attrs.entityIds;
41351 this.loc = attrs.loc;
41352 this.data = attrs.data;
41353 this.dynamicFixes = attrs.dynamicFixes;
41354 this.hash = attrs.hash;
41355 this.id = generateID.apply(this);
41356 this.key = generateKey.apply(this);
41357 this.autoFix = null;
41358 function generateID() {
41359 var parts = [this.type];
41361 parts.push(this.hash);
41363 if (this.subtype) {
41364 parts.push(this.subtype);
41366 if (this.entityIds) {
41367 var entityKeys = this.entityIds.slice().sort();
41368 parts.push.apply(parts, entityKeys);
41370 return parts.join(":");
41372 function generateKey() {
41373 return this.id + ":" + Date.now().toString();
41375 this.extent = function(resolver) {
41377 return geoExtent(this.loc);
41379 if (this.entityIds && this.entityIds.length) {
41380 return this.entityIds.reduce(function(extent, entityId) {
41381 return extent.extend(resolver.entity(entityId).extent(resolver));
41386 this.fixes = function(context) {
41387 var fixes = this.dynamicFixes ? this.dynamicFixes(context) : [];
41389 if (issue.severity === "warning") {
41390 fixes.push(new validationIssueFix({
41391 title: _t.append("issues.fix.ignore_issue.title"),
41392 icon: "iD-icon-close",
41393 onClick: function() {
41394 context.validator().ignoreIssue(this.issue.id);
41398 fixes.forEach(function(fix) {
41399 fix.id = fix.title.stringId;
41401 if (fix.autoArgs) {
41402 issue.autoFix = fix;
41408 function validationIssueFix(attrs) {
41409 this.title = attrs.title;
41410 this.onClick = attrs.onClick;
41411 this.disabledReason = attrs.disabledReason;
41412 this.icon = attrs.icon;
41413 this.entityIds = attrs.entityIds || [];
41414 this.autoArgs = attrs.autoArgs;
41418 // modules/services/maprules.js
41419 var buildRuleChecks = function() {
41421 equals: function(equals) {
41422 return function(tags) {
41423 return Object.keys(equals).every(function(k2) {
41424 return equals[k2] === tags[k2];
41428 notEquals: function(notEquals) {
41429 return function(tags) {
41430 return Object.keys(notEquals).some(function(k2) {
41431 return notEquals[k2] !== tags[k2];
41435 absence: function(absence) {
41436 return function(tags) {
41437 return Object.keys(tags).indexOf(absence) === -1;
41440 presence: function(presence) {
41441 return function(tags) {
41442 return Object.keys(tags).indexOf(presence) > -1;
41445 greaterThan: function(greaterThan) {
41446 var key = Object.keys(greaterThan)[0];
41447 var value = greaterThan[key];
41448 return function(tags) {
41449 return tags[key] > value;
41452 greaterThanEqual: function(greaterThanEqual) {
41453 var key = Object.keys(greaterThanEqual)[0];
41454 var value = greaterThanEqual[key];
41455 return function(tags) {
41456 return tags[key] >= value;
41459 lessThan: function(lessThan) {
41460 var key = Object.keys(lessThan)[0];
41461 var value = lessThan[key];
41462 return function(tags) {
41463 return tags[key] < value;
41466 lessThanEqual: function(lessThanEqual) {
41467 var key = Object.keys(lessThanEqual)[0];
41468 var value = lessThanEqual[key];
41469 return function(tags) {
41470 return tags[key] <= value;
41473 positiveRegex: function(positiveRegex) {
41474 var tagKey = Object.keys(positiveRegex)[0];
41475 var expression = positiveRegex[tagKey].join("|");
41476 var regex = new RegExp(expression);
41477 return function(tags) {
41478 return regex.test(tags[tagKey]);
41481 negativeRegex: function(negativeRegex) {
41482 var tagKey = Object.keys(negativeRegex)[0];
41483 var expression = negativeRegex[tagKey].join("|");
41484 var regex = new RegExp(expression);
41485 return function(tags) {
41486 return !regex.test(tags[tagKey]);
41491 var buildLineKeys = function() {
41506 var maprules_default = {
41508 this._ruleChecks = buildRuleChecks();
41509 this._validationRules = [];
41510 this._areaKeys = osmAreaKeys;
41511 this._lineKeys = buildLineKeys();
41513 // list of rules only relevant to tag checks...
41514 filterRuleChecks: function(selector) {
41515 var _ruleChecks = this._ruleChecks;
41516 return Object.keys(selector).reduce(function(rules, key) {
41517 if (["geometry", "error", "warning"].indexOf(key) === -1) {
41518 rules.push(_ruleChecks[key](selector[key]));
41523 // builds tagMap from mapcss-parse selector object...
41524 buildTagMap: function(selector) {
41525 var getRegexValues = function(regexes) {
41526 return regexes.map(function(regex) {
41527 return regex.replace(/\$|\^/g, "");
41530 var tagMap = Object.keys(selector).reduce(function(expectedTags, key) {
41532 var isRegex = /regex/gi.test(key);
41533 var isEqual4 = /equals/gi.test(key);
41534 if (isRegex || isEqual4) {
41535 Object.keys(selector[key]).forEach(function(selectorKey) {
41536 values = isEqual4 ? [selector[key][selectorKey]] : getRegexValues(selector[key][selectorKey]);
41537 if (expectedTags.hasOwnProperty(selectorKey)) {
41538 values = values.concat(expectedTags[selectorKey]);
41540 expectedTags[selectorKey] = values;
41542 } else if (/(greater|less)Than(Equal)?|presence/g.test(key)) {
41543 var tagKey = /presence/.test(key) ? selector[key] : Object.keys(selector[key])[0];
41544 values = [selector[key][tagKey]];
41545 if (expectedTags.hasOwnProperty(tagKey)) {
41546 values = values.concat(expectedTags[tagKey]);
41548 expectedTags[tagKey] = values;
41550 return expectedTags;
41554 // inspired by osmWay#isArea()
41555 inferGeometry: function(tagMap) {
41556 var _lineKeys = this._lineKeys;
41557 var _areaKeys = this._areaKeys;
41558 var keyValueDoesNotImplyArea = function(key2) {
41559 return utilArrayIntersection(tagMap[key2], Object.keys(_areaKeys[key2])).length > 0;
41561 var keyValueImpliesLine = function(key2) {
41562 return utilArrayIntersection(tagMap[key2], Object.keys(_lineKeys[key2])).length > 0;
41564 if (tagMap.hasOwnProperty("area")) {
41565 if (tagMap.area.indexOf("yes") > -1) {
41568 if (tagMap.area.indexOf("no") > -1) {
41572 for (var key in tagMap) {
41573 if (key in _areaKeys && !keyValueDoesNotImplyArea(key)) {
41576 if (key in _lineKeys && keyValueImpliesLine(key)) {
41582 // adds from mapcss-parse selector check...
41583 addRule: function(selector) {
41585 // checks relevant to mapcss-selector
41586 checks: this.filterRuleChecks(selector),
41587 // true if all conditions for a tag error are true..
41588 matches: function(entity) {
41589 return this.checks.every(function(check) {
41590 return check(entity.tags);
41593 // borrowed from Way#isArea()
41594 inferredGeometry: this.inferGeometry(this.buildTagMap(selector), this._areaKeys),
41595 geometryMatches: function(entity, graph) {
41596 if (entity.type === "node" || entity.type === "relation") {
41597 return selector.geometry === entity.type;
41598 } else if (entity.type === "way") {
41599 return this.inferredGeometry === entity.geometry(graph);
41602 // when geometries match and tag matches are present, return a warning...
41603 findIssues: function(entity, graph, issues) {
41604 if (this.geometryMatches(entity, graph) && this.matches(entity)) {
41605 var severity = Object.keys(selector).indexOf("error") > -1 ? "error" : "warning";
41606 var message = selector[severity];
41607 issues.push(new validationIssue({
41610 message: function() {
41613 entityIds: [entity.id]
41618 this._validationRules.push(rule);
41620 clearRules: function() {
41621 this._validationRules = [];
41623 // returns validationRules...
41624 validationRules: function() {
41625 return this._validationRules;
41627 // returns ruleChecks
41628 ruleChecks: function() {
41629 return this._ruleChecks;
41633 // modules/core/difference.js
41634 var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
41635 function coreDifference(base, head) {
41637 var _didChange = {};
41639 function checkEntityID(id2) {
41640 var h2 = head.entities[id2];
41641 var b2 = base.entities[id2];
41642 if (h2 === b2) return;
41643 if (_changes[id2]) return;
41645 _changes[id2] = { base: b2, head: h2 };
41646 _didChange.deletion = true;
41650 _changes[id2] = { base: b2, head: h2 };
41651 _didChange.addition = true;
41655 if (h2.members && b2.members && !(0, import_fast_deep_equal3.default)(h2.members, b2.members)) {
41656 _changes[id2] = { base: b2, head: h2 };
41657 _didChange.geometry = true;
41658 _didChange.properties = true;
41661 if (h2.loc && b2.loc && !geoVecEqual(h2.loc, b2.loc)) {
41662 _changes[id2] = { base: b2, head: h2 };
41663 _didChange.geometry = true;
41665 if (h2.nodes && b2.nodes && !(0, import_fast_deep_equal3.default)(h2.nodes, b2.nodes)) {
41666 _changes[id2] = { base: b2, head: h2 };
41667 _didChange.geometry = true;
41669 if (h2.tags && b2.tags && !(0, import_fast_deep_equal3.default)(h2.tags, b2.tags)) {
41670 _changes[id2] = { base: b2, head: h2 };
41671 _didChange.properties = true;
41676 var ids = utilArrayUniq(Object.keys(head.entities).concat(Object.keys(base.entities)));
41677 for (var i3 = 0; i3 < ids.length; i3++) {
41678 checkEntityID(ids[i3]);
41682 _diff.length = function length2() {
41683 return Object.keys(_changes).length;
41685 _diff.changes = function changes() {
41688 _diff.didChange = _didChange;
41689 _diff.extantIDs = function extantIDs(includeRelMembers) {
41690 var result = /* @__PURE__ */ new Set();
41691 Object.keys(_changes).forEach(function(id2) {
41692 if (_changes[id2].head) {
41695 var h2 = _changes[id2].head;
41696 var b2 = _changes[id2].base;
41697 var entity = h2 || b2;
41698 if (includeRelMembers && entity.type === "relation") {
41699 var mh = h2 ? h2.members.map(function(m2) {
41702 var mb = b2 ? b2.members.map(function(m2) {
41705 utilArrayUnion(mh, mb).forEach(function(memberID) {
41706 if (head.hasEntity(memberID)) {
41707 result.add(memberID);
41712 return Array.from(result);
41714 _diff.modified = function modified() {
41716 Object.values(_changes).forEach(function(change) {
41717 if (change.base && change.head) {
41718 result.push(change.head);
41723 _diff.created = function created() {
41725 Object.values(_changes).forEach(function(change) {
41726 if (!change.base && change.head) {
41727 result.push(change.head);
41732 _diff.deleted = function deleted() {
41734 Object.values(_changes).forEach(function(change) {
41735 if (change.base && !change.head) {
41736 result.push(change.base);
41741 _diff.summary = function summary() {
41743 var keys2 = Object.keys(_changes);
41744 for (var i3 = 0; i3 < keys2.length; i3++) {
41745 var change = _changes[keys2[i3]];
41746 if (change.head && change.head.geometry(head) !== "vertex") {
41747 addEntity(change.head, head, change.base ? "modified" : "created");
41748 } else if (change.base && change.base.geometry(base) !== "vertex") {
41749 addEntity(change.base, base, "deleted");
41750 } else if (change.base && change.head) {
41751 var moved = !(0, import_fast_deep_equal3.default)(change.base.loc, change.head.loc);
41752 var retagged = !(0, import_fast_deep_equal3.default)(change.base.tags, change.head.tags);
41754 addParents(change.head);
41756 if (retagged || moved && change.head.hasInterestingTags()) {
41757 addEntity(change.head, head, "modified");
41759 } else if (change.head && change.head.hasInterestingTags()) {
41760 addEntity(change.head, head, "created");
41761 } else if (change.base && change.base.hasInterestingTags()) {
41762 addEntity(change.base, base, "deleted");
41765 return Object.values(relevant);
41766 function addEntity(entity, graph, changeType) {
41767 relevant[entity.id] = {
41773 function addParents(entity) {
41774 var parents = head.parentWays(entity);
41775 for (var j2 = parents.length - 1; j2 >= 0; j2--) {
41776 var parent = parents[j2];
41777 if (!(parent.id in relevant)) {
41778 addEntity(parent, head, "modified");
41783 _diff.complete = function complete(extent) {
41786 for (id2 in _changes) {
41787 change = _changes[id2];
41788 var h2 = change.head;
41789 var b2 = change.base;
41790 var entity = h2 || b2;
41792 if (extent && (!h2 || !h2.intersects(extent, head)) && (!b2 || !b2.intersects(extent, base))) {
41796 if (entity.type === "way") {
41797 var nh = h2 ? h2.nodes : [];
41798 var nb = b2 ? b2.nodes : [];
41800 diff = utilArrayDifference(nh, nb);
41801 for (i3 = 0; i3 < diff.length; i3++) {
41802 result[diff[i3]] = head.hasEntity(diff[i3]);
41804 diff = utilArrayDifference(nb, nh);
41805 for (i3 = 0; i3 < diff.length; i3++) {
41806 result[diff[i3]] = head.hasEntity(diff[i3]);
41809 if (entity.type === "relation" && entity.isMultipolygon()) {
41810 var mh = h2 ? h2.members.map(function(m2) {
41813 var mb = b2 ? b2.members.map(function(m2) {
41816 var ids = utilArrayUnion(mh, mb);
41817 for (i3 = 0; i3 < ids.length; i3++) {
41818 var member = head.hasEntity(ids[i3]);
41819 if (!member) continue;
41820 if (extent && !member.intersects(extent, head)) continue;
41821 result[ids[i3]] = member;
41824 addParents(head.parentWays(entity), result);
41825 addParents(head.parentRelations(entity), result);
41828 function addParents(parents, result2) {
41829 for (var i4 = 0; i4 < parents.length; i4++) {
41830 var parent = parents[i4];
41831 if (parent.id in result2) continue;
41832 result2[parent.id] = parent;
41833 addParents(head.parentRelations(parent), result2);
41840 // modules/core/tree.js
41841 function coreTree(head) {
41842 var _rtree = new RBush();
41844 var _segmentsRTree = new RBush();
41845 var _segmentsBBoxes = {};
41846 var _segmentsByWayId = {};
41848 function entityBBox(entity) {
41849 var bbox2 = entity.extent(head).bbox();
41850 bbox2.id = entity.id;
41851 _bboxes[entity.id] = bbox2;
41854 function segmentBBox(segment) {
41855 var extent = segment.extent(head);
41856 if (!extent) return null;
41857 var bbox2 = extent.bbox();
41858 bbox2.segment = segment;
41859 _segmentsBBoxes[segment.id] = bbox2;
41862 function removeEntity(entity) {
41863 _rtree.remove(_bboxes[entity.id]);
41864 delete _bboxes[entity.id];
41865 if (_segmentsByWayId[entity.id]) {
41866 _segmentsByWayId[entity.id].forEach(function(segment) {
41867 _segmentsRTree.remove(_segmentsBBoxes[segment.id]);
41868 delete _segmentsBBoxes[segment.id];
41870 delete _segmentsByWayId[entity.id];
41873 function loadEntities(entities) {
41874 _rtree.load(entities.map(entityBBox));
41876 entities.forEach(function(entity) {
41877 if (entity.segments) {
41878 var entitySegments = entity.segments(head);
41879 _segmentsByWayId[entity.id] = entitySegments;
41880 segments = segments.concat(entitySegments);
41883 if (segments.length) _segmentsRTree.load(segments.map(segmentBBox).filter(Boolean));
41885 function updateParents(entity, insertions, memo) {
41886 head.parentWays(entity).forEach(function(way) {
41887 if (_bboxes[way.id]) {
41889 insertions[way.id] = way;
41891 updateParents(way, insertions, memo);
41893 head.parentRelations(entity).forEach(function(relation) {
41894 if (memo[relation.id]) return;
41895 memo[relation.id] = true;
41896 if (_bboxes[relation.id]) {
41897 removeEntity(relation);
41898 insertions[relation.id] = relation;
41900 updateParents(relation, insertions, memo);
41903 tree.rebase = function(entities, force) {
41904 var insertions = {};
41905 for (var i3 = 0; i3 < entities.length; i3++) {
41906 var entity = entities[i3];
41907 if (!entity.visible) continue;
41908 if (head.entities.hasOwnProperty(entity.id) || _bboxes[entity.id]) {
41911 } else if (_bboxes[entity.id]) {
41912 removeEntity(entity);
41915 insertions[entity.id] = entity;
41916 updateParents(entity, insertions, {});
41918 loadEntities(Object.values(insertions));
41921 function updateToGraph(graph) {
41922 if (graph === head) return;
41923 var diff = coreDifference(head, graph);
41925 var changed = diff.didChange;
41926 if (!changed.addition && !changed.deletion && !changed.geometry) return;
41927 var insertions = {};
41928 if (changed.deletion) {
41929 diff.deleted().forEach(function(entity) {
41930 removeEntity(entity);
41933 if (changed.geometry) {
41934 diff.modified().forEach(function(entity) {
41935 removeEntity(entity);
41936 insertions[entity.id] = entity;
41937 updateParents(entity, insertions, {});
41940 if (changed.addition) {
41941 diff.created().forEach(function(entity) {
41942 insertions[entity.id] = entity;
41945 loadEntities(Object.values(insertions));
41947 tree.intersects = function(extent, graph) {
41948 updateToGraph(graph);
41949 return _rtree.search(extent.bbox()).map(function(bbox2) {
41950 return graph.entity(bbox2.id);
41953 tree.waySegments = function(extent, graph) {
41954 updateToGraph(graph);
41955 return _segmentsRTree.search(extent.bbox()).map(function(bbox2) {
41956 return bbox2.segment;
41962 // modules/svg/icon.js
41963 function svgIcon(name, svgklass, useklass) {
41964 return function drawIcon(selection2) {
41965 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);
41969 // modules/ui/modal.js
41970 function uiModal(selection2, blocking) {
41971 let keybinding = utilKeybinding("modal");
41972 let previous = selection2.select("div.modal");
41973 let animate = previous.empty();
41974 previous.transition().duration(200).style("opacity", 0).remove();
41975 let shaded = selection2.append("div").attr("class", "shaded").style("opacity", 0);
41976 shaded.close = () => {
41977 shaded.transition().duration(200).style("opacity", 0).remove();
41978 modal.transition().duration(200).style("top", "0px");
41979 select_default2(document).call(keybinding.unbind);
41981 let modal = shaded.append("div").attr("class", "modal fillL");
41982 modal.append("input").attr("class", "keytrap keytrap-first").on("focus.keytrap", moveFocusToLast);
41984 shaded.on("click.remove-modal", (d3_event) => {
41985 if (d3_event.target === this) {
41989 modal.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", shaded.close).call(svgIcon("#iD-icon-close"));
41990 keybinding.on("\u232B", shaded.close).on("\u238B", shaded.close);
41991 select_default2(document).call(keybinding);
41993 modal.append("div").attr("class", "content");
41994 modal.append("input").attr("class", "keytrap keytrap-last").on("focus.keytrap", moveFocusToFirst);
41996 shaded.transition().style("opacity", 1);
41998 shaded.style("opacity", 1);
42001 function moveFocusToFirst() {
42002 let node = modal.select("a, button, input:not(.keytrap), select, textarea").node();
42006 select_default2(this).node().blur();
42009 function moveFocusToLast() {
42010 let nodes = modal.selectAll("a, button, input:not(.keytrap), select, textarea").nodes();
42011 if (nodes.length) {
42012 nodes[nodes.length - 1].focus();
42014 select_default2(this).node().blur();
42019 // modules/ui/loading.js
42020 function uiLoading(context) {
42021 let _modalSelection = select_default2(null);
42023 let _blocking = false;
42024 let loading = (selection2) => {
42025 _modalSelection = uiModal(selection2, _blocking);
42026 let loadertext = _modalSelection.select(".content").classed("loading-modal", true).append("div").attr("class", "modal-section fillL");
42027 loadertext.append("img").attr("class", "loader").attr("src", context.imagePath("loader-white.gif"));
42028 loadertext.append("h3").html(_message);
42029 _modalSelection.select("button.close").attr("class", "hide");
42032 loading.message = function(val) {
42033 if (!arguments.length) return _message;
42037 loading.blocking = function(val) {
42038 if (!arguments.length) return _blocking;
42042 loading.close = () => {
42043 _modalSelection.remove();
42045 loading.isShown = () => {
42046 return _modalSelection && !_modalSelection.empty() && _modalSelection.node().parentNode;
42051 // modules/core/history.js
42052 function coreHistory(context) {
42053 var dispatch14 = dispatch_default("reset", "change", "merge", "restore", "undone", "redone", "storage_error");
42054 var lock = utilSessionMutex("lock");
42055 var _hasUnresolvedRestorableChanges = lock.lock() && !!corePreferences(getKey("saved_history"));
42056 var duration = 150;
42057 var _imageryUsed = [];
42058 var _photoOverlaysUsed = [];
42059 var _checkpoints = {};
42064 function _act(actions, t2) {
42065 actions = Array.prototype.slice.call(actions);
42067 if (typeof actions[actions.length - 1] !== "function") {
42068 annotation = actions.pop();
42070 var graph = _stack[_index].graph;
42071 for (var i3 = 0; i3 < actions.length; i3++) {
42072 graph = actions[i3](graph, t2);
42077 imageryUsed: _imageryUsed,
42078 photoOverlaysUsed: _photoOverlaysUsed,
42079 transform: context.projection.transform(),
42080 selectedIDs: context.selectedIDs()
42083 function _perform(args, t2) {
42084 var previous = _stack[_index].graph;
42085 _stack = _stack.slice(0, _index + 1);
42086 var actionResult = _act(args, t2);
42087 _stack.push(actionResult);
42089 return change(previous);
42091 function _replace(args, t2) {
42092 var previous = _stack[_index].graph;
42093 var actionResult = _act(args, t2);
42094 _stack[_index] = actionResult;
42095 return change(previous);
42097 function _overwrite(args, t2) {
42098 var previous = _stack[_index].graph;
42103 _stack = _stack.slice(0, _index + 1);
42104 var actionResult = _act(args, t2);
42105 _stack.push(actionResult);
42107 return change(previous);
42109 function change(previous) {
42110 var difference2 = coreDifference(previous, history.graph());
42111 if (!_pausedGraph) {
42112 dispatch14.call("change", this, difference2);
42114 return difference2;
42116 function getKey(n3) {
42117 return "iD_" + window.location.origin + "_" + n3;
42120 graph: function() {
42121 return _stack[_index].graph;
42127 return _stack[0].graph;
42129 merge: function(entities) {
42130 var stack = _stack.map(function(state) {
42131 return state.graph;
42133 _stack[0].graph.rebase(entities, stack, false);
42134 _tree.rebase(entities, false);
42135 dispatch14.call("merge", this, entities);
42137 perform: function() {
42138 select_default2(document).interrupt("history.perform");
42139 var transitionable = false;
42140 var action0 = arguments[0];
42141 if (arguments.length === 1 || arguments.length === 2 && typeof arguments[1] !== "function") {
42142 transitionable = !!action0.transitionable;
42144 if (transitionable) {
42145 var origArguments = arguments;
42146 select_default2(document).transition("history.perform").duration(duration).ease(linear2).tween("history.tween", function() {
42147 return function(t2) {
42148 if (t2 < 1) _overwrite([action0], t2);
42150 }).on("start", function() {
42151 _perform([action0], 0);
42152 }).on("end interrupt", function() {
42153 _overwrite(origArguments, 1);
42156 return _perform(arguments);
42159 replace: function() {
42160 select_default2(document).interrupt("history.perform");
42161 return _replace(arguments, 1);
42163 // Same as calling pop and then perform
42164 overwrite: function() {
42165 select_default2(document).interrupt("history.perform");
42166 return _overwrite(arguments, 1);
42168 pop: function(n3) {
42169 select_default2(document).interrupt("history.perform");
42170 var previous = _stack[_index].graph;
42171 if (isNaN(+n3) || +n3 < 0) {
42174 while (n3-- > 0 && _index > 0) {
42178 return change(previous);
42180 // Back to the previous annotated state or _index = 0.
42182 select_default2(document).interrupt("history.perform");
42183 var previousStack = _stack[_index];
42184 var previous = previousStack.graph;
42185 while (_index > 0) {
42187 if (_stack[_index].annotation) break;
42189 dispatch14.call("undone", this, _stack[_index], previousStack);
42190 return change(previous);
42192 // Forward to the next annotated state.
42194 select_default2(document).interrupt("history.perform");
42195 var previousStack = _stack[_index];
42196 var previous = previousStack.graph;
42197 var tryIndex = _index;
42198 while (tryIndex < _stack.length - 1) {
42200 if (_stack[tryIndex].annotation) {
42202 dispatch14.call("redone", this, _stack[_index], previousStack);
42206 return change(previous);
42208 pauseChangeDispatch: function() {
42209 if (!_pausedGraph) {
42210 _pausedGraph = _stack[_index].graph;
42213 resumeChangeDispatch: function() {
42214 if (_pausedGraph) {
42215 var previous = _pausedGraph;
42216 _pausedGraph = null;
42217 return change(previous);
42220 undoAnnotation: function() {
42223 if (_stack[i3].annotation) return _stack[i3].annotation;
42227 redoAnnotation: function() {
42228 var i3 = _index + 1;
42229 while (i3 <= _stack.length - 1) {
42230 if (_stack[i3].annotation) return _stack[i3].annotation;
42234 // Returns the entities from the active graph with bounding boxes
42235 // overlapping the given `extent`.
42236 intersects: function(extent) {
42237 return _tree.intersects(extent, _stack[_index].graph);
42239 difference: function() {
42240 var base = _stack[0].graph;
42241 var head = _stack[_index].graph;
42242 return coreDifference(base, head);
42244 changes: function(action) {
42245 var base = _stack[0].graph;
42246 var head = _stack[_index].graph;
42248 head = action(head);
42250 var difference2 = coreDifference(base, head);
42252 modified: difference2.modified(),
42253 created: difference2.created(),
42254 deleted: difference2.deleted()
42257 hasChanges: function() {
42258 return this.difference().length() > 0;
42260 imageryUsed: function(sources) {
42262 _imageryUsed = sources;
42265 var s2 = /* @__PURE__ */ new Set();
42266 _stack.slice(1, _index + 1).forEach(function(state) {
42267 state.imageryUsed.forEach(function(source) {
42268 if (source !== "Custom") {
42273 return Array.from(s2);
42276 photoOverlaysUsed: function(sources) {
42278 _photoOverlaysUsed = sources;
42281 var s2 = /* @__PURE__ */ new Set();
42282 _stack.slice(1, _index + 1).forEach(function(state) {
42283 if (state.photoOverlaysUsed && Array.isArray(state.photoOverlaysUsed)) {
42284 state.photoOverlaysUsed.forEach(function(photoOverlay) {
42285 s2.add(photoOverlay);
42289 return Array.from(s2);
42292 // save the current history state
42293 checkpoint: function(key) {
42294 _checkpoints[key] = {
42300 // restore history state to a given checkpoint or reset completely
42301 reset: function(key) {
42302 if (key !== void 0 && _checkpoints.hasOwnProperty(key)) {
42303 _stack = _checkpoints[key].stack;
42304 _index = _checkpoints[key].index;
42306 _stack = [{ graph: coreGraph() }];
42308 _tree = coreTree(_stack[0].graph);
42311 dispatch14.call("reset");
42312 dispatch14.call("change");
42315 // `toIntroGraph()` is used to export the intro graph used by the walkthrough.
42318 // 1. Start the walkthrough.
42319 // 2. Get to a "free editing" tutorial step
42320 // 3. Make your edits to the walkthrough map
42321 // 4. In your browser dev console run:
42322 // `id.history().toIntroGraph()`
42323 // 5. This outputs stringified JSON to the browser console
42324 // 6. Copy it to `data/intro_graph.json` and prettify it in your code editor
42325 toIntroGraph: function() {
42326 var nextID = { n: 0, r: 0, w: 0 };
42328 var graph = this.graph();
42329 var baseEntities = {};
42330 Object.values(graph.base().entities).forEach(function(entity) {
42331 var copy2 = copyIntroEntity(entity);
42332 baseEntities[copy2.id] = copy2;
42334 Object.keys(graph.entities).forEach(function(id2) {
42335 var entity = graph.entities[id2];
42337 var copy2 = copyIntroEntity(entity);
42338 baseEntities[copy2.id] = copy2;
42340 delete baseEntities[id2];
42343 Object.values(baseEntities).forEach(function(entity) {
42344 if (Array.isArray(entity.nodes)) {
42345 entity.nodes = entity.nodes.map(function(node) {
42346 return permIDs[node] || node;
42349 if (Array.isArray(entity.members)) {
42350 entity.members = entity.members.map(function(member) {
42351 member.id = permIDs[member.id] || member.id;
42356 return JSON.stringify({ dataIntroGraph: baseEntities });
42357 function copyIntroEntity(source) {
42358 var copy2 = utilObjectOmit(source, ["type", "user", "v", "version", "visible"]);
42359 if (copy2.tags && !Object.keys(copy2.tags)) {
42362 if (Array.isArray(copy2.loc)) {
42363 copy2.loc[0] = +copy2.loc[0].toFixed(6);
42364 copy2.loc[1] = +copy2.loc[1].toFixed(6);
42366 var match = source.id.match(/([nrw])-\d*/);
42367 if (match !== null) {
42368 var nrw = match[1];
42371 permID = nrw + ++nextID[nrw];
42372 } while (baseEntities.hasOwnProperty(permID));
42373 copy2.id = permIDs[source.id] = permID;
42378 toJSON: function() {
42379 if (!this.hasChanges()) return;
42380 var allEntities = {};
42381 var baseEntities = {};
42382 var base = _stack[0];
42383 var s2 = _stack.map(function(i3) {
42386 Object.keys(i3.graph.entities).forEach(function(id2) {
42387 var entity = i3.graph.entities[id2];
42389 var key = osmEntity.key(entity);
42390 allEntities[key] = entity;
42391 modified.push(key);
42395 if (id2 in base.graph.entities) {
42396 baseEntities[id2] = base.graph.entities[id2];
42398 if (entity && entity.nodes) {
42399 entity.nodes.forEach(function(nodeID) {
42400 if (nodeID in base.graph.entities) {
42401 baseEntities[nodeID] = base.graph.entities[nodeID];
42405 var baseParents = base.graph._parentWays[id2];
42407 baseParents.forEach(function(parentID) {
42408 if (parentID in base.graph.entities) {
42409 baseEntities[parentID] = base.graph.entities[parentID];
42415 if (modified.length) x2.modified = modified;
42416 if (deleted.length) x2.deleted = deleted;
42417 if (i3.imageryUsed) x2.imageryUsed = i3.imageryUsed;
42418 if (i3.photoOverlaysUsed) x2.photoOverlaysUsed = i3.photoOverlaysUsed;
42419 if (i3.annotation) x2.annotation = i3.annotation;
42420 if (i3.transform) x2.transform = i3.transform;
42421 if (i3.selectedIDs) x2.selectedIDs = i3.selectedIDs;
42424 return JSON.stringify({
42426 entities: Object.values(allEntities),
42427 baseEntities: Object.values(baseEntities),
42429 nextIDs: osmEntity.id.next,
42431 // note the time the changes were saved
42432 timestamp: (/* @__PURE__ */ new Date()).getTime()
42435 fromJSON: function(json, loadChildNodes) {
42436 var h2 = JSON.parse(json);
42437 var loadComplete = true;
42438 osmEntity.id.next = h2.nextIDs;
42440 if (h2.version === 2 || h2.version === 3) {
42441 var allEntities = {};
42442 h2.entities.forEach(function(entity) {
42443 allEntities[osmEntity.key(entity)] = osmEntity(entity);
42445 if (h2.version === 3) {
42446 var baseEntities = h2.baseEntities.map(function(d2) {
42447 return osmEntity(d2);
42449 var stack = _stack.map(function(state) {
42450 return state.graph;
42452 _stack[0].graph.rebase(baseEntities, stack, true);
42453 _tree.rebase(baseEntities, true);
42454 if (loadChildNodes) {
42455 var osm = context.connection();
42456 var baseWays = baseEntities.filter(function(e3) {
42457 return e3.type === "way";
42459 var nodeIDs = baseWays.reduce(function(acc, way) {
42460 return utilArrayUnion(acc, way.nodes);
42462 var missing = nodeIDs.filter(function(n3) {
42463 return !_stack[0].graph.hasEntity(n3);
42465 if (missing.length && osm) {
42466 loadComplete = false;
42467 context.map().redrawEnable(false);
42468 var loading = uiLoading(context).blocking(true);
42469 context.container().call(loading);
42470 var childNodesLoaded = function(err, result) {
42472 var visibleGroups = utilArrayGroupBy(result.data, "visible");
42473 var visibles = visibleGroups.true || [];
42474 var invisibles = visibleGroups.false || [];
42475 if (visibles.length) {
42476 var visibleIDs = visibles.map(function(entity) {
42479 var stack2 = _stack.map(function(state) {
42480 return state.graph;
42482 missing = utilArrayDifference(missing, visibleIDs);
42483 _stack[0].graph.rebase(visibles, stack2, true);
42484 _tree.rebase(visibles, true);
42486 invisibles.forEach(function(entity) {
42487 osm.loadEntityVersion(entity.id, +entity.version - 1, childNodesLoaded);
42490 if (err || !missing.length) {
42492 context.map().redrawEnable(true);
42493 dispatch14.call("change");
42494 dispatch14.call("restore", this);
42497 osm.loadMultiple(missing, childNodesLoaded);
42501 _stack = h2.stack.map(function(d2) {
42502 var entities = {}, entity;
42504 d2.modified.forEach(function(key) {
42505 entity = allEntities[key];
42506 entities[entity.id] = entity;
42510 d2.deleted.forEach(function(id2) {
42511 entities[id2] = void 0;
42515 graph: coreGraph(_stack[0].graph).load(entities),
42516 annotation: d2.annotation,
42517 imageryUsed: d2.imageryUsed,
42518 photoOverlaysUsed: d2.photoOverlaysUsed,
42519 transform: d2.transform,
42520 selectedIDs: d2.selectedIDs
42524 _stack = h2.stack.map(function(d2) {
42526 for (var i3 in d2.entities) {
42527 var entity = d2.entities[i3];
42528 entities[i3] = entity === "undefined" ? void 0 : osmEntity(entity);
42530 d2.graph = coreGraph(_stack[0].graph).load(entities);
42534 var transform2 = _stack[_index].transform;
42536 context.map().transformEase(transform2, 0);
42538 if (loadComplete) {
42539 dispatch14.call("change");
42540 dispatch14.call("restore", this);
42545 return lock.lock();
42547 unlock: function() {
42551 if (lock.locked() && // don't overwrite existing, unresolved changes
42552 !_hasUnresolvedRestorableChanges) {
42553 const success = corePreferences(getKey("saved_history"), history.toJSON() || null);
42554 if (!success) dispatch14.call("storage_error");
42558 // delete the history version saved in localStorage
42559 clearSaved: function() {
42560 context.debouncedSave.cancel();
42561 if (lock.locked()) {
42562 _hasUnresolvedRestorableChanges = false;
42563 corePreferences(getKey("saved_history"), null);
42564 corePreferences("comment", null);
42565 corePreferences("hashtags", null);
42566 corePreferences("source", null);
42570 savedHistoryJSON: function() {
42571 return corePreferences(getKey("saved_history"));
42573 hasRestorableChanges: function() {
42574 return _hasUnresolvedRestorableChanges;
42576 // load history from a version stored in localStorage
42577 restore: function() {
42578 if (lock.locked()) {
42579 _hasUnresolvedRestorableChanges = false;
42580 var json = this.savedHistoryJSON();
42581 if (json) history.fromJSON(json, true);
42587 return utilRebind(history, dispatch14, "on");
42590 // modules/validations/index.js
42591 var validations_exports = {};
42592 __export(validations_exports, {
42593 validationAlmostJunction: () => validationAlmostJunction,
42594 validationCloseNodes: () => validationCloseNodes,
42595 validationCrossingWays: () => validationCrossingWays,
42596 validationDisconnectedWay: () => validationDisconnectedWay,
42597 validationFormatting: () => validationFormatting,
42598 validationHelpRequest: () => validationHelpRequest,
42599 validationImpossibleOneway: () => validationImpossibleOneway,
42600 validationIncompatibleSource: () => validationIncompatibleSource,
42601 validationMaprules: () => validationMaprules,
42602 validationMismatchedGeometry: () => validationMismatchedGeometry,
42603 validationMissingRole: () => validationMissingRole,
42604 validationMissingTag: () => validationMissingTag,
42605 validationMutuallyExclusiveTags: () => validationMutuallyExclusiveTags,
42606 validationOutdatedTags: () => validationOutdatedTags,
42607 validationPrivateData: () => validationPrivateData,
42608 validationSuspiciousName: () => validationSuspiciousName,
42609 validationUnsquareWay: () => validationUnsquareWay
42612 // modules/validations/almost_junction.js
42613 function validationAlmostJunction(context) {
42614 const type2 = "almost_junction";
42615 const EXTEND_TH_METERS = 5;
42616 const WELD_TH_METERS = 0.75;
42617 const CLOSE_NODE_TH = EXTEND_TH_METERS - WELD_TH_METERS;
42618 const SIG_ANGLE_TH = Math.atan(WELD_TH_METERS / EXTEND_TH_METERS);
42619 function isHighway(entity) {
42620 return entity.type === "way" && osmRoutableHighwayTagValues[entity.tags.highway];
42622 function isTaggedAsNotContinuing(node) {
42623 return node.tags.noexit === "yes" || node.tags.amenity === "parking_entrance" || node.tags.entrance && node.tags.entrance !== "no";
42625 const validation = function checkAlmostJunction(entity, graph) {
42626 if (!isHighway(entity)) return [];
42627 if (entity.isDegenerate()) return [];
42628 const tree = context.history().tree();
42629 const extendableNodeInfos = findConnectableEndNodesByExtension(entity);
42631 extendableNodeInfos.forEach((extendableNodeInfo) => {
42632 issues.push(new validationIssue({
42634 subtype: "highway-highway",
42635 severity: "warning",
42636 message: function(context2) {
42637 const entity1 = context2.hasEntity(this.entityIds[0]);
42638 if (this.entityIds[0] === this.entityIds[2]) {
42639 return entity1 ? _t.append("issues.almost_junction.self.message", {
42640 feature: utilDisplayLabel(entity1, context2.graph())
42643 const entity2 = context2.hasEntity(this.entityIds[2]);
42644 return entity1 && entity2 ? _t.append("issues.almost_junction.message", {
42645 feature: utilDisplayLabel(entity1, context2.graph()),
42646 feature2: utilDisplayLabel(entity2, context2.graph())
42650 reference: showReference,
42653 extendableNodeInfo.node.id,
42654 extendableNodeInfo.wid
42656 loc: extendableNodeInfo.node.loc,
42657 hash: JSON.stringify(extendableNodeInfo.node.loc),
42659 midId: extendableNodeInfo.mid.id,
42660 edge: extendableNodeInfo.edge,
42661 cross_loc: extendableNodeInfo.cross_loc
42663 dynamicFixes: makeFixes
42667 function makeFixes(context2) {
42668 let fixes = [new validationIssueFix({
42669 icon: "iD-icon-abutment",
42670 title: _t.append("issues.fix.connect_features.title"),
42671 onClick: function(context3) {
42672 const annotation = _t("issues.fix.connect_almost_junction.annotation");
42673 const [, endNodeId, crossWayId] = this.issue.entityIds;
42674 const midNode = context3.entity(this.issue.data.midId);
42675 const endNode = context3.entity(endNodeId);
42676 const crossWay = context3.entity(crossWayId);
42677 const nearEndNodes = findNearbyEndNodes(endNode, crossWay);
42678 if (nearEndNodes.length > 0) {
42679 const collinear = findSmallJoinAngle(midNode, endNode, nearEndNodes);
42682 actionMergeNodes([collinear.id, endNode.id], collinear.loc),
42688 const targetEdge = this.issue.data.edge;
42689 const crossLoc = this.issue.data.cross_loc;
42690 const edgeNodes = [context3.entity(targetEdge[0]), context3.entity(targetEdge[1])];
42691 const closestNodeInfo = geoSphericalClosestNode(edgeNodes, crossLoc);
42692 if (closestNodeInfo.distance < WELD_TH_METERS) {
42694 actionMergeNodes([closestNodeInfo.node.id, endNode.id], closestNodeInfo.node.loc),
42699 actionAddMidpoint({ loc: crossLoc, edge: targetEdge }, endNode),
42705 const node = context2.hasEntity(this.entityIds[1]);
42706 if (node && !node.hasInterestingTags()) {
42707 fixes.push(new validationIssueFix({
42708 icon: "maki-barrier",
42709 title: _t.append("issues.fix.tag_as_disconnected.title"),
42710 onClick: function(context3) {
42711 const nodeID = this.issue.entityIds[1];
42712 const tags = Object.assign({}, context3.entity(nodeID).tags);
42713 tags.noexit = "yes";
42715 actionChangeTags(nodeID, tags),
42716 _t("issues.fix.tag_as_disconnected.annotation")
42723 function showReference(selection2) {
42724 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.almost_junction.highway-highway.reference"));
42726 function isExtendableCandidate(node, way) {
42727 const osm = services.osm;
42728 if (osm && !osm.isDataLoaded(node.loc)) {
42731 if (isTaggedAsNotContinuing(node) || graph.parentWays(node).length !== 1) {
42734 let occurrences = 0;
42735 for (const index in way.nodes) {
42736 if (way.nodes[index] === node.id) {
42738 if (occurrences > 1) {
42745 function findConnectableEndNodesByExtension(way) {
42747 if (way.isClosed()) return results;
42749 const indices = [0, way.nodes.length - 1];
42750 indices.forEach((nodeIndex) => {
42751 const nodeID = way.nodes[nodeIndex];
42752 const node = graph.entity(nodeID);
42753 if (!isExtendableCandidate(node, way)) return;
42754 const connectionInfo = canConnectByExtend(way, nodeIndex);
42755 if (!connectionInfo) return;
42756 testNodes = graph.childNodes(way).slice();
42757 testNodes[nodeIndex] = testNodes[nodeIndex].move(connectionInfo.cross_loc);
42758 if (geoHasSelfIntersections(testNodes, nodeID)) return;
42759 results.push(connectionInfo);
42763 function findNearbyEndNodes(node, way) {
42766 way.nodes[way.nodes.length - 1]
42767 ].map((d2) => graph.entity(d2)).filter((d2) => {
42768 return d2.id !== node.id && geoSphericalDistance(node.loc, d2.loc) <= CLOSE_NODE_TH;
42771 function findSmallJoinAngle(midNode, tipNode, endNodes) {
42773 let minAngle = Infinity;
42774 endNodes.forEach((endNode) => {
42775 const a1 = geoAngle(midNode, tipNode, context.projection) + Math.PI;
42776 const a2 = geoAngle(midNode, endNode, context.projection) + Math.PI;
42777 const diff = Math.max(a1, a2) - Math.min(a1, a2);
42778 if (diff < minAngle) {
42783 if (minAngle <= SIG_ANGLE_TH) return joinTo;
42786 function hasTag(tags, key) {
42787 return tags[key] !== void 0 && tags[key] !== "no";
42789 function canConnectWays(way, way2) {
42790 if (way.id === way2.id) return true;
42791 if ((hasTag(way.tags, "bridge") || hasTag(way2.tags, "bridge")) && !(hasTag(way.tags, "bridge") && hasTag(way2.tags, "bridge"))) return false;
42792 if ((hasTag(way.tags, "tunnel") || hasTag(way2.tags, "tunnel")) && !(hasTag(way.tags, "tunnel") && hasTag(way2.tags, "tunnel"))) return false;
42793 const layer1 = way.tags.layer || "0", layer2 = way2.tags.layer || "0";
42794 if (layer1 !== layer2) return false;
42795 const level1 = way.tags.level || "0", level2 = way2.tags.level || "0";
42796 if (level1 !== level2) return false;
42799 function canConnectByExtend(way, endNodeIdx) {
42800 const tipNid = way.nodes[endNodeIdx];
42801 const midNid = endNodeIdx === 0 ? way.nodes[1] : way.nodes[way.nodes.length - 2];
42802 const tipNode = graph.entity(tipNid);
42803 const midNode = graph.entity(midNid);
42804 const lon = tipNode.loc[0];
42805 const lat = tipNode.loc[1];
42806 const lon_range = geoMetersToLon(EXTEND_TH_METERS, lat) / 2;
42807 const lat_range = geoMetersToLat(EXTEND_TH_METERS) / 2;
42808 const queryExtent = geoExtent([
42809 [lon - lon_range, lat - lat_range],
42810 [lon + lon_range, lat + lat_range]
42812 const edgeLen = geoSphericalDistance(midNode.loc, tipNode.loc);
42813 const t2 = EXTEND_TH_METERS / edgeLen + 1;
42814 const extTipLoc = geoVecInterp(midNode.loc, tipNode.loc, t2);
42815 const segmentInfos = tree.waySegments(queryExtent, graph);
42816 for (let i3 = 0; i3 < segmentInfos.length; i3++) {
42817 let segmentInfo = segmentInfos[i3];
42818 let way2 = graph.entity(segmentInfo.wayId);
42819 if (!isHighway(way2)) continue;
42820 if (!canConnectWays(way, way2)) continue;
42821 let nAid = segmentInfo.nodes[0], nBid = segmentInfo.nodes[1];
42822 if (nAid === tipNid || nBid === tipNid) continue;
42823 let nA = graph.entity(nAid), nB = graph.entity(nBid);
42824 let crossLoc = geoLineIntersection([tipNode.loc, extTipLoc], [nA.loc, nB.loc]);
42830 edge: [nA.id, nB.id],
42831 cross_loc: crossLoc
42838 validation.type = type2;
42842 // modules/validations/close_nodes.js
42843 function validationCloseNodes(context) {
42844 var type2 = "close_nodes";
42845 var pointThresholdMeters = 0.2;
42846 var validation = function(entity, graph) {
42847 if (entity.type === "node") {
42848 return getIssuesForNode(entity);
42849 } else if (entity.type === "way") {
42850 return getIssuesForWay(entity);
42853 function getIssuesForNode(node) {
42854 var parentWays = graph.parentWays(node);
42855 if (parentWays.length) {
42856 return getIssuesForVertex(node, parentWays);
42858 return getIssuesForDetachedPoint(node);
42861 function wayTypeFor(way) {
42862 if (way.tags.boundary && way.tags.boundary !== "no") return "boundary";
42863 if (way.tags.indoor && way.tags.indoor !== "no") return "indoor";
42864 if (way.tags.building && way.tags.building !== "no" || way.tags["building:part"] && way.tags["building:part"] !== "no") return "building";
42865 if (osmPathHighwayTagValues[way.tags.highway]) return "path";
42866 var parentRelations = graph.parentRelations(way);
42867 for (var i3 in parentRelations) {
42868 var relation = parentRelations[i3];
42869 if (relation.tags.type === "boundary") return "boundary";
42870 if (relation.isMultipolygon()) {
42871 if (relation.tags.indoor && relation.tags.indoor !== "no") return "indoor";
42872 if (relation.tags.building && relation.tags.building !== "no" || relation.tags["building:part"] && relation.tags["building:part"] !== "no") return "building";
42877 function shouldCheckWay(way) {
42878 if (way.nodes.length <= 2 || way.isClosed() && way.nodes.length <= 4) return false;
42879 var bbox2 = way.extent(graph).bbox();
42880 var hypotenuseMeters = geoSphericalDistance([bbox2.minX, bbox2.minY], [bbox2.maxX, bbox2.maxY]);
42881 if (hypotenuseMeters < 1.5) return false;
42884 function getIssuesForWay(way) {
42885 if (!shouldCheckWay(way)) return [];
42886 var issues = [], nodes = graph.childNodes(way);
42887 for (var i3 = 0; i3 < nodes.length - 1; i3++) {
42888 var node1 = nodes[i3];
42889 var node2 = nodes[i3 + 1];
42890 var issue = getWayIssueIfAny(node1, node2, way);
42891 if (issue) issues.push(issue);
42895 function getIssuesForVertex(node, parentWays) {
42897 function checkForCloseness(node1, node2, way) {
42898 var issue = getWayIssueIfAny(node1, node2, way);
42899 if (issue) issues.push(issue);
42901 for (var i3 = 0; i3 < parentWays.length; i3++) {
42902 var parentWay = parentWays[i3];
42903 if (!shouldCheckWay(parentWay)) continue;
42904 var lastIndex = parentWay.nodes.length - 1;
42905 for (var j2 = 0; j2 < parentWay.nodes.length; j2++) {
42907 if (parentWay.nodes[j2 - 1] === node.id) {
42908 checkForCloseness(node, graph.entity(parentWay.nodes[j2]), parentWay);
42911 if (j2 !== lastIndex) {
42912 if (parentWay.nodes[j2 + 1] === node.id) {
42913 checkForCloseness(graph.entity(parentWay.nodes[j2]), node, parentWay);
42920 function thresholdMetersForWay(way) {
42921 if (!shouldCheckWay(way)) return 0;
42922 var wayType = wayTypeFor(way);
42923 if (wayType === "boundary") return 0;
42924 if (wayType === "indoor") return 0.01;
42925 if (wayType === "building") return 0.05;
42926 if (wayType === "path") return 0.1;
42929 function getIssuesForDetachedPoint(node) {
42931 var lon = node.loc[0];
42932 var lat = node.loc[1];
42933 var lon_range = geoMetersToLon(pointThresholdMeters, lat) / 2;
42934 var lat_range = geoMetersToLat(pointThresholdMeters) / 2;
42935 var queryExtent = geoExtent([
42936 [lon - lon_range, lat - lat_range],
42937 [lon + lon_range, lat + lat_range]
42939 var intersected = context.history().tree().intersects(queryExtent, graph);
42940 for (var j2 = 0; j2 < intersected.length; j2++) {
42941 var nearby = intersected[j2];
42942 if (nearby.id === node.id) continue;
42943 if (nearby.type !== "node" || nearby.geometry(graph) !== "point") continue;
42944 if (nearby.loc === node.loc || geoSphericalDistance(node.loc, nearby.loc) < pointThresholdMeters) {
42945 if ("memorial:type" in node.tags && "memorial:type" in nearby.tags && node.tags["memorial:type"] === "stolperstein" && nearby.tags["memorial:type"] === "stolperstein") continue;
42946 if ("memorial" in node.tags && "memorial" in nearby.tags && node.tags.memorial === "stolperstein" && nearby.tags.memorial === "stolperstein") continue;
42947 var zAxisKeys = { layer: true, level: true, "addr:housenumber": true, "addr:unit": true };
42948 var zAxisDifferentiates = false;
42949 for (var key in zAxisKeys) {
42950 var nodeValue = node.tags[key] || "0";
42951 var nearbyValue = nearby.tags[key] || "0";
42952 if (nodeValue !== nearbyValue) {
42953 zAxisDifferentiates = true;
42957 if (zAxisDifferentiates) continue;
42958 issues.push(new validationIssue({
42960 subtype: "detached",
42961 severity: "warning",
42962 message: function(context2) {
42963 var entity2 = context2.hasEntity(this.entityIds[0]), entity22 = context2.hasEntity(this.entityIds[1]);
42964 return entity2 && entity22 ? _t.append("issues.close_nodes.detached.message", {
42965 feature: utilDisplayLabel(entity2, context2.graph()),
42966 feature2: utilDisplayLabel(entity22, context2.graph())
42969 reference: showReference,
42970 entityIds: [node.id, nearby.id],
42971 dynamicFixes: function() {
42973 new validationIssueFix({
42974 icon: "iD-operation-disconnect",
42975 title: _t.append("issues.fix.move_points_apart.title")
42977 new validationIssueFix({
42978 icon: "iD-icon-layers",
42979 title: _t.append("issues.fix.use_different_layers_or_levels.title")
42987 function showReference(selection2) {
42988 var referenceText = _t("issues.close_nodes.detached.reference");
42989 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
42992 function getWayIssueIfAny(node1, node2, way) {
42993 if (node1.id === node2.id || node1.hasInterestingTags() && node2.hasInterestingTags()) {
42996 if (node1.loc !== node2.loc) {
42997 var parentWays1 = graph.parentWays(node1);
42998 var parentWays2 = new Set(graph.parentWays(node2));
42999 var sharedWays = parentWays1.filter(function(parentWay) {
43000 return parentWays2.has(parentWay);
43002 var thresholds = sharedWays.map(function(parentWay) {
43003 return thresholdMetersForWay(parentWay);
43005 var threshold = Math.min(...thresholds);
43006 var distance = geoSphericalDistance(node1.loc, node2.loc);
43007 if (distance > threshold) return null;
43009 return new validationIssue({
43011 subtype: "vertices",
43012 severity: "warning",
43013 message: function(context2) {
43014 var entity2 = context2.hasEntity(this.entityIds[0]);
43015 return entity2 ? _t.append("issues.close_nodes.message", { way: utilDisplayLabel(entity2, context2.graph()) }) : "";
43017 reference: showReference,
43018 entityIds: [way.id, node1.id, node2.id],
43020 dynamicFixes: function() {
43022 new validationIssueFix({
43023 icon: "iD-icon-plus",
43024 title: _t.append("issues.fix.merge_points.title"),
43025 onClick: function(context2) {
43026 var entityIds = this.issue.entityIds;
43027 var action = actionMergeNodes([entityIds[1], entityIds[2]]);
43028 context2.perform(action, _t("issues.fix.merge_close_vertices.annotation"));
43031 new validationIssueFix({
43032 icon: "iD-operation-disconnect",
43033 title: _t.append("issues.fix.move_points_apart.title")
43038 function showReference(selection2) {
43039 var referenceText = _t("issues.close_nodes.reference");
43040 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").html(referenceText);
43044 validation.type = type2;
43048 // modules/validations/crossing_ways.js
43049 var import_lodash3 = __toESM(require_lodash());
43050 function validationCrossingWays(context) {
43051 var type2 = "crossing_ways";
43052 function getFeatureWithFeatureTypeTagsForWay(way, graph) {
43053 if (getFeatureType(way, graph) === null) {
43054 var parentRels = graph.parentRelations(way);
43055 for (var i3 = 0; i3 < parentRels.length; i3++) {
43056 var rel = parentRels[i3];
43057 if (getFeatureType(rel, graph) !== null) {
43064 function hasTag(tags, key) {
43065 return tags[key] !== void 0 && tags[key] !== "no";
43067 function taggedAsIndoor(tags) {
43068 return hasTag(tags, "indoor") || hasTag(tags, "level") || tags.highway === "corridor";
43070 function allowsBridge(featureType) {
43071 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43073 function allowsTunnel(featureType) {
43074 return featureType === "highway" || featureType === "railway" || featureType === "waterway";
43076 var ignoredBuildings = {
43082 function getFeatureType(entity, graph) {
43083 var geometry = entity.geometry(graph);
43084 if (geometry !== "line" && geometry !== "area") return null;
43085 var tags = entity.tags;
43086 if (hasTag(tags, "building") && !ignoredBuildings[tags.building]) return "building";
43087 if (hasTag(tags, "highway") && osmRoutableHighwayTagValues[tags.highway]) return "highway";
43088 if (geometry !== "line") return null;
43089 if (hasTag(tags, "railway") && osmRailwayTrackTagValues[tags.railway]) return "railway";
43090 if (hasTag(tags, "waterway") && osmFlowingWaterwayTagValues[tags.waterway]) return "waterway";
43093 function isLegitCrossing(tags1, featureType1, tags2, featureType2) {
43094 var level1 = tags1.level || "0";
43095 var level2 = tags2.level || "0";
43096 if (taggedAsIndoor(tags1) && taggedAsIndoor(tags2) && level1 !== level2) {
43099 var layer1 = tags1.layer || "0";
43100 var layer2 = tags2.layer || "0";
43101 if (allowsBridge(featureType1) && allowsBridge(featureType2)) {
43102 if (hasTag(tags1, "bridge") && !hasTag(tags2, "bridge")) return true;
43103 if (!hasTag(tags1, "bridge") && hasTag(tags2, "bridge")) return true;
43104 if (hasTag(tags1, "bridge") && hasTag(tags2, "bridge") && layer1 !== layer2) return true;
43105 } else if (allowsBridge(featureType1) && hasTag(tags1, "bridge")) return true;
43106 else if (allowsBridge(featureType2) && hasTag(tags2, "bridge")) return true;
43107 if (allowsTunnel(featureType1) && allowsTunnel(featureType2)) {
43108 if (hasTag(tags1, "tunnel") && !hasTag(tags2, "tunnel")) return true;
43109 if (!hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel")) return true;
43110 if (hasTag(tags1, "tunnel") && hasTag(tags2, "tunnel") && layer1 !== layer2) return true;
43111 } else if (allowsTunnel(featureType1) && hasTag(tags1, "tunnel")) return true;
43112 else if (allowsTunnel(featureType2) && hasTag(tags2, "tunnel")) return true;
43113 if (featureType1 === "waterway" && featureType2 === "highway" && tags2.man_made === "pier") return true;
43114 if (featureType2 === "waterway" && featureType1 === "highway" && tags1.man_made === "pier") return true;
43115 if (featureType1 === "building" || featureType2 === "building" || taggedAsIndoor(tags1) || taggedAsIndoor(tags2)) {
43116 if (layer1 !== layer2) return true;
43120 var highwaysDisallowingFords = {
43122 motorway_link: true,
43126 primary_link: true,
43128 secondary_link: true
43130 function tagsForConnectionNodeIfAllowed(entity1, entity2, graph, lessLikelyTags) {
43131 var featureType1 = getFeatureType(entity1, graph);
43132 var featureType2 = getFeatureType(entity2, graph);
43133 var geometry1 = entity1.geometry(graph);
43134 var geometry2 = entity2.geometry(graph);
43135 var bothLines = geometry1 === "line" && geometry2 === "line";
43136 if (featureType1 === featureType2) {
43137 if (featureType1 === "highway") {
43138 var entity1IsPath = osmPathHighwayTagValues[entity1.tags.highway];
43139 var entity2IsPath = osmPathHighwayTagValues[entity2.tags.highway];
43140 if ((entity1IsPath || entity2IsPath) && entity1IsPath !== entity2IsPath) {
43141 var roadFeature = entity1IsPath ? entity2 : entity1;
43142 var pathFeature = entity1IsPath ? entity1 : entity2;
43143 if (roadFeature.tags.highway === "track") {
43146 if (!lessLikelyTags && roadFeature.tags.highway === "service" && pathFeature.tags.highway === "footway" && pathFeature.tags.footway === "sidewalk") {
43149 if (["marked", "unmarked", "traffic_signals", "uncontrolled"].indexOf(pathFeature.tags.crossing) !== -1) {
43150 return bothLines ? { highway: "crossing", crossing: pathFeature.tags.crossing } : {};
43152 return bothLines ? { highway: "crossing" } : {};
43156 if (featureType1 === "waterway") return {};
43157 if (featureType1 === "railway") return {};
43159 var featureTypes = [featureType1, featureType2];
43160 if (featureTypes.indexOf("highway") !== -1) {
43161 if (featureTypes.indexOf("railway") !== -1) {
43162 if (!bothLines) return {};
43163 var isTram = entity1.tags.railway === "tram" || entity2.tags.railway === "tram";
43164 if (osmPathHighwayTagValues[entity1.tags.highway] || osmPathHighwayTagValues[entity2.tags.highway]) {
43165 if (isTram) return { railway: "tram_crossing" };
43166 return { railway: "crossing" };
43168 if (isTram) return { railway: "tram_level_crossing" };
43169 return { railway: "level_crossing" };
43172 if (featureTypes.indexOf("waterway") !== -1) {
43173 if (hasTag(entity1.tags, "tunnel") && hasTag(entity2.tags, "tunnel")) return null;
43174 if (hasTag(entity1.tags, "bridge") && hasTag(entity2.tags, "bridge")) return null;
43175 if (highwaysDisallowingFords[entity1.tags.highway] || highwaysDisallowingFords[entity2.tags.highway]) {
43178 return bothLines ? { ford: "yes" } : {};
43184 function findCrossingsByWay(way1, graph, tree) {
43185 var edgeCrossInfos = [];
43186 if (way1.type !== "way") return edgeCrossInfos;
43187 var taggedFeature1 = getFeatureWithFeatureTypeTagsForWay(way1, graph);
43188 var way1FeatureType = getFeatureType(taggedFeature1, graph);
43189 if (way1FeatureType === null) return edgeCrossInfos;
43190 var checkedSingleCrossingWays = {};
43193 var n1, n22, nA, nB, nAId, nBId;
43194 var segment1, segment2;
43196 var segmentInfos, segment2Info, way2, taggedFeature2, way2FeatureType;
43197 var way1Nodes = graph.childNodes(way1);
43198 var comparedWays = {};
43199 for (i3 = 0; i3 < way1Nodes.length - 1; i3++) {
43200 n1 = way1Nodes[i3];
43201 n22 = way1Nodes[i3 + 1];
43202 extent = geoExtent([
43204 Math.min(n1.loc[0], n22.loc[0]),
43205 Math.min(n1.loc[1], n22.loc[1])
43208 Math.max(n1.loc[0], n22.loc[0]),
43209 Math.max(n1.loc[1], n22.loc[1])
43212 segmentInfos = tree.waySegments(extent, graph);
43213 for (j2 = 0; j2 < segmentInfos.length; j2++) {
43214 segment2Info = segmentInfos[j2];
43215 if (segment2Info.wayId === way1.id) continue;
43216 if (checkedSingleCrossingWays[segment2Info.wayId]) continue;
43217 comparedWays[segment2Info.wayId] = true;
43218 way2 = graph.hasEntity(segment2Info.wayId);
43219 if (!way2) continue;
43220 taggedFeature2 = getFeatureWithFeatureTypeTagsForWay(way2, graph);
43221 way2FeatureType = getFeatureType(taggedFeature2, graph);
43222 if (way2FeatureType === null || isLegitCrossing(taggedFeature1.tags, way1FeatureType, taggedFeature2.tags, way2FeatureType)) {
43225 oneOnly = way1FeatureType === "building" || way2FeatureType === "building";
43226 nAId = segment2Info.nodes[0];
43227 nBId = segment2Info.nodes[1];
43228 if (nAId === n1.id || nAId === n22.id || nBId === n1.id || nBId === n22.id) {
43231 nA = graph.hasEntity(nAId);
43233 nB = graph.hasEntity(nBId);
43235 segment1 = [n1.loc, n22.loc];
43236 segment2 = [nA.loc, nB.loc];
43237 var point = geoLineIntersection(segment1, segment2);
43239 edgeCrossInfos.push({
43243 featureType: way1FeatureType,
43244 edge: [n1.id, n22.id]
43248 featureType: way2FeatureType,
43249 edge: [nA.id, nB.id]
43255 checkedSingleCrossingWays[way2.id] = true;
43261 return edgeCrossInfos;
43263 function waysToCheck(entity, graph) {
43264 var featureType = getFeatureType(entity, graph);
43265 if (!featureType) return [];
43266 if (entity.type === "way") {
43268 } else if (entity.type === "relation") {
43269 return entity.members.reduce(function(array2, member) {
43270 if (member.type === "way" && // only look at geometry ways
43271 (!member.role || member.role === "outer" || member.role === "inner")) {
43272 var entity2 = graph.hasEntity(member.id);
43273 if (entity2 && array2.indexOf(entity2) === -1) {
43274 array2.push(entity2);
43282 var validation = function checkCrossingWays(entity, graph) {
43283 var tree = context.history().tree();
43284 var ways = waysToCheck(entity, graph);
43286 var wayIndex, crossingIndex, crossings;
43287 for (wayIndex in ways) {
43288 crossings = findCrossingsByWay(ways[wayIndex], graph, tree);
43289 for (crossingIndex in crossings) {
43290 issues.push(createIssue(crossings[crossingIndex], graph));
43295 function createIssue(crossing, graph) {
43296 crossing.wayInfos.sort(function(way1Info, way2Info) {
43297 var type1 = way1Info.featureType;
43298 var type22 = way2Info.featureType;
43299 if (type1 === type22) {
43300 return utilDisplayLabel(way1Info.way, graph) > utilDisplayLabel(way2Info.way, graph);
43301 } else if (type1 === "waterway") {
43303 } else if (type22 === "waterway") {
43306 return type1 < type22;
43308 var entities = crossing.wayInfos.map(function(wayInfo) {
43309 return getFeatureWithFeatureTypeTagsForWay(wayInfo.way, graph);
43311 var edges = [crossing.wayInfos[0].edge, crossing.wayInfos[1].edge];
43312 var featureTypes = [crossing.wayInfos[0].featureType, crossing.wayInfos[1].featureType];
43313 var connectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph);
43314 var featureType1 = crossing.wayInfos[0].featureType;
43315 var featureType2 = crossing.wayInfos[1].featureType;
43316 var isCrossingIndoors = taggedAsIndoor(entities[0].tags) && taggedAsIndoor(entities[1].tags);
43317 var isCrossingTunnels = allowsTunnel(featureType1) && hasTag(entities[0].tags, "tunnel") && allowsTunnel(featureType2) && hasTag(entities[1].tags, "tunnel");
43318 var isCrossingBridges = allowsBridge(featureType1) && hasTag(entities[0].tags, "bridge") && allowsBridge(featureType2) && hasTag(entities[1].tags, "bridge");
43319 var subtype = [featureType1, featureType2].sort().join("-");
43320 var crossingTypeID = subtype;
43321 if (isCrossingIndoors) {
43322 crossingTypeID = "indoor-indoor";
43323 } else if (isCrossingTunnels) {
43324 crossingTypeID = "tunnel-tunnel";
43325 } else if (isCrossingBridges) {
43326 crossingTypeID = "bridge-bridge";
43328 if (connectionTags && (isCrossingIndoors || isCrossingTunnels || isCrossingBridges)) {
43329 crossingTypeID += "_connectable";
43331 var uniqueID = crossing.crossPoint[0].toFixed(4) + "," + crossing.crossPoint[1].toFixed(4);
43332 return new validationIssue({
43335 severity: "warning",
43336 message: function(context2) {
43337 var graph2 = context2.graph();
43338 var entity1 = graph2.hasEntity(this.entityIds[0]), entity2 = graph2.hasEntity(this.entityIds[1]);
43339 return entity1 && entity2 ? _t.append("issues.crossing_ways.message", {
43340 feature: utilDisplayLabel(entity1, graph2),
43341 feature2: utilDisplayLabel(entity2, graph2)
43344 reference: showReference,
43345 entityIds: entities.map(function(entity) {
43354 loc: crossing.crossPoint,
43355 dynamicFixes: function(context2) {
43356 var mode = context2.mode();
43357 if (!mode || mode.id !== "select" || mode.selectedIDs().length !== 1) return [];
43358 var selectedIndex = this.entityIds[0] === mode.selectedIDs()[0] ? 0 : 1;
43359 var selectedFeatureType = this.data.featureTypes[selectedIndex];
43360 var otherFeatureType = this.data.featureTypes[selectedIndex === 0 ? 1 : 0];
43362 if (connectionTags) {
43363 fixes.push(makeConnectWaysFix(this.data.connectionTags));
43364 let lessLikelyConnectionTags = tagsForConnectionNodeIfAllowed(entities[0], entities[1], graph, true);
43365 if (lessLikelyConnectionTags && !(0, import_lodash3.isEqual)(connectionTags, lessLikelyConnectionTags)) {
43366 fixes.push(makeConnectWaysFix(lessLikelyConnectionTags));
43369 if (isCrossingIndoors) {
43370 fixes.push(new validationIssueFix({
43371 icon: "iD-icon-layers",
43372 title: _t.append("issues.fix.use_different_levels.title")
43374 } else if (isCrossingTunnels || isCrossingBridges || featureType1 === "building" || featureType2 === "building") {
43375 fixes.push(makeChangeLayerFix("higher"));
43376 fixes.push(makeChangeLayerFix("lower"));
43377 } else if (context2.graph().geometry(this.entityIds[0]) === "line" && context2.graph().geometry(this.entityIds[1]) === "line") {
43378 if (allowsBridge(selectedFeatureType) && selectedFeatureType !== "waterway") {
43379 fixes.push(makeAddBridgeOrTunnelFix("add_a_bridge", "temaki-bridge", "bridge"));
43381 var skipTunnelFix = otherFeatureType === "waterway" && selectedFeatureType !== "waterway";
43382 if (allowsTunnel(selectedFeatureType) && !skipTunnelFix) {
43383 fixes.push(makeAddBridgeOrTunnelFix("add_a_tunnel", "temaki-tunnel", "tunnel"));
43386 fixes.push(new validationIssueFix({
43387 icon: "iD-operation-move",
43388 title: _t.append("issues.fix.reposition_features.title")
43393 function showReference(selection2) {
43394 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.crossing_ways." + crossingTypeID + ".reference"));
43397 function makeAddBridgeOrTunnelFix(fixTitleID, iconName, bridgeOrTunnel) {
43398 return new validationIssueFix({
43400 title: _t.append("issues.fix." + fixTitleID + ".title"),
43401 onClick: function(context2) {
43402 var mode = context2.mode();
43403 if (!mode || mode.id !== "select") return;
43404 var selectedIDs = mode.selectedIDs();
43405 if (selectedIDs.length !== 1) return;
43406 var selectedWayID = selectedIDs[0];
43407 if (!context2.hasEntity(selectedWayID)) return;
43408 var resultWayIDs = [selectedWayID];
43409 var edge, crossedEdge, crossedWayID;
43410 if (this.issue.entityIds[0] === selectedWayID) {
43411 edge = this.issue.data.edges[0];
43412 crossedEdge = this.issue.data.edges[1];
43413 crossedWayID = this.issue.entityIds[1];
43415 edge = this.issue.data.edges[1];
43416 crossedEdge = this.issue.data.edges[0];
43417 crossedWayID = this.issue.entityIds[0];
43419 var crossingLoc = this.issue.loc;
43420 var projection2 = context2.projection;
43421 var action = function actionAddStructure(graph) {
43422 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
43423 var crossedWay = graph.hasEntity(crossedWayID);
43424 var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
43425 if (!structLengthMeters) {
43426 structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
43428 if (structLengthMeters) {
43429 if (getFeatureType(crossedWay, graph) === "railway") {
43430 structLengthMeters *= 2;
43433 structLengthMeters = 8;
43435 var a1 = geoAngle(edgeNodes[0], edgeNodes[1], projection2) + Math.PI;
43436 var a2 = geoAngle(graph.entity(crossedEdge[0]), graph.entity(crossedEdge[1]), projection2) + Math.PI;
43437 var crossingAngle = Math.max(a1, a2) - Math.min(a1, a2);
43438 if (crossingAngle > Math.PI) crossingAngle -= Math.PI;
43439 structLengthMeters = structLengthMeters / 2 / Math.sin(crossingAngle) * 2;
43440 structLengthMeters += 4;
43441 structLengthMeters = Math.min(Math.max(structLengthMeters, 4), 50);
43442 function geomToProj(geoPoint) {
43444 geoLonToMeters(geoPoint[0], geoPoint[1]),
43445 geoLatToMeters(geoPoint[1])
43448 function projToGeom(projPoint) {
43449 var lat = geoMetersToLat(projPoint[1]);
43451 geoMetersToLon(projPoint[0], lat),
43455 var projEdgeNode1 = geomToProj(edgeNodes[0].loc);
43456 var projEdgeNode2 = geomToProj(edgeNodes[1].loc);
43457 var projectedAngle = geoVecAngle(projEdgeNode1, projEdgeNode2);
43458 var projectedCrossingLoc = geomToProj(crossingLoc);
43459 var linearToSphericalMetersRatio = geoVecLength(projEdgeNode1, projEdgeNode2) / geoSphericalDistance(edgeNodes[0].loc, edgeNodes[1].loc);
43460 function locSphericalDistanceFromCrossingLoc(angle2, distanceMeters) {
43461 var lengthSphericalMeters = distanceMeters * linearToSphericalMetersRatio;
43462 return projToGeom([
43463 projectedCrossingLoc[0] + Math.cos(angle2) * lengthSphericalMeters,
43464 projectedCrossingLoc[1] + Math.sin(angle2) * lengthSphericalMeters
43467 var endpointLocGetter1 = function(lengthMeters) {
43468 return locSphericalDistanceFromCrossingLoc(projectedAngle, lengthMeters);
43470 var endpointLocGetter2 = function(lengthMeters) {
43471 return locSphericalDistanceFromCrossingLoc(projectedAngle + Math.PI, lengthMeters);
43473 var minEdgeLengthMeters = 0.55;
43474 function determineEndpoint(edge2, endNode, locGetter) {
43476 var idealLengthMeters = structLengthMeters / 2;
43477 var crossingToEdgeEndDistance = geoSphericalDistance(crossingLoc, endNode.loc);
43478 if (crossingToEdgeEndDistance - idealLengthMeters > minEdgeLengthMeters) {
43479 var idealNodeLoc = locGetter(idealLengthMeters);
43480 newNode = osmNode();
43481 graph = actionAddMidpoint({ loc: idealNodeLoc, edge: edge2 }, newNode)(graph);
43484 endNode.parentIntersectionWays(graph).forEach(function(way) {
43485 way.nodes.forEach(function(nodeID) {
43486 if (nodeID === endNode.id) {
43487 if (endNode.id === way.first() && endNode.id !== way.last() || endNode.id === way.last() && endNode.id !== way.first()) {
43495 if (edgeCount >= 3) {
43496 var insetLength = crossingToEdgeEndDistance - minEdgeLengthMeters;
43497 if (insetLength > minEdgeLengthMeters) {
43498 var insetNodeLoc = locGetter(insetLength);
43499 newNode = osmNode();
43500 graph = actionAddMidpoint({ loc: insetNodeLoc, edge: edge2 }, newNode)(graph);
43504 if (!newNode) newNode = endNode;
43505 var splitAction = actionSplit([newNode.id]).limitWays(resultWayIDs);
43506 graph = splitAction(graph);
43507 if (splitAction.getCreatedWayIDs().length) {
43508 resultWayIDs.push(splitAction.getCreatedWayIDs()[0]);
43512 var structEndNode1 = determineEndpoint(edge, edgeNodes[1], endpointLocGetter1);
43513 var structEndNode2 = determineEndpoint([edgeNodes[0].id, structEndNode1.id], edgeNodes[0], endpointLocGetter2);
43514 var structureWay = resultWayIDs.map(function(id2) {
43515 return graph.entity(id2);
43516 }).find(function(way) {
43517 return way.nodes.indexOf(structEndNode1.id) !== -1 && way.nodes.indexOf(structEndNode2.id) !== -1;
43519 var tags = Object.assign({}, structureWay.tags);
43520 if (bridgeOrTunnel === "bridge") {
43521 tags.bridge = "yes";
43524 var tunnelValue = "yes";
43525 if (getFeatureType(structureWay, graph) === "waterway") {
43526 tunnelValue = "culvert";
43528 tags.tunnel = tunnelValue;
43531 graph = actionChangeTags(structureWay.id, tags)(graph);
43534 context2.perform(action, _t("issues.fix." + fixTitleID + ".annotation"));
43535 context2.enter(modeSelect(context2, resultWayIDs));
43539 function makeConnectWaysFix(connectionTags) {
43540 var fixTitleID = "connect_features";
43541 var fixIcon = "iD-icon-crossing";
43542 if (connectionTags.highway === "crossing") {
43543 fixTitleID = "connect_using_crossing";
43544 fixIcon = "temaki-pedestrian";
43546 if (connectionTags.ford) {
43547 fixTitleID = "connect_using_ford";
43548 fixIcon = "roentgen-ford";
43550 const fix = new validationIssueFix({
43552 title: _t.append("issues.fix." + fixTitleID + ".title"),
43553 onClick: function(context2) {
43554 var loc = this.issue.loc;
43555 var edges = this.issue.data.edges;
43557 function actionConnectCrossingWays(graph) {
43558 var node = osmNode({ loc, tags: connectionTags });
43559 graph = graph.replace(node);
43560 var nodesToMerge = [node.id];
43561 var mergeThresholdInMeters = 0.75;
43562 edges.forEach(function(edge) {
43563 var edgeNodes = [graph.entity(edge[0]), graph.entity(edge[1])];
43564 var nearby = geoSphericalClosestNode(edgeNodes, loc);
43565 if ((!nearby.node.hasInterestingTags() || nearby.node.isCrossing()) && nearby.distance < mergeThresholdInMeters) {
43566 nodesToMerge.push(nearby.node.id);
43568 graph = actionAddMidpoint({ loc, edge }, node)(graph);
43571 if (nodesToMerge.length > 1) {
43572 graph = actionMergeNodes(nodesToMerge, loc)(graph);
43576 _t("issues.fix.connect_crossing_features.annotation")
43580 fix._connectionTags = connectionTags;
43583 function makeChangeLayerFix(higherOrLower) {
43584 return new validationIssueFix({
43585 icon: "iD-icon-" + (higherOrLower === "higher" ? "up" : "down"),
43586 title: _t.append("issues.fix.tag_this_as_" + higherOrLower + ".title"),
43587 onClick: function(context2) {
43588 var mode = context2.mode();
43589 if (!mode || mode.id !== "select") return;
43590 var selectedIDs = mode.selectedIDs();
43591 if (selectedIDs.length !== 1) return;
43592 var selectedID = selectedIDs[0];
43593 if (!this.issue.entityIds.some(function(entityId) {
43594 return entityId === selectedID;
43596 var entity = context2.hasEntity(selectedID);
43597 if (!entity) return;
43598 var tags = Object.assign({}, entity.tags);
43599 var layer = tags.layer && Number(tags.layer);
43600 if (layer && !isNaN(layer)) {
43601 if (higherOrLower === "higher") {
43607 if (higherOrLower === "higher") {
43613 tags.layer = layer.toString();
43615 actionChangeTags(entity.id, tags),
43616 _t("operations.change_tags.annotation")
43621 validation.type = type2;
43625 // modules/behavior/draw_way.js
43626 function behaviorDrawWay(context, wayID, mode, startGraph) {
43627 const keybinding = utilKeybinding("drawWay");
43628 var dispatch14 = dispatch_default("rejectedSelfIntersection");
43629 var behavior = behaviorDraw(context);
43635 var _pointerHasMoved = false;
43637 var _didResolveTempEdit = false;
43638 function createDrawNode(loc) {
43639 _drawNode = osmNode({ loc });
43640 context.pauseChangeDispatch();
43641 context.replace(function actionAddDrawNode(graph) {
43642 var way = graph.entity(wayID);
43643 return graph.replace(_drawNode).replace(way.addNode(_drawNode.id, _nodeIndex));
43645 context.resumeChangeDispatch();
43646 setActiveElements();
43648 function removeDrawNode() {
43649 context.pauseChangeDispatch();
43651 function actionDeleteDrawNode(graph) {
43652 var way = graph.entity(wayID);
43653 return graph.replace(way.removeNode(_drawNode.id)).remove(_drawNode);
43657 _drawNode = void 0;
43658 context.resumeChangeDispatch();
43660 function keydown(d3_event) {
43661 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
43662 if (context.surface().classed("nope")) {
43663 context.surface().classed("nope-suppressed", true);
43665 context.surface().classed("nope", false).classed("nope-disabled", true);
43668 function keyup(d3_event) {
43669 if (d3_event.keyCode === utilKeybinding.modifierCodes.alt) {
43670 if (context.surface().classed("nope-suppressed")) {
43671 context.surface().classed("nope", true);
43673 context.surface().classed("nope-suppressed", false).classed("nope-disabled", false);
43676 function allowsVertex(d2) {
43677 return d2.geometry(context.graph()) === "vertex" || _mainPresetIndex.allowsVertex(d2, context.graph());
43679 function move(d3_event, datum2) {
43680 var loc = context.map().mouseCoordinates();
43681 if (!_drawNode) createDrawNode(loc);
43682 context.surface().classed("nope-disabled", d3_event.altKey);
43683 var targetLoc = datum2 && datum2.properties && datum2.properties.entity && allowsVertex(datum2.properties.entity) && datum2.properties.entity.loc;
43684 var targetNodes = datum2 && datum2.properties && datum2.properties.nodes;
43687 } else if (targetNodes) {
43688 var choice = geoChooseEdge(targetNodes, context.map().mouse(), context.projection, _drawNode.id);
43693 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
43694 _drawNode = context.entity(_drawNode.id);
43697 /* includeDrawNode */
43700 function checkGeometry(includeDrawNode) {
43701 var nopeDisabled = context.surface().classed("nope-disabled");
43702 var isInvalid = isInvalidGeometry(includeDrawNode);
43703 if (nopeDisabled) {
43704 context.surface().classed("nope", false).classed("nope-suppressed", isInvalid);
43706 context.surface().classed("nope", isInvalid).classed("nope-suppressed", false);
43709 function isInvalidGeometry(includeDrawNode) {
43710 var testNode = _drawNode;
43711 var parentWay = context.graph().entity(wayID);
43712 var nodes = context.graph().childNodes(parentWay).slice();
43713 if (includeDrawNode) {
43714 if (parentWay.isClosed()) {
43718 if (parentWay.isClosed()) {
43719 if (nodes.length < 3) return false;
43720 if (_drawNode) nodes.splice(-2, 1);
43721 testNode = nodes[nodes.length - 2];
43726 return testNode && geoHasSelfIntersections(nodes, testNode.id);
43728 function undone() {
43729 _didResolveTempEdit = true;
43730 context.pauseChangeDispatch();
43732 if (context.graph() === startGraph) {
43733 nextMode = modeSelect(context, [wayID]);
43738 context.perform(actionNoop());
43740 context.resumeChangeDispatch();
43741 context.enter(nextMode);
43743 function setActiveElements() {
43744 if (!_drawNode) return;
43745 context.surface().selectAll("." + _drawNode.id).classed("active", true);
43747 function resetToStartGraph() {
43748 while (context.graph() !== startGraph) {
43752 var drawWay = function(surface) {
43753 _drawNode = void 0;
43754 _didResolveTempEdit = false;
43755 _origWay = context.entity(wayID);
43756 if (typeof _nodeIndex === "number") {
43757 _headNodeID = _origWay.nodes[_nodeIndex];
43758 } else if (_origWay.isClosed()) {
43759 _headNodeID = _origWay.nodes[_origWay.nodes.length - 2];
43761 _headNodeID = _origWay.nodes[_origWay.nodes.length - 1];
43763 _wayGeometry = _origWay.geometry(context.graph());
43765 (_origWay.nodes.length === (_origWay.isClosed() ? 2 : 1) ? "operations.start.annotation." : "operations.continue.annotation.") + _wayGeometry
43767 _pointerHasMoved = false;
43768 context.pauseChangeDispatch();
43769 context.perform(actionNoop(), _annotation);
43770 context.resumeChangeDispatch();
43771 behavior.hover().initialNodeID(_headNodeID);
43772 behavior.on("move", function() {
43773 _pointerHasMoved = true;
43774 move.apply(this, arguments);
43775 }).on("down", function() {
43776 move.apply(this, arguments);
43777 }).on("downcancel", function() {
43778 if (_drawNode) removeDrawNode();
43779 }).on("click", drawWay.add).on("clickWay", drawWay.addWay).on("clickNode", drawWay.addNode).on("undo", context.undo).on("cancel", drawWay.cancel).on("finish", drawWay.finish);
43780 select_default2(window).on("keydown.drawWay", keydown).on("keyup.drawWay", keyup);
43781 context.map().dblclickZoomEnable(false).on("drawn.draw", setActiveElements);
43782 setActiveElements();
43783 surface.call(behavior);
43784 context.history().on("undone.draw", undone);
43786 drawWay.off = function(surface) {
43787 if (!_didResolveTempEdit) {
43788 context.pauseChangeDispatch();
43789 resetToStartGraph();
43790 context.resumeChangeDispatch();
43792 _drawNode = void 0;
43793 _nodeIndex = void 0;
43794 context.map().on("drawn.draw", null);
43795 surface.call(behavior.off).selectAll(".active").classed("active", false);
43796 surface.classed("nope", false).classed("nope-suppressed", false).classed("nope-disabled", false);
43797 select_default2(window).on("keydown.drawWay", null).on("keyup.drawWay", null);
43798 context.history().on("undone.draw", null);
43800 function attemptAdd(d2, loc, doAdd) {
43802 context.replace(actionMoveNode(_drawNode.id, loc), _annotation);
43803 _drawNode = context.entity(_drawNode.id);
43805 createDrawNode(loc);
43809 /* includeDrawNode */
43811 if (d2 && d2.properties && d2.properties.nope || context.surface().classed("nope")) {
43812 if (!_pointerHasMoved) {
43815 dispatch14.call("rejectedSelfIntersection", this);
43818 context.pauseChangeDispatch();
43820 _didResolveTempEdit = true;
43821 context.resumeChangeDispatch();
43822 context.enter(mode);
43824 drawWay.add = function(loc, d2) {
43825 attemptAdd(d2, loc, function() {
43828 drawWay.addWay = function(loc, edge, d2) {
43829 attemptAdd(d2, loc, function() {
43831 actionAddMidpoint({ loc, edge }, _drawNode),
43836 drawWay.addNode = function(node, d2) {
43837 if (node.id === _headNodeID || // or the first node when drawing an area
43838 _origWay.isClosed() && node.id === _origWay.first()) {
43842 attemptAdd(d2, node.loc, function() {
43844 function actionReplaceDrawNode(graph) {
43845 graph = graph.replace(graph.entity(wayID).removeNode(_drawNode.id)).remove(_drawNode);
43846 return graph.replace(graph.entity(wayID).addNode(node.id, _nodeIndex));
43852 function getFeatureType(ways) {
43853 if (ways.every((way) => way.isClosed())) return "area";
43854 if (ways.every((way) => !way.isClosed())) return "line";
43857 function followMode() {
43858 if (_didResolveTempEdit) return;
43860 const isDrawingArea = _origWay.nodes[0] === _origWay.nodes.slice(-1)[0];
43861 const [secondLastNodeId, lastNodeId] = _origWay.nodes.slice(isDrawingArea ? -3 : -2);
43862 const historyGraph = context.history().graph();
43863 if (!lastNodeId || !secondLastNodeId || !historyGraph.hasEntity(lastNodeId) || !historyGraph.hasEntity(secondLastNodeId)) {
43864 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.needs_more_initial_nodes"))();
43867 const lastNodesParents = historyGraph.parentWays(historyGraph.entity(lastNodeId)).filter((w2) => w2.id !== wayID);
43868 const secondLastNodesParents = historyGraph.parentWays(historyGraph.entity(secondLastNodeId)).filter((w2) => w2.id !== wayID);
43869 const featureType = getFeatureType(lastNodesParents);
43870 if (lastNodesParents.length !== 1 || secondLastNodesParents.length === 0) {
43871 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_multiple_ways.".concat(featureType)))();
43874 if (!secondLastNodesParents.some((n3) => n3.id === lastNodesParents[0].id)) {
43875 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.intersection_of_different_ways.".concat(featureType)))();
43878 const way = lastNodesParents[0];
43879 const indexOfLast = way.nodes.indexOf(lastNodeId);
43880 const indexOfSecondLast = way.nodes.indexOf(secondLastNodeId);
43881 const isDescendingPastZero = indexOfLast === way.nodes.length - 2 && indexOfSecondLast === 0;
43882 let nextNodeIndex = indexOfLast + (indexOfLast > indexOfSecondLast && !isDescendingPastZero ? 1 : -1);
43883 if (nextNodeIndex === -1) nextNodeIndex = indexOfSecondLast === 1 ? way.nodes.length - 2 : 1;
43884 const nextNode = historyGraph.entity(way.nodes[nextNodeIndex]);
43885 drawWay.addNode(nextNode, {
43886 geometry: { type: "Point", coordinates: nextNode.loc },
43888 properties: { target: true, entity: nextNode }
43891 context.ui().flash.duration(4e3).iconName("#iD-icon-no").label(_t.append("operations.follow.error.unknown"))();
43894 keybinding.on(_t("operations.follow.key"), followMode);
43895 select_default2(document).call(keybinding);
43896 drawWay.finish = function() {
43899 /* includeDrawNode */
43901 if (context.surface().classed("nope")) {
43902 dispatch14.call("rejectedSelfIntersection", this);
43905 context.pauseChangeDispatch();
43907 _didResolveTempEdit = true;
43908 context.resumeChangeDispatch();
43909 var way = context.hasEntity(wayID);
43910 if (!way || way.isDegenerate()) {
43914 window.setTimeout(function() {
43915 context.map().dblclickZoomEnable(true);
43917 var isNewFeature = !mode.isContinuing;
43918 context.enter(modeSelect(context, [wayID]).newFeature(isNewFeature));
43920 drawWay.cancel = function() {
43921 context.pauseChangeDispatch();
43922 resetToStartGraph();
43923 context.resumeChangeDispatch();
43924 window.setTimeout(function() {
43925 context.map().dblclickZoomEnable(true);
43927 context.surface().classed("nope", false).classed("nope-disabled", false).classed("nope-suppressed", false);
43928 context.enter(modeBrowse(context));
43930 drawWay.nodeIndex = function(val) {
43931 if (!arguments.length) return _nodeIndex;
43935 drawWay.activeID = function() {
43936 if (!arguments.length) return _drawNode && _drawNode.id;
43939 return utilRebind(drawWay, dispatch14, "on");
43942 // modules/modes/draw_line.js
43943 function modeDrawLine(context, wayID, startGraph, button, affix, continuing) {
43948 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawLine", function() {
43949 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.lines"))();
43951 mode.wayID = wayID;
43952 mode.isContinuing = continuing;
43953 mode.enter = function() {
43954 behavior.nodeIndex(affix === "prefix" ? 0 : void 0);
43955 context.install(behavior);
43957 mode.exit = function() {
43958 context.uninstall(behavior);
43960 mode.selectedIDs = function() {
43963 mode.activeID = function() {
43964 return behavior && behavior.activeID() || [];
43969 // modules/validations/disconnected_way.js
43970 function validationDisconnectedWay() {
43971 var type2 = "disconnected_way";
43972 function isTaggedAsHighway(entity) {
43973 return osmRoutableHighwayTagValues[entity.tags.highway];
43975 var validation = function checkDisconnectedWay(entity, graph) {
43976 var routingIslandWays = routingIslandForEntity(entity);
43977 if (!routingIslandWays) return [];
43978 return [new validationIssue({
43980 subtype: "highway",
43981 severity: "warning",
43982 message: function(context) {
43983 var entity2 = this.entityIds.length && context.hasEntity(this.entityIds[0]);
43984 var label = entity2 && utilDisplayLabel(entity2, context.graph());
43985 return _t.append("issues.disconnected_way.routable.message", { count: this.entityIds.length, highway: label });
43987 reference: showReference,
43988 entityIds: Array.from(routingIslandWays).map(function(way) {
43991 dynamicFixes: makeFixes
43993 function makeFixes(context) {
43995 var singleEntity = this.entityIds.length === 1 && context.hasEntity(this.entityIds[0]);
43996 if (singleEntity) {
43997 if (singleEntity.type === "way" && !singleEntity.isClosed()) {
43998 var textDirection = _mainLocalizer.textDirection();
43999 var startFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.first(), "start");
44000 if (startFix) fixes.push(startFix);
44001 var endFix = makeContinueDrawingFixIfAllowed(textDirection, singleEntity.last(), "end");
44002 if (endFix) fixes.push(endFix);
44004 if (!fixes.length) {
44005 fixes.push(new validationIssueFix({
44006 title: _t.append("issues.fix.connect_feature.title")
44009 fixes.push(new validationIssueFix({
44010 icon: "iD-operation-delete",
44011 title: _t.append("issues.fix.delete_feature.title"),
44012 entityIds: [singleEntity.id],
44013 onClick: function(context2) {
44014 var id2 = this.issue.entityIds[0];
44015 var operation2 = operationDelete(context2, [id2]);
44016 if (!operation2.disabled()) {
44022 fixes.push(new validationIssueFix({
44023 title: _t.append("issues.fix.connect_features.title")
44028 function showReference(selection2) {
44029 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.disconnected_way.routable.reference"));
44031 function routingIslandForEntity(entity2) {
44032 var routingIsland = /* @__PURE__ */ new Set();
44033 var waysToCheck = [];
44034 function queueParentWays(node) {
44035 graph.parentWays(node).forEach(function(parentWay) {
44036 if (!routingIsland.has(parentWay) && // only check each feature once
44037 isRoutableWay(parentWay, false)) {
44038 routingIsland.add(parentWay);
44039 waysToCheck.push(parentWay);
44043 if (entity2.type === "way" && isRoutableWay(entity2, true)) {
44044 routingIsland.add(entity2);
44045 waysToCheck.push(entity2);
44046 } else if (entity2.type === "node" && isRoutableNode(entity2)) {
44047 routingIsland.add(entity2);
44048 queueParentWays(entity2);
44052 while (waysToCheck.length) {
44053 var wayToCheck = waysToCheck.pop();
44054 var childNodes = graph.childNodes(wayToCheck);
44055 for (var i3 in childNodes) {
44056 var vertex = childNodes[i3];
44057 if (isConnectedVertex(vertex)) {
44060 if (isRoutableNode(vertex)) {
44061 routingIsland.add(vertex);
44063 queueParentWays(vertex);
44066 return routingIsland;
44068 function isConnectedVertex(vertex) {
44069 var osm = services.osm;
44070 if (osm && !osm.isDataLoaded(vertex.loc)) return true;
44071 if (vertex.tags.entrance && vertex.tags.entrance !== "no") return true;
44072 if (vertex.tags.amenity === "parking_entrance") return true;
44075 function isRoutableNode(node) {
44076 if (node.tags.highway === "elevator") return true;
44079 function isRoutableWay(way, ignoreInnerWays) {
44080 if (isTaggedAsHighway(way) || way.tags.route === "ferry") return true;
44081 return graph.parentRelations(way).some(function(parentRelation) {
44082 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44083 if (parentRelation.isMultipolygon() && isTaggedAsHighway(parentRelation) && (!ignoreInnerWays || parentRelation.memberById(way.id).role !== "inner")) return true;
44087 function makeContinueDrawingFixIfAllowed(textDirection, vertexID, whichEnd) {
44088 var vertex = graph.hasEntity(vertexID);
44089 if (!vertex || vertex.tags.noexit === "yes") return null;
44090 var useLeftContinue = whichEnd === "start" && textDirection === "ltr" || whichEnd === "end" && textDirection === "rtl";
44091 return new validationIssueFix({
44092 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44093 title: _t.append("issues.fix.continue_from_" + whichEnd + ".title"),
44094 entityIds: [vertexID],
44095 onClick: function(context) {
44096 var wayId = this.issue.entityIds[0];
44097 var way = context.hasEntity(wayId);
44098 var vertexId = this.entityIds[0];
44099 var vertex2 = context.hasEntity(vertexId);
44100 if (!way || !vertex2) return;
44101 var map2 = context.map();
44102 if (!context.editable() || !map2.trimmedExtent().contains(vertex2.loc)) {
44103 map2.zoomToEase(vertex2);
44106 modeDrawLine(context, wayId, context.graph(), "line", way.affix(vertexId), true)
44112 validation.type = type2;
44116 // modules/validations/invalid_format.js
44117 function validationFormatting() {
44118 var type2 = "invalid_format";
44119 var validation = function(entity) {
44121 function isValidEmail(email) {
44122 var valid_email = /^[^\(\)\\,":;<>@\[\]]+@[^\(\)\\,":;<>@\[\]\.]+(?:\.[a-z0-9-]+)*$/i;
44123 return !email || valid_email.test(email);
44125 function showReferenceEmail(selection2) {
44126 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.invalid_format.email.reference"));
44128 if (entity.tags.email) {
44129 var emails = entity.tags.email.split(";").map(function(s2) {
44131 }).filter(function(x2) {
44132 return !isValidEmail(x2);
44134 if (emails.length) {
44135 issues.push(new validationIssue({
44138 severity: "warning",
44139 message: function(context) {
44140 var entity2 = context.hasEntity(this.entityIds[0]);
44141 return entity2 ? _t.append(
44142 "issues.invalid_format.email.message" + this.data,
44143 { feature: utilDisplayLabel(entity2, context.graph()), email: emails.join(", ") }
44146 reference: showReferenceEmail,
44147 entityIds: [entity.id],
44148 hash: emails.join(),
44149 data: emails.length > 1 ? "_multi" : ""
44155 validation.type = type2;
44159 // modules/validations/help_request.js
44160 function validationHelpRequest(context) {
44161 var type2 = "help_request";
44162 var validation = function checkFixmeTag(entity) {
44163 if (!entity.tags.fixme) return [];
44164 if (entity.version === void 0) return [];
44165 if (entity.v !== void 0) {
44166 var baseEntity = context.history().base().hasEntity(entity.id);
44167 if (!baseEntity || !baseEntity.tags.fixme) return [];
44169 return [new validationIssue({
44171 subtype: "fixme_tag",
44172 severity: "warning",
44173 message: function(context2) {
44174 var entity2 = context2.hasEntity(this.entityIds[0]);
44175 return entity2 ? _t.append("issues.fixme_tag.message", {
44176 feature: utilDisplayLabel(
44184 dynamicFixes: function() {
44186 new validationIssueFix({
44187 title: _t.append("issues.fix.address_the_concern.title")
44191 reference: showReference,
44192 entityIds: [entity.id]
44194 function showReference(selection2) {
44195 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.fixme_tag.reference"));
44198 validation.type = type2;
44202 // modules/validations/impossible_oneway.js
44203 function validationImpossibleOneway() {
44204 var type2 = "impossible_oneway";
44205 var validation = function checkImpossibleOneway(entity, graph) {
44206 if (entity.type !== "way" || entity.geometry(graph) !== "line") return [];
44207 if (entity.isClosed()) return [];
44208 if (!typeForWay(entity)) return [];
44209 if (!isOneway(entity)) return [];
44210 var firstIssues = issuesForNode(entity, entity.first());
44211 var lastIssues = issuesForNode(entity, entity.last());
44212 return firstIssues.concat(lastIssues);
44213 function typeForWay(way) {
44214 if (way.geometry(graph) !== "line") return null;
44215 if (osmRoutableHighwayTagValues[way.tags.highway]) return "highway";
44216 if (osmFlowingWaterwayTagValues[way.tags.waterway]) return "waterway";
44219 function isOneway(way) {
44220 if (way.tags.oneway === "yes") return true;
44221 if (way.tags.oneway) return false;
44222 for (var key in way.tags) {
44223 if (osmOneWayTags[key] && osmOneWayTags[key][way.tags[key]]) {
44229 function nodeOccursMoreThanOnce(way, nodeID) {
44230 var occurrences = 0;
44231 for (var index in way.nodes) {
44232 if (way.nodes[index] === nodeID) {
44234 if (occurrences > 1) return true;
44239 function isConnectedViaOtherTypes(way, node) {
44240 var wayType = typeForWay(way);
44241 if (wayType === "highway") {
44242 if (node.tags.entrance && node.tags.entrance !== "no") return true;
44243 if (node.tags.amenity === "parking_entrance") return true;
44244 } else if (wayType === "waterway") {
44245 if (node.id === way.first()) {
44246 if (node.tags.natural === "spring") return true;
44248 if (node.tags.manhole === "drain") return true;
44251 return graph.parentWays(node).some(function(parentWay) {
44252 if (parentWay.id === way.id) return false;
44253 if (wayType === "highway") {
44254 if (parentWay.geometry(graph) === "area" && osmRoutableHighwayTagValues[parentWay.tags.highway]) return true;
44255 if (parentWay.tags.route === "ferry") return true;
44256 return graph.parentRelations(parentWay).some(function(parentRelation) {
44257 if (parentRelation.tags.type === "route" && parentRelation.tags.route === "ferry") return true;
44258 return parentRelation.isMultipolygon() && osmRoutableHighwayTagValues[parentRelation.tags.highway];
44260 } else if (wayType === "waterway") {
44261 if (parentWay.tags.natural === "water" || parentWay.tags.natural === "coastline") return true;
44266 function issuesForNode(way, nodeID) {
44267 var isFirst = nodeID === way.first();
44268 var wayType = typeForWay(way);
44269 if (nodeOccursMoreThanOnce(way, nodeID)) return [];
44270 var osm = services.osm;
44271 if (!osm) return [];
44272 var node = graph.hasEntity(nodeID);
44273 if (!node || !osm.isDataLoaded(node.loc)) return [];
44274 if (isConnectedViaOtherTypes(way, node)) return [];
44275 var attachedWaysOfSameType = graph.parentWays(node).filter(function(parentWay) {
44276 if (parentWay.id === way.id) return false;
44277 return typeForWay(parentWay) === wayType;
44279 if (wayType === "waterway" && attachedWaysOfSameType.length === 0) return [];
44280 var attachedOneways = attachedWaysOfSameType.filter(function(attachedWay) {
44281 return isOneway(attachedWay);
44283 if (attachedOneways.length < attachedWaysOfSameType.length) return [];
44284 if (attachedOneways.length) {
44285 var connectedEndpointsOkay = attachedOneways.some(function(attachedOneway) {
44286 if ((isFirst ? attachedOneway.first() : attachedOneway.last()) !== nodeID) return true;
44287 if (nodeOccursMoreThanOnce(attachedOneway, nodeID)) return true;
44290 if (connectedEndpointsOkay) return [];
44292 var placement = isFirst ? "start" : "end", messageID = wayType + ".", referenceID = wayType + ".";
44293 if (wayType === "waterway") {
44294 messageID += "connected." + placement;
44295 referenceID += "connected";
44297 messageID += placement;
44298 referenceID += placement;
44300 return [new validationIssue({
44303 severity: "warning",
44304 message: function(context) {
44305 var entity2 = context.hasEntity(this.entityIds[0]);
44306 return entity2 ? _t.append("issues.impossible_oneway." + messageID + ".message", {
44307 feature: utilDisplayLabel(entity2, context.graph())
44310 reference: getReference(referenceID),
44311 entityIds: [way.id, node.id],
44312 dynamicFixes: function() {
44314 if (attachedOneways.length) {
44315 fixes.push(new validationIssueFix({
44316 icon: "iD-operation-reverse",
44317 title: _t.append("issues.fix.reverse_feature.title"),
44318 entityIds: [way.id],
44319 onClick: function(context) {
44320 var id2 = this.issue.entityIds[0];
44321 context.perform(actionReverse(id2), _t("operations.reverse.annotation.line", { n: 1 }));
44325 if (node.tags.noexit !== "yes") {
44326 var textDirection = _mainLocalizer.textDirection();
44327 var useLeftContinue = isFirst && textDirection === "ltr" || !isFirst && textDirection === "rtl";
44328 fixes.push(new validationIssueFix({
44329 icon: "iD-operation-continue" + (useLeftContinue ? "-left" : ""),
44330 title: _t.append("issues.fix.continue_from_" + (isFirst ? "start" : "end") + ".title"),
44331 onClick: function(context) {
44332 var entityID = this.issue.entityIds[0];
44333 var vertexID = this.issue.entityIds[1];
44334 var way2 = context.entity(entityID);
44335 var vertex = context.entity(vertexID);
44336 continueDrawing(way2, vertex, context);
44344 function getReference(referenceID2) {
44345 return function showReference(selection2) {
44346 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.impossible_oneway." + referenceID2 + ".reference"));
44351 function continueDrawing(way, vertex, context) {
44352 var map2 = context.map();
44353 if (!context.editable() || !map2.trimmedExtent().contains(vertex.loc)) {
44354 map2.zoomToEase(vertex);
44357 modeDrawLine(context, way.id, context.graph(), "line", way.affix(vertex.id), true)
44360 validation.type = type2;
44364 // modules/validations/incompatible_source.js
44365 function validationIncompatibleSource() {
44366 const type2 = "incompatible_source";
44367 const incompatibleRules = [
44370 regex: /(^amap$|^amap\.com|autonavi|mapabc|高德)/i
44374 regex: /(baidu|mapbar|百度)/i
44379 exceptRegex: /((books|drive)\.google|google\s?(books|drive|plus))|(esri\/Google_Africa_Buildings)/i
44382 const validation = function checkIncompatibleSource(entity) {
44383 const entitySources = entity.tags && entity.tags.source && entity.tags.source.split(";");
44384 if (!entitySources) return [];
44385 const entityID = entity.id;
44386 return entitySources.map((source) => {
44387 const matchRule = incompatibleRules.find((rule) => {
44388 if (!rule.regex.test(source)) return false;
44389 if (rule.exceptRegex && rule.exceptRegex.test(source)) return false;
44392 if (!matchRule) return null;
44393 return new validationIssue({
44395 severity: "warning",
44396 message: (context) => {
44397 const entity2 = context.hasEntity(entityID);
44398 return entity2 ? _t.append("issues.incompatible_source.feature.message", {
44399 feature: utilDisplayLabel(
44408 reference: getReference(matchRule.id),
44409 entityIds: [entityID],
44411 dynamicFixes: () => {
44413 new validationIssueFix({ title: _t.append("issues.fix.remove_proprietary_data.title") })
44417 }).filter(Boolean);
44418 function getReference(id2) {
44419 return function showReference(selection2) {
44420 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.incompatible_source.reference.".concat(id2)));
44424 validation.type = type2;
44428 // modules/validations/maprules.js
44429 function validationMaprules() {
44430 var type2 = "maprules";
44431 var validation = function checkMaprules(entity, graph) {
44432 if (!services.maprules) return [];
44433 var rules = services.maprules.validationRules();
44435 for (var i3 = 0; i3 < rules.length; i3++) {
44436 var rule = rules[i3];
44437 rule.findIssues(entity, graph, issues);
44441 validation.type = type2;
44445 // modules/validations/mismatched_geometry.js
44446 var import_fast_deep_equal4 = __toESM(require_fast_deep_equal());
44447 function validationMismatchedGeometry() {
44448 var type2 = "mismatched_geometry";
44449 function tagSuggestingLineIsArea(entity) {
44450 if (entity.type !== "way" || entity.isClosed()) return null;
44451 var tagSuggestingArea = entity.tagSuggestingArea();
44452 if (!tagSuggestingArea) {
44455 var asLine = _mainPresetIndex.matchTags(tagSuggestingArea, "line");
44456 var asArea = _mainPresetIndex.matchTags(tagSuggestingArea, "area");
44457 if (asLine && asArea && (0, import_fast_deep_equal4.default)(asLine.tags, asArea.tags)) {
44460 return tagSuggestingArea;
44462 function makeConnectEndpointsFixOnClick(way, graph) {
44463 if (way.nodes.length < 3) return null;
44464 var nodes = graph.childNodes(way), testNodes;
44465 var firstToLastDistanceMeters = geoSphericalDistance(nodes[0].loc, nodes[nodes.length - 1].loc);
44466 if (firstToLastDistanceMeters < 0.75) {
44467 testNodes = nodes.slice();
44469 testNodes.push(testNodes[0]);
44470 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
44471 return function(context) {
44472 var way2 = context.entity(this.issue.entityIds[0]);
44474 actionMergeNodes([way2.nodes[0], way2.nodes[way2.nodes.length - 1]], nodes[0].loc),
44475 _t("issues.fix.connect_endpoints.annotation")
44480 testNodes = nodes.slice();
44481 testNodes.push(testNodes[0]);
44482 if (!geoHasSelfIntersections(testNodes, testNodes[0].id)) {
44483 return function(context) {
44484 var wayId = this.issue.entityIds[0];
44485 var way2 = context.entity(wayId);
44486 var nodeId = way2.nodes[0];
44487 var index = way2.nodes.length;
44489 actionAddVertex(wayId, nodeId, index),
44490 _t("issues.fix.connect_endpoints.annotation")
44495 function lineTaggedAsAreaIssue(entity) {
44496 var tagSuggestingArea = tagSuggestingLineIsArea(entity);
44497 if (!tagSuggestingArea) return null;
44498 var validAsLine = false;
44499 var presetAsLine = _mainPresetIndex.matchTags(entity.tags, "line");
44500 if (presetAsLine) {
44501 validAsLine = true;
44502 var key = Object.keys(tagSuggestingArea)[0];
44503 if (presetAsLine.tags[key] && presetAsLine.tags[key] === "*") {
44504 validAsLine = false;
44506 if (Object.keys(presetAsLine.tags).length === 0) {
44507 validAsLine = false;
44510 return new validationIssue({
44512 subtype: "area_as_line",
44513 severity: "warning",
44514 message: function(context) {
44515 var entity2 = context.hasEntity(this.entityIds[0]);
44516 return entity2 ? _t.append("issues.tag_suggests_area.message", {
44517 feature: utilDisplayLabel(
44523 tag: utilTagText({ tags: tagSuggestingArea })
44526 reference: showReference,
44527 entityIds: [entity.id],
44528 hash: JSON.stringify(tagSuggestingArea),
44529 dynamicFixes: function(context) {
44531 var entity2 = context.entity(this.entityIds[0]);
44532 var connectEndsOnClick = makeConnectEndpointsFixOnClick(entity2, context.graph());
44533 if (!validAsLine) {
44534 fixes.push(new validationIssueFix({
44535 title: _t.append("issues.fix.connect_endpoints.title"),
44536 onClick: connectEndsOnClick
44539 fixes.push(new validationIssueFix({
44540 icon: "iD-operation-delete",
44541 title: _t.append("issues.fix.remove_tag.title"),
44542 onClick: function(context2) {
44543 var entityId = this.issue.entityIds[0];
44544 var entity3 = context2.entity(entityId);
44545 var tags = Object.assign({}, entity3.tags);
44546 for (var key2 in tagSuggestingArea) {
44550 actionChangeTags(entityId, tags),
44551 _t("issues.fix.remove_tag.annotation")
44558 function showReference(selection2) {
44559 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.tag_suggests_area.reference"));
44562 function vertexPointIssue(entity, graph) {
44563 if (entity.type !== "node") return null;
44564 if (Object.keys(entity.tags).length === 0) return null;
44565 if (entity.isOnAddressLine(graph)) return null;
44566 var geometry = entity.geometry(graph);
44567 var allowedGeometries = osmNodeGeometriesForTags(entity.tags);
44568 if (geometry === "point" && !allowedGeometries.point && allowedGeometries.vertex) {
44569 return new validationIssue({
44571 subtype: "vertex_as_point",
44572 severity: "warning",
44573 message: function(context) {
44574 var entity2 = context.hasEntity(this.entityIds[0]);
44575 return entity2 ? _t.append("issues.vertex_as_point.message", {
44576 feature: utilDisplayLabel(
44584 reference: function showReference(selection2) {
44585 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.vertex_as_point.reference"));
44587 entityIds: [entity.id]
44589 } else if (geometry === "vertex" && !allowedGeometries.vertex && allowedGeometries.point) {
44590 return new validationIssue({
44592 subtype: "point_as_vertex",
44593 severity: "warning",
44594 message: function(context) {
44595 var entity2 = context.hasEntity(this.entityIds[0]);
44596 return entity2 ? _t.append("issues.point_as_vertex.message", {
44597 feature: utilDisplayLabel(
44605 reference: function showReference(selection2) {
44606 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.point_as_vertex.reference"));
44608 entityIds: [entity.id],
44609 dynamicFixes: extractPointDynamicFixes
44614 function otherMismatchIssue(entity, graph) {
44615 if (!entity.hasInterestingTags()) return null;
44616 if (entity.type !== "node" && entity.type !== "way") return null;
44617 if (entity.type === "node" && entity.isOnAddressLine(graph)) return null;
44618 var sourceGeom = entity.geometry(graph);
44619 var targetGeoms = entity.type === "way" ? ["point", "vertex"] : ["line", "area"];
44620 if (sourceGeom === "area") targetGeoms.unshift("line");
44621 var asSource = _mainPresetIndex.match(entity, graph);
44622 var targetGeom = targetGeoms.find((nodeGeom) => {
44623 var asTarget = _mainPresetIndex.matchTags(entity.tags, nodeGeom);
44624 if (!asSource || !asTarget || asSource === asTarget || // sometimes there are two presets with the same tags for different geometries
44625 (0, import_fast_deep_equal4.default)(asSource.tags, asTarget.tags)) return false;
44626 if (asTarget.isFallback()) return false;
44627 var primaryKey = Object.keys(asTarget.tags)[0];
44628 if (primaryKey === "building") return false;
44629 if (asTarget.tags[primaryKey] === "*") return false;
44630 return asSource.isFallback() || asSource.tags[primaryKey] === "*";
44632 if (!targetGeom) return null;
44633 var subtype = targetGeom + "_as_" + sourceGeom;
44634 if (targetGeom === "vertex") targetGeom = "point";
44635 if (sourceGeom === "vertex") sourceGeom = "point";
44636 var referenceId = targetGeom + "_as_" + sourceGeom;
44638 if (targetGeom === "point") {
44639 dynamicFixes = extractPointDynamicFixes;
44640 } else if (sourceGeom === "area" && targetGeom === "line") {
44641 dynamicFixes = lineToAreaDynamicFixes;
44643 return new validationIssue({
44646 severity: "warning",
44647 message: function(context) {
44648 var entity2 = context.hasEntity(this.entityIds[0]);
44649 return entity2 ? _t.append("issues." + referenceId + ".message", {
44650 feature: utilDisplayLabel(
44658 reference: function showReference(selection2) {
44659 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.mismatched_geometry.reference"));
44661 entityIds: [entity.id],
44665 function lineToAreaDynamicFixes(context) {
44666 var convertOnClick;
44667 var entityId = this.entityIds[0];
44668 var entity = context.entity(entityId);
44669 var tags = Object.assign({}, entity.tags);
44671 if (!osmTagSuggestingArea(tags)) {
44672 convertOnClick = function(context2) {
44673 var entityId2 = this.issue.entityIds[0];
44674 var entity2 = context2.entity(entityId2);
44675 var tags2 = Object.assign({}, entity2.tags);
44680 actionChangeTags(entityId2, tags2),
44681 _t("issues.fix.convert_to_line.annotation")
44686 new validationIssueFix({
44687 icon: "iD-icon-line",
44688 title: _t.append("issues.fix.convert_to_line.title"),
44689 onClick: convertOnClick
44693 function extractPointDynamicFixes(context) {
44694 var entityId = this.entityIds[0];
44695 var extractOnClick = null;
44696 if (!context.hasHiddenConnections(entityId)) {
44697 extractOnClick = function(context2) {
44698 var entityId2 = this.issue.entityIds[0];
44699 var action = actionExtract(entityId2, context2.projection);
44702 _t("operations.extract.annotation", { n: 1 })
44704 context2.enter(modeSelect(context2, [action.getExtractedNodeID()]));
44708 new validationIssueFix({
44709 icon: "iD-operation-extract",
44710 title: _t.append("issues.fix.extract_point.title"),
44711 onClick: extractOnClick
44715 function unclosedMultipolygonPartIssues(entity, graph) {
44716 if (entity.type !== "relation" || !entity.isMultipolygon() || entity.isDegenerate() || // cannot determine issues for incompletely-downloaded relations
44717 !entity.isComplete(graph)) return [];
44718 var sequences = osmJoinWays(entity.members, graph);
44720 for (var i3 in sequences) {
44721 var sequence = sequences[i3];
44722 if (!sequence.nodes) continue;
44723 var firstNode = sequence.nodes[0];
44724 var lastNode = sequence.nodes[sequence.nodes.length - 1];
44725 if (firstNode === lastNode) continue;
44726 var issue = new validationIssue({
44728 subtype: "unclosed_multipolygon_part",
44729 severity: "warning",
44730 message: function(context) {
44731 var entity2 = context.hasEntity(this.entityIds[0]);
44732 return entity2 ? _t.append("issues.unclosed_multipolygon_part.message", {
44733 feature: utilDisplayLabel(
44741 reference: showReference,
44742 loc: sequence.nodes[0].loc,
44743 entityIds: [entity.id],
44744 hash: sequence.map(function(way) {
44748 issues.push(issue);
44751 function showReference(selection2) {
44752 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unclosed_multipolygon_part.reference"));
44755 var validation = function checkMismatchedGeometry(entity, graph) {
44756 var vertexPoint = vertexPointIssue(entity, graph);
44757 if (vertexPoint) return [vertexPoint];
44758 var lineAsArea = lineTaggedAsAreaIssue(entity);
44759 if (lineAsArea) return [lineAsArea];
44760 var mismatch = otherMismatchIssue(entity, graph);
44761 if (mismatch) return [mismatch];
44762 return unclosedMultipolygonPartIssues(entity, graph);
44764 validation.type = type2;
44768 // modules/validations/missing_role.js
44769 function validationMissingRole() {
44770 var type2 = "missing_role";
44771 var validation = function checkMissingRole(entity, graph) {
44773 if (entity.type === "way") {
44774 graph.parentRelations(entity).forEach(function(relation) {
44775 if (!relation.isMultipolygon()) return;
44776 var member = relation.memberById(entity.id);
44777 if (member && isMissingRole(member)) {
44778 issues.push(makeIssue(entity, relation, member));
44781 } else if (entity.type === "relation" && entity.isMultipolygon()) {
44782 entity.indexedMembers().forEach(function(member) {
44783 var way = graph.hasEntity(member.id);
44784 if (way && isMissingRole(member)) {
44785 issues.push(makeIssue(way, entity, member));
44791 function isMissingRole(member) {
44792 return !member.role || !member.role.trim().length;
44794 function makeIssue(way, relation, member) {
44795 return new validationIssue({
44797 severity: "warning",
44798 message: function(context) {
44799 var member2 = context.hasEntity(this.entityIds[1]), relation2 = context.hasEntity(this.entityIds[0]);
44800 return member2 && relation2 ? _t.append("issues.missing_role.message", {
44801 member: utilDisplayLabel(member2, context.graph()),
44802 relation: utilDisplayLabel(relation2, context.graph())
44805 reference: showReference,
44806 entityIds: [relation.id, way.id],
44810 hash: member.index.toString(),
44811 dynamicFixes: function() {
44813 makeAddRoleFix("inner"),
44814 makeAddRoleFix("outer"),
44815 new validationIssueFix({
44816 icon: "iD-operation-delete",
44817 title: _t.append("issues.fix.remove_from_relation.title"),
44818 onClick: function(context) {
44820 actionDeleteMember(this.issue.entityIds[0], this.issue.data.member.index),
44821 _t("operations.delete_member.annotation", {
44830 function showReference(selection2) {
44831 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.missing_role.multipolygon.reference"));
44834 function makeAddRoleFix(role) {
44835 return new validationIssueFix({
44836 title: _t.append("issues.fix.set_as_" + role + ".title"),
44837 onClick: function(context) {
44838 var oldMember = this.issue.data.member;
44839 var member = { id: this.issue.entityIds[1], type: oldMember.type, role };
44841 actionChangeMember(this.issue.entityIds[0], member, oldMember.index),
44842 _t("operations.change_role.annotation", {
44849 validation.type = type2;
44853 // modules/validations/missing_tag.js
44854 function validationMissingTag(context) {
44855 var type2 = "missing_tag";
44856 function hasDescriptiveTags(entity) {
44857 var onlyAttributeKeys = ["description", "name", "note", "start_date"];
44858 var entityDescriptiveKeys = Object.keys(entity.tags).filter(function(k2) {
44859 if (k2 === "area" || !osmIsInterestingTag(k2)) return false;
44860 return !onlyAttributeKeys.some(function(attributeKey) {
44861 return k2 === attributeKey || k2.indexOf(attributeKey + ":") === 0;
44864 if (entity.type === "relation" && entityDescriptiveKeys.length === 1 && entity.tags.type === "multipolygon") {
44867 return entityDescriptiveKeys.length > 0;
44869 function isUnknownRoad(entity) {
44870 return entity.type === "way" && entity.tags.highway === "road";
44872 function isUntypedRelation(entity) {
44873 return entity.type === "relation" && !entity.tags.type;
44875 var validation = function checkMissingTag(entity, graph) {
44877 var osm = context.connection();
44878 var isUnloadedNode = entity.type === "node" && osm && !osm.isDataLoaded(entity.loc);
44879 if (!isUnloadedNode && // allow untagged nodes that are part of ways
44880 entity.geometry(graph) !== "vertex" && // allow untagged entities that are part of relations
44881 !entity.hasParentRelations(graph)) {
44882 if (Object.keys(entity.tags).length === 0) {
44884 } else if (!hasDescriptiveTags(entity)) {
44885 subtype = "descriptive";
44886 } else if (isUntypedRelation(entity)) {
44887 subtype = "relation_type";
44890 if (!subtype && isUnknownRoad(entity)) {
44891 subtype = "highway_classification";
44893 if (!subtype) return [];
44894 var messageID = subtype === "highway_classification" ? "unknown_road" : "missing_tag." + subtype;
44895 var referenceID = subtype === "highway_classification" ? "unknown_road" : "missing_tag";
44896 var canDelete = entity.version === void 0 || entity.v !== void 0;
44897 var severity = canDelete && subtype !== "highway_classification" ? "error" : "warning";
44898 return [new validationIssue({
44902 message: function(context2) {
44903 var entity2 = context2.hasEntity(this.entityIds[0]);
44904 return entity2 ? _t.append("issues." + messageID + ".message", {
44905 feature: utilDisplayLabel(entity2, context2.graph())
44908 reference: showReference,
44909 entityIds: [entity.id],
44910 dynamicFixes: function(context2) {
44912 var selectFixType = subtype === "highway_classification" ? "select_road_type" : "select_preset";
44913 fixes.push(new validationIssueFix({
44914 icon: "iD-icon-search",
44915 title: _t.append("issues.fix." + selectFixType + ".title"),
44916 onClick: function(context3) {
44917 context3.ui().sidebar.showPresetList();
44921 var id2 = this.entityIds[0];
44922 var operation2 = operationDelete(context2, [id2]);
44923 var disabledReasonID = operation2.disabled();
44924 if (!disabledReasonID) {
44925 deleteOnClick = function(context3) {
44926 var id3 = this.issue.entityIds[0];
44927 var operation3 = operationDelete(context3, [id3]);
44928 if (!operation3.disabled()) {
44934 new validationIssueFix({
44935 icon: "iD-operation-delete",
44936 title: _t.append("issues.fix.delete_feature.title"),
44937 disabledReason: disabledReasonID ? _t("operations.delete." + disabledReasonID + ".single") : void 0,
44938 onClick: deleteOnClick
44944 function showReference(selection2) {
44945 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues." + referenceID + ".reference"));
44948 validation.type = type2;
44952 // modules/validations/mutually_exclusive_tags.js
44953 function validationMutuallyExclusiveTags() {
44954 const type2 = "mutually_exclusive_tags";
44955 const tagKeyPairs = osmMutuallyExclusiveTagPairs;
44956 const validation = function checkMutuallyExclusiveTags(entity) {
44957 let pairsFounds = tagKeyPairs.filter((pair3) => {
44958 return pair3[0] in entity.tags && pair3[1] in entity.tags;
44959 }).filter((pair3) => {
44960 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");
44962 Object.keys(entity.tags).forEach((key) => {
44963 let negative_key = "not:" + key;
44964 if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
44965 pairsFounds.push([negative_key, key, "same_value"]);
44967 if (key.match(/^name:[a-z]+/)) {
44968 negative_key = "not:name";
44969 if (negative_key in entity.tags && entity.tags[negative_key].split(";").includes(entity.tags[key])) {
44970 pairsFounds.push([negative_key, key, "same_value"]);
44974 let issues = pairsFounds.map((pair3) => {
44975 const subtype = pair3[2] || "default";
44976 return new validationIssue({
44979 severity: "warning",
44980 message: function(context) {
44981 let entity2 = context.hasEntity(this.entityIds[0]);
44982 return entity2 ? _t.append("issues.".concat(type2, ".").concat(subtype, ".message"), {
44983 feature: utilDisplayLabel(entity2, context.graph()),
44988 reference: (selection2) => showReference(selection2, pair3, subtype),
44989 entityIds: [entity.id],
44990 dynamicFixes: () => pair3.slice(0, 2).map((tagToRemove) => createIssueFix(tagToRemove))
44993 function createIssueFix(tagToRemove) {
44994 return new validationIssueFix({
44995 icon: "iD-operation-delete",
44996 title: _t.append("issues.fix.remove_named_tag.title", { tag: tagToRemove }),
44997 onClick: function(context) {
44998 const entityId = this.issue.entityIds[0];
44999 const entity2 = context.entity(entityId);
45000 let tags = Object.assign({}, entity2.tags);
45001 delete tags[tagToRemove];
45003 actionChangeTags(entityId, tags),
45004 _t("issues.fix.remove_named_tag.annotation", { tag: tagToRemove })
45009 function showReference(selection2, pair3, subtype) {
45010 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] }));
45014 validation.type = type2;
45018 // modules/validations/outdated_tags.js
45019 function validationOutdatedTags() {
45020 const type2 = "outdated_tags";
45021 let _waitingForDeprecated = true;
45022 let _dataDeprecated;
45023 _mainFileFetcher.get("deprecated").then((d2) => _dataDeprecated = d2).catch(() => {
45024 }).finally(() => _waitingForDeprecated = false);
45025 function oldTagIssues(entity, graph) {
45026 if (!entity.hasInterestingTags()) return [];
45027 let preset = _mainPresetIndex.match(entity, graph);
45028 if (!preset) return [];
45029 const oldTags = Object.assign({}, entity.tags);
45030 let subtype = "deprecated_tags";
45031 if (preset.replacement) {
45032 const newPreset = _mainPresetIndex.item(preset.replacement);
45033 graph = actionChangePreset(
45038 /* skip field defaults */
45040 entity = graph.entity(entity.id);
45041 preset = newPreset;
45043 const upgradeReasons = [];
45044 if (_dataDeprecated) {
45045 const deprecatedTags = entity.deprecatedTags(_dataDeprecated);
45046 if (entity.type === "way" && entity.isClosed() && entity.tags.traffic_calming === "island" && !entity.tags.highway) {
45047 deprecatedTags.push({
45048 old: { traffic_calming: "island" },
45049 replace: { "area:highway": "traffic_island" }
45052 if (deprecatedTags.length) {
45053 deprecatedTags.forEach((tag2) => {
45054 graph = actionUpgradeTags(entity.id, tag2.old, tag2.replace)(graph);
45055 upgradeReasons.push({
45056 source: "id-tagging-schema--deprecated",
45060 entity = graph.entity(entity.id);
45063 let newTags = Object.assign({}, entity.tags);
45064 if (preset.tags !== preset.addTags) {
45065 Object.keys(preset.addTags).forEach((k2) => {
45066 if (!newTags[k2]) {
45067 if (preset.addTags[k2] === "*") {
45068 newTags[k2] = "yes";
45069 } else if (preset.addTags[k2]) {
45070 newTags[k2] = preset.addTags[k2];
45072 upgradeReasons.push({
45073 source: "id-tagging-schema--preset-addTags",
45079 const nsi = services.nsi;
45080 let waitingForNsi = false;
45083 waitingForNsi = nsi.status() === "loading";
45084 if (!waitingForNsi) {
45085 const loc = entity.extent(graph).center();
45086 nsiResult = nsi.upgradeTags(newTags, loc);
45088 newTags = nsiResult.newTags;
45089 subtype = "noncanonical_brand";
45090 upgradeReasons.push({
45091 source: "name-suggestion-index",
45098 issues.provisional = _waitingForDeprecated || waitingForNsi;
45099 const tagDiff = utilTagDiff(oldTags, newTags);
45100 if (!tagDiff.length) return issues;
45101 const isOnlyAddingTags = tagDiff.every((d2) => d2.type === "+");
45104 prefix = "noncanonical_brand.";
45105 } else if (subtype === "deprecated_tags" && isOnlyAddingTags) {
45106 subtype = "incomplete_tags";
45107 prefix = "incomplete.";
45109 let autoArgs = subtype !== "noncanonical_brand" ? [doUpgrade, _t("issues.fix.upgrade_tags.annotation")] : null;
45110 issues.push(new validationIssue({
45113 severity: "warning",
45114 message: showMessage,
45115 reference: showReference,
45116 entityIds: [entity.id],
45117 hash: utilHashcode(JSON.stringify(tagDiff)),
45118 dynamicFixes: () => {
45120 new validationIssueFix({
45122 title: _t.append("issues.fix.upgrade_tags.title"),
45123 onClick: (context) => {
45124 context.perform(doUpgrade, _t("issues.fix.upgrade_tags.annotation"));
45128 const item = nsiResult && nsiResult.matched;
45131 new validationIssueFix({
45132 title: _t.append("issues.fix.tag_as_not.title", { name: item.displayName }),
45133 onClick: (context) => {
45134 context.perform(addNotTag, _t("issues.fix.tag_as_not.annotation"));
45143 function doUpgrade(graph2) {
45144 const currEntity = graph2.hasEntity(entity.id);
45145 if (!currEntity) return graph2;
45146 let newTags2 = Object.assign({}, currEntity.tags);
45147 tagDiff.forEach((diff) => {
45148 if (diff.type === "-") {
45149 delete newTags2[diff.key];
45150 } else if (diff.type === "+") {
45151 newTags2[diff.key] = diff.newVal;
45154 return actionChangeTags(currEntity.id, newTags2)(graph2);
45156 function addNotTag(graph2) {
45157 const currEntity = graph2.hasEntity(entity.id);
45158 if (!currEntity) return graph2;
45159 const item = nsiResult && nsiResult.matched;
45160 if (!item) return graph2;
45161 let newTags2 = Object.assign({}, currEntity.tags);
45162 const wd = item.mainTag;
45163 const notwd = "not:".concat(wd);
45164 const qid = item.tags[wd];
45165 newTags2[notwd] = qid;
45166 if (newTags2[wd] === qid) {
45167 const wp = item.mainTag.replace("wikidata", "wikipedia");
45168 delete newTags2[wd];
45169 delete newTags2[wp];
45171 return actionChangeTags(currEntity.id, newTags2)(graph2);
45173 function showMessage(context) {
45174 const currEntity = context.hasEntity(entity.id);
45175 if (!currEntity) return "";
45176 let messageID = "issues.outdated_tags.".concat(prefix, "message");
45177 if (subtype === "noncanonical_brand" && isOnlyAddingTags) {
45178 messageID += "_incomplete";
45180 return _t.append(messageID, {
45181 feature: utilDisplayLabel(
45189 function showReference(selection2) {
45190 let enter = selection2.selectAll(".issue-reference").data([0]).enter();
45191 enter.append("div").attr("class", "issue-reference").call(_t.append("issues.outdated_tags.".concat(prefix, "reference")));
45192 enter.append("strong").call(_t.append("issues.suggested"));
45193 enter.append("table").attr("class", "tagDiff-table").selectAll(".tagDiff-row").data(tagDiff).enter().append("tr").attr("class", "tagDiff-row").append("td").attr("class", (d2) => {
45194 let klass = d2.type === "+" ? "add" : "remove";
45195 return "tagDiff-cell tagDiff-cell-".concat(klass);
45196 }).html((d2) => d2.display);
45199 let validation = oldTagIssues;
45200 validation.type = type2;
45204 // modules/validations/private_data.js
45205 function validationPrivateData() {
45206 var type2 = "private_data";
45207 var privateBuildingValues = {
45213 semidetached_house: true,
45214 static_caravan: true
45225 var personalTags = {
45226 "contact:email": true,
45227 "contact:fax": true,
45228 "contact:phone": true,
45233 var validation = function checkPrivateData(entity) {
45234 var tags = entity.tags;
45235 if (!tags.building || !privateBuildingValues[tags.building]) return [];
45237 for (var k2 in tags) {
45238 if (publicKeys[k2]) return [];
45239 if (!personalTags[k2]) {
45240 keepTags[k2] = tags[k2];
45243 var tagDiff = utilTagDiff(tags, keepTags);
45244 if (!tagDiff.length) return [];
45245 var fixID = tagDiff.length === 1 ? "remove_tag" : "remove_tags";
45246 return [new validationIssue({
45248 severity: "warning",
45249 message: showMessage,
45250 reference: showReference,
45251 entityIds: [entity.id],
45252 dynamicFixes: function() {
45254 new validationIssueFix({
45255 icon: "iD-operation-delete",
45256 title: _t.append("issues.fix." + fixID + ".title"),
45257 onClick: function(context) {
45258 context.perform(doUpgrade, _t("issues.fix.remove_tag.annotation"));
45264 function doUpgrade(graph) {
45265 var currEntity = graph.hasEntity(entity.id);
45266 if (!currEntity) return graph;
45267 var newTags = Object.assign({}, currEntity.tags);
45268 tagDiff.forEach(function(diff) {
45269 if (diff.type === "-") {
45270 delete newTags[diff.key];
45271 } else if (diff.type === "+") {
45272 newTags[diff.key] = diff.newVal;
45275 return actionChangeTags(currEntity.id, newTags)(graph);
45277 function showMessage(context) {
45278 var currEntity = context.hasEntity(this.entityIds[0]);
45279 if (!currEntity) return "";
45281 "issues.private_data.contact.message",
45282 { feature: utilDisplayLabel(currEntity, context.graph()) }
45285 function showReference(selection2) {
45286 var enter = selection2.selectAll(".issue-reference").data([0]).enter();
45287 enter.append("div").attr("class", "issue-reference").call(_t.append("issues.private_data.reference"));
45288 enter.append("strong").call(_t.append("issues.suggested"));
45289 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) {
45290 var klass = d2.type === "+" ? "add" : "remove";
45291 return "tagDiff-cell tagDiff-cell-" + klass;
45292 }).html(function(d2) {
45297 validation.type = type2;
45301 // modules/validations/suspicious_name.js
45302 function validationSuspiciousName() {
45303 const type2 = "suspicious_name";
45304 const keysToTestForGenericValues = [
45319 let _waitingForNsi = false;
45320 function isGenericMatchInNsi(tags) {
45321 const nsi = services.nsi;
45323 _waitingForNsi = nsi.status() === "loading";
45324 if (!_waitingForNsi) {
45325 return nsi.isGenericName(tags);
45330 function nameMatchesRawTag(lowercaseName, tags) {
45331 for (let i3 = 0; i3 < keysToTestForGenericValues.length; i3++) {
45332 let key = keysToTestForGenericValues[i3];
45333 let val = tags[key];
45335 val = val.toLowerCase();
45336 if (key === lowercaseName || val === lowercaseName || key.replace(/\_/g, " ") === lowercaseName || val.replace(/\_/g, " ") === lowercaseName) {
45343 function isGenericName(name, tags) {
45344 name = name.toLowerCase();
45345 return nameMatchesRawTag(name, tags) || isGenericMatchInNsi(tags);
45347 function makeGenericNameIssue(entityId, nameKey, genericName, langCode) {
45348 return new validationIssue({
45350 subtype: "generic_name",
45351 severity: "warning",
45352 message: function(context) {
45353 let entity = context.hasEntity(this.entityIds[0]);
45354 if (!entity) return "";
45355 let preset = _mainPresetIndex.match(entity, context.graph());
45356 let langName = langCode && _mainLocalizer.languageName(langCode);
45358 "issues.generic_name.message" + (langName ? "_language" : ""),
45359 { feature: preset.name(), name: genericName, language: langName }
45362 reference: showReference,
45363 entityIds: [entityId],
45364 hash: "".concat(nameKey, "=").concat(genericName),
45365 dynamicFixes: function() {
45367 new validationIssueFix({
45368 icon: "iD-operation-delete",
45369 title: _t.append("issues.fix.remove_the_name.title"),
45370 onClick: function(context) {
45371 let entityId2 = this.issue.entityIds[0];
45372 let entity = context.entity(entityId2);
45373 let tags = Object.assign({}, entity.tags);
45374 delete tags[nameKey];
45376 actionChangeTags(entityId2, tags),
45377 _t("issues.fix.remove_generic_name.annotation")
45384 function showReference(selection2) {
45385 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.generic_name.reference"));
45388 let validation = function checkGenericName(entity) {
45389 const tags = entity.tags;
45390 const hasWikidata = !!tags.wikidata || !!tags["brand:wikidata"] || !!tags["operator:wikidata"];
45391 if (hasWikidata) return [];
45393 for (let key in tags) {
45394 const m2 = key.match(/^name(?:(?::)([a-zA-Z_-]+))?$/);
45396 const langCode = m2.length >= 2 ? m2[1] : null;
45397 const value = tags[key];
45398 if (isGenericName(value, tags)) {
45399 issues.provisional = _waitingForNsi;
45400 issues.push(makeGenericNameIssue(entity.id, key, value, langCode));
45405 validation.type = type2;
45409 // modules/validations/unsquare_way.js
45410 function validationUnsquareWay(context) {
45411 var type2 = "unsquare_way";
45412 var DEFAULT_DEG_THRESHOLD = 5;
45413 var epsilon3 = 0.05;
45414 var nodeThreshold = 10;
45415 function isBuilding(entity, graph) {
45416 if (entity.type !== "way" || entity.geometry(graph) !== "area") return false;
45417 return entity.tags.building && entity.tags.building !== "no";
45419 var validation = function checkUnsquareWay(entity, graph) {
45420 if (!isBuilding(entity, graph)) return [];
45421 if (entity.tags.nonsquare === "yes") return [];
45422 var isClosed = entity.isClosed();
45423 if (!isClosed) return [];
45424 var nodes = graph.childNodes(entity).slice();
45425 if (nodes.length > nodeThreshold + 1) return [];
45426 var osm = services.osm;
45427 if (!osm || nodes.some(function(node) {
45428 return !osm.isDataLoaded(node.loc);
45430 var hasConnectedSquarableWays = nodes.some(function(node) {
45431 return graph.parentWays(node).some(function(way) {
45432 if (way.id === entity.id) return false;
45433 if (isBuilding(way, graph)) return true;
45434 return graph.parentRelations(way).some(function(parentRelation) {
45435 return parentRelation.isMultipolygon() && parentRelation.tags.building && parentRelation.tags.building !== "no";
45439 if (hasConnectedSquarableWays) return [];
45440 var storedDegreeThreshold = corePreferences("validate-square-degrees");
45441 var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
45442 var points = nodes.map(function(node) {
45443 return context.projection(node.loc);
45445 if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon3, degreeThreshold, true)) return [];
45447 if (!entity.tags.wikidata) {
45448 var autoAction = actionOrthogonalize(entity.id, context.projection, void 0, degreeThreshold);
45449 autoAction.transitionable = false;
45450 autoArgs = [autoAction, _t("operations.orthogonalize.annotation.feature", { n: 1 })];
45452 return [new validationIssue({
45454 subtype: "building",
45455 severity: "warning",
45456 message: function(context2) {
45457 var entity2 = context2.hasEntity(this.entityIds[0]);
45458 return entity2 ? _t.append("issues.unsquare_way.message", {
45459 feature: utilDisplayLabel(entity2, context2.graph())
45462 reference: showReference,
45463 entityIds: [entity.id],
45464 hash: degreeThreshold,
45465 dynamicFixes: function() {
45467 new validationIssueFix({
45468 icon: "iD-operation-orthogonalize",
45469 title: _t.append("issues.fix.square_feature.title"),
45471 onClick: function(context2, completionHandler) {
45472 var entityId = this.issue.entityIds[0];
45474 actionOrthogonalize(entityId, context2.projection, void 0, degreeThreshold),
45475 _t("operations.orthogonalize.annotation.feature", { n: 1 })
45477 window.setTimeout(function() {
45478 completionHandler();
45483 new validationIssueFix({
45484 title: t.append('issues.fix.tag_as_unsquare.title'),
45485 onClick: function(context) {
45486 var entityId = this.issue.entityIds[0];
45487 var entity = context.entity(entityId);
45488 var tags = Object.assign({}, entity.tags); // shallow copy
45489 tags.nonsquare = 'yes';
45491 actionChangeTags(entityId, tags),
45492 t('issues.fix.tag_as_unsquare.annotation')
45500 function showReference(selection2) {
45501 selection2.selectAll(".issue-reference").data([0]).enter().append("div").attr("class", "issue-reference").call(_t.append("issues.unsquare_way.buildings.reference"));
45504 validation.type = type2;
45508 // modules/core/validator.js
45509 function coreValidator(context) {
45510 let dispatch14 = dispatch_default("validated", "focusedIssue");
45511 let validator = utilRebind({}, dispatch14, "on");
45513 let _disabledRules = {};
45514 let _ignoredIssueIDs = /* @__PURE__ */ new Set();
45515 let _resolvedIssueIDs = /* @__PURE__ */ new Set();
45516 let _baseCache = validationCache("base");
45517 let _headCache = validationCache("head");
45518 let _completeDiff = {};
45519 let _headIsCurrent = false;
45520 let _deferredRIC = {};
45521 let _deferredST = /* @__PURE__ */ new Set();
45524 const _errorOverrides = parseHashParam(context.initialHashParams.validationError);
45525 const _warningOverrides = parseHashParam(context.initialHashParams.validationWarning);
45526 const _disableOverrides = parseHashParam(context.initialHashParams.validationDisable);
45527 function parseHashParam(param) {
45529 let rules = (param || "").split(",");
45530 rules.forEach((rule) => {
45531 rule = rule.trim();
45532 const parts = rule.split("/", 2);
45533 const type2 = parts[0];
45534 const subtype = parts[1] || "*";
45535 if (!type2 || !subtype) return;
45536 result.push({ type: makeRegExp(type2), subtype: makeRegExp(subtype) });
45539 function makeRegExp(str) {
45540 const escaped = str.replace(/[-\/\\^$+?.()|[\]{}]/g, "\\$&").replace(/\*/g, ".*");
45541 return new RegExp("^" + escaped + "$");
45544 validator.init = () => {
45545 Object.values(validations_exports).forEach((validation) => {
45546 if (typeof validation !== "function") return;
45547 const fn = validation(context);
45548 const key = fn.type;
45551 let disabledRules = corePreferences("validate-disabledRules");
45552 if (disabledRules) {
45553 disabledRules.split(",").forEach((k2) => _disabledRules[k2] = true);
45556 function reset(resetIgnored) {
45557 _baseCache.queue = [];
45558 _headCache.queue = [];
45559 Object.keys(_deferredRIC).forEach((key) => {
45560 window.cancelIdleCallback(key);
45561 _deferredRIC[key]();
45564 _deferredST.forEach(window.clearTimeout);
45565 _deferredST.clear();
45566 if (resetIgnored) _ignoredIssueIDs.clear();
45567 _resolvedIssueIDs.clear();
45568 _baseCache = validationCache("base");
45569 _headCache = validationCache("head");
45570 _completeDiff = {};
45571 _headIsCurrent = false;
45573 validator.reset = () => {
45576 validator.resetIgnoredIssues = () => {
45577 _ignoredIssueIDs.clear();
45578 dispatch14.call("validated");
45580 validator.revalidateUnsquare = () => {
45581 revalidateUnsquare(_headCache);
45582 revalidateUnsquare(_baseCache);
45583 dispatch14.call("validated");
45585 function revalidateUnsquare(cache) {
45586 const checkUnsquareWay = _rules.unsquare_way;
45587 if (!cache.graph || typeof checkUnsquareWay !== "function") return;
45588 cache.uncacheIssuesOfType("unsquare_way");
45589 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");
45590 buildings.forEach((entity) => {
45591 const detected = checkUnsquareWay(entity, cache.graph);
45592 if (!detected.length) return;
45593 cache.cacheIssues(detected);
45596 validator.getIssues = (options2) => {
45597 const opts = Object.assign({ what: "all", where: "all", includeIgnored: false, includeDisabledRules: false }, options2);
45598 const view = context.map().extent();
45599 let seen = /* @__PURE__ */ new Set();
45601 if (_headCache.graph && _headCache.graph !== _baseCache.graph) {
45602 Object.values(_headCache.issuesByIssueID).forEach((issue) => {
45603 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
45604 if (opts.what === "edited" && !userModified) return;
45605 if (!filter2(issue)) return;
45606 seen.add(issue.id);
45607 results.push(issue);
45610 if (opts.what === "all") {
45611 Object.values(_baseCache.issuesByIssueID).forEach((issue) => {
45612 if (!filter2(issue)) return;
45613 seen.add(issue.id);
45614 results.push(issue);
45618 function filter2(issue) {
45619 if (!issue) return false;
45620 if (seen.has(issue.id)) return false;
45621 if (_resolvedIssueIDs.has(issue.id)) return false;
45622 if (opts.includeDisabledRules === "only" && !_disabledRules[issue.type]) return false;
45623 if (!opts.includeDisabledRules && _disabledRules[issue.type]) return false;
45624 if (opts.includeIgnored === "only" && !_ignoredIssueIDs.has(issue.id)) return false;
45625 if (!opts.includeIgnored && _ignoredIssueIDs.has(issue.id)) return false;
45626 if ((issue.entityIds || []).some((id2) => !context.hasEntity(id2))) return false;
45627 if (opts.where === "visible") {
45628 const extent = issue.extent(context.graph());
45629 if (!view.intersects(extent)) return false;
45634 validator.getResolvedIssues = () => {
45635 return Array.from(_resolvedIssueIDs).map((issueID) => _baseCache.issuesByIssueID[issueID]).filter(Boolean);
45637 validator.focusIssue = (issue) => {
45638 const graph = context.graph();
45641 const issueExtent = issue.extent(graph);
45643 focusCenter = issueExtent.center();
45645 if (issue.entityIds && issue.entityIds.length) {
45646 selectID = issue.entityIds[0];
45647 if (selectID && selectID.charAt(0) === "r") {
45648 const ids = utilEntityAndDeepMemberIDs([selectID], graph);
45649 let nodeID = ids.find((id2) => id2.charAt(0) === "n" && graph.hasEntity(id2));
45651 const wayID = ids.find((id2) => id2.charAt(0) === "w" && graph.hasEntity(id2));
45653 nodeID = graph.entity(wayID).first();
45657 focusCenter = graph.entity(nodeID).loc;
45662 const setZoom = Math.max(context.map().zoom(), 19);
45663 context.map().unobscuredCenterZoomEase(focusCenter, setZoom);
45666 window.setTimeout(() => {
45667 context.enter(modeSelect(context, [selectID]));
45668 dispatch14.call("focusedIssue", this, issue);
45672 validator.getIssuesBySeverity = (options2) => {
45673 let groups = utilArrayGroupBy(validator.getIssues(options2), "severity");
45674 groups.error = groups.error || [];
45675 groups.warning = groups.warning || [];
45678 validator.getSharedEntityIssues = (entityIDs, options2) => {
45679 const orderedIssueTypes = [
45680 // Show some issue types in a particular order:
45683 // - missing data first
45685 "mismatched_geometry",
45686 // - identity issues
45689 // - geometry issues where fixing them might solve connectivity issues
45690 "disconnected_way",
45691 "impossible_oneway"
45692 // - finally connectivity issues
45694 const allIssues = validator.getIssues(options2);
45695 const forEntityIDs = new Set(entityIDs);
45696 return allIssues.filter((issue) => (issue.entityIds || []).some((entityID) => forEntityIDs.has(entityID))).sort((issue1, issue2) => {
45697 if (issue1.type === issue2.type) {
45698 return issue1.id < issue2.id ? -1 : 1;
45700 const index1 = orderedIssueTypes.indexOf(issue1.type);
45701 const index2 = orderedIssueTypes.indexOf(issue2.type);
45702 if (index1 !== -1 && index2 !== -1) {
45703 return index1 - index2;
45704 } else if (index1 === -1 && index2 === -1) {
45705 return issue1.type < issue2.type ? -1 : 1;
45707 return index1 !== -1 ? -1 : 1;
45711 validator.getEntityIssues = (entityID, options2) => {
45712 return validator.getSharedEntityIssues([entityID], options2);
45714 validator.getRuleKeys = () => {
45715 return Object.keys(_rules);
45717 validator.isRuleEnabled = (key) => {
45718 return !_disabledRules[key];
45720 validator.toggleRule = (key) => {
45721 if (_disabledRules[key]) {
45722 delete _disabledRules[key];
45724 _disabledRules[key] = true;
45726 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
45727 validator.validate();
45729 validator.disableRules = (keys2) => {
45730 _disabledRules = {};
45731 keys2.forEach((k2) => _disabledRules[k2] = true);
45732 corePreferences("validate-disabledRules", Object.keys(_disabledRules).join(","));
45733 validator.validate();
45735 validator.ignoreIssue = (issueID) => {
45736 _ignoredIssueIDs.add(issueID);
45738 validator.validate = () => {
45739 const baseGraph = context.history().base();
45740 if (!_headCache.graph) _headCache.graph = baseGraph;
45741 if (!_baseCache.graph) _baseCache.graph = baseGraph;
45742 const prevGraph = _headCache.graph;
45743 const currGraph = context.graph();
45744 if (currGraph === prevGraph) {
45745 _headIsCurrent = true;
45746 dispatch14.call("validated");
45747 return Promise.resolve();
45749 if (_headPromise) {
45750 _headIsCurrent = false;
45751 return _headPromise;
45753 _headCache.graph = currGraph;
45754 _completeDiff = context.history().difference().complete();
45755 const incrementalDiff = coreDifference(prevGraph, currGraph);
45756 let entityIDs = Object.keys(incrementalDiff.complete());
45757 entityIDs = _headCache.withAllRelatedEntities(entityIDs);
45758 if (!entityIDs.size) {
45759 dispatch14.call("validated");
45760 return Promise.resolve();
45762 _headPromise = validateEntitiesAsync(entityIDs, _headCache).then(() => updateResolvedIssues(entityIDs)).then(() => dispatch14.call("validated")).catch(() => {
45764 _headPromise = null;
45765 if (!_headIsCurrent) {
45766 validator.validate();
45769 return _headPromise;
45771 context.history().on("restore.validator", validator.validate).on("undone.validator", validator.validate).on("redone.validator", validator.validate).on("reset.validator", () => {
45773 validator.validate();
45775 context.on("exit.validator", validator.validate);
45776 context.history().on("merge.validator", (entities) => {
45777 if (!entities) return;
45778 const baseGraph = context.history().base();
45779 if (!_headCache.graph) _headCache.graph = baseGraph;
45780 if (!_baseCache.graph) _baseCache.graph = baseGraph;
45781 let entityIDs = entities.map((entity) => entity.id);
45782 entityIDs = _baseCache.withAllRelatedEntities(entityIDs);
45783 validateEntitiesAsync(entityIDs, _baseCache);
45785 function validateEntity(entity, graph) {
45786 let result = { issues: [], provisional: false };
45787 Object.keys(_rules).forEach(runValidation);
45789 function runValidation(key) {
45790 const fn = _rules[key];
45791 if (typeof fn !== "function") {
45792 console.error("no such validation rule = " + key);
45795 let detected = fn(entity, graph);
45796 if (detected.provisional) {
45797 result.provisional = true;
45799 detected = detected.filter(applySeverityOverrides);
45800 result.issues = result.issues.concat(detected);
45801 function applySeverityOverrides(issue) {
45802 const type2 = issue.type;
45803 const subtype = issue.subtype || "";
45805 for (i3 = 0; i3 < _errorOverrides.length; i3++) {
45806 if (_errorOverrides[i3].type.test(type2) && _errorOverrides[i3].subtype.test(subtype)) {
45807 issue.severity = "error";
45811 for (i3 = 0; i3 < _warningOverrides.length; i3++) {
45812 if (_warningOverrides[i3].type.test(type2) && _warningOverrides[i3].subtype.test(subtype)) {
45813 issue.severity = "warning";
45817 for (i3 = 0; i3 < _disableOverrides.length; i3++) {
45818 if (_disableOverrides[i3].type.test(type2) && _disableOverrides[i3].subtype.test(subtype)) {
45826 function updateResolvedIssues(entityIDs) {
45827 entityIDs.forEach((entityID) => {
45828 const baseIssues = _baseCache.issuesByEntityID[entityID];
45829 if (!baseIssues) return;
45830 baseIssues.forEach((issueID) => {
45831 const issue = _baseCache.issuesByIssueID[issueID];
45832 const userModified = (issue.entityIds || []).some((id2) => _completeDiff.hasOwnProperty(id2));
45833 if (userModified && !_headCache.issuesByIssueID[issueID]) {
45834 _resolvedIssueIDs.add(issueID);
45836 _resolvedIssueIDs.delete(issueID);
45841 function validateEntitiesAsync(entityIDs, cache) {
45842 const jobs = Array.from(entityIDs).map((entityID) => {
45843 if (cache.queuedEntityIDs.has(entityID)) return null;
45844 cache.queuedEntityIDs.add(entityID);
45845 cache.uncacheEntityID(entityID);
45847 cache.queuedEntityIDs.delete(entityID);
45848 const graph = cache.graph;
45849 if (!graph) return;
45850 const entity = graph.hasEntity(entityID);
45851 if (!entity) return;
45852 const result = validateEntity(entity, graph);
45853 if (result.provisional) {
45854 cache.provisionalEntityIDs.add(entityID);
45856 cache.cacheIssues(result.issues);
45858 }).filter(Boolean);
45859 cache.queue = cache.queue.concat(utilArrayChunk(jobs, 100));
45860 if (cache.queuePromise) return cache.queuePromise;
45861 cache.queuePromise = processQueue(cache).then(() => revalidateProvisionalEntities(cache)).catch(() => {
45862 }).finally(() => cache.queuePromise = null);
45863 return cache.queuePromise;
45865 function revalidateProvisionalEntities(cache) {
45866 if (!cache.provisionalEntityIDs.size) return;
45867 const handle = window.setTimeout(() => {
45868 _deferredST.delete(handle);
45869 if (!cache.provisionalEntityIDs.size) return;
45870 validateEntitiesAsync(Array.from(cache.provisionalEntityIDs), cache);
45872 _deferredST.add(handle);
45874 function processQueue(cache) {
45875 if (!cache.queue.length) return Promise.resolve();
45876 const chunk = cache.queue.pop();
45877 return new Promise((resolvePromise, rejectPromise) => {
45878 const handle = window.requestIdleCallback(() => {
45879 delete _deferredRIC[handle];
45880 chunk.forEach((job) => job());
45883 _deferredRIC[handle] = rejectPromise;
45885 if (cache.queue.length % 25 === 0) dispatch14.call("validated");
45886 }).then(() => processQueue(cache));
45890 function validationCache(which) {
45895 queuePromise: null,
45896 queuedEntityIDs: /* @__PURE__ */ new Set(),
45897 provisionalEntityIDs: /* @__PURE__ */ new Set(),
45898 issuesByIssueID: {},
45899 // issue.id -> issue
45900 issuesByEntityID: {}
45901 // entity.id -> Set(issue.id)
45903 cache.cacheIssue = (issue) => {
45904 (issue.entityIds || []).forEach((entityID) => {
45905 if (!cache.issuesByEntityID[entityID]) {
45906 cache.issuesByEntityID[entityID] = /* @__PURE__ */ new Set();
45908 cache.issuesByEntityID[entityID].add(issue.id);
45910 cache.issuesByIssueID[issue.id] = issue;
45912 cache.uncacheIssue = (issue) => {
45913 (issue.entityIds || []).forEach((entityID) => {
45914 if (cache.issuesByEntityID[entityID]) {
45915 cache.issuesByEntityID[entityID].delete(issue.id);
45918 delete cache.issuesByIssueID[issue.id];
45920 cache.cacheIssues = (issues) => {
45921 issues.forEach(cache.cacheIssue);
45923 cache.uncacheIssues = (issues) => {
45924 issues.forEach(cache.uncacheIssue);
45926 cache.uncacheIssuesOfType = (type2) => {
45927 const issuesOfType = Object.values(cache.issuesByIssueID).filter((issue) => issue.type === type2);
45928 cache.uncacheIssues(issuesOfType);
45930 cache.uncacheEntityID = (entityID) => {
45931 const entityIssueIDs = cache.issuesByEntityID[entityID];
45932 if (entityIssueIDs) {
45933 entityIssueIDs.forEach((issueID) => {
45934 const issue = cache.issuesByIssueID[issueID];
45936 cache.uncacheIssue(issue);
45938 delete cache.issuesByIssueID[issueID];
45942 delete cache.issuesByEntityID[entityID];
45943 cache.provisionalEntityIDs.delete(entityID);
45945 cache.withAllRelatedEntities = (entityIDs) => {
45946 let result = /* @__PURE__ */ new Set();
45947 (entityIDs || []).forEach((entityID) => {
45948 result.add(entityID);
45949 const entityIssueIDs = cache.issuesByEntityID[entityID];
45950 if (entityIssueIDs) {
45951 entityIssueIDs.forEach((issueID) => {
45952 const issue = cache.issuesByIssueID[issueID];
45954 (issue.entityIds || []).forEach((relatedID) => result.add(relatedID));
45956 delete cache.issuesByIssueID[issueID];
45966 // modules/core/uploader.js
45967 function coreUploader(context) {
45968 var dispatch14 = dispatch_default(
45969 // Start and end events are dispatched exactly once each per legitimate outside call to `save`
45971 // dispatched as soon as a call to `save` has been deemed legitimate
45973 // dispatched after the result event has been dispatched
45974 "willAttemptUpload",
45975 // dispatched before the actual upload call occurs, if it will
45977 // Each save results in one of these outcomes:
45979 // upload wasn't attempted since there were no edits
45981 // upload failed due to errors
45983 // upload failed due to data conflicts
45985 // upload completed without errors
45987 var _isSaving = false;
45988 var _conflicts = [];
45991 var _discardTags = {};
45992 _mainFileFetcher.get("discarded").then(function(d2) {
45994 }).catch(function() {
45996 var uploader = utilRebind({}, dispatch14, "on");
45997 uploader.isSaving = function() {
46000 uploader.save = function(changeset, tryAgain, checkConflicts) {
46001 if (_isSaving && !tryAgain) {
46004 var osm = context.connection();
46006 if (!osm.authenticated()) {
46007 osm.authenticate(function(err) {
46009 uploader.save(changeset, tryAgain, checkConflicts);
46016 dispatch14.call("saveStarted", this);
46018 var history = context.history();
46021 _origChanges = history.changes(actionDiscardTags(history.difference(), _discardTags));
46023 history.perform(actionNoop());
46025 if (!checkConflicts) {
46028 performFullConflictCheck(changeset);
46031 function performFullConflictCheck(changeset) {
46032 var osm = context.connection();
46034 var history = context.history();
46035 var localGraph = context.graph();
46036 var remoteGraph = coreGraph(history.base(), true);
46037 var summary = history.difference().summary();
46039 for (var i3 = 0; i3 < summary.length; i3++) {
46040 var item = summary[i3];
46041 if (item.changeType === "modified") {
46042 _toCheck.push(item.entity.id);
46045 var _toLoad = withChildNodes(_toCheck, localGraph);
46047 var _toLoadCount = 0;
46048 var _toLoadTotal = _toLoad.length;
46049 if (_toCheck.length) {
46050 dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
46051 _toLoad.forEach(function(id2) {
46052 _loaded[id2] = false;
46054 osm.loadMultiple(_toLoad, loaded);
46059 function withChildNodes(ids, graph) {
46060 var s2 = new Set(ids);
46061 ids.forEach(function(id2) {
46062 var entity = graph.entity(id2);
46063 if (entity.type !== "way") return;
46064 graph.childNodes(entity).forEach(function(child) {
46065 if (child.version !== void 0) {
46070 return Array.from(s2);
46072 function loaded(err, result) {
46073 if (_errors.length) return;
46076 msg: err.message || err.responseText,
46077 details: [_t("save.status_code", { code: err.status })]
46079 didResultInErrors();
46082 result.data.forEach(function(entity) {
46083 remoteGraph.replace(entity);
46084 _loaded[entity.id] = true;
46085 _toLoad = _toLoad.filter(function(val) {
46086 return val !== entity.id;
46088 if (!entity.visible) return;
46090 if (entity.type === "way") {
46091 for (i4 = 0; i4 < entity.nodes.length; i4++) {
46092 id2 = entity.nodes[i4];
46093 if (_loaded[id2] === void 0) {
46094 _loaded[id2] = false;
46095 loadMore.push(id2);
46098 } else if (entity.type === "relation" && entity.isMultipolygon()) {
46099 for (i4 = 0; i4 < entity.members.length; i4++) {
46100 id2 = entity.members[i4].id;
46101 if (_loaded[id2] === void 0) {
46102 _loaded[id2] = false;
46103 loadMore.push(id2);
46108 _toLoadCount += result.data.length;
46109 _toLoadTotal += loadMore.length;
46110 dispatch14.call("progressChanged", this, _toLoadCount, _toLoadTotal);
46111 if (loadMore.length) {
46112 _toLoad.push.apply(_toLoad, loadMore);
46113 osm.loadMultiple(loadMore, loaded);
46115 if (!_toLoad.length) {
46121 function detectConflicts() {
46122 function choice(id2, text, action) {
46126 action: function() {
46127 history.replace(action);
46131 function formatUser(d2) {
46132 return '<a href="' + osm.userURL(d2) + '" target="_blank">' + escape_default(d2) + "</a>";
46134 function entityName(entity) {
46135 return utilDisplayName(entity) || utilDisplayType(entity.id) + " " + entity.id;
46137 function sameVersions(local, remote) {
46138 if (local.version !== remote.version) return false;
46139 if (local.type === "way") {
46140 var children2 = utilArrayUnion(local.nodes, remote.nodes);
46141 for (var i4 = 0; i4 < children2.length; i4++) {
46142 var a2 = localGraph.hasEntity(children2[i4]);
46143 var b2 = remoteGraph.hasEntity(children2[i4]);
46144 if (a2 && b2 && a2.version !== b2.version) return false;
46149 _toCheck.forEach(function(id2) {
46150 var local = localGraph.entity(id2);
46151 var remote = remoteGraph.entity(id2);
46152 if (sameVersions(local, remote)) return;
46153 var merge2 = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags, formatUser);
46154 history.replace(merge2);
46155 var mergeConflicts = merge2.conflicts();
46156 if (!mergeConflicts.length) return;
46157 var forceLocal = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_local");
46158 var forceRemote = actionMergeRemoteChanges(id2, localGraph, remoteGraph, _discardTags).withOption("force_remote");
46159 var keepMine = _t("save.conflict." + (remote.visible ? "keep_local" : "restore"));
46160 var keepTheirs = _t("save.conflict." + (remote.visible ? "keep_remote" : "delete"));
46163 name: entityName(local),
46164 details: mergeConflicts,
46167 choice(id2, keepMine, forceLocal),
46168 choice(id2, keepTheirs, forceRemote)
46174 function upload(changeset) {
46175 var osm = context.connection();
46177 _errors.push({ msg: "No OSM Service" });
46179 if (_conflicts.length) {
46180 didResultInConflicts(changeset);
46181 } else if (_errors.length) {
46182 didResultInErrors();
46184 var history = context.history();
46185 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
46186 if (changes.modified.length || changes.created.length || changes.deleted.length) {
46187 dispatch14.call("willAttemptUpload", this);
46188 osm.putChangeset(changeset, changes, uploadCallback);
46190 didResultInNoChanges();
46194 function uploadCallback(err, changeset) {
46196 if (err.status === 409) {
46197 uploader.save(changeset, true, true);
46200 msg: err.message || err.responseText,
46201 details: [_t("save.status_code", { code: err.status })]
46203 didResultInErrors();
46206 didResultInSuccess(changeset);
46209 function didResultInNoChanges() {
46210 dispatch14.call("resultNoChanges", this);
46214 function didResultInErrors() {
46215 context.history().pop();
46216 dispatch14.call("resultErrors", this, _errors);
46219 function didResultInConflicts(changeset) {
46220 _conflicts.sort(function(a2, b2) {
46221 return b2.id.localeCompare(a2.id);
46223 dispatch14.call("resultConflicts", this, changeset, _conflicts, _origChanges);
46226 function didResultInSuccess(changeset) {
46227 context.history().clearSaved();
46228 dispatch14.call("resultSuccess", this, changeset);
46229 window.setTimeout(function() {
46234 function endSave() {
46236 dispatch14.call("saveEnded", this);
46238 uploader.cancelConflictResolution = function() {
46239 context.history().pop();
46241 uploader.processResolvedConflicts = function(changeset) {
46242 var history = context.history();
46243 for (var i3 = 0; i3 < _conflicts.length; i3++) {
46244 if (_conflicts[i3].chosen === 1) {
46245 var entity = context.hasEntity(_conflicts[i3].id);
46246 if (entity && entity.type === "way") {
46247 var children2 = utilArrayUniq(entity.nodes);
46248 for (var j2 = 0; j2 < children2.length; j2++) {
46249 history.replace(actionRevert(children2[j2]));
46252 history.replace(actionRevert(_conflicts[i3].id));
46255 uploader.save(changeset, true, false);
46257 uploader.reset = function() {
46262 // modules/modes/draw_area.js
46263 function modeDrawArea(context, wayID, startGraph, button) {
46268 var behavior = behaviorDrawWay(context, wayID, mode, startGraph).on("rejectedSelfIntersection.modeDrawArea", function() {
46269 context.ui().flash.iconName("#iD-icon-no").label(_t.append("self_intersection.error.areas"))();
46271 mode.wayID = wayID;
46272 mode.enter = function() {
46273 context.install(behavior);
46275 mode.exit = function() {
46276 context.uninstall(behavior);
46278 mode.selectedIDs = function() {
46281 mode.activeID = function() {
46282 return behavior && behavior.activeID() || [];
46287 // modules/modes/add_area.js
46288 function modeAddArea(context, mode) {
46289 mode.id = "add-area";
46290 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
46291 function defaultTags(loc) {
46292 var defaultTags2 = { area: "yes" };
46293 if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "area", false, loc);
46294 return defaultTags2;
46296 function actionClose(wayId) {
46297 return function(graph) {
46298 return graph.replace(graph.entity(wayId).close());
46301 function start2(loc) {
46302 var startGraph = context.graph();
46303 var node = osmNode({ loc });
46304 var way = osmWay({ tags: defaultTags(loc) });
46306 actionAddEntity(node),
46307 actionAddEntity(way),
46308 actionAddVertex(way.id, node.id),
46309 actionClose(way.id)
46311 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46313 function startFromWay(loc, edge) {
46314 var startGraph = context.graph();
46315 var node = osmNode({ loc });
46316 var way = osmWay({ tags: defaultTags(loc) });
46318 actionAddEntity(node),
46319 actionAddEntity(way),
46320 actionAddVertex(way.id, node.id),
46321 actionClose(way.id),
46322 actionAddMidpoint({ loc, edge }, node)
46324 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46326 function startFromNode(node) {
46327 var startGraph = context.graph();
46328 var way = osmWay({ tags: defaultTags(node.loc) });
46330 actionAddEntity(way),
46331 actionAddVertex(way.id, node.id),
46332 actionClose(way.id)
46334 context.enter(modeDrawArea(context, way.id, startGraph, mode.button));
46336 mode.enter = function() {
46337 context.install(behavior);
46339 mode.exit = function() {
46340 context.uninstall(behavior);
46345 // modules/modes/add_line.js
46346 function modeAddLine(context, mode) {
46347 mode.id = "add-line";
46348 var behavior = behaviorAddWay(context).on("start", start2).on("startFromWay", startFromWay).on("startFromNode", startFromNode);
46349 function defaultTags(loc) {
46350 var defaultTags2 = {};
46351 if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "line", false, loc);
46352 return defaultTags2;
46354 function start2(loc) {
46355 var startGraph = context.graph();
46356 var node = osmNode({ loc });
46357 var way = osmWay({ tags: defaultTags(loc) });
46359 actionAddEntity(node),
46360 actionAddEntity(way),
46361 actionAddVertex(way.id, node.id)
46363 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46365 function startFromWay(loc, edge) {
46366 var startGraph = context.graph();
46367 var node = osmNode({ loc });
46368 var way = osmWay({ tags: defaultTags(loc) });
46370 actionAddEntity(node),
46371 actionAddEntity(way),
46372 actionAddVertex(way.id, node.id),
46373 actionAddMidpoint({ loc, edge }, node)
46375 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46377 function startFromNode(node) {
46378 var startGraph = context.graph();
46379 var way = osmWay({ tags: defaultTags(node.loc) });
46381 actionAddEntity(way),
46382 actionAddVertex(way.id, node.id)
46384 context.enter(modeDrawLine(context, way.id, startGraph, mode.button));
46386 mode.enter = function() {
46387 context.install(behavior);
46389 mode.exit = function() {
46390 context.uninstall(behavior);
46395 // modules/modes/add_point.js
46396 function modeAddPoint(context, mode) {
46397 mode.id = "add-point";
46398 var behavior = behaviorDraw(context).on("click", add).on("clickWay", addWay).on("clickNode", addNode).on("cancel", cancel).on("finish", cancel);
46399 function defaultTags(loc) {
46400 var defaultTags2 = {};
46401 if (mode.preset) defaultTags2 = mode.preset.setTags(defaultTags2, "point", false, loc);
46402 return defaultTags2;
46404 function add(loc) {
46405 var node = osmNode({ loc, tags: defaultTags(loc) });
46407 actionAddEntity(node),
46408 _t("operations.add.annotation.point")
46410 enterSelectMode(node);
46412 function addWay(loc, edge) {
46413 var node = osmNode({ tags: defaultTags(loc) });
46415 actionAddMidpoint({ loc, edge }, node),
46416 _t("operations.add.annotation.vertex")
46418 enterSelectMode(node);
46420 function enterSelectMode(node) {
46422 modeSelect(context, [node.id]).newFeature(true)
46425 function addNode(node) {
46426 const _defaultTags = defaultTags(node.loc);
46427 if (Object.keys(_defaultTags).length === 0) {
46428 enterSelectMode(node);
46431 var tags = Object.assign({}, node.tags);
46432 for (var key in _defaultTags) {
46433 tags[key] = _defaultTags[key];
46436 actionChangeTags(node.id, tags),
46437 _t("operations.add.annotation.point")
46439 enterSelectMode(node);
46441 function cancel() {
46442 context.enter(modeBrowse(context));
46444 mode.enter = function() {
46445 context.install(behavior);
46447 mode.exit = function() {
46448 context.uninstall(behavior);
46453 // modules/ui/note_comments.js
46454 function uiNoteComments() {
46456 function noteComments(selection2) {
46457 if (_note.isNew()) return;
46458 var comments = selection2.selectAll(".comments-container").data([0]);
46459 comments = comments.enter().append("div").attr("class", "comments-container").merge(comments);
46460 var commentEnter = comments.selectAll(".comment").data(_note.comments).enter().append("div").attr("class", "comment");
46461 commentEnter.append("div").attr("class", function(d2) {
46462 return "comment-avatar user-" + d2.uid;
46463 }).call(svgIcon("#iD-icon-avatar", "comment-avatar-icon"));
46464 var mainEnter = commentEnter.append("div").attr("class", "comment-main");
46465 var metadataEnter = mainEnter.append("div").attr("class", "comment-metadata");
46466 metadataEnter.append("div").attr("class", "comment-author").each(function(d2) {
46467 var selection3 = select_default2(this);
46468 var osm = services.osm;
46469 if (osm && d2.user) {
46470 selection3 = selection3.append("a").attr("class", "comment-author-link").attr("href", osm.userURL(d2.user)).attr("target", "_blank");
46473 selection3.text(d2.user);
46475 selection3.call(_t.append("note.anonymous"));
46478 metadataEnter.append("div").attr("class", "comment-date").html(function(d2) {
46479 return _t.html("note.status." + d2.action, { when: localeDateString2(d2.date) });
46481 mainEnter.append("div").attr("class", "comment-text").html(function(d2) {
46483 }).selectAll("a").attr("rel", "noopener nofollow").attr("target", "_blank");
46484 comments.call(replaceAvatars);
46486 function replaceAvatars(selection2) {
46487 var showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
46488 var osm = services.osm;
46489 if (showThirdPartyIcons !== "true" || !osm) return;
46491 _note.comments.forEach(function(d2) {
46492 if (d2.uid) uids[d2.uid] = true;
46494 Object.keys(uids).forEach(function(uid) {
46495 osm.loadUser(uid, function(err, user) {
46496 if (!user || !user.image_url) return;
46497 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);
46501 function localeDateString2(s2) {
46502 if (!s2) return null;
46503 var options2 = { day: "numeric", month: "short", year: "numeric" };
46504 s2 = s2.replace(/-/g, "/");
46505 var d2 = new Date(s2);
46506 if (isNaN(d2.getTime())) return null;
46507 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
46509 noteComments.note = function(val) {
46510 if (!arguments.length) return _note;
46512 return noteComments;
46514 return noteComments;
46517 // modules/ui/note_header.js
46518 function uiNoteHeader() {
46520 function noteHeader(selection2) {
46521 var header = selection2.selectAll(".note-header").data(
46522 _note ? [_note] : [],
46524 return d2.status + d2.id;
46527 header.exit().remove();
46528 var headerEnter = header.enter().append("div").attr("class", "note-header");
46529 var iconEnter = headerEnter.append("div").attr("class", function(d2) {
46530 return "note-header-icon " + d2.status;
46531 }).classed("new", function(d2) {
46534 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-note", "note-fill"));
46535 iconEnter.each(function(d2) {
46538 statusIcon = "#iD-icon-plus";
46539 } else if (d2.status === "open") {
46540 statusIcon = "#iD-icon-close";
46542 statusIcon = "#iD-icon-apply";
46544 iconEnter.append("div").attr("class", "note-icon-annotation").attr("title", _t("icons.close")).call(svgIcon(statusIcon, "icon-annotation"));
46546 headerEnter.append("div").attr("class", "note-header-label").html(function(d2) {
46547 if (_note.isNew()) {
46548 return _t.html("note.new");
46550 return _t.html("note.note") + " " + d2.id + " " + (d2.status === "closed" ? _t.html("note.closed") : "");
46553 noteHeader.note = function(val) {
46554 if (!arguments.length) return _note;
46561 // modules/ui/note_report.js
46562 function uiNoteReport() {
46564 function noteReport(selection2) {
46566 if (services.osm && _note instanceof osmNote && !_note.isNew()) {
46567 url = services.osm.noteReportURL(_note);
46569 var link3 = selection2.selectAll(".note-report").data(url ? [url] : []);
46570 link3.exit().remove();
46571 var linkEnter = link3.enter().append("a").attr("class", "note-report").attr("target", "_blank").attr("href", function(d2) {
46573 }).call(svgIcon("#iD-icon-out-link", "inline"));
46574 linkEnter.append("span").call(_t.append("note.report"));
46576 noteReport.note = function(val) {
46577 if (!arguments.length) return _note;
46584 // modules/ui/view_on_osm.js
46585 function uiViewOnOSM(context) {
46587 function viewOnOSM(selection2) {
46589 if (_what instanceof osmEntity) {
46590 url = context.connection().entityURL(_what);
46591 } else if (_what instanceof osmNote) {
46592 url = context.connection().noteURL(_what);
46594 var data = !_what || _what.isNew() ? [] : [_what];
46595 var link3 = selection2.selectAll(".view-on-osm").data(data, function(d2) {
46598 link3.exit().remove();
46599 var linkEnter = link3.enter().append("a").attr("class", "view-on-osm").attr("target", "_blank").attr("href", url).call(svgIcon("#iD-icon-out-link", "inline"));
46600 linkEnter.append("span").call(_t.append("inspector.view_on_osm"));
46602 viewOnOSM.what = function(_2) {
46603 if (!arguments.length) return _what;
46610 // modules/ui/note_editor.js
46611 function uiNoteEditor(context) {
46612 var dispatch14 = dispatch_default("change");
46613 var noteComments = uiNoteComments(context);
46614 var noteHeader = uiNoteHeader();
46617 function noteEditor(selection2) {
46618 var header = selection2.selectAll(".header").data([0]);
46619 var headerEnter = header.enter().append("div").attr("class", "header fillL");
46620 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
46621 context.enter(modeBrowse(context));
46622 }).call(svgIcon("#iD-icon-close"));
46623 headerEnter.append("h2").call(_t.append("note.title"));
46624 var body = selection2.selectAll(".body").data([0]);
46625 body = body.enter().append("div").attr("class", "body").merge(body);
46626 var editor = body.selectAll(".note-editor").data([0]);
46627 editor.enter().append("div").attr("class", "modal-section note-editor").merge(editor).call(noteHeader.note(_note)).call(noteComments.note(_note)).call(noteSaveSection);
46628 var footer = selection2.selectAll(".footer").data([0]);
46629 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOSM(context).what(_note)).call(uiNoteReport(context).note(_note));
46630 var osm = services.osm;
46632 osm.on("change.note-save", function() {
46633 selection2.call(noteEditor);
46637 function noteSaveSection(selection2) {
46638 var isSelected = _note && _note.id === context.selectedNoteID();
46639 var noteSave = selection2.selectAll(".note-save").data(isSelected ? [_note] : [], function(d2) {
46640 return d2.status + d2.id;
46642 noteSave.exit().remove();
46643 var noteSaveEnter = noteSave.enter().append("div").attr("class", "note-save save-section cf");
46644 noteSaveEnter.append("h4").attr("class", ".note-save-header").text("").each(function() {
46645 if (_note.isNew()) {
46646 _t.append("note.newDescription")(select_default2(this));
46648 _t.append("note.newComment")(select_default2(this));
46651 var commentTextarea = noteSaveEnter.append("textarea").attr("class", "new-comment-input").attr("placeholder", _t("note.inputPlaceholder")).attr("maxlength", 1e3).property("value", function(d2) {
46652 return d2.newComment;
46653 }).call(utilNoAuto).on("keydown.note-input", keydown).on("input.note-input", changeInput).on("blur.note-input", changeInput);
46654 if (!commentTextarea.empty() && _newNote) {
46655 commentTextarea.node().focus();
46657 noteSave = noteSaveEnter.merge(noteSave).call(userDetails).call(noteSaveButtons);
46658 function keydown(d3_event) {
46659 if (!(d3_event.keyCode === 13 && // ↩ Return
46660 d3_event.metaKey)) return;
46661 var osm = services.osm;
46663 var hasAuth = osm.authenticated();
46664 if (!hasAuth) return;
46665 if (!_note.newComment) return;
46666 d3_event.preventDefault();
46667 select_default2(this).on("keydown.note-input", null);
46668 window.setTimeout(function() {
46669 if (_note.isNew()) {
46670 noteSave.selectAll(".save-button").node().focus();
46673 noteSave.selectAll(".comment-button").node().focus();
46674 clickComment(_note);
46678 function changeInput() {
46679 var input = select_default2(this);
46680 var val = input.property("value").trim() || void 0;
46681 _note = _note.update({ newComment: val });
46682 var osm = services.osm;
46684 osm.replaceNote(_note);
46686 noteSave.call(noteSaveButtons);
46689 function userDetails(selection2) {
46690 var detailSection = selection2.selectAll(".detail-section").data([0]);
46691 detailSection = detailSection.enter().append("div").attr("class", "detail-section").merge(detailSection);
46692 var osm = services.osm;
46694 var hasAuth = osm.authenticated();
46695 var authWarning = detailSection.selectAll(".auth-warning").data(hasAuth ? [] : [0]);
46696 authWarning.exit().transition().duration(200).style("opacity", 0).remove();
46697 var authEnter = authWarning.enter().insert("div", ".tag-reference-body").attr("class", "field-warning auth-warning").style("opacity", 0);
46698 authEnter.call(svgIcon("#iD-icon-alert", "inline"));
46699 authEnter.append("span").call(_t.append("note.login"));
46700 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) {
46701 d3_event.preventDefault();
46702 osm.authenticate();
46704 authEnter.transition().duration(200).style("opacity", 1);
46705 var prose = detailSection.selectAll(".note-save-prose").data(hasAuth ? [0] : []);
46706 prose.exit().remove();
46707 prose = prose.enter().append("p").attr("class", "note-save-prose").call(_t.append("note.upload_explanation")).merge(prose);
46708 osm.userDetails(function(err, user) {
46710 var userLink = select_default2(document.createElement("div"));
46711 if (user.image_url) {
46712 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
46714 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
46715 prose.html(_t.html("note.upload_explanation_with_user", { user: { html: userLink.html() } }));
46718 function noteSaveButtons(selection2) {
46719 var osm = services.osm;
46720 var hasAuth = osm && osm.authenticated();
46721 var isSelected = _note && _note.id === context.selectedNoteID();
46722 var buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_note] : [], function(d2) {
46723 return d2.status + d2.id;
46725 buttonSection.exit().remove();
46726 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
46727 if (_note.isNew()) {
46728 buttonEnter.append("button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
46729 buttonEnter.append("button").attr("class", "button save-button action").call(_t.append("note.save"));
46731 buttonEnter.append("button").attr("class", "button status-button action");
46732 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("note.comment"));
46734 buttonSection = buttonSection.merge(buttonEnter);
46735 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
46736 buttonSection.select(".save-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
46737 buttonSection.select(".status-button").attr("disabled", hasAuth ? null : true).each(function(d2) {
46738 var action = d2.status === "open" ? "close" : "open";
46739 var andComment = d2.newComment ? "_comment" : "";
46740 _t.addOrUpdate("note." + action + andComment)(select_default2(this));
46741 }).on("click.status", clickStatus);
46742 buttonSection.select(".comment-button").attr("disabled", isSaveDisabled).on("click.comment", clickComment);
46743 function isSaveDisabled(d2) {
46744 return hasAuth && d2.status === "open" && d2.newComment ? null : true;
46747 function clickCancel(d3_event, d2) {
46749 var osm = services.osm;
46751 osm.removeNote(d2);
46753 context.enter(modeBrowse(context));
46754 dispatch14.call("change");
46756 function clickSave(d3_event, d2) {
46758 var osm = services.osm;
46760 osm.postNoteCreate(d2, function(err, note) {
46761 dispatch14.call("change", note);
46765 function clickStatus(d3_event, d2) {
46767 var osm = services.osm;
46769 var setStatus = d2.status === "open" ? "closed" : "open";
46770 osm.postNoteUpdate(d2, setStatus, function(err, note) {
46771 dispatch14.call("change", note);
46775 function clickComment(d3_event, d2) {
46777 var osm = services.osm;
46779 osm.postNoteUpdate(d2, d2.status, function(err, note) {
46780 dispatch14.call("change", note);
46784 noteEditor.note = function(val) {
46785 if (!arguments.length) return _note;
46789 noteEditor.newNote = function(val) {
46790 if (!arguments.length) return _newNote;
46794 return utilRebind(noteEditor, dispatch14, "on");
46797 // modules/modes/select_note.js
46798 function modeSelectNote(context, selectedNoteID) {
46803 var _keybinding = utilKeybinding("select-note");
46804 var _noteEditor = uiNoteEditor(context).on("change", function() {
46805 context.map().pan([0, 0]);
46806 var note = checkSelectedID();
46808 context.ui().sidebar.show(_noteEditor.note(note));
46811 behaviorBreathe(context),
46812 behaviorHover(context),
46813 behaviorSelect(context),
46814 behaviorLasso(context),
46815 modeDragNode(context).behavior,
46816 modeDragNote(context).behavior
46818 var _newFeature = false;
46819 function checkSelectedID() {
46820 if (!services.osm) return;
46821 var note = services.osm.getNote(selectedNoteID);
46823 context.enter(modeBrowse(context));
46827 function selectNote(d3_event, drawn) {
46828 if (!checkSelectedID()) return;
46829 var selection2 = context.surface().selectAll(".layer-notes .note-" + selectedNoteID);
46830 if (selection2.empty()) {
46831 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
46832 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
46833 context.enter(modeBrowse(context));
46836 selection2.classed("selected", true);
46837 context.selectedNoteID(selectedNoteID);
46841 if (context.container().select(".combobox").size()) return;
46842 context.enter(modeBrowse(context));
46844 mode.zoomToSelected = function() {
46845 if (!services.osm) return;
46846 var note = services.osm.getNote(selectedNoteID);
46848 context.map().centerZoomEase(note.loc, 20);
46851 mode.newFeature = function(val) {
46852 if (!arguments.length) return _newFeature;
46856 mode.enter = function() {
46857 var note = checkSelectedID();
46859 _behaviors.forEach(context.install);
46860 _keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
46861 select_default2(document).call(_keybinding);
46863 var sidebar = context.ui().sidebar;
46864 sidebar.show(_noteEditor.note(note).newNote(_newFeature));
46865 sidebar.expand(sidebar.intersects(note.extent()));
46866 context.map().on("drawn.select", selectNote);
46868 mode.exit = function() {
46869 _behaviors.forEach(context.uninstall);
46870 select_default2(document).call(_keybinding.unbind);
46871 context.surface().selectAll(".layer-notes .selected").classed("selected hover", false);
46872 context.map().on("drawn.select", null);
46873 context.ui().sidebar.hide();
46874 context.selectedNoteID(null);
46879 // modules/modes/add_note.js
46880 function modeAddNote(context) {
46884 description: _t.append("modes.add_note.description"),
46885 key: _t("modes.add_note.key")
46887 var behavior = behaviorDraw(context).on("click", add).on("cancel", cancel).on("finish", cancel);
46888 function add(loc) {
46889 var osm = services.osm;
46891 var note = osmNote({ loc, status: "open", comments: [] });
46892 osm.replaceNote(note);
46893 context.map().pan([0, 0]);
46894 context.selectedNoteID(note.id).enter(modeSelectNote(context, note.id).newFeature(true));
46896 function cancel() {
46897 context.enter(modeBrowse(context));
46899 mode.enter = function() {
46900 context.install(behavior);
46902 mode.exit = function() {
46903 context.uninstall(behavior);
46908 // modules/util/jxon.js
46909 var JXON = new function() {
46910 var sValueProp = "keyValue", sAttributesProp = "keyAttributes", sAttrPref = "@", aCache = [], rIsNull = /^\s*$/, rIsBool = /^(?:true|false)$/i;
46911 function parseText(sValue) {
46912 if (rIsNull.test(sValue)) {
46915 if (rIsBool.test(sValue)) {
46916 return sValue.toLowerCase() === "true";
46918 if (isFinite(sValue)) {
46919 return parseFloat(sValue);
46921 if (isFinite(Date.parse(sValue))) {
46922 return new Date(sValue);
46926 function EmptyTree() {
46928 EmptyTree.prototype.toString = function() {
46931 EmptyTree.prototype.valueOf = function() {
46934 function objectify(vValue) {
46935 return vValue === null ? new EmptyTree() : vValue instanceof Object ? vValue : new vValue.constructor(vValue);
46937 function createObjTree(oParentNode, nVerb, bFreeze, bNesteAttr) {
46938 var nLevelStart = aCache.length, bChildren = oParentNode.hasChildNodes(), bAttributes = oParentNode.hasAttributes(), bHighVerb = Boolean(nVerb & 2);
46939 var sProp, vContent, nLength = 0, sCollectedTxt = "", vResult = bHighVerb ? {} : (
46940 /* put here the default value for empty nodes: */
46944 for (var oNode, nItem = 0; nItem < oParentNode.childNodes.length; nItem++) {
46945 oNode = oParentNode.childNodes.item(nItem);
46946 if (oNode.nodeType === 4) {
46947 sCollectedTxt += oNode.nodeValue;
46948 } else if (oNode.nodeType === 3) {
46949 sCollectedTxt += oNode.nodeValue.trim();
46950 } else if (oNode.nodeType === 1 && !oNode.prefix) {
46951 aCache.push(oNode);
46955 var nLevelEnd = aCache.length, vBuiltVal = parseText(sCollectedTxt);
46956 if (!bHighVerb && (bChildren || bAttributes)) {
46957 vResult = nVerb === 0 ? objectify(vBuiltVal) : {};
46959 for (var nElId = nLevelStart; nElId < nLevelEnd; nElId++) {
46960 sProp = aCache[nElId].nodeName.toLowerCase();
46961 vContent = createObjTree(aCache[nElId], nVerb, bFreeze, bNesteAttr);
46962 if (vResult.hasOwnProperty(sProp)) {
46963 if (vResult[sProp].constructor !== Array) {
46964 vResult[sProp] = [vResult[sProp]];
46966 vResult[sProp].push(vContent);
46968 vResult[sProp] = vContent;
46973 var nAttrLen = oParentNode.attributes.length, sAPrefix = bNesteAttr ? "" : sAttrPref, oAttrParent = bNesteAttr ? {} : vResult;
46974 for (var oAttrib, nAttrib = 0; nAttrib < nAttrLen; nLength++, nAttrib++) {
46975 oAttrib = oParentNode.attributes.item(nAttrib);
46976 oAttrParent[sAPrefix + oAttrib.name.toLowerCase()] = parseText(oAttrib.value.trim());
46980 Object.freeze(oAttrParent);
46982 vResult[sAttributesProp] = oAttrParent;
46983 nLength -= nAttrLen - 1;
46986 if (nVerb === 3 || (nVerb === 2 || nVerb === 1 && nLength > 0) && sCollectedTxt) {
46987 vResult[sValueProp] = vBuiltVal;
46988 } else if (!bHighVerb && nLength === 0 && sCollectedTxt) {
46989 vResult = vBuiltVal;
46991 if (bFreeze && (bHighVerb || nLength > 0)) {
46992 Object.freeze(vResult);
46994 aCache.length = nLevelStart;
46997 function loadObjTree(oXMLDoc, oParentEl, oParentObj) {
46998 var vValue, oChild;
46999 if (oParentObj instanceof String || oParentObj instanceof Number || oParentObj instanceof Boolean) {
47000 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toString()));
47001 } else if (oParentObj.constructor === Date) {
47002 oParentEl.appendChild(oXMLDoc.createTextNode(oParentObj.toGMTString()));
47004 for (var sName in oParentObj) {
47005 vValue = oParentObj[sName];
47006 if (isFinite(sName) || vValue instanceof Function) {
47009 if (sName === sValueProp) {
47010 if (vValue !== null && vValue !== true) {
47011 oParentEl.appendChild(oXMLDoc.createTextNode(vValue.constructor === Date ? vValue.toGMTString() : String(vValue)));
47013 } else if (sName === sAttributesProp) {
47014 for (var sAttrib in vValue) {
47015 oParentEl.setAttribute(sAttrib, vValue[sAttrib]);
47017 } else if (sName.charAt(0) === sAttrPref) {
47018 oParentEl.setAttribute(sName.slice(1), vValue);
47019 } else if (vValue.constructor === Array) {
47020 for (var nItem = 0; nItem < vValue.length; nItem++) {
47021 oChild = oXMLDoc.createElement(sName);
47022 loadObjTree(oXMLDoc, oChild, vValue[nItem]);
47023 oParentEl.appendChild(oChild);
47026 oChild = oXMLDoc.createElement(sName);
47027 if (vValue instanceof Object) {
47028 loadObjTree(oXMLDoc, oChild, vValue);
47029 } else if (vValue !== null && vValue !== true) {
47030 oChild.appendChild(oXMLDoc.createTextNode(vValue.toString()));
47032 oParentEl.appendChild(oChild);
47036 this.build = function(oXMLParent, nVerbosity, bFreeze, bNesteAttributes) {
47037 var _nVerb = arguments.length > 1 && typeof nVerbosity === "number" ? nVerbosity & 3 : (
47038 /* put here the default verbosity level: */
47041 return createObjTree(oXMLParent, _nVerb, bFreeze || false, arguments.length > 3 ? bNesteAttributes : _nVerb === 3);
47043 this.unbuild = function(oObjTree) {
47044 var oNewDoc = document.implementation.createDocument("", "", null);
47045 loadObjTree(oNewDoc, oNewDoc, oObjTree);
47048 this.stringify = function(oObjTree) {
47049 return new XMLSerializer().serializeToString(JXON.unbuild(oObjTree));
47053 // modules/ui/conflicts.js
47054 function uiConflicts(context) {
47055 var dispatch14 = dispatch_default("cancel", "save");
47056 var keybinding = utilKeybinding("conflicts");
47059 var _shownConflictIndex;
47060 function keybindingOn() {
47061 select_default2(document).call(keybinding.on("\u238B", cancel, true));
47063 function keybindingOff() {
47064 select_default2(document).call(keybinding.unbind);
47066 function tryAgain() {
47068 dispatch14.call("save");
47070 function cancel() {
47072 dispatch14.call("cancel");
47074 function conflicts(selection2) {
47076 var headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
47077 headerEnter.append("button").attr("class", "fr").attr("title", _t("icons.close")).on("click", cancel).call(svgIcon("#iD-icon-close"));
47078 headerEnter.append("h2").call(_t.append("save.conflict.header"));
47079 var bodyEnter = selection2.selectAll(".body").data([0]).enter().append("div").attr("class", "body fillL");
47080 var conflictsHelpEnter = bodyEnter.append("div").attr("class", "conflicts-help").call(_t.append("save.conflict.help"));
47081 var changeset = new osmChangeset();
47082 delete changeset.id;
47083 var data = JXON.stringify(changeset.osmChangeJXON(_origChanges));
47084 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
47085 var fileName = "changes.osc";
47086 var linkEnter = conflictsHelpEnter.selectAll(".download-changes").append("a").attr("class", "download-changes");
47087 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
47088 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("save.conflict.download_changes"));
47089 bodyEnter.append("div").attr("class", "conflict-container fillL3").call(showConflict, 0);
47090 bodyEnter.append("div").attr("class", "conflicts-done").attr("opacity", 0).style("display", "none").call(_t.append("save.conflict.done"));
47091 var buttonsEnter = bodyEnter.append("div").attr("class", "buttons col12 joined conflicts-buttons");
47092 buttonsEnter.append("button").attr("disabled", _conflictList.length > 1).attr("class", "action conflicts-button col6").call(_t.append("save.title")).on("click.try_again", tryAgain);
47093 buttonsEnter.append("button").attr("class", "secondary-action conflicts-button col6").call(_t.append("confirm.cancel")).on("click.cancel", cancel);
47095 function showConflict(selection2, index) {
47096 index = utilWrap(index, _conflictList.length);
47097 _shownConflictIndex = index;
47098 var parent = select_default2(selection2.node().parentNode);
47099 if (index === _conflictList.length - 1) {
47100 window.setTimeout(function() {
47101 parent.select(".conflicts-button").attr("disabled", null);
47102 parent.select(".conflicts-done").transition().attr("opacity", 1).style("display", "block");
47105 var conflict = selection2.selectAll(".conflict").data([_conflictList[index]]);
47106 conflict.exit().remove();
47107 var conflictEnter = conflict.enter().append("div").attr("class", "conflict");
47108 conflictEnter.append("h4").attr("class", "conflict-count").call(_t.append("save.conflict.count", { num: index + 1, total: _conflictList.length }));
47109 conflictEnter.append("a").attr("class", "conflict-description").attr("href", "#").text(function(d2) {
47111 }).on("click", function(d3_event, d2) {
47112 d3_event.preventDefault();
47113 zoomToEntity(d2.id);
47115 var details = conflictEnter.append("div").attr("class", "conflict-detail-container");
47116 details.append("ul").attr("class", "conflict-detail-list").selectAll("li").data(function(d2) {
47117 return d2.details || [];
47118 }).enter().append("li").attr("class", "conflict-detail-item").html(function(d2) {
47121 details.append("div").attr("class", "conflict-choices").call(addChoices);
47122 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) {
47123 return i3 === 0 && index === 0 || i3 === 1 && index === _conflictList.length - 1 || null;
47124 }).on("click", function(d3_event, d2) {
47125 d3_event.preventDefault();
47126 var container = parent.selectAll(".conflict-container");
47127 var sign2 = d2 === "previous" ? -1 : 1;
47128 container.selectAll(".conflict").remove();
47129 container.call(showConflict, index + sign2);
47130 }).each(function(d2) {
47131 _t.append("save.conflict." + d2)(select_default2(this));
47134 function addChoices(selection2) {
47135 var choices = selection2.append("ul").attr("class", "layer-list").selectAll("li").data(function(d2) {
47136 return d2.choices || [];
47138 var choicesEnter = choices.enter().append("li").attr("class", "layer");
47139 var labelEnter = choicesEnter.append("label");
47140 labelEnter.append("input").attr("type", "radio").attr("name", function(d2) {
47142 }).on("change", function(d3_event, d2) {
47143 var ul = this.parentNode.parentNode.parentNode;
47144 ul.__data__.chosen = d2.id;
47145 choose(d3_event, ul, d2);
47147 labelEnter.append("span").text(function(d2) {
47150 choicesEnter.merge(choices).each(function(d2) {
47151 var ul = this.parentNode;
47152 if (ul.__data__.chosen === d2.id) {
47153 choose(null, ul, d2);
47157 function choose(d3_event, ul, datum2) {
47158 if (d3_event) d3_event.preventDefault();
47159 select_default2(ul).selectAll("li").classed("active", function(d2) {
47160 return d2 === datum2;
47161 }).selectAll("input").property("checked", function(d2) {
47162 return d2 === datum2;
47164 var extent = geoExtent();
47166 entity = context.graph().hasEntity(datum2.id);
47167 if (entity) extent._extend(entity.extent(context.graph()));
47169 entity = context.graph().hasEntity(datum2.id);
47170 if (entity) extent._extend(entity.extent(context.graph()));
47171 zoomToEntity(datum2.id, extent);
47173 function zoomToEntity(id2, extent) {
47174 context.surface().selectAll(".hover").classed("hover", false);
47175 var entity = context.graph().hasEntity(id2);
47178 context.map().trimmedExtent(extent);
47180 context.map().zoomToEase(entity);
47182 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
47185 conflicts.conflictList = function(_2) {
47186 if (!arguments.length) return _conflictList;
47187 _conflictList = _2;
47190 conflicts.origChanges = function(_2) {
47191 if (!arguments.length) return _origChanges;
47195 conflicts.shownEntityIds = function() {
47196 if (_conflictList && typeof _shownConflictIndex === "number") {
47197 return [_conflictList[_shownConflictIndex].id];
47201 return utilRebind(conflicts, dispatch14, "on");
47204 // modules/ui/confirm.js
47205 function uiConfirm(selection2) {
47206 var modalSelection = uiModal(selection2);
47207 modalSelection.select(".modal").classed("modal-alert", true);
47208 var section = modalSelection.select(".content");
47209 section.append("div").attr("class", "modal-section header");
47210 section.append("div").attr("class", "modal-section message-text");
47211 var buttons = section.append("div").attr("class", "modal-section buttons cf");
47212 modalSelection.okButton = function() {
47213 buttons.append("button").attr("class", "button ok-button action").on("click.confirm", function() {
47214 modalSelection.remove();
47215 }).call(_t.append("confirm.okay")).node().focus();
47216 return modalSelection;
47218 return modalSelection;
47221 // modules/ui/commit.js
47222 var import_fast_deep_equal10 = __toESM(require_fast_deep_equal());
47224 // modules/ui/popover.js
47225 var _popoverID = 0;
47226 function uiPopover(klass) {
47227 var _id = _popoverID++;
47228 var _anchorSelection = select_default2(null);
47229 var popover = function(selection2) {
47230 _anchorSelection = selection2;
47231 selection2.each(setup);
47233 var _animation = utilFunctor(false);
47234 var _placement = utilFunctor("top");
47235 var _alignment = utilFunctor("center");
47236 var _scrollContainer = utilFunctor(select_default2(null));
47238 var _displayType = utilFunctor("");
47239 var _hasArrow = utilFunctor(true);
47240 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
47241 popover.displayType = function(val) {
47242 if (arguments.length) {
47243 _displayType = utilFunctor(val);
47246 return _displayType;
47249 popover.hasArrow = function(val) {
47250 if (arguments.length) {
47251 _hasArrow = utilFunctor(val);
47257 popover.placement = function(val) {
47258 if (arguments.length) {
47259 _placement = utilFunctor(val);
47265 popover.alignment = function(val) {
47266 if (arguments.length) {
47267 _alignment = utilFunctor(val);
47273 popover.scrollContainer = function(val) {
47274 if (arguments.length) {
47275 _scrollContainer = utilFunctor(val);
47278 return _scrollContainer;
47281 popover.content = function(val) {
47282 if (arguments.length) {
47289 popover.isShown = function() {
47290 var popoverSelection = _anchorSelection.select(".popover-" + _id);
47291 return !popoverSelection.empty() && popoverSelection.classed("in");
47293 popover.show = function() {
47294 _anchorSelection.each(show);
47296 popover.updateContent = function() {
47297 _anchorSelection.each(updateContent);
47299 popover.hide = function() {
47300 _anchorSelection.each(hide);
47302 popover.toggle = function() {
47303 _anchorSelection.each(toggle);
47305 popover.destroy = function(selection2, selector) {
47306 selector = selector || ".popover-" + _id;
47307 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() {
47308 return this.getAttribute("data-original-title") || this.getAttribute("title");
47309 }).attr("data-original-title", null).selectAll(selector).remove();
47311 popover.destroyAny = function(selection2) {
47312 selection2.call(popover.destroy, ".popover");
47315 var anchor = select_default2(this);
47316 var animate = _animation.apply(this, arguments);
47317 var popoverSelection = anchor.selectAll(".popover-" + _id).data([0]);
47318 var enter = popoverSelection.enter().append("div").attr("class", "popover popover-" + _id + " " + (klass ? klass : "")).classed("arrowed", _hasArrow.apply(this, arguments));
47319 enter.append("div").attr("class", "popover-arrow");
47320 enter.append("div").attr("class", "popover-inner");
47321 popoverSelection = enter.merge(popoverSelection);
47323 popoverSelection.classed("fade", true);
47325 var display = _displayType.apply(this, arguments);
47326 if (display === "hover") {
47327 var _lastNonMouseEnterTime;
47328 anchor.on(_pointerPrefix + "enter.popover", function(d3_event) {
47329 if (d3_event.pointerType) {
47330 if (d3_event.pointerType !== "mouse") {
47331 _lastNonMouseEnterTime = d3_event.timeStamp;
47333 } else if (_lastNonMouseEnterTime && d3_event.timeStamp - _lastNonMouseEnterTime < 1500) {
47337 if (d3_event.buttons !== 0) return;
47338 show.apply(this, arguments);
47339 }).on(_pointerPrefix + "leave.popover", function() {
47340 hide.apply(this, arguments);
47341 }).on("focus.popover", function() {
47342 show.apply(this, arguments);
47343 }).on("blur.popover", function() {
47344 hide.apply(this, arguments);
47346 } else if (display === "clickFocus") {
47347 anchor.on(_pointerPrefix + "down.popover", function(d3_event) {
47348 d3_event.preventDefault();
47349 d3_event.stopPropagation();
47350 }).on(_pointerPrefix + "up.popover", function(d3_event) {
47351 d3_event.preventDefault();
47352 d3_event.stopPropagation();
47353 }).on("click.popover", toggle);
47354 popoverSelection.attr("tabindex", 0).on("blur.popover", function() {
47355 anchor.each(function() {
47356 hide.apply(this, arguments);
47362 var anchor = select_default2(this);
47363 var popoverSelection = anchor.selectAll(".popover-" + _id);
47364 if (popoverSelection.empty()) {
47365 anchor.call(popover.destroy);
47366 anchor.each(setup);
47367 popoverSelection = anchor.selectAll(".popover-" + _id);
47369 popoverSelection.classed("in", true);
47370 var displayType = _displayType.apply(this, arguments);
47371 if (displayType === "clickFocus") {
47372 anchor.classed("active", true);
47373 popoverSelection.node().focus();
47375 anchor.each(updateContent);
47377 function updateContent() {
47378 var anchor = select_default2(this);
47380 anchor.selectAll(".popover-" + _id + " > .popover-inner").call(_content.apply(this, arguments));
47382 updatePosition.apply(this, arguments);
47383 updatePosition.apply(this, arguments);
47384 updatePosition.apply(this, arguments);
47386 function updatePosition() {
47387 var anchor = select_default2(this);
47388 var popoverSelection = anchor.selectAll(".popover-" + _id);
47389 var scrollContainer = _scrollContainer && _scrollContainer.apply(this, arguments);
47390 var scrollNode = scrollContainer && !scrollContainer.empty() && scrollContainer.node();
47391 var scrollLeft = scrollNode ? scrollNode.scrollLeft : 0;
47392 var scrollTop = scrollNode ? scrollNode.scrollTop : 0;
47393 var placement = _placement.apply(this, arguments);
47394 popoverSelection.classed("left", false).classed("right", false).classed("top", false).classed("bottom", false).classed(placement, true);
47395 var alignment = _alignment.apply(this, arguments);
47396 var alignFactor = 0.5;
47397 if (alignment === "leading") {
47399 } else if (alignment === "trailing") {
47402 var anchorFrame = getFrame(anchor.node());
47403 var popoverFrame = getFrame(popoverSelection.node());
47405 switch (placement) {
47408 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
47409 y: anchorFrame.y - popoverFrame.h
47414 x: anchorFrame.x + (anchorFrame.w - popoverFrame.w) * alignFactor,
47415 y: anchorFrame.y + anchorFrame.h
47420 x: anchorFrame.x - popoverFrame.w,
47421 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
47426 x: anchorFrame.x + anchorFrame.w,
47427 y: anchorFrame.y + (anchorFrame.h - popoverFrame.h) * alignFactor
47432 if (scrollNode && (placement === "top" || placement === "bottom")) {
47433 var initialPosX = position.x;
47434 if (position.x + popoverFrame.w > scrollNode.offsetWidth - 10) {
47435 position.x = scrollNode.offsetWidth - 10 - popoverFrame.w;
47436 } else if (position.x < 10) {
47439 var arrow = anchor.selectAll(".popover-" + _id + " > .popover-arrow");
47440 var arrowPosX = Math.min(Math.max(popoverFrame.w / 2 - (position.x - initialPosX), 10), popoverFrame.w - 10);
47441 arrow.style("left", ~~arrowPosX + "px");
47443 popoverSelection.style("left", ~~position.x + "px").style("top", ~~position.y + "px");
47445 popoverSelection.style("left", null).style("top", null);
47447 function getFrame(node) {
47448 var positionStyle = select_default2(node).style("position");
47449 if (positionStyle === "absolute" || positionStyle === "static") {
47451 x: node.offsetLeft - scrollLeft,
47452 y: node.offsetTop - scrollTop,
47453 w: node.offsetWidth,
47454 h: node.offsetHeight
47460 w: node.offsetWidth,
47461 h: node.offsetHeight
47467 var anchor = select_default2(this);
47468 if (_displayType.apply(this, arguments) === "clickFocus") {
47469 anchor.classed("active", false);
47471 anchor.selectAll(".popover-" + _id).classed("in", false);
47473 function toggle() {
47474 if (select_default2(this).select(".popover-" + _id).classed("in")) {
47475 hide.apply(this, arguments);
47477 show.apply(this, arguments);
47483 // modules/ui/tooltip.js
47484 function uiTooltip(klass) {
47485 var tooltip = uiPopover((klass || "") + " tooltip").displayType("hover");
47486 var _title = function() {
47487 var title = this.getAttribute("data-original-title");
47491 title = this.getAttribute("title");
47492 this.removeAttribute("title");
47493 this.setAttribute("data-original-title", title);
47497 var _heading = utilFunctor(null);
47498 var _keys = utilFunctor(null);
47499 tooltip.title = function(val) {
47500 if (!arguments.length) return _title;
47501 _title = utilFunctor(val);
47504 tooltip.heading = function(val) {
47505 if (!arguments.length) return _heading;
47506 _heading = utilFunctor(val);
47509 tooltip.keys = function(val) {
47510 if (!arguments.length) return _keys;
47511 _keys = utilFunctor(val);
47514 tooltip.content(function() {
47515 var heading2 = _heading.apply(this, arguments);
47516 var text = _title.apply(this, arguments);
47517 var keys2 = _keys.apply(this, arguments);
47518 var headingCallback = typeof heading2 === "function" ? heading2 : (s2) => s2.text(heading2);
47519 var textCallback = typeof text === "function" ? text : (s2) => s2.text(text);
47520 return function(selection2) {
47521 var headingSelect = selection2.selectAll(".tooltip-heading").data(heading2 ? [heading2] : []);
47522 headingSelect.exit().remove();
47523 headingSelect.enter().append("div").attr("class", "tooltip-heading").merge(headingSelect).text("").call(headingCallback);
47524 var textSelect = selection2.selectAll(".tooltip-text").data(text ? [text] : []);
47525 textSelect.exit().remove();
47526 textSelect.enter().append("div").attr("class", "tooltip-text").merge(textSelect).text("").call(textCallback);
47527 var keyhintWrap = selection2.selectAll(".keyhint-wrap").data(keys2 && keys2.length ? [0] : []);
47528 keyhintWrap.exit().remove();
47529 var keyhintWrapEnter = keyhintWrap.enter().append("div").attr("class", "keyhint-wrap");
47530 keyhintWrapEnter.append("span").call(_t.append("tooltip_keyhint"));
47531 keyhintWrap = keyhintWrapEnter.merge(keyhintWrap);
47532 keyhintWrap.selectAll("kbd.shortcut").data(keys2 && keys2.length ? keys2 : []).enter().append("kbd").attr("class", "shortcut").text(function(d2) {
47540 // modules/ui/combobox.js
47541 var _comboHideTimerID;
47542 function uiCombobox(context, klass) {
47543 var dispatch14 = dispatch_default("accept", "cancel", "update");
47544 var container = context.container();
47545 var _suggestions = [];
47548 var _selected = null;
47549 var _canAutocomplete = true;
47550 var _caseSensitive = false;
47551 var _cancelFetch = false;
47554 var _mouseEnterHandler, _mouseLeaveHandler;
47555 var _fetcher = function(val, cb) {
47556 cb(_data.filter(function(d2) {
47557 var terms = d2.terms || [];
47558 terms.push(d2.value);
47560 terms.push(d2.key);
47562 return terms.some(function(term) {
47563 return term.toString().toLowerCase().indexOf(val.toLowerCase()) !== -1;
47567 var combobox = function(input, attachTo) {
47568 if (!input || input.empty()) return;
47569 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() {
47570 var parent = this.parentNode;
47571 var sibling = this.nextSibling;
47572 select_default2(parent).selectAll(".combobox-caret").filter(function(d2) {
47573 return d2 === input.node();
47574 }).data([input.node()]).enter().insert("div", function() {
47576 }).attr("class", "combobox-caret").on("mousedown.combo-caret", function(d3_event) {
47577 d3_event.preventDefault();
47578 input.node().focus();
47579 mousedown(d3_event);
47580 }).on("mouseup.combo-caret", function(d3_event) {
47581 d3_event.preventDefault();
47585 function mousedown(d3_event) {
47586 if (d3_event.button !== 0) return;
47587 if (input.classed("disabled")) return;
47588 _tDown = +/* @__PURE__ */ new Date();
47589 var start2 = input.property("selectionStart");
47590 var end = input.property("selectionEnd");
47591 if (start2 !== end) {
47592 var val = utilGetSetValue(input);
47593 input.node().setSelectionRange(val.length, val.length);
47596 input.on("mouseup.combo-input", mouseup);
47598 function mouseup(d3_event) {
47599 input.on("mouseup.combo-input", null);
47600 if (d3_event.button !== 0) return;
47601 if (input.classed("disabled")) return;
47602 if (input.node() !== document.activeElement) return;
47603 var start2 = input.property("selectionStart");
47604 var end = input.property("selectionEnd");
47605 if (start2 !== end) return;
47606 var combo = container.selectAll(".combobox");
47607 if (combo.empty() || combo.datum() !== input.node()) {
47608 var tOrig = _tDown;
47609 window.setTimeout(function() {
47610 if (tOrig !== _tDown) return;
47611 fetchComboData("", function() {
47621 fetchComboData("");
47624 _comboHideTimerID = window.setTimeout(hide, 75);
47628 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) {
47629 d3_event.preventDefault();
47631 container.on("scroll.combo-scroll", render, true);
47634 if (_comboHideTimerID) {
47635 window.clearTimeout(_comboHideTimerID);
47636 _comboHideTimerID = void 0;
47638 container.selectAll(".combobox").remove();
47639 container.on("scroll.combo-scroll", null);
47641 function keydown(d3_event) {
47642 var shown = !container.selectAll(".combobox").empty();
47643 var tagName = input.node() ? input.node().tagName.toLowerCase() : "";
47644 switch (d3_event.keyCode) {
47648 d3_event.stopPropagation();
47651 input.on("input.combo-input", function() {
47652 var start2 = input.property("selectionStart");
47653 input.node().setSelectionRange(start2, start2);
47654 input.on("input.combo-input", change);
47662 d3_event.preventDefault();
47663 d3_event.stopPropagation();
47667 if (tagName === "textarea" && !shown) return;
47668 d3_event.preventDefault();
47669 if (tagName === "input" && !shown) {
47675 if (tagName === "textarea" && !shown) return;
47676 d3_event.preventDefault();
47677 if (tagName === "input" && !shown) {
47684 function keyup(d3_event) {
47685 switch (d3_event.keyCode) {
47691 function change(doAutoComplete) {
47692 if (doAutoComplete === void 0) doAutoComplete = true;
47693 fetchComboData(value(), function(skipAutosuggest) {
47695 var val = input.property("value");
47696 if (_suggestions.length) {
47697 if (doAutoComplete && !skipAutosuggest && input.property("selectionEnd") === val.length) {
47698 _selected = tryAutocomplete();
47705 var combo = container.selectAll(".combobox");
47706 if (combo.empty()) {
47715 function nav(dir) {
47716 if (_suggestions.length) {
47718 for (var i3 = 0; i3 < _suggestions.length; i3++) {
47719 if (_selected && _suggestions[i3].value === _selected) {
47724 index = Math.max(Math.min(index + dir, _suggestions.length - 1), 0);
47725 _selected = _suggestions[index].value;
47726 utilGetSetValue(input, _selected);
47727 dispatch14.call("update");
47732 function ensureVisible() {
47733 var combo = container.selectAll(".combobox");
47734 if (combo.empty()) return;
47735 var containerRect = container.node().getBoundingClientRect();
47736 var comboRect = combo.node().getBoundingClientRect();
47737 if (comboRect.bottom > containerRect.bottom) {
47738 var node = attachTo ? attachTo.node() : input.node();
47739 node.scrollIntoView({ behavior: "instant", block: "center" });
47742 var selected = combo.selectAll(".combobox-option.selected").node();
47744 selected.scrollIntoView({ behavior: "smooth", block: "nearest" });
47748 var value2 = input.property("value");
47749 var start2 = input.property("selectionStart");
47750 var end = input.property("selectionEnd");
47751 if (start2 && end) {
47752 value2 = value2.substring(0, start2);
47756 function fetchComboData(v2, cb) {
47757 _cancelFetch = false;
47758 _fetcher.call(input, v2, function(results, skipAutosuggest) {
47759 if (_cancelFetch) return;
47760 _suggestions = results;
47761 results.forEach(function(d2) {
47762 _fetched[d2.value] = d2;
47765 cb(skipAutosuggest);
47769 function tryAutocomplete() {
47770 if (!_canAutocomplete) return;
47771 var val = _caseSensitive ? value() : value().toLowerCase();
47773 if (isFinite(val)) return;
47774 const suggestionValues = [];
47775 _suggestions.forEach((s2) => {
47776 suggestionValues.push(s2.value);
47777 if (s2.key && s2.key !== s2.value) {
47778 suggestionValues.push(s2.key);
47781 var bestIndex = -1;
47782 for (var i3 = 0; i3 < suggestionValues.length; i3++) {
47783 var suggestion = suggestionValues[i3];
47784 var compare2 = _caseSensitive ? suggestion : suggestion.toLowerCase();
47785 if (compare2 === val) {
47788 } else if (bestIndex === -1 && compare2.indexOf(val) === 0) {
47792 if (bestIndex !== -1) {
47793 var bestVal = suggestionValues[bestIndex];
47794 input.property("value", bestVal);
47795 input.node().setSelectionRange(val.length, bestVal.length);
47796 dispatch14.call("update");
47800 function render() {
47801 if (_suggestions.length < _minItems || document.activeElement !== input.node()) {
47805 var shown = !container.selectAll(".combobox").empty();
47806 if (!shown) return;
47807 var combo = container.selectAll(".combobox");
47808 var options2 = combo.selectAll(".combobox-option").data(_suggestions, function(d2) {
47811 options2.exit().remove();
47812 options2.enter().append("a").attr("class", function(d2) {
47813 return "combobox-option " + (d2.klass || "");
47814 }).attr("title", function(d2) {
47816 }).each(function(d2) {
47818 d2.display(select_default2(this));
47820 select_default2(this).text(d2.value);
47822 }).on("mouseenter", _mouseEnterHandler).on("mouseleave", _mouseLeaveHandler).merge(options2).classed("selected", function(d2) {
47823 return d2.value === _selected || d2.key === _selected;
47824 }).on("click.combo-option", accept).order();
47825 var node = attachTo ? attachTo.node() : input.node();
47826 var containerRect = container.node().getBoundingClientRect();
47827 var rect = node.getBoundingClientRect();
47828 combo.style("left", rect.left + 5 - containerRect.left + "px").style("width", rect.width - 10 + "px").style("top", rect.height + rect.top - containerRect.top + "px");
47830 function accept(d3_event, d2) {
47831 _cancelFetch = true;
47832 var thiz = input.node();
47834 utilGetSetValue(input, d2.value);
47835 utilTriggerEvent(input, "change");
47837 var val = utilGetSetValue(input);
47838 thiz.setSelectionRange(val.length, val.length);
47840 d2 = _fetched[val];
47842 dispatch14.call("accept", thiz, d2, val);
47845 function cancel() {
47846 _cancelFetch = true;
47847 var thiz = input.node();
47848 var val = utilGetSetValue(input);
47849 var start2 = input.property("selectionStart");
47850 var end = input.property("selectionEnd");
47851 val = val.slice(0, start2) + val.slice(end);
47852 utilGetSetValue(input, val);
47853 thiz.setSelectionRange(val.length, val.length);
47854 dispatch14.call("cancel", thiz);
47858 combobox.canAutocomplete = function(val) {
47859 if (!arguments.length) return _canAutocomplete;
47860 _canAutocomplete = val;
47863 combobox.caseSensitive = function(val) {
47864 if (!arguments.length) return _caseSensitive;
47865 _caseSensitive = val;
47868 combobox.data = function(val) {
47869 if (!arguments.length) return _data;
47873 combobox.fetcher = function(val) {
47874 if (!arguments.length) return _fetcher;
47878 combobox.minItems = function(val) {
47879 if (!arguments.length) return _minItems;
47883 combobox.itemsMouseEnter = function(val) {
47884 if (!arguments.length) return _mouseEnterHandler;
47885 _mouseEnterHandler = val;
47888 combobox.itemsMouseLeave = function(val) {
47889 if (!arguments.length) return _mouseLeaveHandler;
47890 _mouseLeaveHandler = val;
47893 return utilRebind(combobox, dispatch14, "on");
47895 uiCombobox.off = function(input, context) {
47896 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);
47897 context.container().on("scroll.combo-scroll", null);
47900 // modules/ui/intro/helper.js
47901 function pointBox(loc, context) {
47902 var rect = context.surfaceRect();
47903 var point = context.curtainProjection(loc);
47905 left: point[0] + rect.left - 40,
47906 top: point[1] + rect.top - 60,
47911 function pad(locOrBox, padding, context) {
47913 if (locOrBox instanceof Array) {
47914 var rect = context.surfaceRect();
47915 var point = context.curtainProjection(locOrBox);
47917 left: point[0] + rect.left,
47918 top: point[1] + rect.top
47924 left: box.left - padding,
47925 top: box.top - padding,
47926 width: (box.width || 0) + 2 * padding,
47927 height: (box.width || 0) + 2 * padding
47930 function icon(name, svgklass, useklass) {
47931 return '<svg class="icon ' + (svgklass || "") + '"><use xlink:href="' + name + '"' + (useklass ? ' class="' + useklass + '"' : "") + "></use></svg>";
47933 var helpStringReplacements;
47934 function helpHtml(id2, replacements) {
47935 if (!helpStringReplacements) {
47936 helpStringReplacements = {
47937 // insert icons corresponding to various UI elements
47938 point_icon: icon("#iD-icon-point", "inline"),
47939 line_icon: icon("#iD-icon-line", "inline"),
47940 area_icon: icon("#iD-icon-area", "inline"),
47941 note_icon: icon("#iD-icon-note", "inline add-note"),
47942 plus: icon("#iD-icon-plus", "inline"),
47943 minus: icon("#iD-icon-minus", "inline"),
47944 layers_icon: icon("#iD-icon-layers", "inline"),
47945 data_icon: icon("#iD-icon-data", "inline"),
47946 inspect: icon("#iD-icon-inspect", "inline"),
47947 help_icon: icon("#iD-icon-help", "inline"),
47948 undo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo", "inline"),
47949 redo_icon: icon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-undo" : "#iD-icon-redo", "inline"),
47950 save_icon: icon("#iD-icon-save", "inline"),
47952 circularize_icon: icon("#iD-operation-circularize", "inline operation"),
47953 continue_icon: icon("#iD-operation-continue", "inline operation"),
47954 copy_icon: icon("#iD-operation-copy", "inline operation"),
47955 delete_icon: icon("#iD-operation-delete", "inline operation"),
47956 disconnect_icon: icon("#iD-operation-disconnect", "inline operation"),
47957 downgrade_icon: icon("#iD-operation-downgrade", "inline operation"),
47958 extract_icon: icon("#iD-operation-extract", "inline operation"),
47959 merge_icon: icon("#iD-operation-merge", "inline operation"),
47960 move_icon: icon("#iD-operation-move", "inline operation"),
47961 orthogonalize_icon: icon("#iD-operation-orthogonalize", "inline operation"),
47962 paste_icon: icon("#iD-operation-paste", "inline operation"),
47963 reflect_long_icon: icon("#iD-operation-reflect-long", "inline operation"),
47964 reflect_short_icon: icon("#iD-operation-reflect-short", "inline operation"),
47965 reverse_icon: icon("#iD-operation-reverse", "inline operation"),
47966 rotate_icon: icon("#iD-operation-rotate", "inline operation"),
47967 split_icon: icon("#iD-operation-split", "inline operation"),
47968 straighten_icon: icon("#iD-operation-straighten", "inline operation"),
47969 // interaction icons
47970 leftclick: icon("#iD-walkthrough-mouse-left", "inline operation"),
47971 rightclick: icon("#iD-walkthrough-mouse-right", "inline operation"),
47972 mousewheel_icon: icon("#iD-walkthrough-mousewheel", "inline operation"),
47973 tap_icon: icon("#iD-walkthrough-tap", "inline operation"),
47974 doubletap_icon: icon("#iD-walkthrough-doubletap", "inline operation"),
47975 longpress_icon: icon("#iD-walkthrough-longpress", "inline operation"),
47976 touchdrag_icon: icon("#iD-walkthrough-touchdrag", "inline operation"),
47977 pinch_icon: icon("#iD-walkthrough-pinch-apart", "inline operation"),
47978 // insert keys; may be localized and platform-dependent
47979 shift: uiCmd.display("\u21E7"),
47980 alt: uiCmd.display("\u2325"),
47981 return: uiCmd.display("\u21B5"),
47982 esc: _t.html("shortcuts.key.esc"),
47983 space: _t.html("shortcuts.key.space"),
47984 add_note_key: _t.html("modes.add_note.key"),
47985 help_key: _t.html("help.key"),
47986 shortcuts_key: _t.html("shortcuts.toggle.key"),
47987 // reference localized UI labels directly so that they'll always match
47988 save: _t.html("save.title"),
47989 undo: _t.html("undo.title"),
47990 redo: _t.html("redo.title"),
47991 upload: _t.html("commit.save"),
47992 point: _t.html("modes.add_point.title"),
47993 line: _t.html("modes.add_line.title"),
47994 area: _t.html("modes.add_area.title"),
47995 note: _t.html("modes.add_note.label"),
47996 circularize: _t.html("operations.circularize.title"),
47997 continue: _t.html("operations.continue.title"),
47998 copy: _t.html("operations.copy.title"),
47999 delete: _t.html("operations.delete.title"),
48000 disconnect: _t.html("operations.disconnect.title"),
48001 downgrade: _t.html("operations.downgrade.title"),
48002 extract: _t.html("operations.extract.title"),
48003 merge: _t.html("operations.merge.title"),
48004 move: _t.html("operations.move.title"),
48005 orthogonalize: _t.html("operations.orthogonalize.title"),
48006 paste: _t.html("operations.paste.title"),
48007 reflect_long: _t.html("operations.reflect.title.long"),
48008 reflect_short: _t.html("operations.reflect.title.short"),
48009 reverse: _t.html("operations.reverse.title"),
48010 rotate: _t.html("operations.rotate.title"),
48011 split: _t.html("operations.split.title"),
48012 straighten: _t.html("operations.straighten.title"),
48013 map_data: _t.html("map_data.title"),
48014 osm_notes: _t.html("map_data.layers.notes.title"),
48015 fields: _t.html("inspector.fields"),
48016 tags: _t.html("inspector.tags"),
48017 relations: _t.html("inspector.relations"),
48018 new_relation: _t.html("inspector.new_relation"),
48019 turn_restrictions: _t.html("_tagging.presets.fields.restrictions.label"),
48020 background_settings: _t.html("background.description"),
48021 imagery_offset: _t.html("background.fix_misalignment"),
48022 start_the_walkthrough: _t.html("splash.walkthrough"),
48023 help: _t.html("help.title"),
48024 ok: _t.html("intro.ok")
48026 for (var key in helpStringReplacements) {
48027 helpStringReplacements[key] = { html: helpStringReplacements[key] };
48031 if (replacements) {
48032 reps = Object.assign(replacements, helpStringReplacements);
48034 reps = helpStringReplacements;
48036 return _t.html(id2, reps).replace(/\`(.*?)\`/g, "<kbd>$1</kbd>");
48038 function slugify(text) {
48039 return text.toString().toLowerCase().replace(/\s+/g, "-").replace(/[^\w\-]+/g, "").replace(/\-\-+/g, "-").replace(/^-+/, "").replace(/-+$/, "");
48041 var missingStrings = {};
48042 function checkKey(key, text) {
48043 if (_t(key, { default: void 0 }) === void 0) {
48044 if (missingStrings.hasOwnProperty(key)) return;
48045 missingStrings[key] = text;
48046 var missing = key + ": " + text;
48047 if (typeof console !== "undefined") console.log(missing);
48050 function localize(obj) {
48052 var name = obj.tags && obj.tags.name;
48054 key = "intro.graph.name." + slugify(name);
48055 obj.tags.name = _t(key, { default: name });
48056 checkKey(key, name);
48058 var street = obj.tags && obj.tags["addr:street"];
48060 key = "intro.graph.name." + slugify(street);
48061 obj.tags["addr:street"] = _t(key, { default: street });
48062 checkKey(key, street);
48077 addrTags.forEach(function(k2) {
48078 var key2 = "intro.graph." + k2;
48079 var tag2 = "addr:" + k2;
48080 var val = obj.tags && obj.tags[tag2];
48081 var str = _t(key2, { default: val });
48083 if (str.match(/^<.*>$/) !== null) {
48084 delete obj.tags[tag2];
48086 obj.tags[tag2] = str;
48093 function isMostlySquare(points) {
48094 var threshold = 15;
48095 var lowerBound = Math.cos((90 - threshold) * Math.PI / 180);
48096 var upperBound = Math.cos(threshold * Math.PI / 180);
48097 for (var i3 = 0; i3 < points.length; i3++) {
48098 var a2 = points[(i3 - 1 + points.length) % points.length];
48099 var origin = points[i3];
48100 var b2 = points[(i3 + 1) % points.length];
48101 var dotp = geoVecNormalizedDot(a2, b2, origin);
48102 var mag = Math.abs(dotp);
48103 if (mag > lowerBound && mag < upperBound) {
48109 function selectMenuItem(context, operation2) {
48110 return context.container().select(".edit-menu .edit-menu-item-" + operation2);
48112 function transitionTime(point1, point2) {
48113 var distance = geoSphericalDistance(point1, point2);
48114 if (distance === 0) {
48116 } else if (distance < 80) {
48123 // modules/ui/field_help.js
48124 function uiFieldHelp(context, fieldName) {
48125 var fieldHelp = {};
48126 var _inspector = select_default2(null);
48127 var _wrap = select_default2(null);
48128 var _body = select_default2(null);
48129 var fieldHelpKeys = {
48157 "indirect_example",
48162 var fieldHelpHeadings = {};
48163 var replacements = {
48164 distField: { html: _t.html("restriction.controls.distance") },
48165 viaField: { html: _t.html("restriction.controls.via") },
48166 fromShadow: { html: icon("#iD-turn-shadow", "inline shadow from") },
48167 allowShadow: { html: icon("#iD-turn-shadow", "inline shadow allow") },
48168 restrictShadow: { html: icon("#iD-turn-shadow", "inline shadow restrict") },
48169 onlyShadow: { html: icon("#iD-turn-shadow", "inline shadow only") },
48170 allowTurn: { html: icon("#iD-turn-yes", "inline turn") },
48171 restrictTurn: { html: icon("#iD-turn-no", "inline turn") },
48172 onlyTurn: { html: icon("#iD-turn-only", "inline turn") }
48174 var docs = fieldHelpKeys[fieldName].map(function(key) {
48175 var helpkey = "help.field." + fieldName + "." + key[0];
48176 var text = key[1].reduce(function(all, part) {
48177 var subkey = helpkey + "." + part;
48178 var depth = fieldHelpHeadings[subkey];
48179 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
48180 return all + hhh + _t.html(subkey, replacements) + "\n\n";
48184 title: _t.html(helpkey + ".title"),
48185 html: marked(text.trim())
48190 _body.classed("hide", false).style("opacity", "0").transition().duration(200).style("opacity", "1");
48193 _body.classed("hide", true).transition().duration(200).style("opacity", "0").on("end", function() {
48194 _body.classed("hide", true);
48197 function clickHelp(index) {
48198 var d2 = docs[index];
48199 var tkeys = fieldHelpKeys[fieldName][index][1];
48200 _body.selectAll(".field-help-nav-item").classed("active", function(d4, i3) {
48201 return i3 === index;
48203 var content = _body.selectAll(".field-help-content").html(d2.html);
48204 content.selectAll("p").attr("class", function(d4, i3) {
48207 if (d2.key === "help.field.restrictions.inspecting") {
48208 content.insert("img", "p.from_shadow").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_inspect.gif"));
48209 } else if (d2.key === "help.field.restrictions.modifying") {
48210 content.insert("img", "p.allow_turn").attr("class", "field-help-image cf").attr("src", context.imagePath("tr_modify.gif"));
48213 fieldHelp.button = function(selection2) {
48214 if (_body.empty()) return;
48215 var button = selection2.selectAll(".field-help-button").data([0]);
48216 button.enter().append("button").attr("class", "field-help-button").call(svgIcon("#iD-icon-help")).merge(button).on("click", function(d3_event) {
48217 d3_event.stopPropagation();
48218 d3_event.preventDefault();
48219 if (_body.classed("hide")) {
48226 function updatePosition() {
48227 var wrap2 = _wrap.node();
48228 var inspector = _inspector.node();
48229 var wRect = wrap2.getBoundingClientRect();
48230 var iRect = inspector.getBoundingClientRect();
48231 _body.style("top", wRect.top + inspector.scrollTop - iRect.top + "px");
48233 fieldHelp.body = function(selection2) {
48234 _wrap = selection2.selectAll(".form-field-input-wrap");
48235 if (_wrap.empty()) return;
48236 _inspector = context.container().select(".sidebar .entity-editor-pane .inspector-body");
48237 if (_inspector.empty()) return;
48238 _body = _inspector.selectAll(".field-help-body").data([0]);
48239 var enter = _body.enter().append("div").attr("class", "field-help-body hide");
48240 var titleEnter = enter.append("div").attr("class", "field-help-title cf");
48241 titleEnter.append("h2").attr("class", _mainLocalizer.textDirection() === "rtl" ? "fr" : "fl").call(_t.append("help.field." + fieldName + ".title"));
48242 titleEnter.append("button").attr("class", "fr close").attr("title", _t("icons.close")).on("click", function(d3_event) {
48243 d3_event.stopPropagation();
48244 d3_event.preventDefault();
48246 }).call(svgIcon("#iD-icon-close"));
48247 var navEnter = enter.append("div").attr("class", "field-help-nav cf");
48248 var titles = docs.map(function(d2) {
48251 navEnter.selectAll(".field-help-nav-item").data(titles).enter().append("div").attr("class", "field-help-nav-item").html(function(d2) {
48253 }).on("click", function(d3_event, d2) {
48254 d3_event.stopPropagation();
48255 d3_event.preventDefault();
48256 clickHelp(titles.indexOf(d2));
48258 enter.append("div").attr("class", "field-help-content");
48259 _body = _body.merge(enter);
48265 // modules/ui/fields/check.js
48266 function uiFieldCheck(field, context) {
48267 var dispatch14 = dispatch_default("change");
48268 var options2 = field.options;
48272 var input = select_default2(null);
48273 var text = select_default2(null);
48274 var label = select_default2(null);
48275 var reverser = select_default2(null);
48277 var _entityIDs = [];
48279 var stringsField = field.resolveReference("stringsCrossReference");
48280 if (!options2 && stringsField.options) {
48281 options2 = stringsField.options;
48284 for (var i3 in options2) {
48285 var v2 = options2[i3];
48286 values.push(v2 === "undefined" ? void 0 : v2);
48287 texts.push(stringsField.t.html("options." + v2, { "default": v2 }));
48290 values = [void 0, "yes"];
48291 texts = [_t.html("inspector.unknown"), _t.html("inspector.check.yes")];
48292 if (field.type !== "defaultCheck") {
48294 texts.push(_t.html("inspector.check.no"));
48297 function checkImpliedYes() {
48298 _impliedYes = field.id === "oneway_yes";
48299 if (field.id === "oneway") {
48300 var entity = context.entity(_entityIDs[0]);
48301 for (var key in entity.tags) {
48302 if (key in osmOneWayTags && entity.tags[key] in osmOneWayTags[key]) {
48303 _impliedYes = true;
48304 texts[0] = _t.html("_tagging.presets.fields.oneway_yes.options.undefined");
48310 function reverserHidden() {
48311 if (!context.container().select("div.inspector-hover").empty()) return true;
48312 return !(_value === "yes" || _impliedYes && !_value);
48314 function reverserSetText(selection2) {
48315 var entity = _entityIDs.length && context.hasEntity(_entityIDs[0]);
48316 if (reverserHidden() || !entity) return selection2;
48317 var first = entity.first();
48318 var last = entity.isClosed() ? entity.nodes[entity.nodes.length - 2] : entity.last();
48319 var pseudoDirection = first < last;
48320 var icon2 = pseudoDirection ? "#iD-icon-forward" : "#iD-icon-backward";
48321 selection2.selectAll(".reverser-span").html("").call(_t.append("inspector.check.reverser")).call(svgIcon(icon2, "inline"));
48324 var check = function(selection2) {
48326 label = selection2.selectAll(".form-field-input-wrap").data([0]);
48327 var enter = label.enter().append("label").attr("class", "form-field-input-wrap form-field-input-check");
48328 enter.append("input").property("indeterminate", field.type !== "defaultCheck").attr("type", "checkbox").attr("id", field.domId);
48329 enter.append("span").html(texts[0]).attr("class", "value");
48330 if (field.type === "onewayCheck") {
48331 enter.append("button").attr("class", "reverser" + (reverserHidden() ? " hide" : "")).append("span").attr("class", "reverser-span");
48333 label = label.merge(enter);
48334 input = label.selectAll("input");
48335 text = label.selectAll("span.value");
48336 input.on("click", function(d3_event) {
48337 d3_event.stopPropagation();
48339 if (Array.isArray(_tags[field.key])) {
48340 if (values.indexOf("yes") !== -1) {
48341 t2[field.key] = "yes";
48343 t2[field.key] = values[0];
48346 t2[field.key] = values[(values.indexOf(_value) + 1) % values.length];
48348 if (t2[field.key] === "reversible" || t2[field.key] === "alternating") {
48349 t2[field.key] = values[0];
48351 dispatch14.call("change", this, t2);
48353 if (field.type === "onewayCheck") {
48354 reverser = label.selectAll(".reverser");
48355 reverser.call(reverserSetText).on("click", function(d3_event) {
48356 d3_event.preventDefault();
48357 d3_event.stopPropagation();
48360 for (var i4 in _entityIDs) {
48361 graph = actionReverse(_entityIDs[i4])(graph);
48365 _t("operations.reverse.annotation.line", { n: 1 })
48367 context.validator().validate();
48368 select_default2(this).call(reverserSetText);
48372 check.entityIDs = function(val) {
48373 if (!arguments.length) return _entityIDs;
48377 check.tags = function(tags) {
48379 function isChecked(val) {
48380 return val !== "no" && val !== "" && val !== void 0 && val !== null;
48382 function textFor(val) {
48383 if (val === "") val = void 0;
48384 var index = values.indexOf(val);
48385 return index !== -1 ? texts[index] : '"' + val + '"';
48388 var isMixed = Array.isArray(tags[field.key]);
48389 _value = !isMixed && tags[field.key] && tags[field.key].toLowerCase();
48390 if (field.type === "onewayCheck" && (_value === "1" || _value === "-1")) {
48393 input.property("indeterminate", isMixed || field.type !== "defaultCheck" && !_value).property("checked", isChecked(_value));
48394 text.html(isMixed ? _t.html("inspector.multiple_values") : textFor(_value)).classed("mixed", isMixed);
48395 label.classed("set", !!_value);
48396 if (field.type === "onewayCheck") {
48397 reverser.classed("hide", reverserHidden()).call(reverserSetText);
48400 check.focus = function() {
48401 input.node().focus();
48403 return utilRebind(check, dispatch14, "on");
48406 // modules/svg/areas.js
48407 var import_fast_deep_equal5 = __toESM(require_fast_deep_equal());
48409 // modules/svg/helpers.js
48410 function svgPassiveVertex(node, graph, activeID) {
48411 if (!activeID) return 1;
48412 if (activeID === node.id) return 0;
48413 var parents = graph.parentWays(node);
48414 var i3, j2, nodes, isClosed, ix1, ix2, ix3, ix4, max3;
48415 for (i3 = 0; i3 < parents.length; i3++) {
48416 nodes = parents[i3].nodes;
48417 isClosed = parents[i3].isClosed();
48418 for (j2 = 0; j2 < nodes.length; j2++) {
48419 if (nodes[j2] === node.id) {
48425 max3 = nodes.length - 1;
48426 if (ix1 < 0) ix1 = max3 + ix1;
48427 if (ix2 < 0) ix2 = max3 + ix2;
48428 if (ix3 > max3) ix3 = ix3 - max3;
48429 if (ix4 > max3) ix4 = ix4 - max3;
48431 if (nodes[ix1] === activeID) return 0;
48432 else if (nodes[ix2] === activeID) return 2;
48433 else if (nodes[ix3] === activeID) return 2;
48434 else if (nodes[ix4] === activeID) return 0;
48435 else if (isClosed && nodes.indexOf(activeID) !== -1) return 0;
48441 function svgMarkerSegments(projection2, graph, dt2, shouldReverse, bothDirections) {
48442 return function(entity) {
48446 var clip = identity_default2().clipExtent(projection2.clipExtent()).stream;
48447 var coordinates = graph.childNodes(entity).map(function(n3) {
48451 if (shouldReverse(entity)) {
48452 coordinates.reverse();
48455 type: "LineString",
48457 }, projection2.stream(clip({
48458 lineStart: function() {
48460 lineEnd: function() {
48463 point: function(x2, y2) {
48466 var span = geoVecLength(a2, b2) - offset;
48468 var heading2 = geoVecAngle(a2, b2);
48469 var dx = dt2 * Math.cos(heading2);
48470 var dy = dt2 * Math.sin(heading2);
48472 a2[0] + offset * Math.cos(heading2),
48473 a2[1] + offset * Math.sin(heading2)
48475 var coord2 = [a2, p2];
48476 for (span -= dt2; span >= 0; span -= dt2) {
48477 p2 = geoVecAdd(p2, [dx, dy]);
48483 for (j2 = 0; j2 < coord2.length; j2++) {
48484 segment += (j2 === 0 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
48486 segments.push({ id: entity.id, index: i3++, d: segment });
48487 if (bothDirections(entity)) {
48489 for (j2 = coord2.length - 1; j2 >= 0; j2--) {
48490 segment += (j2 === coord2.length - 1 ? "M" : "L") + coord2[j2][0] + "," + coord2[j2][1];
48492 segments.push({ id: entity.id, index: i3++, d: segment });
48503 function svgPath(projection2, graph, isArea) {
48505 var padding = isArea ? 65 : 5;
48506 var viewport = projection2.clipExtent();
48507 var paddedExtent = [
48508 [viewport[0][0] - padding, viewport[0][1] - padding],
48509 [viewport[1][0] + padding, viewport[1][1] + padding]
48511 var clip = identity_default2().clipExtent(paddedExtent).stream;
48512 var project = projection2.stream;
48513 var path = path_default().projection({ stream: function(output) {
48514 return project(clip(output));
48516 var svgpath = function(entity) {
48517 if (entity.id in cache) {
48518 return cache[entity.id];
48520 return cache[entity.id] = path(entity.asGeoJSON(graph));
48523 svgpath.geojson = function(d2) {
48524 if (d2.__featurehash__ !== void 0) {
48525 if (d2.__featurehash__ in cache) {
48526 return cache[d2.__featurehash__];
48528 return cache[d2.__featurehash__] = path(d2);
48536 function svgPointTransform(projection2) {
48537 var svgpoint = function(entity) {
48538 var pt2 = projection2(entity.loc);
48539 return "translate(" + pt2[0] + "," + pt2[1] + ")";
48541 svgpoint.geojson = function(d2) {
48542 return svgpoint(d2.properties.entity);
48546 function svgRelationMemberTags(graph) {
48547 return function(entity) {
48548 var tags = entity.tags;
48549 var shouldCopyMultipolygonTags = !entity.hasInterestingTags();
48550 graph.parentRelations(entity).forEach(function(relation) {
48551 var type2 = relation.tags.type;
48552 if (type2 === "multipolygon" && shouldCopyMultipolygonTags || type2 === "boundary") {
48553 tags = Object.assign({}, relation.tags, tags);
48559 function svgSegmentWay(way, graph, activeID) {
48560 if (activeID === void 0) {
48561 return graph.transient(way, "waySegments", getWaySegments);
48563 return getWaySegments();
48565 function getWaySegments() {
48566 var isActiveWay = way.nodes.indexOf(activeID) !== -1;
48567 var features = { passive: [], active: [] };
48571 for (var i3 = 0; i3 < way.nodes.length; i3++) {
48572 node = graph.entity(way.nodes[i3]);
48573 type2 = svgPassiveVertex(node, graph, activeID);
48574 end = { node, type: type2 };
48575 if (start2.type !== void 0) {
48576 if (start2.node.id === activeID || end.node.id === activeID) {
48577 } else if (isActiveWay && (start2.type === 2 || end.type === 2)) {
48578 pushActive(start2, end, i3);
48579 } else if (start2.type === 0 && end.type === 0) {
48580 pushActive(start2, end, i3);
48582 pushPassive(start2, end, i3);
48588 function pushActive(start3, end2, index) {
48589 features.active.push({
48591 id: way.id + "-" + index + "-nope",
48596 nodes: [start3.node, end2.node],
48600 type: "LineString",
48601 coordinates: [start3.node.loc, end2.node.loc]
48605 function pushPassive(start3, end2, index) {
48606 features.passive.push({
48608 id: way.id + "-" + index,
48612 nodes: [start3.node, end2.node],
48616 type: "LineString",
48617 coordinates: [start3.node.loc, end2.node.loc]
48624 // modules/svg/tag_classes.js
48625 function svgTagClasses() {
48649 var statuses = Object.keys(osmLifecyclePrefixes);
48650 var secondaries = [
48663 "public_transport",
48674 var _tags = function(entity) {
48675 return entity.tags;
48677 var tagClasses = function(selection2) {
48678 selection2.each(function tagClassesEach(entity) {
48679 var value = this.className;
48680 if (value.baseVal !== void 0) {
48681 value = value.baseVal;
48683 var t2 = _tags(entity);
48684 var computed = tagClasses.getClassesString(t2, value);
48685 if (computed !== value) {
48686 select_default2(this).attr("class", computed);
48690 tagClasses.getClassesString = function(t2, value) {
48691 var primary, status;
48692 var i3, j2, k2, v2;
48693 var overrideGeometry;
48694 if (/\bstroke\b/.test(value)) {
48695 if (!!t2.barrier && t2.barrier !== "no") {
48696 overrideGeometry = "line";
48699 var classes = value.trim().split(/\s+/).filter(function(klass) {
48700 return klass.length && !/^tag-/.test(klass);
48701 }).map(function(klass) {
48702 return klass === "line" || klass === "area" ? overrideGeometry || klass : klass;
48704 for (i3 = 0; i3 < primaries.length; i3++) {
48705 k2 = primaries[i3];
48707 if (!v2 || v2 === "no") continue;
48708 if (k2 === "piste:type") {
48710 } else if (k2 === "building:part") {
48711 k2 = "building_part";
48714 if (statuses.indexOf(v2) !== -1) {
48716 classes.push("tag-" + k2);
48718 classes.push("tag-" + k2);
48719 classes.push("tag-" + k2 + "-" + v2);
48724 for (i3 = 0; i3 < statuses.length; i3++) {
48725 for (j2 = 0; j2 < primaries.length; j2++) {
48726 k2 = statuses[i3] + ":" + primaries[j2];
48728 if (!v2 || v2 === "no") continue;
48729 status = statuses[i3];
48735 for (i3 = 0; i3 < statuses.length; i3++) {
48738 if (!v2 || v2 === "no") continue;
48739 if (v2 === "yes") {
48741 } else if (primary && primary === v2) {
48743 } else if (!primary && primaries.indexOf(v2) !== -1) {
48746 classes.push("tag-" + v2);
48752 classes.push("tag-status");
48753 classes.push("tag-status-" + status);
48755 for (i3 = 0; i3 < secondaries.length; i3++) {
48756 k2 = secondaries[i3];
48758 if (!v2 || v2 === "no" || k2 === primary) continue;
48759 classes.push("tag-" + k2);
48760 classes.push("tag-" + k2 + "-" + v2);
48762 if (primary === "highway" && !osmPathHighwayTagValues[t2.highway] || primary === "aeroway") {
48763 var surface = t2.highway === "track" ? "unpaved" : "paved";
48766 if (k2 in osmPavedTags) {
48767 surface = osmPavedTags[k2][v2] ? "paved" : "unpaved";
48769 if (k2 in osmSemipavedTags && !!osmSemipavedTags[k2][v2]) {
48770 surface = "semipaved";
48773 classes.push("tag-" + surface);
48775 var qid = t2.wikidata || t2["flag:wikidata"] || t2["brand:wikidata"] || t2["network:wikidata"] || t2["operator:wikidata"];
48777 classes.push("tag-wikidata");
48779 return classes.filter((klass) => /^[-_a-z0-9]+$/.test(klass)).join(" ").trim();
48781 tagClasses.tags = function(val) {
48782 if (!arguments.length) return _tags;
48789 // modules/svg/tag_pattern.js
48791 // tag - pattern name
48793 // tag - value - pattern name
48795 // tag - value - rules (optional tag-values, pattern name)
48796 // (matches earlier rules first, so fallback should be last entry)
48798 grave_yard: "cemetery",
48799 fountain: "water_standing"
48803 { religion: "christian", pattern: "cemetery_christian" },
48804 { religion: "buddhist", pattern: "cemetery_buddhist" },
48805 { religion: "muslim", pattern: "cemetery_muslim" },
48806 { religion: "jewish", pattern: "cemetery_jewish" },
48807 { pattern: "cemetery" }
48809 construction: "construction",
48810 farmland: "farmland",
48811 farmyard: "farmyard",
48813 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
48814 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
48815 { leaf_type: "leafless", pattern: "forest_leafless" },
48816 { pattern: "forest" }
48817 // same as 'leaf_type:mixed'
48819 grave_yard: "cemetery",
48821 landfill: "landfill",
48823 military: "construction",
48824 orchard: "orchard",
48826 vineyard: "vineyard"
48829 horse_riding: "farmyard"
48833 grassland: "grass",
48837 { water: "pond", pattern: "pond" },
48838 { water: "reservoir", pattern: "water_standing" },
48839 { pattern: "waves" }
48842 { wetland: "marsh", pattern: "wetland_marsh" },
48843 { wetland: "swamp", pattern: "wetland_swamp" },
48844 { wetland: "bog", pattern: "wetland_bog" },
48845 { wetland: "reedbed", pattern: "wetland_reedbed" },
48846 { pattern: "wetland" }
48849 { leaf_type: "broadleaved", pattern: "forest_broadleaved" },
48850 { leaf_type: "needleleaved", pattern: "forest_needleleaved" },
48851 { leaf_type: "leafless", pattern: "forest_leafless" },
48852 { pattern: "forest" }
48853 // same as 'leaf_type:mixed'
48857 green: "golf_green",
48867 function svgTagPattern(tags) {
48868 if (tags.building && tags.building !== "no") {
48871 for (var tag2 in patterns) {
48872 var entityValue = tags[tag2];
48873 if (!entityValue) continue;
48874 if (typeof patterns[tag2] === "string") {
48875 return "pattern-" + patterns[tag2];
48877 var values = patterns[tag2];
48878 for (var value in values) {
48879 if (entityValue !== value) continue;
48880 var rules = values[value];
48881 if (typeof rules === "string") {
48882 return "pattern-" + rules;
48884 for (var ruleKey in rules) {
48885 var rule = rules[ruleKey];
48887 for (var criterion in rule) {
48888 if (criterion !== "pattern") {
48889 var v2 = tags[criterion];
48890 if (!v2 || v2 !== rule[criterion]) {
48897 return "pattern-" + rule.pattern;
48906 // modules/svg/areas.js
48907 function svgAreas(projection2, context) {
48908 function getPatternStyle(tags) {
48909 var imageID = svgTagPattern(tags);
48911 return 'url("#ideditor-' + imageID + '")';
48915 function drawTargets(selection2, graph, entities, filter2) {
48916 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
48917 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
48918 var getPath = svgPath(projection2).geojson;
48919 var activeID = context.activeID();
48920 var base = context.history().base();
48921 var data = { targets: [], nopes: [] };
48922 entities.forEach(function(way) {
48923 var features = svgSegmentWay(way, graph, activeID);
48924 data.targets.push.apply(data.targets, features.passive);
48925 data.nopes.push.apply(data.nopes, features.active);
48927 var targetData = data.targets.filter(getPath);
48928 var targets = selection2.selectAll(".area.target-allowed").filter(function(d2) {
48929 return filter2(d2.properties.entity);
48930 }).data(targetData, function key(d2) {
48933 targets.exit().remove();
48934 var segmentWasEdited = function(d2) {
48935 var wayID = d2.properties.entity.id;
48936 if (!base.entities[wayID] || !(0, import_fast_deep_equal5.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
48939 return d2.properties.nodes.some(function(n3) {
48940 return !base.entities[n3.id] || !(0, import_fast_deep_equal5.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
48943 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
48944 return "way area target target-allowed " + targetClass + d2.id;
48945 }).classed("segment-edited", segmentWasEdited);
48946 var nopeData = data.nopes.filter(getPath);
48947 var nopes = selection2.selectAll(".area.target-nope").filter(function(d2) {
48948 return filter2(d2.properties.entity);
48949 }).data(nopeData, function key(d2) {
48952 nopes.exit().remove();
48953 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
48954 return "way area target target-nope " + nopeClass + d2.id;
48955 }).classed("segment-edited", segmentWasEdited);
48957 function drawAreas(selection2, graph, entities, filter2) {
48958 var path = svgPath(projection2, graph, true);
48960 var base = context.history().base();
48961 for (var i3 = 0; i3 < entities.length; i3++) {
48962 var entity = entities[i3];
48963 if (entity.geometry(graph) !== "area") continue;
48964 if (!areas[entity.id]) {
48965 areas[entity.id] = {
48967 area: Math.abs(entity.area(graph))
48971 var fills = Object.values(areas).filter(function hasPath(a2) {
48972 return path(a2.entity);
48974 fills.sort(function areaSort(a2, b2) {
48975 return b2.area - a2.area;
48977 fills = fills.map(function(a2) {
48980 var strokes = fills.filter(function(area) {
48981 return area.type === "way";
48989 var clipPaths = context.surface().selectAll("defs").selectAll(".clipPath-osm").filter(filter2).data(data.clip, osmEntity.key);
48990 clipPaths.exit().remove();
48991 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-osm").attr("id", function(entity2) {
48992 return "ideditor-" + entity2.id + "-clippath";
48994 clipPathsEnter.append("path");
48995 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", path);
48996 var drawLayer = selection2.selectAll(".layer-osm.areas");
48997 var touchLayer = selection2.selectAll(".layer-touch.areas");
48998 var areagroup = drawLayer.selectAll("g.areagroup").data(["fill", "shadow", "stroke"]);
48999 areagroup = areagroup.enter().append("g").attr("class", function(d2) {
49000 return "areagroup area-" + d2;
49001 }).merge(areagroup);
49002 var paths = areagroup.selectAll("path").filter(filter2).data(function(layer) {
49003 return data[layer];
49005 paths.exit().remove();
49006 var fillpaths = selection2.selectAll(".area-fill path.area").nodes();
49007 var bisect = bisector(function(node) {
49008 return -node.__data__.area(graph);
49010 function sortedByArea(entity2) {
49011 if (this._parent.__data__ === "fill") {
49012 return fillpaths[bisect(fillpaths, -entity2.area(graph))];
49015 paths = paths.enter().insert("path", sortedByArea).merge(paths).each(function(entity2) {
49016 var layer = this.parentNode.__data__;
49017 this.setAttribute("class", entity2.type + " area " + layer + " " + entity2.id);
49018 if (layer === "fill") {
49019 this.setAttribute("clip-path", "url(#ideditor-" + entity2.id + "-clippath)");
49020 this.style.fill = this.style.stroke = getPatternStyle(entity2.tags);
49022 }).classed("added", function(d2) {
49023 return !base.entities[d2.id];
49024 }).classed("geometry-edited", function(d2) {
49025 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);
49026 }).classed("retagged", function(d2) {
49027 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);
49028 }).call(svgTagClasses()).attr("d", path);
49029 touchLayer.call(drawTargets, graph, data.stroke, filter2);
49034 // modules/svg/data.js
49035 var import_fast_json_stable_stringify = __toESM(require_fast_json_stable_stringify());
49037 // node_modules/@tmcw/togeojson/dist/togeojson.es.mjs
49038 function $(element, tagName) {
49039 return Array.from(element.getElementsByTagName(tagName));
49041 function normalizeId(id2) {
49042 return id2[0] === "#" ? id2 : "#".concat(id2);
49044 function $ns(element, tagName, ns) {
49045 return Array.from(element.getElementsByTagNameNS(ns, tagName));
49047 function nodeVal(node) {
49048 node == null ? void 0 : node.normalize();
49049 return node && node.textContent || "";
49051 function get1(node, tagName, callback) {
49052 const n3 = node.getElementsByTagName(tagName);
49053 const result = n3.length ? n3[0] : null;
49054 if (result && callback)
49058 function get3(node, tagName, callback) {
49059 const properties = {};
49062 const n3 = node.getElementsByTagName(tagName);
49063 const result = n3.length ? n3[0] : null;
49064 if (result && callback) {
49065 return callback(result, properties);
49069 function val1(node, tagName, callback) {
49070 const val = nodeVal(get1(node, tagName));
49071 if (val && callback)
49072 return callback(val) || {};
49075 function $num(node, tagName, callback) {
49076 const val = parseFloat(nodeVal(get1(node, tagName)));
49079 if (val && callback)
49080 return callback(val) || {};
49083 function num1(node, tagName, callback) {
49084 const val = parseFloat(nodeVal(get1(node, tagName)));
49091 function getMulti(node, propertyNames) {
49092 const properties = {};
49093 for (const property of propertyNames) {
49094 val1(node, property, (val) => {
49095 properties[property] = val;
49100 function isElement(node) {
49101 return (node == null ? void 0 : node.nodeType) === 1;
49103 function getLineStyle(node) {
49104 return get3(node, "line", (lineStyle) => {
49105 const val = Object.assign({}, val1(lineStyle, "color", (color2) => {
49106 return { stroke: "#".concat(color2) };
49107 }), $num(lineStyle, "opacity", (opacity) => {
49108 return { "stroke-opacity": opacity };
49109 }), $num(lineStyle, "width", (width) => {
49110 return { "stroke-width": width * 96 / 25.4 };
49115 function getExtensions(node) {
49119 for (const child of Array.from(node.childNodes)) {
49120 if (!isElement(child))
49122 const name = abbreviateName(child.nodeName);
49123 if (name === "gpxtpx:TrackPointExtension") {
49124 values = values.concat(getExtensions(child));
49126 const val = nodeVal(child);
49127 values.push([name, parseNumeric(val)]);
49132 function abbreviateName(name) {
49133 return ["heart", "gpxtpx:hr", "hr"].includes(name) ? "heart" : name;
49135 function parseNumeric(val) {
49136 const num = parseFloat(val);
49137 return isNaN(num) ? val : num;
49139 function coordPair$1(node) {
49141 parseFloat(node.getAttribute("lon") || ""),
49142 parseFloat(node.getAttribute("lat") || "")
49144 if (isNaN(ll[0]) || isNaN(ll[1])) {
49147 num1(node, "ele", (val) => {
49150 const time = get1(node, "time");
49153 time: time ? nodeVal(time) : null,
49154 extendedValues: getExtensions(get1(node, "extensions"))
49157 function extractProperties(node) {
49159 const properties = getMulti(node, [
49167 const extensions = Array.from(node.getElementsByTagNameNS("http://www.garmin.com/xmlschemas/GpxExtensions/v3", "*"));
49168 for (const child of extensions) {
49169 if (((_a3 = child.parentNode) == null ? void 0 : _a3.parentNode) === node) {
49170 properties[child.tagName.replace(":", "_")] = nodeVal(child);
49173 const links = $(node, "link");
49174 if (links.length) {
49175 properties.links = links.map((link3) => Object.assign({ href: link3.getAttribute("href") }, getMulti(link3, ["text", "type"])));
49179 function getPoints$1(node, pointname) {
49180 const pts = $(node, pointname);
49183 const extendedValues = {};
49184 for (let i3 = 0; i3 < pts.length; i3++) {
49185 const c2 = coordPair$1(pts[i3]);
49189 line.push(c2.coordinates);
49191 times.push(c2.time);
49192 for (const [name, val] of c2.extendedValues) {
49193 const plural = name === "heart" ? name : name.replace("gpxtpx:", "") + "s";
49194 if (!extendedValues[plural]) {
49195 extendedValues[plural] = Array(pts.length).fill(null);
49197 extendedValues[plural][i3] = val;
49200 if (line.length < 2)
49208 function getRoute(node) {
49209 const line = getPoints$1(node, "rtept");
49214 properties: Object.assign({ _gpxType: "rte" }, extractProperties(node), getLineStyle(get1(node, "extensions"))),
49216 type: "LineString",
49217 coordinates: line.line
49221 function getTrack(node) {
49222 const segments = $(node, "trkseg");
49225 const extractedLines = [];
49226 for (const segment of segments) {
49227 const line = getPoints$1(segment, "trkpt");
49229 extractedLines.push(line);
49230 if (line.times && line.times.length)
49231 times.push(line.times);
49234 if (extractedLines.length === 0)
49236 const multi = extractedLines.length > 1;
49237 const properties = Object.assign({ _gpxType: "trk" }, extractProperties(node), getLineStyle(get1(node, "extensions")), times.length ? {
49238 coordinateProperties: {
49239 times: multi ? times : times[0]
49242 for (const line of extractedLines) {
49243 track.push(line.line);
49244 if (!properties.coordinateProperties) {
49245 properties.coordinateProperties = {};
49247 const props = properties.coordinateProperties;
49248 const entries = Object.entries(line.extendedValues);
49249 for (let i3 = 0; i3 < entries.length; i3++) {
49250 const [name, val] = entries[i3];
49252 if (!props[name]) {
49253 props[name] = extractedLines.map((line2) => new Array(line2.line.length).fill(null));
49255 props[name][i3] = val;
49264 geometry: multi ? {
49265 type: "MultiLineString",
49268 type: "LineString",
49269 coordinates: track[0]
49273 function getPoint(node) {
49274 const properties = Object.assign(extractProperties(node), getMulti(node, ["sym"]));
49275 const pair3 = coordPair$1(node);
49283 coordinates: pair3.coordinates
49287 function* gpxGen(node) {
49288 for (const track of $(node, "trk")) {
49289 const feature3 = getTrack(track);
49293 for (const route of $(node, "rte")) {
49294 const feature3 = getRoute(route);
49298 for (const waypoint of $(node, "wpt")) {
49299 const point = getPoint(waypoint);
49304 function gpx(node) {
49306 type: "FeatureCollection",
49307 features: Array.from(gpxGen(node))
49310 function fixColor(v2, prefix) {
49311 const properties = {};
49312 const colorProp = prefix == "stroke" || prefix === "fill" ? prefix : prefix + "-color";
49313 if (v2[0] === "#") {
49314 v2 = v2.substring(1);
49316 if (v2.length === 6 || v2.length === 3) {
49317 properties[colorProp] = "#" + v2;
49318 } else if (v2.length === 8) {
49319 properties[prefix + "-opacity"] = parseInt(v2.substring(0, 2), 16) / 255;
49320 properties[colorProp] = "#" + v2.substring(6, 8) + v2.substring(4, 6) + v2.substring(2, 4);
49324 function numericProperty(node, source, target) {
49325 const properties = {};
49326 num1(node, source, (val) => {
49327 properties[target] = val;
49331 function getColor(node, output) {
49332 return get3(node, "color", (elem) => fixColor(nodeVal(elem), output));
49334 function extractIconHref(node) {
49335 return get3(node, "Icon", (icon2, properties) => {
49336 val1(icon2, "href", (href) => {
49337 properties.icon = href;
49342 function extractIcon(node) {
49343 return get3(node, "IconStyle", (iconStyle) => {
49344 return Object.assign(getColor(iconStyle, "icon"), numericProperty(iconStyle, "scale", "icon-scale"), numericProperty(iconStyle, "heading", "icon-heading"), get3(iconStyle, "hotSpot", (hotspot) => {
49345 const left = parseFloat(hotspot.getAttribute("x") || "");
49346 const top = parseFloat(hotspot.getAttribute("y") || "");
49347 const xunits = hotspot.getAttribute("xunits") || "";
49348 const yunits = hotspot.getAttribute("yunits") || "";
49349 if (!isNaN(left) && !isNaN(top))
49351 "icon-offset": [left, top],
49352 "icon-offset-units": [xunits, yunits]
49355 }), extractIconHref(iconStyle));
49358 function extractLabel(node) {
49359 return get3(node, "LabelStyle", (labelStyle) => {
49360 return Object.assign(getColor(labelStyle, "label"), numericProperty(labelStyle, "scale", "label-scale"));
49363 function extractLine(node) {
49364 return get3(node, "LineStyle", (lineStyle) => {
49365 return Object.assign(getColor(lineStyle, "stroke"), numericProperty(lineStyle, "width", "stroke-width"));
49368 function extractPoly(node) {
49369 return get3(node, "PolyStyle", (polyStyle, properties) => {
49370 return Object.assign(properties, get3(polyStyle, "color", (elem) => fixColor(nodeVal(elem), "fill")), val1(polyStyle, "fill", (fill) => {
49372 return { "fill-opacity": 0 };
49373 }), val1(polyStyle, "outline", (outline) => {
49374 if (outline === "0")
49375 return { "stroke-opacity": 0 };
49379 function extractStyle(node) {
49380 return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));
49382 var toNumber2 = (x2) => Number(x2);
49383 var typeConverters = {
49384 string: (x2) => x2,
49391 bool: (x2) => Boolean(x2)
49393 function extractExtendedData(node, schema) {
49394 return get3(node, "ExtendedData", (extendedData, properties) => {
49395 for (const data of $(extendedData, "Data")) {
49396 properties[data.getAttribute("name") || ""] = nodeVal(get1(data, "value"));
49398 for (const simpleData of $(extendedData, "SimpleData")) {
49399 const name = simpleData.getAttribute("name") || "";
49400 const typeConverter = schema[name] || typeConverters.string;
49401 properties[name] = typeConverter(nodeVal(simpleData));
49406 function getMaybeHTMLDescription(node) {
49407 const descriptionNode = get1(node, "description");
49408 for (const c2 of Array.from((descriptionNode == null ? void 0 : descriptionNode.childNodes) || [])) {
49409 if (c2.nodeType === 4) {
49420 function extractTimeSpan(node) {
49421 return get3(node, "TimeSpan", (timeSpan) => {
49424 begin: nodeVal(get1(timeSpan, "begin")),
49425 end: nodeVal(get1(timeSpan, "end"))
49430 function extractTimeStamp(node) {
49431 return get3(node, "TimeStamp", (timeStamp) => {
49432 return { timestamp: nodeVal(get1(timeStamp, "when")) };
49435 function extractCascadedStyle(node, styleMap) {
49436 return val1(node, "styleUrl", (styleUrl) => {
49437 styleUrl = normalizeId(styleUrl);
49438 if (styleMap[styleUrl]) {
49439 return Object.assign({ styleUrl }, styleMap[styleUrl]);
49441 return { styleUrl };
49444 var removeSpace = /\s*/g;
49445 var trimSpace = /^\s*|\s*$/g;
49446 var splitSpace = /\s+/;
49447 function coord1(value) {
49448 return value.replace(removeSpace, "").split(",").map(parseFloat).filter((num) => !isNaN(num)).slice(0, 3);
49450 function coord(value) {
49451 return value.replace(trimSpace, "").split(splitSpace).map(coord1).filter((coord2) => {
49452 return coord2.length >= 2;
49455 function gxCoords(node) {
49456 let elems = $(node, "coord");
49457 if (elems.length === 0) {
49458 elems = $ns(node, "coord", "*");
49460 const coordinates = elems.map((elem) => {
49461 return nodeVal(elem).split(" ").map(parseFloat);
49463 if (coordinates.length === 0) {
49467 geometry: coordinates.length > 2 ? {
49468 type: "LineString",
49472 coordinates: coordinates[0]
49474 times: $(node, "when").map((elem) => nodeVal(elem))
49477 function fixRing(ring) {
49478 if (ring.length === 0)
49480 const first = ring[0];
49481 const last = ring[ring.length - 1];
49483 for (let i3 = 0; i3 < Math.max(first.length, last.length); i3++) {
49484 if (first[i3] !== last[i3]) {
49490 return ring.concat([ring[0]]);
49494 function getCoordinates(node) {
49495 return nodeVal(get1(node, "coordinates"));
49497 function getGeometry(node) {
49498 let geometries = [];
49499 let coordTimes = [];
49500 for (let i3 = 0; i3 < node.childNodes.length; i3++) {
49501 const child = node.childNodes.item(i3);
49502 if (isElement(child)) {
49503 switch (child.tagName) {
49504 case "MultiGeometry":
49506 case "gx:MultiTrack": {
49507 const childGeometries = getGeometry(child);
49508 geometries = geometries.concat(childGeometries.geometries);
49509 coordTimes = coordTimes.concat(childGeometries.coordTimes);
49513 const coordinates = coord1(getCoordinates(child));
49514 if (coordinates.length >= 2) {
49523 case "LineString": {
49524 const coordinates = coord(getCoordinates(child));
49525 if (coordinates.length >= 2) {
49527 type: "LineString",
49535 for (const linearRing of $(child, "LinearRing")) {
49536 const ring = fixRing(coord(getCoordinates(linearRing)));
49537 if (ring.length >= 4) {
49541 if (coords.length) {
49544 coordinates: coords
49551 const gx = gxCoords(child);
49554 const { times, geometry } = gx;
49555 geometries.push(geometry);
49557 coordTimes.push(times);
49568 function geometryListToGeometry(geometries) {
49569 return geometries.length === 0 ? null : geometries.length === 1 ? geometries[0] : {
49570 type: "GeometryCollection",
49574 function getPlacemark(node, styleMap, schema, options2) {
49576 const { coordTimes, geometries } = getGeometry(node);
49577 const geometry = geometryListToGeometry(geometries);
49578 if (!geometry && options2.skipNullGeometry) {
49584 properties: Object.assign(getMulti(node, [
49591 ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length ? {
49592 coordinateProperties: {
49593 times: coordTimes.length === 1 ? coordTimes[0] : coordTimes
49597 if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
49598 feature3.properties.visibility = feature3.properties.visibility !== "0";
49600 const id2 = node.getAttribute("id");
49601 if (id2 !== null && id2 !== "")
49605 function getGroundOverlayBox(node) {
49606 const latLonQuad = get1(node, "gx:LatLonQuad");
49608 const ring = fixRing(coord(getCoordinates(node)));
49612 coordinates: [ring]
49616 return getLatLonBox(node);
49618 var DEGREES_TO_RADIANS = Math.PI / 180;
49619 function rotateBox(bbox2, coordinates, rotation) {
49620 const center = [(bbox2[0] + bbox2[2]) / 2, (bbox2[1] + bbox2[3]) / 2];
49622 coordinates[0].map((coordinate) => {
49623 const dy = coordinate[1] - center[1];
49624 const dx = coordinate[0] - center[0];
49625 const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));
49626 const angle2 = Math.atan2(dy, dx) + rotation * DEGREES_TO_RADIANS;
49628 center[0] + Math.cos(angle2) * distance,
49629 center[1] + Math.sin(angle2) * distance
49634 function getLatLonBox(node) {
49635 const latLonBox = get1(node, "LatLonBox");
49637 const north = num1(latLonBox, "north");
49638 const west = num1(latLonBox, "west");
49639 const east = num1(latLonBox, "east");
49640 const south = num1(latLonBox, "south");
49641 const rotation = num1(latLonBox, "rotation");
49642 if (typeof north === "number" && typeof south === "number" && typeof west === "number" && typeof east === "number") {
49643 const bbox2 = [west, south, east, north];
49644 let coordinates = [
49651 // top left (again)
49654 if (typeof rotation === "number") {
49655 coordinates = rotateBox(bbox2, coordinates, rotation);
49668 function getGroundOverlay(node, styleMap, schema, options2) {
49670 const box = getGroundOverlayBox(node);
49671 const geometry = (box == null ? void 0 : box.geometry) || null;
49672 if (!geometry && options2.skipNullGeometry) {
49678 properties: Object.assign(
49681 * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46
49683 { "@geometry-type": "groundoverlay" },
49692 getMaybeHTMLDescription(node),
49693 extractCascadedStyle(node, styleMap),
49694 extractStyle(node),
49695 extractIconHref(node),
49696 extractExtendedData(node, schema),
49697 extractTimeSpan(node),
49698 extractTimeStamp(node)
49701 if (box == null ? void 0 : box.bbox) {
49702 feature3.bbox = box.bbox;
49704 if (((_a3 = feature3.properties) == null ? void 0 : _a3.visibility) !== void 0) {
49705 feature3.properties.visibility = feature3.properties.visibility !== "0";
49707 const id2 = node.getAttribute("id");
49708 if (id2 !== null && id2 !== "")
49712 function getStyleId(style) {
49713 let id2 = style.getAttribute("id");
49714 const parentNode = style.parentNode;
49715 if (!id2 && isElement(parentNode) && parentNode.localName === "CascadingStyle") {
49716 id2 = parentNode.getAttribute("kml:id") || parentNode.getAttribute("id");
49718 return normalizeId(id2 || "");
49720 function buildStyleMap(node) {
49721 const styleMap = {};
49722 for (const style of $(node, "Style")) {
49723 styleMap[getStyleId(style)] = extractStyle(style);
49725 for (const map2 of $(node, "StyleMap")) {
49726 const id2 = normalizeId(map2.getAttribute("id") || "");
49727 val1(map2, "styleUrl", (styleUrl) => {
49728 styleUrl = normalizeId(styleUrl);
49729 if (styleMap[styleUrl]) {
49730 styleMap[id2] = styleMap[styleUrl];
49736 function buildSchema(node) {
49738 for (const field of $(node, "SimpleField")) {
49739 schema[field.getAttribute("name") || ""] = typeConverters[field.getAttribute("type") || ""] || typeConverters["string"];
49743 function* kmlGen(node, options2 = {
49744 skipNullGeometry: false
49746 const styleMap = buildStyleMap(node);
49747 const schema = buildSchema(node);
49748 for (const placemark of $(node, "Placemark")) {
49749 const feature3 = getPlacemark(placemark, styleMap, schema, options2);
49753 for (const groundOverlay of $(node, "GroundOverlay")) {
49754 const feature3 = getGroundOverlay(groundOverlay, styleMap, schema, options2);
49759 function kml(node, options2 = {
49760 skipNullGeometry: false
49763 type: "FeatureCollection",
49764 features: Array.from(kmlGen(node, options2))
49768 // modules/svg/data.js
49769 var _initialized = false;
49770 var _enabled = false;
49772 function svgData(projection2, context, dispatch14) {
49773 var throttledRedraw = throttle_default(function() {
49774 dispatch14.call("change");
49776 var _showLabels = true;
49777 var detected = utilDetect();
49778 var layer = select_default2(null);
49783 const supportedFormats = [
49790 if (_initialized) return;
49793 function over(d3_event) {
49794 d3_event.stopPropagation();
49795 d3_event.preventDefault();
49796 d3_event.dataTransfer.dropEffect = "copy";
49798 context.container().attr("dropzone", "copy").on("drop.svgData", function(d3_event) {
49799 d3_event.stopPropagation();
49800 d3_event.preventDefault();
49801 if (!detected.filedrop) return;
49802 var f2 = d3_event.dataTransfer.files[0];
49803 var extension = getExtension(f2.name);
49804 if (!supportedFormats.includes(extension)) return;
49805 drawData.fileList(d3_event.dataTransfer.files);
49806 }).on("dragenter.svgData", over).on("dragexit.svgData", over).on("dragover.svgData", over);
49807 _initialized = true;
49809 function getService() {
49810 if (services.vectorTile && !_vtService) {
49811 _vtService = services.vectorTile;
49812 _vtService.event.on("loadedData", throttledRedraw);
49813 } else if (!services.vectorTile && _vtService) {
49818 function showLayer() {
49820 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
49821 dispatch14.call("change");
49824 function hideLayer() {
49825 throttledRedraw.cancel();
49826 layer.transition().duration(250).style("opacity", 0).on("end", layerOff);
49828 function layerOn() {
49829 layer.style("display", "block");
49831 function layerOff() {
49832 layer.selectAll(".viewfield-group").remove();
49833 layer.style("display", "none");
49835 function ensureIDs(gj) {
49836 if (!gj) return null;
49837 if (gj.type === "FeatureCollection") {
49838 for (var i3 = 0; i3 < gj.features.length; i3++) {
49839 ensureFeatureID(gj.features[i3]);
49842 ensureFeatureID(gj);
49846 function ensureFeatureID(feature3) {
49847 if (!feature3) return;
49848 feature3.__featurehash__ = utilHashcode((0, import_fast_json_stable_stringify.default)(feature3));
49851 function getFeatures(gj) {
49852 if (!gj) return [];
49853 if (gj.type === "FeatureCollection") {
49854 return gj.features;
49859 function featureKey(d2) {
49860 return d2.__featurehash__;
49862 function isPolygon(d2) {
49863 return d2.geometry.type === "Polygon" || d2.geometry.type === "MultiPolygon";
49865 function clipPathID(d2) {
49866 return "ideditor-data-" + d2.__featurehash__ + "-clippath";
49868 function featureClasses(d2) {
49870 "data" + d2.__featurehash__,
49872 isPolygon(d2) ? "area" : "",
49873 d2.__layerID__ || ""
49874 ].filter(Boolean).join(" ");
49876 function drawData(selection2) {
49877 var vtService = getService();
49878 var getPath = svgPath(projection2).geojson;
49879 var getAreaPath = svgPath(projection2, null, true).geojson;
49880 var hasData = drawData.hasData();
49881 layer = selection2.selectAll(".layer-mapdata").data(_enabled && hasData ? [0] : []);
49882 layer.exit().remove();
49883 layer = layer.enter().append("g").attr("class", "layer-mapdata").merge(layer);
49884 var surface = context.surface();
49885 if (!surface || surface.empty()) return;
49886 var geoData, polygonData;
49887 if (_template && vtService) {
49888 var sourceID = _template;
49889 vtService.loadTiles(sourceID, _template, projection2);
49890 geoData = vtService.data(sourceID, projection2);
49892 geoData = getFeatures(_geojson);
49894 geoData = geoData.filter(getPath);
49895 polygonData = geoData.filter(isPolygon);
49896 var clipPaths = surface.selectAll("defs").selectAll(".clipPath-data").data(polygonData, featureKey);
49897 clipPaths.exit().remove();
49898 var clipPathsEnter = clipPaths.enter().append("clipPath").attr("class", "clipPath-data").attr("id", clipPathID);
49899 clipPathsEnter.append("path");
49900 clipPaths.merge(clipPathsEnter).selectAll("path").attr("d", getAreaPath);
49901 var datagroups = layer.selectAll("g.datagroup").data(["fill", "shadow", "stroke"]);
49902 datagroups = datagroups.enter().append("g").attr("class", function(d2) {
49903 return "datagroup datagroup-" + d2;
49904 }).merge(datagroups);
49910 var paths = datagroups.selectAll("path").data(function(layer2) {
49911 return pathData[layer2];
49913 paths.exit().remove();
49914 paths = paths.enter().append("path").attr("class", function(d2) {
49915 var datagroup = this.parentNode.__data__;
49916 return "pathdata " + datagroup + " " + featureClasses(d2);
49917 }).attr("clip-path", function(d2) {
49918 var datagroup = this.parentNode.__data__;
49919 return datagroup === "fill" ? "url(#" + clipPathID(d2) + ")" : null;
49920 }).merge(paths).attr("d", function(d2) {
49921 var datagroup = this.parentNode.__data__;
49922 return datagroup === "fill" ? getAreaPath(d2) : getPath(d2);
49924 layer.call(drawLabels, "label-halo", geoData).call(drawLabels, "label", geoData);
49925 function drawLabels(selection3, textClass, data) {
49926 var labelPath = path_default(projection2);
49927 var labelData = data.filter(function(d2) {
49928 return _showLabels && d2.properties && (d2.properties.desc || d2.properties.name);
49930 var labels = selection3.selectAll("text." + textClass).data(labelData, featureKey);
49931 labels.exit().remove();
49932 labels = labels.enter().append("text").attr("class", function(d2) {
49933 return textClass + " " + featureClasses(d2);
49934 }).merge(labels).text(function(d2) {
49935 return d2.properties.desc || d2.properties.name;
49936 }).attr("x", function(d2) {
49937 var centroid = labelPath.centroid(d2);
49938 return centroid[0] + 11;
49939 }).attr("y", function(d2) {
49940 var centroid = labelPath.centroid(d2);
49941 return centroid[1];
49945 function getExtension(fileName) {
49946 if (!fileName) return;
49947 var re3 = /\.(gpx|kml|(geo)?json|png)$/i;
49948 var match = fileName.toLowerCase().match(re3);
49949 return match && match.length && match[0];
49951 function xmlToDom(textdata) {
49952 return new DOMParser().parseFromString(textdata, "text/xml");
49954 function stringifyGeojsonProperties(feature3) {
49955 const properties = feature3.properties;
49956 for (const key in properties) {
49957 const property = properties[key];
49958 if (typeof property === "number" || typeof property === "boolean" || Array.isArray(property)) {
49959 properties[key] = property.toString();
49960 } else if (property === null) {
49961 properties[key] = "null";
49962 } else if (typeof property === "object") {
49963 properties[key] = JSON.stringify(property);
49967 drawData.setFile = function(extension, data) {
49973 switch (extension) {
49975 gj = gpx(xmlToDom(data));
49978 gj = kml(xmlToDom(data));
49982 gj = JSON.parse(data);
49983 if (gj.type === "FeatureCollection") {
49984 gj.features.forEach(stringifyGeojsonProperties);
49985 } else if (gj.type === "Feature") {
49986 stringifyGeojsonProperties(gj);
49991 if (Object.keys(gj).length) {
49992 _geojson = ensureIDs(gj);
49993 _src = extension + " data file";
49996 dispatch14.call("change");
49999 drawData.showLabels = function(val) {
50000 if (!arguments.length) return _showLabels;
50004 drawData.enabled = function(val) {
50005 if (!arguments.length) return _enabled;
50012 dispatch14.call("change");
50015 drawData.hasData = function() {
50016 var gj = _geojson || {};
50017 return !!(_template || Object.keys(gj).length);
50019 drawData.template = function(val, src) {
50020 if (!arguments.length) return _template;
50021 var osm = context.connection();
50023 var blocklists = osm.imageryBlocklists();
50027 for (var i3 = 0; i3 < blocklists.length; i3++) {
50028 regex = blocklists[i3];
50029 fail = regex.test(val);
50034 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
50035 fail = regex.test(val);
50041 _src = src || "vectortile:" + val.split(/[?#]/)[0];
50042 dispatch14.call("change");
50045 drawData.geojson = function(gj, src) {
50046 if (!arguments.length) return _geojson;
50052 if (Object.keys(gj).length) {
50053 _geojson = ensureIDs(gj);
50054 _src = src || "unknown.geojson";
50056 dispatch14.call("change");
50059 drawData.fileList = function(fileList) {
50060 if (!arguments.length) return _fileList;
50064 _fileList = fileList;
50065 if (!fileList || !fileList.length) return this;
50066 var f2 = fileList[0];
50067 var extension = getExtension(f2.name);
50068 var reader = new FileReader();
50069 reader.onload = /* @__PURE__ */ function() {
50070 return function(e3) {
50071 drawData.setFile(extension, e3.target.result);
50074 reader.readAsText(f2);
50077 drawData.url = function(url, defaultExtension) {
50082 var testUrl = url.split(/[?#]/)[0];
50083 var extension = getExtension(testUrl) || defaultExtension;
50086 text_default3(url).then(function(data) {
50087 drawData.setFile(extension, data);
50088 }).catch(function() {
50091 drawData.template(url);
50095 drawData.getSrc = function() {
50098 drawData.fitZoom = function() {
50099 var features = getFeatures(_geojson);
50100 if (!features.length) return;
50101 var map2 = context.map();
50102 var viewport = map2.trimmedExtent().polygon();
50103 var coords = features.reduce(function(coords2, feature3) {
50104 var geom = feature3.geometry;
50105 if (!geom) return coords2;
50106 var c2 = geom.coordinates;
50107 switch (geom.type) {
50113 case "MultiPolygon":
50114 c2 = utilArrayFlatten(c2);
50116 case "MultiLineString":
50117 c2 = utilArrayFlatten(c2);
50120 return utilArrayUnion(coords2, c2);
50122 if (!geoPolygonIntersectsPolygon(viewport, coords, true)) {
50123 var extent = geoExtent(bounds_default({ type: "LineString", coordinates: coords }));
50124 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
50132 // modules/svg/debug.js
50133 function svgDebug(projection2, context) {
50134 function drawDebug(selection2) {
50135 const showTile = context.getDebug("tile");
50136 const showCollision = context.getDebug("collision");
50137 const showImagery = context.getDebug("imagery");
50138 const showTouchTargets = context.getDebug("target");
50139 const showDownloaded = context.getDebug("downloaded");
50140 let debugData = [];
50142 debugData.push({ class: "red", label: "tile" });
50144 if (showCollision) {
50145 debugData.push({ class: "yellow", label: "collision" });
50148 debugData.push({ class: "orange", label: "imagery" });
50150 if (showTouchTargets) {
50151 debugData.push({ class: "pink", label: "touchTargets" });
50153 if (showDownloaded) {
50154 debugData.push({ class: "purple", label: "downloaded" });
50156 let legend = context.container().select(".main-content").selectAll(".debug-legend").data(debugData.length ? [0] : []);
50157 legend.exit().remove();
50158 legend = legend.enter().append("div").attr("class", "fillD debug-legend").merge(legend);
50159 let legendItems = legend.selectAll(".debug-legend-item").data(debugData, (d2) => d2.label);
50160 legendItems.exit().remove();
50161 legendItems.enter().append("span").attr("class", (d2) => "debug-legend-item ".concat(d2.class)).text((d2) => d2.label);
50162 let layer = selection2.selectAll(".layer-debug").data(showImagery || showDownloaded ? [0] : []);
50163 layer.exit().remove();
50164 layer = layer.enter().append("g").attr("class", "layer-debug").merge(layer);
50165 const extent = context.map().extent();
50166 _mainFileFetcher.get("imagery").then((d2) => {
50167 const hits = showImagery && d2.query.bbox(extent.rectangle(), true) || [];
50168 const features = hits.map((d4) => d4.features[d4.id]);
50169 let imagery = layer.selectAll("path.debug-imagery").data(features);
50170 imagery.exit().remove();
50171 imagery.enter().append("path").attr("class", "debug-imagery debug orange");
50174 const osm = context.connection();
50175 let dataDownloaded = [];
50176 if (osm && showDownloaded) {
50177 const rtree = osm.caches("get").tile.rtree;
50178 dataDownloaded = rtree.all().map((bbox2) => {
50181 properties: { id: bbox2.id },
50185 [bbox2.minX, bbox2.minY],
50186 [bbox2.minX, bbox2.maxY],
50187 [bbox2.maxX, bbox2.maxY],
50188 [bbox2.maxX, bbox2.minY],
50189 [bbox2.minX, bbox2.minY]
50195 let downloaded = layer.selectAll("path.debug-downloaded").data(showDownloaded ? dataDownloaded : []);
50196 downloaded.exit().remove();
50197 downloaded.enter().append("path").attr("class", "debug-downloaded debug purple");
50198 layer.selectAll("path").attr("d", svgPath(projection2).geojson);
50200 drawDebug.enabled = function() {
50201 if (!arguments.length) {
50202 return context.getDebug("tile") || context.getDebug("collision") || context.getDebug("imagery") || context.getDebug("target") || context.getDebug("downloaded");
50210 // modules/svg/defs.js
50211 function svgDefs(context) {
50212 var _defsSelection = select_default2(null);
50213 var _spritesheetIds = [
50221 function drawDefs(selection2) {
50222 _defsSelection = selection2.append("defs");
50223 _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");
50224 function addSidedMarker(name, color2, offset) {
50225 _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);
50227 addSidedMarker("natural", "rgb(170, 170, 170)", 0);
50228 addSidedMarker("coastline", "#77dede", 1);
50229 addSidedMarker("waterway", "#77dede", 1);
50230 addSidedMarker("barrier", "#ddd", 1);
50231 addSidedMarker("man_made", "#fff", 0);
50232 _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");
50233 _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");
50234 var patterns2 = _defsSelection.selectAll("pattern").data([
50235 // pattern name, pattern image name
50237 ["construction", "construction"],
50238 ["cemetery", "cemetery"],
50239 ["cemetery_christian", "cemetery_christian"],
50240 ["cemetery_buddhist", "cemetery_buddhist"],
50241 ["cemetery_muslim", "cemetery_muslim"],
50242 ["cemetery_jewish", "cemetery_jewish"],
50243 ["farmland", "farmland"],
50244 ["farmyard", "farmyard"],
50245 ["forest", "forest"],
50246 ["forest_broadleaved", "forest_broadleaved"],
50247 ["forest_needleleaved", "forest_needleleaved"],
50248 ["forest_leafless", "forest_leafless"],
50249 ["golf_green", "grass"],
50250 ["grass", "grass"],
50251 ["landfill", "landfill"],
50252 ["meadow", "grass"],
50253 ["orchard", "orchard"],
50255 ["quarry", "quarry"],
50256 ["scrub", "bushes"],
50257 ["vineyard", "vineyard"],
50258 ["water_standing", "lines"],
50259 ["waves", "waves"],
50260 ["wetland", "wetland"],
50261 ["wetland_marsh", "wetland_marsh"],
50262 ["wetland_swamp", "wetland_swamp"],
50263 ["wetland_bog", "wetland_bog"],
50264 ["wetland_reedbed", "wetland_reedbed"]
50265 ]).enter().append("pattern").attr("id", function(d2) {
50266 return "ideditor-pattern-" + d2[0];
50267 }).attr("width", 32).attr("height", 32).attr("patternUnits", "userSpaceOnUse");
50268 patterns2.append("rect").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("class", function(d2) {
50269 return "pattern-color-" + d2[0];
50271 patterns2.append("image").attr("x", 0).attr("y", 0).attr("width", 32).attr("height", 32).attr("xlink:href", function(d2) {
50272 return context.imagePath("pattern/" + d2[1] + ".png");
50274 _defsSelection.selectAll("clipPath").data([12, 18, 20, 32, 45]).enter().append("clipPath").attr("id", function(d2) {
50275 return "ideditor-clip-square-" + d2;
50276 }).append("rect").attr("x", 0).attr("y", 0).attr("width", function(d2) {
50278 }).attr("height", function(d2) {
50281 addSprites(_spritesheetIds, true);
50283 function addSprites(ids, overrideColors) {
50284 _spritesheetIds = utilArrayUniq(_spritesheetIds.concat(ids));
50285 var spritesheets = _defsSelection.selectAll(".spritesheet").data(_spritesheetIds);
50286 spritesheets.enter().append("g").attr("class", function(d2) {
50287 return "spritesheet spritesheet-" + d2;
50288 }).each(function(d2) {
50289 var url = context.imagePath(d2 + ".svg");
50290 var node = select_default2(this).node();
50291 svg(url).then(function(svg2) {
50293 select_default2(svg2.documentElement).attr("id", "ideditor-" + d2).node()
50295 if (overrideColors && d2 !== "iD-sprite") {
50296 select_default2(node).selectAll("path").attr("fill", "currentColor");
50298 }).catch(function() {
50301 spritesheets.exit().remove();
50303 drawDefs.addSprites = addSprites;
50307 // modules/svg/keepRight.js
50308 var _layerEnabled = false;
50310 function svgKeepRight(projection2, context, dispatch14) {
50311 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
50312 const minZoom5 = 12;
50313 let touchLayer = select_default2(null);
50314 let drawLayer = select_default2(null);
50315 let layerVisible = false;
50316 function markerPath(selection2, klass) {
50317 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");
50319 function getService() {
50320 if (services.keepRight && !_qaService) {
50321 _qaService = services.keepRight;
50322 _qaService.on("loaded", throttledRedraw);
50323 } else if (!services.keepRight && _qaService) {
50328 function editOn() {
50329 if (!layerVisible) {
50330 layerVisible = true;
50331 drawLayer.style("display", "block");
50334 function editOff() {
50335 if (layerVisible) {
50336 layerVisible = false;
50337 drawLayer.style("display", "none");
50338 drawLayer.selectAll(".qaItem.keepRight").remove();
50339 touchLayer.selectAll(".qaItem.keepRight").remove();
50342 function layerOn() {
50344 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
50346 function layerOff() {
50347 throttledRedraw.cancel();
50348 drawLayer.interrupt();
50349 touchLayer.selectAll(".qaItem.keepRight").remove();
50350 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
50352 dispatch14.call("change");
50355 function updateMarkers() {
50356 if (!layerVisible || !_layerEnabled) return;
50357 const service = getService();
50358 const selectedID = context.selectedErrorID();
50359 const data = service ? service.getItems(projection2) : [];
50360 const getTransform = svgPointTransform(projection2);
50361 const markers = drawLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
50362 markers.exit().remove();
50363 const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.parentIssueType));
50364 markersEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
50365 markersEnter.append("path").call(markerPath, "shadow");
50366 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");
50367 markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
50368 if (touchLayer.empty()) return;
50369 const fillClass = context.getDebug("target") ? "pink " : "nocolor ";
50370 const targets = touchLayer.selectAll(".qaItem.keepRight").data(data, (d2) => d2.id);
50371 targets.exit().remove();
50372 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);
50373 function sortY(a2, b2) {
50374 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];
50377 function drawKeepRight(selection2) {
50378 const service = getService();
50379 const surface = context.surface();
50380 if (surface && !surface.empty()) {
50381 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
50383 drawLayer = selection2.selectAll(".layer-keepRight").data(service ? [0] : []);
50384 drawLayer.exit().remove();
50385 drawLayer = drawLayer.enter().append("g").attr("class", "layer-keepRight").style("display", _layerEnabled ? "block" : "none").merge(drawLayer);
50386 if (_layerEnabled) {
50387 if (service && ~~context.map().zoom() >= minZoom5) {
50389 service.loadIssues(projection2);
50396 drawKeepRight.enabled = function(val) {
50397 if (!arguments.length) return _layerEnabled;
50398 _layerEnabled = val;
50399 if (_layerEnabled) {
50403 if (context.selectedErrorID()) {
50404 context.enter(modeBrowse(context));
50407 dispatch14.call("change");
50410 drawKeepRight.supported = () => !!getService();
50411 return drawKeepRight;
50414 // modules/svg/geolocate.js
50415 function svgGeolocate(projection2) {
50416 var layer = select_default2(null);
50419 if (svgGeolocate.initialized) return;
50420 svgGeolocate.enabled = false;
50421 svgGeolocate.initialized = true;
50423 function showLayer() {
50424 layer.style("display", "block");
50426 function hideLayer() {
50427 layer.transition().duration(250).style("opacity", 0);
50429 function layerOn() {
50430 layer.style("opacity", 0).transition().duration(250).style("opacity", 1);
50432 function layerOff() {
50433 layer.style("display", "none");
50435 function transform2(d2) {
50436 return svgPointTransform(projection2)(d2);
50438 function accuracy(accuracy2, loc) {
50439 var degreesRadius = geoMetersToLat(accuracy2), tangentLoc = [loc[0], loc[1] + degreesRadius], projectedTangent = projection2(tangentLoc), projectedLoc = projection2([loc[0], loc[1]]);
50440 return Math.round(projectedLoc[1] - projectedTangent[1]).toString();
50442 function update() {
50443 var geolocation = { loc: [_position.coords.longitude, _position.coords.latitude] };
50444 var groups = layer.selectAll(".geolocations").selectAll(".geolocation").data([geolocation]);
50445 groups.exit().remove();
50446 var pointsEnter = groups.enter().append("g").attr("class", "geolocation");
50447 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");
50448 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");
50449 groups.merge(pointsEnter).attr("transform", transform2);
50450 layer.select(".geolocate-radius").attr("r", accuracy(_position.coords.accuracy, geolocation.loc));
50452 function drawLocation(selection2) {
50453 var enabled = svgGeolocate.enabled;
50454 layer = selection2.selectAll(".layer-geolocate").data([0]);
50455 layer.exit().remove();
50456 var layerEnter = layer.enter().append("g").attr("class", "layer-geolocate").style("display", enabled ? "block" : "none");
50457 layerEnter.append("g").attr("class", "geolocations");
50458 layer = layerEnter.merge(layer);
50465 drawLocation.enabled = function(position, enabled) {
50466 if (!arguments.length) return svgGeolocate.enabled;
50467 _position = position;
50468 svgGeolocate.enabled = enabled;
50469 if (svgGeolocate.enabled) {
50478 return drawLocation;
50481 // modules/svg/labels.js
50482 function svgLabels(projection2, context) {
50483 var path = path_default(projection2);
50484 var detected = utilDetect();
50485 var baselineHack = detected.ie || detected.browser.toLowerCase() === "edge" || detected.browser.toLowerCase() === "firefox" && detected.version >= 70;
50486 var _rdrawn = new RBush();
50487 var _rskipped = new RBush();
50488 var _textWidthCache = {};
50489 var _entitybboxes = {};
50491 ["line", "aeroway", "*", 12],
50492 ["line", "highway", "motorway", 12],
50493 ["line", "highway", "trunk", 12],
50494 ["line", "highway", "primary", 12],
50495 ["line", "highway", "secondary", 12],
50496 ["line", "highway", "tertiary", 12],
50497 ["line", "highway", "*", 12],
50498 ["line", "railway", "*", 12],
50499 ["line", "waterway", "*", 12],
50500 ["area", "aeroway", "*", 12],
50501 ["area", "amenity", "*", 12],
50502 ["area", "building", "*", 12],
50503 ["area", "historic", "*", 12],
50504 ["area", "leisure", "*", 12],
50505 ["area", "man_made", "*", 12],
50506 ["area", "natural", "*", 12],
50507 ["area", "shop", "*", 12],
50508 ["area", "tourism", "*", 12],
50509 ["area", "camp_site", "*", 12],
50510 ["point", "aeroway", "*", 10],
50511 ["point", "amenity", "*", 10],
50512 ["point", "building", "*", 10],
50513 ["point", "historic", "*", 10],
50514 ["point", "leisure", "*", 10],
50515 ["point", "man_made", "*", 10],
50516 ["point", "natural", "*", 10],
50517 ["point", "shop", "*", 10],
50518 ["point", "tourism", "*", 10],
50519 ["point", "camp_site", "*", 10],
50520 ["line", "ref", "*", 12],
50521 ["area", "ref", "*", 12],
50522 ["point", "ref", "*", 10],
50523 ["line", "name", "*", 12],
50524 ["area", "name", "*", 12],
50525 ["point", "name", "*", 10]
50527 function shouldSkipIcon(preset) {
50528 var noIcons = ["building", "landuse", "natural"];
50529 return noIcons.some(function(s2) {
50530 return preset.id.indexOf(s2) >= 0;
50533 function get4(array2, prop) {
50534 return function(d2, i3) {
50535 return array2[i3][prop];
50538 function textWidth(text, size, elem) {
50539 var c2 = _textWidthCache[size];
50540 if (!c2) c2 = _textWidthCache[size] = {};
50544 c2[text] = elem.getComputedTextLength();
50547 var str = encodeURIComponent(text).match(/%[CDEFcdef]/g);
50548 if (str === null) {
50549 return size / 3 * 2 * text.length;
50551 return size / 3 * (2 * text.length + str.length);
50555 function drawLinePaths(selection2, entities, filter2, classes, labels) {
50556 var paths = selection2.selectAll("path").filter(filter2).data(entities, osmEntity.key);
50557 paths.exit().remove();
50558 paths.enter().append("path").style("stroke-width", get4(labels, "font-size")).attr("id", function(d2) {
50559 return "ideditor-labelpath-" + d2.id;
50560 }).attr("class", classes).merge(paths).attr("d", get4(labels, "lineString"));
50562 function drawLineLabels(selection2, entities, filter2, classes, labels) {
50563 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
50564 texts.exit().remove();
50565 texts.enter().append("text").attr("class", function(d2, i3) {
50566 return classes + " " + labels[i3].classes + " " + d2.id;
50567 }).attr("dy", baselineHack ? "0.35em" : null).append("textPath").attr("class", "textpath");
50568 selection2.selectAll("text." + classes).selectAll(".textpath").filter(filter2).data(entities, osmEntity.key).attr("startOffset", "50%").attr("xlink:href", function(d2) {
50569 return "#ideditor-labelpath-" + d2.id;
50570 }).text(utilDisplayNameForPath);
50572 function drawPointLabels(selection2, entities, filter2, classes, labels) {
50573 var texts = selection2.selectAll("text." + classes).filter(filter2).data(entities, osmEntity.key);
50574 texts.exit().remove();
50575 texts.enter().append("text").attr("class", function(d2, i3) {
50576 return classes + " " + labels[i3].classes + " " + d2.id;
50577 }).merge(texts).attr("x", get4(labels, "x")).attr("y", get4(labels, "y")).style("text-anchor", get4(labels, "textAnchor")).text(utilDisplayName).each(function(d2, i3) {
50578 textWidth(utilDisplayName(d2), labels[i3].height, this);
50581 function drawAreaLabels(selection2, entities, filter2, classes, labels) {
50582 entities = entities.filter(hasText);
50583 labels = labels.filter(hasText);
50584 drawPointLabels(selection2, entities, filter2, classes, labels);
50585 function hasText(d2, i3) {
50586 return labels[i3].hasOwnProperty("x") && labels[i3].hasOwnProperty("y");
50589 function drawAreaIcons(selection2, entities, filter2, classes, labels) {
50590 var icons = selection2.selectAll("use." + classes).filter(filter2).data(entities, osmEntity.key);
50591 icons.exit().remove();
50592 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) {
50593 var preset = _mainPresetIndex.match(d2, context.graph());
50594 var picon = preset && preset.icon;
50595 return picon ? "#" + picon : "";
50598 function drawCollisionBoxes(selection2, rtree, which) {
50599 var classes = "debug " + which + " " + (which === "debug-skipped" ? "orange" : "yellow");
50601 if (context.getDebug("collision")) {
50602 gj = rtree.all().map(function(d2) {
50603 return { type: "Polygon", coordinates: [[
50604 [d2.minX, d2.minY],
50605 [d2.maxX, d2.minY],
50606 [d2.maxX, d2.maxY],
50607 [d2.minX, d2.maxY],
50612 var boxes = selection2.selectAll("." + which).data(gj);
50613 boxes.exit().remove();
50614 boxes.enter().append("path").attr("class", classes).merge(boxes).attr("d", path_default());
50616 function drawLabels(selection2, graph, entities, filter2, dimensions, fullRedraw) {
50617 var wireframe = context.surface().classed("fill-wireframe");
50618 var zoom = geoScaleToZoom(projection2.scale());
50619 var labelable = [];
50620 var renderNodeAs = {};
50621 var i3, j2, k2, entity, geometry;
50622 for (i3 = 0; i3 < labelStack.length; i3++) {
50623 labelable.push([]);
50628 _entitybboxes = {};
50630 for (i3 = 0; i3 < entities.length; i3++) {
50631 entity = entities[i3];
50632 var toRemove = [].concat(_entitybboxes[entity.id] || []).concat(_entitybboxes[entity.id + "I"] || []);
50633 for (j2 = 0; j2 < toRemove.length; j2++) {
50634 _rdrawn.remove(toRemove[j2]);
50635 _rskipped.remove(toRemove[j2]);
50639 for (i3 = 0; i3 < entities.length; i3++) {
50640 entity = entities[i3];
50641 geometry = entity.geometry(graph);
50642 if (geometry === "point" || geometry === "vertex" && isInterestingVertex(entity)) {
50643 var hasDirections = entity.directions(graph, projection2).length;
50645 if (!wireframe && geometry === "point" && !(zoom >= 18 && hasDirections)) {
50646 renderNodeAs[entity.id] = "point";
50647 markerPadding = 20;
50649 renderNodeAs[entity.id] = "vertex";
50652 var coord2 = projection2(entity.loc);
50653 var nodePadding = 10;
50655 minX: coord2[0] - nodePadding,
50656 minY: coord2[1] - nodePadding - markerPadding,
50657 maxX: coord2[0] + nodePadding,
50658 maxY: coord2[1] + nodePadding
50660 doInsert(bbox2, entity.id + "P");
50662 if (geometry === "vertex") {
50663 geometry = "point";
50665 var preset = geometry === "area" && _mainPresetIndex.match(entity, graph);
50666 var icon2 = preset && !shouldSkipIcon(preset) && preset.icon;
50667 if (!icon2 && !utilDisplayName(entity)) continue;
50668 for (k2 = 0; k2 < labelStack.length; k2++) {
50669 var matchGeom = labelStack[k2][0];
50670 var matchKey = labelStack[k2][1];
50671 var matchVal = labelStack[k2][2];
50672 var hasVal = entity.tags[matchKey];
50673 if (geometry === matchGeom && hasVal && (matchVal === "*" || matchVal === hasVal)) {
50674 labelable[k2].push(entity);
50689 for (k2 = 0; k2 < labelable.length; k2++) {
50690 var fontSize = labelStack[k2][3];
50691 for (i3 = 0; i3 < labelable[k2].length; i3++) {
50692 entity = labelable[k2][i3];
50693 geometry = entity.geometry(graph);
50694 var getName = geometry === "line" ? utilDisplayNameForPath : utilDisplayName;
50695 var name = getName(entity);
50696 var width = name && textWidth(name, fontSize);
50698 if (geometry === "point" || geometry === "vertex") {
50699 if (wireframe) continue;
50700 var renderAs = renderNodeAs[entity.id];
50701 if (renderAs === "vertex" && zoom < 17) continue;
50702 p2 = getPointLabel(entity, width, fontSize, renderAs);
50703 } else if (geometry === "line") {
50704 p2 = getLineLabel(entity, width, fontSize);
50705 } else if (geometry === "area") {
50706 p2 = getAreaLabel(entity, width, fontSize);
50709 if (geometry === "vertex") {
50710 geometry = "point";
50712 p2.classes = geometry + " tag-" + labelStack[k2][1];
50713 positions[geometry].push(p2);
50714 labelled[geometry].push(entity);
50718 function isInterestingVertex(entity2) {
50719 var selectedIDs = context.selectedIDs();
50720 return entity2.hasInterestingTags() || entity2.isEndpoint(graph) || entity2.isConnected(graph) || selectedIDs.indexOf(entity2.id) !== -1 || graph.parentWays(entity2).some(function(parent) {
50721 return selectedIDs.indexOf(parent.id) !== -1;
50724 function getPointLabel(entity2, width2, height, geometry2) {
50725 var y2 = geometry2 === "point" ? -12 : 0;
50726 var pointOffsets = {
50727 ltr: [15, y2, "start"],
50728 rtl: [-15, y2, "end"]
50730 var textDirection = _mainLocalizer.textDirection();
50731 var coord3 = projection2(entity2.loc);
50732 var textPadding = 2;
50733 var offset = pointOffsets[textDirection];
50737 x: coord3[0] + offset[0],
50738 y: coord3[1] + offset[1],
50739 textAnchor: offset[2]
50742 if (textDirection === "rtl") {
50744 minX: p3.x - width2 - textPadding,
50745 minY: p3.y - height / 2 - textPadding,
50746 maxX: p3.x + textPadding,
50747 maxY: p3.y + height / 2 + textPadding
50751 minX: p3.x - textPadding,
50752 minY: p3.y - height / 2 - textPadding,
50753 maxX: p3.x + width2 + textPadding,
50754 maxY: p3.y + height / 2 + textPadding
50757 if (tryInsert([bbox3], entity2.id, true)) {
50761 function getLineLabel(entity2, width2, height) {
50762 var viewport = geoExtent(context.projection.clipExtent()).polygon();
50763 var points = graph.childNodes(entity2).map(function(node) {
50764 return projection2(node.loc);
50766 var length2 = geoPathLength(points);
50767 if (length2 < width2 + 20) return;
50768 var lineOffsets = [
50790 for (var i4 = 0; i4 < lineOffsets.length; i4++) {
50791 var offset = lineOffsets[i4];
50792 var middle = offset / 100 * length2;
50793 var start2 = middle - width2 / 2;
50794 if (start2 < 0 || start2 + width2 > length2) continue;
50795 var sub = subpath(points, start2, start2 + width2);
50796 if (!sub || !geoPolygonIntersectsPolygon(viewport, sub, true)) {
50799 var isReverse = reverse(sub);
50801 sub = sub.reverse();
50804 var boxsize = (height + 2) / 2;
50805 for (var j3 = 0; j3 < sub.length - 1; j3++) {
50807 var b2 = sub[j3 + 1];
50808 var num = Math.max(1, Math.floor(geoVecLength(a2, b2) / boxsize / 2));
50809 for (var box = 0; box < num; box++) {
50810 var p3 = geoVecInterp(a2, b2, box / num);
50811 var x05 = p3[0] - boxsize - padding;
50812 var y05 = p3[1] - boxsize - padding;
50813 var x12 = p3[0] + boxsize + padding;
50814 var y12 = p3[1] + boxsize + padding;
50816 minX: Math.min(x05, x12),
50817 minY: Math.min(y05, y12),
50818 maxX: Math.max(x05, x12),
50819 maxY: Math.max(y05, y12)
50823 if (tryInsert(bboxes, entity2.id, false)) {
50825 "font-size": height + 2,
50826 lineString: lineString2(sub),
50827 startOffset: offset + "%"
50831 function reverse(p4) {
50832 var angle2 = Math.atan2(p4[1][1] - p4[0][1], p4[1][0] - p4[0][0]);
50833 return !(p4[0][0] < p4[p4.length - 1][0] && angle2 < Math.PI / 2 && angle2 > -Math.PI / 2);
50835 function lineString2(points2) {
50836 return "M" + points2.join("L");
50838 function subpath(points2, from, to) {
50840 var start3, end, i0, i1;
50841 for (var i5 = 0; i5 < points2.length - 1; i5++) {
50842 var a3 = points2[i5];
50843 var b3 = points2[i5 + 1];
50844 var current = geoVecLength(a3, b3);
50846 if (!start3 && sofar + current >= from) {
50847 portion = (from - sofar) / current;
50849 a3[0] + portion * (b3[0] - a3[0]),
50850 a3[1] + portion * (b3[1] - a3[1])
50854 if (!end && sofar + current >= to) {
50855 portion = (to - sofar) / current;
50857 a3[0] + portion * (b3[0] - a3[0]),
50858 a3[1] + portion * (b3[1] - a3[1])
50864 var result = points2.slice(i0, i1);
50865 result.unshift(start3);
50870 function getAreaLabel(entity2, width2, height) {
50871 var centroid = path.centroid(entity2.asGeoJSON(graph));
50872 var extent = entity2.extent(graph);
50873 var areaWidth = projection2(extent[1])[0] - projection2(extent[0])[0];
50874 if (isNaN(centroid[0]) || areaWidth < 20) return;
50875 var preset2 = _mainPresetIndex.match(entity2, context.graph());
50876 var picon = preset2 && preset2.icon;
50882 addLabel(iconSize + padding);
50890 function addIcon() {
50891 var iconX = centroid[0] - iconSize / 2;
50892 var iconY = centroid[1] - iconSize / 2;
50896 maxX: iconX + iconSize,
50897 maxY: iconY + iconSize
50899 if (tryInsert([bbox3], entity2.id + "I", true)) {
50900 p3.transform = "translate(" + iconX + "," + iconY + ")";
50905 function addLabel(yOffset) {
50906 if (width2 && areaWidth >= width2 + 20) {
50907 var labelX = centroid[0];
50908 var labelY = centroid[1] + yOffset;
50910 minX: labelX - width2 / 2 - padding,
50911 minY: labelY - height / 2 - padding,
50912 maxX: labelX + width2 / 2 + padding,
50913 maxY: labelY + height / 2 + padding
50915 if (tryInsert([bbox3], entity2.id, true)) {
50918 p3.textAnchor = "middle";
50919 p3.height = height;
50926 function doInsert(bbox3, id2) {
50928 var oldbox = _entitybboxes[id2];
50930 _rdrawn.remove(oldbox);
50932 _entitybboxes[id2] = bbox3;
50933 _rdrawn.insert(bbox3);
50935 function tryInsert(bboxes, id2, saveSkipped) {
50936 var skipped = false;
50937 for (var i4 = 0; i4 < bboxes.length; i4++) {
50938 var bbox3 = bboxes[i4];
50940 if (bbox3.minX < 0 || bbox3.minY < 0 || bbox3.maxX > dimensions[0] || bbox3.maxY > dimensions[1]) {
50944 if (_rdrawn.collides(bbox3)) {
50949 _entitybboxes[id2] = bboxes;
50952 _rskipped.load(bboxes);
50955 _rdrawn.load(bboxes);
50959 var layer = selection2.selectAll(".layer-osm.labels");
50960 layer.selectAll(".labels-group").data(["halo", "label", "debug"]).enter().append("g").attr("class", function(d2) {
50961 return "labels-group " + d2;
50963 var halo = layer.selectAll(".labels-group.halo");
50964 var label = layer.selectAll(".labels-group.label");
50965 var debug2 = layer.selectAll(".labels-group.debug");
50966 drawPointLabels(label, labelled.point, filter2, "pointlabel", positions.point);
50967 drawPointLabels(halo, labelled.point, filter2, "pointlabel-halo", positions.point);
50968 drawLinePaths(layer, labelled.line, filter2, "", positions.line);
50969 drawLineLabels(label, labelled.line, filter2, "linelabel", positions.line);
50970 drawLineLabels(halo, labelled.line, filter2, "linelabel-halo", positions.line);
50971 drawAreaLabels(label, labelled.area, filter2, "arealabel", positions.area);
50972 drawAreaLabels(halo, labelled.area, filter2, "arealabel-halo", positions.area);
50973 drawAreaIcons(label, labelled.area, filter2, "areaicon", positions.area);
50974 drawAreaIcons(halo, labelled.area, filter2, "areaicon-halo", positions.area);
50975 drawCollisionBoxes(debug2, _rskipped, "debug-skipped");
50976 drawCollisionBoxes(debug2, _rdrawn, "debug-drawn");
50977 layer.call(filterLabels);
50979 function filterLabels(selection2) {
50980 var drawLayer = selection2.selectAll(".layer-osm.labels");
50981 var layers = drawLayer.selectAll(".labels-group.halo, .labels-group.label");
50982 layers.selectAll(".nolabel").classed("nolabel", false);
50983 var mouse = context.map().mouse();
50984 var graph = context.graph();
50985 var selectedIDs = context.selectedIDs();
50990 bbox2 = { minX: mouse[0] - pad2, minY: mouse[1] - pad2, maxX: mouse[0] + pad2, maxY: mouse[1] + pad2 };
50991 var nearMouse = _rdrawn.search(bbox2).map(function(entity2) {
50994 ids.push.apply(ids, nearMouse);
50996 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
50997 var entity = graph.hasEntity(selectedIDs[i3]);
50998 if (entity && entity.type === "node") {
50999 ids.push(selectedIDs[i3]);
51002 layers.selectAll(utilEntitySelector(ids)).classed("nolabel", true);
51003 var debug2 = selection2.selectAll(".labels-group.debug");
51005 if (context.getDebug("collision")) {
51009 [bbox2.minX, bbox2.minY],
51010 [bbox2.maxX, bbox2.minY],
51011 [bbox2.maxX, bbox2.maxY],
51012 [bbox2.minX, bbox2.maxY],
51013 [bbox2.minX, bbox2.minY]
51017 var box = debug2.selectAll(".debug-mouse").data(gj);
51018 box.exit().remove();
51019 box.enter().append("path").attr("class", "debug debug-mouse yellow").merge(box).attr("d", path_default());
51021 var throttleFilterLabels = throttle_default(filterLabels, 100);
51022 drawLabels.observe = function(selection2) {
51023 var listener = function() {
51024 throttleFilterLabels(selection2);
51026 selection2.on("mousemove.hidelabels", listener);
51027 context.on("enter.hidelabels", listener);
51029 drawLabels.off = function(selection2) {
51030 throttleFilterLabels.cancel();
51031 selection2.on("mousemove.hidelabels", null);
51032 context.on("enter.hidelabels", null);
51037 // node_modules/exifr/dist/full.esm.mjs
51038 var e = "undefined" != typeof self ? self : global;
51039 var t = "undefined" != typeof navigator;
51040 var i2 = t && "undefined" == typeof HTMLImageElement;
51041 var n2 = !("undefined" == typeof global || "undefined" == typeof process || !process.versions || !process.versions.node);
51045 var o = (e3) => e3;
51046 function l(e3, t2 = o) {
51048 return "function" == typeof __require ? Promise.resolve(t2(__require(e3))) : import(
51049 /* webpackIgnore: true */
51053 console.warn("Couldn't load ".concat(e3));
51057 var u = (e3) => h = e3;
51059 const e3 = l("http", (e4) => e4), t2 = l("https", (e4) => e4), i3 = (n3, { headers: s2 } = {}) => new Promise(async (r2, a2) => {
51060 let { port: o2, hostname: l2, pathname: h2, protocol: u2, search: c2 } = new URL(n3);
51061 const f2 = { method: "GET", hostname: l2, path: encodeURI(h2) + c2, headers: s2 };
51062 "" !== o2 && (f2.port = Number(o2));
51063 const d2 = ("https:" === u2 ? await t2 : await e3).request(f2, (e4) => {
51064 if (301 === e4.statusCode || 302 === e4.statusCode) {
51065 let t3 = new URL(e4.headers.location, n3).toString();
51066 return i3(t3, { headers: s2 }).then(r2).catch(a2);
51068 r2({ status: e4.statusCode, arrayBuffer: () => new Promise((t3) => {
51070 e4.on("data", (e6) => i4.push(e6)), e4.on("end", () => t3(Buffer.concat(i4)));
51073 d2.on("error", a2), d2.end();
51077 function c(e3, t2, i3) {
51078 return t2 in e3 ? Object.defineProperty(e3, t2, { value: i3, enumerable: true, configurable: true, writable: true }) : e3[t2] = i3, e3;
51080 var f = (e3) => p(e3) ? void 0 : e3;
51081 var d = (e3) => void 0 !== e3;
51083 return void 0 === e3 || (e3 instanceof Map ? 0 === e3.size : 0 === Object.values(e3).filter(d).length);
51086 let t2 = new Error(e3);
51087 throw delete t2.stack, t2;
51090 return "" === (e3 = function(e4) {
51091 for (; e4.endsWith("\0"); ) e4 = e4.slice(0, -1);
51093 }(e3).trim()) ? void 0 : e3;
51096 let t2 = function(e4) {
51098 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;
51100 return e3.jfif.enabled && (t2 += 50), e3.xmp.enabled && (t2 += 2e4), e3.iptc.enabled && (t2 += 14e3), e3.icc.enabled && (t2 += 6e3), t2;
51102 var C = (e3) => String.fromCharCode.apply(null, e3);
51103 var y = "undefined" != typeof TextDecoder ? new TextDecoder("utf-8") : void 0;
51105 return y ? y.decode(e3) : a ? Buffer.from(e3).toString("utf8") : decodeURIComponent(escape(C(e3)));
51108 static from(e3, t2) {
51109 return e3 instanceof this && e3.le === t2 ? e3 : new _I(e3, void 0, void 0, t2);
51111 constructor(e3, t2 = 0, i3, n3) {
51112 if ("boolean" == typeof n3 && (this.le = n3), Array.isArray(e3) && (e3 = new Uint8Array(e3)), 0 === e3) this.byteOffset = 0, this.byteLength = 0;
51113 else if (e3 instanceof ArrayBuffer) {
51114 void 0 === i3 && (i3 = e3.byteLength - t2);
51115 let n4 = new DataView(e3, t2, i3);
51116 this._swapDataView(n4);
51117 } else if (e3 instanceof Uint8Array || e3 instanceof DataView || e3 instanceof _I) {
51118 void 0 === i3 && (i3 = e3.byteLength - t2), (t2 += e3.byteOffset) + i3 > e3.byteOffset + e3.byteLength && g2("Creating view outside of available memory in ArrayBuffer");
51119 let n4 = new DataView(e3.buffer, t2, i3);
51120 this._swapDataView(n4);
51121 } else if ("number" == typeof e3) {
51122 let t3 = new DataView(new ArrayBuffer(e3));
51123 this._swapDataView(t3);
51124 } else g2("Invalid input argument for BufferView: " + e3);
51126 _swapArrayBuffer(e3) {
51127 this._swapDataView(new DataView(e3));
51130 this._swapDataView(new DataView(e3.buffer, e3.byteOffset, e3.byteLength));
51132 _swapDataView(e3) {
51133 this.dataView = e3, this.buffer = e3.buffer, this.byteOffset = e3.byteOffset, this.byteLength = e3.byteLength;
51136 return this.byteLength - e3;
51138 set(e3, t2, i3 = _I) {
51139 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);
51142 return t2 = t2 || this._lengthToEnd(e3), new _I(this, e3, t2);
51145 return new Uint8Array(this.buffer, this.byteOffset, this.byteLength);
51147 getUint8Array(e3, t2) {
51148 return new Uint8Array(this.buffer, this.byteOffset + e3, t2);
51150 getString(e3 = 0, t2 = this.byteLength) {
51151 return b(this.getUint8Array(e3, t2));
51153 getLatin1String(e3 = 0, t2 = this.byteLength) {
51154 let i3 = this.getUint8Array(e3, t2);
51157 getUnicodeString(e3 = 0, t2 = this.byteLength) {
51159 for (let n3 = 0; n3 < t2 && e3 + n3 < this.byteLength; n3 += 2) i3.push(this.getUint16(e3 + n3));
51163 return this.dataView.getInt8(e3);
51166 return this.dataView.getUint8(e3);
51168 getInt16(e3, t2 = this.le) {
51169 return this.dataView.getInt16(e3, t2);
51171 getInt32(e3, t2 = this.le) {
51172 return this.dataView.getInt32(e3, t2);
51174 getUint16(e3, t2 = this.le) {
51175 return this.dataView.getUint16(e3, t2);
51177 getUint32(e3, t2 = this.le) {
51178 return this.dataView.getUint32(e3, t2);
51180 getFloat32(e3, t2 = this.le) {
51181 return this.dataView.getFloat32(e3, t2);
51183 getFloat64(e3, t2 = this.le) {
51184 return this.dataView.getFloat64(e3, t2);
51186 getFloat(e3, t2 = this.le) {
51187 return this.dataView.getFloat32(e3, t2);
51189 getDouble(e3, t2 = this.le) {
51190 return this.dataView.getFloat64(e3, t2);
51192 getUintBytes(e3, t2, i3) {
51195 return this.getUint8(e3, i3);
51197 return this.getUint16(e3, i3);
51199 return this.getUint32(e3, i3);
51201 return this.getUint64 && this.getUint64(e3, i3);
51204 getUint(e3, t2, i3) {
51207 return this.getUint8(e3, i3);
51209 return this.getUint16(e3, i3);
51211 return this.getUint32(e3, i3);
51213 return this.getUint64 && this.getUint64(e3, i3);
51217 return this.dataView.toString(e3, this.constructor.name);
51222 function P(e3, t2) {
51223 g2("".concat(e3, " '").concat(t2, "' was not loaded, try using full build of exifr."));
51225 var k = class extends Map {
51227 super(), this.kind = e3;
51230 return this.has(e3) || P(this.kind, e3), t2 && (e3 in t2 || function(e4, t3) {
51231 g2("Unknown ".concat(e4, " '").concat(t3, "'."));
51232 }(this.kind, e3), t2[e3].enabled || P(this.kind, e3)), super.get(e3);
51235 return Array.from(this.keys());
51238 var w = new k("file parser");
51239 var T = new k("segment parser");
51240 var A = new k("file reader");
51241 function D(e3, n3) {
51242 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");
51244 function O(e3, i3) {
51245 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");
51248 async function x(e3, t2, i3, n3) {
51249 return A.has(i3) ? v(e3, t2, i3) : n3 ? async function(e4, t3) {
51250 let i4 = await t3(e4);
51252 }(e3, n3) : void g2("Parser ".concat(i3, " is not loaded"));
51254 async function v(e3, t2, i3) {
51255 let n3 = new (A.get(i3))(e3, t2);
51256 return await n3.read(), n3;
51258 var M = (e3) => h(e3).then((e4) => e4.arrayBuffer());
51259 var R = (e3) => new Promise((t2, i3) => {
51260 let n3 = new FileReader();
51261 n3.onloadend = () => t2(n3.result || new ArrayBuffer()), n3.onerror = i3, n3.readAsArrayBuffer(e3);
51263 var L = class extends Map {
51265 return this.allKeys || (this.allKeys = Array.from(this.keys())), this.allKeys;
51268 return this.allValues || (this.allValues = Array.from(this.values())), this.allValues;
51271 function U(e3, t2, i3) {
51273 for (let [e4, t3] of i3) n3.set(e4, t3);
51274 if (Array.isArray(t2)) for (let i4 of t2) e3.set(i4, n3);
51275 else e3.set(t2, n3);
51278 function F(e3, t2, i3) {
51279 let n3, s2 = e3.get(t2);
51280 for (n3 of i3) s2.set(n3[0], n3[1]);
51282 var E = /* @__PURE__ */ new Map();
51283 var B = /* @__PURE__ */ new Map();
51284 var N = /* @__PURE__ */ new Map();
51285 var G = ["chunked", "firstChunkSize", "firstChunkSizeNode", "firstChunkSizeBrowser", "chunkSize", "chunkLimit"];
51286 var V = ["jfif", "xmp", "icc", "iptc", "ihdr"];
51287 var z = ["tiff", ...V];
51288 var H = ["ifd0", "ifd1", "exif", "gps", "interop"];
51289 var j = [...z, ...H];
51290 var W = ["makerNote", "userComment"];
51291 var K = ["translateKeys", "translateValues", "reviveValues", "multiSegment"];
51292 var X = [...K, "sanitize", "mergeOutput", "silentErrors"];
51295 return this.translateKeys || this.translateValues || this.reviveValues;
51298 var Y = class extends _ {
51300 return this.enabled || this.deps.size > 0;
51302 constructor(e3, t2, i3, n3) {
51303 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) if (Array.isArray(i3)) this.parse = this.enabled = true, this.canBeFiltered && i3.length > 0 && this.translateTagSet(i3, this.pick);
51304 else if ("object" == typeof i3) {
51305 if (this.enabled = true, this.parse = false !== i3.parse, this.canBeFiltered) {
51306 let { pick: e4, skip: t3 } = i3;
51307 e4 && e4.length > 0 && this.translateTagSet(e4, this.pick), t3 && t3.length > 0 && this.translateTagSet(t3, this.skip);
51309 this.applyInheritables(i3);
51310 } else true === i3 || false === i3 ? this.parse = this.enabled = i3 : g2("Invalid options argument: ".concat(i3));
51312 applyInheritables(e3) {
51314 for (t2 of K) i3 = e3[t2], void 0 !== i3 && (this[t2] = i3);
51316 translateTagSet(e3, t2) {
51318 let i3, n3, { tagKeys: s2, tagValues: r2 } = this.dict;
51319 for (i3 of e3) "string" == typeof i3 ? (n3 = r2.indexOf(i3), -1 === n3 && (n3 = s2.indexOf(Number(i3))), -1 !== n3 && t2.add(Number(s2[n3]))) : t2.add(i3);
51320 } else for (let i3 of e3) t2.add(i3);
51322 finalizeFilters() {
51323 !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);
51326 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 };
51327 var J = /* @__PURE__ */ new Map();
51328 var q = class extends _ {
51329 static useCached(e3) {
51330 let t2 = J.get(e3);
51331 return void 0 !== t2 || (t2 = new this(e3), J.set(e3, t2)), t2;
51334 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();
51336 setupFromUndefined() {
51338 for (e3 of G) this[e3] = $2[e3];
51339 for (e3 of X) this[e3] = $2[e3];
51340 for (e3 of W) this[e3] = $2[e3];
51341 for (e3 of j) this[e3] = new Y(e3, $2[e3], void 0, this);
51345 for (e3 of G) this[e3] = $2[e3];
51346 for (e3 of X) this[e3] = $2[e3];
51347 for (e3 of W) this[e3] = true;
51348 for (e3 of j) this[e3] = new Y(e3, true, void 0, this);
51350 setupFromArray(e3) {
51352 for (t2 of G) this[t2] = $2[t2];
51353 for (t2 of X) this[t2] = $2[t2];
51354 for (t2 of W) this[t2] = $2[t2];
51355 for (t2 of j) this[t2] = new Y(t2, false, void 0, this);
51356 this.setupGlobalFilters(e3, void 0, H);
51358 setupFromObject(e3) {
51360 for (t2 of (H.ifd0 = H.ifd0 || H.image, H.ifd1 = H.ifd1 || H.thumbnail, Object.assign(this, e3), G)) this[t2] = Z(e3[t2], $2[t2]);
51361 for (t2 of X) this[t2] = Z(e3[t2], $2[t2]);
51362 for (t2 of W) this[t2] = Z(e3[t2], $2[t2]);
51363 for (t2 of z) this[t2] = new Y(t2, $2[t2], e3[t2], this);
51364 for (t2 of H) this[t2] = new Y(t2, $2[t2], e3[t2], this.tiff);
51365 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);
51367 batchEnableWithBool(e3, t2) {
51368 for (let i3 of e3) this[i3].enabled = t2;
51370 batchEnableWithUserValue(e3, t2) {
51371 for (let i3 of e3) {
51373 this[i3].enabled = false !== e4 && void 0 !== e4;
51376 setupGlobalFilters(e3, t2, i3, n3 = i3) {
51377 if (e3 && e3.length) {
51378 for (let e4 of n3) this[e4].enabled = false;
51379 let t3 = Q(e3, i3);
51380 for (let [e4, i4] of t3) ee(this[e4].pick, i4), this[e4].enabled = true;
51381 } else if (t2 && t2.length) {
51382 let e4 = Q(t2, i3);
51383 for (let [t3, i4] of e4) ee(this[t3].skip, i4);
51386 filterNestedSegmentTags() {
51387 let { ifd0: e3, exif: t2, xmp: i3, iptc: n3, icc: s2 } = this;
51388 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);
51390 traverseTiffDependencyTree() {
51391 let { ifd0: e3, exif: t2, gps: i3, interop: n3 } = this;
51392 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;
51393 for (let e4 of H) this[e4].finalizeFilters();
51396 return !V.map((e3) => this[e3].enabled).some((e3) => true === e3) && this.tiff.enabled;
51398 checkLoadedPlugins() {
51399 for (let e3 of z) this[e3].enabled && !T.has(e3) && P("segment parser", e3);
51402 function Q(e3, t2) {
51403 let i3, n3, s2, r2, a2 = [];
51405 for (r2 of (i3 = E.get(s2), n3 = [], i3)) (e3.includes(r2[0]) || e3.includes(r2[1])) && n3.push(r2[0]);
51406 n3.length && a2.push([s2, n3]);
51410 function Z(e3, t2) {
51411 return void 0 !== e3 ? e3 : void 0 !== t2 ? t2 : void 0;
51413 function ee(e3, t2) {
51414 for (let i3 of t2) e3.add(i3);
51416 c(q, "default", $2);
51419 c(this, "parsers", {}), c(this, "output", {}), c(this, "errors", []), c(this, "pushToErrors", (e4) => this.errors.push(e4)), this.options = q.useCached(e3);
51422 this.file = await D(e3, this.options);
51425 if (this.fileParser) return;
51426 let { file: e3 } = this, t2 = e3.getUint16(0);
51427 for (let [i3, n3] of w) if (n3.canHandle(e3, t2)) return this.fileParser = new n3(this.options, this.file, this.parsers), e3[i3] = true;
51428 this.file.close && this.file.close(), g2("Unknown file format");
51431 let { output: e3, errors: t2 } = this;
51432 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);
51434 async executeParsers() {
51435 let { output: e3 } = this;
51436 await this.fileParser.parse();
51437 let t2 = Object.values(this.parsers).map(async (t3) => {
51438 let i3 = await t3.parse();
51439 t3.assignToOutput(e3, i3);
51441 this.options.silentErrors && (t2 = t2.map((e4) => e4.catch(this.pushToErrors))), await Promise.all(t2);
51443 async extractThumbnail() {
51445 let { options: e3, file: t2 } = this, i3 = T.get("tiff", e3);
51447 if (t2.tiff ? n3 = { start: 0, type: "tiff" } : t2.jpeg && (n3 = await this.fileParser.getOrFindSegment("tiff")), void 0 === n3) return;
51448 let s2 = await this.fileParser.ensureSegmentChunk(n3), r2 = this.parsers.tiff = new i3(s2, e3, t2), a2 = await r2.extractThumbnail();
51449 return t2.close && t2.close(), a2;
51452 async function ie(e3, t2) {
51453 let i3 = new te(t2);
51454 return await i3.read(e3), i3.parse();
51456 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 });
51458 constructor(e3, t2, i3) {
51459 c(this, "errors", []), c(this, "ensureSegmentChunk", async (e4) => {
51460 let t3 = e4.start, i4 = e4.size || 65536;
51461 if (this.file.chunked) if (this.file.available(t3, i4)) e4.chunk = this.file.subarray(t3, i4);
51463 e4.chunk = await this.file.readChunk(t3, i4);
51465 g2("Couldn't read segment: ".concat(JSON.stringify(e4), ". ").concat(t4.message));
51467 else 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));
51469 }), this.extendOptions && this.extendOptions(e3), this.options = e3, this.file = t2, this.parsers = i3;
51471 injectSegment(e3, t2) {
51472 this.options[e3].enabled && this.createParser(e3, t2);
51474 createParser(e3, t2) {
51475 let i3 = new (T.get(e3))(t2, this.options, this.file);
51476 return this.parsers[e3] = i3;
51478 createParsers(e3) {
51479 for (let t2 of e3) {
51480 let { type: e4, chunk: i3 } = t2, n3 = this.options[e4];
51481 if (n3 && n3.enabled) {
51482 let t3 = this.parsers[e4];
51483 t3 && t3.append || t3 || this.createParser(e4, i3);
51487 async readSegments(e3) {
51488 let t2 = e3.map(this.ensureSegmentChunk);
51489 await Promise.all(t2);
51493 static findPosition(e3, t2) {
51494 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;
51495 return { offset: t2, length: i3, headerLength: n3, start: s2, size: r2, end: s2 + r2 };
51497 static parse(e3, t2 = {}) {
51498 return new this(e3, new q({ [this.type]: t2 }), e3).parse();
51500 normalizeInput(e3) {
51501 return e3 instanceof I ? e3 : new I(e3);
51503 constructor(e3, t2 = {}, i3) {
51504 c(this, "errors", []), c(this, "raw", /* @__PURE__ */ new Map()), c(this, "handleError", (e4) => {
51505 if (!this.options.silentErrors) throw e4;
51506 this.errors.push(e4.message);
51507 }), 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;
51510 this.canTranslate && (this.translated = this.translateBlock(this.raw, this.type));
51513 return this.translated ? this.translated : this.raw ? Object.fromEntries(this.raw) : void 0;
51515 translateBlock(e3, t2) {
51516 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 = {};
51517 for (let [t3, r3] of e3) 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;
51520 translateValue(e3, t2) {
51521 return t2[e3] || t2.DEFAULT || e3;
51523 assignToOutput(e3, t2) {
51524 this.assignObjectToOutput(e3, this.constructor.type, t2);
51526 assignObjectToOutput(e3, t2, i3) {
51527 if (this.globalOptions.mergeOutput) return Object.assign(e3, i3);
51528 e3[t2] ? Object.assign(e3[t2], i3) : e3[t2] = i3;
51531 c(re2, "headerLength", 4), c(re2, "type", void 0), c(re2, "multiSegment", false), c(re2, "canHandle", () => false);
51533 return 192 === e3 || 194 === e3 || 196 === e3 || 219 === e3 || 221 === e3 || 218 === e3 || 254 === e3;
51536 return e3 >= 224 && e3 <= 239;
51538 function le(e3, t2, i3) {
51539 for (let [n3, s2] of T) if (s2.canHandle(e3, t2, i3)) return n3;
51541 var he = class extends se {
51542 constructor(...e3) {
51543 super(...e3), c(this, "appSegments", []), c(this, "jpegSegments", []), c(this, "unknownSegments", []);
51545 static canHandle(e3, t2) {
51546 return 65496 === t2;
51549 await this.findAppSegments(), await this.readSegments(this.appSegments), this.mergeMultiSegments(), this.createParsers(this.mergedAppSegments || this.appSegments);
51551 setupSegmentFinderArgs(e3) {
51552 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;
51554 async findAppSegments(e3 = 0, t2) {
51555 this.setupSegmentFinderArgs(t2);
51556 let { file: i3, findAll: n3, wanted: s2, remaining: r2 } = this;
51557 if (!n3 && this.file.chunked && (n3 = Array.from(s2).some((e4) => {
51558 let t3 = T.get(e4), i4 = this.options[e4];
51559 return t3.multiSegment && i4.multiSegment;
51560 }), n3 && await this.file.readWhole()), e3 = this.findAppSegmentsInRange(e3, i3.byteLength), !this.options.onlyTiff && i3.chunked) {
51562 for (; r2.size > 0 && !t3 && (i3.canReadNextChunk || this.unfinishedMultiSegment); ) {
51563 let { nextChunkOffset: n4 } = i3, s3 = this.appSegments.some((e4) => !this.file.available(e4.offset || e4.start, e4.length || e4.size));
51564 if (t3 = e3 > n4 && !s3 ? !await i3.readNextChunk(e3) : !await i3.readNextChunk(n4), void 0 === (e3 = this.findAppSegmentsInRange(e3, i3.byteLength))) return;
51568 findAppSegmentsInRange(e3, t2) {
51570 let i3, n3, s2, r2, a2, o2, { file: l2, findAll: h2, wanted: u2, remaining: c2, options: f2 } = this;
51571 for (; e3 < t2; e3++) if (255 === l2.getUint8(e3)) {
51572 if (i3 = l2.getUint8(e3 + 1), oe(i3)) {
51573 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))) break;
51574 f2.recordUnknownSegments && (a2 = re2.findPosition(l2, e3), a2.marker = i3, this.unknownSegments.push(a2)), e3 += n3 + 1;
51575 } else if (ae(i3)) {
51576 if (n3 = l2.getUint16(e3 + 2), 218 === i3 && false !== f2.stopAfterSos) return;
51577 f2.recordJpegSegments && this.jpegSegments.push({ offset: e3, length: n3, marker: i3 }), e3 += n3 + 1;
51582 mergeMultiSegments() {
51583 if (!this.appSegments.some((e4) => e4.multiSegment)) return;
51584 let e3 = function(e4, t2) {
51585 let i3, n3, s2, r2 = /* @__PURE__ */ new Map();
51586 for (let a2 = 0; a2 < e4.length; a2++) i3 = e4[a2], n3 = i3[t2], r2.has(n3) ? s2 = r2.get(n3) : r2.set(n3, s2 = []), s2.push(i3);
51587 return Array.from(r2);
51588 }(this.appSegments, "type");
51589 this.mergedAppSegments = e3.map(([e4, t2]) => {
51590 let i3 = T.get(e4, this.options);
51591 if (i3.handleMultiSegments) {
51592 return { type: e4, chunk: i3.handleMultiSegments(t2) };
51598 return this.appSegments.find((t2) => t2.type === e3);
51600 async getOrFindSegment(e3) {
51601 let t2 = this.getSegment(e3);
51602 return void 0 === t2 && (await this.findAppSegments(0, [e3]), t2 = this.getSegment(e3)), t2;
51605 c(he, "type", "jpeg"), w.set("jpeg", he);
51606 var ue = [void 0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8, 4];
51607 var ce = class extends re2 {
51609 var e3 = this.chunk.getUint16();
51610 18761 === e3 ? this.le = true : 19789 === e3 && (this.le = false), this.chunk.le = this.le, this.headerParsed = true;
51612 parseTags(e3, t2, i3 = /* @__PURE__ */ new Map()) {
51613 let { pick: n3, skip: s2 } = this.options[t2];
51615 let r2 = n3.size > 0, a2 = 0 === s2.size, o2 = this.chunk.getUint16(e3);
51617 for (let l2 = 0; l2 < o2; l2++) {
51618 let o3 = this.chunk.getUint16(e3);
51620 if (n3.has(o3) && (i3.set(o3, this.parseTag(e3, o3, t2)), n3.delete(o3), 0 === n3.size)) break;
51621 } else !a2 && s2.has(o3) || i3.set(o3, this.parseTag(e3, o3, t2));
51626 parseTag(e3, t2, i3) {
51627 let { chunk: n3 } = this, s2 = n3.getUint16(e3 + 2), r2 = n3.getUint32(e3 + 4), a2 = ue[s2];
51628 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) return n3.getUint8Array(e3, r2);
51629 if (2 === s2) return m(n3.getString(e3, r2));
51630 if (7 === s2) return n3.getUint8Array(e3, r2);
51631 if (1 === r2) return this.parseTagValue(s2, e3);
51633 let t3 = new (function(e4) {
51638 return Uint16Array;
51640 return Uint32Array;
51652 return Float32Array;
51654 return Float64Array;
51658 }(s2))(r2), i4 = a2;
51659 for (let n4 = 0; n4 < r2; n4++) t3[n4] = this.parseTagValue(s2, e3), e3 += i4;
51663 parseTagValue(e3, t2) {
51664 let { chunk: i3 } = this;
51667 return i3.getUint8(t2);
51669 return i3.getUint16(t2);
51671 return i3.getUint32(t2);
51673 return i3.getUint32(t2) / i3.getUint32(t2 + 4);
51675 return i3.getInt8(t2);
51677 return i3.getInt16(t2);
51679 return i3.getInt32(t2);
51681 return i3.getInt32(t2) / i3.getInt32(t2 + 4);
51683 return i3.getFloat(t2);
51685 return i3.getDouble(t2);
51687 return i3.getUint32(t2);
51689 g2("Invalid tiff type ".concat(e3));
51693 var fe = class extends ce {
51694 static canHandle(e3, t2) {
51695 return 225 === e3.getUint8(t2 + 1) && 1165519206 === e3.getUint32(t2 + 4) && 0 === e3.getUint16(t2 + 8);
51698 this.parseHeader();
51699 let { options: e3 } = this;
51700 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();
51703 let t2 = this[e3]();
51704 return void 0 !== t2.catch && (t2 = t2.catch(this.handleError)), t2;
51707 void 0 === this.ifd0Offset && (this.ifd0Offset = this.chunk.getUint32(4));
51710 if (void 0 === this.ifd1Offset) {
51711 this.findIfd0Offset();
51712 let e3 = this.chunk.getUint16(this.ifd0Offset), t2 = this.ifd0Offset + 2 + 12 * e3;
51713 this.ifd1Offset = this.chunk.getUint32(t2);
51716 parseBlock(e3, t2) {
51717 let i3 = /* @__PURE__ */ new Map();
51718 return this[t2] = i3, this.parseTags(e3, t2, i3), i3;
51720 async parseIfd0Block() {
51721 if (this.ifd0) return;
51722 let { file: e3 } = this;
51723 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));
51724 let t2 = this.parseBlock(this.ifd0Offset, "ifd0");
51725 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;
51727 async parseExifBlock() {
51728 if (this.exif) return;
51729 if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.exifOffset) return;
51730 this.file.tiff && await this.file.ensureChunk(this.exifOffset, S(this.options));
51731 let e3 = this.parseBlock(this.exifOffset, "exif");
51732 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;
51735 let i3 = e3.get(t2);
51736 i3 && 1 === i3.length && e3.set(t2, i3[0]);
51738 async parseGpsBlock() {
51739 if (this.gps) return;
51740 if (this.ifd0 || await this.parseIfd0Block(), void 0 === this.gpsOffset) return;
51741 let e3 = this.parseBlock(this.gpsOffset, "gps");
51742 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;
51744 async parseInteropBlock() {
51745 if (!this.interop && (this.ifd0 || await this.parseIfd0Block(), void 0 !== this.interopOffset || this.exif || await this.parseExifBlock(), void 0 !== this.interopOffset)) return this.parseBlock(this.interopOffset, "interop");
51747 async parseThumbnailBlock(e3 = false) {
51748 if (!this.ifd1 && !this.ifd1Parsed && (!this.options.mergeOutput || e3)) return this.findIfd1Offset(), this.ifd1Offset > 0 && (this.parseBlock(this.ifd1Offset, "ifd1"), this.ifd1Parsed = true), this.ifd1;
51750 async extractThumbnail() {
51751 if (this.headerParsed || this.parseHeader(), this.ifd1Parsed || await this.parseThumbnailBlock(true), void 0 === this.ifd1) return;
51752 let e3 = this.ifd1.get(513), t2 = this.ifd1.get(514);
51753 return this.chunk.getUint8Array(e3, t2);
51762 let e3, t2, i3, n3 = {};
51763 for (t2 of H) if (e3 = this[t2], !p(e3)) if (i3 = this.canTranslate ? this.translateBlock(e3, t2) : Object.fromEntries(e3), this.options.mergeOutput) {
51764 if ("ifd1" === t2) continue;
51765 Object.assign(n3, i3);
51766 } else n3[t2] = i3;
51767 return this.makerNote && (n3.makerNote = this.makerNote), this.userComment && (n3.userComment = this.userComment), n3;
51769 assignToOutput(e3, t2) {
51770 if (this.globalOptions.mergeOutput) Object.assign(e3, t2);
51771 else for (let [i3, n3] of Object.entries(t2)) this.assignObjectToOutput(e3, i3, n3);
51774 function de(e3, t2, i3, n3) {
51775 var s2 = e3 + t2 / 60 + i3 / 3600;
51776 return "S" !== n3 && "W" !== n3 || (s2 *= -1), s2;
51778 c(fe, "type", "tiff"), c(fe, "headerLength", 10), T.set("tiff", fe);
51779 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 });
51780 var ge = { ifd0: false, ifd1: false, exif: false, gps: false, interop: false, sanitize: false, reviveValues: true, translateKeys: false, translateValues: false, mergeOutput: false };
51781 var me = Object.assign({}, ge, { firstChunkSize: 4e4, gps: [1, 2, 3, 4] });
51782 async function Se(e3) {
51783 let t2 = new te(me);
51785 let i3 = await t2.parse();
51786 if (i3 && i3.gps) {
51787 let { latitude: e4, longitude: t3 } = i3.gps;
51788 return { latitude: e4, longitude: t3 };
51791 var Ce = Object.assign({}, ge, { tiff: false, ifd1: true, mergeOutput: false });
51792 async function ye(e3) {
51793 let t2 = new te(Ce);
51795 let i3 = await t2.extractThumbnail();
51796 return i3 && a ? s.from(i3) : i3;
51798 async function be(e3) {
51799 let t2 = await this.thumbnail(e3);
51800 if (void 0 !== t2) {
51801 let e4 = new Blob([t2]);
51802 return URL.createObjectURL(e4);
51805 var Ie = Object.assign({}, ge, { firstChunkSize: 4e4, ifd0: [274] });
51806 async function Pe(e3) {
51807 let t2 = new te(Ie);
51809 let i3 = await t2.parse();
51810 if (i3 && i3.ifd0) return i3.ifd0[274];
51812 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 } });
51815 if ("object" == typeof navigator) {
51816 let e3 = navigator.userAgent;
51817 if (e3.includes("iPad") || e3.includes("iPhone")) {
51818 let t2 = e3.match(/OS (\d+)_(\d+)/);
51820 let [, e4, i3] = t2, n3 = Number(e4) + 0.1 * Number(i3);
51821 we = n3 < 13.4, Te = false;
51823 } else if (e3.includes("OS X 10")) {
51824 let [, t2] = e3.match(/OS X 10[_.](\d+)/);
51825 we = Te = Number(t2) < 15;
51827 if (e3.includes("Chrome/")) {
51828 let [, t2] = e3.match(/Chrome\/(\d+)/);
51829 we = Te = Number(t2) < 81;
51830 } else if (e3.includes("Firefox/")) {
51831 let [, t2] = e3.match(/Firefox\/(\d+)/);
51832 we = Te = Number(t2) < 77;
51835 async function Ae(e3) {
51836 let t2 = await Pe(e3);
51837 return Object.assign({ canvas: we, css: Te }, ke[t2]);
51839 var De = class extends I {
51840 constructor(...e3) {
51841 super(...e3), c(this, "ranges", new Oe()), 0 !== this.byteLength && this.ranges.add(0, this.byteLength);
51843 _tryExtend(e3, t2, i3) {
51844 if (0 === e3 && 0 === this.byteLength && i3) {
51845 let e4 = new DataView(i3.buffer || i3, i3.byteOffset, i3.byteLength);
51846 this._swapDataView(e4);
51849 if (i4 > this.byteLength) {
51850 let { dataView: e4 } = this._extend(i4);
51851 this._swapDataView(e4);
51857 t2 = a ? s.allocUnsafe(e3) : new Uint8Array(e3);
51858 let i3 = new DataView(t2.buffer, t2.byteOffset, t2.byteLength);
51859 return t2.set(new Uint8Array(this.buffer, this.byteOffset, this.byteLength), 0), { uintView: t2, dataView: i3 };
51861 subarray(e3, t2, i3 = false) {
51862 return t2 = t2 || this._lengthToEnd(e3), i3 && this._tryExtend(e3, t2), this.ranges.add(e3, t2), super.subarray(e3, t2);
51864 set(e3, t2, i3 = false) {
51865 i3 && this._tryExtend(t2, e3.byteLength, e3);
51866 let n3 = super.set(e3, t2);
51867 return this.ranges.add(t2, n3.byteLength), n3;
51869 async ensureChunk(e3, t2) {
51870 this.chunked && (this.ranges.available(e3, t2) || await this.readChunk(e3, t2));
51872 available(e3, t2) {
51873 return this.ranges.available(e3, t2);
51878 c(this, "list", []);
51881 return this.list.length;
51883 add(e3, t2, i3 = 0) {
51884 let n3 = e3 + t2, s2 = this.list.filter((t3) => xe(e3, t3.offset, n3) || xe(e3, t3.end, n3));
51885 if (s2.length > 0) {
51886 e3 = Math.min(e3, ...s2.map((e4) => e4.offset)), n3 = Math.max(n3, ...s2.map((e4) => e4.end)), t2 = n3 - e3;
51887 let i4 = s2.shift();
51888 i4.offset = e3, i4.length = t2, i4.end = n3, this.list = this.list.filter((e4) => !s2.includes(e4));
51889 } else this.list.push({ offset: e3, length: t2, end: n3 });
51891 available(e3, t2) {
51893 return this.list.some((t3) => t3.offset <= e3 && i3 <= t3.end);
51896 function xe(e3, t2, i3) {
51897 return e3 <= t2 && t2 <= i3;
51899 var ve = class extends De {
51900 constructor(e3, t2) {
51901 super(0), c(this, "chunksRead", 0), this.input = e3, this.options = t2;
51903 async readWhole() {
51904 this.chunked = false, await this.readChunk(this.nextChunkOffset);
51906 async readChunked() {
51907 this.chunked = true, await this.readChunk(0, this.options.firstChunkSize);
51909 async readNextChunk(e3 = this.nextChunkOffset) {
51910 if (this.fullyRead) return this.chunksRead++, false;
51911 let t2 = this.options.chunkSize, i3 = await this.readChunk(e3, t2);
51912 return !!i3 && i3.byteLength === t2;
51914 async readChunk(e3, t2) {
51915 if (this.chunksRead++, 0 !== (t2 = this.safeWrapAddress(e3, t2))) return this._readChunk(e3, t2);
51917 safeWrapAddress(e3, t2) {
51918 return void 0 !== this.size && e3 + t2 > this.size ? Math.max(0, this.size - e3) : t2;
51920 get nextChunkOffset() {
51921 if (0 !== this.ranges.list.length) return this.ranges.list[0].length;
51923 get canReadNextChunk() {
51924 return this.chunksRead < this.options.chunkLimit;
51927 return void 0 !== this.size && this.nextChunkOffset === this.size;
51930 return this.options.chunked ? this.readChunked() : this.readWhole();
51935 A.set("blob", class extends ve {
51936 async readWhole() {
51937 this.chunked = false;
51938 let e3 = await R(this.input);
51939 this._swapArrayBuffer(e3);
51942 return this.chunked = true, this.size = this.input.size, super.readChunked();
51944 async _readChunk(e3, t2) {
51945 let i3 = t2 ? e3 + t2 : void 0, n3 = this.input.slice(e3, i3), s2 = await R(n3);
51946 return this.set(s2, e3, true);
51949 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() {
51951 }, get rotateCss() {
51953 }, rotation: Ae });
51954 A.set("url", class extends ve {
51955 async readWhole() {
51956 this.chunked = false;
51957 let e3 = await M(this.input);
51958 e3 instanceof ArrayBuffer ? this._swapArrayBuffer(e3) : e3 instanceof Uint8Array && this._swapBuffer(e3);
51960 async _readChunk(e3, t2) {
51961 let i3 = t2 ? e3 + t2 - 1 : void 0, n3 = this.options.httpHeaders || {};
51962 (e3 || i3) && (n3.range = "bytes=".concat([e3, i3].join("-")));
51963 let s2 = await h(this.input, { headers: n3 }), r2 = await s2.arrayBuffer(), a2 = r2.byteLength;
51964 if (416 !== s2.status) return a2 !== t2 && (this.size = e3 + a2), this.set(r2, e3, true);
51967 I.prototype.getUint64 = function(e3) {
51968 let t2 = this.getUint32(e3), i3 = this.getUint32(e3 + 4);
51969 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.");
51971 var Re = class extends se {
51972 parseBoxes(e3 = 0) {
51974 for (; e3 < this.file.byteLength - 4; ) {
51975 let i3 = this.parseBoxHead(e3);
51976 if (t2.push(i3), 0 === i3.length) break;
51981 parseSubBoxes(e3) {
51982 e3.boxes = this.parseBoxes(e3.start);
51985 return void 0 === e3.boxes && this.parseSubBoxes(e3), e3.boxes.find((e4) => e4.kind === t2);
51988 let t2 = this.file.getUint32(e3), i3 = this.file.getString(e3 + 4, 4), n3 = e3 + 8;
51989 return 1 === t2 && (t2 = this.file.getUint64(e3 + 8), n3 += 8), { offset: e3, length: t2, kind: i3, start: n3 };
51991 parseBoxFullHead(e3) {
51992 if (void 0 !== e3.version) return;
51993 let t2 = this.file.getUint32(e3.start);
51994 e3.version = t2 >> 24, e3.start += 4;
51997 var Le = class extends Re {
51998 static canHandle(e3, t2) {
51999 if (0 !== t2) return false;
52000 let i3 = e3.getUint16(2);
52001 if (i3 > 50) return false;
52002 let n3 = 16, s2 = [];
52003 for (; n3 < i3; ) s2.push(e3.getString(n3, 4)), n3 += 4;
52004 return s2.includes(this.type);
52007 let e3 = this.file.getUint32(0), t2 = this.parseBoxHead(e3);
52008 for (; "meta" !== t2.kind; ) e3 += t2.length, await this.file.ensureChunk(e3, 16), t2 = this.parseBoxHead(e3);
52009 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);
52011 async registerSegment(e3, t2, i3) {
52012 await this.file.ensureChunk(t2, i3);
52013 let n3 = this.file.subarray(t2, i3);
52014 this.createParser(e3, n3);
52016 async findIcc(e3) {
52017 let t2 = this.findBox(e3, "iprp");
52018 if (void 0 === t2) return;
52019 let i3 = this.findBox(t2, "ipco");
52020 if (void 0 === i3) return;
52021 let n3 = this.findBox(i3, "colr");
52022 void 0 !== n3 && await this.registerSegment("icc", n3.offset + 12, n3.length);
52024 async findExif(e3) {
52025 let t2 = this.findBox(e3, "iinf");
52026 if (void 0 === t2) return;
52027 let i3 = this.findBox(e3, "iloc");
52028 if (void 0 === i3) return;
52029 let n3 = this.findExifLocIdInIinf(t2), s2 = this.findExtentInIloc(i3, n3);
52030 if (void 0 === s2) return;
52032 await this.file.ensureChunk(r2, a2);
52033 let o2 = 4 + this.file.getUint32(r2);
52034 r2 += o2, a2 -= o2, await this.registerSegment("tiff", r2, a2);
52036 findExifLocIdInIinf(e3) {
52037 this.parseBoxFullHead(e3);
52038 let t2, i3, n3, s2, r2 = e3.start, a2 = this.file.getUint16(r2);
52039 for (r2 += 2; a2--; ) {
52040 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)) return this.file.getUintBytes(i3, n3);
52045 let t2 = this.file.getUint8(e3);
52046 return [t2 >> 4, 15 & t2];
52048 findExtentInIloc(e3, t2) {
52049 this.parseBoxFullHead(e3);
52050 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);
52051 for (i3 += u2; c2--; ) {
52052 let e4 = this.file.getUintBytes(i3, o2);
52053 i3 += o2 + l2 + 2 + r2;
52054 let u3 = this.file.getUint16(i3);
52055 if (i3 += 2, e4 === t2) 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)];
52060 var Ue = class extends Le {
52062 c(Ue, "type", "heic");
52063 var Fe = class extends Le {
52065 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" }]]);
52066 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" }]]);
52067 var Be = { 1: "No absolute unit of measurement", 2: "Inch", 3: "Centimeter" };
52068 Ee.set(37392, Be), Ee.set(41488, Be);
52069 var Ne = { 0: "Normal", 1: "Low", 2: "High" };
52071 return "object" == typeof e3 && void 0 !== e3.length ? e3[0] : e3;
52074 let t2 = Array.from(e3).slice(1);
52075 return t2[1] > 15 && (t2 = t2.map((e4) => String.fromCharCode(e4))), "0" !== t2[2] && 0 !== t2[2] || t2.pop(), t2.join(".");
52078 if ("string" == typeof e3) {
52079 var [t2, i3, n3, s2, r2, a2] = e3.trim().split(/[-: ]/g).map(Number), o2 = new Date(t2, i3 - 1, n3);
52080 return Number.isNaN(s2) || Number.isNaN(r2) || Number.isNaN(a2) || (o2.setHours(s2), o2.setMinutes(r2), o2.setSeconds(a2)), Number.isNaN(+o2) ? e3 : o2;
52084 if ("string" == typeof e3) return e3;
52086 if (0 === e3[1] && 0 === e3[e3.length - 1]) for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3 + 1], e3[i3]));
52087 else for (let i3 = 0; i3 < e3.length; i3 += 2) t2.push(je(e3[i3], e3[i3 + 1]));
52088 return m(String.fromCodePoint(...t2));
52090 function je(e3, t2) {
52091 return e3 << 8 | t2;
52093 Ee.set(41992, Ne), Ee.set(41993, Ne), Ee.set(41994, Ne), U(N, ["ifd0", "ifd1"], [[50827, function(e3) {
52094 return "string" != typeof e3 ? b(e3) : e3;
52095 }], [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(":")]]);
52096 var We = class extends re2 {
52097 static canHandle(e3, t2) {
52098 return 225 === e3.getUint8(t2 + 1) && 1752462448 === e3.getUint32(t2 + 4) && "http://ns.adobe.com/" === e3.getString(t2 + 4, "http://ns.adobe.com/".length);
52100 static headerLength(e3, t2) {
52101 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;
52103 static findPosition(e3, t2) {
52104 let i3 = super.findPosition(e3, t2);
52105 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;
52107 static handleMultiSegments(e3) {
52108 return e3.map((e4) => e4.chunk.getString()).join("");
52110 normalizeInput(e3) {
52111 return "string" == typeof e3 ? e3 : I.from(e3).getString();
52113 parse(e3 = this.chunk) {
52114 if (!this.localOptions.parse) return e3;
52115 e3 = function(e4) {
52116 let t3 = {}, i4 = {};
52117 for (let e6 of Ze) t3[e6] = [], i4[e6] = 0;
52118 return e4.replace(et, (e6, n4, s2) => {
52121 return t3[s2].push(n5), "".concat(e6, "#").concat(n5);
52123 return "".concat(e6, "#").concat(t3[s2].pop());
52126 let t2 = Xe.findAll(e3, "rdf", "Description");
52127 0 === t2.length && t2.push(new Xe("rdf", "Description", void 0, e3));
52129 for (let e4 of t2) for (let t3 of e4.properties) i3 = Je(t3.ns, n3), _e(t3, i3);
52130 return function(e4) {
52132 for (let i4 in e4) t3 = e4[i4] = f(e4[i4]), void 0 === t3 && delete e4[i4];
52136 assignToOutput(e3, t2) {
52137 if (this.localOptions.parse) for (let [i3, n3] of Object.entries(t2)) switch (i3) {
52139 this.assignObjectToOutput(e3, "ifd0", n3);
52142 this.assignObjectToOutput(e3, "exif", n3);
52147 this.assignObjectToOutput(e3, i3, n3);
52152 c(We, "type", "xmp"), c(We, "multiSegment", true), T.set("xmp", We);
52153 var Ke = class _Ke {
52154 static findAll(e3) {
52155 return qe(e3, /([a-zA-Z0-9-]+):([a-zA-Z0-9-]+)=("[^"]*"|'[^']*')/gm).map(_Ke.unpackMatch);
52157 static unpackMatch(e3) {
52158 let t2 = e3[1], i3 = e3[2], n3 = e3[3].slice(1, -1);
52159 return n3 = Qe(n3), new _Ke(t2, i3, n3);
52161 constructor(e3, t2, i3) {
52162 this.ns = e3, this.name = t2, this.value = i3;
52168 var Xe = class _Xe {
52169 static findAll(e3, t2, i3) {
52170 if (void 0 !== t2 || void 0 !== i3) {
52171 t2 = t2 || "[\\w\\d-]+", i3 = i3 || "[\\w\\d-]+";
52172 var n3 = new RegExp("<(".concat(t2, "):(").concat(i3, ")(#\\d+)?((\\s+?[\\w\\d-:]+=(\"[^\"]*\"|'[^']*'))*\\s*)(\\/>|>([\\s\\S]*?)<\\/\\1:\\2\\3>)"), "gm");
52173 } else n3 = /<([\w\d-]+):([\w\d-]+)(#\d+)?((\s+?[\w\d-:]+=("[^"]*"|'[^']*'))*\s*)(\/>|>([\s\S]*?)<\/\1:\2\3>)/gm;
52174 return qe(e3, n3).map(_Xe.unpackMatch);
52176 static unpackMatch(e3) {
52177 let t2 = e3[1], i3 = e3[2], n3 = e3[4], s2 = e3[8];
52178 return new _Xe(t2, i3, n3, s2);
52180 constructor(e3, t2, i3, n3) {
52181 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];
52183 get isPrimitive() {
52184 return void 0 !== this.value && 0 === this.attrs.length && 0 === this.children.length;
52186 get isListContainer() {
52187 return 1 === this.children.length && this.children[0].isList;
52190 let { ns: e3, name: t2 } = this;
52191 return "rdf" === e3 && ("Seq" === t2 || "Bag" === t2 || "Alt" === t2);
52194 return "rdf" === this.ns && "li" === this.name;
52197 if (0 === this.properties.length && void 0 === this.value) return;
52198 if (this.isPrimitive) return this.value;
52199 if (this.isListContainer) return this.children[0].serialize();
52200 if (this.isList) return $e(this.children.map(Ye));
52201 if (this.isListItem && 1 === this.children.length && 0 === this.attrs.length) return this.children[0].serialize();
52203 for (let t2 of this.properties) _e(t2, e3);
52204 return void 0 !== this.value && (e3.value = this.value), f(e3);
52207 function _e(e3, t2) {
52208 let i3 = e3.serialize();
52209 void 0 !== i3 && (t2[e3.name] = i3);
52211 var Ye = (e3) => e3.serialize();
52212 var $e = (e3) => 1 === e3.length ? e3[0] : e3;
52213 var Je = (e3, t2) => t2[e3] ? t2[e3] : t2[e3] = {};
52214 function qe(e3, t2) {
52216 if (!e3) return n3;
52217 for (; null !== (i3 = t2.exec(e3)); ) n3.push(i3);
52222 return null == e4 || "null" === e4 || "undefined" === e4 || "" === e4 || "" === e4.trim();
52224 let t2 = Number(e3);
52225 if (!Number.isNaN(t2)) return t2;
52226 let i3 = e3.toLowerCase();
52227 return "true" === i3 || "false" !== i3 && e3.trim();
52229 var Ze = ["rdf:li", "rdf:Seq", "rdf:Bag", "rdf:Alt", "rdf:Description"];
52230 var et = new RegExp("(<|\\/)(".concat(Ze.join("|"), ")"), "g");
52231 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() {
52233 }, get rotateCss() {
52235 }, rotation: Ae });
52236 var at = l("fs", (e3) => e3.promises);
52237 A.set("fs", class extends ve {
52238 async readWhole() {
52239 this.chunked = false, this.fs = await at;
52240 let e3 = await this.fs.readFile(this.input);
52241 this._swapBuffer(e3);
52243 async readChunked() {
52244 this.chunked = true, this.fs = await at, await this.open(), await this.readChunk(0, this.options.firstChunkSize);
52247 void 0 === this.fh && (this.fh = await this.fs.open(this.input, "r"), this.size = (await this.fh.stat(this.input)).size);
52249 async _readChunk(e3, t2) {
52250 void 0 === this.fh && await this.open(), e3 + t2 > this.size && (t2 = this.size - e3);
52251 var i3 = this.subarray(e3, t2, true);
52252 return await this.fh.read(i3.dataView, 0, t2, e3), i3;
52257 this.fh = void 0, await e3.close();
52261 A.set("base64", class extends ve {
52262 constructor(...e3) {
52263 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);
52265 async _readChunk(e3, t2) {
52266 let i3, n3, r2 = this.input;
52267 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);
52268 let o2 = e3 + t2, l2 = i3 + 4 * Math.ceil(o2 / 3);
52269 r2 = r2.slice(i3, l2);
52270 let h2 = Math.min(t2, this.size - e3);
52272 let t3 = s.from(r2, "base64").slice(n3, n3 + h2);
52273 return this.set(t3, e3, true);
52276 let t3 = this.subarray(e3, h2, true), i4 = atob(r2), s2 = t3.toUint8();
52277 for (let e4 = 0; e4 < h2; e4++) s2[e4] = i4.charCodeAt(n3 + e4);
52282 var ot = class extends se {
52283 static canHandle(e3, t2) {
52284 return 18761 === t2 || 19789 === t2;
52286 extendOptions(e3) {
52287 let { ifd0: t2, xmp: i3, iptc: n3, icc: s2 } = e3;
52288 i3.enabled && t2.deps.add(700), n3.enabled && t2.deps.add(33723), s2.enabled && t2.deps.add(34675), t2.finalizeFilters();
52291 let { tiff: e3, xmp: t2, iptc: i3, icc: n3 } = this.options;
52292 if (e3.enabled || t2.enabled || i3.enabled || n3.enabled) {
52293 let e4 = Math.max(S(this.options), this.options.chunkSize);
52294 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");
52297 adaptTiffPropAsSegment(e3) {
52298 if (this.parsers.tiff[e3]) {
52299 let t2 = this.parsers.tiff[e3];
52300 this.injectSegment(e3, t2);
52304 c(ot, "type", "tiff"), w.set("tiff", ot);
52305 var lt = l("zlib");
52306 var ht = ["ihdr", "iccp", "text", "itxt", "exif"];
52307 var ut = class extends se {
52308 constructor(...e3) {
52309 super(...e3), c(this, "catchError", (e4) => this.errors.push(e4)), c(this, "metaChunks", []), c(this, "unknownChunks", []);
52311 static canHandle(e3, t2) {
52312 return 35152 === t2 && 2303741511 === e3.getUint32(0) && 218765834 === e3.getUint32(4);
52315 let { file: e3 } = this;
52316 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);
52318 async findPngChunksInRange(e3, t2) {
52319 let { file: i3 } = this;
52320 for (; e3 < t2; ) {
52321 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 };
52322 ht.includes(s2) ? this.metaChunks.push(a2) : this.unknownChunks.push(a2), e3 += r2;
52325 parseTextChunks() {
52326 let e3 = this.metaChunks.filter((e4) => "text" === e4.type);
52327 for (let t2 of e3) {
52328 let [e4, i3] = this.file.getString(t2.start, t2.size).split("\0");
52329 this.injectKeyValToIhdr(e4, i3);
52332 injectKeyValToIhdr(e3, t2) {
52333 let i3 = this.parsers.ihdr;
52334 i3 && i3.raw.set(e3, t2);
52337 let e3 = this.metaChunks.find((e4) => "ihdr" === e4.type);
52338 e3 && false !== this.options.ihdr.enabled && this.createParser("ihdr", e3.chunk);
52341 let e3 = this.metaChunks.find((e4) => "exif" === e4.type);
52342 e3 && this.injectSegment("tiff", e3.chunk);
52345 let e3 = this.metaChunks.filter((e4) => "itxt" === e4.type);
52346 for (let t2 of e3) {
52347 "XML:com.adobe.xmp" === t2.chunk.getString(0, "XML:com.adobe.xmp".length) && this.injectSegment("xmp", t2.chunk);
52351 let e3 = this.metaChunks.find((e4) => "iccp" === e4.type);
52353 let { chunk: t2 } = e3, i3 = t2.getUint8Array(0, 81), s2 = 0;
52354 for (; s2 < 80 && 0 !== i3[s2]; ) s2++;
52355 let r2 = s2 + 2, a2 = t2.getString(0, s2);
52356 if (this.injectKeyValToIhdr("ProfileName", a2), n2) {
52357 let e4 = await lt, i4 = t2.getUint8Array(r2);
52358 i4 = e4.inflateSync(i4), this.injectSegment("icc", i4);
52362 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"]]);
52363 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"]];
52364 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" }]]);
52365 var ft = class extends re2 {
52366 static canHandle(e3, t2) {
52367 return 224 === e3.getUint8(t2 + 1) && 1246120262 === e3.getUint32(t2 + 4) && 0 === e3.getUint8(t2 + 8);
52370 return this.parseTags(), this.translate(), this.output;
52373 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)]]);
52376 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"]]);
52377 var dt = class extends re2 {
52379 return this.parseTags(), this.translate(), this.output;
52382 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)]);
52385 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" }]]);
52386 var pt = class extends re2 {
52387 static canHandle(e3, t2) {
52388 return 226 === e3.getUint8(t2 + 1) && 1229144927 === e3.getUint32(t2 + 4);
52390 static findPosition(e3, t2) {
52391 let i3 = super.findPosition(e3, t2);
52392 return i3.chunkNumber = e3.getUint8(t2 + 16), i3.chunkCount = e3.getUint8(t2 + 17), i3.multiSegment = i3.chunkCount > 1, i3;
52394 static handleMultiSegments(e3) {
52395 return function(e4) {
52396 let t2 = function(e6) {
52397 let t3 = e6[0].constructor, i3 = 0;
52398 for (let t4 of e6) i3 += t4.length;
52399 let n3 = new t3(i3), s2 = 0;
52400 for (let t4 of e6) n3.set(t4, s2), s2 += t4.length;
52402 }(e4.map((e6) => e6.chunk.toUint8()));
52407 return this.raw = /* @__PURE__ */ new Map(), this.parseHeader(), this.parseTags(), this.translate(), this.output;
52410 let { raw: e3 } = this;
52411 this.chunk.byteLength < 84 && g2("ICC header is too short");
52412 for (let [t2, i3] of Object.entries(gt)) {
52413 t2 = parseInt(t2, 10);
52414 let n3 = i3(this.chunk, t2);
52415 "\0\0\0\0" !== n3 && e3.set(t2, n3);
52419 let e3, t2, i3, n3, s2, { raw: r2 } = this, a2 = this.chunk.getUint32(128), o2 = 132, l2 = this.chunk.byteLength;
52421 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) return void console.warn("reached the end of the first ICC chunk. Enable options.tiff.multiSegment to read all ICC segments.");
52422 s2 = this.parseTag(n3, t2, i3), void 0 !== s2 && "\0\0\0\0" !== s2 && r2.set(e3, s2), o2 += 12;
52425 parseTag(e3, t2, i3) {
52428 return this.parseDesc(t2);
52430 return this.parseMluc(t2);
52432 return this.parseText(t2, i3);
52434 return this.parseSig(t2);
52436 if (!(t2 + i3 > this.chunk.byteLength)) return this.chunk.getUint8Array(t2, i3);
52439 let t2 = this.chunk.getUint32(e3 + 8) - 1;
52440 return m(this.chunk.getString(e3 + 12, t2));
52442 parseText(e3, t2) {
52443 return m(this.chunk.getString(e3 + 8, t2 - 8));
52446 return m(this.chunk.getString(e3 + 8, 4));
52449 let { chunk: t2 } = this, i3 = t2.getUint32(e3 + 8), n3 = t2.getUint32(e3 + 12), s2 = e3 + 16, r2 = [];
52450 for (let a2 = 0; a2 < i3; a2++) {
52451 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));
52452 r2.push({ lang: i4, country: a3, text: h2 }), s2 += n3;
52454 return 1 === i3 ? r2[0].text : r2;
52456 translateValue(e3, t2) {
52457 return "string" == typeof e3 ? t2[e3] || t2[e3.toLowerCase()] || e3 : t2[e3] || e3;
52460 c(pt, "type", "icc"), c(pt, "multiSegment", true), c(pt, "headerLength", 18);
52461 var gt = { 4: mt, 8: function(e3, t2) {
52462 return [e3.getUint8(t2), e3.getUint8(t2 + 1) >> 4, e3.getUint8(t2 + 1) % 16].map((e4) => e4.toString(10)).join(".");
52463 }, 12: mt, 16: mt, 20: mt, 24: function(e3, t2) {
52464 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);
52465 return new Date(Date.UTC(i3, n3, s2, r2, a2, o2));
52466 }, 36: mt, 40: mt, 48: mt, 52: mt, 64: (e3, t2) => e3.getUint32(t2), 80: mt };
52467 function mt(e3, t2) {
52468 return m(e3.getString(t2, 4));
52470 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"]]);
52471 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" };
52472 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!)" };
52473 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" }]]);
52474 var yt = class extends re2 {
52475 static canHandle(e3, t2, i3) {
52476 return 237 === e3.getUint8(t2 + 1) && "Photoshop" === e3.getString(t2 + 4, 9) && void 0 !== this.containsIptc8bim(e3, t2, i3);
52478 static headerLength(e3, t2, i3) {
52479 let n3, s2 = this.containsIptc8bim(e3, t2, i3);
52480 if (void 0 !== s2) return n3 = e3.getUint8(t2 + s2 + 7), n3 % 2 != 0 && (n3 += 1), 0 === n3 && (n3 = 4), s2 + 8 + n3;
52482 static containsIptc8bim(e3, t2, i3) {
52483 for (let n3 = 0; n3 < i3; n3++) if (this.isIptcSegmentHead(e3, t2 + n3)) return n3;
52485 static isIptcSegmentHead(e3, t2) {
52486 return 56 === e3.getUint8(t2) && 943868237 === e3.getUint32(t2) && 1028 === e3.getUint16(t2 + 4);
52489 let { raw: e3 } = this, t2 = this.chunk.byteLength - 1, i3 = false;
52490 for (let n3 = 0; n3 < t2; n3++) if (28 === this.chunk.getUint8(n3) && 2 === this.chunk.getUint8(n3 + 1)) {
52492 let t3 = this.chunk.getUint16(n3 + 3), s2 = this.chunk.getUint8(n3 + 2), r2 = this.chunk.getLatin1String(n3 + 5, t3);
52493 e3.set(s2, this.pluralizeValue(e3.get(s2), r2)), n3 += 4 + t3;
52494 } else if (i3) break;
52495 return this.translate(), this.output;
52497 pluralizeValue(e3, t2) {
52498 return void 0 !== e3 ? e3 instanceof Array ? (e3.push(t2), e3) : [e3, t2] : t2;
52501 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" }]]);
52502 var full_esm_default = tt;
52504 // modules/services/plane_photo.js
52505 var dispatch5 = dispatch_default("viewerChanged");
52509 var _widthOverflow;
52510 function zoomPan(d3_event) {
52511 let t2 = d3_event.transform;
52512 _photo.call(utilSetTransform, t2.x, t2.y, t2.k);
52514 function zoomBeahvior() {
52515 const { width: wrapperWidth, height: wrapperHeight } = _wrapper.node().getBoundingClientRect();
52516 const { naturalHeight, naturalWidth } = _photo.node();
52517 const intrinsicRatio = naturalWidth / naturalHeight;
52518 _widthOverflow = wrapperHeight * intrinsicRatio - wrapperWidth;
52519 return zoom_default2().extent([[0, 0], [wrapperWidth, wrapperHeight]]).translateExtent([[0, 0], [wrapperWidth + _widthOverflow, wrapperHeight]]).scaleExtent([1, 15]).on("zoom", zoomPan);
52521 function loadImage(selection2, path) {
52522 return new Promise((resolve) => {
52523 selection2.attr("src", path);
52524 selection2.on("load", () => {
52525 resolve(selection2);
52529 var plane_photo_default = {
52530 init: async function(context, selection2) {
52531 this.event = utilRebind(this, dispatch5, "on");
52532 _wrapper = selection2.append("div").attr("class", "photo-frame plane-frame").classed("hide", true);
52533 _photo = _wrapper.append("img").attr("class", "plane-photo");
52534 context.ui().photoviewer.on("resize.plane", () => {
52535 imgZoom = zoomBeahvior();
52536 _wrapper.call(imgZoom);
52538 await Promise.resolve();
52541 showPhotoFrame: function(context) {
52542 const isHidden = context.selectAll(".photo-frame.plane-frame.hide").size();
52544 context.selectAll(".photo-frame:not(.plane-frame)").classed("hide", true);
52545 context.selectAll(".photo-frame.plane-frame").classed("hide", false);
52549 hidePhotoFrame: function(context) {
52550 context.select("photo-frame.plane-frame").classed("hide", false);
52553 selectPhoto: function(data) {
52554 dispatch5.call("viewerChanged");
52555 loadImage(_photo, "");
52556 loadImage(_photo, data.image_path).then(() => {
52557 imgZoom = zoomBeahvior();
52558 _wrapper.call(imgZoom);
52559 _wrapper.call(imgZoom.transform, identity2.translate(-_widthOverflow / 2, 0));
52563 getYaw: function() {
52568 // modules/svg/local_photos.js
52569 var _initialized2 = false;
52570 var _enabled2 = false;
52571 var minViewfieldZoom = 16;
52572 function svgLocalPhotos(projection2, context, dispatch14) {
52573 const detected = utilDetect();
52574 let layer = select_default2(null);
52577 let _idAutoinc = 0;
52580 if (_initialized2) return;
52582 function over(d3_event) {
52583 d3_event.stopPropagation();
52584 d3_event.preventDefault();
52585 d3_event.dataTransfer.dropEffect = "copy";
52587 context.container().attr("dropzone", "copy").on("drop.svgLocalPhotos", function(d3_event) {
52588 d3_event.stopPropagation();
52589 d3_event.preventDefault();
52590 if (!detected.filedrop) return;
52591 drawPhotos.fileList(d3_event.dataTransfer.files, (loaded) => {
52592 if (loaded.length > 0) {
52593 drawPhotos.fitZoom(false);
52596 }).on("dragenter.svgLocalPhotos", over).on("dragexit.svgLocalPhotos", over).on("dragover.svgLocalPhotos", over);
52597 _initialized2 = true;
52599 function ensureViewerLoaded(context2) {
52601 return Promise.resolve(_photoFrame);
52603 const viewer = context2.container().select(".photoviewer").selectAll(".local-photos-wrapper").data([0]);
52604 const viewerEnter = viewer.enter().append("div").attr("class", "photo-wrapper local-photos-wrapper").classed("hide", true);
52605 viewerEnter.append("div").attr("class", "photo-attribution photo-attribution-dual fillD");
52606 return plane_photo_default.init(context2, viewerEnter).then((planePhotoFrame) => {
52607 _photoFrame = planePhotoFrame;
52610 function click(d3_event, image, zoomTo) {
52611 ensureViewerLoaded(context).then(() => {
52612 const viewer = context.container().select(".photoviewer").datum(image).classed("hide", false);
52613 const viewerWrap = viewer.select(".local-photos-wrapper").classed("hide", false);
52614 const attribution = viewerWrap.selectAll(".photo-attribution").text("");
52616 attribution.append("span").text(image.date.toLocaleString());
52619 attribution.append("span").classed("filename", true).text(image.name);
52621 _photoFrame.selectPhoto({ image_path: "" });
52622 image.getSrc().then((src) => {
52623 _photoFrame.selectPhoto({ image_path: src }).showPhotoFrame(viewerWrap);
52628 context.map().centerEase(image.loc);
52631 function transform2(d2) {
52632 var svgpoint = projection2(d2.loc);
52633 return "translate(" + svgpoint[0] + "," + svgpoint[1] + ")";
52635 function setStyles(hovered) {
52636 const viewer = context.container().select(".photoviewer");
52637 const selected = viewer.empty() ? void 0 : viewer.datum();
52638 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));
52640 function display_markers(imageList) {
52641 imageList = imageList.filter((image) => isArray_default(image.loc) && isNumber_default(image.loc[0]) && isNumber_default(image.loc[1]));
52642 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(imageList, function(d2) {
52645 groups.exit().remove();
52646 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", (d3_event, d2) => setStyles(d2)).on("mouseleave", () => setStyles(null)).on("click", click);
52647 groupsEnter.append("g").attr("class", "viewfield-scale");
52648 const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
52649 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
52650 const showViewfields = context.map().zoom() >= minViewfieldZoom;
52651 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
52652 viewfields.exit().remove();
52653 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", function() {
52655 const d2 = this.parentNode.__data__;
52656 return "rotate(".concat(Math.round((_a3 = d2.direction) != null ? _a3 : 0), ",0,0),scale(1.5,1.5),translate(-8,-13)");
52657 }).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() {
52658 const d2 = this.parentNode.__data__;
52659 return isNumber_default(d2.direction) ? "visible" : "hidden";
52662 function drawPhotos(selection2) {
52663 layer = selection2.selectAll(".layer-local-photos").data(_photos ? [0] : []);
52664 layer.exit().remove();
52665 const layerEnter = layer.enter().append("g").attr("class", "layer-local-photos");
52666 layerEnter.append("g").attr("class", "markers");
52667 layer = layerEnter.merge(layer);
52669 display_markers(_photos);
52672 function readFileAsDataURL(file) {
52673 return new Promise((resolve, reject) => {
52674 const reader = new FileReader();
52675 reader.onload = () => resolve(reader.result);
52676 reader.onerror = (error) => reject(error);
52677 reader.readAsDataURL(file);
52680 async function readmultifiles(files, callback) {
52682 for (const file of files) {
52684 const exifData = await full_esm_default.parse(file);
52688 getSrc: () => readFileAsDataURL(file),
52690 loc: [exifData.longitude, exifData.latitude],
52691 direction: exifData.GPSImgDirection,
52692 date: exifData.CreateDate || exifData.DateTimeOriginal || exifData.ModifyDate
52694 loaded.push(photo);
52695 const sameName = _photos.filter((i3) => i3.name === photo.name);
52696 if (sameName.length === 0) {
52697 _photos.push(photo);
52699 const thisContent = await photo.getSrc();
52700 const sameNameContent = await Promise.allSettled(sameName.map((i3) => i3.getSrc()));
52701 if (!sameNameContent.some((i3) => i3.value === thisContent)) {
52702 _photos.push(photo);
52708 if (typeof callback === "function") callback(loaded);
52709 dispatch14.call("change");
52711 drawPhotos.setFiles = function(fileList, callback) {
52712 readmultifiles(Array.from(fileList), callback);
52715 drawPhotos.fileList = function(fileList, callback) {
52716 if (!arguments.length) return _fileList;
52717 _fileList = fileList;
52718 if (!fileList || !fileList.length) return this;
52719 drawPhotos.setFiles(_fileList, callback);
52722 drawPhotos.getPhotos = function() {
52725 drawPhotos.removePhoto = function(id2) {
52726 _photos = _photos.filter((i3) => i3.id !== id2);
52727 dispatch14.call("change");
52730 drawPhotos.openPhoto = click;
52731 drawPhotos.fitZoom = function(force) {
52732 const coords = _photos.map((image) => image.loc).filter((l2) => isArray_default(l2) && isNumber_default(l2[0]) && isNumber_default(l2[1]));
52733 if (coords.length === 0) return;
52734 const extent = coords.map((l2) => geoExtent(l2, l2)).reduce((a2, b2) => a2.extend(b2));
52735 const map2 = context.map();
52736 var viewport = map2.trimmedExtent().polygon();
52737 if (force !== false || !geoPolygonIntersectsPolygon(viewport, coords, true)) {
52738 map2.centerZoom(extent.center(), Math.min(18, map2.trimmedExtentZoom(extent)));
52741 function showLayer() {
52742 layer.style("display", "block");
52743 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52744 dispatch14.call("change");
52747 function hideLayer() {
52748 layer.transition().duration(250).style("opacity", 0).on("end", () => {
52749 layer.selectAll(".viewfield-group").remove();
52750 layer.style("display", "none");
52753 drawPhotos.enabled = function(val) {
52754 if (!arguments.length) return _enabled2;
52761 dispatch14.call("change");
52764 drawPhotos.hasData = function() {
52765 return isArray_default(_photos) && _photos.length > 0;
52771 // modules/svg/osmose.js
52772 var _layerEnabled2 = false;
52774 function svgOsmose(projection2, context, dispatch14) {
52775 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
52776 const minZoom5 = 12;
52777 let touchLayer = select_default2(null);
52778 let drawLayer = select_default2(null);
52779 let layerVisible = false;
52780 function markerPath(selection2, klass) {
52781 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");
52783 function getService() {
52784 if (services.osmose && !_qaService2) {
52785 _qaService2 = services.osmose;
52786 _qaService2.on("loaded", throttledRedraw);
52787 } else if (!services.osmose && _qaService2) {
52788 _qaService2 = null;
52790 return _qaService2;
52792 function editOn() {
52793 if (!layerVisible) {
52794 layerVisible = true;
52795 drawLayer.style("display", "block");
52798 function editOff() {
52799 if (layerVisible) {
52800 layerVisible = false;
52801 drawLayer.style("display", "none");
52802 drawLayer.selectAll(".qaItem.osmose").remove();
52803 touchLayer.selectAll(".qaItem.osmose").remove();
52806 function layerOn() {
52808 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", () => dispatch14.call("change"));
52810 function layerOff() {
52811 throttledRedraw.cancel();
52812 drawLayer.interrupt();
52813 touchLayer.selectAll(".qaItem.osmose").remove();
52814 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", () => {
52816 dispatch14.call("change");
52819 function updateMarkers() {
52820 if (!layerVisible || !_layerEnabled2) return;
52821 const service = getService();
52822 const selectedID = context.selectedErrorID();
52823 const data = service ? service.getItems(projection2) : [];
52824 const getTransform = svgPointTransform(projection2);
52825 const markers = drawLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
52826 markers.exit().remove();
52827 const markersEnter = markers.enter().append("g").attr("class", (d2) => "qaItem ".concat(d2.service, " itemId-").concat(d2.id, " itemType-").concat(d2.itemType));
52828 markersEnter.append("polygon").call(markerPath, "shadow");
52829 markersEnter.append("ellipse").attr("cx", 0).attr("cy", 0).attr("rx", 4.5).attr("ry", 2).attr("class", "stroke");
52830 markersEnter.append("polygon").attr("fill", (d2) => service.getColor(d2.item)).call(markerPath, "qaItem-fill");
52831 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 : "");
52832 markers.merge(markersEnter).sort(sortY).classed("selected", (d2) => d2.id === selectedID).attr("transform", getTransform);
52833 if (touchLayer.empty()) return;
52834 const fillClass = context.getDebug("target") ? "pink" : "nocolor";
52835 const targets = touchLayer.selectAll(".qaItem.osmose").data(data, (d2) => d2.id);
52836 targets.exit().remove();
52837 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);
52838 function sortY(a2, b2) {
52839 return a2.id === selectedID ? 1 : b2.id === selectedID ? -1 : b2.loc[1] - a2.loc[1];
52842 function drawOsmose(selection2) {
52843 const service = getService();
52844 const surface = context.surface();
52845 if (surface && !surface.empty()) {
52846 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
52848 drawLayer = selection2.selectAll(".layer-osmose").data(service ? [0] : []);
52849 drawLayer.exit().remove();
52850 drawLayer = drawLayer.enter().append("g").attr("class", "layer-osmose").style("display", _layerEnabled2 ? "block" : "none").merge(drawLayer);
52851 if (_layerEnabled2) {
52852 if (service && ~~context.map().zoom() >= minZoom5) {
52854 service.loadIssues(projection2);
52861 drawOsmose.enabled = function(val) {
52862 if (!arguments.length) return _layerEnabled2;
52863 _layerEnabled2 = val;
52864 if (_layerEnabled2) {
52865 getService().loadStrings().then(layerOn).catch((err) => {
52870 if (context.selectedErrorID()) {
52871 context.enter(modeBrowse(context));
52874 dispatch14.call("change");
52877 drawOsmose.supported = () => !!getService();
52881 // modules/svg/streetside.js
52882 function svgStreetside(projection2, context, dispatch14) {
52883 var throttledRedraw = throttle_default(function() {
52884 dispatch14.call("change");
52887 var minMarkerZoom = 16;
52888 var minViewfieldZoom2 = 18;
52889 var layer = select_default2(null);
52890 var _viewerYaw = 0;
52891 var _selectedSequence = null;
52894 if (svgStreetside.initialized) return;
52895 svgStreetside.enabled = false;
52896 svgStreetside.initialized = true;
52898 function getService() {
52899 if (services.streetside && !_streetside) {
52900 _streetside = services.streetside;
52901 _streetside.event.on("viewerChanged.svgStreetside", viewerChanged).on("loadedImages.svgStreetside", throttledRedraw);
52902 } else if (!services.streetside && _streetside) {
52903 _streetside = null;
52905 return _streetside;
52907 function showLayer() {
52908 var service = getService();
52909 if (!service) return;
52911 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
52912 dispatch14.call("change");
52915 function hideLayer() {
52916 throttledRedraw.cancel();
52917 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
52919 function editOn() {
52920 layer.style("display", "block");
52922 function editOff() {
52923 layer.selectAll(".viewfield-group").remove();
52924 layer.style("display", "none");
52926 function click(d3_event, d2) {
52927 var service = getService();
52928 if (!service) return;
52929 if (d2.sequenceKey !== _selectedSequence) {
52932 _selectedSequence = d2.sequenceKey;
52933 service.ensureViewerLoaded(context).then(function() {
52934 service.selectImage(context, d2.key).yaw(_viewerYaw).showViewer(context);
52936 context.map().centerEase(d2.loc);
52938 function mouseover(d3_event, d2) {
52939 var service = getService();
52940 if (service) service.setStyles(context, d2);
52942 function mouseout() {
52943 var service = getService();
52944 if (service) service.setStyles(context, null);
52946 function transform2(d2) {
52947 var t2 = svgPointTransform(projection2)(d2);
52948 var rot = d2.ca + _viewerYaw;
52950 t2 += " rotate(" + Math.floor(rot) + ",0,0)";
52954 function viewerChanged() {
52955 var service = getService();
52956 if (!service) return;
52957 var viewer = service.viewer();
52958 if (!viewer) return;
52959 _viewerYaw = viewer.getYaw();
52960 if (context.map().isTransformed()) return;
52961 layer.selectAll(".viewfield-group.currentView").attr("transform", transform2);
52963 function filterBubbles(bubbles) {
52964 var fromDate = context.photos().fromDate();
52965 var toDate = context.photos().toDate();
52966 var usernames = context.photos().usernames();
52968 var fromTimestamp = new Date(fromDate).getTime();
52969 bubbles = bubbles.filter(function(bubble) {
52970 return new Date(bubble.captured_at).getTime() >= fromTimestamp;
52974 var toTimestamp = new Date(toDate).getTime();
52975 bubbles = bubbles.filter(function(bubble) {
52976 return new Date(bubble.captured_at).getTime() <= toTimestamp;
52980 bubbles = bubbles.filter(function(bubble) {
52981 return usernames.indexOf(bubble.captured_by) !== -1;
52986 function filterSequences(sequences) {
52987 var fromDate = context.photos().fromDate();
52988 var toDate = context.photos().toDate();
52989 var usernames = context.photos().usernames();
52991 var fromTimestamp = new Date(fromDate).getTime();
52992 sequences = sequences.filter(function(sequences2) {
52993 return new Date(sequences2.properties.captured_at).getTime() >= fromTimestamp;
52997 var toTimestamp = new Date(toDate).getTime();
52998 sequences = sequences.filter(function(sequences2) {
52999 return new Date(sequences2.properties.captured_at).getTime() <= toTimestamp;
53003 sequences = sequences.filter(function(sequences2) {
53004 return usernames.indexOf(sequences2.properties.captured_by) !== -1;
53009 function update() {
53010 var viewer = context.container().select(".photoviewer");
53011 var selected = viewer.empty() ? void 0 : viewer.datum();
53012 var z2 = ~~context.map().zoom();
53013 var showMarkers = z2 >= minMarkerZoom;
53014 var showViewfields = z2 >= minViewfieldZoom2;
53015 var service = getService();
53016 var sequences = [];
53018 if (context.photos().showsPanoramic()) {
53019 sequences = service ? service.sequences(projection2) : [];
53020 bubbles = service && showMarkers ? service.bubbles(projection2) : [];
53021 sequences = filterSequences(sequences);
53022 bubbles = filterBubbles(bubbles);
53024 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53025 return d2.properties.key;
53027 traces.exit().remove();
53028 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53029 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(bubbles, function(d2) {
53030 return d2.key + (d2.sequenceKey ? "v1" : "v0");
53032 groups.exit().remove();
53033 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53034 groupsEnter.append("g").attr("class", "viewfield-scale");
53035 var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53036 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53037 }).attr("transform", transform2).select(".viewfield-scale");
53038 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53039 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53040 viewfields.exit().remove();
53041 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53042 function viewfieldPath() {
53043 var d2 = this.parentNode.__data__;
53045 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53047 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53051 function drawImages(selection2) {
53052 var enabled = svgStreetside.enabled;
53053 var service = getService();
53054 layer = selection2.selectAll(".layer-streetside-images").data(service ? [0] : []);
53055 layer.exit().remove();
53056 var layerEnter = layer.enter().append("g").attr("class", "layer-streetside-images").style("display", enabled ? "block" : "none");
53057 layerEnter.append("g").attr("class", "sequences");
53058 layerEnter.append("g").attr("class", "markers");
53059 layer = layerEnter.merge(layer);
53061 if (service && ~~context.map().zoom() >= minZoom5) {
53064 service.loadBubbles(projection2);
53070 drawImages.enabled = function(_2) {
53071 if (!arguments.length) return svgStreetside.enabled;
53072 svgStreetside.enabled = _2;
53073 if (svgStreetside.enabled) {
53075 context.photos().on("change.streetside", update);
53078 context.photos().on("change.streetside", null);
53080 dispatch14.call("change");
53083 drawImages.supported = function() {
53084 return !!getService();
53086 drawImages.rendered = function(zoom) {
53087 return zoom >= minZoom5;
53093 // modules/svg/vegbilder.js
53094 function svgVegbilder(projection2, context, dispatch14) {
53095 const throttledRedraw = throttle_default(() => dispatch14.call("change"), 1e3);
53096 const minZoom5 = 14;
53097 const minMarkerZoom = 16;
53098 const minViewfieldZoom2 = 18;
53099 let layer = select_default2(null);
53100 let _viewerYaw = 0;
53103 if (svgVegbilder.initialized) return;
53104 svgVegbilder.enabled = false;
53105 svgVegbilder.initialized = true;
53107 function getService() {
53108 if (services.vegbilder && !_vegbilder) {
53109 _vegbilder = services.vegbilder;
53110 _vegbilder.event.on("viewerChanged.svgVegbilder", viewerChanged).on("loadedImages.svgVegbilder", throttledRedraw);
53111 } else if (!services.vegbilder && _vegbilder) {
53116 function showLayer() {
53117 const service = getService();
53118 if (!service) return;
53120 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", () => dispatch14.call("change"));
53122 function hideLayer() {
53123 throttledRedraw.cancel();
53124 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53126 function editOn() {
53127 layer.style("display", "block");
53129 function editOff() {
53130 layer.selectAll(".viewfield-group").remove();
53131 layer.style("display", "none");
53133 function click(d3_event, d2) {
53134 const service = getService();
53135 if (!service) return;
53136 service.ensureViewerLoaded(context).then(() => {
53137 service.selectImage(context, d2.key).showViewer(context);
53139 context.map().centerEase(d2.loc);
53141 function mouseover(d3_event, d2) {
53142 const service = getService();
53143 if (service) service.setStyles(context, d2);
53145 function mouseout() {
53146 const service = getService();
53147 if (service) service.setStyles(context, null);
53149 function transform2(d2, selected) {
53150 let t2 = svgPointTransform(projection2)(d2);
53152 if (d2 === selected) {
53156 t2 += " rotate(" + Math.floor(rot) + ",0,0)";
53160 function viewerChanged() {
53161 const service = getService();
53162 if (!service) return;
53163 const frame2 = service.photoFrame();
53164 _viewerYaw = frame2.getYaw();
53165 if (context.map().isTransformed()) return;
53166 layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2));
53168 function filterImages(images) {
53169 const photoContext = context.photos();
53170 const fromDateString = photoContext.fromDate();
53171 const toDateString = photoContext.toDate();
53172 const showsFlat = photoContext.showsFlat();
53173 const showsPano = photoContext.showsPanoramic();
53174 if (fromDateString) {
53175 const fromDate = new Date(fromDateString);
53176 images = images.filter((image) => image.captured_at.getTime() >= fromDate.getTime());
53178 if (toDateString) {
53179 const toDate = new Date(toDateString);
53180 images = images.filter((image) => image.captured_at.getTime() <= toDate.getTime());
53183 images = images.filter((image) => !image.is_sphere);
53186 images = images.filter((image) => image.is_sphere);
53190 function filterSequences(sequences) {
53191 const photoContext = context.photos();
53192 const fromDateString = photoContext.fromDate();
53193 const toDateString = photoContext.toDate();
53194 const showsFlat = photoContext.showsFlat();
53195 const showsPano = photoContext.showsPanoramic();
53196 if (fromDateString) {
53197 const fromDate = new Date(fromDateString);
53198 sequences = sequences.filter(({ images }) => images[0].captured_at.getTime() >= fromDate.getTime());
53200 if (toDateString) {
53201 const toDate = new Date(toDateString);
53202 sequences = sequences.filter(({ images }) => images[images.length - 1].captured_at.getTime() <= toDate.getTime());
53205 sequences = sequences.filter(({ images }) => !images[0].is_sphere);
53208 sequences = sequences.filter(({ images }) => images[0].is_sphere);
53212 function update() {
53213 const viewer = context.container().select(".photoviewer");
53214 const selected = viewer.empty() ? void 0 : viewer.datum();
53215 const z2 = ~~context.map().zoom();
53216 const showMarkers = z2 >= minMarkerZoom;
53217 const showViewfields = z2 >= minViewfieldZoom2;
53218 const service = getService();
53219 let sequences = [];
53222 service.loadImages(context);
53223 sequences = service.sequences(projection2);
53224 images = showMarkers ? service.images(projection2) : [];
53225 images = filterImages(images);
53226 sequences = filterSequences(sequences);
53228 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, (d2) => d2.key);
53229 traces.exit().remove();
53230 traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53231 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, (d2) => d2.key);
53232 groups.exit().remove();
53233 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53234 groupsEnter.append("g").attr("class", "viewfield-scale");
53235 const markers = groups.merge(groupsEnter).sort((a2, b2) => {
53236 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53237 }).attr("transform", (d2) => transform2(d2, selected)).select(".viewfield-scale");
53238 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53239 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53240 viewfields.exit().remove();
53241 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53242 function viewfieldPath() {
53243 const d2 = this.parentNode.__data__;
53244 if (d2.is_sphere) {
53245 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53247 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53251 function drawImages(selection2) {
53252 const enabled = svgVegbilder.enabled;
53253 const service = getService();
53254 layer = selection2.selectAll(".layer-vegbilder").data(service ? [0] : []);
53255 layer.exit().remove();
53256 const layerEnter = layer.enter().append("g").attr("class", "layer-vegbilder").style("display", enabled ? "block" : "none");
53257 layerEnter.append("g").attr("class", "sequences");
53258 layerEnter.append("g").attr("class", "markers");
53259 layer = layerEnter.merge(layer);
53261 if (service && ~~context.map().zoom() >= minZoom5) {
53264 service.loadImages(context);
53270 drawImages.enabled = function(_2) {
53271 if (!arguments.length) return svgVegbilder.enabled;
53272 svgVegbilder.enabled = _2;
53273 if (svgVegbilder.enabled) {
53275 context.photos().on("change.vegbilder", update);
53278 context.photos().on("change.vegbilder", null);
53280 dispatch14.call("change");
53283 drawImages.supported = function() {
53284 return !!getService();
53286 drawImages.rendered = function(zoom) {
53287 return zoom >= minZoom5;
53289 drawImages.validHere = function(extent, zoom) {
53290 return zoom >= minZoom5 - 2 && getService().validHere(extent);
53296 // modules/svg/mapillary_images.js
53297 function svgMapillaryImages(projection2, context, dispatch14) {
53298 const throttledRedraw = throttle_default(function() {
53299 dispatch14.call("change");
53301 const minZoom5 = 12;
53302 const minMarkerZoom = 16;
53303 const minViewfieldZoom2 = 18;
53304 let layer = select_default2(null);
53307 if (svgMapillaryImages.initialized) return;
53308 svgMapillaryImages.enabled = false;
53309 svgMapillaryImages.initialized = true;
53311 function getService() {
53312 if (services.mapillary && !_mapillary) {
53313 _mapillary = services.mapillary;
53314 _mapillary.event.on("loadedImages", throttledRedraw);
53315 } else if (!services.mapillary && _mapillary) {
53320 function showLayer() {
53321 const service = getService();
53322 if (!service) return;
53324 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
53325 dispatch14.call("change");
53328 function hideLayer() {
53329 throttledRedraw.cancel();
53330 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53332 function editOn() {
53333 layer.style("display", "block");
53335 function editOff() {
53336 layer.selectAll(".viewfield-group").remove();
53337 layer.style("display", "none");
53339 function click(d3_event, image) {
53340 const service = getService();
53341 if (!service) return;
53342 service.ensureViewerLoaded(context).then(function() {
53343 service.selectImage(context, image.id).showViewer(context);
53345 context.map().centerEase(image.loc);
53347 function mouseover(d3_event, image) {
53348 const service = getService();
53349 if (service) service.setStyles(context, image);
53351 function mouseout() {
53352 const service = getService();
53353 if (service) service.setStyles(context, null);
53355 function transform2(d2) {
53356 let t2 = svgPointTransform(projection2)(d2);
53358 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53362 function filterImages(images) {
53363 const showsPano = context.photos().showsPanoramic();
53364 const showsFlat = context.photos().showsFlat();
53365 const fromDate = context.photos().fromDate();
53366 const toDate = context.photos().toDate();
53367 if (!showsPano || !showsFlat) {
53368 images = images.filter(function(image) {
53369 if (image.is_pano) return showsPano;
53374 images = images.filter(function(image) {
53375 return new Date(image.captured_at).getTime() >= new Date(fromDate).getTime();
53379 images = images.filter(function(image) {
53380 return new Date(image.captured_at).getTime() <= new Date(toDate).getTime();
53385 function filterSequences(sequences) {
53386 const showsPano = context.photos().showsPanoramic();
53387 const showsFlat = context.photos().showsFlat();
53388 const fromDate = context.photos().fromDate();
53389 const toDate = context.photos().toDate();
53390 if (!showsPano || !showsFlat) {
53391 sequences = sequences.filter(function(sequence) {
53392 if (sequence.properties.hasOwnProperty("is_pano")) {
53393 if (sequence.properties.is_pano) return showsPano;
53400 sequences = sequences.filter(function(sequence) {
53401 return new Date(sequence.properties.captured_at).getTime() >= new Date(fromDate).getTime().toString();
53405 sequences = sequences.filter(function(sequence) {
53406 return new Date(sequence.properties.captured_at).getTime() <= new Date(toDate).getTime().toString();
53411 function update() {
53412 const z2 = ~~context.map().zoom();
53413 const showMarkers = z2 >= minMarkerZoom;
53414 const showViewfields = z2 >= minViewfieldZoom2;
53415 const service = getService();
53416 let sequences = service ? service.sequences(projection2) : [];
53417 let images = service && showMarkers ? service.images(projection2) : [];
53418 images = filterImages(images);
53419 sequences = filterSequences(sequences, service);
53420 service.filterViewer(context);
53421 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53422 return d2.properties.id;
53424 traces.exit().remove();
53425 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53426 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53429 groups.exit().remove();
53430 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53431 groupsEnter.append("g").attr("class", "viewfield-scale");
53432 const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53433 return b2.loc[1] - a2.loc[1];
53434 }).attr("transform", transform2).select(".viewfield-scale");
53435 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53436 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53437 viewfields.exit().remove();
53438 viewfields.enter().insert("path", "circle").attr("class", "viewfield").classed("pano", function() {
53439 return this.parentNode.__data__.is_pano;
53440 }).attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
53441 function viewfieldPath() {
53442 if (this.parentNode.__data__.is_pano) {
53443 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
53445 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
53449 function drawImages(selection2) {
53450 const enabled = svgMapillaryImages.enabled;
53451 const service = getService();
53452 layer = selection2.selectAll(".layer-mapillary").data(service ? [0] : []);
53453 layer.exit().remove();
53454 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary").style("display", enabled ? "block" : "none");
53455 layerEnter.append("g").attr("class", "sequences");
53456 layerEnter.append("g").attr("class", "markers");
53457 layer = layerEnter.merge(layer);
53459 if (service && ~~context.map().zoom() >= minZoom5) {
53462 service.loadImages(projection2);
53468 drawImages.enabled = function(_2) {
53469 if (!arguments.length) return svgMapillaryImages.enabled;
53470 svgMapillaryImages.enabled = _2;
53471 if (svgMapillaryImages.enabled) {
53473 context.photos().on("change.mapillary_images", update);
53476 context.photos().on("change.mapillary_images", null);
53478 dispatch14.call("change");
53481 drawImages.supported = function() {
53482 return !!getService();
53484 drawImages.rendered = function(zoom) {
53485 return zoom >= minZoom5;
53491 // modules/svg/mapillary_position.js
53492 function svgMapillaryPosition(projection2, context) {
53493 const throttledRedraw = throttle_default(function() {
53496 const minZoom5 = 12;
53497 const minViewfieldZoom2 = 18;
53498 let layer = select_default2(null);
53500 let viewerCompassAngle;
53502 if (svgMapillaryPosition.initialized) return;
53503 svgMapillaryPosition.initialized = true;
53505 function getService() {
53506 if (services.mapillary && !_mapillary) {
53507 _mapillary = services.mapillary;
53508 _mapillary.event.on("imageChanged", throttledRedraw);
53509 _mapillary.event.on("bearingChanged", function(e3) {
53510 viewerCompassAngle = e3.bearing;
53511 if (context.map().isTransformed()) return;
53512 layer.selectAll(".viewfield-group.currentView").filter(function(d2) {
53514 }).attr("transform", transform2);
53516 } else if (!services.mapillary && _mapillary) {
53521 function editOn() {
53522 layer.style("display", "block");
53524 function editOff() {
53525 layer.selectAll(".viewfield-group").remove();
53526 layer.style("display", "none");
53528 function transform2(d2) {
53529 let t2 = svgPointTransform(projection2)(d2);
53530 if (d2.is_pano && viewerCompassAngle !== null && isFinite(viewerCompassAngle)) {
53531 t2 += " rotate(" + Math.floor(viewerCompassAngle) + ",0,0)";
53532 } else if (d2.ca) {
53533 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53537 function update() {
53538 const z2 = ~~context.map().zoom();
53539 const showViewfields = z2 >= minViewfieldZoom2;
53540 const service = getService();
53541 const image = service && service.getActiveImage();
53542 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(image ? [image] : [], function(d2) {
53545 groups.exit().remove();
53546 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group currentView highlighted");
53547 groupsEnter.append("g").attr("class", "viewfield-scale");
53548 const markers = groups.merge(groupsEnter).attr("transform", transform2).select(".viewfield-scale");
53549 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53550 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53551 viewfields.exit().remove();
53552 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");
53554 function drawImages(selection2) {
53555 const service = getService();
53556 layer = selection2.selectAll(".layer-mapillary-position").data(service ? [0] : []);
53557 layer.exit().remove();
53558 const layerEnter = layer.enter().append("g").attr("class", "layer-mapillary-position");
53559 layerEnter.append("g").attr("class", "markers");
53560 layer = layerEnter.merge(layer);
53561 if (service && ~~context.map().zoom() >= minZoom5) {
53568 drawImages.enabled = function() {
53572 drawImages.supported = function() {
53573 return !!getService();
53575 drawImages.rendered = function(zoom) {
53576 return zoom >= minZoom5;
53582 // modules/svg/mapillary_signs.js
53583 function svgMapillarySigns(projection2, context, dispatch14) {
53584 const throttledRedraw = throttle_default(function() {
53585 dispatch14.call("change");
53587 const minZoom5 = 12;
53588 let layer = select_default2(null);
53591 if (svgMapillarySigns.initialized) return;
53592 svgMapillarySigns.enabled = false;
53593 svgMapillarySigns.initialized = true;
53595 function getService() {
53596 if (services.mapillary && !_mapillary) {
53597 _mapillary = services.mapillary;
53598 _mapillary.event.on("loadedSigns", throttledRedraw);
53599 } else if (!services.mapillary && _mapillary) {
53604 function showLayer() {
53605 const service = getService();
53606 if (!service) return;
53607 service.loadSignResources(context);
53610 function hideLayer() {
53611 throttledRedraw.cancel();
53614 function editOn() {
53615 layer.style("display", "block");
53617 function editOff() {
53618 layer.selectAll(".icon-sign").remove();
53619 layer.style("display", "none");
53621 function click(d3_event, d2) {
53622 const service = getService();
53623 if (!service) return;
53624 context.map().centerEase(d2.loc);
53625 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
53626 service.getDetections(d2.id).then((detections) => {
53627 if (detections.length) {
53628 const imageId = detections[0].image.id;
53629 if (imageId === selectedImageId) {
53630 service.highlightDetection(detections[0]).selectImage(context, imageId);
53632 service.ensureViewerLoaded(context).then(function() {
53633 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
53639 function filterData(detectedFeatures) {
53640 var fromDate = context.photos().fromDate();
53641 var toDate = context.photos().toDate();
53643 var fromTimestamp = new Date(fromDate).getTime();
53644 detectedFeatures = detectedFeatures.filter(function(feature3) {
53645 return new Date(feature3.last_seen_at).getTime() >= fromTimestamp;
53649 var toTimestamp = new Date(toDate).getTime();
53650 detectedFeatures = detectedFeatures.filter(function(feature3) {
53651 return new Date(feature3.first_seen_at).getTime() <= toTimestamp;
53654 return detectedFeatures;
53656 function update() {
53657 const service = getService();
53658 let data = service ? service.signs(projection2) : [];
53659 data = filterData(data);
53660 const transform2 = svgPointTransform(projection2);
53661 const signs = layer.selectAll(".icon-sign").data(data, function(d2) {
53664 signs.exit().remove();
53665 const enter = signs.enter().append("g").attr("class", "icon-sign icon-detected").on("click", click);
53666 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
53667 return "#" + d2.value;
53669 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
53670 signs.merge(enter).attr("transform", transform2);
53672 function drawSigns(selection2) {
53673 const enabled = svgMapillarySigns.enabled;
53674 const service = getService();
53675 layer = selection2.selectAll(".layer-mapillary-signs").data(service ? [0] : []);
53676 layer.exit().remove();
53677 layer = layer.enter().append("g").attr("class", "layer-mapillary-signs layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
53679 if (service && ~~context.map().zoom() >= minZoom5) {
53682 service.loadSigns(projection2);
53683 service.showSignDetections(true);
53687 } else if (service) {
53688 service.showSignDetections(false);
53691 drawSigns.enabled = function(_2) {
53692 if (!arguments.length) return svgMapillarySigns.enabled;
53693 svgMapillarySigns.enabled = _2;
53694 if (svgMapillarySigns.enabled) {
53696 context.photos().on("change.mapillary_signs", update);
53699 context.photos().on("change.mapillary_signs", null);
53701 dispatch14.call("change");
53704 drawSigns.supported = function() {
53705 return !!getService();
53707 drawSigns.rendered = function(zoom) {
53708 return zoom >= minZoom5;
53714 // modules/svg/mapillary_map_features.js
53715 function svgMapillaryMapFeatures(projection2, context, dispatch14) {
53716 const throttledRedraw = throttle_default(function() {
53717 dispatch14.call("change");
53719 const minZoom5 = 12;
53720 let layer = select_default2(null);
53723 if (svgMapillaryMapFeatures.initialized) return;
53724 svgMapillaryMapFeatures.enabled = false;
53725 svgMapillaryMapFeatures.initialized = true;
53727 function getService() {
53728 if (services.mapillary && !_mapillary) {
53729 _mapillary = services.mapillary;
53730 _mapillary.event.on("loadedMapFeatures", throttledRedraw);
53731 } else if (!services.mapillary && _mapillary) {
53736 function showLayer() {
53737 const service = getService();
53738 if (!service) return;
53739 service.loadObjectResources(context);
53742 function hideLayer() {
53743 throttledRedraw.cancel();
53746 function editOn() {
53747 layer.style("display", "block");
53749 function editOff() {
53750 layer.selectAll(".icon-map-feature").remove();
53751 layer.style("display", "none");
53753 function click(d3_event, d2) {
53754 const service = getService();
53755 if (!service) return;
53756 context.map().centerEase(d2.loc);
53757 const selectedImageId = service.getActiveImage() && service.getActiveImage().id;
53758 service.getDetections(d2.id).then((detections) => {
53759 if (detections.length) {
53760 const imageId = detections[0].image.id;
53761 if (imageId === selectedImageId) {
53762 service.highlightDetection(detections[0]).selectImage(context, imageId);
53764 service.ensureViewerLoaded(context).then(function() {
53765 service.highlightDetection(detections[0]).selectImage(context, imageId).showViewer(context);
53771 function filterData(detectedFeatures) {
53772 const fromDate = context.photos().fromDate();
53773 const toDate = context.photos().toDate();
53775 detectedFeatures = detectedFeatures.filter(function(feature3) {
53776 return new Date(feature3.last_seen_at).getTime() >= new Date(fromDate).getTime();
53780 detectedFeatures = detectedFeatures.filter(function(feature3) {
53781 return new Date(feature3.first_seen_at).getTime() <= new Date(toDate).getTime();
53784 return detectedFeatures;
53786 function update() {
53787 const service = getService();
53788 let data = service ? service.mapFeatures(projection2) : [];
53789 data = filterData(data);
53790 const transform2 = svgPointTransform(projection2);
53791 const mapFeatures = layer.selectAll(".icon-map-feature").data(data, function(d2) {
53794 mapFeatures.exit().remove();
53795 const enter = mapFeatures.enter().append("g").attr("class", "icon-map-feature icon-detected").on("click", click);
53796 enter.append("title").text(function(d2) {
53797 var id2 = d2.value.replace(/--/g, ".").replace(/-/g, "_");
53798 return _t("mapillary_map_features." + id2);
53800 enter.append("use").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px").attr("xlink:href", function(d2) {
53801 if (d2.value === "object--billboard") {
53802 return "#object--sign--advertisement";
53804 return "#" + d2.value;
53806 enter.append("rect").attr("width", "24px").attr("height", "24px").attr("x", "-12px").attr("y", "-12px");
53807 mapFeatures.merge(enter).attr("transform", transform2);
53809 function drawMapFeatures(selection2) {
53810 const enabled = svgMapillaryMapFeatures.enabled;
53811 const service = getService();
53812 layer = selection2.selectAll(".layer-mapillary-map-features").data(service ? [0] : []);
53813 layer.exit().remove();
53814 layer = layer.enter().append("g").attr("class", "layer-mapillary-map-features layer-mapillary-detections").style("display", enabled ? "block" : "none").merge(layer);
53816 if (service && ~~context.map().zoom() >= minZoom5) {
53819 service.loadMapFeatures(projection2);
53820 service.showFeatureDetections(true);
53824 } else if (service) {
53825 service.showFeatureDetections(false);
53828 drawMapFeatures.enabled = function(_2) {
53829 if (!arguments.length) return svgMapillaryMapFeatures.enabled;
53830 svgMapillaryMapFeatures.enabled = _2;
53831 if (svgMapillaryMapFeatures.enabled) {
53833 context.photos().on("change.mapillary_map_features", update);
53836 context.photos().on("change.mapillary_map_features", null);
53838 dispatch14.call("change");
53841 drawMapFeatures.supported = function() {
53842 return !!getService();
53844 drawMapFeatures.rendered = function(zoom) {
53845 return zoom >= minZoom5;
53848 return drawMapFeatures;
53851 // modules/svg/kartaview_images.js
53852 function svgKartaviewImages(projection2, context, dispatch14) {
53853 var throttledRedraw = throttle_default(function() {
53854 dispatch14.call("change");
53857 var minMarkerZoom = 16;
53858 var minViewfieldZoom2 = 18;
53859 var layer = select_default2(null);
53862 if (svgKartaviewImages.initialized) return;
53863 svgKartaviewImages.enabled = false;
53864 svgKartaviewImages.initialized = true;
53866 function getService() {
53867 if (services.kartaview && !_kartaview) {
53868 _kartaview = services.kartaview;
53869 _kartaview.event.on("loadedImages", throttledRedraw);
53870 } else if (!services.kartaview && _kartaview) {
53875 function showLayer() {
53876 var service = getService();
53877 if (!service) return;
53879 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
53880 dispatch14.call("change");
53883 function hideLayer() {
53884 throttledRedraw.cancel();
53885 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
53887 function editOn() {
53888 layer.style("display", "block");
53890 function editOff() {
53891 layer.selectAll(".viewfield-group").remove();
53892 layer.style("display", "none");
53894 function click(d3_event, d2) {
53895 var service = getService();
53896 if (!service) return;
53897 service.ensureViewerLoaded(context).then(function() {
53898 service.selectImage(context, d2.key).showViewer(context);
53900 context.map().centerEase(d2.loc);
53902 function mouseover(d3_event, d2) {
53903 var service = getService();
53904 if (service) service.setStyles(context, d2);
53906 function mouseout() {
53907 var service = getService();
53908 if (service) service.setStyles(context, null);
53910 function transform2(d2) {
53911 var t2 = svgPointTransform(projection2)(d2);
53913 t2 += " rotate(" + Math.floor(d2.ca) + ",0,0)";
53917 function filterImages(images) {
53918 var fromDate = context.photos().fromDate();
53919 var toDate = context.photos().toDate();
53920 var usernames = context.photos().usernames();
53922 var fromTimestamp = new Date(fromDate).getTime();
53923 images = images.filter(function(item) {
53924 return new Date(item.captured_at).getTime() >= fromTimestamp;
53928 var toTimestamp = new Date(toDate).getTime();
53929 images = images.filter(function(item) {
53930 return new Date(item.captured_at).getTime() <= toTimestamp;
53934 images = images.filter(function(item) {
53935 return usernames.indexOf(item.captured_by) !== -1;
53940 function filterSequences(sequences) {
53941 var fromDate = context.photos().fromDate();
53942 var toDate = context.photos().toDate();
53943 var usernames = context.photos().usernames();
53945 var fromTimestamp = new Date(fromDate).getTime();
53946 sequences = sequences.filter(function(image) {
53947 return new Date(image.properties.captured_at).getTime() >= fromTimestamp;
53951 var toTimestamp = new Date(toDate).getTime();
53952 sequences = sequences.filter(function(image) {
53953 return new Date(image.properties.captured_at).getTime() <= toTimestamp;
53957 sequences = sequences.filter(function(image) {
53958 return usernames.indexOf(image.properties.captured_by) !== -1;
53963 function update() {
53964 var viewer = context.container().select(".photoviewer");
53965 var selected = viewer.empty() ? void 0 : viewer.datum();
53966 var z2 = ~~context.map().zoom();
53967 var showMarkers = z2 >= minMarkerZoom;
53968 var showViewfields = z2 >= minViewfieldZoom2;
53969 var service = getService();
53970 var sequences = [];
53972 if (context.photos().showsFlat()) {
53973 sequences = service ? service.sequences(projection2) : [];
53974 images = service && showMarkers ? service.images(projection2) : [];
53975 sequences = filterSequences(sequences);
53976 images = filterImages(images);
53978 var traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
53979 return d2.properties.key;
53981 traces.exit().remove();
53982 traces = traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
53983 var groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
53986 groups.exit().remove();
53987 var groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
53988 groupsEnter.append("g").attr("class", "viewfield-scale");
53989 var markers = groups.merge(groupsEnter).sort(function(a2, b2) {
53990 return a2 === selected ? 1 : b2 === selected ? -1 : b2.loc[1] - a2.loc[1];
53991 }).attr("transform", transform2).select(".viewfield-scale");
53992 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
53993 var viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
53994 viewfields.exit().remove();
53995 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");
53997 function drawImages(selection2) {
53998 var enabled = svgKartaviewImages.enabled, service = getService();
53999 layer = selection2.selectAll(".layer-kartaview").data(service ? [0] : []);
54000 layer.exit().remove();
54001 var layerEnter = layer.enter().append("g").attr("class", "layer-kartaview").style("display", enabled ? "block" : "none");
54002 layerEnter.append("g").attr("class", "sequences");
54003 layerEnter.append("g").attr("class", "markers");
54004 layer = layerEnter.merge(layer);
54006 if (service && ~~context.map().zoom() >= minZoom5) {
54009 service.loadImages(projection2);
54015 drawImages.enabled = function(_2) {
54016 if (!arguments.length) return svgKartaviewImages.enabled;
54017 svgKartaviewImages.enabled = _2;
54018 if (svgKartaviewImages.enabled) {
54020 context.photos().on("change.kartaview_images", update);
54023 context.photos().on("change.kartaview_images", null);
54025 dispatch14.call("change");
54028 drawImages.supported = function() {
54029 return !!getService();
54031 drawImages.rendered = function(zoom) {
54032 return zoom >= minZoom5;
54038 // modules/svg/mapilio_images.js
54039 function svgMapilioImages(projection2, context, dispatch14) {
54040 const throttledRedraw = throttle_default(function() {
54041 dispatch14.call("change");
54043 const minZoom5 = 12;
54044 let layer = select_default2(null);
54046 const viewFieldZoomLevel = 18;
54048 if (svgMapilioImages.initialized) return;
54049 svgMapilioImages.enabled = false;
54050 svgMapilioImages.initialized = true;
54052 function getService() {
54053 if (services.mapilio && !_mapilio) {
54054 _mapilio = services.mapilio;
54055 _mapilio.event.on("loadedImages", throttledRedraw);
54056 } else if (!services.mapilio && _mapilio) {
54061 function showLayer() {
54062 const service = getService();
54063 if (!service) return;
54065 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54066 dispatch14.call("change");
54069 function hideLayer() {
54070 throttledRedraw.cancel();
54071 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54073 function transform2(d2) {
54074 let t2 = svgPointTransform(projection2)(d2);
54076 t2 += " rotate(" + Math.floor(d2.heading) + ",0,0)";
54080 function editOn() {
54081 layer.style("display", "block");
54083 function editOff() {
54084 layer.selectAll(".viewfield-group").remove();
54085 layer.style("display", "none");
54087 function click(d3_event, image) {
54088 const service = getService();
54089 if (!service) return;
54090 service.ensureViewerLoaded(context, image.id).then(function() {
54091 service.selectImage(context, image.id).showViewer(context);
54093 context.map().centerEase(image.loc);
54095 function mouseover(d3_event, image) {
54096 const service = getService();
54097 if (service) service.setStyles(context, image);
54099 function mouseout() {
54100 const service = getService();
54101 if (service) service.setStyles(context, null);
54103 function update() {
54104 const z2 = ~~context.map().zoom();
54105 const showViewfields = z2 >= viewFieldZoomLevel;
54106 const service = getService();
54107 let sequences = service ? service.sequences(projection2) : [];
54108 let images = service ? service.images(projection2) : [];
54109 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54110 return d2.properties.id;
54112 traces.exit().remove();
54113 traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54114 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
54117 groups.exit().remove();
54118 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54119 groupsEnter.append("g").attr("class", "viewfield-scale");
54120 const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54121 return b2.loc[1] - a2.loc[1];
54122 }).attr("transform", transform2).select(".viewfield-scale");
54123 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54124 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54125 viewfields.exit().remove();
54126 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54127 function viewfieldPath() {
54128 if (this.parentNode.__data__.isPano) {
54129 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54131 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54135 function drawImages(selection2) {
54136 const enabled = svgMapilioImages.enabled;
54137 const service = getService();
54138 layer = selection2.selectAll(".layer-mapilio").data(service ? [0] : []);
54139 layer.exit().remove();
54140 const layerEnter = layer.enter().append("g").attr("class", "layer-mapilio").style("display", enabled ? "block" : "none");
54141 layerEnter.append("g").attr("class", "sequences");
54142 layerEnter.append("g").attr("class", "markers");
54143 layer = layerEnter.merge(layer);
54145 if (service && ~~context.map().zoom() >= minZoom5) {
54148 service.loadImages(projection2);
54149 service.loadLines(projection2);
54155 drawImages.enabled = function(_2) {
54156 if (!arguments.length) return svgMapilioImages.enabled;
54157 svgMapilioImages.enabled = _2;
54158 if (svgMapilioImages.enabled) {
54160 context.photos().on("change.mapilio_images", update);
54163 context.photos().on("change.mapilio_images", null);
54165 dispatch14.call("change");
54168 drawImages.supported = function() {
54169 return !!getService();
54171 drawImages.rendered = function(zoom) {
54172 return zoom >= minZoom5;
54178 // modules/svg/panoramax_images.js
54179 function svgPanoramaxImages(projection2, context, dispatch14) {
54180 const throttledRedraw = throttle_default(function() {
54181 dispatch14.call("change");
54183 const imageMinZoom2 = 15;
54184 const lineMinZoom2 = 10;
54185 const viewFieldZoomLevel = 18;
54186 let layer = select_default2(null);
54188 let _viewerYaw = 0;
54189 let _selectedSequence;
54190 let _activeUsernameFilter;
54193 if (svgPanoramaxImages.initialized) return;
54194 svgPanoramaxImages.enabled = false;
54195 svgPanoramaxImages.initialized = true;
54197 function getService() {
54198 if (services.panoramax && !_panoramax) {
54199 _panoramax = services.panoramax;
54200 _panoramax.event.on("viewerChanged", viewerChanged).on("loadedLines", throttledRedraw).on("loadedImages", throttledRedraw);
54201 } else if (!services.panoramax && _panoramax) {
54206 async function filterImages(images) {
54207 const showsPano = context.photos().showsPanoramic();
54208 const showsFlat = context.photos().showsFlat();
54209 const fromDate = context.photos().fromDate();
54210 const toDate = context.photos().toDate();
54211 const username = context.photos().usernames();
54212 const service = getService();
54213 if (!showsPano || !showsFlat) {
54214 images = images.filter(function(image) {
54215 if (image.isPano) return showsPano;
54220 images = images.filter(function(image) {
54221 return new Date(image.capture_time).getTime() >= new Date(fromDate).getTime();
54225 images = images.filter(function(image) {
54226 return new Date(image.capture_time).getTime() <= new Date(toDate).getTime();
54229 if (username && service) {
54230 if (_activeUsernameFilter !== username) {
54231 _activeUsernameFilter = username;
54232 const tempIds = await service.getUserIds(username);
54234 tempIds.forEach((id2) => {
54235 _activeIds[id2] = true;
54238 images = images.filter(function(image) {
54239 return _activeIds[image.account_id];
54244 async function filterSequences(sequences) {
54245 const showsPano = context.photos().showsPanoramic();
54246 const showsFlat = context.photos().showsFlat();
54247 const fromDate = context.photos().fromDate();
54248 const toDate = context.photos().toDate();
54249 const username = context.photos().usernames();
54250 const service = getService();
54251 if (!showsPano || !showsFlat) {
54252 sequences = sequences.filter(function(sequence) {
54253 if (sequence.properties.type === "equirectangular") return showsPano;
54258 sequences = sequences.filter(function(sequence) {
54259 return new Date(sequence.properties.date).getTime() >= new Date(fromDate).getTime().toString();
54263 sequences = sequences.filter(function(sequence) {
54264 return new Date(sequence.properties.date).getTime() <= new Date(toDate).getTime().toString();
54267 if (username && service) {
54268 if (_activeUsernameFilter !== username) {
54269 _activeUsernameFilter = username;
54270 const tempIds = await service.getUserIds(username);
54272 tempIds.forEach((id2) => {
54273 _activeIds[id2] = true;
54276 sequences = sequences.filter(function(sequence) {
54277 return _activeIds[sequence.properties.account_id];
54282 function showLayer() {
54283 const service = getService();
54284 if (!service) return;
54286 layer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end", function() {
54287 dispatch14.call("change");
54290 function hideLayer() {
54291 throttledRedraw.cancel();
54292 layer.transition().duration(250).style("opacity", 0).on("end", editOff);
54294 function transform2(d2, selectedImageId) {
54295 let t2 = svgPointTransform(projection2)(d2);
54296 let rot = d2.heading;
54297 if (d2.id === selectedImageId) {
54301 t2 += " rotate(" + Math.floor(rot) + ",0,0)";
54305 function editOn() {
54306 layer.style("display", "block");
54308 function editOff() {
54309 layer.selectAll(".viewfield-group").remove();
54310 layer.style("display", "none");
54312 function click(d3_event, image) {
54313 const service = getService();
54314 if (!service) return;
54315 if (image.sequence_id !== _selectedSequence) {
54318 _selectedSequence = image.sequence_id;
54319 service.ensureViewerLoaded(context).then(function() {
54320 service.selectImage(context, image.id).showViewer(context);
54322 context.map().centerEase(image.loc);
54324 function mouseover(d3_event, image) {
54325 const service = getService();
54326 if (service) service.setStyles(context, image);
54328 function mouseout() {
54329 const service = getService();
54330 if (service) service.setStyles(context, null);
54332 async function update() {
54334 const zoom = ~~context.map().zoom();
54335 const showViewfields = zoom >= viewFieldZoomLevel;
54336 const service = getService();
54337 let sequences = service ? service.sequences(projection2, zoom) : [];
54338 let images = service && zoom >= imageMinZoom2 ? service.images(projection2) : [];
54339 images = await filterImages(images);
54340 sequences = await filterSequences(sequences, service);
54341 let traces = layer.selectAll(".sequences").selectAll(".sequence").data(sequences, function(d2) {
54342 return d2.properties.id;
54344 traces.exit().remove();
54345 traces.enter().append("path").attr("class", "sequence").merge(traces).attr("d", svgPath(projection2).geojson);
54346 const groups = layer.selectAll(".markers").selectAll(".viewfield-group").data(images, function(d2) {
54349 groups.exit().remove();
54350 const groupsEnter = groups.enter().append("g").attr("class", "viewfield-group").on("mouseenter", mouseover).on("mouseleave", mouseout).on("click", click);
54351 groupsEnter.append("g").attr("class", "viewfield-scale");
54352 const activeImageId = (_a3 = service.getActiveImage()) == null ? void 0 : _a3.id;
54353 const markers = groups.merge(groupsEnter).sort(function(a2, b2) {
54354 if (a2.id === activeImageId) return 1;
54355 if (b2.id === activeImageId) return -1;
54356 return a2.capture_time_parsed - b2.capture_time_parsed;
54357 }).attr("transform", (d2) => transform2(d2, activeImageId)).select(".viewfield-scale");
54358 markers.selectAll("circle").data([0]).enter().append("circle").attr("dx", "0").attr("dy", "0").attr("r", "6");
54359 const viewfields = markers.selectAll(".viewfield").data(showViewfields ? [0] : []);
54360 viewfields.exit().remove();
54361 viewfields.enter().insert("path", "circle").attr("class", "viewfield").attr("transform", "scale(1.5,1.5),translate(-8, -13)").attr("d", viewfieldPath);
54362 service.setStyles(context, null);
54363 function viewfieldPath() {
54364 if (this.parentNode.__data__.isPano) {
54365 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
54367 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
54371 function viewerChanged() {
54372 const service = getService();
54373 if (!service) return;
54374 const frame2 = service.photoFrame();
54375 if (!frame2) return;
54376 _viewerYaw = frame2.getYaw();
54377 if (context.map().isTransformed()) return;
54378 layer.selectAll(".viewfield-group.currentView").attr("transform", (d2) => transform2(d2, d2.id));
54380 function drawImages(selection2) {
54381 const enabled = svgPanoramaxImages.enabled;
54382 const service = getService();
54383 layer = selection2.selectAll(".layer-panoramax").data(service ? [0] : []);
54384 layer.exit().remove();
54385 const layerEnter = layer.enter().append("g").attr("class", "layer-panoramax").style("display", enabled ? "block" : "none");
54386 layerEnter.append("g").attr("class", "sequences");
54387 layerEnter.append("g").attr("class", "markers");
54388 layer = layerEnter.merge(layer);
54390 let zoom = ~~context.map().zoom();
54392 if (zoom >= imageMinZoom2) {
54395 service.loadImages(projection2);
54396 } else if (zoom >= lineMinZoom2) {
54399 service.loadLines(projection2, zoom);
54408 drawImages.enabled = function(_2) {
54409 if (!arguments.length) return svgPanoramaxImages.enabled;
54410 svgPanoramaxImages.enabled = _2;
54411 if (svgPanoramaxImages.enabled) {
54413 context.photos().on("change.panoramax_images", update);
54416 context.photos().on("change.panoramax_images", null);
54418 dispatch14.call("change");
54421 drawImages.supported = function() {
54422 return !!getService();
54424 drawImages.rendered = function(zoom) {
54425 return zoom >= lineMinZoom2;
54431 // modules/svg/osm.js
54432 function svgOsm(projection2, context, dispatch14) {
54433 var enabled = true;
54434 function drawOsm(selection2) {
54435 selection2.selectAll(".layer-osm").data(["covered", "areas", "lines", "points", "labels"]).enter().append("g").attr("class", function(d2) {
54436 return "layer-osm " + d2;
54438 selection2.selectAll(".layer-osm.points").selectAll(".points-group").data(["points", "midpoints", "vertices", "turns"]).enter().append("g").attr("class", function(d2) {
54439 return "points-group " + d2;
54442 function showLayer() {
54443 var layer = context.surface().selectAll(".data-layer.osm");
54445 layer.classed("disabled", false).style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
54446 dispatch14.call("change");
54449 function hideLayer() {
54450 var layer = context.surface().selectAll(".data-layer.osm");
54452 layer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
54453 layer.classed("disabled", true);
54454 dispatch14.call("change");
54457 drawOsm.enabled = function(val) {
54458 if (!arguments.length) return enabled;
54465 dispatch14.call("change");
54471 // modules/svg/notes.js
54472 var _notesEnabled = false;
54474 function svgNotes(projection2, context, dispatch14) {
54476 dispatch14 = dispatch_default("change");
54478 var throttledRedraw = throttle_default(function() {
54479 dispatch14.call("change");
54482 var touchLayer = select_default2(null);
54483 var drawLayer = select_default2(null);
54484 var _notesVisible = false;
54485 function markerPath(selection2, klass) {
54486 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");
54488 function getService() {
54489 if (services.osm && !_osmService) {
54490 _osmService = services.osm;
54491 _osmService.on("loadedNotes", throttledRedraw);
54492 } else if (!services.osm && _osmService) {
54493 _osmService = null;
54495 return _osmService;
54497 function editOn() {
54498 if (!_notesVisible) {
54499 _notesVisible = true;
54500 drawLayer.style("display", "block");
54503 function editOff() {
54504 if (_notesVisible) {
54505 _notesVisible = false;
54506 drawLayer.style("display", "none");
54507 drawLayer.selectAll(".note").remove();
54508 touchLayer.selectAll(".note").remove();
54511 function layerOn() {
54513 drawLayer.style("opacity", 0).transition().duration(250).style("opacity", 1).on("end interrupt", function() {
54514 dispatch14.call("change");
54517 function layerOff() {
54518 throttledRedraw.cancel();
54519 drawLayer.interrupt();
54520 touchLayer.selectAll(".note").remove();
54521 drawLayer.transition().duration(250).style("opacity", 0).on("end interrupt", function() {
54523 dispatch14.call("change");
54526 function updateMarkers() {
54527 if (!_notesVisible || !_notesEnabled) return;
54528 var service = getService();
54529 var selectedID = context.selectedNoteID();
54530 var data = service ? service.notes(projection2) : [];
54531 var getTransform = svgPointTransform(projection2);
54532 var notes = drawLayer.selectAll(".note").data(data, function(d2) {
54533 return d2.status + d2.id;
54535 notes.exit().remove();
54536 var notesEnter = notes.enter().append("g").attr("class", function(d2) {
54537 return "note note-" + d2.id + " " + d2.status;
54538 }).classed("new", function(d2) {
54541 notesEnter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
54542 notesEnter.append("path").call(markerPath, "shadow");
54543 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");
54544 notesEnter.selectAll(".icon-annotation").data(function(d2) {
54546 }).enter().append("use").attr("class", "icon-annotation").attr("width", "10px").attr("height", "10px").attr("x", "-3px").attr("y", "-19px").attr("xlink:href", function(d2) {
54547 if (d2.id < 0) return "#iD-icon-plus";
54548 if (d2.status === "open") return "#iD-icon-close";
54549 return "#iD-icon-apply";
54551 notes.merge(notesEnter).sort(sortY).classed("selected", function(d2) {
54552 var mode = context.mode();
54553 var isMoving = mode && mode.id === "drag-note";
54554 return !isMoving && d2.id === selectedID;
54555 }).attr("transform", getTransform);
54556 if (touchLayer.empty()) return;
54557 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
54558 var targets = touchLayer.selectAll(".note").data(data, function(d2) {
54561 targets.exit().remove();
54562 targets.enter().append("rect").attr("width", "20px").attr("height", "20px").attr("x", "-8px").attr("y", "-22px").merge(targets).sort(sortY).attr("class", function(d2) {
54563 var newClass = d2.id < 0 ? "new" : "";
54564 return "note target note-" + d2.id + " " + fillClass + newClass;
54565 }).attr("transform", getTransform);
54566 function sortY(a2, b2) {
54567 if (a2.id === selectedID) return 1;
54568 if (b2.id === selectedID) return -1;
54569 return b2.loc[1] - a2.loc[1];
54572 function drawNotes(selection2) {
54573 var service = getService();
54574 var surface = context.surface();
54575 if (surface && !surface.empty()) {
54576 touchLayer = surface.selectAll(".data-layer.touch .layer-touch.markers");
54578 drawLayer = selection2.selectAll(".layer-notes").data(service ? [0] : []);
54579 drawLayer.exit().remove();
54580 drawLayer = drawLayer.enter().append("g").attr("class", "layer-notes").style("display", _notesEnabled ? "block" : "none").merge(drawLayer);
54581 if (_notesEnabled) {
54582 if (service && ~~context.map().zoom() >= minZoom5) {
54584 service.loadNotes(projection2);
54591 drawNotes.enabled = function(val) {
54592 if (!arguments.length) return _notesEnabled;
54593 _notesEnabled = val;
54594 if (_notesEnabled) {
54598 if (context.selectedNoteID()) {
54599 context.enter(modeBrowse(context));
54602 dispatch14.call("change");
54608 // modules/svg/touch.js
54609 function svgTouch() {
54610 function drawTouch(selection2) {
54611 selection2.selectAll(".layer-touch").data(["areas", "lines", "points", "turns", "markers"]).enter().append("g").attr("class", function(d2) {
54612 return "layer-touch " + d2;
54618 // modules/util/dimensions.js
54619 function refresh(selection2, node) {
54620 var cr = node.getBoundingClientRect();
54621 var prop = [cr.width, cr.height];
54622 selection2.property("__dimensions__", prop);
54625 function utilGetDimensions(selection2, force) {
54626 if (!selection2 || selection2.empty()) {
54629 var node = selection2.node(), cached = selection2.property("__dimensions__");
54630 return !cached || force ? refresh(selection2, node) : cached;
54632 function utilSetDimensions(selection2, dimensions) {
54633 if (!selection2 || selection2.empty()) {
54636 var node = selection2.node();
54637 if (dimensions === null) {
54638 refresh(selection2, node);
54641 return selection2.property("__dimensions__", [dimensions[0], dimensions[1]]).attr("width", dimensions[0]).attr("height", dimensions[1]);
54644 // modules/svg/layers.js
54645 function svgLayers(projection2, context) {
54646 var dispatch14 = dispatch_default("change");
54647 var svg2 = select_default2(null);
54649 { id: "osm", layer: svgOsm(projection2, context, dispatch14) },
54650 { id: "notes", layer: svgNotes(projection2, context, dispatch14) },
54651 { id: "data", layer: svgData(projection2, context, dispatch14) },
54652 { id: "keepRight", layer: svgKeepRight(projection2, context, dispatch14) },
54653 { id: "osmose", layer: svgOsmose(projection2, context, dispatch14) },
54654 { id: "streetside", layer: svgStreetside(projection2, context, dispatch14) },
54655 { id: "mapillary", layer: svgMapillaryImages(projection2, context, dispatch14) },
54656 { id: "mapillary-position", layer: svgMapillaryPosition(projection2, context, dispatch14) },
54657 { id: "mapillary-map-features", layer: svgMapillaryMapFeatures(projection2, context, dispatch14) },
54658 { id: "mapillary-signs", layer: svgMapillarySigns(projection2, context, dispatch14) },
54659 { id: "kartaview", layer: svgKartaviewImages(projection2, context, dispatch14) },
54660 { id: "mapilio", layer: svgMapilioImages(projection2, context, dispatch14) },
54661 { id: "vegbilder", layer: svgVegbilder(projection2, context, dispatch14) },
54662 { id: "panoramax", layer: svgPanoramaxImages(projection2, context, dispatch14) },
54663 { id: "local-photos", layer: svgLocalPhotos(projection2, context, dispatch14) },
54664 { id: "debug", layer: svgDebug(projection2, context, dispatch14) },
54665 { id: "geolocate", layer: svgGeolocate(projection2, context, dispatch14) },
54666 { id: "touch", layer: svgTouch(projection2, context, dispatch14) }
54668 function drawLayers(selection2) {
54669 svg2 = selection2.selectAll(".surface").data([0]);
54670 svg2 = svg2.enter().append("svg").attr("class", "surface").merge(svg2);
54671 var defs = svg2.selectAll(".surface-defs").data([0]);
54672 defs.enter().append("defs").attr("class", "surface-defs");
54673 var groups = svg2.selectAll(".data-layer").data(_layers);
54674 groups.exit().remove();
54675 groups.enter().append("g").attr("class", function(d2) {
54676 return "data-layer " + d2.id;
54677 }).merge(groups).each(function(d2) {
54678 select_default2(this).call(d2.layer);
54681 drawLayers.all = function() {
54684 drawLayers.layer = function(id2) {
54685 var obj = _layers.find(function(o2) {
54686 return o2.id === id2;
54688 return obj && obj.layer;
54690 drawLayers.only = function(what) {
54691 var arr = [].concat(what);
54692 var all = _layers.map(function(layer) {
54695 return drawLayers.remove(utilArrayDifference(all, arr));
54697 drawLayers.remove = function(what) {
54698 var arr = [].concat(what);
54699 arr.forEach(function(id2) {
54700 _layers = _layers.filter(function(o2) {
54701 return o2.id !== id2;
54704 dispatch14.call("change");
54707 drawLayers.add = function(what) {
54708 var arr = [].concat(what);
54709 arr.forEach(function(obj) {
54710 if ("id" in obj && "layer" in obj) {
54714 dispatch14.call("change");
54717 drawLayers.dimensions = function(val) {
54718 if (!arguments.length) return utilGetDimensions(svg2);
54719 utilSetDimensions(svg2, val);
54722 return utilRebind(drawLayers, dispatch14, "on");
54725 // modules/svg/lines.js
54726 var import_fast_deep_equal6 = __toESM(require_fast_deep_equal());
54727 function svgLines(projection2, context) {
54728 var detected = utilDetect();
54729 var highway_stack = {
54744 function drawTargets(selection2, graph, entities, filter2) {
54745 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
54746 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
54747 var getPath = svgPath(projection2).geojson;
54748 var activeID = context.activeID();
54749 var base = context.history().base();
54750 var data = { targets: [], nopes: [] };
54751 entities.forEach(function(way) {
54752 var features = svgSegmentWay(way, graph, activeID);
54753 data.targets.push.apply(data.targets, features.passive);
54754 data.nopes.push.apply(data.nopes, features.active);
54756 var targetData = data.targets.filter(getPath);
54757 var targets = selection2.selectAll(".line.target-allowed").filter(function(d2) {
54758 return filter2(d2.properties.entity);
54759 }).data(targetData, function key(d2) {
54762 targets.exit().remove();
54763 var segmentWasEdited = function(d2) {
54764 var wayID = d2.properties.entity.id;
54765 if (!base.entities[wayID] || !(0, import_fast_deep_equal6.default)(graph.entities[wayID].nodes, base.entities[wayID].nodes)) {
54768 return d2.properties.nodes.some(function(n3) {
54769 return !base.entities[n3.id] || !(0, import_fast_deep_equal6.default)(graph.entities[n3.id].loc, base.entities[n3.id].loc);
54772 targets.enter().append("path").merge(targets).attr("d", getPath).attr("class", function(d2) {
54773 return "way line target target-allowed " + targetClass + d2.id;
54774 }).classed("segment-edited", segmentWasEdited);
54775 var nopeData = data.nopes.filter(getPath);
54776 var nopes = selection2.selectAll(".line.target-nope").filter(function(d2) {
54777 return filter2(d2.properties.entity);
54778 }).data(nopeData, function key(d2) {
54781 nopes.exit().remove();
54782 nopes.enter().append("path").merge(nopes).attr("d", getPath).attr("class", function(d2) {
54783 return "way line target target-nope " + nopeClass + d2.id;
54784 }).classed("segment-edited", segmentWasEdited);
54786 function drawLines(selection2, graph, entities, filter2) {
54787 var base = context.history().base();
54788 function waystack(a2, b2) {
54789 var selected = context.selectedIDs();
54790 var scoreA = selected.indexOf(a2.id) !== -1 ? 20 : 0;
54791 var scoreB = selected.indexOf(b2.id) !== -1 ? 20 : 0;
54792 if (a2.tags.highway) {
54793 scoreA -= highway_stack[a2.tags.highway];
54795 if (b2.tags.highway) {
54796 scoreB -= highway_stack[b2.tags.highway];
54798 return scoreA - scoreB;
54800 function drawLineGroup(selection3, klass, isSelected) {
54801 var mode = context.mode();
54802 var isDrawing = mode && /^draw/.test(mode.id);
54803 var selectedClass = !isDrawing && isSelected ? "selected " : "";
54804 var lines = selection3.selectAll("path").filter(filter2).data(getPathData(isSelected), osmEntity.key);
54805 lines.exit().remove();
54806 lines.enter().append("path").attr("class", function(d2) {
54807 var prefix = "way line";
54808 if (!d2.hasInterestingTags()) {
54809 var parentRelations = graph.parentRelations(d2);
54810 var parentMultipolygons = parentRelations.filter(function(relation) {
54811 return relation.isMultipolygon();
54813 if (parentMultipolygons.length > 0 && // and only multipolygon relations
54814 parentRelations.length === parentMultipolygons.length) {
54815 prefix = "relation area";
54818 var oldMPClass = oldMultiPolygonOuters[d2.id] ? "old-multipolygon " : "";
54819 return prefix + " " + klass + " " + selectedClass + oldMPClass + d2.id;
54820 }).classed("added", function(d2) {
54821 return !base.entities[d2.id];
54822 }).classed("geometry-edited", function(d2) {
54823 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);
54824 }).classed("retagged", function(d2) {
54825 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);
54826 }).call(svgTagClasses()).merge(lines).sort(waystack).attr("d", getPath).call(svgTagClasses().tags(svgRelationMemberTags(graph)));
54829 function getPathData(isSelected) {
54830 return function() {
54831 var layer = this.parentNode.__data__;
54832 var data = pathdata[layer] || [];
54833 return data.filter(function(d2) {
54835 return context.selectedIDs().indexOf(d2.id) !== -1;
54837 return context.selectedIDs().indexOf(d2.id) === -1;
54842 function addMarkers(layergroup, pathclass, groupclass, groupdata, marker) {
54843 var markergroup = layergroup.selectAll("g." + groupclass).data([pathclass]);
54844 markergroup = markergroup.enter().append("g").attr("class", groupclass).merge(markergroup);
54845 var markers = markergroup.selectAll("path").filter(filter2).data(
54847 return groupdata[this.parentNode.__data__] || [];
54850 return [d2.id, d2.index];
54853 markers.exit().remove();
54854 markers = markers.enter().append("path").attr("class", pathclass).merge(markers).attr("marker-mid", marker).attr("d", function(d2) {
54858 markers.each(function() {
54859 this.parentNode.insertBefore(this, this);
54863 var getPath = svgPath(projection2, graph);
54865 var onewaydata = {};
54866 var sideddata = {};
54867 var oldMultiPolygonOuters = {};
54868 for (var i3 = 0; i3 < entities.length; i3++) {
54869 var entity = entities[i3];
54870 if (entity.geometry(graph) === "line" || entity.geometry(graph) === "area" && entity.sidednessIdentifier && entity.sidednessIdentifier() === "coastline") {
54874 ways = ways.filter(getPath);
54875 var pathdata = utilArrayGroupBy(ways, function(way) {
54876 return way.layer();
54878 Object.keys(pathdata).forEach(function(k2) {
54879 var v2 = pathdata[k2];
54880 var onewayArr = v2.filter(function(d2) {
54881 return d2.isOneWay();
54883 var onewaySegments = svgMarkerSegments(
54887 function shouldReverse(entity2) {
54888 return entity2.tags.oneway === "-1" || entity2.tags.conveying === "backward";
54890 function bothDirections(entity2) {
54891 return entity2.tags.oneway === "alternating" || entity2.tags.oneway === "reversible" || entity2.tags.conveying === "reversible";
54894 onewaydata[k2] = utilArrayFlatten(onewayArr.map(onewaySegments));
54895 var sidedArr = v2.filter(function(d2) {
54896 return d2.isSided();
54898 var sidedSegments = svgMarkerSegments(
54902 function shouldReverse() {
54905 function bothDirections() {
54909 sideddata[k2] = utilArrayFlatten(sidedArr.map(sidedSegments));
54911 var covered = selection2.selectAll(".layer-osm.covered");
54912 var uncovered = selection2.selectAll(".layer-osm.lines");
54913 var touchLayer = selection2.selectAll(".layer-touch.lines");
54914 [covered, uncovered].forEach(function(selection3) {
54915 var range3 = selection3 === covered ? range(-10, 0) : range(0, 11);
54916 var layergroup = selection3.selectAll("g.layergroup").data(range3);
54917 layergroup = layergroup.enter().append("g").attr("class", function(d2) {
54918 return "layergroup layer" + String(d2);
54919 }).merge(layergroup);
54920 layergroup.selectAll("g.linegroup").data(["shadow", "casing", "stroke", "shadow-highlighted", "casing-highlighted", "stroke-highlighted"]).enter().append("g").attr("class", function(d2) {
54921 return "linegroup line-" + d2;
54923 layergroup.selectAll("g.line-shadow").call(drawLineGroup, "shadow", false);
54924 layergroup.selectAll("g.line-casing").call(drawLineGroup, "casing", false);
54925 layergroup.selectAll("g.line-stroke").call(drawLineGroup, "stroke", false);
54926 layergroup.selectAll("g.line-shadow-highlighted").call(drawLineGroup, "shadow", true);
54927 layergroup.selectAll("g.line-casing-highlighted").call(drawLineGroup, "casing", true);
54928 layergroup.selectAll("g.line-stroke-highlighted").call(drawLineGroup, "stroke", true);
54929 addMarkers(layergroup, "oneway", "onewaygroup", onewaydata, "url(#ideditor-oneway-marker)");
54935 function marker(d2) {
54936 var category = graph.entity(d2.id).sidednessIdentifier();
54937 return "url(#ideditor-sided-marker-" + category + ")";
54941 touchLayer.call(drawTargets, graph, ways, filter2);
54946 // modules/svg/midpoints.js
54947 function svgMidpoints(projection2, context) {
54948 var targetRadius = 8;
54949 function drawTargets(selection2, graph, entities, filter2) {
54950 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
54951 var getTransform = svgPointTransform(projection2).geojson;
54952 var data = entities.map(function(midpoint) {
54962 coordinates: midpoint.loc
54966 var targets = selection2.selectAll(".midpoint.target").filter(function(d2) {
54967 return filter2(d2.properties.entity);
54968 }).data(data, function key(d2) {
54971 targets.exit().remove();
54972 targets.enter().append("circle").attr("r", targetRadius).merge(targets).attr("class", function(d2) {
54973 return "node midpoint target " + fillClass + d2.id;
54974 }).attr("transform", getTransform);
54976 function drawMidpoints(selection2, graph, entities, filter2, extent) {
54977 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.midpoints");
54978 var touchLayer = selection2.selectAll(".layer-touch.points");
54979 var mode = context.mode();
54980 if (mode && mode.id !== "select" || !context.map().withinEditableZoom()) {
54981 drawLayer.selectAll(".midpoint").remove();
54982 touchLayer.selectAll(".midpoint.target").remove();
54985 var poly = extent.polygon();
54986 var midpoints = {};
54987 for (var i3 = 0; i3 < entities.length; i3++) {
54988 var entity = entities[i3];
54989 if (entity.type !== "way") continue;
54990 if (!filter2(entity)) continue;
54991 if (context.selectedIDs().indexOf(entity.id) < 0) continue;
54992 var nodes = graph.childNodes(entity);
54993 for (var j2 = 0; j2 < nodes.length - 1; j2++) {
54994 var a2 = nodes[j2];
54995 var b2 = nodes[j2 + 1];
54996 var id2 = [a2.id, b2.id].sort().join("-");
54997 if (midpoints[id2]) {
54998 midpoints[id2].parents.push(entity);
54999 } else if (geoVecLength(projection2(a2.loc), projection2(b2.loc)) > 40) {
55000 var point = geoVecInterp(a2.loc, b2.loc, 0.5);
55002 if (extent.intersects(point)) {
55005 for (var k2 = 0; k2 < 4; k2++) {
55006 point = geoLineIntersection([a2.loc, b2.loc], [poly[k2], poly[k2 + 1]]);
55007 if (point && geoVecLength(projection2(a2.loc), projection2(point)) > 20 && geoVecLength(projection2(b2.loc), projection2(point)) > 20) {
55018 edge: [a2.id, b2.id],
55025 function midpointFilter(d2) {
55026 if (midpoints[d2.id]) return true;
55027 for (var i4 = 0; i4 < d2.parents.length; i4++) {
55028 if (filter2(d2.parents[i4])) {
55034 var groups = drawLayer.selectAll(".midpoint").filter(midpointFilter).data(Object.values(midpoints), function(d2) {
55037 groups.exit().remove();
55038 var enter = groups.enter().insert("g", ":first-child").attr("class", "midpoint");
55039 enter.append("polygon").attr("points", "-6,8 10,0 -6,-8").attr("class", "shadow");
55040 enter.append("polygon").attr("points", "-3,4 5,0 -3,-4").attr("class", "fill");
55041 groups = groups.merge(enter).attr("transform", function(d2) {
55042 var translate = svgPointTransform(projection2);
55043 var a3 = graph.entity(d2.edge[0]);
55044 var b3 = graph.entity(d2.edge[1]);
55045 var angle2 = geoAngle(a3, b3, projection2) * (180 / Math.PI);
55046 return translate(d2) + " rotate(" + angle2 + ")";
55047 }).call(svgTagClasses().tags(
55049 return d2.parents[0].tags;
55052 groups.select("polygon.shadow");
55053 groups.select("polygon.fill");
55054 touchLayer.call(drawTargets, graph, Object.values(midpoints), midpointFilter);
55056 return drawMidpoints;
55059 // modules/svg/points.js
55060 var import_fast_deep_equal7 = __toESM(require_fast_deep_equal());
55061 function svgPoints(projection2, context) {
55062 function markerPath(selection2, klass) {
55063 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");
55065 function sortY(a2, b2) {
55066 return b2.loc[1] - a2.loc[1];
55068 function fastEntityKey(d2) {
55069 var mode = context.mode();
55070 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55071 return isMoving ? d2.id : osmEntity.key(d2);
55073 function drawTargets(selection2, graph, entities, filter2) {
55074 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
55075 var getTransform = svgPointTransform(projection2).geojson;
55076 var activeID = context.activeID();
55078 entities.forEach(function(node) {
55079 if (activeID === node.id) return;
55087 geometry: node.asGeoJSON()
55090 var targets = selection2.selectAll(".point.target").filter(function(d2) {
55091 return filter2(d2.properties.entity);
55092 }).data(data, function key(d2) {
55095 targets.exit().remove();
55096 targets.enter().append("rect").attr("x", -10).attr("y", -26).attr("width", 20).attr("height", 30).merge(targets).attr("class", function(d2) {
55097 return "node point target " + fillClass + d2.id;
55098 }).attr("transform", getTransform);
55100 function drawPoints(selection2, graph, entities, filter2) {
55101 var wireframe = context.surface().classed("fill-wireframe");
55102 var zoom = geoScaleToZoom(projection2.scale());
55103 var base = context.history().base();
55104 function renderAsPoint(entity) {
55105 return entity.geometry(graph) === "point" && !(zoom >= 18 && entity.directions(graph, projection2).length);
55107 var points = wireframe ? [] : entities.filter(renderAsPoint);
55108 points.sort(sortY);
55109 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.points");
55110 var touchLayer = selection2.selectAll(".layer-touch.points");
55111 var groups = drawLayer.selectAll("g.point").filter(filter2).data(points, fastEntityKey);
55112 groups.exit().remove();
55113 var enter = groups.enter().append("g").attr("class", function(d2) {
55114 return "node point " + d2.id;
55116 enter.append("path").call(markerPath, "shadow");
55117 enter.append("ellipse").attr("cx", 0.5).attr("cy", 1).attr("rx", 6.5).attr("ry", 3).attr("class", "stroke");
55118 enter.append("path").call(markerPath, "stroke");
55119 enter.append("use").attr("transform", "translate(-5.5, -20)").attr("class", "icon").attr("width", "12px").attr("height", "12px");
55120 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("added", function(d2) {
55121 return !base.entities[d2.id];
55122 }).classed("moved", function(d2) {
55123 return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
55124 }).classed("retagged", function(d2) {
55125 return base.entities[d2.id] && !(0, import_fast_deep_equal7.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
55126 }).call(svgTagClasses());
55127 groups.select(".shadow");
55128 groups.select(".stroke");
55129 groups.select(".icon").attr("xlink:href", function(entity) {
55130 var preset = _mainPresetIndex.match(entity, graph);
55131 var picon = preset && preset.icon;
55132 return picon ? "#" + picon : "";
55134 touchLayer.call(drawTargets, graph, points, filter2);
55139 // modules/svg/turns.js
55140 function svgTurns(projection2, context) {
55141 function icon2(turn) {
55142 var u2 = turn.u ? "-u" : "";
55143 if (turn.no) return "#iD-turn-no" + u2;
55144 if (turn.only) return "#iD-turn-only" + u2;
55145 return "#iD-turn-yes" + u2;
55147 function drawTurns(selection2, graph, turns) {
55148 function turnTransform(d2) {
55150 var toWay = graph.entity(d2.to.way);
55151 var toPoints = graph.childNodes(toWay).map(function(n3) {
55153 }).map(projection2);
55154 var toLength = geoPathLength(toPoints);
55155 var mid = toLength / 2;
55156 var toNode = graph.entity(d2.to.node);
55157 var toVertex = graph.entity(d2.to.vertex);
55158 var a2 = geoAngle(toVertex, toNode, projection2);
55159 var o2 = projection2(toVertex.loc);
55160 var r2 = d2.u ? 0 : !toWay.__via ? pxRadius : Math.min(mid, pxRadius);
55161 return "translate(" + (r2 * Math.cos(a2) + o2[0]) + "," + (r2 * Math.sin(a2) + o2[1]) + ") rotate(" + a2 * 180 / Math.PI + ")";
55163 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.turns");
55164 var touchLayer = selection2.selectAll(".layer-touch.turns");
55165 var groups = drawLayer.selectAll("g.turn").data(turns, function(d2) {
55168 groups.exit().remove();
55169 var groupsEnter = groups.enter().append("g").attr("class", function(d2) {
55170 return "turn " + d2.key;
55172 var turnsEnter = groupsEnter.filter(function(d2) {
55175 turnsEnter.append("rect").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55176 turnsEnter.append("use").attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55177 var uEnter = groupsEnter.filter(function(d2) {
55180 uEnter.append("circle").attr("r", "16");
55181 uEnter.append("use").attr("transform", "translate(-16, -16)").attr("width", "32").attr("height", "32");
55182 groups = groups.merge(groupsEnter).attr("opacity", function(d2) {
55183 return d2.direct === false ? "0.7" : null;
55184 }).attr("transform", turnTransform);
55185 groups.select("use").attr("xlink:href", icon2);
55186 groups.select("rect");
55187 groups.select("circle");
55188 var fillClass = context.getDebug("target") ? "pink " : "nocolor ";
55189 groups = touchLayer.selectAll("g.turn").data(turns, function(d2) {
55192 groups.exit().remove();
55193 groupsEnter = groups.enter().append("g").attr("class", function(d2) {
55194 return "turn " + d2.key;
55196 turnsEnter = groupsEnter.filter(function(d2) {
55199 turnsEnter.append("rect").attr("class", "target " + fillClass).attr("transform", "translate(-22, -12)").attr("width", "44").attr("height", "24");
55200 uEnter = groupsEnter.filter(function(d2) {
55203 uEnter.append("circle").attr("class", "target " + fillClass).attr("r", "16");
55204 groups = groups.merge(groupsEnter).attr("transform", turnTransform);
55205 groups.select("rect");
55206 groups.select("circle");
55212 // modules/svg/vertices.js
55213 var import_fast_deep_equal8 = __toESM(require_fast_deep_equal());
55214 function svgVertices(projection2, context) {
55216 // z16-, z17, z18+, w/icon
55217 shadow: [6, 7.5, 7.5, 12],
55218 stroke: [2.5, 3.5, 3.5, 8],
55219 fill: [1, 1.5, 1.5, 1.5]
55221 var _currHoverTarget;
55222 var _currPersistent = {};
55223 var _currHover = {};
55224 var _prevHover = {};
55225 var _currSelected = {};
55226 var _prevSelected = {};
55228 function sortY(a2, b2) {
55229 return b2.loc[1] - a2.loc[1];
55231 function fastEntityKey(d2) {
55232 var mode = context.mode();
55233 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55234 return isMoving ? d2.id : osmEntity.key(d2);
55236 function draw(selection2, graph, vertices, sets2, filter2) {
55237 sets2 = sets2 || { selected: {}, important: {}, hovered: {} };
55239 var directions = {};
55240 var wireframe = context.surface().classed("fill-wireframe");
55241 var zoom = geoScaleToZoom(projection2.scale());
55242 var z2 = zoom < 17 ? 0 : zoom < 18 ? 1 : 2;
55243 var activeID = context.activeID();
55244 var base = context.history().base();
55245 function getIcon(d2) {
55246 var entity = graph.entity(d2.id);
55247 if (entity.id in icons) return icons[entity.id];
55248 icons[entity.id] = entity.hasInterestingTags() && _mainPresetIndex.match(entity, graph).icon;
55249 return icons[entity.id];
55251 function getDirections(entity) {
55252 if (entity.id in directions) return directions[entity.id];
55253 var angles = entity.directions(graph, projection2);
55254 directions[entity.id] = angles.length ? angles : false;
55257 function updateAttributes(selection3) {
55258 ["shadow", "stroke", "fill"].forEach(function(klass) {
55259 var rads = radiuses[klass];
55260 selection3.selectAll("." + klass).each(function(entity) {
55261 var i3 = z2 && getIcon(entity);
55262 var r2 = rads[i3 ? 3 : z2];
55263 if (entity.id !== activeID && entity.isEndpoint(graph) && !entity.isConnected(graph)) {
55266 if (klass === "shadow") {
55267 _radii[entity.id] = r2;
55269 select_default2(this).attr("r", r2).attr("visibility", i3 && klass === "fill" ? "hidden" : null);
55273 vertices.sort(sortY);
55274 var groups = selection2.selectAll("g.vertex").filter(filter2).data(vertices, fastEntityKey);
55275 groups.exit().remove();
55276 var enter = groups.enter().append("g").attr("class", function(d2) {
55277 return "node vertex " + d2.id;
55279 enter.append("circle").attr("class", "shadow");
55280 enter.append("circle").attr("class", "stroke");
55281 enter.filter(function(d2) {
55282 return d2.hasInterestingTags();
55283 }).append("circle").attr("class", "fill");
55284 groups = groups.merge(enter).attr("transform", svgPointTransform(projection2)).classed("sibling", function(d2) {
55285 return d2.id in sets2.selected;
55286 }).classed("shared", function(d2) {
55287 return graph.isShared(d2);
55288 }).classed("endpoint", function(d2) {
55289 return d2.isEndpoint(graph);
55290 }).classed("added", function(d2) {
55291 return !base.entities[d2.id];
55292 }).classed("moved", function(d2) {
55293 return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].loc, base.entities[d2.id].loc);
55294 }).classed("retagged", function(d2) {
55295 return base.entities[d2.id] && !(0, import_fast_deep_equal8.default)(graph.entities[d2.id].tags, base.entities[d2.id].tags);
55296 }).call(svgTagClasses()).call(updateAttributes);
55297 var iconUse = groups.selectAll(".icon").data(function data(d2) {
55298 return zoom >= 17 && getIcon(d2) ? [d2] : [];
55300 iconUse.exit().remove();
55301 iconUse.enter().append("use").attr("class", "icon").attr("width", "12px").attr("height", "12px").attr("transform", "translate(-6, -6)").attr("xlink:href", function(d2) {
55302 var picon = getIcon(d2);
55303 return picon ? "#" + picon : "";
55305 var dgroups = groups.selectAll(".viewfieldgroup").data(function data(d2) {
55306 return zoom >= 18 && getDirections(d2) ? [d2] : [];
55308 dgroups.exit().remove();
55309 dgroups = dgroups.enter().insert("g", ".shadow").attr("class", "viewfieldgroup").merge(dgroups);
55310 var viewfields = dgroups.selectAll(".viewfield").data(getDirections, function key(d2) {
55311 return osmEntity.key(d2);
55313 viewfields.exit().remove();
55314 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) {
55315 return "rotate(" + d2 + ")";
55318 function drawTargets(selection2, graph, entities, filter2) {
55319 var targetClass = context.getDebug("target") ? "pink " : "nocolor ";
55320 var nopeClass = context.getDebug("target") ? "red " : "nocolor ";
55321 var getTransform = svgPointTransform(projection2).geojson;
55322 var activeID = context.activeID();
55323 var data = { targets: [], nopes: [] };
55324 entities.forEach(function(node) {
55325 if (activeID === node.id) return;
55326 var vertexType = svgPassiveVertex(node, graph, activeID);
55327 if (vertexType !== 0) {
55328 data.targets.push({
55335 geometry: node.asGeoJSON()
55340 id: node.id + "-nope",
55346 geometry: node.asGeoJSON()
55350 var targets = selection2.selectAll(".vertex.target-allowed").filter(function(d2) {
55351 return filter2(d2.properties.entity);
55352 }).data(data.targets, function key(d2) {
55355 targets.exit().remove();
55356 targets.enter().append("circle").attr("r", function(d2) {
55357 return _radii[d2.id] || radiuses.shadow[3];
55358 }).merge(targets).attr("class", function(d2) {
55359 return "node vertex target target-allowed " + targetClass + d2.id;
55360 }).attr("transform", getTransform);
55361 var nopes = selection2.selectAll(".vertex.target-nope").filter(function(d2) {
55362 return filter2(d2.properties.entity);
55363 }).data(data.nopes, function key(d2) {
55366 nopes.exit().remove();
55367 nopes.enter().append("circle").attr("r", function(d2) {
55368 return _radii[d2.properties.entity.id] || radiuses.shadow[3];
55369 }).merge(nopes).attr("class", function(d2) {
55370 return "node vertex target target-nope " + nopeClass + d2.id;
55371 }).attr("transform", getTransform);
55373 function renderAsVertex(entity, graph, wireframe, zoom) {
55374 var geometry = entity.geometry(graph);
55375 return geometry === "vertex" || geometry === "point" && (wireframe || zoom >= 18 && entity.directions(graph, projection2).length);
55377 function isEditedNode(node, base, head) {
55378 var baseNode = base.entities[node.id];
55379 var headNode = head.entities[node.id];
55380 return !headNode || !baseNode || !(0, import_fast_deep_equal8.default)(headNode.tags, baseNode.tags) || !(0, import_fast_deep_equal8.default)(headNode.loc, baseNode.loc);
55382 function getSiblingAndChildVertices(ids, graph, wireframe, zoom) {
55385 function addChildVertices(entity) {
55386 if (seenIds[entity.id]) return;
55387 seenIds[entity.id] = true;
55388 var geometry = entity.geometry(graph);
55389 if (!context.features().isHiddenFeature(entity, graph, geometry)) {
55391 if (entity.type === "way") {
55392 for (i3 = 0; i3 < entity.nodes.length; i3++) {
55393 var child = graph.hasEntity(entity.nodes[i3]);
55395 addChildVertices(child);
55398 } else if (entity.type === "relation") {
55399 for (i3 = 0; i3 < entity.members.length; i3++) {
55400 var member = graph.hasEntity(entity.members[i3].id);
55402 addChildVertices(member);
55405 } else if (renderAsVertex(entity, graph, wireframe, zoom)) {
55406 results[entity.id] = entity;
55410 ids.forEach(function(id2) {
55411 var entity = graph.hasEntity(id2);
55412 if (!entity) return;
55413 if (entity.type === "node") {
55414 if (renderAsVertex(entity, graph, wireframe, zoom)) {
55415 results[entity.id] = entity;
55416 graph.parentWays(entity).forEach(function(entity2) {
55417 addChildVertices(entity2);
55421 addChildVertices(entity);
55426 function drawVertices(selection2, graph, entities, filter2, extent, fullRedraw) {
55427 var wireframe = context.surface().classed("fill-wireframe");
55428 var visualDiff = context.surface().classed("highlight-edited");
55429 var zoom = geoScaleToZoom(projection2.scale());
55430 var mode = context.mode();
55431 var isMoving = mode && /^(add|draw|drag|move|rotate)/.test(mode.id);
55432 var base = context.history().base();
55433 var drawLayer = selection2.selectAll(".layer-osm.points .points-group.vertices");
55434 var touchLayer = selection2.selectAll(".layer-touch.points");
55436 _currPersistent = {};
55439 for (var i3 = 0; i3 < entities.length; i3++) {
55440 var entity = entities[i3];
55441 var geometry = entity.geometry(graph);
55443 if (geometry === "point" && renderAsVertex(entity, graph, wireframe, zoom)) {
55444 _currPersistent[entity.id] = entity;
55446 } else if (geometry === "vertex" && (entity.hasInterestingTags() || entity.isEndpoint(graph) || entity.isConnected(graph) || visualDiff && isEditedNode(entity, base, graph))) {
55447 _currPersistent[entity.id] = entity;
55450 if (!keep && !fullRedraw) {
55451 delete _currPersistent[entity.id];
55455 persistent: _currPersistent,
55456 // persistent = important vertices (render always)
55457 selected: _currSelected,
55458 // selected + siblings of selected (render always)
55459 hovered: _currHover
55460 // hovered + siblings of hovered (render only in draw modes)
55462 var all = Object.assign({}, isMoving ? _currHover : {}, _currSelected, _currPersistent);
55463 var filterRendered = function(d2) {
55464 return d2.id in _currPersistent || d2.id in _currSelected || d2.id in _currHover || filter2(d2);
55466 drawLayer.call(draw, graph, currentVisible(all), sets2, filterRendered);
55467 var filterTouch = function(d2) {
55468 return isMoving ? true : filterRendered(d2);
55470 touchLayer.call(drawTargets, graph, currentVisible(all), filterTouch);
55471 function currentVisible(which) {
55472 return Object.keys(which).map(graph.hasEntity, graph).filter(function(entity2) {
55473 return entity2 && entity2.intersects(extent, graph);
55477 drawVertices.drawSelected = function(selection2, graph, extent) {
55478 var wireframe = context.surface().classed("fill-wireframe");
55479 var zoom = geoScaleToZoom(projection2.scale());
55480 _prevSelected = _currSelected || {};
55481 if (context.map().isInWideSelection()) {
55482 _currSelected = {};
55483 context.selectedIDs().forEach(function(id2) {
55484 var entity = graph.hasEntity(id2);
55485 if (!entity) return;
55486 if (entity.type === "node") {
55487 if (renderAsVertex(entity, graph, wireframe, zoom)) {
55488 _currSelected[entity.id] = entity;
55493 _currSelected = getSiblingAndChildVertices(context.selectedIDs(), graph, wireframe, zoom);
55495 var filter2 = function(d2) {
55496 return d2.id in _prevSelected;
55498 drawVertices(selection2, graph, Object.values(_prevSelected), filter2, extent, false);
55500 drawVertices.drawHover = function(selection2, graph, target, extent) {
55501 if (target === _currHoverTarget) return;
55502 var wireframe = context.surface().classed("fill-wireframe");
55503 var zoom = geoScaleToZoom(projection2.scale());
55504 _prevHover = _currHover || {};
55505 _currHoverTarget = target;
55506 var entity = target && target.properties && target.properties.entity;
55508 _currHover = getSiblingAndChildVertices([entity.id], graph, wireframe, zoom);
55512 var filter2 = function(d2) {
55513 return d2.id in _prevHover;
55515 drawVertices(selection2, graph, Object.values(_prevHover), filter2, extent, false);
55517 return drawVertices;
55520 // modules/ui/length_indicator.js
55521 function uiLengthIndicator(maxChars) {
55522 var _wrap = select_default2(null);
55523 var _tooltip = uiPopover("tooltip max-length-warning").placement("bottom").hasArrow(true).content(() => (selection2) => {
55524 selection2.text("");
55525 selection2.call(svgIcon("#iD-icon-alert", "inline"));
55526 selection2.call(_t.append("inspector.max_length_reached", { maxChars }));
55528 var _silent = false;
55529 var lengthIndicator = function(selection2) {
55530 _wrap = selection2.selectAll("span.length-indicator-wrap").data([0]);
55531 _wrap = _wrap.enter().append("span").merge(_wrap).classed("length-indicator-wrap", true);
55532 selection2.call(_tooltip);
55534 lengthIndicator.update = function(val) {
55535 const strLen = utilUnicodeCharsCount(utilCleanOsmString(val, Number.POSITIVE_INFINITY));
55536 let indicator = _wrap.selectAll("span.length-indicator").data([strLen]);
55537 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");
55538 if (_silent) return;
55539 if (strLen > maxChars) {
55545 lengthIndicator.silent = function(val) {
55546 if (!arguments.length) return _silent;
55548 return lengthIndicator;
55550 return lengthIndicator;
55553 // modules/ui/fields/combo.js
55554 function uiFieldCombo(field, context) {
55555 var dispatch14 = dispatch_default("change");
55556 var _isMulti = field.type === "multiCombo" || field.type === "manyCombo";
55557 var _isNetwork = field.type === "networkCombo";
55558 var _isSemi = field.type === "semiCombo";
55559 var _showTagInfoSuggestions = field.type !== "manyCombo" && field.autoSuggestions !== false;
55560 var _allowCustomValues = field.type !== "manyCombo" && field.customValues !== false;
55561 var _snake_case = field.snake_case || field.snake_case === void 0;
55562 var _combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(field.caseSensitive).minItems(1);
55563 var _container = select_default2(null);
55564 var _inputWrap = select_default2(null);
55565 var _input = select_default2(null);
55566 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
55567 var _comboData = [];
55568 var _multiData = [];
55569 var _entityIDs = [];
55572 var _staticPlaceholder;
55573 var _dataDeprecated = [];
55574 _mainFileFetcher.get("deprecated").then(function(d2) {
55575 _dataDeprecated = d2;
55576 }).catch(function() {
55578 if (_isMulti && field.key && /[^:]$/.test(field.key)) {
55581 function snake(s2) {
55582 return s2.replace(/\s+/g, "_");
55584 function clean2(s2) {
55585 return s2.split(";").map(function(s3) {
55589 function tagValue(dval) {
55590 dval = clean2(dval || "");
55591 var found = getOptions(true).find(function(o2) {
55592 return o2.key && clean2(o2.value) === dval;
55594 if (found) return found.key;
55595 if (field.type === "typeCombo" && !dval) {
55598 return restrictTagValueSpelling(dval) || void 0;
55600 function restrictTagValueSpelling(dval) {
55602 dval = snake(dval);
55604 if (!field.caseSensitive) {
55605 dval = dval.toLowerCase();
55609 function getLabelId(field2, v2) {
55610 return field2.hasTextForStringId("options.".concat(v2, ".title")) ? "options.".concat(v2, ".title") : "options.".concat(v2);
55612 function displayValue(tval) {
55614 var stringsField = field.resolveReference("stringsCrossReference");
55615 const labelId = getLabelId(stringsField, tval);
55616 if (stringsField.hasTextForStringId(labelId)) {
55617 return stringsField.t(labelId, { default: tval });
55619 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
55624 function renderValue(tval) {
55626 var stringsField = field.resolveReference("stringsCrossReference");
55627 const labelId = getLabelId(stringsField, tval);
55628 if (stringsField.hasTextForStringId(labelId)) {
55629 return stringsField.t.append(labelId, { default: tval });
55631 if (field.type === "typeCombo" && tval.toLowerCase() === "yes") {
55634 return (selection2) => selection2.text(tval);
55636 function objectDifference(a2, b2) {
55637 return a2.filter(function(d1) {
55638 return !b2.some(function(d2) {
55639 return d1.value === d2.value;
55643 function initCombo(selection2, attachTo) {
55644 if (!_allowCustomValues) {
55645 selection2.attr("readonly", "readonly");
55647 if (_showTagInfoSuggestions && services.taginfo) {
55648 selection2.call(_combobox.fetcher(setTaginfoValues), attachTo);
55649 setTaginfoValues("", setPlaceholder);
55651 selection2.call(_combobox, attachTo);
55652 setTimeout(() => setStaticValues(setPlaceholder), 0);
55655 function getOptions(allOptions) {
55656 var stringsField = field.resolveReference("stringsCrossReference");
55657 if (!(field.options || stringsField.options)) return [];
55659 if (allOptions !== true) {
55660 options2 = field.options || stringsField.options;
55662 options2 = [].concat(field.options, stringsField.options).filter(Boolean);
55664 return options2.map(function(v2) {
55665 const labelId = getLabelId(stringsField, v2);
55668 value: stringsField.t(labelId, { default: v2 }),
55669 title: stringsField.t("options.".concat(v2, ".description"), { default: v2 }),
55670 display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
55671 klass: stringsField.hasTextForStringId(labelId) ? "" : "raw-option"
55675 function hasStaticValues() {
55676 return getOptions().length > 0;
55678 function setStaticValues(callback, filter2) {
55679 _comboData = getOptions();
55680 if (filter2 !== void 0) {
55681 _comboData = _comboData.filter(filter2);
55683 _comboData = objectDifference(_comboData, _multiData);
55684 _combobox.data(_comboData);
55685 if (callback) callback(_comboData);
55687 function setTaginfoValues(q2, callback) {
55688 var queryFilter = (d2) => d2.value.toLowerCase().includes(q2.toLowerCase()) || d2.key.toLowerCase().includes(q2.toLowerCase());
55689 if (hasStaticValues()) {
55690 setStaticValues(callback, queryFilter);
55692 var stringsField = field.resolveReference("stringsCrossReference");
55693 var fn = _isMulti ? "multikeys" : "values";
55694 var query = (_isMulti ? field.key : "") + q2;
55695 var hasCountryPrefix = _isNetwork && _countryCode && _countryCode.indexOf(q2.toLowerCase()) === 0;
55696 if (hasCountryPrefix) {
55697 query = _countryCode + ":";
55700 debounce: q2 !== "",
55704 if (_entityIDs.length) {
55705 params.geometry = context.graph().geometry(_entityIDs[0]);
55707 services.taginfo[fn](params, function(err, data) {
55709 data = data.filter((d2) => field.type !== "typeCombo" || d2.value !== "yes");
55710 data = data.filter((d2) => {
55711 var value = d2.value;
55713 value = value.slice(field.key.length);
55715 return value === restrictTagValueSpelling(value);
55717 var deprecatedValues = osmEntity.deprecatedTagValuesByKey(_dataDeprecated)[field.key];
55718 if (deprecatedValues) {
55719 data = data.filter((d2) => !deprecatedValues.includes(d2.value));
55721 if (hasCountryPrefix) {
55722 data = data.filter((d2) => d2.value.toLowerCase().indexOf(_countryCode + ":") === 0);
55724 const additionalOptions = (field.options || stringsField.options || []).filter((v2) => !data.some((dv) => dv.value === (_isMulti ? field.key + v2 : v2))).map((v2) => ({ value: v2 }));
55725 _container.classed("empty-combobox", data.length === 0);
55726 _comboData = data.concat(additionalOptions).map(function(d2) {
55728 if (_isMulti) v2 = v2.replace(field.key, "");
55729 const labelId = getLabelId(stringsField, v2);
55730 var isLocalizable = stringsField.hasTextForStringId(labelId);
55731 var label = stringsField.t(labelId, { default: v2 });
55735 title: stringsField.t("options.".concat(v2, ".description"), { default: isLocalizable ? v2 : d2.title !== label ? d2.title : "" }),
55736 display: addComboboxIcons(stringsField.t.append(labelId, { default: v2 }), v2),
55737 klass: isLocalizable ? "" : "raw-option"
55740 _comboData = _comboData.filter(queryFilter);
55741 _comboData = objectDifference(_comboData, _multiData);
55742 if (callback) callback(_comboData, hasStaticValues());
55745 function addComboboxIcons(disp, value) {
55746 const iconsField = field.resolveReference("iconsCrossReference");
55747 if (iconsField.icons) {
55748 return function(selection2) {
55749 var span = selection2.insert("span", ":first-child").attr("class", "tag-value-icon");
55750 if (iconsField.icons[value]) {
55751 span.call(svgIcon("#".concat(iconsField.icons[value])));
55753 disp.call(this, selection2);
55758 function setPlaceholder(values) {
55759 if (_isMulti || _isSemi) {
55760 _staticPlaceholder = field.placeholder() || _t("inspector.add");
55762 var vals = values.map(function(d2) {
55764 }).filter(function(s2) {
55765 return s2.length < 20;
55767 var placeholders = vals.length > 1 ? vals : values.map(function(d2) {
55770 _staticPlaceholder = field.placeholder() || placeholders.slice(0, 3).join(", ");
55772 if (!/(…|\.\.\.)$/.test(_staticPlaceholder)) {
55773 _staticPlaceholder += "\u2026";
55776 if (!_isMulti && !_isSemi && _tags && Array.isArray(_tags[field.key])) {
55777 ph = _t("inspector.multiple_values");
55779 ph = _staticPlaceholder;
55781 _container.selectAll("input").attr("placeholder", ph);
55782 var hideAdd = !_allowCustomValues && !values.length;
55783 _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
55785 function change() {
55788 if (_isMulti || _isSemi) {
55791 vals = [tagValue(utilGetSetValue(_input))];
55792 } else if (_isSemi) {
55793 val = tagValue(utilGetSetValue(_input)) || "";
55794 val = val.replace(/,/g, ";");
55795 vals = val.split(";");
55797 vals = vals.filter(Boolean);
55798 if (!vals.length) return;
55799 _container.classed("active", false);
55800 utilGetSetValue(_input, "");
55802 utilArrayUniq(vals).forEach(function(v2) {
55803 var key = (field.key || "") + v2;
55805 var old = _tags[key];
55806 if (typeof old === "string" && old.toLowerCase() !== "no") return;
55808 key = context.cleanTagKey(key);
55809 field.keys.push(key);
55812 } else if (_isSemi) {
55813 var arr = _multiData.map(function(d2) {
55816 arr = arr.concat(vals);
55817 t2[field.key] = context.cleanTagValue(utilArrayUniq(arr).filter(Boolean).join(";"));
55819 window.setTimeout(function() {
55820 _input.node().focus();
55823 var rawValue = utilGetSetValue(_input);
55824 if (!rawValue && Array.isArray(_tags[field.key])) return;
55825 val = context.cleanTagValue(tagValue(rawValue));
55826 t2[field.key] = val || void 0;
55828 dispatch14.call("change", this, t2);
55830 function removeMultikey(d3_event, d2) {
55831 d3_event.preventDefault();
55832 d3_event.stopPropagation();
55835 t2[d2.key] = void 0;
55836 } else if (_isSemi) {
55837 var arr = _multiData.map(function(md) {
55838 return md.key === d2.key ? null : md.key;
55839 }).filter(Boolean);
55840 arr = utilArrayUniq(arr);
55841 t2[field.key] = arr.length ? arr.join(";") : void 0;
55842 _lengthIndicator.update(t2[field.key]);
55844 dispatch14.call("change", this, t2);
55846 function invertMultikey(d3_event, d2) {
55847 d3_event.preventDefault();
55848 d3_event.stopPropagation();
55851 t2[d2.key] = _tags[d2.key] === "yes" ? "no" : "yes";
55853 dispatch14.call("change", this, t2);
55855 function combo(selection2) {
55856 _container = selection2.selectAll(".form-field-input-wrap").data([0]);
55857 var type2 = _isMulti || _isSemi ? "multicombo" : "combo";
55858 _container = _container.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + type2).merge(_container);
55859 if (_isMulti || _isSemi) {
55860 _container = _container.selectAll(".chiplist").data([0]);
55861 var listClass = "chiplist";
55862 if (field.key === "destination" || field.key === "via") {
55863 listClass += " full-line-chips";
55865 _container = _container.enter().append("ul").attr("class", listClass).on("click", function() {
55866 window.setTimeout(function() {
55867 _input.node().focus();
55869 }).merge(_container);
55870 _inputWrap = _container.selectAll(".input-wrap").data([0]);
55871 _inputWrap = _inputWrap.enter().append("li").attr("class", "input-wrap").merge(_inputWrap);
55872 var hideAdd = !_allowCustomValues && !_comboData.length;
55873 _inputWrap.style("display", hideAdd ? "none" : null);
55874 _input = _inputWrap.selectAll("input").data([0]);
55876 _input = _container.selectAll("input").data([0]);
55878 _input = _input.enter().append("input").attr("type", "text").attr("id", field.domId).call(utilNoAuto).call(initCombo, _container).merge(_input);
55880 _inputWrap.call(_lengthIndicator);
55881 } else if (!_isMulti) {
55882 _container.call(_lengthIndicator);
55885 var extent = combinedEntityExtent();
55886 var countryCode = extent && iso1A2Code(extent.center());
55887 _countryCode = countryCode && countryCode.toLowerCase();
55889 _input.on("change", change).on("blur", change).on("input", function() {
55890 let val = utilGetSetValue(_input);
55892 if (_isSemi && _tags[field.key]) {
55893 val += ";" + _tags[field.key];
55895 _lengthIndicator.update(val);
55897 _input.on("keydown.field", function(d3_event) {
55898 switch (d3_event.keyCode) {
55900 _input.node().blur();
55901 d3_event.stopPropagation();
55905 if (_isMulti || _isSemi) {
55906 _combobox.on("accept", function() {
55907 _input.node().blur();
55908 _input.node().focus();
55910 _input.on("focus", function() {
55911 _container.classed("active", true);
55914 _combobox.on("cancel", function() {
55915 _input.node().blur();
55916 }).on("update", function() {
55917 updateIcon(utilGetSetValue(_input));
55920 function updateIcon(value) {
55921 value = tagValue(value);
55922 let container = _container;
55923 if (field.type === "multiCombo" || field.type === "semiCombo") {
55924 container = _container.select(".input-wrap");
55926 const iconsField = field.resolveReference("iconsCrossReference");
55927 if (iconsField.icons) {
55928 container.selectAll(".tag-value-icon").remove();
55929 if (iconsField.icons[value]) {
55930 container.selectAll(".tag-value-icon").data([value]).enter().insert("div", "input").attr("class", "tag-value-icon").call(svgIcon("#".concat(iconsField.icons[value])));
55934 combo.tags = function(tags) {
55936 var stringsField = field.resolveReference("stringsCrossReference");
55937 var isMixed = Array.isArray(tags[field.key]);
55938 var showsValue = (value) => !isMixed && value && !(field.type === "typeCombo" && value === "yes");
55939 var isRawValue = (value) => showsValue(value) && !stringsField.hasTextForStringId("options.".concat(value)) && !stringsField.hasTextForStringId("options.".concat(value, ".title"));
55940 var isKnownValue = (value) => showsValue(value) && !isRawValue(value);
55941 var isReadOnly = !_allowCustomValues;
55942 if (_isMulti || _isSemi) {
55946 for (var k2 in tags) {
55947 if (field.key && k2.indexOf(field.key) !== 0) continue;
55948 if (!field.key && field.keys.indexOf(k2) === -1) continue;
55950 var suffix = field.key ? k2.slice(field.key.length) : k2;
55953 value: displayValue(suffix),
55954 display: addComboboxIcons(renderValue(suffix), suffix),
55955 state: typeof v2 === "string" ? v2.toLowerCase() : "",
55956 isMixed: Array.isArray(v2)
55960 field.keys = _multiData.map(function(d2) {
55963 maxLength = context.maxCharsForTagKey() - utilUnicodeCharsCount(field.key);
55965 maxLength = context.maxCharsForTagKey();
55967 } else if (_isSemi) {
55968 var allValues = [];
55970 if (Array.isArray(tags[field.key])) {
55971 tags[field.key].forEach(function(tagVal) {
55972 var thisVals = utilArrayUniq((tagVal || "").split(";")).filter(Boolean);
55973 allValues = allValues.concat(thisVals);
55974 if (!commonValues) {
55975 commonValues = thisVals;
55977 commonValues = commonValues.filter((value) => thisVals.includes(value));
55980 allValues = utilArrayUniq(allValues).filter(Boolean);
55982 allValues = utilArrayUniq((tags[field.key] || "").split(";")).filter(Boolean);
55983 commonValues = allValues;
55985 _multiData = allValues.map(function(v3) {
55988 value: displayValue(v3),
55989 display: addComboboxIcons(renderValue(v3), v3),
55990 isMixed: !commonValues.includes(v3)
55993 var currLength = utilUnicodeCharsCount(commonValues.join(";"));
55994 maxLength = context.maxCharsForTagValue() - currLength;
55995 if (currLength > 0) {
55999 maxLength = Math.max(0, maxLength);
56000 var hideAdd = maxLength <= 0 || !_allowCustomValues && !_comboData.length;
56001 _container.selectAll(".chiplist .input-wrap").style("display", hideAdd ? "none" : null);
56002 var allowDragAndDrop = _isSemi && !Array.isArray(tags[field.key]);
56003 var chips = _container.selectAll(".chip").data(_multiData);
56004 chips.exit().remove();
56005 var enter = chips.enter().insert("li", ".input-wrap").attr("class", "chip");
56006 enter.append("span");
56007 const field_buttons = enter.append("div").attr("class", "field_buttons");
56008 field_buttons.append("a").attr("class", "remove");
56009 chips = chips.merge(enter).order().classed("raw-value", function(d2) {
56011 if (_isMulti) k3 = k3.replace(field.key, "");
56012 return !stringsField.hasTextForStringId("options." + k3);
56013 }).classed("draggable", allowDragAndDrop).classed("mixed", function(d2) {
56015 }).attr("title", function(d2) {
56017 return _t("inspector.unshared_value_tooltip");
56019 if (!["yes", "no"].includes(d2.state)) {
56023 }).classed("negated", (d2) => d2.state === "no");
56025 chips.selectAll("input[type=checkbox]").remove();
56026 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);
56028 if (allowDragAndDrop) {
56029 registerDragAndDrop(chips);
56031 chips.each(function(d2) {
56032 const selection2 = select_default2(this);
56033 const text_span = selection2.select("span");
56034 const field_buttons2 = selection2.select(".field_buttons");
56035 const clean_value = d2.value.trim();
56036 text_span.text("");
56037 if (!field_buttons2.select("button").empty()) {
56038 field_buttons2.select("button").remove();
56040 if (clean_value.startsWith("https://")) {
56041 text_span.text(clean_value);
56042 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) {
56043 d3_event.preventDefault();
56044 window.open(clean_value, "_blank");
56049 d2.display(text_span);
56052 text_span.text(d2.value);
56054 chips.select("a.remove").attr("href", "#").on("click", removeMultikey).attr("class", "remove").text("\xD7");
56057 var mixedValues = isMixed && tags[field.key].map(function(val) {
56058 return displayValue(val);
56059 }).filter(Boolean);
56060 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) {
56061 if (isReadOnly && isKnownValue(tags[field.key]) && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
56062 d3_event.preventDefault();
56063 d3_event.stopPropagation();
56065 t2[field.key] = void 0;
56066 dispatch14.call("change", this, t2);
56069 if (!Array.isArray(tags[field.key])) {
56070 updateIcon(tags[field.key]);
56073 _lengthIndicator.update(tags[field.key]);
56076 const refreshStyles = () => {
56077 _input.data([tagValue(utilGetSetValue(_input))]).classed("raw-value", isRawValue).classed("known-value", isKnownValue);
56079 _input.on("input.refreshStyles", refreshStyles);
56080 _combobox.on("update.refreshStyles", refreshStyles);
56083 function registerDragAndDrop(selection2) {
56084 var dragOrigin, targetIndex;
56086 drag_default().on("start", function(d3_event) {
56091 targetIndex = null;
56092 }).on("drag", function(d3_event) {
56093 var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
56094 if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
56095 Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
56096 var index = selection2.nodes().indexOf(this);
56097 select_default2(this).classed("dragging", true);
56098 targetIndex = null;
56099 var targetIndexOffsetTop = null;
56100 var draggedTagWidth = select_default2(this).node().offsetWidth;
56101 if (field.key === "destination" || field.key === "via") {
56102 _container.selectAll(".chip").style("transform", function(d2, index2) {
56103 var node = select_default2(this).node();
56104 if (index === index2) {
56105 return "translate(" + x2 + "px, " + y2 + "px)";
56106 } else if (index2 > index && d3_event.y > node.offsetTop) {
56107 if (targetIndex === null || index2 > targetIndex) {
56108 targetIndex = index2;
56110 return "translateY(-100%)";
56111 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
56112 if (targetIndex === null || index2 < targetIndex) {
56113 targetIndex = index2;
56115 return "translateY(100%)";
56120 _container.selectAll(".chip").each(function(d2, index2) {
56121 var node = select_default2(this).node();
56122 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) {
56123 targetIndex = index2;
56124 targetIndexOffsetTop = node.offsetTop;
56126 }).style("transform", function(d2, index2) {
56127 var node = select_default2(this).node();
56128 if (index === index2) {
56129 return "translate(" + x2 + "px, " + y2 + "px)";
56131 if (node.offsetTop === targetIndexOffsetTop) {
56132 if (index2 < index && index2 >= targetIndex) {
56133 return "translateX(" + draggedTagWidth + "px)";
56134 } else if (index2 > index && index2 <= targetIndex) {
56135 return "translateX(-" + draggedTagWidth + "px)";
56141 }).on("end", function() {
56142 if (!select_default2(this).classed("dragging")) {
56145 var index = selection2.nodes().indexOf(this);
56146 select_default2(this).classed("dragging", false);
56147 _container.selectAll(".chip").style("transform", null);
56148 if (typeof targetIndex === "number") {
56149 var element = _multiData[index];
56150 _multiData.splice(index, 1);
56151 _multiData.splice(targetIndex, 0, element);
56153 if (_multiData.length) {
56154 t2[field.key] = _multiData.map(function(element2) {
56155 return element2.key;
56158 t2[field.key] = void 0;
56160 dispatch14.call("change", this, t2);
56162 dragOrigin = void 0;
56163 targetIndex = void 0;
56167 combo.focus = function() {
56168 _input.node().focus();
56170 combo.entityIDs = function(val) {
56171 if (!arguments.length) return _entityIDs;
56175 function combinedEntityExtent() {
56176 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
56178 return utilRebind(combo, dispatch14, "on");
56181 // modules/ui/account.js
56182 function uiAccount(context) {
56183 const osm = context.connection();
56184 function updateUserDetails(selection2) {
56186 if (!osm.authenticated()) {
56187 render(selection2, null);
56189 osm.userDetails((err, user) => render(selection2, user));
56192 function render(selection2, user) {
56193 let userInfo = selection2.select(".userInfo");
56194 let loginLogout = selection2.select(".loginLogout");
56196 userInfo.html("").classed("hide", false);
56197 let userLink = userInfo.append("a").attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
56198 if (user.image_url) {
56199 userLink.append("img").attr("class", "icon pre-text user-icon").attr("src", user.image_url);
56201 userLink.call(svgIcon("#iD-icon-avatar", "pre-text light"));
56203 userLink.append("span").attr("class", "label").text(user.display_name);
56204 loginLogout.classed("hide", false).select("a").text(_t("logout")).on("click", (e3) => {
56205 e3.preventDefault();
56210 userInfo.html("").classed("hide", true);
56211 loginLogout.classed("hide", false).select("a").text(_t("login")).on("click", (e3) => {
56212 e3.preventDefault();
56213 osm.authenticate();
56217 function tryLogout() {
56219 const url = osm.getUrlRoot() + "/logout?referer=%2Flogin";
56225 ["left", window.screen.width / 2 - w2 / 2],
56226 ["top", window.screen.height / 2 - h2 / 2]
56227 ].map((x2) => x2.join("=")).join(",");
56228 window.open(url, "_blank", settings);
56230 return function(selection2) {
56232 selection2.append("li").attr("class", "userInfo").classed("hide", true);
56233 selection2.append("li").attr("class", "loginLogout").classed("hide", true).append("a").attr("href", "#");
56234 osm.on("change.account", () => updateUserDetails(selection2));
56235 updateUserDetails(selection2);
56239 // modules/ui/attribution.js
56240 function uiAttribution(context) {
56241 let _selection = select_default2(null);
56242 function render(selection2, data, klass) {
56243 let div = selection2.selectAll(".".concat(klass)).data([0]);
56244 div = div.enter().append("div").attr("class", klass).merge(div);
56245 let attributions = div.selectAll(".attribution").data(data, (d2) => d2.id);
56246 attributions.exit().remove();
56247 attributions = attributions.enter().append("span").attr("class", "attribution").each((d2, i3, nodes) => {
56248 let attribution = select_default2(nodes[i3]);
56249 if (d2.terms_html) {
56250 attribution.html(d2.terms_html);
56253 if (d2.terms_url) {
56254 attribution = attribution.append("a").attr("href", d2.terms_url).attr("target", "_blank");
56256 const sourceID = d2.id.replace(/\./g, "<TX_DOT>");
56257 const terms_text = _t(
56258 "imagery.".concat(sourceID, ".attribution.text"),
56259 { default: d2.terms_text || d2.id || d2.name() }
56261 if (d2.icon && !d2.overlay) {
56262 attribution.append("img").attr("class", "source-image").attr("src", d2.icon);
56264 attribution.append("span").attr("class", "attribution-text").text(terms_text);
56265 }).merge(attributions);
56266 let copyright = attributions.selectAll(".copyright-notice").data((d2) => {
56267 let notice = d2.copyrightNotices(context.map().zoom(), context.map().extent());
56268 return notice ? [notice] : [];
56270 copyright.exit().remove();
56271 copyright = copyright.enter().append("span").attr("class", "copyright-notice").merge(copyright);
56272 copyright.text(String);
56274 function update() {
56275 let baselayer = context.background().baseLayerSource();
56276 _selection.call(render, baselayer ? [baselayer] : [], "base-layer-attribution");
56277 const z2 = context.map().zoom();
56278 let overlays = context.background().overlayLayerSources() || [];
56279 _selection.call(render, overlays.filter((s2) => s2.validZoom(z2)), "overlay-layer-attribution");
56281 return function(selection2) {
56282 _selection = selection2;
56283 context.background().on("change.attribution", update);
56284 context.map().on("move.attribution", throttle_default(update, 400, { leading: false }));
56289 // modules/ui/contributors.js
56290 function uiContributors(context) {
56291 var osm = context.connection(), debouncedUpdate = debounce_default(function() {
56293 }, 1e3), limit = 4, hidden = false, wrap2 = select_default2(null);
56294 function update() {
56296 var users = {}, entities = context.history().intersects(context.map().extent());
56297 entities.forEach(function(entity) {
56298 if (entity && entity.user) users[entity.user] = true;
56300 var u2 = Object.keys(users), subset = u2.slice(0, u2.length > limit ? limit - 1 : limit);
56301 wrap2.html("").call(svgIcon("#iD-icon-nearby", "pre-text light"));
56302 var userList = select_default2(document.createElement("span"));
56303 userList.selectAll().data(subset).enter().append("a").attr("class", "user-link").attr("href", function(d2) {
56304 return osm.userURL(d2);
56305 }).attr("target", "_blank").text(String);
56306 if (u2.length > limit) {
56307 var count = select_default2(document.createElement("span"));
56308 var othersNum = u2.length - limit + 1;
56309 count.append("a").attr("target", "_blank").attr("href", function() {
56310 return osm.changesetsURL(context.map().center(), context.map().zoom());
56311 }).text(othersNum);
56312 wrap2.append("span").html(_t.html("contributors.truncated_list", { n: othersNum, users: { html: userList.html() }, count: { html: count.html() } }));
56314 wrap2.append("span").html(_t.html("contributors.list", { users: { html: userList.html() } }));
56318 wrap2.transition().style("opacity", 0);
56319 } else if (hidden) {
56320 wrap2.transition().style("opacity", 1);
56323 return function(selection2) {
56325 wrap2 = selection2;
56327 osm.on("loaded.contributors", debouncedUpdate);
56328 context.map().on("move.contributors", debouncedUpdate);
56332 // modules/ui/edit_menu.js
56333 function uiEditMenu(context) {
56334 var dispatch14 = dispatch_default("toggled");
56335 var _menu = select_default2(null);
56336 var _operations = [];
56337 var _anchorLoc = [0, 0];
56338 var _anchorLocLonLat = [0, 0];
56339 var _triggerType = "";
56340 var _vpTopMargin = 85;
56341 var _vpBottomMargin = 45;
56342 var _vpSideMargin = 35;
56343 var _menuTop = false;
56346 var _verticalPadding = 4;
56347 var _tooltipWidth = 210;
56348 var _menuSideMargin = 10;
56349 var _tooltips = [];
56350 var editMenu = function(selection2) {
56351 var isTouchMenu = _triggerType.includes("touch") || _triggerType.includes("pen");
56352 var ops = _operations.filter(function(op) {
56353 return !isTouchMenu || !op.mouseOnly;
56355 if (!ops.length) return;
56357 _menuTop = isTouchMenu;
56358 var showLabels = isTouchMenu;
56359 var buttonHeight = showLabels ? 32 : 34;
56361 _menuWidth = 52 + Math.min(120, 6 * Math.max.apply(Math, ops.map(function(op) {
56362 return op.title.length;
56367 _menuHeight = _verticalPadding * 2 + ops.length * buttonHeight;
56368 _menu = selection2.append("div").attr("class", "edit-menu").classed("touch-menu", isTouchMenu).style("padding", _verticalPadding + "px 0");
56369 var buttons = _menu.selectAll(".edit-menu-item").data(ops);
56370 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
56371 return "edit-menu-item edit-menu-item-" + d2.id;
56372 }).style("height", buttonHeight + "px").on("click", click).on("pointerup", pointerup).on("pointerdown mousedown", function pointerdown(d3_event) {
56373 d3_event.stopPropagation();
56374 }).on("mouseenter.highlight", function(d3_event, d2) {
56375 if (!d2.relatedEntityIds || select_default2(this).classed("disabled")) return;
56376 utilHighlightEntities(d2.relatedEntityIds(), true, context);
56377 }).on("mouseleave.highlight", function(d3_event, d2) {
56378 if (!d2.relatedEntityIds) return;
56379 utilHighlightEntities(d2.relatedEntityIds(), false, context);
56381 buttonsEnter.each(function(d2) {
56382 var tooltip = uiTooltip().heading(() => d2.title).title(d2.tooltip).keys([d2.keys[0]]);
56383 _tooltips.push(tooltip);
56384 select_default2(this).call(tooltip).append("div").attr("class", "icon-wrap").call(svgIcon(d2.icon && d2.icon() || "#iD-operation-" + d2.id, "operation"));
56387 buttonsEnter.append("span").attr("class", "label").each(function(d2) {
56388 select_default2(this).call(d2.title);
56391 buttonsEnter.merge(buttons).classed("disabled", function(d2) {
56392 return d2.disabled();
56395 var initialScale = context.projection.scale();
56396 context.map().on("move.edit-menu", function() {
56397 if (initialScale !== context.projection.scale()) {
56400 }).on("drawn.edit-menu", function(info) {
56401 if (info.full) updatePosition();
56403 var lastPointerUpType;
56404 function pointerup(d3_event) {
56405 lastPointerUpType = d3_event.pointerType;
56407 function click(d3_event, operation2) {
56408 d3_event.stopPropagation();
56409 if (operation2.relatedEntityIds) {
56410 utilHighlightEntities(operation2.relatedEntityIds(), false, context);
56412 if (operation2.disabled()) {
56413 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56414 context.ui().flash.duration(4e3).iconName("#iD-operation-" + operation2.id).iconClass("operation disabled").label(operation2.tooltip())();
56417 if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
56418 context.ui().flash.duration(2e3).iconName("#iD-operation-" + operation2.id).iconClass("operation").label(operation2.annotation() || operation2.title)();
56423 lastPointerUpType = null;
56425 dispatch14.call("toggled", this, true);
56427 function updatePosition() {
56428 if (!_menu || _menu.empty()) return;
56429 var anchorLoc = context.projection(_anchorLocLonLat);
56430 var viewport = context.surfaceRect();
56431 if (anchorLoc[0] < 0 || anchorLoc[0] > viewport.width || anchorLoc[1] < 0 || anchorLoc[1] > viewport.height) {
56435 var menuLeft = displayOnLeft(viewport);
56436 var offset = [0, 0];
56437 offset[0] = menuLeft ? -1 * (_menuSideMargin + _menuWidth) : _menuSideMargin;
56439 if (anchorLoc[1] - _menuHeight < _vpTopMargin) {
56440 offset[1] = -anchorLoc[1] + _vpTopMargin;
56442 offset[1] = -_menuHeight;
56445 if (anchorLoc[1] + _menuHeight > viewport.height - _vpBottomMargin) {
56446 offset[1] = -anchorLoc[1] - _menuHeight + viewport.height - _vpBottomMargin;
56451 var origin = geoVecAdd(anchorLoc, offset);
56452 _menu.style("left", origin[0] + "px").style("top", origin[1] + "px");
56453 var tooltipSide = tooltipPosition(viewport, menuLeft);
56454 _tooltips.forEach(function(tooltip) {
56455 tooltip.placement(tooltipSide);
56457 function displayOnLeft(viewport2) {
56458 if (_mainLocalizer.textDirection() === "ltr") {
56459 if (anchorLoc[0] + _menuSideMargin + _menuWidth > viewport2.width - _vpSideMargin) {
56464 if (anchorLoc[0] - _menuSideMargin - _menuWidth < _vpSideMargin) {
56470 function tooltipPosition(viewport2, menuLeft2) {
56471 if (_mainLocalizer.textDirection() === "ltr") {
56475 if (anchorLoc[0] + _menuSideMargin + _menuWidth + _tooltipWidth > viewport2.width - _vpSideMargin) {
56483 if (anchorLoc[0] - _menuSideMargin - _menuWidth - _tooltipWidth < _vpSideMargin) {
56490 editMenu.close = function() {
56491 context.map().on("move.edit-menu", null).on("drawn.edit-menu", null);
56494 dispatch14.call("toggled", this, false);
56496 editMenu.anchorLoc = function(val) {
56497 if (!arguments.length) return _anchorLoc;
56499 _anchorLocLonLat = context.projection.invert(_anchorLoc);
56502 editMenu.triggerType = function(val) {
56503 if (!arguments.length) return _triggerType;
56504 _triggerType = val;
56507 editMenu.operations = function(val) {
56508 if (!arguments.length) return _operations;
56512 return utilRebind(editMenu, dispatch14, "on");
56515 // modules/ui/feature_info.js
56516 function uiFeatureInfo(context) {
56517 function update(selection2) {
56518 var features = context.features();
56519 var stats = features.stats();
56521 var hiddenList = features.hidden().map(function(k2) {
56523 count += stats[k2];
56524 return _t.append("inspector.title_count", {
56525 title: _t("feature." + k2 + ".description"),
56530 }).filter(Boolean);
56531 selection2.text("");
56532 if (hiddenList.length) {
56533 var tooltipBehavior = uiTooltip().placement("top").title(function() {
56534 return (selection3) => {
56535 hiddenList.forEach((hiddenFeature) => {
56536 selection3.append("div").call(hiddenFeature);
56540 selection2.append("a").attr("class", "chip").attr("href", "#").call(_t.append("feature_info.hidden_warning", { count })).call(tooltipBehavior).on("click", function(d3_event) {
56541 tooltipBehavior.hide();
56542 d3_event.preventDefault();
56543 context.ui().togglePanes(context.container().select(".map-panes .map-data-pane"));
56546 selection2.classed("hide", !hiddenList.length);
56548 return function(selection2) {
56549 update(selection2);
56550 context.features().on("change.feature_info", function() {
56551 update(selection2);
56556 // modules/ui/flash.js
56557 function uiFlash(context) {
56559 var _duration = 2e3;
56560 var _iconName = "#iD-icon-no";
56561 var _iconClass = "disabled";
56562 var _label = (s2) => s2.text("");
56565 _flashTimer.stop();
56567 context.container().select(".main-footer-wrap").classed("footer-hide", true).classed("footer-show", false);
56568 context.container().select(".flash-wrap").classed("footer-hide", false).classed("footer-show", true);
56569 var content = context.container().select(".flash-wrap").selectAll(".flash-content").data([0]);
56570 var contentEnter = content.enter().append("div").attr("class", "flash-content");
56571 var iconEnter = contentEnter.append("svg").attr("class", "flash-icon icon").append("g").attr("transform", "translate(10,10)");
56572 iconEnter.append("circle").attr("r", 9);
56573 iconEnter.append("use").attr("transform", "translate(-7,-7)").attr("width", "14").attr("height", "14");
56574 contentEnter.append("div").attr("class", "flash-text");
56575 content = content.merge(contentEnter);
56576 content.selectAll(".flash-icon").attr("class", "icon flash-icon " + (_iconClass || ""));
56577 content.selectAll(".flash-icon use").attr("xlink:href", _iconName);
56578 content.selectAll(".flash-text").attr("class", "flash-text").call(_label);
56579 _flashTimer = timeout_default(function() {
56580 _flashTimer = null;
56581 context.container().select(".main-footer-wrap").classed("footer-hide", false).classed("footer-show", true);
56582 context.container().select(".flash-wrap").classed("footer-hide", true).classed("footer-show", false);
56586 flash.duration = function(_2) {
56587 if (!arguments.length) return _duration;
56591 flash.label = function(_2) {
56592 if (!arguments.length) return _label;
56593 if (typeof _2 !== "function") {
56594 _label = (selection2) => selection2.text(_2);
56596 _label = (selection2) => selection2.text("").call(_2);
56600 flash.iconName = function(_2) {
56601 if (!arguments.length) return _iconName;
56605 flash.iconClass = function(_2) {
56606 if (!arguments.length) return _iconClass;
56613 // modules/ui/full_screen.js
56614 function uiFullScreen(context) {
56615 var element = context.container().node();
56616 function getFullScreenFn() {
56617 if (element.requestFullscreen) {
56618 return element.requestFullscreen;
56619 } else if (element.msRequestFullscreen) {
56620 return element.msRequestFullscreen;
56621 } else if (element.mozRequestFullScreen) {
56622 return element.mozRequestFullScreen;
56623 } else if (element.webkitRequestFullscreen) {
56624 return element.webkitRequestFullscreen;
56627 function getExitFullScreenFn() {
56628 if (document.exitFullscreen) {
56629 return document.exitFullscreen;
56630 } else if (document.msExitFullscreen) {
56631 return document.msExitFullscreen;
56632 } else if (document.mozCancelFullScreen) {
56633 return document.mozCancelFullScreen;
56634 } else if (document.webkitExitFullscreen) {
56635 return document.webkitExitFullscreen;
56638 function isFullScreen() {
56639 return document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
56641 function isSupported() {
56642 return !!getFullScreenFn();
56644 function fullScreen(d3_event) {
56645 d3_event.preventDefault();
56646 if (!isFullScreen()) {
56647 getFullScreenFn().apply(element);
56649 getExitFullScreenFn().apply(document);
56652 return function() {
56653 if (!isSupported()) return;
56654 var detected = utilDetect();
56655 var keys2 = detected.os === "mac" ? [uiCmd("\u2303\u2318F"), "f11"] : ["f11"];
56656 context.keybinding().on(keys2, fullScreen);
56660 // modules/ui/geolocate.js
56661 function uiGeolocate(context) {
56662 var _geolocationOptions = {
56663 // prioritize speed and power usage over precision
56664 enableHighAccuracy: false,
56665 // don't hang indefinitely getting the location
56669 var _locating = uiLoading(context).message(_t.html("geolocate.locating")).blocking(true);
56670 var _layer = context.layers().layer("geolocate");
56674 var _button = select_default2(null);
56676 if (context.inIntro()) return;
56677 if (!_layer.enabled() && !_locating.isShown()) {
56678 _timeoutID = setTimeout(
56683 context.container().call(_locating);
56684 navigator.geolocation.getCurrentPosition(success, error, _geolocationOptions);
56687 _layer.enabled(null, false);
56688 updateButtonState();
56691 function zoomTo() {
56692 context.enter(modeBrowse(context));
56693 var map2 = context.map();
56694 _layer.enabled(_position, true);
56695 updateButtonState();
56696 map2.centerZoomEase(_extent.center(), Math.min(20, map2.extentZoom(_extent)));
56698 function success(geolocation) {
56699 _position = geolocation;
56700 var coords = _position.coords;
56701 _extent = geoExtent([coords.longitude, coords.latitude]).padByMeters(coords.accuracy);
56709 context.ui().flash.label(_t.append("geolocate.location_unavailable")).iconName("#iD-icon-geolocate")();
56713 function finish() {
56716 clearTimeout(_timeoutID);
56718 _timeoutID = void 0;
56720 function updateButtonState() {
56721 _button.classed("active", _layer.enabled());
56722 _button.attr("aria-pressed", _layer.enabled());
56724 return function(selection2) {
56725 if (!navigator.geolocation || !navigator.geolocation.getCurrentPosition) return;
56726 _button = selection2.append("button").on("click", click).attr("aria-pressed", false).call(svgIcon("#iD-icon-geolocate", "light")).call(
56727 uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _t.append("geolocate.title")).keys([_t("geolocate.key")])
56729 context.keybinding().on(_t("geolocate.key"), click);
56733 // modules/ui/panels/background.js
56734 function uiPanelBackground(context) {
56735 var background = context.background();
56736 var _currSourceName = null;
56737 var _metadata = {};
56738 var _metadataKeys = [
56746 var debouncedRedraw = debounce_default(redraw, 250);
56747 function redraw(selection2) {
56748 var source = background.baseLayerSource();
56749 if (!source) return;
56750 var isDG = source.id.match(/^DigitalGlobe/i) !== null;
56751 var sourceLabel = source.label();
56752 if (_currSourceName !== sourceLabel) {
56753 _currSourceName = sourceLabel;
56756 selection2.text("");
56757 var list2 = selection2.append("ul").attr("class", "background-info");
56758 list2.append("li").call(_currSourceName);
56759 _metadataKeys.forEach(function(k2) {
56760 if (isDG && k2 === "vintage") return;
56761 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]);
56763 debouncedGetMetadata(selection2);
56764 var toggleTiles = context.getDebug("tile") ? "hide_tiles" : "show_tiles";
56765 selection2.append("a").call(_t.append("info_panels.background." + toggleTiles)).attr("href", "#").attr("class", "button button-toggle-tiles").on("click", function(d3_event) {
56766 d3_event.preventDefault();
56767 context.setDebug("tile", !context.getDebug("tile"));
56768 selection2.call(redraw);
56771 var key = source.id + "-vintage";
56772 var sourceVintage = context.background().findSource(key);
56773 var showsVintage = context.background().showsLayer(sourceVintage);
56774 var toggleVintage = showsVintage ? "hide_vintage" : "show_vintage";
56775 selection2.append("a").call(_t.append("info_panels.background." + toggleVintage)).attr("href", "#").attr("class", "button button-toggle-vintage").on("click", function(d3_event) {
56776 d3_event.preventDefault();
56777 context.background().toggleOverlayLayer(sourceVintage);
56778 selection2.call(redraw);
56781 ["DigitalGlobe-Premium", "DigitalGlobe-Standard"].forEach(function(layerId) {
56782 if (source.id !== layerId) {
56783 var key2 = layerId + "-vintage";
56784 var sourceVintage2 = context.background().findSource(key2);
56785 if (context.background().showsLayer(sourceVintage2)) {
56786 context.background().toggleOverlayLayer(sourceVintage2);
56791 var debouncedGetMetadata = debounce_default(getMetadata, 250);
56792 function getMetadata(selection2) {
56793 var tile = context.container().select(".layer-background img.tile-center");
56794 if (tile.empty()) return;
56795 var sourceName = _currSourceName;
56796 var d2 = tile.datum();
56797 var zoom = d2 && d2.length >= 3 && d2[2] || Math.floor(context.map().zoom());
56798 var center = context.map().center();
56799 _metadata.zoom = String(zoom);
56800 selection2.selectAll(".background-info-list-zoom").classed("hide", false).selectAll(".background-info-span-zoom").text(_metadata.zoom);
56801 if (!d2 || !d2.length >= 3) return;
56802 background.baseLayerSource().getMetadata(center, d2, function(err, result) {
56803 if (err || _currSourceName !== sourceName) return;
56804 var vintage = result.vintage;
56805 _metadata.vintage = vintage && vintage.range || _t("info_panels.background.unknown");
56806 selection2.selectAll(".background-info-list-vintage").classed("hide", false).selectAll(".background-info-span-vintage").text(_metadata.vintage);
56807 _metadataKeys.forEach(function(k2) {
56808 if (k2 === "zoom" || k2 === "vintage") return;
56809 var val = result[k2];
56810 _metadata[k2] = val;
56811 selection2.selectAll(".background-info-list-" + k2).classed("hide", !val).selectAll(".background-info-span-" + k2).text(val);
56815 var panel = function(selection2) {
56816 selection2.call(redraw);
56817 context.map().on("drawn.info-background", function() {
56818 selection2.call(debouncedRedraw);
56819 }).on("move.info-background", function() {
56820 selection2.call(debouncedGetMetadata);
56823 panel.off = function() {
56824 context.map().on("drawn.info-background", null).on("move.info-background", null);
56826 panel.id = "background";
56827 panel.label = _t.append("info_panels.background.title");
56828 panel.key = _t("info_panels.background.key");
56832 // modules/ui/panels/history.js
56833 function uiPanelHistory(context) {
56835 function displayTimestamp(timestamp) {
56836 if (!timestamp) return _t("info_panels.history.unknown");
56845 var d2 = new Date(timestamp);
56846 if (isNaN(d2.getTime())) return _t("info_panels.history.unknown");
56847 return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
56849 function displayUser(selection2, userName) {
56851 selection2.append("span").call(_t.append("info_panels.history.unknown"));
56854 selection2.append("span").attr("class", "user-name").text(userName);
56855 var links = selection2.append("div").attr("class", "links");
56857 links.append("a").attr("class", "user-osm-link").attr("href", osm.userURL(userName)).attr("target", "_blank").call(_t.append("info_panels.history.profile_link"));
56859 links.append("a").attr("class", "user-hdyc-link").attr("href", "https://hdyc.neis-one.org/?" + userName).attr("target", "_blank").attr("tabindex", -1).text("HDYC");
56861 function displayChangeset(selection2, changeset) {
56863 selection2.append("span").call(_t.append("info_panels.history.unknown"));
56866 selection2.append("span").attr("class", "changeset-id").text(changeset);
56867 var links = selection2.append("div").attr("class", "links");
56869 links.append("a").attr("class", "changeset-osm-link").attr("href", osm.changesetURL(changeset)).attr("target", "_blank").call(_t.append("info_panels.history.changeset_link"));
56871 links.append("a").attr("class", "changeset-osmcha-link").attr("href", "https://osmcha.org/changesets/" + changeset).attr("target", "_blank").text("OSMCha");
56872 links.append("a").attr("class", "changeset-achavi-link").attr("href", "https://overpass-api.de/achavi/?changeset=" + changeset).attr("target", "_blank").text("Achavi");
56874 function redraw(selection2) {
56875 var selectedNoteID = context.selectedNoteID();
56876 osm = context.connection();
56877 var selected, note, entity;
56878 if (selectedNoteID && osm) {
56879 selected = [_t.html("note.note") + " " + selectedNoteID];
56880 note = osm.getNote(selectedNoteID);
56882 selected = context.selectedIDs().filter(function(e3) {
56883 return context.hasEntity(e3);
56885 if (selected.length) {
56886 entity = context.entity(selected[0]);
56889 var singular = selected.length === 1 ? selected[0] : null;
56890 selection2.html("");
56892 selection2.append("h4").attr("class", "history-heading").html(singular);
56894 selection2.append("h4").attr("class", "history-heading").call(_t.append("info_panels.selected", { n: selected.length }));
56896 if (!singular) return;
56898 selection2.call(redrawEntity, entity);
56900 selection2.call(redrawNote, note);
56903 function redrawNote(selection2, note) {
56904 if (!note || note.isNew()) {
56905 selection2.append("div").call(_t.append("info_panels.history.note_no_history"));
56908 var list2 = selection2.append("ul");
56909 list2.append("li").call(_t.append("info_panels.history.note_comments", { suffix: ":" })).append("span").text(note.comments.length);
56910 if (note.comments.length) {
56911 list2.append("li").call(_t.append("info_panels.history.note_created_date", { suffix: ":" })).append("span").text(displayTimestamp(note.comments[0].date));
56912 list2.append("li").call(_t.append("info_panels.history.note_created_user", { suffix: ":" })).call(displayUser, note.comments[0].user);
56915 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"));
56918 function redrawEntity(selection2, entity) {
56919 if (!entity || entity.isNew()) {
56920 selection2.append("div").call(_t.append("info_panels.history.no_history"));
56923 var links = selection2.append("div").attr("class", "links");
56925 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"));
56927 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");
56928 var list2 = selection2.append("ul");
56929 list2.append("li").call(_t.append("info_panels.history.version", { suffix: ":" })).append("span").text(entity.version);
56930 list2.append("li").call(_t.append("info_panels.history.last_edit", { suffix: ":" })).append("span").text(displayTimestamp(entity.timestamp));
56931 list2.append("li").call(_t.append("info_panels.history.edited_by", { suffix: ":" })).call(displayUser, entity.user);
56932 list2.append("li").call(_t.append("info_panels.history.changeset", { suffix: ":" })).call(displayChangeset, entity.changeset);
56934 var panel = function(selection2) {
56935 selection2.call(redraw);
56936 context.map().on("drawn.info-history", function() {
56937 selection2.call(redraw);
56939 context.on("enter.info-history", function() {
56940 selection2.call(redraw);
56943 panel.off = function() {
56944 context.map().on("drawn.info-history", null);
56945 context.on("enter.info-history", null);
56947 panel.id = "history";
56948 panel.label = _t.append("info_panels.history.title");
56949 panel.key = _t("info_panels.history.key");
56953 // modules/ui/panels/location.js
56954 function uiPanelLocation(context) {
56955 var currLocation = "";
56956 function redraw(selection2) {
56957 selection2.html("");
56958 var list2 = selection2.append("ul");
56959 var coord2 = context.map().mouseCoordinates();
56960 if (coord2.some(isNaN)) {
56961 coord2 = context.map().center();
56963 list2.append("li").text(dmsCoordinatePair(coord2)).append("li").text(decimalCoordinatePair(coord2));
56964 selection2.append("div").attr("class", "location-info").text(currLocation || " ");
56965 debouncedGetLocation(selection2, coord2);
56967 var debouncedGetLocation = debounce_default(getLocation, 250);
56968 function getLocation(selection2, coord2) {
56969 if (!services.geocoder) {
56970 currLocation = _t("info_panels.location.unknown_location");
56971 selection2.selectAll(".location-info").text(currLocation);
56973 services.geocoder.reverse(coord2, function(err, result) {
56974 currLocation = result ? result.display_name : _t("info_panels.location.unknown_location");
56975 selection2.selectAll(".location-info").text(currLocation);
56979 var panel = function(selection2) {
56980 selection2.call(redraw);
56981 context.surface().on(("PointerEvent" in window ? "pointer" : "mouse") + "move.info-location", function() {
56982 selection2.call(redraw);
56985 panel.off = function() {
56986 context.surface().on(".info-location", null);
56988 panel.id = "location";
56989 panel.label = _t.append("info_panels.location.title");
56990 panel.key = _t("info_panels.location.key");
56994 // modules/ui/panels/measurement.js
56995 function uiPanelMeasurement(context) {
56996 function radiansToMeters(r2) {
56997 return r2 * 63710071809e-4;
56999 function steradiansToSqmeters(r2) {
57000 return r2 / (4 * Math.PI) * 510065621724e3;
57002 function toLineString(feature3) {
57003 if (feature3.type === "LineString") return feature3;
57004 var result = { type: "LineString", coordinates: [] };
57005 if (feature3.type === "Polygon") {
57006 result.coordinates = feature3.coordinates[0];
57007 } else if (feature3.type === "MultiPolygon") {
57008 result.coordinates = feature3.coordinates[0][0];
57012 var _isImperial = !_mainLocalizer.usesMetric();
57013 function redraw(selection2) {
57014 var graph = context.graph();
57015 var selectedNoteID = context.selectedNoteID();
57016 var osm = services.osm;
57017 var localeCode = _mainLocalizer.localeCode();
57019 var center, location, centroid;
57020 var closed, geometry;
57021 var totalNodeCount, length2 = 0, area = 0, distance;
57022 if (selectedNoteID && osm) {
57023 var note = osm.getNote(selectedNoteID);
57024 heading2 = _t.html("note.note") + " " + selectedNoteID;
57025 location = note.loc;
57028 var selectedIDs = context.selectedIDs().filter(function(id2) {
57029 return context.hasEntity(id2);
57031 var selected = selectedIDs.map(function(id2) {
57032 return context.entity(id2);
57034 heading2 = selected.length === 1 ? selected[0].id : _t.html("info_panels.selected", { n: selected.length });
57035 if (selected.length) {
57036 var extent = geoExtent();
57037 for (var i3 in selected) {
57038 var entity = selected[i3];
57039 extent._extend(entity.extent(graph));
57040 geometry = entity.geometry(graph);
57041 if (geometry === "line" || geometry === "area") {
57042 closed = entity.type === "relation" || entity.isClosed() && !entity.isDegenerate();
57043 var feature3 = entity.asGeoJSON(graph);
57044 length2 += radiansToMeters(length_default(toLineString(feature3)));
57045 centroid = path_default(context.projection).centroid(entity.asGeoJSON(graph));
57046 centroid = centroid && context.projection.invert(centroid);
57047 if (!centroid || !isFinite(centroid[0]) || !isFinite(centroid[1])) {
57048 centroid = entity.extent(graph).center();
57051 area += steradiansToSqmeters(entity.area(graph));
57055 if (selected.length > 1) {
57060 if (selected.length === 2 && selected[0].type === "node" && selected[1].type === "node") {
57061 distance = geoSphericalDistance(selected[0].loc, selected[1].loc);
57063 if (selected.length === 1 && selected[0].type === "node") {
57064 location = selected[0].loc;
57066 totalNodeCount = utilGetAllNodes(selectedIDs, context.graph()).length;
57068 if (!location && !centroid) {
57069 center = extent.center();
57073 selection2.html("");
57075 selection2.append("h4").attr("class", "measurement-heading").html(heading2);
57077 var list2 = selection2.append("ul");
57080 list2.append("li").call(_t.append("info_panels.measurement.geometry", { suffix: ":" })).append("span").html(
57081 closed ? _t.html("info_panels.measurement.closed_" + geometry) : _t.html("geometry." + geometry)
57084 if (totalNodeCount) {
57085 list2.append("li").call(_t.append("info_panels.measurement.node_count", { suffix: ":" })).append("span").text(totalNodeCount.toLocaleString(localeCode));
57088 list2.append("li").call(_t.append("info_panels.measurement.area", { suffix: ":" })).append("span").text(displayArea(area, _isImperial));
57091 list2.append("li").call(_t.append("info_panels.measurement." + (closed ? "perimeter" : "length"), { suffix: ":" })).append("span").text(displayLength(length2, _isImperial));
57093 if (typeof distance === "number") {
57094 list2.append("li").call(_t.append("info_panels.measurement.distance", { suffix: ":" })).append("span").text(displayLength(distance, _isImperial));
57097 coordItem = list2.append("li").call(_t.append("info_panels.measurement.location", { suffix: ":" }));
57098 coordItem.append("span").text(dmsCoordinatePair(location));
57099 coordItem.append("span").text(decimalCoordinatePair(location));
57102 coordItem = list2.append("li").call(_t.append("info_panels.measurement.centroid", { suffix: ":" }));
57103 coordItem.append("span").text(dmsCoordinatePair(centroid));
57104 coordItem.append("span").text(decimalCoordinatePair(centroid));
57107 coordItem = list2.append("li").call(_t.append("info_panels.measurement.center", { suffix: ":" }));
57108 coordItem.append("span").text(dmsCoordinatePair(center));
57109 coordItem.append("span").text(decimalCoordinatePair(center));
57111 if (length2 || area || typeof distance === "number") {
57112 var toggle = _isImperial ? "imperial" : "metric";
57113 selection2.append("a").call(_t.append("info_panels.measurement." + toggle)).attr("href", "#").attr("class", "button button-toggle-units").on("click", function(d3_event) {
57114 d3_event.preventDefault();
57115 _isImperial = !_isImperial;
57116 selection2.call(redraw);
57120 var panel = function(selection2) {
57121 selection2.call(redraw);
57122 context.map().on("drawn.info-measurement", function() {
57123 selection2.call(redraw);
57125 context.on("enter.info-measurement", function() {
57126 selection2.call(redraw);
57129 panel.off = function() {
57130 context.map().on("drawn.info-measurement", null);
57131 context.on("enter.info-measurement", null);
57133 panel.id = "measurement";
57134 panel.label = _t.append("info_panels.measurement.title");
57135 panel.key = _t("info_panels.measurement.key");
57139 // modules/ui/panels/index.js
57140 var uiInfoPanels = {
57141 background: uiPanelBackground,
57142 history: uiPanelHistory,
57143 location: uiPanelLocation,
57144 measurement: uiPanelMeasurement
57147 // modules/ui/info.js
57148 function uiInfo(context) {
57149 var ids = Object.keys(uiInfoPanels);
57150 var wasActive = ["measurement"];
57153 ids.forEach(function(k2) {
57155 panels[k2] = uiInfoPanels[k2](context);
57156 active[k2] = false;
57159 function info(selection2) {
57160 function redraw() {
57161 var activeids = ids.filter(function(k2) {
57164 var containers = infoPanels.selectAll(".panel-container").data(activeids, function(k2) {
57167 containers.exit().style("opacity", 1).transition().duration(200).style("opacity", 0).on("end", function(d2) {
57168 select_default2(this).call(panels[d2].off).remove();
57170 var enter = containers.enter().append("div").attr("class", function(d2) {
57171 return "fillD2 panel-container panel-container-" + d2;
57173 enter.style("opacity", 0).transition().duration(200).style("opacity", 1);
57174 var title = enter.append("div").attr("class", "panel-title fillD2");
57175 title.append("h3").each(function(d2) {
57176 return panels[d2].label(select_default2(this));
57178 title.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function(d3_event, d2) {
57179 d3_event.stopImmediatePropagation();
57180 d3_event.preventDefault();
57182 }).call(svgIcon("#iD-icon-close"));
57183 enter.append("div").attr("class", function(d2) {
57184 return "panel-content panel-content-" + d2;
57186 infoPanels.selectAll(".panel-content").each(function(d2) {
57187 select_default2(this).call(panels[d2]);
57190 info.toggle = function(which) {
57191 var activeids = ids.filter(function(k2) {
57195 active[which] = !active[which];
57196 if (activeids.length === 1 && activeids[0] === which) {
57197 wasActive = [which];
57199 context.container().select("." + which + "-panel-toggle-item").classed("active", active[which]).select("input").property("checked", active[which]);
57201 if (activeids.length) {
57202 wasActive = activeids;
57203 activeids.forEach(function(k2) {
57204 active[k2] = false;
57207 wasActive.forEach(function(k2) {
57214 var infoPanels = selection2.selectAll(".info-panels").data([0]);
57215 infoPanels = infoPanels.enter().append("div").attr("class", "info-panels").merge(infoPanels);
57217 context.keybinding().on(uiCmd("\u2318" + _t("info_panels.key")), function(d3_event) {
57218 d3_event.stopImmediatePropagation();
57219 d3_event.preventDefault();
57222 ids.forEach(function(k2) {
57223 var key = _t("info_panels." + k2 + ".key", { default: null });
57225 context.keybinding().on(uiCmd("\u2318\u21E7" + key), function(d3_event) {
57226 d3_event.stopImmediatePropagation();
57227 d3_event.preventDefault();
57235 // modules/ui/toggle.js
57236 function uiToggle(show, callback) {
57237 return function(selection2) {
57238 selection2.style("opacity", show ? 0 : 1).classed("hide", false).transition().style("opacity", show ? 1 : 0).on("end", function() {
57239 select_default2(this).classed("hide", !show).style("opacity", null);
57240 if (callback) callback.apply(this);
57245 // modules/ui/curtain.js
57246 function uiCurtain(containerNode) {
57247 var surface = select_default2(null), tooltip = select_default2(null), darkness = select_default2(null);
57248 function curtain(selection2) {
57249 surface = selection2.append("svg").attr("class", "curtain").style("top", 0).style("left", 0);
57250 darkness = surface.append("path").attr("x", 0).attr("y", 0).attr("class", "curtain-darkness");
57251 select_default2(window).on("resize.curtain", resize);
57252 tooltip = selection2.append("div").attr("class", "tooltip");
57253 tooltip.append("div").attr("class", "popover-arrow");
57254 tooltip.append("div").attr("class", "popover-inner");
57256 function resize() {
57257 surface.attr("width", containerNode.clientWidth).attr("height", containerNode.clientHeight);
57258 curtain.cut(darkness.datum());
57261 curtain.reveal = function(box, html3, options2) {
57262 options2 = options2 || {};
57263 if (typeof box === "string") {
57264 box = select_default2(box).node();
57266 if (box && box.getBoundingClientRect) {
57267 box = copyBox(box.getBoundingClientRect());
57268 var containerRect = containerNode.getBoundingClientRect();
57269 box.top -= containerRect.top;
57270 box.left -= containerRect.left;
57272 if (box && options2.padding) {
57273 box.top -= options2.padding;
57274 box.left -= options2.padding;
57275 box.bottom += options2.padding;
57276 box.right += options2.padding;
57277 box.height += options2.padding * 2;
57278 box.width += options2.padding * 2;
57281 if (options2.tooltipBox) {
57282 tooltipBox = options2.tooltipBox;
57283 if (typeof tooltipBox === "string") {
57284 tooltipBox = select_default2(tooltipBox).node();
57286 if (tooltipBox && tooltipBox.getBoundingClientRect) {
57287 tooltipBox = copyBox(tooltipBox.getBoundingClientRect());
57292 if (tooltipBox && html3) {
57293 if (html3.indexOf("**") !== -1) {
57294 if (html3.indexOf("<span") === 0) {
57295 html3 = html3.replace(/^(<span.*?>)(.+?)(\*\*)/, "$1<span>$2</span>$3");
57297 html3 = html3.replace(/^(.+?)(\*\*)/, "<span>$1</span>$2");
57299 html3 = html3.replace(/\*\*(.*?)\*\*/g, '<span class="instruction">$1</span>');
57301 html3 = html3.replace(/\*(.*?)\*/g, "<em>$1</em>");
57302 html3 = html3.replace(/\{br\}/g, "<br/><br/>");
57303 if (options2.buttonText && options2.buttonCallback) {
57304 html3 += '<div class="button-section"><button href="#" class="button action">' + options2.buttonText + "</button></div>";
57306 var classes = "curtain-tooltip popover tooltip arrowed in " + (options2.tooltipClass || "");
57307 tooltip.classed(classes, true).selectAll(".popover-inner").html(html3);
57308 if (options2.buttonText && options2.buttonCallback) {
57309 var button = tooltip.selectAll(".button-section .button.action");
57310 button.on("click", function(d3_event) {
57311 d3_event.preventDefault();
57312 options2.buttonCallback();
57315 var tip = copyBox(tooltip.node().getBoundingClientRect()), w2 = containerNode.clientWidth, h2 = containerNode.clientHeight, tooltipWidth = 200, tooltipArrow = 5, side, pos;
57316 if (options2.tooltipClass === "intro-mouse") {
57319 if (tooltipBox.top + tooltipBox.height > h2) {
57320 tooltipBox.height -= tooltipBox.top + tooltipBox.height - h2;
57322 if (tooltipBox.left + tooltipBox.width > w2) {
57323 tooltipBox.width -= tooltipBox.left + tooltipBox.width - w2;
57325 if (tooltipBox.top + tooltipBox.height < 100) {
57328 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57329 tooltipBox.top + tooltipBox.height
57331 } else if (tooltipBox.top > h2 - 140) {
57334 tooltipBox.left + tooltipBox.width / 2 - tip.width / 2,
57335 tooltipBox.top - tip.height
57338 var tipY = tooltipBox.top + tooltipBox.height / 2 - tip.height / 2;
57339 if (_mainLocalizer.textDirection() === "rtl") {
57340 if (tooltipBox.left - tooltipWidth - tooltipArrow < 70) {
57342 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57345 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57348 if (tooltipBox.left + tooltipBox.width + tooltipArrow + tooltipWidth > w2 - 70) {
57350 pos = [tooltipBox.left - tooltipWidth - tooltipArrow, tipY];
57353 pos = [tooltipBox.left + tooltipBox.width + tooltipArrow, tipY];
57357 if (options2.duration !== 0 || !tooltip.classed(side)) {
57358 tooltip.call(uiToggle(true));
57360 tooltip.style("top", pos[1] + "px").style("left", pos[0] + "px").attr("class", classes + " " + side);
57362 if (side === "left" || side === "right") {
57364 shiftY = 60 - pos[1];
57365 } else if (pos[1] + tip.height > h2 - 100) {
57366 shiftY = h2 - pos[1] - tip.height - 100;
57369 tooltip.selectAll(".popover-inner").style("top", shiftY + "px");
57371 tooltip.classed("in", false).call(uiToggle(false));
57373 curtain.cut(box, options2.duration);
57376 curtain.cut = function(datum2, duration) {
57377 darkness.datum(datum2).interrupt();
57379 if (duration === 0) {
57380 selection2 = darkness;
57382 selection2 = darkness.transition().duration(duration || 600).ease(linear2);
57384 selection2.attr("d", function(d2) {
57385 var containerWidth = containerNode.clientWidth;
57386 var containerHeight = containerNode.clientHeight;
57387 var string = "M 0,0 L 0," + containerHeight + " L " + containerWidth + "," + containerHeight + "L" + containerWidth + ",0 Z";
57388 if (!d2) return string;
57389 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";
57392 curtain.remove = function() {
57395 select_default2(window).on("resize.curtain", null);
57397 function copyBox(src) {
57401 bottom: src.bottom,
57410 // modules/ui/intro/welcome.js
57411 function uiIntroWelcome(context, reveal) {
57412 var dispatch14 = dispatch_default("done");
57414 title: "intro.welcome.title"
57416 function welcome() {
57417 context.map().centerZoom([-85.63591, 41.94285], 19);
57419 ".intro-nav-wrap .chapter-welcome",
57420 helpHtml("intro.welcome.welcome"),
57421 { buttonText: _t.html("intro.ok"), buttonCallback: practice }
57424 function practice() {
57426 ".intro-nav-wrap .chapter-welcome",
57427 helpHtml("intro.welcome.practice"),
57428 { buttonText: _t.html("intro.ok"), buttonCallback: words }
57433 ".intro-nav-wrap .chapter-welcome",
57434 helpHtml("intro.welcome.words"),
57435 { buttonText: _t.html("intro.ok"), buttonCallback: chapters }
57438 function chapters() {
57439 dispatch14.call("done");
57441 ".intro-nav-wrap .chapter-navigation",
57442 helpHtml("intro.welcome.chapters", { next: _t("intro.navigation.title") })
57445 chapter.enter = function() {
57448 chapter.exit = function() {
57449 context.container().select(".curtain-tooltip.intro-mouse").selectAll(".counter").remove();
57451 chapter.restart = function() {
57455 return utilRebind(chapter, dispatch14, "on");
57458 // modules/ui/intro/navigation.js
57459 function uiIntroNavigation(context, reveal) {
57460 var dispatch14 = dispatch_default("done");
57462 var hallId = "n2061";
57463 var townHall = [-85.63591, 41.94285];
57464 var springStreetId = "w397";
57465 var springStreetEndId = "n1834";
57466 var springStreet = [-85.63582, 41.94255];
57467 var onewayField = _mainPresetIndex.field("oneway");
57468 var maxspeedField = _mainPresetIndex.field("maxspeed");
57470 title: "intro.navigation.title"
57472 function timeout2(f2, t2) {
57473 timeouts.push(window.setTimeout(f2, t2));
57475 function eventCancel(d3_event) {
57476 d3_event.stopPropagation();
57477 d3_event.preventDefault();
57479 function isTownHallSelected() {
57480 var ids = context.selectedIDs();
57481 return ids.length === 1 && ids[0] === hallId;
57483 function dragMap() {
57484 context.enter(modeBrowse(context));
57485 context.history().reset("initial");
57486 var msec = transitionTime(townHall, context.map().center());
57488 reveal(null, null, { duration: 0 });
57490 context.map().centerZoomEase(townHall, 19, msec);
57491 timeout2(function() {
57492 var centerStart = context.map().center();
57493 var textId = context.lastPointerType() === "mouse" ? "drag" : "drag_touch";
57494 var dragString = helpHtml("intro.navigation.map_info") + "{br}" + helpHtml("intro.navigation." + textId);
57495 reveal(".surface", dragString);
57496 context.map().on("drawn.intro", function() {
57497 reveal(".surface", dragString, { duration: 0 });
57499 context.map().on("move.intro", function() {
57500 var centerNow = context.map().center();
57501 if (centerStart[0] !== centerNow[0] || centerStart[1] !== centerNow[1]) {
57502 context.map().on("move.intro", null);
57503 timeout2(function() {
57504 continueTo(zoomMap);
57509 function continueTo(nextStep) {
57510 context.map().on("move.intro drawn.intro", null);
57514 function zoomMap() {
57515 var zoomStart = context.map().zoom();
57516 var textId = context.lastPointerType() === "mouse" ? "zoom" : "zoom_touch";
57517 var zoomString = helpHtml("intro.navigation." + textId);
57518 reveal(".surface", zoomString);
57519 context.map().on("drawn.intro", function() {
57520 reveal(".surface", zoomString, { duration: 0 });
57522 context.map().on("move.intro", function() {
57523 if (context.map().zoom() !== zoomStart) {
57524 context.map().on("move.intro", null);
57525 timeout2(function() {
57526 continueTo(features);
57530 function continueTo(nextStep) {
57531 context.map().on("move.intro drawn.intro", null);
57535 function features() {
57536 var onClick = function() {
57537 continueTo(pointsLinesAreas);
57541 helpHtml("intro.navigation.features"),
57542 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57544 context.map().on("drawn.intro", function() {
57547 helpHtml("intro.navigation.features"),
57548 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57551 function continueTo(nextStep) {
57552 context.map().on("drawn.intro", null);
57556 function pointsLinesAreas() {
57557 var onClick = function() {
57558 continueTo(nodesWays);
57562 helpHtml("intro.navigation.points_lines_areas"),
57563 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57565 context.map().on("drawn.intro", function() {
57568 helpHtml("intro.navigation.points_lines_areas"),
57569 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57572 function continueTo(nextStep) {
57573 context.map().on("drawn.intro", null);
57577 function nodesWays() {
57578 var onClick = function() {
57579 continueTo(clickTownHall);
57583 helpHtml("intro.navigation.nodes_ways"),
57584 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57586 context.map().on("drawn.intro", function() {
57589 helpHtml("intro.navigation.nodes_ways"),
57590 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57593 function continueTo(nextStep) {
57594 context.map().on("drawn.intro", null);
57598 function clickTownHall() {
57599 context.enter(modeBrowse(context));
57600 context.history().reset("initial");
57601 var entity = context.hasEntity(hallId);
57602 if (!entity) return;
57603 reveal(null, null, { duration: 0 });
57604 context.map().centerZoomEase(entity.loc, 19, 500);
57605 timeout2(function() {
57606 var entity2 = context.hasEntity(hallId);
57607 if (!entity2) return;
57608 var box = pointBox(entity2.loc, context);
57609 var textId = context.lastPointerType() === "mouse" ? "click_townhall" : "tap_townhall";
57610 reveal(box, helpHtml("intro.navigation." + textId));
57611 context.map().on("move.intro drawn.intro", function() {
57612 var entity3 = context.hasEntity(hallId);
57613 if (!entity3) return;
57614 var box2 = pointBox(entity3.loc, context);
57615 reveal(box2, helpHtml("intro.navigation." + textId), { duration: 0 });
57617 context.on("enter.intro", function() {
57618 if (isTownHallSelected()) continueTo(selectedTownHall);
57621 context.history().on("change.intro", function() {
57622 if (!context.hasEntity(hallId)) {
57623 continueTo(clickTownHall);
57626 function continueTo(nextStep) {
57627 context.on("enter.intro", null);
57628 context.map().on("move.intro drawn.intro", null);
57629 context.history().on("change.intro", null);
57633 function selectedTownHall() {
57634 if (!isTownHallSelected()) return clickTownHall();
57635 var entity = context.hasEntity(hallId);
57636 if (!entity) return clickTownHall();
57637 var box = pointBox(entity.loc, context);
57638 var onClick = function() {
57639 continueTo(editorTownHall);
57643 helpHtml("intro.navigation.selected_townhall"),
57644 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57646 context.map().on("move.intro drawn.intro", function() {
57647 var entity2 = context.hasEntity(hallId);
57648 if (!entity2) return;
57649 var box2 = pointBox(entity2.loc, context);
57652 helpHtml("intro.navigation.selected_townhall"),
57653 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57656 context.history().on("change.intro", function() {
57657 if (!context.hasEntity(hallId)) {
57658 continueTo(clickTownHall);
57661 function continueTo(nextStep) {
57662 context.map().on("move.intro drawn.intro", null);
57663 context.history().on("change.intro", null);
57667 function editorTownHall() {
57668 if (!isTownHallSelected()) return clickTownHall();
57669 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57670 var onClick = function() {
57671 continueTo(presetTownHall);
57674 ".entity-editor-pane",
57675 helpHtml("intro.navigation.editor_townhall"),
57676 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57678 context.on("exit.intro", function() {
57679 continueTo(clickTownHall);
57681 context.history().on("change.intro", function() {
57682 if (!context.hasEntity(hallId)) {
57683 continueTo(clickTownHall);
57686 function continueTo(nextStep) {
57687 context.on("exit.intro", null);
57688 context.history().on("change.intro", null);
57689 context.container().select(".inspector-wrap").on("wheel.intro", null);
57693 function presetTownHall() {
57694 if (!isTownHallSelected()) return clickTownHall();
57695 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57696 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57697 var entity = context.entity(context.selectedIDs()[0]);
57698 var preset = _mainPresetIndex.match(entity, context.graph());
57699 var onClick = function() {
57700 continueTo(fieldsTownHall);
57703 ".entity-editor-pane .section-feature-type",
57704 helpHtml("intro.navigation.preset_townhall", { preset: preset.name() }),
57705 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57707 context.on("exit.intro", function() {
57708 continueTo(clickTownHall);
57710 context.history().on("change.intro", function() {
57711 if (!context.hasEntity(hallId)) {
57712 continueTo(clickTownHall);
57715 function continueTo(nextStep) {
57716 context.on("exit.intro", null);
57717 context.history().on("change.intro", null);
57718 context.container().select(".inspector-wrap").on("wheel.intro", null);
57722 function fieldsTownHall() {
57723 if (!isTownHallSelected()) return clickTownHall();
57724 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
57725 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
57726 var onClick = function() {
57727 continueTo(closeTownHall);
57730 ".entity-editor-pane .section-preset-fields",
57731 helpHtml("intro.navigation.fields_townhall"),
57732 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57734 context.on("exit.intro", function() {
57735 continueTo(clickTownHall);
57737 context.history().on("change.intro", function() {
57738 if (!context.hasEntity(hallId)) {
57739 continueTo(clickTownHall);
57742 function continueTo(nextStep) {
57743 context.on("exit.intro", null);
57744 context.history().on("change.intro", null);
57745 context.container().select(".inspector-wrap").on("wheel.intro", null);
57749 function closeTownHall() {
57750 if (!isTownHallSelected()) return clickTownHall();
57751 var selector = ".entity-editor-pane button.close svg use";
57752 var href = select_default2(selector).attr("href") || "#iD-icon-close";
57754 ".entity-editor-pane",
57755 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href, "inline") } })
57757 context.on("exit.intro", function() {
57758 continueTo(searchStreet);
57760 context.history().on("change.intro", function() {
57761 var selector2 = ".entity-editor-pane button.close svg use";
57762 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57764 ".entity-editor-pane",
57765 helpHtml("intro.navigation.close_townhall", { button: { html: icon(href2, "inline") } }),
57769 function continueTo(nextStep) {
57770 context.on("exit.intro", null);
57771 context.history().on("change.intro", null);
57775 function searchStreet() {
57776 context.enter(modeBrowse(context));
57777 context.history().reset("initial");
57778 var msec = transitionTime(springStreet, context.map().center());
57780 reveal(null, null, { duration: 0 });
57782 context.map().centerZoomEase(springStreet, 19, msec);
57783 timeout2(function() {
57785 ".search-header input",
57786 helpHtml("intro.navigation.search_street", { name: _t("intro.graph.name.spring-street") })
57788 context.container().select(".search-header input").on("keyup.intro", checkSearchResult);
57791 function checkSearchResult() {
57792 var first = context.container().select(".feature-list-item:nth-child(0n+2)");
57793 var firstName = first.select(".entity-name");
57794 var name = _t("intro.graph.name.spring-street");
57795 if (!firstName.empty() && firstName.html() === name) {
57798 helpHtml("intro.navigation.choose_street", { name }),
57801 context.on("exit.intro", function() {
57802 continueTo(selectedStreet);
57804 context.container().select(".search-header input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
57806 function continueTo(nextStep) {
57807 context.on("exit.intro", null);
57808 context.container().select(".search-header input").on("keydown.intro", null).on("keyup.intro", null);
57812 function selectedStreet() {
57813 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57814 return searchStreet();
57816 var onClick = function() {
57817 continueTo(editorStreet);
57819 var entity = context.entity(springStreetEndId);
57820 var box = pointBox(entity.loc, context);
57824 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57825 { duration: 600, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57827 timeout2(function() {
57828 context.map().on("move.intro drawn.intro", function() {
57829 var entity2 = context.hasEntity(springStreetEndId);
57830 if (!entity2) return;
57831 var box2 = pointBox(entity2.loc, context);
57835 helpHtml("intro.navigation.selected_street", { name: _t("intro.graph.name.spring-street") }),
57836 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
57840 context.on("enter.intro", function(mode) {
57841 if (!context.hasEntity(springStreetId)) {
57842 return continueTo(searchStreet);
57844 var ids = context.selectedIDs();
57845 if (mode.id !== "select" || !ids.length || ids[0] !== springStreetId) {
57846 context.enter(modeSelect(context, [springStreetId]));
57849 context.history().on("change.intro", function() {
57850 if (!context.hasEntity(springStreetEndId) || !context.hasEntity(springStreetId)) {
57851 timeout2(function() {
57852 continueTo(searchStreet);
57856 function continueTo(nextStep) {
57857 context.map().on("move.intro drawn.intro", null);
57858 context.on("enter.intro", null);
57859 context.history().on("change.intro", null);
57863 function editorStreet() {
57864 var selector = ".entity-editor-pane button.close svg use";
57865 var href = select_default2(selector).attr("href") || "#iD-icon-close";
57866 reveal(".entity-editor-pane", helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57867 button: { html: icon(href, "inline") },
57868 field1: onewayField.title(),
57869 field2: maxspeedField.title()
57871 context.on("exit.intro", function() {
57874 context.history().on("change.intro", function() {
57875 var selector2 = ".entity-editor-pane button.close svg use";
57876 var href2 = select_default2(selector2).attr("href") || "#iD-icon-close";
57878 ".entity-editor-pane",
57879 helpHtml("intro.navigation.street_different_fields") + "{br}" + helpHtml("intro.navigation.editor_street", {
57880 button: { html: icon(href2, "inline") },
57881 field1: onewayField.title(),
57882 field2: maxspeedField.title()
57887 function continueTo(nextStep) {
57888 context.on("exit.intro", null);
57889 context.history().on("change.intro", null);
57894 dispatch14.call("done");
57897 helpHtml("intro.navigation.play", { next: _t("intro.points.title") }),
57899 tooltipBox: ".intro-nav-wrap .chapter-point",
57900 buttonText: _t.html("intro.ok"),
57901 buttonCallback: function() {
57902 reveal(".ideditor");
57907 chapter.enter = function() {
57910 chapter.exit = function() {
57911 timeouts.forEach(window.clearTimeout);
57912 context.on("enter.intro exit.intro", null);
57913 context.map().on("move.intro drawn.intro", null);
57914 context.history().on("change.intro", null);
57915 context.container().select(".inspector-wrap").on("wheel.intro", null);
57916 context.container().select(".search-header input").on("keydown.intro keyup.intro", null);
57918 chapter.restart = function() {
57922 return utilRebind(chapter, dispatch14, "on");
57925 // modules/ui/intro/point.js
57926 function uiIntroPoint(context, reveal) {
57927 var dispatch14 = dispatch_default("done");
57929 var intersection2 = [-85.63279, 41.94394];
57930 var building = [-85.632422, 41.944045];
57931 var cafePreset = _mainPresetIndex.item("amenity/cafe");
57932 var _pointID = null;
57934 title: "intro.points.title"
57936 function timeout2(f2, t2) {
57937 timeouts.push(window.setTimeout(f2, t2));
57939 function eventCancel(d3_event) {
57940 d3_event.stopPropagation();
57941 d3_event.preventDefault();
57943 function addPoint() {
57944 context.enter(modeBrowse(context));
57945 context.history().reset("initial");
57946 var msec = transitionTime(intersection2, context.map().center());
57948 reveal(null, null, { duration: 0 });
57950 context.map().centerZoomEase(intersection2, 19, msec);
57951 timeout2(function() {
57952 var tooltip = reveal(
57953 "button.add-point",
57954 helpHtml("intro.points.points_info") + "{br}" + helpHtml("intro.points.add_point")
57957 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-points");
57958 context.on("enter.intro", function(mode) {
57959 if (mode.id !== "add-point") return;
57960 continueTo(placePoint);
57963 function continueTo(nextStep) {
57964 context.on("enter.intro", null);
57968 function placePoint() {
57969 if (context.mode().id !== "add-point") {
57970 return chapter.restart();
57972 var pointBox2 = pad(building, 150, context);
57973 var textId = context.lastPointerType() === "mouse" ? "place_point" : "place_point_touch";
57974 reveal(pointBox2, helpHtml("intro.points." + textId));
57975 context.map().on("move.intro drawn.intro", function() {
57976 pointBox2 = pad(building, 150, context);
57977 reveal(pointBox2, helpHtml("intro.points." + textId), { duration: 0 });
57979 context.on("enter.intro", function(mode) {
57980 if (mode.id !== "select") return chapter.restart();
57981 _pointID = context.mode().selectedIDs()[0];
57982 if (context.graph().geometry(_pointID) === "vertex") {
57983 context.map().on("move.intro drawn.intro", null);
57984 context.on("enter.intro", null);
57985 reveal(pointBox2, helpHtml("intro.points.place_point_error"), {
57986 buttonText: _t.html("intro.ok"),
57987 buttonCallback: function() {
57988 return chapter.restart();
57992 continueTo(searchPreset);
57995 function continueTo(nextStep) {
57996 context.map().on("move.intro drawn.intro", null);
57997 context.on("enter.intro", null);
58001 function searchPreset() {
58002 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58005 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58006 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58008 ".preset-search-input",
58009 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58011 context.on("enter.intro", function(mode) {
58012 if (!_pointID || !context.hasEntity(_pointID)) {
58013 return continueTo(addPoint);
58015 var ids = context.selectedIDs();
58016 if (mode.id !== "select" || !ids.length || ids[0] !== _pointID) {
58017 context.enter(modeSelect(context, [_pointID]));
58018 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58019 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58021 ".preset-search-input",
58022 helpHtml("intro.points.search_cafe", { preset: cafePreset.name() })
58024 context.history().on("change.intro", null);
58027 function checkPresetSearch() {
58028 var first = context.container().select(".preset-list-item:first-child");
58029 if (first.classed("preset-amenity-cafe")) {
58030 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58032 first.select(".preset-list-button").node(),
58033 helpHtml("intro.points.choose_cafe", { preset: cafePreset.name() }),
58036 context.history().on("change.intro", function() {
58037 continueTo(aboutFeatureEditor);
58041 function continueTo(nextStep) {
58042 context.on("enter.intro", null);
58043 context.history().on("change.intro", null);
58044 context.container().select(".inspector-wrap").on("wheel.intro", null);
58045 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58049 function aboutFeatureEditor() {
58050 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58053 timeout2(function() {
58054 reveal(".entity-editor-pane", helpHtml("intro.points.feature_editor"), {
58055 tooltipClass: "intro-points-describe",
58056 buttonText: _t.html("intro.ok"),
58057 buttonCallback: function() {
58058 continueTo(addName);
58062 context.on("exit.intro", function() {
58063 continueTo(reselectPoint);
58065 function continueTo(nextStep) {
58066 context.on("exit.intro", null);
58070 function addName() {
58071 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58074 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58075 var addNameString = helpHtml("intro.points.fields_info") + "{br}" + helpHtml("intro.points.add_name");
58076 timeout2(function() {
58077 var entity = context.entity(_pointID);
58078 if (entity.tags.name) {
58079 var tooltip = reveal(".entity-editor-pane", addNameString, {
58080 tooltipClass: "intro-points-describe",
58081 buttonText: _t.html("intro.ok"),
58082 buttonCallback: function() {
58083 continueTo(addCloseEditor);
58086 tooltip.select(".instruction").style("display", "none");
58089 ".entity-editor-pane",
58091 { tooltipClass: "intro-points-describe" }
58095 context.history().on("change.intro", function() {
58096 continueTo(addCloseEditor);
58098 context.on("exit.intro", function() {
58099 continueTo(reselectPoint);
58101 function continueTo(nextStep) {
58102 context.on("exit.intro", null);
58103 context.history().on("change.intro", null);
58107 function addCloseEditor() {
58108 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58109 var selector = ".entity-editor-pane button.close svg use";
58110 var href = select_default2(selector).attr("href") || "#iD-icon-close";
58111 context.on("exit.intro", function() {
58112 continueTo(reselectPoint);
58115 ".entity-editor-pane",
58116 helpHtml("intro.points.add_close", { button: { html: icon(href, "inline") } })
58118 function continueTo(nextStep) {
58119 context.on("exit.intro", null);
58123 function reselectPoint() {
58124 if (!_pointID) return chapter.restart();
58125 var entity = context.hasEntity(_pointID);
58126 if (!entity) return chapter.restart();
58127 var oldPreset = _mainPresetIndex.match(entity, context.graph());
58128 context.replace(actionChangePreset(_pointID, oldPreset, cafePreset));
58129 context.enter(modeBrowse(context));
58130 var msec = transitionTime(entity.loc, context.map().center());
58132 reveal(null, null, { duration: 0 });
58134 context.map().centerEase(entity.loc, msec);
58135 timeout2(function() {
58136 var box = pointBox(entity.loc, context);
58137 reveal(box, helpHtml("intro.points.reselect"), { duration: 600 });
58138 timeout2(function() {
58139 context.map().on("move.intro drawn.intro", function() {
58140 var entity2 = context.hasEntity(_pointID);
58141 if (!entity2) return chapter.restart();
58142 var box2 = pointBox(entity2.loc, context);
58143 reveal(box2, helpHtml("intro.points.reselect"), { duration: 0 });
58146 context.on("enter.intro", function(mode) {
58147 if (mode.id !== "select") return;
58148 continueTo(updatePoint);
58151 function continueTo(nextStep) {
58152 context.map().on("move.intro drawn.intro", null);
58153 context.on("enter.intro", null);
58157 function updatePoint() {
58158 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58159 return continueTo(reselectPoint);
58161 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58162 context.on("exit.intro", function() {
58163 continueTo(reselectPoint);
58165 context.history().on("change.intro", function() {
58166 continueTo(updateCloseEditor);
58168 timeout2(function() {
58170 ".entity-editor-pane",
58171 helpHtml("intro.points.update"),
58172 { tooltipClass: "intro-points-describe" }
58175 function continueTo(nextStep) {
58176 context.on("exit.intro", null);
58177 context.history().on("change.intro", null);
58181 function updateCloseEditor() {
58182 if (context.mode().id !== "select" || !_pointID || !context.hasEntity(_pointID)) {
58183 return continueTo(reselectPoint);
58185 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58186 context.on("exit.intro", function() {
58187 continueTo(rightClickPoint);
58189 timeout2(function() {
58191 ".entity-editor-pane",
58192 helpHtml("intro.points.update_close", { button: { html: icon("#iD-icon-close", "inline") } })
58195 function continueTo(nextStep) {
58196 context.on("exit.intro", null);
58200 function rightClickPoint() {
58201 if (!_pointID) return chapter.restart();
58202 var entity = context.hasEntity(_pointID);
58203 if (!entity) return chapter.restart();
58204 context.enter(modeBrowse(context));
58205 var box = pointBox(entity.loc, context);
58206 var textId = context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch";
58207 reveal(box, helpHtml("intro.points." + textId), { duration: 600 });
58208 timeout2(function() {
58209 context.map().on("move.intro", function() {
58210 var entity2 = context.hasEntity(_pointID);
58211 if (!entity2) return chapter.restart();
58212 var box2 = pointBox(entity2.loc, context);
58213 reveal(box2, helpHtml("intro.points." + textId), { duration: 0 });
58216 context.on("enter.intro", function(mode) {
58217 if (mode.id !== "select") return;
58218 var ids = context.selectedIDs();
58219 if (ids.length !== 1 || ids[0] !== _pointID) return;
58220 timeout2(function() {
58221 var node = selectMenuItem(context, "delete").node();
58223 continueTo(enterDelete);
58226 function continueTo(nextStep) {
58227 context.on("enter.intro", null);
58228 context.map().on("move.intro", null);
58232 function enterDelete() {
58233 if (!_pointID) return chapter.restart();
58234 var entity = context.hasEntity(_pointID);
58235 if (!entity) return chapter.restart();
58236 var node = selectMenuItem(context, "delete").node();
58238 return continueTo(rightClickPoint);
58242 helpHtml("intro.points.delete"),
58245 timeout2(function() {
58246 context.map().on("move.intro", function() {
58249 helpHtml("intro.points.delete"),
58250 { duration: 0, padding: 50 }
58254 context.on("exit.intro", function() {
58255 if (!_pointID) return chapter.restart();
58256 var entity2 = context.hasEntity(_pointID);
58257 if (entity2) return continueTo(rightClickPoint);
58259 context.history().on("change.intro", function(changed) {
58260 if (changed.deleted().length) {
58264 function continueTo(nextStep) {
58265 context.map().on("move.intro", null);
58266 context.history().on("change.intro", null);
58267 context.on("exit.intro", null);
58272 context.history().on("change.intro", function() {
58276 ".top-toolbar button.undo-button",
58277 helpHtml("intro.points.undo")
58279 function continueTo(nextStep) {
58280 context.history().on("change.intro", null);
58285 dispatch14.call("done");
58288 helpHtml("intro.points.play", { next: _t("intro.areas.title") }),
58290 tooltipBox: ".intro-nav-wrap .chapter-area",
58291 buttonText: _t.html("intro.ok"),
58292 buttonCallback: function() {
58293 reveal(".ideditor");
58298 chapter.enter = function() {
58301 chapter.exit = function() {
58302 timeouts.forEach(window.clearTimeout);
58303 context.on("enter.intro exit.intro", null);
58304 context.map().on("move.intro drawn.intro", null);
58305 context.history().on("change.intro", null);
58306 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58307 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58309 chapter.restart = function() {
58313 return utilRebind(chapter, dispatch14, "on");
58316 // modules/ui/intro/area.js
58317 function uiIntroArea(context, reveal) {
58318 var dispatch14 = dispatch_default("done");
58319 var playground = [-85.63552, 41.94159];
58320 var playgroundPreset = _mainPresetIndex.item("leisure/playground");
58321 var nameField = _mainPresetIndex.field("name");
58322 var descriptionField = _mainPresetIndex.field("description");
58326 title: "intro.areas.title"
58328 function timeout2(f2, t2) {
58329 timeouts.push(window.setTimeout(f2, t2));
58331 function eventCancel(d3_event) {
58332 d3_event.stopPropagation();
58333 d3_event.preventDefault();
58335 function revealPlayground(center, text, options2) {
58336 var padding = 180 * Math.pow(2, context.map().zoom() - 19.5);
58337 var box = pad(center, padding, context);
58338 reveal(box, text, options2);
58340 function addArea() {
58341 context.enter(modeBrowse(context));
58342 context.history().reset("initial");
58344 var msec = transitionTime(playground, context.map().center());
58346 reveal(null, null, { duration: 0 });
58348 context.map().centerZoomEase(playground, 19, msec);
58349 timeout2(function() {
58350 var tooltip = reveal(
58352 helpHtml("intro.areas.add_playground")
58354 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-areas");
58355 context.on("enter.intro", function(mode) {
58356 if (mode.id !== "add-area") return;
58357 continueTo(startPlayground);
58360 function continueTo(nextStep) {
58361 context.on("enter.intro", null);
58365 function startPlayground() {
58366 if (context.mode().id !== "add-area") {
58367 return chapter.restart();
58370 context.map().zoomEase(19.5, 500);
58371 timeout2(function() {
58372 var textId = context.lastPointerType() === "mouse" ? "starting_node_click" : "starting_node_tap";
58373 var startDrawString = helpHtml("intro.areas.start_playground") + helpHtml("intro.areas." + textId);
58379 timeout2(function() {
58380 context.map().on("move.intro drawn.intro", function() {
58387 context.on("enter.intro", function(mode) {
58388 if (mode.id !== "draw-area") return chapter.restart();
58389 continueTo(continuePlayground);
58393 function continueTo(nextStep) {
58394 context.map().on("move.intro drawn.intro", null);
58395 context.on("enter.intro", null);
58399 function continuePlayground() {
58400 if (context.mode().id !== "draw-area") {
58401 return chapter.restart();
58406 helpHtml("intro.areas.continue_playground"),
58409 timeout2(function() {
58410 context.map().on("move.intro drawn.intro", function() {
58413 helpHtml("intro.areas.continue_playground"),
58418 context.on("enter.intro", function(mode) {
58419 if (mode.id === "draw-area") {
58420 var entity = context.hasEntity(context.selectedIDs()[0]);
58421 if (entity && entity.nodes.length >= 6) {
58422 return continueTo(finishPlayground);
58426 } else if (mode.id === "select") {
58427 _areaID = context.selectedIDs()[0];
58428 return continueTo(searchPresets);
58430 return chapter.restart();
58433 function continueTo(nextStep) {
58434 context.map().on("move.intro drawn.intro", null);
58435 context.on("enter.intro", null);
58439 function finishPlayground() {
58440 if (context.mode().id !== "draw-area") {
58441 return chapter.restart();
58444 var finishString = helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.areas.finish_playground");
58450 timeout2(function() {
58451 context.map().on("move.intro drawn.intro", function() {
58459 context.on("enter.intro", function(mode) {
58460 if (mode.id === "draw-area") {
58462 } else if (mode.id === "select") {
58463 _areaID = context.selectedIDs()[0];
58464 return continueTo(searchPresets);
58466 return chapter.restart();
58469 function continueTo(nextStep) {
58470 context.map().on("move.intro drawn.intro", null);
58471 context.on("enter.intro", null);
58475 function searchPresets() {
58476 if (!_areaID || !context.hasEntity(_areaID)) {
58479 var ids = context.selectedIDs();
58480 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58481 context.enter(modeSelect(context, [_areaID]));
58483 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58484 timeout2(function() {
58485 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58486 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58488 ".preset-search-input",
58489 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58492 context.on("enter.intro", function(mode) {
58493 if (!_areaID || !context.hasEntity(_areaID)) {
58494 return continueTo(addArea);
58496 var ids2 = context.selectedIDs();
58497 if (mode.id !== "select" || !ids2.length || ids2[0] !== _areaID) {
58498 context.enter(modeSelect(context, [_areaID]));
58499 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58500 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58501 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
58503 ".preset-search-input",
58504 helpHtml("intro.areas.search_playground", { preset: playgroundPreset.name() })
58506 context.history().on("change.intro", null);
58509 function checkPresetSearch() {
58510 var first = context.container().select(".preset-list-item:first-child");
58511 if (first.classed("preset-leisure-playground")) {
58513 first.select(".preset-list-button").node(),
58514 helpHtml("intro.areas.choose_playground", { preset: playgroundPreset.name() }),
58517 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
58518 context.history().on("change.intro", function() {
58519 continueTo(clickAddField);
58523 function continueTo(nextStep) {
58524 context.container().select(".inspector-wrap").on("wheel.intro", null);
58525 context.on("enter.intro", null);
58526 context.history().on("change.intro", null);
58527 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58531 function clickAddField() {
58532 if (!_areaID || !context.hasEntity(_areaID)) {
58535 var ids = context.selectedIDs();
58536 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58537 return searchPresets();
58539 if (!context.container().select(".form-field-description").empty()) {
58540 return continueTo(describePlayground);
58542 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58543 timeout2(function() {
58544 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58545 var entity = context.entity(_areaID);
58546 if (entity.tags.description) {
58547 return continueTo(play);
58549 var box = context.container().select(".more-fields").node().getBoundingClientRect();
58550 if (box.top > 300) {
58551 var pane = context.container().select(".entity-editor-pane .inspector-body");
58552 var start2 = pane.node().scrollTop;
58553 var end = start2 + (box.top - 300);
58554 pane.transition().duration(250).tween("scroll.inspector", function() {
58556 var i3 = number_default(start2, end);
58557 return function(t2) {
58558 node.scrollTop = i3(t2);
58562 timeout2(function() {
58564 ".more-fields .combobox-input",
58565 helpHtml("intro.areas.add_field", {
58566 name: nameField.title(),
58567 description: descriptionField.title()
58571 context.container().select(".more-fields .combobox-input").on("click.intro", function() {
58573 watcher = window.setInterval(function() {
58574 if (!context.container().select("div.combobox").empty()) {
58575 window.clearInterval(watcher);
58576 continueTo(chooseDescriptionField);
58582 context.on("exit.intro", function() {
58583 return continueTo(searchPresets);
58585 function continueTo(nextStep) {
58586 context.container().select(".inspector-wrap").on("wheel.intro", null);
58587 context.container().select(".more-fields .combobox-input").on("click.intro", null);
58588 context.on("exit.intro", null);
58592 function chooseDescriptionField() {
58593 if (!_areaID || !context.hasEntity(_areaID)) {
58596 var ids = context.selectedIDs();
58597 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58598 return searchPresets();
58600 if (!context.container().select(".form-field-description").empty()) {
58601 return continueTo(describePlayground);
58603 if (context.container().select("div.combobox").empty()) {
58604 return continueTo(clickAddField);
58607 watcher = window.setInterval(function() {
58608 if (context.container().select("div.combobox").empty()) {
58609 window.clearInterval(watcher);
58610 timeout2(function() {
58611 if (context.container().select(".form-field-description").empty()) {
58612 continueTo(retryChooseDescription);
58614 continueTo(describePlayground);
58621 helpHtml("intro.areas.choose_field", { field: descriptionField.title() }),
58624 context.on("exit.intro", function() {
58625 return continueTo(searchPresets);
58627 function continueTo(nextStep) {
58628 if (watcher) window.clearInterval(watcher);
58629 context.on("exit.intro", null);
58633 function describePlayground() {
58634 if (!_areaID || !context.hasEntity(_areaID)) {
58637 var ids = context.selectedIDs();
58638 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58639 return searchPresets();
58641 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58642 if (context.container().select(".form-field-description").empty()) {
58643 return continueTo(retryChooseDescription);
58645 context.on("exit.intro", function() {
58649 ".entity-editor-pane",
58650 helpHtml("intro.areas.describe_playground", { button: { html: icon("#iD-icon-close", "inline") } }),
58653 function continueTo(nextStep) {
58654 context.on("exit.intro", null);
58658 function retryChooseDescription() {
58659 if (!_areaID || !context.hasEntity(_areaID)) {
58662 var ids = context.selectedIDs();
58663 if (context.mode().id !== "select" || !ids.length || ids[0] !== _areaID) {
58664 return searchPresets();
58666 context.container().select(".inspector-wrap .panewrap").style("right", "0%");
58668 ".entity-editor-pane",
58669 helpHtml("intro.areas.retry_add_field", { field: descriptionField.title() }),
58671 buttonText: _t.html("intro.ok"),
58672 buttonCallback: function() {
58673 continueTo(clickAddField);
58677 context.on("exit.intro", function() {
58678 return continueTo(searchPresets);
58680 function continueTo(nextStep) {
58681 context.on("exit.intro", null);
58686 dispatch14.call("done");
58689 helpHtml("intro.areas.play", { next: _t("intro.lines.title") }),
58691 tooltipBox: ".intro-nav-wrap .chapter-line",
58692 buttonText: _t.html("intro.ok"),
58693 buttonCallback: function() {
58694 reveal(".ideditor");
58699 chapter.enter = function() {
58702 chapter.exit = function() {
58703 timeouts.forEach(window.clearTimeout);
58704 context.on("enter.intro exit.intro", null);
58705 context.map().on("move.intro drawn.intro", null);
58706 context.history().on("change.intro", null);
58707 context.container().select(".inspector-wrap").on("wheel.intro", null);
58708 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
58709 context.container().select(".more-fields .combobox-input").on("click.intro", null);
58711 chapter.restart = function() {
58715 return utilRebind(chapter, dispatch14, "on");
58718 // modules/ui/intro/line.js
58719 function uiIntroLine(context, reveal) {
58720 var dispatch14 = dispatch_default("done");
58722 var _tulipRoadID = null;
58723 var flowerRoadID = "w646";
58724 var tulipRoadStart = [-85.6297754121684, 41.95805253325314];
58725 var tulipRoadMidpoint = [-85.62975395449628, 41.95787501510204];
58726 var tulipRoadIntersection = [-85.62974496187628, 41.95742515554585];
58727 var roadCategory = _mainPresetIndex.item("category-road_minor");
58728 var residentialPreset = _mainPresetIndex.item("highway/residential");
58729 var woodRoadID = "w525";
58730 var woodRoadEndID = "n2862";
58731 var woodRoadAddNode = [-85.62390110349587, 41.95397111462291];
58732 var woodRoadDragEndpoint = [-85.623867390213, 41.95466987786487];
58733 var woodRoadDragMidpoint = [-85.62386254803509, 41.95430395953872];
58734 var washingtonStreetID = "w522";
58735 var twelfthAvenueID = "w1";
58736 var eleventhAvenueEndID = "n3550";
58737 var twelfthAvenueEndID = "n5";
58738 var _washingtonSegmentID = null;
58739 var eleventhAvenueEnd = context.entity(eleventhAvenueEndID).loc;
58740 var twelfthAvenueEnd = context.entity(twelfthAvenueEndID).loc;
58741 var deleteLinesLoc = [-85.6219395542764, 41.95228033922477];
58742 var twelfthAvenue = [-85.62219310052491, 41.952505413152956];
58744 title: "intro.lines.title"
58746 function timeout2(f2, t2) {
58747 timeouts.push(window.setTimeout(f2, t2));
58749 function eventCancel(d3_event) {
58750 d3_event.stopPropagation();
58751 d3_event.preventDefault();
58753 function addLine() {
58754 context.enter(modeBrowse(context));
58755 context.history().reset("initial");
58756 var msec = transitionTime(tulipRoadStart, context.map().center());
58758 reveal(null, null, { duration: 0 });
58760 context.map().centerZoomEase(tulipRoadStart, 18.5, msec);
58761 timeout2(function() {
58762 var tooltip = reveal(
58764 helpHtml("intro.lines.add_line")
58766 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-lines");
58767 context.on("enter.intro", function(mode) {
58768 if (mode.id !== "add-line") return;
58769 continueTo(startLine);
58772 function continueTo(nextStep) {
58773 context.on("enter.intro", null);
58777 function startLine() {
58778 if (context.mode().id !== "add-line") return chapter.restart();
58779 _tulipRoadID = null;
58780 var padding = 70 * Math.pow(2, context.map().zoom() - 18);
58781 var box = pad(tulipRoadStart, padding, context);
58782 box.height = box.height + 100;
58783 var textId = context.lastPointerType() === "mouse" ? "start_line" : "start_line_tap";
58784 var startLineString = helpHtml("intro.lines.missing_road") + "{br}" + helpHtml("intro.lines.line_draw_info") + helpHtml("intro.lines." + textId);
58785 reveal(box, startLineString);
58786 context.map().on("move.intro drawn.intro", function() {
58787 padding = 70 * Math.pow(2, context.map().zoom() - 18);
58788 box = pad(tulipRoadStart, padding, context);
58789 box.height = box.height + 100;
58790 reveal(box, startLineString, { duration: 0 });
58792 context.on("enter.intro", function(mode) {
58793 if (mode.id !== "draw-line") return chapter.restart();
58794 continueTo(drawLine);
58796 function continueTo(nextStep) {
58797 context.map().on("move.intro drawn.intro", null);
58798 context.on("enter.intro", null);
58802 function drawLine() {
58803 if (context.mode().id !== "draw-line") return chapter.restart();
58804 _tulipRoadID = context.mode().selectedIDs()[0];
58805 context.map().centerEase(tulipRoadMidpoint, 500);
58806 timeout2(function() {
58807 var padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58808 var box = pad(tulipRoadMidpoint, padding, context);
58809 box.height = box.height * 2;
58812 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") })
58814 context.map().on("move.intro drawn.intro", function() {
58815 padding = 200 * Math.pow(2, context.map().zoom() - 18.5);
58816 box = pad(tulipRoadMidpoint, padding, context);
58817 box.height = box.height * 2;
58820 helpHtml("intro.lines.intersect", { name: _t("intro.graph.name.flower-street") }),
58825 context.history().on("change.intro", function() {
58826 if (isLineConnected()) {
58827 continueTo(continueLine);
58830 context.on("enter.intro", function(mode) {
58831 if (mode.id === "draw-line") {
58833 } else if (mode.id === "select") {
58834 continueTo(retryIntersect);
58837 return chapter.restart();
58840 function continueTo(nextStep) {
58841 context.map().on("move.intro drawn.intro", null);
58842 context.history().on("change.intro", null);
58843 context.on("enter.intro", null);
58847 function isLineConnected() {
58848 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58849 if (!entity) return false;
58850 var drawNodes = context.graph().childNodes(entity);
58851 return drawNodes.some(function(node) {
58852 return context.graph().parentWays(node).some(function(parent) {
58853 return parent.id === flowerRoadID;
58857 function retryIntersect() {
58858 select_default2(window).on("pointerdown.intro mousedown.intro", eventCancel, true);
58859 var box = pad(tulipRoadIntersection, 80, context);
58862 helpHtml("intro.lines.retry_intersect", { name: _t("intro.graph.name.flower-street") })
58864 timeout2(chapter.restart, 3e3);
58866 function continueLine() {
58867 if (context.mode().id !== "draw-line") return chapter.restart();
58868 var entity = _tulipRoadID && context.hasEntity(_tulipRoadID);
58869 if (!entity) return chapter.restart();
58870 context.map().centerEase(tulipRoadIntersection, 500);
58871 var continueLineText = helpHtml("intro.lines.continue_line") + "{br}" + helpHtml("intro.lines.finish_line_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.lines.finish_road");
58872 reveal(".surface", continueLineText);
58873 context.on("enter.intro", function(mode) {
58874 if (mode.id === "draw-line") {
58876 } else if (mode.id === "select") {
58877 return continueTo(chooseCategoryRoad);
58879 return chapter.restart();
58882 function continueTo(nextStep) {
58883 context.on("enter.intro", null);
58887 function chooseCategoryRoad() {
58888 if (context.mode().id !== "select") return chapter.restart();
58889 context.on("exit.intro", function() {
58890 return chapter.restart();
58892 var button = context.container().select(".preset-category-road_minor .preset-list-button");
58893 if (button.empty()) return chapter.restart();
58894 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58895 timeout2(function() {
58896 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
58899 helpHtml("intro.lines.choose_category_road", { category: roadCategory.name() })
58901 button.on("click.intro", function() {
58902 continueTo(choosePresetResidential);
58905 function continueTo(nextStep) {
58906 context.container().select(".inspector-wrap").on("wheel.intro", null);
58907 context.container().select(".preset-list-button").on("click.intro", null);
58908 context.on("exit.intro", null);
58912 function choosePresetResidential() {
58913 if (context.mode().id !== "select") return chapter.restart();
58914 context.on("exit.intro", function() {
58915 return chapter.restart();
58917 var subgrid = context.container().select(".preset-category-road_minor .subgrid");
58918 if (subgrid.empty()) return chapter.restart();
58919 subgrid.selectAll(":not(.preset-highway-residential) .preset-list-button").on("click.intro", function() {
58920 continueTo(retryPresetResidential);
58922 subgrid.selectAll(".preset-highway-residential .preset-list-button").on("click.intro", function() {
58923 continueTo(nameRoad);
58925 timeout2(function() {
58928 helpHtml("intro.lines.choose_preset_residential", { preset: residentialPreset.name() }),
58929 { tooltipBox: ".preset-highway-residential .preset-list-button", duration: 300 }
58932 function continueTo(nextStep) {
58933 context.container().select(".preset-list-button").on("click.intro", null);
58934 context.on("exit.intro", null);
58938 function retryPresetResidential() {
58939 if (context.mode().id !== "select") return chapter.restart();
58940 context.on("exit.intro", function() {
58941 return chapter.restart();
58943 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
58944 timeout2(function() {
58945 var button = context.container().select(".entity-editor-pane .preset-list-button");
58948 helpHtml("intro.lines.retry_preset_residential", { preset: residentialPreset.name() })
58950 button.on("click.intro", function() {
58951 continueTo(chooseCategoryRoad);
58954 function continueTo(nextStep) {
58955 context.container().select(".inspector-wrap").on("wheel.intro", null);
58956 context.container().select(".preset-list-button").on("click.intro", null);
58957 context.on("exit.intro", null);
58961 function nameRoad() {
58962 context.on("exit.intro", function() {
58963 continueTo(didNameRoad);
58965 timeout2(function() {
58967 ".entity-editor-pane",
58968 helpHtml("intro.lines.name_road", { button: { html: icon("#iD-icon-close", "inline") } }),
58969 { tooltipClass: "intro-lines-name_road" }
58972 function continueTo(nextStep) {
58973 context.on("exit.intro", null);
58977 function didNameRoad() {
58978 context.history().checkpoint("doneAddLine");
58979 timeout2(function() {
58980 reveal(".surface", helpHtml("intro.lines.did_name_road"), {
58981 buttonText: _t.html("intro.ok"),
58982 buttonCallback: function() {
58983 continueTo(updateLine);
58987 function continueTo(nextStep) {
58991 function updateLine() {
58992 context.history().reset("doneAddLine");
58993 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
58994 return chapter.restart();
58996 var msec = transitionTime(woodRoadDragMidpoint, context.map().center());
58998 reveal(null, null, { duration: 0 });
59000 context.map().centerZoomEase(woodRoadDragMidpoint, 19, msec);
59001 timeout2(function() {
59002 var padding = 250 * Math.pow(2, context.map().zoom() - 19);
59003 var box = pad(woodRoadDragMidpoint, padding, context);
59004 var advance = function() {
59005 continueTo(addNode);
59009 helpHtml("intro.lines.update_line"),
59010 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59012 context.map().on("move.intro drawn.intro", function() {
59013 var padding2 = 250 * Math.pow(2, context.map().zoom() - 19);
59014 var box2 = pad(woodRoadDragMidpoint, padding2, context);
59017 helpHtml("intro.lines.update_line"),
59018 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59022 function continueTo(nextStep) {
59023 context.map().on("move.intro drawn.intro", null);
59027 function addNode() {
59028 context.history().reset("doneAddLine");
59029 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59030 return chapter.restart();
59032 var padding = 40 * Math.pow(2, context.map().zoom() - 19);
59033 var box = pad(woodRoadAddNode, padding, context);
59034 var addNodeString = helpHtml("intro.lines.add_node" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59035 reveal(box, addNodeString);
59036 context.map().on("move.intro drawn.intro", function() {
59037 var padding2 = 40 * Math.pow(2, context.map().zoom() - 19);
59038 var box2 = pad(woodRoadAddNode, padding2, context);
59039 reveal(box2, addNodeString, { duration: 0 });
59041 context.history().on("change.intro", function(changed) {
59042 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59043 return continueTo(updateLine);
59045 if (changed.created().length === 1) {
59046 timeout2(function() {
59047 continueTo(startDragEndpoint);
59051 context.on("enter.intro", function(mode) {
59052 if (mode.id !== "select") {
59053 continueTo(updateLine);
59056 function continueTo(nextStep) {
59057 context.map().on("move.intro drawn.intro", null);
59058 context.history().on("change.intro", null);
59059 context.on("enter.intro", null);
59063 function startDragEndpoint() {
59064 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59065 return continueTo(updateLine);
59067 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59068 var box = pad(woodRoadDragEndpoint, padding, context);
59069 var startDragString = helpHtml("intro.lines.start_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch")) + helpHtml("intro.lines.drag_to_intersection");
59070 reveal(box, startDragString);
59071 context.map().on("move.intro drawn.intro", function() {
59072 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59073 return continueTo(updateLine);
59075 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59076 var box2 = pad(woodRoadDragEndpoint, padding2, context);
59077 reveal(box2, startDragString, { duration: 0 });
59078 var entity = context.entity(woodRoadEndID);
59079 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) <= 4) {
59080 continueTo(finishDragEndpoint);
59083 function continueTo(nextStep) {
59084 context.map().on("move.intro drawn.intro", null);
59088 function finishDragEndpoint() {
59089 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59090 return continueTo(updateLine);
59092 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59093 var box = pad(woodRoadDragEndpoint, padding, context);
59094 var finishDragString = helpHtml("intro.lines.spot_looks_good") + helpHtml("intro.lines.finish_drag_endpoint" + (context.lastPointerType() === "mouse" ? "" : "_touch"));
59095 reveal(box, finishDragString);
59096 context.map().on("move.intro drawn.intro", function() {
59097 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59098 return continueTo(updateLine);
59100 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59101 var box2 = pad(woodRoadDragEndpoint, padding2, context);
59102 reveal(box2, finishDragString, { duration: 0 });
59103 var entity = context.entity(woodRoadEndID);
59104 if (geoSphericalDistance(entity.loc, woodRoadDragEndpoint) > 4) {
59105 continueTo(startDragEndpoint);
59108 context.on("enter.intro", function() {
59109 continueTo(startDragMidpoint);
59111 function continueTo(nextStep) {
59112 context.map().on("move.intro drawn.intro", null);
59113 context.on("enter.intro", null);
59117 function startDragMidpoint() {
59118 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59119 return continueTo(updateLine);
59121 if (context.selectedIDs().indexOf(woodRoadID) === -1) {
59122 context.enter(modeSelect(context, [woodRoadID]));
59124 var padding = 80 * Math.pow(2, context.map().zoom() - 19);
59125 var box = pad(woodRoadDragMidpoint, padding, context);
59126 reveal(box, helpHtml("intro.lines.start_drag_midpoint"));
59127 context.map().on("move.intro drawn.intro", function() {
59128 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59129 return continueTo(updateLine);
59131 var padding2 = 80 * Math.pow(2, context.map().zoom() - 19);
59132 var box2 = pad(woodRoadDragMidpoint, padding2, context);
59133 reveal(box2, helpHtml("intro.lines.start_drag_midpoint"), { duration: 0 });
59135 context.history().on("change.intro", function(changed) {
59136 if (changed.created().length === 1) {
59137 continueTo(continueDragMidpoint);
59140 context.on("enter.intro", function(mode) {
59141 if (mode.id !== "select") {
59142 context.enter(modeSelect(context, [woodRoadID]));
59145 function continueTo(nextStep) {
59146 context.map().on("move.intro drawn.intro", null);
59147 context.history().on("change.intro", null);
59148 context.on("enter.intro", null);
59152 function continueDragMidpoint() {
59153 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59154 return continueTo(updateLine);
59156 var padding = 100 * Math.pow(2, context.map().zoom() - 19);
59157 var box = pad(woodRoadDragEndpoint, padding, context);
59159 var advance = function() {
59160 context.history().checkpoint("doneUpdateLine");
59161 continueTo(deleteLines);
59165 helpHtml("intro.lines.continue_drag_midpoint"),
59166 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59168 context.map().on("move.intro drawn.intro", function() {
59169 if (!context.hasEntity(woodRoadID) || !context.hasEntity(woodRoadEndID)) {
59170 return continueTo(updateLine);
59172 var padding2 = 100 * Math.pow(2, context.map().zoom() - 19);
59173 var box2 = pad(woodRoadDragEndpoint, padding2, context);
59174 box2.height += 400;
59177 helpHtml("intro.lines.continue_drag_midpoint"),
59178 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59181 function continueTo(nextStep) {
59182 context.map().on("move.intro drawn.intro", null);
59186 function deleteLines() {
59187 context.history().reset("doneUpdateLine");
59188 context.enter(modeBrowse(context));
59189 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59190 return chapter.restart();
59192 var msec = transitionTime(deleteLinesLoc, context.map().center());
59194 reveal(null, null, { duration: 0 });
59196 context.map().centerZoomEase(deleteLinesLoc, 18, msec);
59197 timeout2(function() {
59198 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59199 var box = pad(deleteLinesLoc, padding, context);
59202 var advance = function() {
59203 continueTo(rightClickIntersection);
59207 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59208 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59210 context.map().on("move.intro drawn.intro", function() {
59211 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59212 var box2 = pad(deleteLinesLoc, padding2, context);
59214 box2.height += 400;
59217 helpHtml("intro.lines.delete_lines", { street: _t("intro.graph.name.12th-avenue") }),
59218 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59221 context.history().on("change.intro", function() {
59222 timeout2(function() {
59223 continueTo(deleteLines);
59227 function continueTo(nextStep) {
59228 context.map().on("move.intro drawn.intro", null);
59229 context.history().on("change.intro", null);
59233 function rightClickIntersection() {
59234 context.history().reset("doneUpdateLine");
59235 context.enter(modeBrowse(context));
59236 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59237 var rightClickString = helpHtml("intro.lines.split_street", {
59238 street1: _t("intro.graph.name.11th-avenue"),
59239 street2: _t("intro.graph.name.washington-street")
59240 }) + helpHtml("intro.lines." + (context.lastPointerType() === "mouse" ? "rightclick_intersection" : "edit_menu_intersection_touch"));
59241 timeout2(function() {
59242 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59243 var box = pad(eleventhAvenueEnd, padding, context);
59244 reveal(box, rightClickString);
59245 context.map().on("move.intro drawn.intro", function() {
59246 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59247 var box2 = pad(eleventhAvenueEnd, padding2, context);
59254 context.on("enter.intro", function(mode) {
59255 if (mode.id !== "select") return;
59256 var ids = context.selectedIDs();
59257 if (ids.length !== 1 || ids[0] !== eleventhAvenueEndID) return;
59258 timeout2(function() {
59259 var node = selectMenuItem(context, "split").node();
59261 continueTo(splitIntersection);
59264 context.history().on("change.intro", function() {
59265 timeout2(function() {
59266 continueTo(deleteLines);
59270 function continueTo(nextStep) {
59271 context.map().on("move.intro drawn.intro", null);
59272 context.on("enter.intro", null);
59273 context.history().on("change.intro", null);
59277 function splitIntersection() {
59278 if (!context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59279 return continueTo(deleteLines);
59281 var node = selectMenuItem(context, "split").node();
59283 return continueTo(rightClickIntersection);
59285 var wasChanged = false;
59286 _washingtonSegmentID = null;
59290 "intro.lines.split_intersection",
59291 { street: _t("intro.graph.name.washington-street") }
59295 context.map().on("move.intro drawn.intro", function() {
59296 var node2 = selectMenuItem(context, "split").node();
59297 if (!wasChanged && !node2) {
59298 return continueTo(rightClickIntersection);
59303 "intro.lines.split_intersection",
59304 { street: _t("intro.graph.name.washington-street") }
59306 { duration: 0, padding: 50 }
59309 context.history().on("change.intro", function(changed) {
59311 timeout2(function() {
59312 if (context.history().undoAnnotation() === _t("operations.split.annotation.line", { n: 1 })) {
59313 _washingtonSegmentID = changed.created()[0].id;
59314 continueTo(didSplit);
59316 _washingtonSegmentID = null;
59317 continueTo(retrySplit);
59321 function continueTo(nextStep) {
59322 context.map().on("move.intro drawn.intro", null);
59323 context.history().on("change.intro", null);
59327 function retrySplit() {
59328 context.enter(modeBrowse(context));
59329 context.map().centerZoomEase(eleventhAvenueEnd, 18, 500);
59330 var advance = function() {
59331 continueTo(rightClickIntersection);
59333 var padding = 60 * Math.pow(2, context.map().zoom() - 18);
59334 var box = pad(eleventhAvenueEnd, padding, context);
59337 helpHtml("intro.lines.retry_split"),
59338 { buttonText: _t.html("intro.ok"), buttonCallback: advance }
59340 context.map().on("move.intro drawn.intro", function() {
59341 var padding2 = 60 * Math.pow(2, context.map().zoom() - 18);
59342 var box2 = pad(eleventhAvenueEnd, padding2, context);
59345 helpHtml("intro.lines.retry_split"),
59346 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: advance }
59349 function continueTo(nextStep) {
59350 context.map().on("move.intro drawn.intro", null);
59354 function didSplit() {
59355 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59356 return continueTo(rightClickIntersection);
59358 var ids = context.selectedIDs();
59359 var string = "intro.lines.did_split_" + (ids.length > 1 ? "multi" : "single");
59360 var street = _t("intro.graph.name.washington-street");
59361 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59362 var box = pad(twelfthAvenue, padding, context);
59363 box.width = box.width / 2;
59366 helpHtml(string, { street1: street, street2: street }),
59369 timeout2(function() {
59370 context.map().centerZoomEase(twelfthAvenue, 18, 500);
59371 context.map().on("move.intro drawn.intro", function() {
59372 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59373 var box2 = pad(twelfthAvenue, padding2, context);
59374 box2.width = box2.width / 2;
59377 helpHtml(string, { street1: street, street2: street }),
59382 context.on("enter.intro", function() {
59383 var ids2 = context.selectedIDs();
59384 if (ids2.length === 1 && ids2[0] === _washingtonSegmentID) {
59385 continueTo(multiSelect2);
59388 context.history().on("change.intro", function() {
59389 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59390 return continueTo(rightClickIntersection);
59393 function continueTo(nextStep) {
59394 context.map().on("move.intro drawn.intro", null);
59395 context.on("enter.intro", null);
59396 context.history().on("change.intro", null);
59400 function multiSelect2() {
59401 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59402 return continueTo(rightClickIntersection);
59404 var ids = context.selectedIDs();
59405 var hasWashington = ids.indexOf(_washingtonSegmentID) !== -1;
59406 var hasTwelfth = ids.indexOf(twelfthAvenueID) !== -1;
59407 if (hasWashington && hasTwelfth) {
59408 return continueTo(multiRightClick);
59409 } else if (!hasWashington && !hasTwelfth) {
59410 return continueTo(didSplit);
59412 context.map().centerZoomEase(twelfthAvenue, 18, 500);
59413 timeout2(function() {
59414 var selected, other, padding, box;
59415 if (hasWashington) {
59416 selected = _t("intro.graph.name.washington-street");
59417 other = _t("intro.graph.name.12th-avenue");
59418 padding = 60 * Math.pow(2, context.map().zoom() - 18);
59419 box = pad(twelfthAvenueEnd, padding, context);
59422 selected = _t("intro.graph.name.12th-avenue");
59423 other = _t("intro.graph.name.washington-street");
59424 padding = 200 * Math.pow(2, context.map().zoom() - 18);
59425 box = pad(twelfthAvenue, padding, context);
59431 "intro.lines.multi_select",
59432 { selected, other1: other }
59433 ) + " " + helpHtml(
59434 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59435 { selected, other2: other }
59438 context.map().on("move.intro drawn.intro", function() {
59439 if (hasWashington) {
59440 selected = _t("intro.graph.name.washington-street");
59441 other = _t("intro.graph.name.12th-avenue");
59442 padding = 60 * Math.pow(2, context.map().zoom() - 18);
59443 box = pad(twelfthAvenueEnd, padding, context);
59446 selected = _t("intro.graph.name.12th-avenue");
59447 other = _t("intro.graph.name.washington-street");
59448 padding = 200 * Math.pow(2, context.map().zoom() - 18);
59449 box = pad(twelfthAvenue, padding, context);
59455 "intro.lines.multi_select",
59456 { selected, other1: other }
59457 ) + " " + helpHtml(
59458 "intro.lines.add_to_selection_" + (context.lastPointerType() === "mouse" ? "click" : "touch"),
59459 { selected, other2: other }
59464 context.on("enter.intro", function() {
59465 continueTo(multiSelect2);
59467 context.history().on("change.intro", function() {
59468 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59469 return continueTo(rightClickIntersection);
59473 function continueTo(nextStep) {
59474 context.map().on("move.intro drawn.intro", null);
59475 context.on("enter.intro", null);
59476 context.history().on("change.intro", null);
59480 function multiRightClick() {
59481 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59482 return continueTo(rightClickIntersection);
59484 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59485 var box = pad(twelfthAvenue, padding, context);
59486 var rightClickString = helpHtml("intro.lines.multi_select_success") + helpHtml("intro.lines.multi_" + (context.lastPointerType() === "mouse" ? "rightclick" : "edit_menu_touch"));
59487 reveal(box, rightClickString);
59488 context.map().on("move.intro drawn.intro", function() {
59489 var padding2 = 200 * Math.pow(2, context.map().zoom() - 18);
59490 var box2 = pad(twelfthAvenue, padding2, context);
59491 reveal(box2, rightClickString, { duration: 0 });
59493 context.ui().editMenu().on("toggled.intro", function(open) {
59495 timeout2(function() {
59496 var ids = context.selectedIDs();
59497 if (ids.length === 2 && ids.indexOf(twelfthAvenueID) !== -1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59498 var node = selectMenuItem(context, "delete").node();
59500 continueTo(multiDelete);
59501 } else if (ids.length === 1 && ids.indexOf(_washingtonSegmentID) !== -1) {
59502 return continueTo(multiSelect2);
59504 return continueTo(didSplit);
59508 context.history().on("change.intro", function() {
59509 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59510 return continueTo(rightClickIntersection);
59513 function continueTo(nextStep) {
59514 context.map().on("move.intro drawn.intro", null);
59515 context.ui().editMenu().on("toggled.intro", null);
59516 context.history().on("change.intro", null);
59520 function multiDelete() {
59521 if (!_washingtonSegmentID || !context.hasEntity(_washingtonSegmentID) || !context.hasEntity(washingtonStreetID) || !context.hasEntity(twelfthAvenueID) || !context.hasEntity(eleventhAvenueEndID)) {
59522 return continueTo(rightClickIntersection);
59524 var node = selectMenuItem(context, "delete").node();
59525 if (!node) return continueTo(multiRightClick);
59528 helpHtml("intro.lines.multi_delete"),
59531 context.map().on("move.intro drawn.intro", function() {
59534 helpHtml("intro.lines.multi_delete"),
59535 { duration: 0, padding: 50 }
59538 context.on("exit.intro", function() {
59539 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59540 return continueTo(multiSelect2);
59543 context.history().on("change.intro", function() {
59544 if (context.hasEntity(_washingtonSegmentID) || context.hasEntity(twelfthAvenueID)) {
59545 continueTo(retryDelete);
59550 function continueTo(nextStep) {
59551 context.map().on("move.intro drawn.intro", null);
59552 context.on("exit.intro", null);
59553 context.history().on("change.intro", null);
59557 function retryDelete() {
59558 context.enter(modeBrowse(context));
59559 var padding = 200 * Math.pow(2, context.map().zoom() - 18);
59560 var box = pad(twelfthAvenue, padding, context);
59561 reveal(box, helpHtml("intro.lines.retry_delete"), {
59562 buttonText: _t.html("intro.ok"),
59563 buttonCallback: function() {
59564 continueTo(multiSelect2);
59567 function continueTo(nextStep) {
59572 dispatch14.call("done");
59575 helpHtml("intro.lines.play", { next: _t("intro.buildings.title") }),
59577 tooltipBox: ".intro-nav-wrap .chapter-building",
59578 buttonText: _t.html("intro.ok"),
59579 buttonCallback: function() {
59580 reveal(".ideditor");
59585 chapter.enter = function() {
59588 chapter.exit = function() {
59589 timeouts.forEach(window.clearTimeout);
59590 select_default2(window).on("pointerdown.intro mousedown.intro", null, true);
59591 context.on("enter.intro exit.intro", null);
59592 context.map().on("move.intro drawn.intro", null);
59593 context.history().on("change.intro", null);
59594 context.container().select(".inspector-wrap").on("wheel.intro", null);
59595 context.container().select(".preset-list-button").on("click.intro", null);
59597 chapter.restart = function() {
59601 return utilRebind(chapter, dispatch14, "on");
59604 // modules/ui/intro/building.js
59605 function uiIntroBuilding(context, reveal) {
59606 var dispatch14 = dispatch_default("done");
59607 var house = [-85.62815, 41.95638];
59608 var tank = [-85.62732, 41.95347];
59609 var buildingCatetory = _mainPresetIndex.item("category-building");
59610 var housePreset = _mainPresetIndex.item("building/house");
59611 var tankPreset = _mainPresetIndex.item("man_made/storage_tank");
59613 var _houseID = null;
59614 var _tankID = null;
59616 title: "intro.buildings.title"
59618 function timeout2(f2, t2) {
59619 timeouts.push(window.setTimeout(f2, t2));
59621 function eventCancel(d3_event) {
59622 d3_event.stopPropagation();
59623 d3_event.preventDefault();
59625 function revealHouse(center, text, options2) {
59626 var padding = 160 * Math.pow(2, context.map().zoom() - 20);
59627 var box = pad(center, padding, context);
59628 reveal(box, text, options2);
59630 function revealTank(center, text, options2) {
59631 var padding = 190 * Math.pow(2, context.map().zoom() - 19.5);
59632 var box = pad(center, padding, context);
59633 reveal(box, text, options2);
59635 function addHouse() {
59636 context.enter(modeBrowse(context));
59637 context.history().reset("initial");
59639 var msec = transitionTime(house, context.map().center());
59641 reveal(null, null, { duration: 0 });
59643 context.map().centerZoomEase(house, 19, msec);
59644 timeout2(function() {
59645 var tooltip = reveal(
59647 helpHtml("intro.buildings.add_building")
59649 tooltip.selectAll(".popover-inner").insert("svg", "span").attr("class", "tooltip-illustration").append("use").attr("xlink:href", "#iD-graphic-buildings");
59650 context.on("enter.intro", function(mode) {
59651 if (mode.id !== "add-area") return;
59652 continueTo(startHouse);
59655 function continueTo(nextStep) {
59656 context.on("enter.intro", null);
59660 function startHouse() {
59661 if (context.mode().id !== "add-area") {
59662 return continueTo(addHouse);
59665 context.map().zoomEase(20, 500);
59666 timeout2(function() {
59667 var startString = helpHtml("intro.buildings.start_building") + helpHtml("intro.buildings.building_corner_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59668 revealHouse(house, startString);
59669 context.map().on("move.intro drawn.intro", function() {
59670 revealHouse(house, startString, { duration: 0 });
59672 context.on("enter.intro", function(mode) {
59673 if (mode.id !== "draw-area") return chapter.restart();
59674 continueTo(continueHouse);
59677 function continueTo(nextStep) {
59678 context.map().on("move.intro drawn.intro", null);
59679 context.on("enter.intro", null);
59683 function continueHouse() {
59684 if (context.mode().id !== "draw-area") {
59685 return continueTo(addHouse);
59688 var continueString = helpHtml("intro.buildings.continue_building") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_building");
59689 revealHouse(house, continueString);
59690 context.map().on("move.intro drawn.intro", function() {
59691 revealHouse(house, continueString, { duration: 0 });
59693 context.on("enter.intro", function(mode) {
59694 if (mode.id === "draw-area") {
59696 } else if (mode.id === "select") {
59697 var graph = context.graph();
59698 var way = context.entity(context.selectedIDs()[0]);
59699 var nodes = graph.childNodes(way);
59700 var points = utilArrayUniq(nodes).map(function(n3) {
59701 return context.projection(n3.loc);
59703 if (isMostlySquare(points)) {
59705 return continueTo(chooseCategoryBuilding);
59707 return continueTo(retryHouse);
59710 return chapter.restart();
59713 function continueTo(nextStep) {
59714 context.map().on("move.intro drawn.intro", null);
59715 context.on("enter.intro", null);
59719 function retryHouse() {
59720 var onClick = function() {
59721 continueTo(addHouse);
59725 helpHtml("intro.buildings.retry_building"),
59726 { buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59728 context.map().on("move.intro drawn.intro", function() {
59731 helpHtml("intro.buildings.retry_building"),
59732 { duration: 0, buttonText: _t.html("intro.ok"), buttonCallback: onClick }
59735 function continueTo(nextStep) {
59736 context.map().on("move.intro drawn.intro", null);
59740 function chooseCategoryBuilding() {
59741 if (!_houseID || !context.hasEntity(_houseID)) {
59744 var ids = context.selectedIDs();
59745 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59746 context.enter(modeSelect(context, [_houseID]));
59748 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59749 timeout2(function() {
59750 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59751 var button = context.container().select(".preset-category-building .preset-list-button");
59754 helpHtml("intro.buildings.choose_category_building", { category: buildingCatetory.name() })
59756 button.on("click.intro", function() {
59757 button.on("click.intro", null);
59758 continueTo(choosePresetHouse);
59761 context.on("enter.intro", function(mode) {
59762 if (!_houseID || !context.hasEntity(_houseID)) {
59763 return continueTo(addHouse);
59765 var ids2 = context.selectedIDs();
59766 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59767 return continueTo(chooseCategoryBuilding);
59770 function continueTo(nextStep) {
59771 context.container().select(".inspector-wrap").on("wheel.intro", null);
59772 context.container().select(".preset-list-button").on("click.intro", null);
59773 context.on("enter.intro", null);
59777 function choosePresetHouse() {
59778 if (!_houseID || !context.hasEntity(_houseID)) {
59781 var ids = context.selectedIDs();
59782 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59783 context.enter(modeSelect(context, [_houseID]));
59785 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
59786 timeout2(function() {
59787 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
59788 var button = context.container().select(".preset-building-house .preset-list-button");
59791 helpHtml("intro.buildings.choose_preset_house", { preset: housePreset.name() }),
59794 button.on("click.intro", function() {
59795 button.on("click.intro", null);
59796 continueTo(closeEditorHouse);
59799 context.on("enter.intro", function(mode) {
59800 if (!_houseID || !context.hasEntity(_houseID)) {
59801 return continueTo(addHouse);
59803 var ids2 = context.selectedIDs();
59804 if (mode.id !== "select" || !ids2.length || ids2[0] !== _houseID) {
59805 return continueTo(chooseCategoryBuilding);
59808 function continueTo(nextStep) {
59809 context.container().select(".inspector-wrap").on("wheel.intro", null);
59810 context.container().select(".preset-list-button").on("click.intro", null);
59811 context.on("enter.intro", null);
59815 function closeEditorHouse() {
59816 if (!_houseID || !context.hasEntity(_houseID)) {
59819 var ids = context.selectedIDs();
59820 if (context.mode().id !== "select" || !ids.length || ids[0] !== _houseID) {
59821 context.enter(modeSelect(context, [_houseID]));
59823 context.history().checkpoint("hasHouse");
59824 context.on("exit.intro", function() {
59825 continueTo(rightClickHouse);
59827 timeout2(function() {
59829 ".entity-editor-pane",
59830 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
59833 function continueTo(nextStep) {
59834 context.on("exit.intro", null);
59838 function rightClickHouse() {
59839 if (!_houseID) return chapter.restart();
59840 context.enter(modeBrowse(context));
59841 context.history().reset("hasHouse");
59842 var zoom = context.map().zoom();
59846 context.map().centerZoomEase(house, zoom, 500);
59847 context.on("enter.intro", function(mode) {
59848 if (mode.id !== "select") return;
59849 var ids = context.selectedIDs();
59850 if (ids.length !== 1 || ids[0] !== _houseID) return;
59851 timeout2(function() {
59852 var node = selectMenuItem(context, "orthogonalize").node();
59854 continueTo(clickSquare);
59857 context.map().on("move.intro drawn.intro", function() {
59858 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_building" : "edit_menu_building_touch"));
59859 revealHouse(house, rightclickString, { duration: 0 });
59861 context.history().on("change.intro", function() {
59862 continueTo(rightClickHouse);
59864 function continueTo(nextStep) {
59865 context.on("enter.intro", null);
59866 context.map().on("move.intro drawn.intro", null);
59867 context.history().on("change.intro", null);
59871 function clickSquare() {
59872 if (!_houseID) return chapter.restart();
59873 var entity = context.hasEntity(_houseID);
59874 if (!entity) return continueTo(rightClickHouse);
59875 var node = selectMenuItem(context, "orthogonalize").node();
59877 return continueTo(rightClickHouse);
59879 var wasChanged = false;
59882 helpHtml("intro.buildings.square_building"),
59885 context.on("enter.intro", function(mode) {
59886 if (mode.id === "browse") {
59887 continueTo(rightClickHouse);
59888 } else if (mode.id === "move" || mode.id === "rotate") {
59889 continueTo(retryClickSquare);
59892 context.map().on("move.intro", function() {
59893 var node2 = selectMenuItem(context, "orthogonalize").node();
59894 if (!wasChanged && !node2) {
59895 return continueTo(rightClickHouse);
59899 helpHtml("intro.buildings.square_building"),
59900 { duration: 0, padding: 50 }
59903 context.history().on("change.intro", function() {
59905 context.history().on("change.intro", null);
59906 timeout2(function() {
59907 if (context.history().undoAnnotation() === _t("operations.orthogonalize.annotation.feature", { n: 1 })) {
59908 continueTo(doneSquare);
59910 continueTo(retryClickSquare);
59914 function continueTo(nextStep) {
59915 context.on("enter.intro", null);
59916 context.map().on("move.intro", null);
59917 context.history().on("change.intro", null);
59921 function retryClickSquare() {
59922 context.enter(modeBrowse(context));
59923 revealHouse(house, helpHtml("intro.buildings.retry_square"), {
59924 buttonText: _t.html("intro.ok"),
59925 buttonCallback: function() {
59926 continueTo(rightClickHouse);
59929 function continueTo(nextStep) {
59933 function doneSquare() {
59934 context.history().checkpoint("doneSquare");
59935 revealHouse(house, helpHtml("intro.buildings.done_square"), {
59936 buttonText: _t.html("intro.ok"),
59937 buttonCallback: function() {
59938 continueTo(addTank);
59941 function continueTo(nextStep) {
59945 function addTank() {
59946 context.enter(modeBrowse(context));
59947 context.history().reset("doneSquare");
59949 var msec = transitionTime(tank, context.map().center());
59951 reveal(null, null, { duration: 0 });
59953 context.map().centerZoomEase(tank, 19.5, msec);
59954 timeout2(function() {
59957 helpHtml("intro.buildings.add_tank")
59959 context.on("enter.intro", function(mode) {
59960 if (mode.id !== "add-area") return;
59961 continueTo(startTank);
59964 function continueTo(nextStep) {
59965 context.on("enter.intro", null);
59969 function startTank() {
59970 if (context.mode().id !== "add-area") {
59971 return continueTo(addTank);
59974 timeout2(function() {
59975 var startString = helpHtml("intro.buildings.start_tank") + helpHtml("intro.buildings.tank_edge_" + (context.lastPointerType() === "mouse" ? "click" : "tap"));
59976 revealTank(tank, startString);
59977 context.map().on("move.intro drawn.intro", function() {
59978 revealTank(tank, startString, { duration: 0 });
59980 context.on("enter.intro", function(mode) {
59981 if (mode.id !== "draw-area") return chapter.restart();
59982 continueTo(continueTank);
59985 function continueTo(nextStep) {
59986 context.map().on("move.intro drawn.intro", null);
59987 context.on("enter.intro", null);
59991 function continueTank() {
59992 if (context.mode().id !== "draw-area") {
59993 return continueTo(addTank);
59996 var continueString = helpHtml("intro.buildings.continue_tank") + "{br}" + helpHtml("intro.areas.finish_area_" + (context.lastPointerType() === "mouse" ? "click" : "tap")) + helpHtml("intro.buildings.finish_tank");
59997 revealTank(tank, continueString);
59998 context.map().on("move.intro drawn.intro", function() {
59999 revealTank(tank, continueString, { duration: 0 });
60001 context.on("enter.intro", function(mode) {
60002 if (mode.id === "draw-area") {
60004 } else if (mode.id === "select") {
60005 _tankID = context.selectedIDs()[0];
60006 return continueTo(searchPresetTank);
60008 return continueTo(addTank);
60011 function continueTo(nextStep) {
60012 context.map().on("move.intro drawn.intro", null);
60013 context.on("enter.intro", null);
60017 function searchPresetTank() {
60018 if (!_tankID || !context.hasEntity(_tankID)) {
60021 var ids = context.selectedIDs();
60022 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60023 context.enter(modeSelect(context, [_tankID]));
60025 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60026 timeout2(function() {
60027 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60028 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60030 ".preset-search-input",
60031 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60034 context.on("enter.intro", function(mode) {
60035 if (!_tankID || !context.hasEntity(_tankID)) {
60036 return continueTo(addTank);
60038 var ids2 = context.selectedIDs();
60039 if (mode.id !== "select" || !ids2.length || ids2[0] !== _tankID) {
60040 context.enter(modeSelect(context, [_tankID]));
60041 context.container().select(".inspector-wrap .panewrap").style("right", "-100%");
60042 context.container().select(".inspector-wrap").on("wheel.intro", eventCancel);
60043 context.container().select(".preset-search-input").on("keydown.intro", null).on("keyup.intro", checkPresetSearch);
60045 ".preset-search-input",
60046 helpHtml("intro.buildings.search_tank", { preset: tankPreset.name() })
60048 context.history().on("change.intro", null);
60051 function checkPresetSearch() {
60052 var first = context.container().select(".preset-list-item:first-child");
60053 if (first.classed("preset-man_made-storage_tank")) {
60055 first.select(".preset-list-button").node(),
60056 helpHtml("intro.buildings.choose_tank", { preset: tankPreset.name() }),
60059 context.container().select(".preset-search-input").on("keydown.intro", eventCancel, true).on("keyup.intro", null);
60060 context.history().on("change.intro", function() {
60061 continueTo(closeEditorTank);
60065 function continueTo(nextStep) {
60066 context.container().select(".inspector-wrap").on("wheel.intro", null);
60067 context.on("enter.intro", null);
60068 context.history().on("change.intro", null);
60069 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60073 function closeEditorTank() {
60074 if (!_tankID || !context.hasEntity(_tankID)) {
60077 var ids = context.selectedIDs();
60078 if (context.mode().id !== "select" || !ids.length || ids[0] !== _tankID) {
60079 context.enter(modeSelect(context, [_tankID]));
60081 context.history().checkpoint("hasTank");
60082 context.on("exit.intro", function() {
60083 continueTo(rightClickTank);
60085 timeout2(function() {
60087 ".entity-editor-pane",
60088 helpHtml("intro.buildings.close", { button: { html: icon("#iD-icon-close", "inline") } })
60091 function continueTo(nextStep) {
60092 context.on("exit.intro", null);
60096 function rightClickTank() {
60097 if (!_tankID) return continueTo(addTank);
60098 context.enter(modeBrowse(context));
60099 context.history().reset("hasTank");
60100 context.map().centerEase(tank, 500);
60101 timeout2(function() {
60102 context.on("enter.intro", function(mode) {
60103 if (mode.id !== "select") return;
60104 var ids = context.selectedIDs();
60105 if (ids.length !== 1 || ids[0] !== _tankID) return;
60106 timeout2(function() {
60107 var node = selectMenuItem(context, "circularize").node();
60109 continueTo(clickCircle);
60112 var rightclickString = helpHtml("intro.buildings." + (context.lastPointerType() === "mouse" ? "rightclick_tank" : "edit_menu_tank_touch"));
60113 revealTank(tank, rightclickString);
60114 context.map().on("move.intro drawn.intro", function() {
60115 revealTank(tank, rightclickString, { duration: 0 });
60117 context.history().on("change.intro", function() {
60118 continueTo(rightClickTank);
60121 function continueTo(nextStep) {
60122 context.on("enter.intro", null);
60123 context.map().on("move.intro drawn.intro", null);
60124 context.history().on("change.intro", null);
60128 function clickCircle() {
60129 if (!_tankID) return chapter.restart();
60130 var entity = context.hasEntity(_tankID);
60131 if (!entity) return continueTo(rightClickTank);
60132 var node = selectMenuItem(context, "circularize").node();
60134 return continueTo(rightClickTank);
60136 var wasChanged = false;
60139 helpHtml("intro.buildings.circle_tank"),
60142 context.on("enter.intro", function(mode) {
60143 if (mode.id === "browse") {
60144 continueTo(rightClickTank);
60145 } else if (mode.id === "move" || mode.id === "rotate") {
60146 continueTo(retryClickCircle);
60149 context.map().on("move.intro", function() {
60150 var node2 = selectMenuItem(context, "circularize").node();
60151 if (!wasChanged && !node2) {
60152 return continueTo(rightClickTank);
60156 helpHtml("intro.buildings.circle_tank"),
60157 { duration: 0, padding: 50 }
60160 context.history().on("change.intro", function() {
60162 context.history().on("change.intro", null);
60163 timeout2(function() {
60164 if (context.history().undoAnnotation() === _t("operations.circularize.annotation.feature", { n: 1 })) {
60167 continueTo(retryClickCircle);
60171 function continueTo(nextStep) {
60172 context.on("enter.intro", null);
60173 context.map().on("move.intro", null);
60174 context.history().on("change.intro", null);
60178 function retryClickCircle() {
60179 context.enter(modeBrowse(context));
60180 revealTank(tank, helpHtml("intro.buildings.retry_circle"), {
60181 buttonText: _t.html("intro.ok"),
60182 buttonCallback: function() {
60183 continueTo(rightClickTank);
60186 function continueTo(nextStep) {
60191 dispatch14.call("done");
60194 helpHtml("intro.buildings.play", { next: _t("intro.startediting.title") }),
60196 tooltipBox: ".intro-nav-wrap .chapter-startEditing",
60197 buttonText: _t.html("intro.ok"),
60198 buttonCallback: function() {
60199 reveal(".ideditor");
60204 chapter.enter = function() {
60207 chapter.exit = function() {
60208 timeouts.forEach(window.clearTimeout);
60209 context.on("enter.intro exit.intro", null);
60210 context.map().on("move.intro drawn.intro", null);
60211 context.history().on("change.intro", null);
60212 context.container().select(".inspector-wrap").on("wheel.intro", null);
60213 context.container().select(".preset-search-input").on("keydown.intro keyup.intro", null);
60214 context.container().select(".more-fields .combobox-input").on("click.intro", null);
60216 chapter.restart = function() {
60220 return utilRebind(chapter, dispatch14, "on");
60223 // modules/ui/intro/start_editing.js
60224 function uiIntroStartEditing(context, reveal) {
60225 var dispatch14 = dispatch_default("done", "startEditing");
60226 var modalSelection = select_default2(null);
60228 title: "intro.startediting.title"
60230 function showHelp() {
60232 ".map-control.help-control",
60233 helpHtml("intro.startediting.help"),
60235 buttonText: _t.html("intro.ok"),
60236 buttonCallback: function() {
60242 function shortcuts() {
60244 ".map-control.help-control",
60245 helpHtml("intro.startediting.shortcuts"),
60247 buttonText: _t.html("intro.ok"),
60248 buttonCallback: function() {
60254 function showSave() {
60255 context.container().selectAll(".shaded").remove();
60257 ".top-toolbar button.save",
60258 helpHtml("intro.startediting.save"),
60260 buttonText: _t.html("intro.ok"),
60261 buttonCallback: function() {
60267 function showStart() {
60268 context.container().selectAll(".shaded").remove();
60269 modalSelection = uiModal(context.container());
60270 modalSelection.select(".modal").attr("class", "modal-splash modal");
60271 modalSelection.selectAll(".close").remove();
60272 var startbutton = modalSelection.select(".content").attr("class", "fillL").append("button").attr("class", "modal-section huge-modal-button").on("click", function() {
60273 modalSelection.remove();
60275 startbutton.append("svg").attr("class", "illustration").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60276 startbutton.append("h2").call(_t.append("intro.startediting.start"));
60277 dispatch14.call("startEditing");
60279 chapter.enter = function() {
60282 chapter.exit = function() {
60283 modalSelection.remove();
60284 context.container().selectAll(".shaded").remove();
60286 return utilRebind(chapter, dispatch14, "on");
60289 // modules/ui/intro/intro.js
60291 welcome: uiIntroWelcome,
60292 navigation: uiIntroNavigation,
60293 point: uiIntroPoint,
60296 building: uiIntroBuilding,
60297 startEditing: uiIntroStartEditing
60299 var chapterFlow = [
60308 function uiIntro(context) {
60309 const INTRO_IMAGERY = "EsriWorldImageryClarity";
60310 let _introGraph = {};
60312 function intro(selection2) {
60313 _mainFileFetcher.get("intro_graph").then((dataIntroGraph) => {
60314 for (let id2 in dataIntroGraph) {
60315 if (!_introGraph[id2]) {
60316 _introGraph[id2] = osmEntity(localize(dataIntroGraph[id2]));
60319 selection2.call(startIntro);
60320 }).catch(function() {
60323 function startIntro(selection2) {
60324 context.enter(modeBrowse(context));
60325 let osm = context.connection();
60326 let history = context.history().toJSON();
60327 let hash = window.location.hash;
60328 let center = context.map().center();
60329 let zoom = context.map().zoom();
60330 let background = context.background().baseLayerSource();
60331 let overlays = context.background().overlayLayerSources();
60332 let opacity = context.container().selectAll(".main-map .layer-background").style("opacity");
60333 let caches = osm && osm.caches();
60334 let baseEntities = context.history().graph().base().entities;
60335 context.ui().sidebar.expand();
60336 context.container().selectAll("button.sidebar-toggle").classed("disabled", true);
60337 context.inIntro(true);
60339 osm.toggle(false).reset();
60341 context.history().reset();
60342 context.history().merge(Object.values(coreGraph().load(_introGraph).entities));
60343 context.history().checkpoint("initial");
60344 let imagery = context.background().findSource(INTRO_IMAGERY);
60346 context.background().baseLayerSource(imagery);
60348 context.background().bing();
60350 overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60351 let layers = context.layers();
60352 layers.all().forEach((item) => {
60353 if (typeof item.layer.enabled === "function") {
60354 item.layer.enabled(item.id === "osm");
60357 context.container().selectAll(".main-map .layer-background").style("opacity", 1);
60358 let curtain = uiCurtain(context.container().node());
60359 selection2.call(curtain);
60360 corePreferences("walkthrough_started", "yes");
60361 let storedProgress = corePreferences("walkthrough_progress") || "";
60362 let progress = storedProgress.split(";").filter(Boolean);
60363 let chapters = chapterFlow.map((chapter, i3) => {
60364 let s2 = chapterUi[chapter](context, curtain.reveal).on("done", () => {
60365 buttons.filter((d2) => d2.title === s2.title).classed("finished", true);
60366 if (i3 < chapterFlow.length - 1) {
60367 const next = chapterFlow[i3 + 1];
60368 context.container().select("button.chapter-".concat(next)).classed("next", true);
60370 progress.push(chapter);
60371 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60375 chapters[chapters.length - 1].on("startEditing", () => {
60376 progress.push("startEditing");
60377 corePreferences("walkthrough_progress", utilArrayUniq(progress).join(";"));
60378 let incomplete = utilArrayDifference(chapterFlow, progress);
60379 if (!incomplete.length) {
60380 corePreferences("walkthrough_completed", "yes");
60384 context.container().selectAll(".main-map .layer-background").style("opacity", opacity);
60385 context.container().selectAll("button.sidebar-toggle").classed("disabled", false);
60387 osm.toggle(true).reset().caches(caches);
60389 context.history().reset().merge(Object.values(baseEntities));
60390 context.background().baseLayerSource(background);
60391 overlays.forEach((d2) => context.background().toggleOverlayLayer(d2));
60393 context.history().fromJSON(history, false);
60395 context.map().centerZoom(center, zoom);
60396 window.location.replace(hash);
60397 context.inIntro(false);
60399 let navwrap = selection2.append("div").attr("class", "intro-nav-wrap fillD");
60400 navwrap.append("svg").attr("class", "intro-nav-wrap-logo").append("use").attr("xlink:href", "#iD-logo-walkthrough");
60401 let buttonwrap = navwrap.append("div").attr("class", "joined").selectAll("button.chapter");
60402 let buttons = buttonwrap.data(chapters).enter().append("button").attr("class", (d2, i3) => "chapter chapter-".concat(chapterFlow[i3])).on("click", enterChapter);
60403 buttons.append("span").html((d2) => _t.html(d2.title));
60404 buttons.append("span").attr("class", "status").call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
60405 enterChapter(null, chapters[0]);
60406 function enterChapter(d3_event, newChapter) {
60407 if (_currChapter) {
60408 _currChapter.exit();
60410 context.enter(modeBrowse(context));
60411 _currChapter = newChapter;
60412 _currChapter.enter();
60413 buttons.classed("next", false).classed("active", (d2) => d2.title === _currChapter.title);
60419 // modules/ui/issues_info.js
60420 function uiIssuesInfo(context) {
60421 var warningsItem = {
60424 iconID: "iD-icon-alert",
60425 descriptionID: "issues.warnings_and_errors"
60427 var resolvedItem = {
60430 iconID: "iD-icon-apply",
60431 descriptionID: "issues.user_resolved_issues"
60433 function update(selection2) {
60434 var shownItems = [];
60435 var liveIssues = context.validator().getIssues({
60436 what: corePreferences("validate-what") || "edited",
60437 where: corePreferences("validate-where") || "all"
60439 if (liveIssues.length) {
60440 warningsItem.count = liveIssues.length;
60441 shownItems.push(warningsItem);
60443 if (corePreferences("validate-what") === "all") {
60444 var resolvedIssues = context.validator().getResolvedIssues();
60445 if (resolvedIssues.length) {
60446 resolvedItem.count = resolvedIssues.length;
60447 shownItems.push(resolvedItem);
60450 var chips = selection2.selectAll(".chip").data(shownItems, function(d2) {
60453 chips.exit().remove();
60454 var enter = chips.enter().append("a").attr("class", function(d2) {
60455 return "chip " + d2.id + "-count";
60456 }).attr("href", "#").each(function(d2) {
60457 var chipSelection = select_default2(this);
60458 var tooltipBehavior = uiTooltip().placement("top").title(() => _t.append(d2.descriptionID));
60459 chipSelection.call(tooltipBehavior).on("click", function(d3_event) {
60460 d3_event.preventDefault();
60461 tooltipBehavior.hide(select_default2(this));
60462 context.ui().togglePanes(context.container().select(".map-panes .issues-pane"));
60464 chipSelection.call(svgIcon("#" + d2.iconID));
60466 enter.append("span").attr("class", "count");
60467 enter.merge(chips).selectAll("span.count").text(function(d2) {
60468 return d2.count.toString();
60471 return function(selection2) {
60472 update(selection2);
60473 context.validator().on("validated.infobox", function() {
60474 update(selection2);
60479 // modules/renderer/background_source.js
60480 var import_lodash4 = __toESM(require_lodash());
60482 // modules/util/IntervalTasksQueue.js
60483 var IntervalTasksQueue = class {
60485 * Interval in milliseconds inside which only 1 task can execute.
60486 * e.g. if interval is 200ms, and 5 async tasks are unqueued,
60487 * they will complete in ~1s if not cleared
60488 * @param {number} intervalInMs
60490 constructor(intervalInMs) {
60491 this.intervalInMs = intervalInMs;
60492 this.pendingHandles = [];
60496 let taskTimeout = this.time;
60497 this.time += this.intervalInMs;
60498 this.pendingHandles.push(setTimeout(() => {
60499 this.time -= this.intervalInMs;
60504 this.pendingHandles.forEach((timeoutHandle) => {
60505 clearTimeout(timeoutHandle);
60507 this.pendingHandles = [];
60512 // modules/renderer/background_source.js
60513 var isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
60514 window.matchMedia("\n (-webkit-min-device-pixel-ratio: 2), /* Safari */\n (min-resolution: 2dppx), /* standard */\n (min-resolution: 192dpi) /* fallback */\n ").addListener(function() {
60515 isRetina = window.devicePixelRatio && window.devicePixelRatio >= 2;
60517 function localeDateString(s2) {
60518 if (!s2) return null;
60519 var options2 = { day: "numeric", month: "short", year: "numeric" };
60520 var d2 = new Date(s2);
60521 if (isNaN(d2.getTime())) return null;
60522 return d2.toLocaleDateString(_mainLocalizer.localeCode(), options2);
60524 function vintageRange(vintage) {
60526 if (vintage.start || vintage.end) {
60527 s2 = vintage.start || "?";
60528 if (vintage.start !== vintage.end) {
60529 s2 += " - " + (vintage.end || "?");
60534 function rendererBackgroundSource(data) {
60535 var source = Object.assign({}, data);
60536 var _offset = [0, 0];
60537 var _name = source.name;
60538 var _description = source.description;
60539 var _best = !!source.best;
60540 var _template = source.encrypted ? utilAesDecrypt(source.template) : source.template;
60541 source.tileSize = data.tileSize || 256;
60542 source.zoomExtent = data.zoomExtent || [0, 22];
60543 source.overzoom = data.overzoom !== false;
60544 source.offset = function(val) {
60545 if (!arguments.length) return _offset;
60549 source.nudge = function(val, zoomlevel) {
60550 _offset[0] += val[0] / Math.pow(2, zoomlevel);
60551 _offset[1] += val[1] / Math.pow(2, zoomlevel);
60554 source.name = function() {
60555 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60556 return _t("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
60558 source.label = function() {
60559 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60560 return _t.append("imagery." + id_safe + ".name", { default: (0, import_lodash4.escape)(_name) });
60562 source.hasDescription = function() {
60563 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60564 var descriptionText = _mainLocalizer.tInfo("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) }).text;
60565 return descriptionText !== "";
60567 source.description = function() {
60568 var id_safe = source.id.replace(/\./g, "<TX_DOT>");
60569 return _t.append("imagery." + id_safe + ".description", { default: (0, import_lodash4.escape)(_description) });
60571 source.best = function() {
60574 source.area = function() {
60575 if (!data.polygon) return Number.MAX_VALUE;
60576 var area = area_default({ type: "MultiPolygon", coordinates: [data.polygon] });
60577 return isNaN(area) ? 0 : area;
60579 source.imageryUsed = function() {
60580 return _name || source.id;
60582 source.template = function(val) {
60583 if (!arguments.length) return _template;
60584 if (source.id === "custom" || source.id === "Bing") {
60589 source.url = function(coord2) {
60590 var result = _template.replace(/#[\s\S]*/u, "");
60591 if (result === "") return result;
60592 if (!source.type || source.id === "custom") {
60593 if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) {
60594 source.type = "wms";
60595 source.projection = "EPSG:3857";
60596 } else if (/\{(x|y)\}/.test(result)) {
60597 source.type = "tms";
60598 } else if (/\{u\}/.test(result)) {
60599 source.type = "bing";
60602 if (source.type === "wms") {
60603 var tileToProjectedCoords = function(x2, y2, z2) {
60604 var zoomSize = Math.pow(2, z2);
60605 var lon = x2 / zoomSize * Math.PI * 2 - Math.PI;
60606 var lat = Math.atan(Math.sinh(Math.PI * (1 - 2 * y2 / zoomSize)));
60607 switch (source.projection) {
60610 x: lon * 180 / Math.PI,
60611 y: lat * 180 / Math.PI
60614 var mercCoords = mercatorRaw(lon, lat);
60616 x: 2003750834e-2 / Math.PI * mercCoords[0],
60617 y: 2003750834e-2 / Math.PI * mercCoords[1]
60621 var tileSize = source.tileSize;
60622 var projection2 = source.projection;
60623 var minXmaxY = tileToProjectedCoords(coord2[0], coord2[1], coord2[2]);
60624 var maxXminY = tileToProjectedCoords(coord2[0] + 1, coord2[1] + 1, coord2[2]);
60625 result = result.replace(/\{(\w+)\}/g, function(token, key) {
60631 return projection2;
60633 return projection2.replace(/^EPSG:/, "");
60635 if (projection2 === "EPSG:4326" && // The CRS parameter implies version 1.3 (prior versions use SRS)
60636 /VERSION=1.3|CRS={proj}/.test(source.template().toUpperCase())) {
60637 return maxXminY.y + "," + minXmaxY.x + "," + minXmaxY.y + "," + maxXminY.x;
60639 return minXmaxY.x + "," + maxXminY.y + "," + maxXminY.x + "," + minXmaxY.y;
60653 } else if (source.type === "tms") {
60654 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" : "");
60655 } else if (source.type === "bing") {
60656 result = result.replace("{u}", function() {
60658 for (var zoom = coord2[2]; zoom > 0; zoom--) {
60660 var mask = 1 << zoom - 1;
60661 if ((coord2[0] & mask) !== 0) b2++;
60662 if ((coord2[1] & mask) !== 0) b2 += 2;
60663 u2 += b2.toString();
60668 result = result.replace(/\{switch:([^}]+)\}/, function(s2, r2) {
60669 var subdomains = r2.split(",");
60670 return subdomains[(coord2[0] + coord2[1]) % subdomains.length];
60674 source.validZoom = function(z2) {
60675 return source.zoomExtent[0] <= z2 && (source.overzoom || source.zoomExtent[1] > z2);
60677 source.isLocatorOverlay = function() {
60678 return source.id === "mapbox_locator_overlay";
60680 source.isHidden = function() {
60681 return source.id === "DigitalGlobe-Premium-vintage" || source.id === "DigitalGlobe-Standard-vintage";
60683 source.copyrightNotices = function() {
60685 source.getMetadata = function(center, tileCoord, callback) {
60687 start: localeDateString(source.startDate),
60688 end: localeDateString(source.endDate)
60690 vintage.range = vintageRange(vintage);
60691 var metadata = { vintage };
60692 callback(null, metadata);
60696 rendererBackgroundSource.Bing = function(data, dispatch14) {
60697 data.template = "https://ecn.t{switch:0,1,2,3}.tiles.virtualearth.net/tiles/a{u}.jpeg?g=1&pr=odbl&n=z";
60698 var bing = rendererBackgroundSource(data);
60699 var key = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
60700 const strictParam = "n";
60701 var url = "https://dev.virtualearth.net/REST/v1/Imagery/Metadata/AerialOSM?include=ImageryProviders&uriScheme=https&key=" + key;
60704 var providers = [];
60705 var taskQueue = new IntervalTasksQueue(250);
60706 var metadataLastZoom = -1;
60707 json_default(url).then(function(json) {
60708 let imageryResource = json.resourceSets[0].resources[0];
60709 let template = imageryResource.imageUrl;
60710 let subDomains = imageryResource.imageUrlSubdomains;
60711 let subDomainNumbers = subDomains.map((subDomain) => {
60712 return subDomain.substring(1);
60714 template = template.replace("{subdomain}", "t{switch:".concat(subDomainNumbers, "}")).replace("{quadkey}", "{u}");
60715 if (!new URLSearchParams(template).has(strictParam)) {
60716 template += "&".concat(strictParam, "=z");
60718 bing.template(template);
60719 providers = imageryResource.imageryProviders.map(function(provider) {
60721 attribution: provider.attribution,
60722 areas: provider.coverageAreas.map(function(area) {
60724 zoom: [area.zoomMin, area.zoomMax],
60725 extent: geoExtent([area.bbox[1], area.bbox[0]], [area.bbox[3], area.bbox[2]])
60730 dispatch14.call("change");
60731 }).catch(function() {
60733 bing.copyrightNotices = function(zoom, extent) {
60734 zoom = Math.min(zoom, 21);
60735 return providers.filter(function(provider) {
60736 return provider.areas.some(function(area) {
60737 return extent.intersects(area.extent) && area.zoom[0] <= zoom && area.zoom[1] >= zoom;
60739 }).map(function(provider) {
60740 return provider.attribution;
60743 bing.getMetadata = function(center, tileCoord, callback) {
60744 var tileID = tileCoord.slice(0, 3).join("/");
60745 var zoom = Math.min(tileCoord[2], 21);
60746 var centerPoint = center[1] + "," + center[0];
60747 var url2 = "https://dev.virtualearth.net/REST/v1/Imagery/BasicMetadata/AerialOSM/" + centerPoint + "?zl=" + zoom + "&key=" + key;
60748 if (inflight[tileID]) return;
60749 if (!cache[tileID]) {
60750 cache[tileID] = {};
60752 if (cache[tileID] && cache[tileID].metadata) {
60753 return callback(null, cache[tileID].metadata);
60755 inflight[tileID] = true;
60756 if (metadataLastZoom !== tileCoord[2]) {
60757 metadataLastZoom = tileCoord[2];
60760 taskQueue.enqueue(() => {
60761 json_default(url2).then(function(result) {
60762 delete inflight[tileID];
60764 throw new Error("Unknown Error");
60767 start: localeDateString(result.resourceSets[0].resources[0].vintageStart),
60768 end: localeDateString(result.resourceSets[0].resources[0].vintageEnd)
60770 vintage.range = vintageRange(vintage);
60771 var metadata = { vintage };
60772 cache[tileID].metadata = metadata;
60773 if (callback) callback(null, metadata);
60774 }).catch(function(err) {
60775 delete inflight[tileID];
60776 if (callback) callback(err.message);
60780 bing.terms_url = "https://blog.openstreetmap.org/2010/11/30/microsoft-imagery-details";
60783 rendererBackgroundSource.Esri = function(data) {
60784 if (data.template.match(/blankTile/) === null) {
60785 data.template = data.template + "?blankTile=false";
60787 var esri = rendererBackgroundSource(data);
60791 esri.fetchTilemap = function(center) {
60792 if (_prevCenter && geoSphericalDistance(center, _prevCenter) < 5e3) return;
60793 _prevCenter = center;
60795 var dummyUrl = esri.url([1, 2, 3]);
60796 var x2 = Math.floor((center[0] + 180) / 360 * Math.pow(2, z2));
60797 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));
60798 var tilemapUrl = dummyUrl.replace(/tile\/[0-9]+\/[0-9]+\/[0-9]+\?blankTile=false/, "tilemap") + "/" + z2 + "/" + y2 + "/" + x2 + "/8/8";
60799 json_default(tilemapUrl).then(function(tilemap) {
60801 throw new Error("Unknown Error");
60803 var hasTiles = true;
60804 for (var i3 = 0; i3 < tilemap.data.length; i3++) {
60805 if (!tilemap.data[i3]) {
60810 esri.zoomExtent[1] = hasTiles ? 22 : 19;
60811 }).catch(function() {
60814 esri.getMetadata = function(center, tileCoord, callback) {
60815 if (esri.id !== "EsriWorldImagery") {
60816 return callback(null, {});
60818 var tileID = tileCoord.slice(0, 3).join("/");
60819 var zoom = Math.min(tileCoord[2], esri.zoomExtent[1]);
60820 var centerPoint = center[0] + "," + center[1];
60821 var unknown = _t("info_panels.background.unknown");
60824 if (inflight[tileID]) return;
60825 var url = "https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/4/query";
60826 url += "?returnGeometry=false&geometry=" + centerPoint + "&inSR=4326&geometryType=esriGeometryPoint&outFields=*&f=json";
60827 if (!cache[tileID]) {
60828 cache[tileID] = {};
60830 if (cache[tileID] && cache[tileID].metadata) {
60831 return callback(null, cache[tileID].metadata);
60833 inflight[tileID] = true;
60834 json_default(url).then(function(result) {
60835 delete inflight[tileID];
60836 result = result.features.map((f2) => f2.attributes).filter((a2) => a2.MinMapLevel <= zoom && a2.MaxMapLevel >= zoom)[0];
60838 throw new Error("Unknown Error");
60839 } else if (result.features && result.features.length < 1) {
60840 throw new Error("No Results");
60841 } else if (result.error && result.error.message) {
60842 throw new Error(result.error.message);
60844 var captureDate = localeDateString(result.SRC_DATE2);
60846 start: captureDate,
60852 source: clean2(result.NICE_NAME),
60853 description: clean2(result.NICE_DESC),
60854 resolution: clean2(+Number(result.SRC_RES).toFixed(4)),
60855 accuracy: clean2(+Number(result.SRC_ACC).toFixed(4))
60857 if (isFinite(metadata.resolution)) {
60858 metadata.resolution += " m";
60860 if (isFinite(metadata.accuracy)) {
60861 metadata.accuracy += " m";
60863 cache[tileID].metadata = metadata;
60864 if (callback) callback(null, metadata);
60865 }).catch(function(err) {
60866 delete inflight[tileID];
60867 if (callback) callback(err.message);
60869 function clean2(val) {
60870 return String(val).trim() || unknown;
60875 rendererBackgroundSource.None = function() {
60876 var source = rendererBackgroundSource({ id: "none", template: "" });
60877 source.name = function() {
60878 return _t("background.none");
60880 source.label = function() {
60881 return _t.append("background.none");
60883 source.imageryUsed = function() {
60886 source.area = function() {
60891 rendererBackgroundSource.Custom = function(template) {
60892 var source = rendererBackgroundSource({ id: "custom", template });
60893 source.name = function() {
60894 return _t("background.custom");
60896 source.label = function() {
60897 return _t.append("background.custom");
60899 source.imageryUsed = function() {
60900 var cleaned = source.template();
60901 if (cleaned.indexOf("?") !== -1) {
60902 var parts = cleaned.split("?", 2);
60903 var qs = utilStringQs(parts[1]);
60904 ["access_token", "connectId", "token", "Signature"].forEach(function(param) {
60906 qs[param] = "{apikey}";
60909 cleaned = parts[0] + "?" + utilQsString(qs, true);
60911 cleaned = cleaned.replace(/token\/(\w+)/, "token/{apikey}").replace(/key=(\w+)/, "key={apikey}");
60912 return "Custom (" + cleaned + " )";
60914 source.area = function() {
60920 // node_modules/@turf/helpers/dist/esm/index.js
60921 var earthRadius = 63710088e-1;
60923 centimeters: earthRadius * 100,
60924 centimetres: earthRadius * 100,
60925 degrees: 360 / (2 * Math.PI),
60926 feet: earthRadius * 3.28084,
60927 inches: earthRadius * 39.37,
60928 kilometers: earthRadius / 1e3,
60929 kilometres: earthRadius / 1e3,
60930 meters: earthRadius,
60931 metres: earthRadius,
60932 miles: earthRadius / 1609.344,
60933 millimeters: earthRadius * 1e3,
60934 millimetres: earthRadius * 1e3,
60935 nauticalmiles: earthRadius / 1852,
60937 yards: earthRadius * 1.0936
60939 function feature2(geom, properties, options2 = {}) {
60940 const feat = { type: "Feature" };
60941 if (options2.id === 0 || options2.id) {
60942 feat.id = options2.id;
60944 if (options2.bbox) {
60945 feat.bbox = options2.bbox;
60947 feat.properties = properties || {};
60948 feat.geometry = geom;
60951 function polygon(coordinates, properties, options2 = {}) {
60952 for (const ring of coordinates) {
60953 if (ring.length < 4) {
60955 "Each LinearRing of a Polygon must have 4 or more Positions."
60958 if (ring[ring.length - 1].length !== ring[0].length) {
60959 throw new Error("First and last Position are not equivalent.");
60961 for (let j2 = 0; j2 < ring[ring.length - 1].length; j2++) {
60962 if (ring[ring.length - 1][j2] !== ring[0][j2]) {
60963 throw new Error("First and last Position are not equivalent.");
60971 return feature2(geom, properties, options2);
60973 function lineString(coordinates, properties, options2 = {}) {
60974 if (coordinates.length < 2) {
60975 throw new Error("coordinates must be an array of two or more positions");
60978 type: "LineString",
60981 return feature2(geom, properties, options2);
60983 function multiLineString(coordinates, properties, options2 = {}) {
60985 type: "MultiLineString",
60988 return feature2(geom, properties, options2);
60990 function multiPolygon(coordinates, properties, options2 = {}) {
60992 type: "MultiPolygon",
60995 return feature2(geom, properties, options2);
60998 // node_modules/@turf/invariant/dist/esm/index.js
60999 function getGeom(geojson) {
61000 if (geojson.type === "Feature") {
61001 return geojson.geometry;
61006 // node_modules/@turf/bbox-clip/dist/esm/index.js
61007 function lineclip(points, bbox2, result) {
61008 var len = points.length, codeA = bitCode(points[0], bbox2), part = [], i3, codeB, lastCode;
61013 for (i3 = 1; i3 < len; i3++) {
61014 a2 = points[i3 - 1];
61016 codeB = lastCode = bitCode(b2, bbox2);
61018 if (!(codeA | codeB)) {
61020 if (codeB !== lastCode) {
61022 if (i3 < len - 1) {
61026 } else if (i3 === len - 1) {
61030 } else if (codeA & codeB) {
61032 } else if (codeA) {
61033 a2 = intersect(a2, b2, codeA, bbox2);
61034 codeA = bitCode(a2, bbox2);
61036 b2 = intersect(a2, b2, codeB, bbox2);
61037 codeB = bitCode(b2, bbox2);
61046 function polygonclip(points, bbox2) {
61047 var result, edge, prev, prevInside, i3, p2, inside;
61048 for (edge = 1; edge <= 8; edge *= 2) {
61050 prev = points[points.length - 1];
61051 prevInside = !(bitCode(prev, bbox2) & edge);
61052 for (i3 = 0; i3 < points.length; i3++) {
61054 inside = !(bitCode(p2, bbox2) & edge);
61055 if (inside !== prevInside)
61056 result.push(intersect(prev, p2, edge, bbox2));
61060 prevInside = inside;
61063 if (!points.length)
61068 function intersect(a2, b2, edge, bbox2) {
61069 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;
61071 function bitCode(p2, bbox2) {
61073 if (p2[0] < bbox2[0])
61075 else if (p2[0] > bbox2[2])
61077 if (p2[1] < bbox2[1])
61079 else if (p2[1] > bbox2[3])
61083 function bboxClip(feature3, bbox2) {
61084 const geom = getGeom(feature3);
61085 const type2 = geom.type;
61086 const properties = feature3.type === "Feature" ? feature3.properties : {};
61087 let coords = geom.coordinates;
61090 case "MultiLineString": {
61092 if (type2 === "LineString") {
61095 coords.forEach((line) => {
61096 lineclip(line, bbox2, lines);
61098 if (lines.length === 1) {
61099 return lineString(lines[0], properties);
61101 return multiLineString(lines, properties);
61104 return polygon(clipPolygon(coords, bbox2), properties);
61105 case "MultiPolygon":
61106 return multiPolygon(
61107 coords.map((poly) => {
61108 return clipPolygon(poly, bbox2);
61113 throw new Error("geometry " + type2 + " not supported");
61116 function clipPolygon(rings, bbox2) {
61117 const outRings = [];
61118 for (const ring of rings) {
61119 const clipped = polygonclip(ring, bbox2);
61120 if (clipped.length > 0) {
61121 if (clipped[0][0] !== clipped[clipped.length - 1][0] || clipped[0][1] !== clipped[clipped.length - 1][1]) {
61122 clipped.push(clipped[0]);
61124 if (clipped.length >= 4) {
61125 outRings.push(clipped);
61131 var turf_bbox_clip_default = bboxClip;
61133 // node_modules/@turf/meta/dist/esm/index.js
61134 function coordEach(geojson, callback, excludeWrapCoord) {
61135 if (geojson === null)
61137 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;
61138 for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
61139 geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
61140 isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
61141 stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
61142 for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
61143 var multiFeatureIndex = 0;
61144 var geometryIndex = 0;
61145 geometry = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
61146 if (geometry === null)
61148 coords = geometry.coordinates;
61149 var geomType = geometry.type;
61150 wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
61151 switch (geomType) {
61164 multiFeatureIndex++;
61168 for (j2 = 0; j2 < coords.length; j2++) {
61178 if (geomType === "MultiPoint")
61179 multiFeatureIndex++;
61181 if (geomType === "LineString")
61182 multiFeatureIndex++;
61185 case "MultiLineString":
61186 for (j2 = 0; j2 < coords.length; j2++) {
61187 for (k2 = 0; k2 < coords[j2].length - wrapShrink; k2++) {
61198 if (geomType === "MultiLineString")
61199 multiFeatureIndex++;
61200 if (geomType === "Polygon")
61203 if (geomType === "Polygon")
61204 multiFeatureIndex++;
61206 case "MultiPolygon":
61207 for (j2 = 0; j2 < coords.length; j2++) {
61209 for (k2 = 0; k2 < coords[j2].length; k2++) {
61210 for (l2 = 0; l2 < coords[j2][k2].length - wrapShrink; l2++) {
61212 coords[j2][k2][l2],
61223 multiFeatureIndex++;
61226 case "GeometryCollection":
61227 for (j2 = 0; j2 < geometry.geometries.length; j2++)
61228 if (coordEach(geometry.geometries[j2], callback, excludeWrapCoord) === false)
61232 throw new Error("Unknown Geometry Type");
61238 // node_modules/@turf/bbox/dist/esm/index.js
61239 function bbox(geojson, options2 = {}) {
61240 if (geojson.bbox != null && true !== options2.recompute) {
61241 return geojson.bbox;
61243 const result = [Infinity, Infinity, -Infinity, -Infinity];
61244 coordEach(geojson, (coord2) => {
61245 if (result[0] > coord2[0]) {
61246 result[0] = coord2[0];
61248 if (result[1] > coord2[1]) {
61249 result[1] = coord2[1];
61251 if (result[2] < coord2[0]) {
61252 result[2] = coord2[0];
61254 if (result[3] < coord2[1]) {
61255 result[3] = coord2[1];
61260 var turf_bbox_default = bbox;
61262 // modules/renderer/background.js
61263 var import_which_polygon3 = __toESM(require_which_polygon());
61265 // modules/renderer/tile_layer.js
61266 function rendererTileLayer(context) {
61267 var transformProp = utilPrefixCSSProperty("Transform");
61268 var tiler8 = utilTiler();
61269 var _tileSize = 256;
61275 function tileSizeAtZoom(d2, z2) {
61276 var EPSILON = 2e-3;
61277 return _tileSize * Math.pow(2, z2 - d2[2]) / _tileSize + EPSILON;
61279 function atZoom(t2, distance) {
61280 var power = Math.pow(2, distance);
61282 Math.floor(t2[0] * power),
61283 Math.floor(t2[1] * power),
61287 function lookUp(d2) {
61288 for (var up = -1; up > -d2[2]; up--) {
61289 var tile = atZoom(d2, up);
61290 if (_cache5[_source.url(tile)] !== false) {
61295 function uniqueBy(a2, n3) {
61298 for (var i3 = 0; i3 < a2.length; i3++) {
61299 if (seen[a2[i3][n3]] === void 0) {
61301 seen[a2[i3][n3]] = true;
61306 function addSource(d2) {
61307 d2.push(_source.url(d2));
61310 function background(selection2) {
61311 _zoom = geoScaleToZoom(_projection.scale(), _tileSize);
61315 _source.offset()[0] * Math.pow(2, _zoom),
61316 _source.offset()[1] * Math.pow(2, _zoom)
61319 pixelOffset = [0, 0];
61322 _projection.translate()[0] + pixelOffset[0],
61323 _projection.translate()[1] + pixelOffset[1]
61325 tiler8.scale(_projection.scale() * 2 * Math.PI).translate(translate);
61327 _projection.scale() * Math.PI - translate[0],
61328 _projection.scale() * Math.PI - translate[1]
61330 render(selection2);
61332 function render(selection2) {
61333 if (!_source) return;
61335 var showDebug = context.getDebug("tile") && !_source.overlay;
61336 if (_source.validZoom(_zoom)) {
61337 tiler8.skipNullIsland(!!_source.overlay);
61338 tiler8().forEach(function(d2) {
61340 if (d2[3] === "") return;
61341 if (typeof d2[3] !== "string") return;
61343 if (_cache5[d2[3]] === false && lookUp(d2)) {
61344 requests.push(addSource(lookUp(d2)));
61347 requests = uniqueBy(requests, 3).filter(function(r2) {
61348 return _cache5[r2[3]] !== false;
61351 function load(d3_event, d2) {
61352 _cache5[d2[3]] = true;
61353 select_default2(this).on("error", null).on("load", null).classed("tile-loaded", true);
61354 render(selection2);
61356 function error(d3_event, d2) {
61357 _cache5[d2[3]] = false;
61358 select_default2(this).on("error", null).on("load", null).remove();
61359 render(selection2);
61361 function imageTransform(d2) {
61362 var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
61363 var scale = tileSizeAtZoom(d2, _zoom);
61364 return "translate(" + (d2[0] * ts - _tileOrigin[0]) + "px," + (d2[1] * ts - _tileOrigin[1]) + "px) scale(" + scale + "," + scale + ")";
61366 function tileCenter(d2) {
61367 var ts = _tileSize * Math.pow(2, _zoom - d2[2]);
61369 d2[0] * ts - _tileOrigin[0] + ts / 2,
61370 d2[1] * ts - _tileOrigin[1] + ts / 2
61373 function debugTransform(d2) {
61374 var coord2 = tileCenter(d2);
61375 return "translate(" + coord2[0] + "px," + coord2[1] + "px)";
61377 var dims = tiler8.size();
61378 var mapCenter = [dims[0] / 2, dims[1] / 2];
61379 var minDist = Math.max(dims[0], dims[1]);
61381 requests.forEach(function(d2) {
61382 var c2 = tileCenter(d2);
61383 var dist = geoVecLength(c2, mapCenter);
61384 if (dist < minDist) {
61389 var image = selection2.selectAll("img").data(requests, function(d2) {
61392 image.exit().style(transformProp, imageTransform).classed("tile-removing", true).classed("tile-center", false).each(function() {
61393 var tile = select_default2(this);
61394 window.setTimeout(function() {
61395 if (tile.classed("tile-removing")) {
61400 image.enter().append("img").attr("class", "tile").attr("alt", "").attr("draggable", "false").style("width", _tileSize + "px").style("height", _tileSize + "px").attr("src", function(d2) {
61402 }).on("error", error).on("load", load).merge(image).style(transformProp, imageTransform).classed("tile-debug", showDebug).classed("tile-removing", false).classed("tile-center", function(d2) {
61403 return d2 === nearCenter;
61405 var debug2 = selection2.selectAll(".tile-label-debug").data(showDebug ? requests : [], function(d2) {
61408 debug2.exit().remove();
61410 var debugEnter = debug2.enter().append("div").attr("class", "tile-label-debug");
61411 debugEnter.append("div").attr("class", "tile-label-debug-coord");
61412 debugEnter.append("div").attr("class", "tile-label-debug-vintage");
61413 debug2 = debug2.merge(debugEnter);
61414 debug2.style(transformProp, debugTransform);
61415 debug2.selectAll(".tile-label-debug-coord").text(function(d2) {
61416 return d2[2] + " / " + d2[0] + " / " + d2[1];
61418 debug2.selectAll(".tile-label-debug-vintage").each(function(d2) {
61419 var span = select_default2(this);
61420 var center = context.projection.invert(tileCenter(d2));
61421 _source.getMetadata(center, d2, function(err, result) {
61422 if (result && result.vintage && result.vintage.range) {
61423 span.text(result.vintage.range);
61426 span.call(_t.append("info_panels.background.vintage"));
61427 span.append("span").text(": ");
61428 span.call(_t.append("info_panels.background.unknown"));
61434 background.projection = function(val) {
61435 if (!arguments.length) return _projection;
61439 background.dimensions = function(val) {
61440 if (!arguments.length) return tiler8.size();
61444 background.source = function(val) {
61445 if (!arguments.length) return _source;
61447 _tileSize = _source.tileSize;
61449 tiler8.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent);
61455 // modules/renderer/background.js
61456 var _imageryIndex = null;
61457 function rendererBackground(context) {
61458 const dispatch14 = dispatch_default("change");
61459 const baseLayer = rendererTileLayer(context).projection(context.projection);
61460 let _checkedBlocklists = [];
61461 let _isValid = true;
61462 let _overlayLayers = [];
61463 let _brightness = 1;
61465 let _saturation = 1;
61466 let _sharpness = 1;
61467 function ensureImageryIndex() {
61468 return _mainFileFetcher.get("imagery").then((sources) => {
61469 if (_imageryIndex) return _imageryIndex;
61474 const features = sources.map((source) => {
61475 if (!source.polygon) return null;
61476 const rings = source.polygon.map((ring) => [ring]);
61479 properties: { id: source.id },
61480 geometry: { type: "MultiPolygon", coordinates: rings }
61482 _imageryIndex.features[source.id] = feature3;
61484 }).filter(Boolean);
61485 _imageryIndex.query = (0, import_which_polygon3.default)({ type: "FeatureCollection", features });
61486 _imageryIndex.backgrounds = sources.map((source) => {
61487 if (source.type === "bing") {
61488 return rendererBackgroundSource.Bing(source, dispatch14);
61489 } else if (/^EsriWorldImagery/.test(source.id)) {
61490 return rendererBackgroundSource.Esri(source);
61492 return rendererBackgroundSource(source);
61495 _imageryIndex.backgrounds.unshift(rendererBackgroundSource.None());
61496 let template = corePreferences("background-custom-template") || "";
61497 const custom = rendererBackgroundSource.Custom(template);
61498 _imageryIndex.backgrounds.unshift(custom);
61499 return _imageryIndex;
61502 function background(selection2) {
61503 const currSource = baseLayer.source();
61504 if (context.map().zoom() > 18) {
61505 if (currSource && /^EsriWorldImagery/.test(currSource.id)) {
61506 const center = context.map().center();
61507 currSource.fetchTilemap(center);
61510 const sources = background.sources(context.map().extent());
61511 const wasValid = _isValid;
61512 _isValid = !!sources.filter((d2) => d2 === currSource).length;
61513 if (wasValid !== _isValid) {
61514 background.updateImagery();
61516 let baseFilter = "";
61517 if (_brightness !== 1) {
61518 baseFilter += " brightness(".concat(_brightness, ")");
61520 if (_contrast !== 1) {
61521 baseFilter += " contrast(".concat(_contrast, ")");
61523 if (_saturation !== 1) {
61524 baseFilter += " saturate(".concat(_saturation, ")");
61526 if (_sharpness < 1) {
61527 const blur = number_default(0.5, 5)(1 - _sharpness);
61528 baseFilter += " blur(".concat(blur, "px)");
61530 let base = selection2.selectAll(".layer-background").data([0]);
61531 base = base.enter().insert("div", ".layer-data").attr("class", "layer layer-background").merge(base);
61532 base.style("filter", baseFilter || null);
61533 let imagery = base.selectAll(".layer-imagery").data([0]);
61534 imagery.enter().append("div").attr("class", "layer layer-imagery").merge(imagery).call(baseLayer);
61535 let maskFilter = "";
61536 let mixBlendMode = "";
61537 if (_sharpness > 1) {
61538 mixBlendMode = "overlay";
61539 maskFilter = "saturate(0) blur(3px) invert(1)";
61540 let contrast = _sharpness - 1;
61541 maskFilter += " contrast(".concat(contrast, ")");
61542 let brightness = number_default(1, 0.85)(_sharpness - 1);
61543 maskFilter += " brightness(".concat(brightness, ")");
61545 let mask = base.selectAll(".layer-unsharp-mask").data(_sharpness > 1 ? [0] : []);
61546 mask.exit().remove();
61547 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);
61548 let overlays = selection2.selectAll(".layer-overlay").data(_overlayLayers, (d2) => d2.source().name());
61549 overlays.exit().remove();
61550 overlays.enter().insert("div", ".layer-data").attr("class", "layer layer-overlay").merge(overlays).each((layer, i3, nodes) => select_default2(nodes[i3]).call(layer));
61552 background.updateImagery = function() {
61553 let currSource = baseLayer.source();
61554 if (context.inIntro() || !currSource) return;
61555 let o2 = _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).map((d2) => d2.source().id).join(",");
61556 const meters = geoOffsetToMeters(currSource.offset());
61557 const EPSILON = 0.01;
61558 const x2 = +meters[0].toFixed(2);
61559 const y2 = +meters[1].toFixed(2);
61560 let hash = utilStringQs(window.location.hash);
61561 let id2 = currSource.id;
61562 if (id2 === "custom") {
61563 id2 = "custom:".concat(currSource.template());
61566 hash.background = id2;
61568 delete hash.background;
61571 hash.overlays = o2;
61573 delete hash.overlays;
61575 if (Math.abs(x2) > EPSILON || Math.abs(y2) > EPSILON) {
61576 hash.offset = "".concat(x2, ",").concat(y2);
61578 delete hash.offset;
61580 if (!window.mocha) {
61581 window.location.replace("#" + utilQsString(hash, true));
61583 let imageryUsed = [];
61584 let photoOverlaysUsed = [];
61585 const currUsed = currSource.imageryUsed();
61586 if (currUsed && _isValid) {
61587 imageryUsed.push(currUsed);
61589 _overlayLayers.filter((d2) => !d2.source().isLocatorOverlay() && !d2.source().isHidden()).forEach((d2) => imageryUsed.push(d2.source().imageryUsed()));
61590 const dataLayer = context.layers().layer("data");
61591 if (dataLayer && dataLayer.enabled() && dataLayer.hasData()) {
61592 imageryUsed.push(dataLayer.getSrc());
61594 const photoOverlayLayers = {
61595 streetside: "Bing Streetside",
61596 mapillary: "Mapillary Images",
61597 "mapillary-map-features": "Mapillary Map Features",
61598 "mapillary-signs": "Mapillary Signs",
61599 kartaview: "KartaView Images",
61600 vegbilder: "Norwegian Road Administration Images",
61601 mapilio: "Mapilio Images",
61602 panoramax: "Panoramax Images"
61604 for (let layerID in photoOverlayLayers) {
61605 const layer = context.layers().layer(layerID);
61606 if (layer && layer.enabled()) {
61607 photoOverlaysUsed.push(layerID);
61608 imageryUsed.push(photoOverlayLayers[layerID]);
61611 context.history().imageryUsed(imageryUsed);
61612 context.history().photoOverlaysUsed(photoOverlaysUsed);
61614 background.sources = (extent, zoom, includeCurrent) => {
61615 if (!_imageryIndex) return [];
61617 (_imageryIndex.query.bbox(extent.rectangle(), true) || []).forEach((d2) => visible[d2.id] = true);
61618 const currSource = baseLayer.source();
61619 const osm = context.connection();
61620 const blocklists = osm && osm.imageryBlocklists() || [];
61621 const blocklistChanged = blocklists.length !== _checkedBlocklists.length || blocklists.some((regex, index) => String(regex) !== _checkedBlocklists[index]);
61622 if (blocklistChanged) {
61623 _imageryIndex.backgrounds.forEach((source) => {
61624 source.isBlocked = blocklists.some((regex) => regex.test(source.template()));
61626 _checkedBlocklists = blocklists.map((regex) => String(regex));
61628 return _imageryIndex.backgrounds.filter((source) => {
61629 if (includeCurrent && currSource === source) return true;
61630 if (source.isBlocked) return false;
61631 if (!source.polygon) return true;
61632 if (zoom && zoom < 6) return false;
61633 return visible[source.id];
61636 background.dimensions = (val) => {
61638 baseLayer.dimensions(val);
61639 _overlayLayers.forEach((layer) => layer.dimensions(val));
61641 background.baseLayerSource = function(d2) {
61642 if (!arguments.length) return baseLayer.source();
61643 const osm = context.connection();
61644 if (!osm) return background;
61645 const blocklists = osm.imageryBlocklists();
61646 const template = d2.template();
61650 for (let i3 = 0; i3 < blocklists.length; i3++) {
61651 regex = blocklists[i3];
61652 fail = regex.test(template);
61657 regex = /.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/;
61658 fail = regex.test(template);
61660 baseLayer.source(!fail ? d2 : background.findSource("none"));
61661 dispatch14.call("change");
61662 background.updateImagery();
61665 background.findSource = (id2) => {
61666 if (!id2 || !_imageryIndex) return null;
61667 return _imageryIndex.backgrounds.find((d2) => d2.id && d2.id === id2);
61669 background.bing = () => {
61670 background.baseLayerSource(background.findSource("Bing"));
61672 background.showsLayer = (d2) => {
61673 const currSource = baseLayer.source();
61674 if (!d2 || !currSource) return false;
61675 return d2.id === currSource.id || _overlayLayers.some((layer) => d2.id === layer.source().id);
61677 background.overlayLayerSources = () => {
61678 return _overlayLayers.map((layer) => layer.source());
61680 background.toggleOverlayLayer = (d2) => {
61682 for (let i3 = 0; i3 < _overlayLayers.length; i3++) {
61683 layer = _overlayLayers[i3];
61684 if (layer.source() === d2) {
61685 _overlayLayers.splice(i3, 1);
61686 dispatch14.call("change");
61687 background.updateImagery();
61691 layer = rendererTileLayer(context).source(d2).projection(context.projection).dimensions(
61692 baseLayer.dimensions()
61694 _overlayLayers.push(layer);
61695 dispatch14.call("change");
61696 background.updateImagery();
61698 background.nudge = (d2, zoom) => {
61699 const currSource = baseLayer.source();
61701 currSource.nudge(d2, zoom);
61702 dispatch14.call("change");
61703 background.updateImagery();
61707 background.offset = function(d2) {
61708 const currSource = baseLayer.source();
61709 if (!arguments.length) {
61710 return currSource && currSource.offset() || [0, 0];
61713 currSource.offset(d2);
61714 dispatch14.call("change");
61715 background.updateImagery();
61719 background.brightness = function(d2) {
61720 if (!arguments.length) return _brightness;
61722 if (context.mode()) dispatch14.call("change");
61725 background.contrast = function(d2) {
61726 if (!arguments.length) return _contrast;
61728 if (context.mode()) dispatch14.call("change");
61731 background.saturation = function(d2) {
61732 if (!arguments.length) return _saturation;
61734 if (context.mode()) dispatch14.call("change");
61737 background.sharpness = function(d2) {
61738 if (!arguments.length) return _sharpness;
61740 if (context.mode()) dispatch14.call("change");
61744 background.ensureLoaded = () => {
61745 if (_loadPromise) return _loadPromise;
61746 return _loadPromise = ensureImageryIndex();
61748 background.init = () => {
61749 const loadPromise = background.ensureLoaded();
61750 const hash = utilStringQs(window.location.hash);
61751 const requestedBackground = hash.background || hash.layer;
61752 const lastUsedBackground = corePreferences("background-last-used");
61753 return loadPromise.then((imageryIndex) => {
61754 const extent = context.map().extent();
61755 const validBackgrounds = background.sources(extent).filter((d2) => d2.id !== "none" && d2.id !== "custom");
61756 const first = validBackgrounds.length && validBackgrounds[0];
61757 const isLastUsedValid = !!validBackgrounds.find((d2) => d2.id && d2.id === lastUsedBackground);
61759 if (!requestedBackground && extent) {
61760 const viewArea = extent.area();
61761 best = validBackgrounds.find((s2) => {
61762 if (!s2.best() || s2.overlay) return false;
61763 let bbox2 = turf_bbox_default(turf_bbox_clip_default(
61764 { type: "MultiPolygon", coordinates: [s2.polygon || [extent.polygon()]] },
61767 let area = geoExtent(bbox2.slice(0, 2), bbox2.slice(2, 4)).area();
61768 return area / viewArea > 0.5;
61771 if (requestedBackground && requestedBackground.indexOf("custom:") === 0) {
61772 const template = requestedBackground.replace(/^custom:/, "");
61773 const custom = background.findSource("custom");
61774 background.baseLayerSource(custom.template(template));
61775 corePreferences("background-custom-template", template);
61777 background.baseLayerSource(
61778 background.findSource(requestedBackground) || best || isLastUsedValid && background.findSource(lastUsedBackground) || background.findSource("Bing") || first || background.findSource("none")
61781 const locator = imageryIndex.backgrounds.find((d2) => d2.overlay && d2.default);
61783 background.toggleOverlayLayer(locator);
61785 const overlays = (hash.overlays || "").split(",");
61786 overlays.forEach((overlay) => {
61787 overlay = background.findSource(overlay);
61789 background.toggleOverlayLayer(overlay);
61793 const gpx2 = context.layers().layer("data");
61795 gpx2.url(hash.gpx, ".gpx");
61799 const offset = hash.offset.replace(/;/g, ",").split(",").map((n3) => !isNaN(n3) && n3);
61800 if (offset.length === 2) {
61801 background.offset(geoMetersToOffset(offset));
61804 }).catch((err) => {
61805 console.error(err);
61808 return utilRebind(background, dispatch14, "on");
61811 // modules/renderer/features.js
61812 function rendererFeatures(context) {
61813 var dispatch14 = dispatch_default("change", "redraw");
61814 var features = utilRebind({}, dispatch14, "on");
61815 var _deferred2 = /* @__PURE__ */ new Set();
61816 var traffic_roads = {
61818 "motorway_link": true,
61820 "trunk_link": true,
61822 "primary_link": true,
61824 "secondary_link": true,
61826 "tertiary_link": true,
61827 "residential": true,
61828 "unclassified": true,
61829 "living_street": true,
61832 var service_roads = {
61846 var _cullFactor = 1;
61852 var _forceVisible = {};
61853 function update() {
61854 if (!window.mocha) {
61855 var hash = utilStringQs(window.location.hash);
61856 var disabled = features.disabled();
61857 if (disabled.length) {
61858 hash.disable_features = disabled.join(",");
61860 delete hash.disable_features;
61862 window.location.replace("#" + utilQsString(hash, true));
61863 corePreferences("disabled-features", disabled.join(","));
61865 _hidden = features.hidden();
61866 dispatch14.call("change");
61867 dispatch14.call("redraw");
61869 function defineRule(k2, filter2, max3) {
61870 var isEnabled = true;
61874 enabled: isEnabled,
61875 // whether the user wants it enabled..
61877 currentMax: max3 || Infinity,
61878 defaultMax: max3 || Infinity,
61879 enable: function() {
61880 this.enabled = true;
61881 this.currentMax = this.defaultMax;
61883 disable: function() {
61884 this.enabled = false;
61885 this.currentMax = 0;
61887 hidden: function() {
61888 return this.count === 0 && !this.enabled || this.count > this.currentMax * _cullFactor;
61890 autoHidden: function() {
61891 return this.hidden() && this.currentMax > 0;
61895 defineRule("points", function isPoint(tags, geometry) {
61896 return geometry === "point";
61898 defineRule("traffic_roads", function isTrafficRoad(tags) {
61899 return traffic_roads[tags.highway];
61901 defineRule("service_roads", function isServiceRoad(tags) {
61902 return service_roads[tags.highway];
61904 defineRule("paths", function isPath(tags) {
61905 return paths[tags.highway];
61907 defineRule("buildings", function isBuilding(tags) {
61908 return !!tags.building && tags.building !== "no" || tags.parking === "multi-storey" || tags.parking === "sheds" || tags.parking === "carports" || tags.parking === "garage_boxes";
61910 defineRule("building_parts", function isBuildingPart(tags) {
61911 return !!tags["building:part"];
61913 defineRule("indoor", function isIndoor(tags) {
61914 return !!tags.indoor;
61916 defineRule("landuse", function isLanduse(tags, geometry) {
61917 return geometry === "area" && (!!tags.landuse || !!tags.natural || !!tags.leisure || !!tags.amenity) && !_rules.buildings.filter(tags) && !_rules.building_parts.filter(tags) && !_rules.indoor.filter(tags) && !_rules.water.filter(tags) && !_rules.pistes.filter(tags);
61919 defineRule("boundaries", function isBoundary(tags, geometry) {
61920 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);
61922 defineRule("water", function isWater(tags) {
61923 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";
61925 defineRule("rail", function isRail(tags) {
61926 return (!!tags.railway || tags.landuse === "railway") && !(traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]);
61928 defineRule("pistes", function isPiste(tags) {
61929 return tags["piste:type"];
61931 defineRule("aerialways", function isAerialways(tags) {
61932 return !!(tags == null ? void 0 : tags.aerialway) && tags.aerialway !== "yes" && tags.aerialway !== "station";
61934 defineRule("power", function isPower(tags) {
61935 return !!tags.power;
61937 defineRule("past_future", function isPastFuture(tags) {
61938 if (traffic_roads[tags.highway] || service_roads[tags.highway] || paths[tags.highway]) {
61941 const keys2 = Object.keys(tags);
61942 for (let i3 = 0; i3 < keys2.length; i3++) {
61943 const key = keys2[i3];
61944 const s2 = key.split(":")[0];
61945 if (osmLifecyclePrefixes[s2] || osmLifecyclePrefixes[tags[key]]) return true;
61949 defineRule("others", function isOther(tags, geometry) {
61950 return geometry === "line" || geometry === "area";
61952 features.features = function() {
61955 features.keys = function() {
61958 features.enabled = function(k2) {
61959 if (!arguments.length) {
61960 return _keys.filter(function(k3) {
61961 return _rules[k3].enabled;
61964 return _rules[k2] && _rules[k2].enabled;
61966 features.disabled = function(k2) {
61967 if (!arguments.length) {
61968 return _keys.filter(function(k3) {
61969 return !_rules[k3].enabled;
61972 return _rules[k2] && !_rules[k2].enabled;
61974 features.hidden = function(k2) {
61976 if (!arguments.length) {
61977 return _keys.filter(function(k3) {
61978 return _rules[k3].hidden();
61981 return (_a3 = _rules[k2]) == null ? void 0 : _a3.hidden();
61983 features.autoHidden = function(k2) {
61984 if (!arguments.length) {
61985 return _keys.filter(function(k3) {
61986 return _rules[k3].autoHidden();
61989 return _rules[k2] && _rules[k2].autoHidden();
61991 features.enable = function(k2) {
61992 if (_rules[k2] && !_rules[k2].enabled) {
61993 _rules[k2].enable();
61997 features.enableAll = function() {
61998 var didEnable = false;
61999 for (var k2 in _rules) {
62000 if (!_rules[k2].enabled) {
62002 _rules[k2].enable();
62005 if (didEnable) update();
62007 features.disable = function(k2) {
62008 if (_rules[k2] && _rules[k2].enabled) {
62009 _rules[k2].disable();
62013 features.disableAll = function() {
62014 var didDisable = false;
62015 for (var k2 in _rules) {
62016 if (_rules[k2].enabled) {
62018 _rules[k2].disable();
62021 if (didDisable) update();
62023 features.toggle = function(k2) {
62026 return f2.enabled ? f2.disable() : f2.enable();
62031 features.resetStats = function() {
62032 for (var i3 = 0; i3 < _keys.length; i3++) {
62033 _rules[_keys[i3]].count = 0;
62035 dispatch14.call("change");
62037 features.gatherStats = function(d2, resolver, dimensions) {
62038 var needsRedraw = false;
62039 var types = utilArrayGroupBy(d2, "type");
62040 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
62041 var currHidden, geometry, matches, i3, j2;
62042 for (i3 = 0; i3 < _keys.length; i3++) {
62043 _rules[_keys[i3]].count = 0;
62045 _cullFactor = dimensions[0] * dimensions[1] / 1e6;
62046 for (i3 = 0; i3 < entities.length; i3++) {
62047 geometry = entities[i3].geometry(resolver);
62048 matches = Object.keys(features.getMatches(entities[i3], resolver, geometry));
62049 for (j2 = 0; j2 < matches.length; j2++) {
62050 _rules[matches[j2]].count++;
62053 currHidden = features.hidden();
62054 if (currHidden !== _hidden) {
62055 _hidden = currHidden;
62056 needsRedraw = true;
62057 dispatch14.call("change");
62059 return needsRedraw;
62061 features.stats = function() {
62062 for (var i3 = 0; i3 < _keys.length; i3++) {
62063 _stats[_keys[i3]] = _rules[_keys[i3]].count;
62067 features.clear = function(d2) {
62068 for (var i3 = 0; i3 < d2.length; i3++) {
62069 features.clearEntity(d2[i3]);
62072 features.clearEntity = function(entity) {
62073 delete _cache5[osmEntity.key(entity)];
62075 features.reset = function() {
62076 Array.from(_deferred2).forEach(function(handle) {
62077 window.cancelIdleCallback(handle);
62078 _deferred2.delete(handle);
62082 function relationShouldBeChecked(relation) {
62083 return relation.tags.type === "boundary";
62085 features.getMatches = function(entity, resolver, geometry) {
62086 if (geometry === "vertex" || geometry === "relation" && !relationShouldBeChecked(entity)) return {};
62087 var ent = osmEntity.key(entity);
62088 if (!_cache5[ent]) {
62091 if (!_cache5[ent].matches) {
62093 var hasMatch = false;
62094 for (var i3 = 0; i3 < _keys.length; i3++) {
62095 if (_keys[i3] === "others") {
62096 if (hasMatch) continue;
62097 if (entity.type === "way") {
62098 var parents = features.getParents(entity, resolver, geometry);
62099 if (parents.length === 1 && parents[0].isMultipolygon() || // 2b. or belongs only to boundary relations
62100 parents.length > 0 && parents.every(function(parent) {
62101 return parent.tags.type === "boundary";
62103 var pkey = osmEntity.key(parents[0]);
62104 if (_cache5[pkey] && _cache5[pkey].matches) {
62105 matches = Object.assign({}, _cache5[pkey].matches);
62111 if (_rules[_keys[i3]].filter(entity.tags, geometry)) {
62112 matches[_keys[i3]] = hasMatch = true;
62115 _cache5[ent].matches = matches;
62117 return _cache5[ent].matches;
62119 features.getParents = function(entity, resolver, geometry) {
62120 if (geometry === "point") return [];
62121 var ent = osmEntity.key(entity);
62122 if (!_cache5[ent]) {
62125 if (!_cache5[ent].parents) {
62127 if (geometry === "vertex") {
62128 parents = resolver.parentWays(entity);
62130 parents = resolver.parentRelations(entity);
62132 _cache5[ent].parents = parents;
62134 return _cache5[ent].parents;
62136 features.isHiddenPreset = function(preset, geometry) {
62137 if (!_hidden.length) return false;
62138 if (!preset.tags) return false;
62139 var test = preset.setTags({}, geometry);
62140 for (var key in _rules) {
62141 if (_rules[key].filter(test, geometry)) {
62142 if (_hidden.indexOf(key) !== -1) {
62150 features.isHiddenFeature = function(entity, resolver, geometry) {
62151 if (!_hidden.length) return false;
62152 if (!entity.version) return false;
62153 if (_forceVisible[entity.id]) return false;
62154 var matches = Object.keys(features.getMatches(entity, resolver, geometry));
62155 return matches.length && matches.every(function(k2) {
62156 return features.hidden(k2);
62159 features.isHiddenChild = function(entity, resolver, geometry) {
62160 if (!_hidden.length) return false;
62161 if (!entity.version || geometry === "point") return false;
62162 if (_forceVisible[entity.id]) return false;
62163 var parents = features.getParents(entity, resolver, geometry);
62164 if (!parents.length) return false;
62165 for (var i3 = 0; i3 < parents.length; i3++) {
62166 if (!features.isHidden(parents[i3], resolver, parents[i3].geometry(resolver))) {
62172 features.hasHiddenConnections = function(entity, resolver) {
62173 if (!_hidden.length) return false;
62174 var childNodes, connections;
62175 if (entity.type === "midpoint") {
62176 childNodes = [resolver.entity(entity.edge[0]), resolver.entity(entity.edge[1])];
62179 childNodes = entity.nodes ? resolver.childNodes(entity) : [];
62180 connections = features.getParents(entity, resolver, entity.geometry(resolver));
62182 connections = childNodes.reduce(function(result, e3) {
62183 return resolver.isShared(e3) ? utilArrayUnion(result, resolver.parentWays(e3)) : result;
62185 return connections.some(function(e3) {
62186 return features.isHidden(e3, resolver, e3.geometry(resolver));
62189 features.isHidden = function(entity, resolver, geometry) {
62190 if (!_hidden.length) return false;
62191 if (!entity.version) return false;
62192 var fn = geometry === "vertex" ? features.isHiddenChild : features.isHiddenFeature;
62193 return fn(entity, resolver, geometry);
62195 features.filter = function(d2, resolver) {
62196 if (!_hidden.length) return d2;
62198 for (var i3 = 0; i3 < d2.length; i3++) {
62199 var entity = d2[i3];
62200 if (!features.isHidden(entity, resolver, entity.geometry(resolver))) {
62201 result.push(entity);
62206 features.forceVisible = function(entityIDs) {
62207 if (!arguments.length) return Object.keys(_forceVisible);
62208 _forceVisible = {};
62209 for (var i3 = 0; i3 < entityIDs.length; i3++) {
62210 _forceVisible[entityIDs[i3]] = true;
62211 var entity = context.hasEntity(entityIDs[i3]);
62212 if (entity && entity.type === "relation") {
62213 for (var j2 in entity.members) {
62214 _forceVisible[entity.members[j2].id] = true;
62220 features.init = function() {
62221 var storage = corePreferences("disabled-features");
62223 var storageDisabled = storage.replace(/;/g, ",").split(",");
62224 storageDisabled.forEach(features.disable);
62226 var hash = utilStringQs(window.location.hash);
62227 if (hash.disable_features) {
62228 var hashDisabled = hash.disable_features.replace(/;/g, ",").split(",");
62229 hashDisabled.forEach(features.disable);
62232 context.history().on("merge.features", function(newEntities) {
62233 if (!newEntities) return;
62234 var handle = window.requestIdleCallback(function() {
62235 var graph = context.graph();
62236 var types = utilArrayGroupBy(newEntities, "type");
62237 var entities = [].concat(types.relation || [], types.way || [], types.node || []);
62238 for (var i3 = 0; i3 < entities.length; i3++) {
62239 var geometry = entities[i3].geometry(graph);
62240 features.getMatches(entities[i3], graph, geometry);
62243 _deferred2.add(handle);
62248 // modules/util/bind_once.js
62249 function utilBindOnce(target, type2, listener, capture) {
62250 var typeOnce = type2 + ".once";
62252 target.on(typeOnce, null);
62253 listener.apply(this, arguments);
62255 target.on(typeOnce, one2, capture);
62259 // modules/util/zoom_pan.js
62260 function defaultFilter3(d3_event) {
62261 return !d3_event.ctrlKey && !d3_event.button;
62263 function defaultExtent2() {
62265 if (e3 instanceof SVGElement) {
62266 e3 = e3.ownerSVGElement || e3;
62267 if (e3.hasAttribute("viewBox")) {
62268 e3 = e3.viewBox.baseVal;
62269 return [[e3.x, e3.y], [e3.x + e3.width, e3.y + e3.height]];
62271 return [[0, 0], [e3.width.baseVal.value, e3.height.baseVal.value]];
62273 return [[0, 0], [e3.clientWidth, e3.clientHeight]];
62275 function defaultWheelDelta2(d3_event) {
62276 return -d3_event.deltaY * (d3_event.deltaMode === 1 ? 0.05 : d3_event.deltaMode ? 1 : 2e-3);
62278 function defaultConstrain2(transform2, extent, translateExtent) {
62279 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];
62280 return transform2.translate(
62281 dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
62282 dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
62285 function utilZoomPan() {
62286 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;
62287 function zoom(selection2) {
62288 selection2.on("pointerdown.zoom", pointerdown).on("wheel.zoom", wheeled).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
62289 select_default2(window).on("pointermove.zoompan", pointermove).on("pointerup.zoompan pointercancel.zoompan", pointerup);
62291 zoom.transform = function(collection, transform2, point) {
62292 var selection2 = collection.selection ? collection.selection() : collection;
62293 if (collection !== selection2) {
62294 schedule(collection, transform2, point);
62296 selection2.interrupt().each(function() {
62297 gesture(this, arguments).start(null).zoom(null, null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(null);
62301 zoom.scaleBy = function(selection2, k2, p2) {
62302 zoom.scaleTo(selection2, function() {
62303 var k0 = _transform.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2;
62307 zoom.scaleTo = function(selection2, k2, p2) {
62308 zoom.transform(selection2, function() {
62309 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;
62310 return constrain(translate(scale(t0, k1), p02, p1), e3, translateExtent);
62313 zoom.translateBy = function(selection2, x2, y2) {
62314 zoom.transform(selection2, function() {
62315 return constrain(_transform.translate(
62316 typeof x2 === "function" ? x2.apply(this, arguments) : x2,
62317 typeof y2 === "function" ? y2.apply(this, arguments) : y2
62318 ), extent.apply(this, arguments), translateExtent);
62321 zoom.translateTo = function(selection2, x2, y2, p2) {
62322 zoom.transform(selection2, function() {
62323 var e3 = extent.apply(this, arguments), t2 = _transform, p02 = !p2 ? centroid(e3) : typeof p2 === "function" ? p2.apply(this, arguments) : p2;
62324 return constrain(identity2.translate(p02[0], p02[1]).scale(t2.k).translate(
62325 typeof x2 === "function" ? -x2.apply(this, arguments) : -x2,
62326 typeof y2 === "function" ? -y2.apply(this, arguments) : -y2
62327 ), e3, translateExtent);
62330 function scale(transform2, k2) {
62331 k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2));
62332 return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y);
62334 function translate(transform2, p02, p1) {
62335 var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k;
62336 return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2);
62338 function centroid(extent2) {
62339 return [(+extent2[0][0] + +extent2[1][0]) / 2, (+extent2[0][1] + +extent2[1][1]) / 2];
62341 function schedule(transition2, transform2, point) {
62342 transition2.on("start.zoom", function() {
62343 gesture(this, arguments).start(null);
62344 }).on("interrupt.zoom end.zoom", function() {
62345 gesture(this, arguments).end(null);
62346 }).tween("zoom", function() {
62347 var that = this, args = arguments, g3 = gesture(that, args), e3 = extent.apply(that, args), p2 = !point ? centroid(e3) : typeof point === "function" ? point.apply(that, args) : point, 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));
62348 return function(t2) {
62353 var k2 = w2 / l2[2];
62354 t2 = new Transform(k2, p2[0] - l2[0] * k2, p2[1] - l2[1] * k2);
62356 g3.zoom(null, null, t2);
62360 function gesture(that, args, clean2) {
62361 return !clean2 && _activeGesture || new Gesture(that, args);
62363 function Gesture(that, args) {
62367 this.extent = extent.apply(that, args);
62369 Gesture.prototype = {
62370 start: function(d3_event) {
62371 if (++this.active === 1) {
62372 _activeGesture = this;
62373 dispatch14.call("start", this, d3_event);
62377 zoom: function(d3_event, key, transform2) {
62378 if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]);
62379 if (this.pointer0 && key !== "touch") this.pointer0[1] = transform2.invert(this.pointer0[0]);
62380 if (this.pointer1 && key !== "touch") this.pointer1[1] = transform2.invert(this.pointer1[0]);
62381 _transform = transform2;
62382 dispatch14.call("zoom", this, d3_event, key, transform2);
62385 end: function(d3_event) {
62386 if (--this.active === 0) {
62387 _activeGesture = null;
62388 dispatch14.call("end", this, d3_event);
62393 function wheeled(d3_event) {
62394 if (!filter2.apply(this, arguments)) return;
62395 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);
62397 if (g3.mouse[0][0] !== p2[0] || g3.mouse[0][1] !== p2[1]) {
62398 g3.mouse[1] = t2.invert(g3.mouse[0] = p2);
62400 clearTimeout(g3.wheel);
62402 g3.mouse = [p2, t2.invert(p2)];
62403 interrupt_default(this);
62404 g3.start(d3_event);
62406 d3_event.preventDefault();
62407 d3_event.stopImmediatePropagation();
62408 g3.wheel = setTimeout(wheelidled, _wheelDelay);
62409 g3.zoom(d3_event, "mouse", constrain(translate(scale(t2, k2), g3.mouse[0], g3.mouse[1]), g3.extent, translateExtent));
62410 function wheelidled() {
62415 var _downPointerIDs = /* @__PURE__ */ new Set();
62416 var _pointerLocGetter;
62417 function pointerdown(d3_event) {
62418 _downPointerIDs.add(d3_event.pointerId);
62419 if (!filter2.apply(this, arguments)) return;
62420 var g3 = gesture(this, arguments, _downPointerIDs.size === 1);
62422 d3_event.stopImmediatePropagation();
62423 _pointerLocGetter = utilFastMouse(this);
62424 var loc = _pointerLocGetter(d3_event);
62425 var p2 = [loc, _transform.invert(loc), d3_event.pointerId];
62426 if (!g3.pointer0) {
62429 } else if (!g3.pointer1 && g3.pointer0[2] !== p2[2]) {
62433 interrupt_default(this);
62434 g3.start(d3_event);
62437 function pointermove(d3_event) {
62438 if (!_downPointerIDs.has(d3_event.pointerId)) return;
62439 if (!_activeGesture || !_pointerLocGetter) return;
62440 var g3 = gesture(this, arguments);
62441 var isPointer0 = g3.pointer0 && g3.pointer0[2] === d3_event.pointerId;
62442 var isPointer1 = !isPointer0 && g3.pointer1 && g3.pointer1[2] === d3_event.pointerId;
62443 if ((isPointer0 || isPointer1) && "buttons" in d3_event && !d3_event.buttons) {
62444 if (g3.pointer0) _downPointerIDs.delete(g3.pointer0[2]);
62445 if (g3.pointer1) _downPointerIDs.delete(g3.pointer1[2]);
62449 d3_event.preventDefault();
62450 d3_event.stopImmediatePropagation();
62451 var loc = _pointerLocGetter(d3_event);
62453 if (isPointer0) g3.pointer0[0] = loc;
62454 else if (isPointer1) g3.pointer1[0] = loc;
62457 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;
62458 t2 = scale(t2, Math.sqrt(dp / dl));
62459 p2 = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2];
62460 l2 = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
62461 } else if (g3.pointer0) {
62462 p2 = g3.pointer0[0];
62463 l2 = g3.pointer0[1];
62467 g3.zoom(d3_event, "touch", constrain(translate(t2, p2, l2), g3.extent, translateExtent));
62469 function pointerup(d3_event) {
62470 if (!_downPointerIDs.has(d3_event.pointerId)) return;
62471 _downPointerIDs.delete(d3_event.pointerId);
62472 if (!_activeGesture) return;
62473 var g3 = gesture(this, arguments);
62474 d3_event.stopImmediatePropagation();
62475 if (g3.pointer0 && g3.pointer0[2] === d3_event.pointerId) delete g3.pointer0;
62476 else if (g3.pointer1 && g3.pointer1[2] === d3_event.pointerId) delete g3.pointer1;
62477 if (g3.pointer1 && !g3.pointer0) {
62478 g3.pointer0 = g3.pointer1;
62479 delete g3.pointer1;
62482 g3.pointer0[1] = _transform.invert(g3.pointer0[0]);
62487 zoom.wheelDelta = function(_2) {
62488 return arguments.length ? (wheelDelta = utilFunctor(+_2), zoom) : wheelDelta;
62490 zoom.filter = function(_2) {
62491 return arguments.length ? (filter2 = utilFunctor(!!_2), zoom) : filter2;
62493 zoom.extent = function(_2) {
62494 return arguments.length ? (extent = utilFunctor([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom) : extent;
62496 zoom.scaleExtent = function(_2) {
62497 return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom) : [scaleExtent[0], scaleExtent[1]];
62499 zoom.translateExtent = function(_2) {
62500 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]]];
62502 zoom.constrain = function(_2) {
62503 return arguments.length ? (constrain = _2, zoom) : constrain;
62505 zoom.interpolate = function(_2) {
62506 return arguments.length ? (interpolate = _2, zoom) : interpolate;
62508 zoom._transform = function(_2) {
62509 return arguments.length ? (_transform = _2, zoom) : _transform;
62511 return utilRebind(zoom, dispatch14, "on");
62514 // modules/util/double_up.js
62515 function utilDoubleUp() {
62516 var dispatch14 = dispatch_default("doubleUp");
62517 var _maxTimespan = 500;
62518 var _maxDistance = 20;
62520 function pointerIsValidFor(loc) {
62521 return (/* @__PURE__ */ new Date()).getTime() - _pointer.startTime <= _maxTimespan && // all pointer events must occur within a small distance of the first pointerdown
62522 geoVecLength(_pointer.startLoc, loc) <= _maxDistance;
62524 function pointerdown(d3_event) {
62525 if (d3_event.ctrlKey || d3_event.button === 2) return;
62526 var loc = [d3_event.clientX, d3_event.clientY];
62527 if (_pointer && !pointerIsValidFor(loc)) {
62533 startTime: (/* @__PURE__ */ new Date()).getTime(),
62535 pointerId: d3_event.pointerId
62538 _pointer.pointerId = d3_event.pointerId;
62541 function pointerup(d3_event) {
62542 if (d3_event.ctrlKey || d3_event.button === 2) return;
62543 if (!_pointer || _pointer.pointerId !== d3_event.pointerId) return;
62544 _pointer.upCount += 1;
62545 if (_pointer.upCount === 2) {
62546 var loc = [d3_event.clientX, d3_event.clientY];
62547 if (pointerIsValidFor(loc)) {
62548 var locInThis = utilFastMouse(this)(d3_event);
62549 dispatch14.call("doubleUp", this, d3_event, locInThis);
62554 function doubleUp(selection2) {
62555 if ("PointerEvent" in window) {
62556 selection2.on("pointerdown.doubleUp", pointerdown).on("pointerup.doubleUp", pointerup);
62558 selection2.on("dblclick.doubleUp", function(d3_event) {
62559 dispatch14.call("doubleUp", this, d3_event, utilFastMouse(this)(d3_event));
62563 doubleUp.off = function(selection2) {
62564 selection2.on("pointerdown.doubleUp", null).on("pointerup.doubleUp", null).on("dblclick.doubleUp", null);
62566 return utilRebind(doubleUp, dispatch14, "on");
62569 // modules/renderer/map.js
62570 var TILESIZE = 256;
62573 var kMin = geoZoomToScale(minZoom2, TILESIZE);
62574 var kMax = geoZoomToScale(maxZoom, TILESIZE);
62575 function clamp2(num, min3, max3) {
62576 return Math.max(min3, Math.min(num, max3));
62578 function rendererMap(context) {
62579 var dispatch14 = dispatch_default(
62582 "crossEditableZoom",
62584 "changeHighlighting",
62587 var projection2 = context.projection;
62588 var curtainProjection = context.curtainProjection;
62596 var _selection = select_default2(null);
62597 var supersurface = select_default2(null);
62598 var wrapper = select_default2(null);
62599 var surface = select_default2(null);
62600 var _dimensions = [1, 1];
62601 var _dblClickZoomEnabled = true;
62602 var _redrawEnabled = true;
62603 var _gestureTransformStart;
62604 var _transformStart = projection2.transform();
62605 var _transformLast;
62606 var _isTransformed = false;
62608 var _getMouseCoords;
62609 var _lastPointerEvent;
62610 var _lastWithinEditableZoom;
62611 var _pointerDown = false;
62612 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
62613 var _zoomerPannerFunction = "PointerEvent" in window ? utilZoomPan : zoom_default2;
62614 var _zoomerPanner = _zoomerPannerFunction().scaleExtent([kMin, kMax]).interpolate(value_default).filter(zoomEventFilter).on("zoom.map", zoomPan2).on("start.map", function(d3_event) {
62615 _pointerDown = d3_event && (d3_event.type === "pointerdown" || d3_event.sourceEvent && d3_event.sourceEvent.type === "pointerdown");
62616 }).on("end.map", function() {
62617 _pointerDown = false;
62619 var _doubleUpHandler = utilDoubleUp();
62620 var scheduleRedraw = throttle_default(redraw, 750);
62621 function cancelPendingRedraw() {
62622 scheduleRedraw.cancel();
62624 function map2(selection2) {
62625 _selection = selection2;
62626 context.on("change.map", immediateRedraw);
62627 var osm = context.connection();
62629 osm.on("change.map", immediateRedraw);
62631 function didUndoOrRedo(targetTransform) {
62632 var mode = context.mode().id;
62633 if (mode !== "browse" && mode !== "select") return;
62634 if (targetTransform) {
62635 map2.transformEase(targetTransform);
62638 context.history().on("merge.map", function() {
62640 }).on("change.map", immediateRedraw).on("undone.map", function(stack, fromStack) {
62641 didUndoOrRedo(fromStack.transform);
62642 }).on("redone.map", function(stack) {
62643 didUndoOrRedo(stack.transform);
62645 context.background().on("change.map", immediateRedraw);
62646 context.features().on("redraw.map", immediateRedraw);
62647 drawLayers.on("change.map", function() {
62648 context.background().updateImagery();
62651 selection2.on("wheel.map mousewheel.map", function(d3_event) {
62652 d3_event.preventDefault();
62653 }).call(_zoomerPanner).call(_zoomerPanner.transform, projection2.transform()).on("dblclick.zoom", null);
62654 map2.supersurface = supersurface = selection2.append("div").attr("class", "supersurface").call(utilSetTransform, 0, 0);
62655 wrapper = supersurface.append("div").attr("class", "layer layer-data");
62656 map2.surface = surface = wrapper.call(drawLayers).selectAll(".surface");
62657 surface.call(drawLabels.observe).call(_doubleUpHandler).on(_pointerPrefix + "down.zoom", function(d3_event) {
62658 _lastPointerEvent = d3_event;
62659 if (d3_event.button === 2) {
62660 d3_event.stopPropagation();
62662 }, true).on(_pointerPrefix + "up.zoom", function(d3_event) {
62663 _lastPointerEvent = d3_event;
62664 if (resetTransform()) {
62667 }).on(_pointerPrefix + "move.map", function(d3_event) {
62668 _lastPointerEvent = d3_event;
62669 }).on(_pointerPrefix + "over.vertices", function(d3_event) {
62670 if (map2.editableDataEnabled() && !_isTransformed) {
62671 var hover = d3_event.target.__data__;
62672 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
62673 dispatch14.call("drawn", this, { full: false });
62675 }).on(_pointerPrefix + "out.vertices", function(d3_event) {
62676 if (map2.editableDataEnabled() && !_isTransformed) {
62677 var hover = d3_event.relatedTarget && d3_event.relatedTarget.__data__;
62678 surface.call(drawVertices.drawHover, context.graph(), hover, map2.extent());
62679 dispatch14.call("drawn", this, { full: false });
62682 var detected = utilDetect();
62683 if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
62684 // but we only need to do this on desktop Safari anyway. – #7694
62685 !detected.isMobileWebKit) {
62686 surface.on("gesturestart.surface", function(d3_event) {
62687 d3_event.preventDefault();
62688 _gestureTransformStart = projection2.transform();
62689 }).on("gesturechange.surface", gestureChange);
62692 _doubleUpHandler.on("doubleUp.map", function(d3_event, p02) {
62693 if (!_dblClickZoomEnabled) return;
62694 if (typeof d3_event.target.__data__ === "object" && // or area fills
62695 !select_default2(d3_event.target).classed("fill")) return;
62696 var zoomOut2 = d3_event.shiftKey;
62697 var t2 = projection2.transform();
62698 var p1 = t2.invert(p02);
62699 t2 = t2.scale(zoomOut2 ? 0.5 : 2);
62700 t2.x = p02[0] - p1[0] * t2.k;
62701 t2.y = p02[1] - p1[1] * t2.k;
62702 map2.transformEase(t2);
62704 context.on("enter.map", function() {
62705 if (!map2.editableDataEnabled(
62707 /* skip zoom check */
62709 if (_isTransformed) return;
62710 var graph = context.graph();
62711 var selectedAndParents = {};
62712 context.selectedIDs().forEach(function(id2) {
62713 var entity = graph.hasEntity(id2);
62715 selectedAndParents[entity.id] = entity;
62716 if (entity.type === "node") {
62717 graph.parentWays(entity).forEach(function(parent) {
62718 selectedAndParents[parent.id] = parent;
62723 var data = Object.values(selectedAndParents);
62724 var filter2 = function(d2) {
62725 return d2.id in selectedAndParents;
62727 data = context.features().filter(data, graph);
62728 surface.call(drawVertices.drawSelected, graph, map2.extent()).call(drawLines, graph, data, filter2).call(drawAreas, graph, data, filter2).call(drawMidpoints, graph, data, filter2, map2.trimmedExtent());
62729 dispatch14.call("drawn", this, { full: false });
62732 map2.dimensions(utilGetDimensions(selection2));
62734 function zoomEventFilter(d3_event) {
62735 if (d3_event.type === "mousedown") {
62736 var hasOrphan = false;
62737 var listeners = window.__on;
62738 for (var i3 = 0; i3 < listeners.length; i3++) {
62739 var listener = listeners[i3];
62740 if (listener.name === "zoom" && listener.type === "mouseup") {
62746 var event = window.CustomEvent;
62748 event = new event("mouseup");
62750 event = window.document.createEvent("Event");
62751 event.initEvent("mouseup", false, false);
62753 event.view = window;
62754 window.dispatchEvent(event);
62757 return d3_event.button !== 2;
62759 function pxCenter() {
62760 return [_dimensions[0] / 2, _dimensions[1] / 2];
62762 function drawEditable(difference2, extent) {
62763 var mode = context.mode();
62764 var graph = context.graph();
62765 var features = context.features();
62766 var all = context.history().intersects(map2.extent());
62767 var fullRedraw = false;
62771 var applyFeatureLayerFilters = true;
62772 if (map2.isInWideSelection()) {
62774 utilEntityAndDeepMemberIDs(mode.selectedIDs(), context.graph()).forEach(function(id2) {
62775 var entity = context.hasEntity(id2);
62776 if (entity) data.push(entity);
62779 filter2 = utilFunctor(true);
62780 applyFeatureLayerFilters = false;
62781 } else if (difference2) {
62782 var complete = difference2.complete(map2.extent());
62783 data = Object.values(complete).filter(Boolean);
62784 set4 = new Set(Object.keys(complete));
62785 filter2 = function(d2) {
62786 return set4.has(d2.id);
62788 features.clear(data);
62790 if (features.gatherStats(all, graph, _dimensions)) {
62794 data = context.history().intersects(map2.extent().intersection(extent));
62795 set4 = new Set(data.map(function(entity) {
62798 filter2 = function(d2) {
62799 return set4.has(d2.id);
62804 filter2 = utilFunctor(true);
62807 if (applyFeatureLayerFilters) {
62808 data = features.filter(data, graph);
62810 context.features().resetStats();
62812 if (mode && mode.id === "select") {
62813 surface.call(drawVertices.drawSelected, graph, map2.extent());
62815 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);
62816 dispatch14.call("drawn", this, { full: true });
62818 map2.init = function() {
62819 drawLayers = svgLayers(projection2, context);
62820 drawPoints = svgPoints(projection2, context);
62821 drawVertices = svgVertices(projection2, context);
62822 drawLines = svgLines(projection2, context);
62823 drawAreas = svgAreas(projection2, context);
62824 drawMidpoints = svgMidpoints(projection2, context);
62825 drawLabels = svgLabels(projection2, context);
62827 function editOff() {
62828 context.features().resetStats();
62829 surface.selectAll(".layer-osm *").remove();
62830 surface.selectAll(".layer-touch:not(.markers) *").remove();
62834 "select-note": true,
62835 "select-data": true,
62836 "select-error": true
62838 var mode = context.mode();
62839 if (mode && !allowed[mode.id]) {
62840 context.enter(modeBrowse(context));
62842 dispatch14.call("drawn", this, { full: true });
62844 function gestureChange(d3_event) {
62846 e3.preventDefault();
62849 // dummy values to ignore in zoomPan
62851 // dummy values to ignore in zoomPan
62852 clientX: e3.clientX,
62853 clientY: e3.clientY,
62854 screenX: e3.screenX,
62855 screenY: e3.screenY,
62859 var e22 = new WheelEvent("wheel", props);
62860 e22._scale = e3.scale;
62861 e22._rotation = e3.rotation;
62862 _selection.node().dispatchEvent(e22);
62864 function zoomPan2(event, key, transform2) {
62865 var source = event && event.sourceEvent || event;
62866 var eventTransform = transform2 || event && event.transform;
62867 var x2 = eventTransform.x;
62868 var y2 = eventTransform.y;
62869 var k2 = eventTransform.k;
62870 if (source && source.type === "wheel") {
62871 if (_pointerDown) return;
62872 var detected = utilDetect();
62873 var dX = source.deltaX;
62874 var dY = source.deltaY;
62879 if (source.deltaMode === 1) {
62880 var lines = Math.abs(source.deltaY);
62881 var sign2 = source.deltaY > 0 ? 1 : -1;
62882 dY = sign2 * clamp2(
62883 Math.exp((lines - 1) * 0.75) * 4.000244140625,
62889 if (detected.os !== "mac") {
62892 t0 = _isTransformed ? _transformLast : _transformStart;
62893 p02 = _getMouseCoords(source);
62894 p1 = t0.invert(p02);
62895 k22 = t0.k * Math.pow(2, -dY / 500);
62896 k22 = clamp2(k22, kMin, kMax);
62897 x22 = p02[0] - p1[0] * k22;
62898 y22 = p02[1] - p1[1] * k22;
62899 } else if (source._scale) {
62900 t0 = _gestureTransformStart;
62901 p02 = _getMouseCoords(source);
62902 p1 = t0.invert(p02);
62903 k22 = t0.k * source._scale;
62904 k22 = clamp2(k22, kMin, kMax);
62905 x22 = p02[0] - p1[0] * k22;
62906 y22 = p02[1] - p1[1] * k22;
62907 } else if (source.ctrlKey && !isInteger(dY)) {
62909 t0 = _isTransformed ? _transformLast : _transformStart;
62910 p02 = _getMouseCoords(source);
62911 p1 = t0.invert(p02);
62912 k22 = t0.k * Math.pow(2, -dY / 500);
62913 k22 = clamp2(k22, kMin, kMax);
62914 x22 = p02[0] - p1[0] * k22;
62915 y22 = p02[1] - p1[1] * k22;
62916 } else if ((source.altKey || source.shiftKey) && isInteger(dY)) {
62917 t0 = _isTransformed ? _transformLast : _transformStart;
62918 p02 = _getMouseCoords(source);
62919 p1 = t0.invert(p02);
62920 k22 = t0.k * Math.pow(2, -dY / 500);
62921 k22 = clamp2(k22, kMin, kMax);
62922 x22 = p02[0] - p1[0] * k22;
62923 y22 = p02[1] - p1[1] * k22;
62924 } else if (detected.os === "mac" && detected.browser !== "Firefox" && !source.ctrlKey && isInteger(dX) && isInteger(dY)) {
62925 p1 = projection2.translate();
62928 k22 = projection2.scale();
62929 k22 = clamp2(k22, kMin, kMax);
62931 if (x22 !== x2 || y22 !== y2 || k22 !== k2) {
62935 eventTransform = identity2.translate(x22, y22).scale(k22);
62936 if (_zoomerPanner._transform) {
62937 _zoomerPanner._transform(eventTransform);
62939 _selection.node().__zoom = eventTransform;
62943 if (_transformStart.x === x2 && _transformStart.y === y2 && _transformStart.k === k2) {
62946 if (geoScaleToZoom(k2, TILESIZE) < _minzoom) {
62947 surface.interrupt();
62948 dispatch14.call("hitMinZoom", this, map2);
62949 setCenterZoom(map2.center(), context.minEditableZoom(), 0, true);
62951 dispatch14.call("move", this, map2);
62954 projection2.transform(eventTransform);
62955 var withinEditableZoom = map2.withinEditableZoom();
62956 if (_lastWithinEditableZoom !== withinEditableZoom) {
62957 if (_lastWithinEditableZoom !== void 0) {
62958 dispatch14.call("crossEditableZoom", this, withinEditableZoom);
62960 _lastWithinEditableZoom = withinEditableZoom;
62962 var scale = k2 / _transformStart.k;
62963 var tX = (x2 / scale - _transformStart.x) * scale;
62964 var tY = (y2 / scale - _transformStart.y) * scale;
62965 if (context.inIntro()) {
62966 curtainProjection.transform({
62973 _lastPointerEvent = event;
62975 _isTransformed = true;
62976 _transformLast = eventTransform;
62977 utilSetTransform(supersurface, tX, tY, scale);
62979 dispatch14.call("move", this, map2);
62980 function isInteger(val) {
62981 return typeof val === "number" && isFinite(val) && Math.floor(val) === val;
62984 function resetTransform() {
62985 if (!_isTransformed) return false;
62986 utilSetTransform(supersurface, 0, 0);
62987 _isTransformed = false;
62988 if (context.inIntro()) {
62989 curtainProjection.transform(projection2.transform());
62993 function redraw(difference2, extent) {
62994 if (surface.empty() || !_redrawEnabled) return;
62995 if (resetTransform()) {
62996 difference2 = extent = void 0;
62998 var zoom = map2.zoom();
62999 var z2 = String(~~zoom);
63000 if (surface.attr("data-zoom") !== z2) {
63001 surface.attr("data-zoom", z2);
63003 var lat = map2.center()[1];
63004 var lowzoom = linear3().domain([-60, 0, 60]).range([17, 18.5, 17]).clamp(true);
63005 surface.classed("low-zoom", zoom <= lowzoom(lat));
63006 if (!difference2) {
63007 supersurface.call(context.background());
63008 wrapper.call(drawLayers);
63010 if (map2.editableDataEnabled() || map2.isInWideSelection()) {
63011 context.loadTiles(projection2);
63012 drawEditable(difference2, extent);
63016 _transformStart = projection2.transform();
63019 var immediateRedraw = function(difference2, extent) {
63020 if (!difference2 && !extent) cancelPendingRedraw();
63021 redraw(difference2, extent);
63023 map2.lastPointerEvent = function() {
63024 return _lastPointerEvent;
63026 map2.mouse = function(d3_event) {
63027 var event = d3_event || _lastPointerEvent;
63030 while (s2 = event.sourceEvent) {
63033 return _getMouseCoords(event);
63037 map2.mouseCoordinates = function() {
63038 var coord2 = map2.mouse() || pxCenter();
63039 return projection2.invert(coord2);
63041 map2.dblclickZoomEnable = function(val) {
63042 if (!arguments.length) return _dblClickZoomEnabled;
63043 _dblClickZoomEnabled = val;
63046 map2.redrawEnable = function(val) {
63047 if (!arguments.length) return _redrawEnabled;
63048 _redrawEnabled = val;
63051 map2.isTransformed = function() {
63052 return _isTransformed;
63054 function setTransform(t2, duration, force) {
63055 var t3 = projection2.transform();
63056 if (!force && t2.k === t3.k && t2.x === t3.x && t2.y === t3.y) return false;
63058 _selection.transition().duration(duration).on("start", function() {
63060 }).call(_zoomerPanner.transform, identity2.translate(t2.x, t2.y).scale(t2.k));
63062 projection2.transform(t2);
63063 _transformStart = t2;
63064 _selection.call(_zoomerPanner.transform, _transformStart);
63068 function setCenterZoom(loc2, z2, duration, force) {
63069 var c2 = map2.center();
63070 var z3 = map2.zoom();
63071 if (loc2[0] === c2[0] && loc2[1] === c2[1] && z2 === z3 && !force) return false;
63072 var proj = geoRawMercator().transform(projection2.transform());
63073 var k2 = clamp2(geoZoomToScale(z2, TILESIZE), kMin, kMax);
63075 var t2 = proj.translate();
63076 var point = proj(loc2);
63077 var center = pxCenter();
63078 t2[0] += center[0] - point[0];
63079 t2[1] += center[1] - point[1];
63080 return setTransform(identity2.translate(t2[0], t2[1]).scale(k2), duration, force);
63082 map2.pan = function(delta, duration) {
63083 var t2 = projection2.translate();
63084 var k2 = projection2.scale();
63088 _selection.transition().duration(duration).on("start", function() {
63090 }).call(_zoomerPanner.transform, identity2.translate(t2[0], t2[1]).scale(k2));
63092 projection2.translate(t2);
63093 _transformStart = projection2.transform();
63094 _selection.call(_zoomerPanner.transform, _transformStart);
63095 dispatch14.call("move", this, map2);
63100 map2.dimensions = function(val) {
63101 if (!arguments.length) return _dimensions;
63103 drawLayers.dimensions(_dimensions);
63104 context.background().dimensions(_dimensions);
63105 projection2.clipExtent([[0, 0], _dimensions]);
63106 _getMouseCoords = utilFastMouse(supersurface.node());
63110 function zoomIn(delta) {
63111 setCenterZoom(map2.center(), ~~map2.zoom() + delta, 250, true);
63113 function zoomOut(delta) {
63114 setCenterZoom(map2.center(), ~~map2.zoom() - delta, 250, true);
63116 map2.zoomIn = function() {
63119 map2.zoomInFurther = function() {
63122 map2.canZoomIn = function() {
63123 return map2.zoom() < maxZoom;
63125 map2.zoomOut = function() {
63128 map2.zoomOutFurther = function() {
63131 map2.canZoomOut = function() {
63132 return map2.zoom() > minZoom2;
63134 map2.center = function(loc2) {
63135 if (!arguments.length) {
63136 return projection2.invert(pxCenter());
63138 if (setCenterZoom(loc2, map2.zoom())) {
63139 dispatch14.call("move", this, map2);
63144 map2.unobscuredCenterZoomEase = function(loc, zoom) {
63145 var offset = map2.unobscuredOffsetPx();
63146 var proj = geoRawMercator().transform(projection2.transform());
63147 proj.scale(geoZoomToScale(zoom, TILESIZE));
63148 var locPx = proj(loc);
63149 var offsetLocPx = [locPx[0] + offset[0], locPx[1] + offset[1]];
63150 var offsetLoc = proj.invert(offsetLocPx);
63151 map2.centerZoomEase(offsetLoc, zoom);
63153 map2.unobscuredOffsetPx = function() {
63154 var openPane = context.container().select(".map-panes .map-pane.shown");
63155 if (!openPane.empty()) {
63156 return [openPane.node().offsetWidth / 2, 0];
63160 map2.zoom = function(z2) {
63161 if (!arguments.length) {
63162 return Math.max(geoScaleToZoom(projection2.scale(), TILESIZE), 0);
63164 if (z2 < _minzoom) {
63165 surface.interrupt();
63166 dispatch14.call("hitMinZoom", this, map2);
63167 z2 = context.minEditableZoom();
63169 if (setCenterZoom(map2.center(), z2)) {
63170 dispatch14.call("move", this, map2);
63175 map2.centerZoom = function(loc2, z2) {
63176 if (setCenterZoom(loc2, z2)) {
63177 dispatch14.call("move", this, map2);
63182 map2.zoomTo = function(entities) {
63183 if (!isArray_default(entities)) {
63184 entities = [entities];
63186 if (entities.length === 0) return map2;
63187 var extent = entities.map((entity) => entity.extent(context.graph())).reduce((a2, b2) => a2.extend(b2));
63188 if (!isFinite(extent.area())) return map2;
63189 var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
63190 return map2.centerZoom(extent.center(), z2);
63192 map2.centerEase = function(loc2, duration) {
63193 duration = duration || 250;
63194 setCenterZoom(loc2, map2.zoom(), duration);
63197 map2.zoomEase = function(z2, duration) {
63198 duration = duration || 250;
63199 setCenterZoom(map2.center(), z2, duration, false);
63202 map2.centerZoomEase = function(loc2, z2, duration) {
63203 duration = duration || 250;
63204 setCenterZoom(loc2, z2, duration, false);
63207 map2.transformEase = function(t2, duration) {
63208 duration = duration || 250;
63217 map2.zoomToEase = function(obj, duration) {
63219 if (Array.isArray(obj)) {
63220 obj.forEach(function(entity) {
63221 var entityExtent = entity.extent(context.graph());
63223 extent = entityExtent;
63225 extent = extent.extend(entityExtent);
63229 extent = obj.extent(context.graph());
63231 if (!isFinite(extent.area())) return map2;
63232 var z2 = clamp2(map2.trimmedExtentZoom(extent), 0, 20);
63233 return map2.centerZoomEase(extent.center(), z2, duration);
63235 map2.startEase = function() {
63236 utilBindOnce(surface, _pointerPrefix + "down.ease", function() {
63241 map2.cancelEase = function() {
63242 _selection.interrupt();
63245 map2.extent = function(val) {
63246 if (!arguments.length) {
63247 return new geoExtent(
63248 projection2.invert([0, _dimensions[1]]),
63249 projection2.invert([_dimensions[0], 0])
63252 var extent = geoExtent(val);
63253 map2.centerZoom(extent.center(), map2.extentZoom(extent));
63256 map2.trimmedExtent = function(val) {
63257 if (!arguments.length) {
63261 return new geoExtent(
63262 projection2.invert([pad2, _dimensions[1] - footerY - pad2]),
63263 projection2.invert([_dimensions[0] - pad2, headerY + pad2])
63266 var extent = geoExtent(val);
63267 map2.centerZoom(extent.center(), map2.trimmedExtentZoom(extent));
63270 function calcExtentZoom(extent, dim) {
63271 var tl = projection2([extent[0][0], extent[1][1]]);
63272 var br2 = projection2([extent[1][0], extent[0][1]]);
63273 var hFactor = (br2[0] - tl[0]) / dim[0];
63274 var vFactor = (br2[1] - tl[1]) / dim[1];
63275 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
63276 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
63277 var newZoom = map2.zoom() - Math.max(hZoomDiff, vZoomDiff);
63280 map2.extentZoom = function(val) {
63281 return calcExtentZoom(geoExtent(val), _dimensions);
63283 map2.trimmedExtentZoom = function(val) {
63286 var trimmed = [_dimensions[0] - trimX, _dimensions[1] - trimY];
63287 return calcExtentZoom(geoExtent(val), trimmed);
63289 map2.withinEditableZoom = function() {
63290 return map2.zoom() >= context.minEditableZoom();
63292 map2.isInWideSelection = function() {
63293 return !map2.withinEditableZoom() && context.selectedIDs().length;
63295 map2.editableDataEnabled = function(skipZoomCheck) {
63296 var layer = context.layers().layer("osm");
63297 if (!layer || !layer.enabled()) return false;
63298 return skipZoomCheck || map2.withinEditableZoom();
63300 map2.notesEditable = function() {
63301 var layer = context.layers().layer("notes");
63302 if (!layer || !layer.enabled()) return false;
63303 return map2.withinEditableZoom();
63305 map2.minzoom = function(val) {
63306 if (!arguments.length) return _minzoom;
63310 map2.toggleHighlightEdited = function() {
63311 surface.classed("highlight-edited", !surface.classed("highlight-edited"));
63313 dispatch14.call("changeHighlighting", this);
63315 map2.areaFillOptions = ["wireframe", "partial", "full"];
63316 map2.activeAreaFill = function(val) {
63317 if (!arguments.length) return corePreferences("area-fill") || "partial";
63318 corePreferences("area-fill", val);
63319 if (val !== "wireframe") {
63320 corePreferences("area-fill-toggle", val);
63324 dispatch14.call("changeAreaFill", this);
63327 map2.toggleWireframe = function() {
63328 var activeFill = map2.activeAreaFill();
63329 if (activeFill === "wireframe") {
63330 activeFill = corePreferences("area-fill-toggle") || "partial";
63332 activeFill = "wireframe";
63334 map2.activeAreaFill(activeFill);
63336 function updateAreaFill() {
63337 var activeFill = map2.activeAreaFill();
63338 map2.areaFillOptions.forEach(function(opt) {
63339 surface.classed("fill-" + opt, Boolean(opt === activeFill));
63342 map2.layers = () => drawLayers;
63343 map2.doubleUpHandler = function() {
63344 return _doubleUpHandler;
63346 return utilRebind(map2, dispatch14, "on");
63349 // modules/renderer/photos.js
63350 function rendererPhotos(context) {
63351 var dispatch14 = dispatch_default("change");
63352 var _layerIDs = ["streetside", "mapillary", "mapillary-map-features", "mapillary-signs", "kartaview", "mapilio", "vegbilder", "panoramax"];
63353 var _allPhotoTypes = ["flat", "panoramic"];
63354 var _shownPhotoTypes = _allPhotoTypes.slice();
63355 var _dateFilters = ["fromDate", "toDate"];
63359 function photos() {
63361 function updateStorage() {
63362 if (window.mocha) return;
63363 var hash = utilStringQs(window.location.hash);
63364 var enabled = context.layers().all().filter(function(d2) {
63365 return _layerIDs.indexOf(d2.id) !== -1 && d2.layer && d2.layer.supported() && d2.layer.enabled();
63366 }).map(function(d2) {
63369 if (enabled.length) {
63370 hash.photo_overlay = enabled.join(",");
63372 delete hash.photo_overlay;
63374 window.location.replace("#" + utilQsString(hash, true));
63376 photos.overlayLayerIDs = function() {
63379 photos.allPhotoTypes = function() {
63380 return _allPhotoTypes;
63382 photos.dateFilters = function() {
63383 return _dateFilters;
63385 photos.dateFilterValue = function(val) {
63386 return val === _dateFilters[0] ? _fromDate : _toDate;
63388 photos.setDateFilter = function(type2, val, updateUrl) {
63389 var date = val && new Date(val);
63390 if (date && !isNaN(date)) {
63391 val = date.toISOString().slice(0, 10);
63395 if (type2 === _dateFilters[0]) {
63397 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
63398 _toDate = _fromDate;
63401 if (type2 === _dateFilters[1]) {
63403 if (_fromDate && _toDate && new Date(_toDate) < new Date(_fromDate)) {
63404 _fromDate = _toDate;
63407 dispatch14.call("change", this);
63410 if (_fromDate || _toDate) {
63411 rangeString = (_fromDate || "") + "_" + (_toDate || "");
63413 setUrlFilterValue("photo_dates", rangeString);
63416 photos.setUsernameFilter = function(val, updateUrl) {
63417 if (val && typeof val === "string") val = val.replace(/;/g, ",").split(",");
63419 val = val.map((d2) => d2.trim()).filter(Boolean);
63425 dispatch14.call("change", this);
63429 hashString = _usernames.join(",");
63431 setUrlFilterValue("photo_username", hashString);
63434 function setUrlFilterValue(property, val) {
63435 if (!window.mocha) {
63436 var hash = utilStringQs(window.location.hash);
63438 if (hash[property] === val) return;
63439 hash[property] = val;
63441 if (!(property in hash)) return;
63442 delete hash[property];
63444 window.location.replace("#" + utilQsString(hash, true));
63447 function showsLayer(id2) {
63448 var layer = context.layers().layer(id2);
63449 return layer && layer.supported() && layer.enabled();
63451 photos.shouldFilterByDate = function() {
63452 return showsLayer("mapillary") || showsLayer("kartaview") || showsLayer("streetside") || showsLayer("vegbilder") || showsLayer("panoramax");
63454 photos.shouldFilterByPhotoType = function() {
63455 return showsLayer("mapillary") || showsLayer("streetside") && showsLayer("kartaview") || showsLayer("vegbilder") || showsLayer("panoramax");
63457 photos.shouldFilterByUsername = function() {
63458 return !showsLayer("mapillary") && showsLayer("kartaview") && !showsLayer("streetside") || showsLayer("panoramax");
63460 photos.showsPhotoType = function(val) {
63461 if (!photos.shouldFilterByPhotoType()) return true;
63462 return _shownPhotoTypes.indexOf(val) !== -1;
63464 photos.showsFlat = function() {
63465 return photos.showsPhotoType("flat");
63467 photos.showsPanoramic = function() {
63468 return photos.showsPhotoType("panoramic");
63470 photos.fromDate = function() {
63473 photos.toDate = function() {
63476 photos.togglePhotoType = function(val) {
63477 var index = _shownPhotoTypes.indexOf(val);
63478 if (index !== -1) {
63479 _shownPhotoTypes.splice(index, 1);
63481 _shownPhotoTypes.push(val);
63483 dispatch14.call("change", this);
63486 photos.usernames = function() {
63489 photos.init = function() {
63490 var hash = utilStringQs(window.location.hash);
63491 if (hash.photo_dates) {
63492 var parts = /^(.*)[–_](.*)$/g.exec(hash.photo_dates.trim());
63493 this.setDateFilter("fromDate", parts && parts.length >= 2 && parts[1], false);
63494 this.setDateFilter("toDate", parts && parts.length >= 3 && parts[2], false);
63496 if (hash.photo_username) {
63497 this.setUsernameFilter(hash.photo_username, false);
63499 if (hash.photo_overlay) {
63500 var hashOverlayIDs = hash.photo_overlay.replace(/;/g, ",").split(",");
63501 hashOverlayIDs.forEach(function(id2) {
63502 if (id2 === "openstreetcam") id2 = "kartaview";
63503 var layer2 = _layerIDs.indexOf(id2) !== -1 && context.layers().layer(id2);
63504 if (layer2 && !layer2.enabled()) layer2.enabled(true);
63508 var photoIds = hash.photo.replace(/;/g, ",").split(",");
63509 var photoId = photoIds.length && photoIds[0].trim();
63510 var results = /(.*)\/(.*)/g.exec(photoId);
63511 if (results && results.length >= 3) {
63512 var serviceId = results[1];
63513 if (serviceId === "openstreetcam") serviceId = "kartaview";
63514 var photoKey = results[2];
63515 var service = services[serviceId];
63516 if (service && service.ensureViewerLoaded) {
63517 var layer = _layerIDs.indexOf(serviceId) !== -1 && context.layers().layer(serviceId);
63518 if (layer && !layer.enabled()) layer.enabled(true);
63519 var baselineTime = Date.now();
63520 service.on("loadedImages.rendererPhotos", function() {
63521 if (Date.now() - baselineTime > 45e3) {
63522 service.on("loadedImages.rendererPhotos", null);
63525 if (!service.cachedImage(photoKey)) return;
63526 service.on("loadedImages.rendererPhotos", null);
63527 service.ensureViewerLoaded(context).then(function() {
63528 service.selectImage(context, photoKey).showViewer(context);
63534 context.layers().on("change.rendererPhotos", updateStorage);
63536 return utilRebind(photos, dispatch14, "on");
63539 // modules/ui/map_in_map.js
63540 function uiMapInMap(context) {
63541 function mapInMap(selection2) {
63542 var backgroundLayer = rendererTileLayer(context);
63543 var overlayLayers = {};
63544 var projection2 = geoRawMercator();
63545 var dataLayer = svgData(projection2, context).showLabels(false);
63546 var debugLayer = svgDebug(projection2, context);
63547 var zoom = zoom_default2().scaleExtent([geoZoomToScale(0.5), geoZoomToScale(24)]).on("start", zoomStarted).on("zoom", zoomed).on("end", zoomEnded);
63548 var wrap2 = select_default2(null);
63549 var tiles = select_default2(null);
63550 var viewport = select_default2(null);
63551 var _isTransformed = false;
63552 var _isHidden = true;
63553 var _skipEvents = false;
63554 var _gesture = null;
63561 function zoomStarted() {
63562 if (_skipEvents) return;
63563 _tStart = _tCurr = projection2.transform();
63566 function zoomed(d3_event) {
63567 if (_skipEvents) return;
63568 var x2 = d3_event.transform.x;
63569 var y2 = d3_event.transform.y;
63570 var k2 = d3_event.transform.k;
63571 var isZooming = k2 !== _tStart.k;
63572 var isPanning = x2 !== _tStart.x || y2 !== _tStart.y;
63573 if (!isZooming && !isPanning) {
63577 _gesture = isZooming ? "zoom" : "pan";
63579 var tMini = projection2.transform();
63581 if (_gesture === "zoom") {
63582 scale = k2 / tMini.k;
63583 tX = (_cMini[0] / scale - _cMini[0]) * scale;
63584 tY = (_cMini[1] / scale - _cMini[1]) * scale;
63591 utilSetTransform(tiles, tX, tY, scale);
63592 utilSetTransform(viewport, 0, 0, scale);
63593 _isTransformed = true;
63594 _tCurr = identity2.translate(x2, y2).scale(k2);
63595 var zMain = geoScaleToZoom(context.projection.scale());
63596 var zMini = geoScaleToZoom(k2);
63597 _zDiff = zMain - zMini;
63600 function zoomEnded() {
63601 if (_skipEvents) return;
63602 if (_gesture !== "pan") return;
63603 updateProjection();
63605 context.map().center(projection2.invert(_cMini));
63607 function updateProjection() {
63608 var loc = context.map().center();
63609 var tMain = context.projection.transform();
63610 var zMain = geoScaleToZoom(tMain.k);
63611 var zMini = Math.max(zMain - _zDiff, 0.5);
63612 var kMini = geoZoomToScale(zMini);
63613 projection2.translate([tMain.x, tMain.y]).scale(kMini);
63614 var point = projection2(loc);
63615 var mouse = _gesture === "pan" ? geoVecSubtract([_tCurr.x, _tCurr.y], [_tStart.x, _tStart.y]) : [0, 0];
63616 var xMini = _cMini[0] - point[0] + tMain.x + mouse[0];
63617 var yMini = _cMini[1] - point[1] + tMain.y + mouse[1];
63618 projection2.translate([xMini, yMini]).clipExtent([[0, 0], _dMini]);
63619 _tCurr = projection2.transform();
63620 if (_isTransformed) {
63621 utilSetTransform(tiles, 0, 0);
63622 utilSetTransform(viewport, 0, 0);
63623 _isTransformed = false;
63625 zoom.scaleExtent([geoZoomToScale(0.5), geoZoomToScale(zMain - 3)]);
63626 _skipEvents = true;
63627 wrap2.call(zoom.transform, _tCurr);
63628 _skipEvents = false;
63630 function redraw() {
63631 clearTimeout(_timeoutID);
63632 if (_isHidden) return;
63633 updateProjection();
63634 var zMini = geoScaleToZoom(projection2.scale());
63635 tiles = wrap2.selectAll(".map-in-map-tiles").data([0]);
63636 tiles = tiles.enter().append("div").attr("class", "map-in-map-tiles").merge(tiles);
63637 backgroundLayer.source(context.background().baseLayerSource()).projection(projection2).dimensions(_dMini);
63638 var background = tiles.selectAll(".map-in-map-background").data([0]);
63639 background.enter().append("div").attr("class", "map-in-map-background").merge(background).call(backgroundLayer);
63640 var overlaySources = context.background().overlayLayerSources();
63641 var activeOverlayLayers = [];
63642 for (var i3 = 0; i3 < overlaySources.length; i3++) {
63643 if (overlaySources[i3].validZoom(zMini)) {
63644 if (!overlayLayers[i3]) overlayLayers[i3] = rendererTileLayer(context);
63645 activeOverlayLayers.push(overlayLayers[i3].source(overlaySources[i3]).projection(projection2).dimensions(_dMini));
63648 var overlay = tiles.selectAll(".map-in-map-overlay").data([0]);
63649 overlay = overlay.enter().append("div").attr("class", "map-in-map-overlay").merge(overlay);
63650 var overlays = overlay.selectAll("div").data(activeOverlayLayers, function(d2) {
63651 return d2.source().name();
63653 overlays.exit().remove();
63654 overlays = overlays.enter().append("div").merge(overlays).each(function(layer) {
63655 select_default2(this).call(layer);
63657 var dataLayers = tiles.selectAll(".map-in-map-data").data([0]);
63658 dataLayers.exit().remove();
63659 dataLayers = dataLayers.enter().append("svg").attr("class", "map-in-map-data").merge(dataLayers).call(dataLayer).call(debugLayer);
63660 if (_gesture !== "pan") {
63661 var getPath = path_default(projection2);
63662 var bbox2 = { type: "Polygon", coordinates: [context.map().extent().polygon()] };
63663 viewport = wrap2.selectAll(".map-in-map-viewport").data([0]);
63664 viewport = viewport.enter().append("svg").attr("class", "map-in-map-viewport").merge(viewport);
63665 var path = viewport.selectAll(".map-in-map-bbox").data([bbox2]);
63666 path.enter().append("path").attr("class", "map-in-map-bbox").merge(path).attr("d", getPath).classed("thick", function(d2) {
63667 return getPath.area(d2) < 30;
63671 function queueRedraw() {
63672 clearTimeout(_timeoutID);
63673 _timeoutID = setTimeout(function() {
63677 function toggle(d3_event) {
63678 if (d3_event) d3_event.preventDefault();
63679 _isHidden = !_isHidden;
63680 context.container().select(".minimap-toggle-item").classed("active", !_isHidden).select("input").property("checked", !_isHidden);
63682 wrap2.style("display", "block").style("opacity", "1").transition().duration(200).style("opacity", "0").on("end", function() {
63683 selection2.selectAll(".map-in-map").style("display", "none");
63686 wrap2.style("display", "block").style("opacity", "0").transition().duration(200).style("opacity", "1").on("end", function() {
63691 uiMapInMap.toggle = toggle;
63692 wrap2 = selection2.selectAll(".map-in-map").data([0]);
63693 wrap2 = wrap2.enter().append("div").attr("class", "map-in-map").style("display", _isHidden ? "none" : "block").call(zoom).on("dblclick.zoom", null).merge(wrap2);
63694 _dMini = [200, 150];
63695 _cMini = geoVecScale(_dMini, 0.5);
63696 context.map().on("drawn.map-in-map", function(drawn) {
63697 if (drawn.full === true) {
63702 context.keybinding().on(_t("background.minimap.key"), toggle);
63707 // modules/ui/notice.js
63708 function uiNotice(context) {
63709 return function(selection2) {
63710 var div = selection2.append("div").attr("class", "notice");
63711 var button = div.append("button").attr("class", "zoom-to notice fillD").on("click", function() {
63712 context.map().zoomEase(context.minEditableZoom());
63713 }).on("wheel", function(d3_event) {
63714 var e22 = new WheelEvent(d3_event.type, d3_event);
63715 context.surface().node().dispatchEvent(e22);
63717 button.call(svgIcon("#iD-icon-plus", "pre-text")).append("span").attr("class", "label").call(_t.append("zoom_in_edit"));
63718 function disableTooHigh() {
63719 var canEdit = context.map().zoom() >= context.minEditableZoom();
63720 div.style("display", canEdit ? "none" : "block");
63722 context.map().on("move.notice", debounce_default(disableTooHigh, 500));
63727 // modules/ui/photoviewer.js
63728 function uiPhotoviewer(context) {
63729 var dispatch14 = dispatch_default("resize");
63730 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
63731 function photoviewer(selection2) {
63732 selection2.append("button").attr("class", "thumb-hide").attr("title", _t("icons.close")).on("click", function() {
63733 if (services.streetside) {
63734 services.streetside.hideViewer(context);
63736 if (services.mapillary) {
63737 services.mapillary.hideViewer(context);
63739 if (services.kartaview) {
63740 services.kartaview.hideViewer(context);
63742 if (services.mapilio) {
63743 services.mapilio.hideViewer(context);
63745 if (services.panoramax) {
63746 services.panoramax.hideViewer(context);
63748 if (services.vegbilder) {
63749 services.vegbilder.hideViewer(context);
63751 }).append("div").call(svgIcon("#iD-icon-close"));
63752 function preventDefault(d3_event) {
63753 d3_event.preventDefault();
63755 selection2.append("button").attr("class", "resize-handle-xy").on("touchstart touchdown touchend", preventDefault).on(
63756 _pointerPrefix + "down",
63757 buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true, resizeOnY: true })
63759 selection2.append("button").attr("class", "resize-handle-x").on("touchstart touchdown touchend", preventDefault).on(
63760 _pointerPrefix + "down",
63761 buildResizeListener(selection2, "resize", dispatch14, { resizeOnX: true })
63763 selection2.append("button").attr("class", "resize-handle-y").on("touchstart touchdown touchend", preventDefault).on(
63764 _pointerPrefix + "down",
63765 buildResizeListener(selection2, "resize", dispatch14, { resizeOnY: true })
63767 context.features().on("change.setPhotoFromViewer", function() {
63768 setPhotoFromViewerButton();
63770 context.history().on("change.setPhotoFromViewer", function() {
63771 setPhotoFromViewerButton();
63773 function setPhotoFromViewerButton() {
63774 if (services.mapillary.isViewerOpen()) {
63775 let setMapillaryPhotoId = function() {
63776 const service = services.mapillary;
63777 const image = service.getActiveImage();
63778 const action = (graph) => context.selectedIDs().reduce((graph2, entityID) => {
63779 const tags = graph2.entity(entityID).tags;
63780 const action2 = actionChangeTags(entityID, { ...tags, mapillary: image.id });
63781 return action2(graph2);
63783 const annotation = _t("operations.change_tags.annotation");
63784 context.perform(action, annotation);
63786 if (context.mode().id !== "select" || !(layerStatus("mapillary") && getServiceId() === "mapillary")) {
63789 if (selection2.select(".set-photo-from-viewer").empty()) {
63790 const button = buttonCreate();
63791 button.on("click", function(e3) {
63792 e3.preventDefault();
63793 e3.stopPropagation();
63794 setMapillaryPhotoId();
63795 buttonDisable("already_set");
63801 function layerStatus(which) {
63802 const layers = context.layers();
63803 const layer = layers.layer(which);
63804 return layer.enabled();
63806 function getServiceId() {
63807 const hash = utilStringQs(window.location.hash);
63810 let result = hash.photo.split("/");
63811 serviceId = result[0];
63815 function buttonCreate() {
63816 const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63817 const buttonEnter = button.enter().append("button").attr("class", "set-photo-from-viewer").call(svgIcon("#iD-icon-plus")).call(
63818 uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer")).placement("right")
63820 buttonEnter.select(".tooltip").classed("dark", true).style("width", "300px");
63821 return buttonEnter;
63823 function buttonRemove() {
63824 const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63827 function buttonShowHide() {
63828 const activeImage = services.mapillary.getActiveImage();
63829 const graph = context.graph();
63830 const entities = context.selectedIDs().map((id2) => graph.entity(id2));
63831 if (entities.map((entity) => entity.tags.mapillary).every((value) => value === (activeImage == null ? void 0 : activeImage.id))) {
63832 buttonDisable("already_set");
63833 } else if (activeImage && entities.map((entity) => entity.extent().center()).every((loc) => geoSphericalDistance(loc, activeImage.loc) > 100)) {
63834 buttonDisable("too_far");
63836 buttonDisable(false);
63839 function buttonDisable(reason) {
63840 const disabled = reason !== false;
63841 const button = selection2.selectAll(".set-photo-from-viewer").data([0]);
63842 button.attr("disabled", disabled ? "true" : null);
63843 button.classed("disabled", disabled);
63844 button.call(uiTooltip().destroyAny);
63847 uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.disable.".concat(reason))).placement("right")
63851 uiTooltip().title(() => _t.append("inspector.set_photo_from_viewer.enable")).placement("right")
63854 button.select(".tooltip").classed("dark", true).style("width", "300px");
63857 function buildResizeListener(target, eventName, dispatch15, options2) {
63858 var resizeOnX = !!options2.resizeOnX;
63859 var resizeOnY = !!options2.resizeOnY;
63860 var minHeight = options2.minHeight || 240;
63861 var minWidth = options2.minWidth || 320;
63867 function startResize(d3_event) {
63868 if (pointerId !== (d3_event.pointerId || "mouse")) return;
63869 d3_event.preventDefault();
63870 d3_event.stopPropagation();
63871 var mapSize = context.map().dimensions();
63873 var maxWidth = mapSize[0];
63874 var newWidth = clamp3(startWidth + d3_event.clientX - startX, minWidth, maxWidth);
63875 target.style("width", newWidth + "px");
63878 var maxHeight = mapSize[1] - 90;
63879 var newHeight = clamp3(startHeight + startY - d3_event.clientY, minHeight, maxHeight);
63880 target.style("height", newHeight + "px");
63882 dispatch15.call(eventName, target, subtractPadding(utilGetDimensions(target, true), target));
63884 function clamp3(num, min3, max3) {
63885 return Math.max(min3, Math.min(num, max3));
63887 function stopResize(d3_event) {
63888 if (pointerId !== (d3_event.pointerId || "mouse")) return;
63889 d3_event.preventDefault();
63890 d3_event.stopPropagation();
63891 select_default2(window).on("." + eventName, null);
63893 return function initResize(d3_event) {
63894 d3_event.preventDefault();
63895 d3_event.stopPropagation();
63896 pointerId = d3_event.pointerId || "mouse";
63897 startX = d3_event.clientX;
63898 startY = d3_event.clientY;
63899 var targetRect = target.node().getBoundingClientRect();
63900 startWidth = targetRect.width;
63901 startHeight = targetRect.height;
63902 select_default2(window).on(_pointerPrefix + "move." + eventName, startResize, false).on(_pointerPrefix + "up." + eventName, stopResize, false);
63903 if (_pointerPrefix === "pointer") {
63904 select_default2(window).on("pointercancel." + eventName, stopResize, false);
63909 photoviewer.onMapResize = function() {
63910 var photoviewer2 = context.container().select(".photoviewer");
63911 var content = context.container().select(".main-content");
63912 var mapDimensions = utilGetDimensions(content, true);
63913 var photoDimensions = utilGetDimensions(photoviewer2, true);
63914 if (photoDimensions[0] > mapDimensions[0] || photoDimensions[1] > mapDimensions[1] - 90) {
63915 var setPhotoDimensions = [
63916 Math.min(photoDimensions[0], mapDimensions[0]),
63917 Math.min(photoDimensions[1], mapDimensions[1] - 90)
63919 photoviewer2.style("width", setPhotoDimensions[0] + "px").style("height", setPhotoDimensions[1] + "px");
63920 dispatch14.call("resize", photoviewer2, subtractPadding(setPhotoDimensions, photoviewer2));
63923 function subtractPadding(dimensions, selection2) {
63925 dimensions[0] - parseFloat(selection2.style("padding-left")) - parseFloat(selection2.style("padding-right")),
63926 dimensions[1] - parseFloat(selection2.style("padding-top")) - parseFloat(selection2.style("padding-bottom"))
63929 return utilRebind(photoviewer, dispatch14, "on");
63932 // modules/ui/restore.js
63933 function uiRestore(context) {
63934 return function(selection2) {
63935 if (!context.history().hasRestorableChanges()) return;
63936 let modalSelection = uiModal(selection2, true);
63937 modalSelection.select(".modal").attr("class", "modal fillL");
63938 let introModal = modalSelection.select(".content");
63939 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("restore.heading"));
63940 introModal.append("div").attr("class", "modal-section").append("p").call(_t.append("restore.description"));
63941 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
63942 let restore = buttonWrap.append("button").attr("class", "restore").on("click", () => {
63943 context.history().restore();
63944 modalSelection.remove();
63946 restore.append("svg").attr("class", "logo logo-restore").append("use").attr("xlink:href", "#iD-logo-restore");
63947 restore.append("div").call(_t.append("restore.restore"));
63948 let reset = buttonWrap.append("button").attr("class", "reset").on("click", () => {
63949 context.history().clearSaved();
63950 modalSelection.remove();
63952 reset.append("svg").attr("class", "logo logo-reset").append("use").attr("xlink:href", "#iD-logo-reset");
63953 reset.append("div").call(_t.append("restore.reset"));
63954 restore.node().focus();
63958 // modules/ui/scale.js
63959 function uiScale(context) {
63960 var projection2 = context.projection, isImperial = !_mainLocalizer.usesMetric(), maxLength = 180, tickHeight = 8;
63961 function scaleDefs(loc1, loc2) {
63962 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;
63964 buckets = [528e4, 528e3, 52800, 5280, 500, 50, 5, 1];
63966 buckets = [5e6, 5e5, 5e4, 5e3, 500, 50, 5, 1];
63968 for (i3 = 0; i3 < buckets.length; i3++) {
63971 scale.dist = Math.floor(dist / val) * val;
63974 scale.dist = +dist.toFixed(2);
63977 dLon = geoMetersToLon(scale.dist / conversion, lat);
63978 scale.px = Math.round(projection2([loc1[0] + dLon, loc1[1]])[0]);
63979 scale.text = displayLength(scale.dist / conversion, isImperial);
63982 function update(selection2) {
63983 var dims = context.map().dimensions(), loc1 = projection2.invert([0, dims[1]]), loc2 = projection2.invert([maxLength, dims[1]]), scale = scaleDefs(loc1, loc2);
63984 selection2.select(".scale-path").attr("d", "M0.5,0.5v" + tickHeight + "h" + scale.px + "v-" + tickHeight);
63985 selection2.select(".scale-text").style(_mainLocalizer.textDirection() === "ltr" ? "left" : "right", scale.px + 16 + "px").text(scale.text);
63987 return function(selection2) {
63988 function switchUnits() {
63989 isImperial = !isImperial;
63990 selection2.call(update);
63992 var scalegroup = selection2.append("svg").attr("class", "scale").on("click", switchUnits).append("g").attr("transform", "translate(10,11)");
63993 scalegroup.append("path").attr("class", "scale-path");
63994 selection2.append("div").attr("class", "scale-text");
63995 selection2.call(update);
63996 context.map().on("move.scale", function() {
63997 update(selection2);
64002 // modules/ui/shortcuts.js
64003 function uiShortcuts(context) {
64004 var detected = utilDetect();
64005 var _activeTab = 0;
64006 var _modalSelection;
64007 var _selection = select_default2(null);
64008 var _dataShortcuts;
64009 function shortcutsModal(_modalSelection2) {
64010 _modalSelection2.select(".modal").classed("modal-shortcuts", true);
64011 var content = _modalSelection2.select(".content");
64012 content.append("div").attr("class", "modal-section header").append("h2").call(_t.append("shortcuts.title"));
64013 _mainFileFetcher.get("shortcuts").then(function(data) {
64014 _dataShortcuts = data;
64015 content.call(render);
64016 }).catch(function() {
64019 function render(selection2) {
64020 if (!_dataShortcuts) return;
64021 var wrapper = selection2.selectAll(".wrapper").data([0]);
64022 var wrapperEnter = wrapper.enter().append("div").attr("class", "wrapper modal-section");
64023 var tabsBar = wrapperEnter.append("div").attr("class", "tabs-bar");
64024 var shortcutsList = wrapperEnter.append("div").attr("class", "shortcuts-list");
64025 wrapper = wrapper.merge(wrapperEnter);
64026 var tabs = tabsBar.selectAll(".tab").data(_dataShortcuts);
64027 var tabsEnter = tabs.enter().append("a").attr("class", "tab").attr("href", "#").on("click", function(d3_event, d2) {
64028 d3_event.preventDefault();
64029 var i3 = _dataShortcuts.indexOf(d2);
64031 render(selection2);
64033 tabsEnter.append("span").html(function(d2) {
64034 return _t.html(d2.text);
64036 wrapper.selectAll(".tab").classed("active", function(d2, i3) {
64037 return i3 === _activeTab;
64039 var shortcuts = shortcutsList.selectAll(".shortcut-tab").data(_dataShortcuts);
64040 var shortcutsEnter = shortcuts.enter().append("div").attr("class", function(d2) {
64041 return "shortcut-tab shortcut-tab-" + d2.tab;
64043 var columnsEnter = shortcutsEnter.selectAll(".shortcut-column").data(function(d2) {
64045 }).enter().append("table").attr("class", "shortcut-column");
64046 var rowsEnter = columnsEnter.selectAll(".shortcut-row").data(function(d2) {
64048 }).enter().append("tr").attr("class", "shortcut-row");
64049 var sectionRows = rowsEnter.filter(function(d2) {
64050 return !d2.shortcuts;
64052 sectionRows.append("td");
64053 sectionRows.append("td").attr("class", "shortcut-section").append("h3").html(function(d2) {
64054 return _t.html(d2.text);
64056 var shortcutRows = rowsEnter.filter(function(d2) {
64057 return d2.shortcuts;
64059 var shortcutKeys = shortcutRows.append("td").attr("class", "shortcut-keys");
64060 var modifierKeys = shortcutKeys.filter(function(d2) {
64061 return d2.modifiers;
64063 modifierKeys.selectAll("kbd.modifier").data(function(d2) {
64064 if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
64066 } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
64069 return d2.modifiers;
64071 }).enter().each(function() {
64072 var selection3 = select_default2(this);
64073 selection3.append("kbd").attr("class", "modifier").text(function(d2) {
64074 return uiCmd.display(d2);
64076 selection3.append("span").text("+");
64078 shortcutKeys.selectAll("kbd.shortcut").data(function(d2) {
64079 var arr = d2.shortcuts;
64080 if (detected.os === "win" && d2.text === "shortcuts.editing.commands.redo") {
64082 } else if (detected.os !== "mac" && d2.text === "shortcuts.browsing.display_options.fullscreen") {
64085 arr = arr.map(function(s2) {
64086 return uiCmd.display(s2.indexOf(".") !== -1 ? _t(s2) : s2);
64088 return utilArrayUniq(arr).map(function(s2) {
64091 separator: d2.separator,
64095 }).enter().each(function(d2, i3, nodes) {
64096 var selection3 = select_default2(this);
64097 var click = d2.shortcut.toLowerCase().match(/(.*).click/);
64098 if (click && click[1]) {
64099 selection3.call(svgIcon("#iD-walkthrough-mouse-" + click[1], "operation"));
64100 } else if (d2.shortcut.toLowerCase() === "long-press") {
64101 selection3.call(svgIcon("#iD-walkthrough-longpress", "longpress operation"));
64102 } else if (d2.shortcut.toLowerCase() === "tap") {
64103 selection3.call(svgIcon("#iD-walkthrough-tap", "tap operation"));
64105 selection3.append("kbd").attr("class", "shortcut").text(function(d4) {
64106 return d4.shortcut;
64109 if (i3 < nodes.length - 1) {
64110 selection3.append("span").html(d2.separator || "\xA0" + _t.html("shortcuts.or") + "\xA0");
64111 } else if (i3 === nodes.length - 1 && d2.suffix) {
64112 selection3.append("span").text(d2.suffix);
64115 shortcutKeys.filter(function(d2) {
64117 }).each(function() {
64118 var selection3 = select_default2(this);
64119 selection3.append("span").text("+");
64120 selection3.append("span").attr("class", "gesture").html(function(d2) {
64121 return _t.html(d2.gesture);
64124 shortcutRows.append("td").attr("class", "shortcut-desc").html(function(d2) {
64125 return d2.text ? _t.html(d2.text) : "\xA0";
64127 wrapper.selectAll(".shortcut-tab").style("display", function(d2, i3) {
64128 return i3 === _activeTab ? "flex" : "none";
64131 return function(selection2, show) {
64132 _selection = selection2;
64134 _modalSelection = uiModal(selection2);
64135 _modalSelection.call(shortcutsModal);
64137 context.keybinding().on([_t("shortcuts.toggle.key"), "?"], function() {
64138 if (context.container().selectAll(".modal-shortcuts").size()) {
64139 if (_modalSelection) {
64140 _modalSelection.close();
64141 _modalSelection = null;
64144 _modalSelection = uiModal(_selection);
64145 _modalSelection.call(shortcutsModal);
64152 // modules/ui/data_header.js
64153 function uiDataHeader() {
64155 function dataHeader(selection2) {
64156 var header = selection2.selectAll(".data-header").data(
64157 _datum ? [_datum] : [],
64159 return d2.__featurehash__;
64162 header.exit().remove();
64163 var headerEnter = header.enter().append("div").attr("class", "data-header");
64164 var iconEnter = headerEnter.append("div").attr("class", "data-header-icon");
64165 iconEnter.append("div").attr("class", "preset-icon-28").call(svgIcon("#iD-icon-data", "note-fill"));
64166 headerEnter.append("div").attr("class", "data-header-label").call(_t.append("map_data.layers.custom.title"));
64168 dataHeader.datum = function(val) {
64169 if (!arguments.length) return _datum;
64176 // modules/ui/disclosure.js
64177 function uiDisclosure(context, key, expandedDefault) {
64178 var dispatch14 = dispatch_default("toggled");
64180 var _label = utilFunctor("");
64181 var _updatePreference = true;
64182 var _content = function() {
64184 var disclosure = function(selection2) {
64185 if (_expanded === void 0 || _expanded === null) {
64186 var preference = corePreferences("disclosure." + key + ".expanded");
64187 _expanded = preference === null ? !!expandedDefault : preference === "true";
64189 var hideToggle = selection2.selectAll(".hide-toggle-" + key).data([0]);
64190 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"));
64191 hideToggleEnter.append("span").attr("class", "hide-toggle-text");
64192 hideToggle = hideToggleEnter.merge(hideToggle);
64193 hideToggle.on("click", toggle).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand"))).attr("aria-expanded", _expanded).classed("expanded", _expanded);
64194 const label = _label();
64195 const labelSelection = hideToggle.selectAll(".hide-toggle-text");
64196 if (typeof label !== "function") {
64197 labelSelection.text(_label());
64199 labelSelection.text("").call(label);
64201 hideToggle.selectAll(".hide-toggle-icon").attr(
64203 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64205 var wrap2 = selection2.selectAll(".disclosure-wrap").data([0]);
64206 wrap2 = wrap2.enter().append("div").attr("class", "disclosure-wrap disclosure-wrap-" + key).merge(wrap2).classed("hide", !_expanded);
64208 wrap2.call(_content);
64210 function toggle(d3_event) {
64211 d3_event.preventDefault();
64212 _expanded = !_expanded;
64213 if (_updatePreference) {
64214 corePreferences("disclosure." + key + ".expanded", _expanded);
64216 hideToggle.classed("expanded", _expanded).attr("aria-expanded", _expanded).attr("title", _t("icons.".concat(_expanded ? "collapse" : "expand")));
64217 hideToggle.selectAll(".hide-toggle-icon").attr(
64219 _expanded ? "#iD-icon-down" : _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward"
64221 wrap2.call(uiToggle(_expanded));
64223 wrap2.call(_content);
64225 dispatch14.call("toggled", this, _expanded);
64228 disclosure.label = function(val) {
64229 if (!arguments.length) return _label;
64230 _label = utilFunctor(val);
64233 disclosure.expanded = function(val) {
64234 if (!arguments.length) return _expanded;
64238 disclosure.updatePreference = function(val) {
64239 if (!arguments.length) return _updatePreference;
64240 _updatePreference = val;
64243 disclosure.content = function(val) {
64244 if (!arguments.length) return _content;
64248 return utilRebind(disclosure, dispatch14, "on");
64251 // modules/ui/section.js
64252 function uiSection(id2, context) {
64253 var _classes = utilFunctor("");
64254 var _shouldDisplay;
64258 var _expandedByDefault = utilFunctor(true);
64259 var _disclosureContent;
64260 var _disclosureExpanded;
64261 var _containerSelection = select_default2(null);
64265 section.classes = function(val) {
64266 if (!arguments.length) return _classes;
64267 _classes = utilFunctor(val);
64270 section.label = function(val) {
64271 if (!arguments.length) return _label;
64272 _label = utilFunctor(val);
64275 section.expandedByDefault = function(val) {
64276 if (!arguments.length) return _expandedByDefault;
64277 _expandedByDefault = utilFunctor(val);
64280 section.shouldDisplay = function(val) {
64281 if (!arguments.length) return _shouldDisplay;
64282 _shouldDisplay = utilFunctor(val);
64285 section.content = function(val) {
64286 if (!arguments.length) return _content;
64290 section.disclosureContent = function(val) {
64291 if (!arguments.length) return _disclosureContent;
64292 _disclosureContent = val;
64295 section.disclosureExpanded = function(val) {
64296 if (!arguments.length) return _disclosureExpanded;
64297 _disclosureExpanded = val;
64300 section.render = function(selection2) {
64301 _containerSelection = selection2.selectAll(".section-" + id2).data([0]);
64302 var sectionEnter = _containerSelection.enter().append("div").attr("class", "section section-" + id2 + " " + (_classes && _classes() || ""));
64303 _containerSelection = sectionEnter.merge(_containerSelection);
64304 _containerSelection.call(renderContent);
64306 section.reRender = function() {
64307 _containerSelection.call(renderContent);
64309 section.selection = function() {
64310 return _containerSelection;
64312 section.disclosure = function() {
64313 return _disclosure;
64315 function renderContent(selection2) {
64316 if (_shouldDisplay) {
64317 var shouldDisplay = _shouldDisplay();
64318 selection2.classed("hide", !shouldDisplay);
64319 if (!shouldDisplay) {
64320 selection2.html("");
64324 if (_disclosureContent) {
64325 if (!_disclosure) {
64326 _disclosure = uiDisclosure(context, id2.replace(/-/g, "_"), _expandedByDefault()).label(_label || "").content(_disclosureContent);
64328 if (_disclosureExpanded !== void 0) {
64329 _disclosure.expanded(_disclosureExpanded);
64330 _disclosureExpanded = void 0;
64332 selection2.call(_disclosure);
64336 selection2.call(_content);
64342 // modules/ui/tag_reference.js
64343 function uiTagReference(what) {
64344 var wikibase = what.qid ? services.wikidata : services.osmWikibase;
64345 var tagReference = {};
64346 var _button = select_default2(null);
64347 var _body = select_default2(null);
64351 if (!wikibase) return;
64352 _button.classed("tag-reference-loading", true);
64353 wikibase.getDocs(what, gotDocs);
64355 function gotDocs(err, docs) {
64357 if (!docs || !docs.title) {
64358 _body.append("p").attr("class", "tag-reference-description").call(_t.append("inspector.no_documentation_key"));
64362 if (docs.imageURL) {
64363 _body.append("img").attr("class", "tag-reference-wiki-image").attr("alt", docs.description).attr("src", docs.imageURL).on("load", function() {
64365 }).on("error", function() {
64366 select_default2(this).remove();
64372 var tagReferenceDescription = _body.append("p").attr("class", "tag-reference-description").append("span");
64373 if (docs.description) {
64374 tagReferenceDescription = tagReferenceDescription.attr("class", "localized-text").attr("lang", docs.descriptionLocaleCode || "und").text(docs.description);
64376 tagReferenceDescription = tagReferenceDescription.call(_t.append("inspector.no_documentation_key"));
64378 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"));
64380 _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));
64382 if (what.key === "comment") {
64383 _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"));
64388 _button.classed("tag-reference-loading", false);
64389 _body.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1");
64391 _button.selectAll("svg.icon use").each(function() {
64392 var iconUse = select_default2(this);
64393 if (iconUse.attr("href") === "#iD-icon-info") {
64394 iconUse.attr("href", "#iD-icon-info-filled");
64399 _body.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
64400 _body.classed("expanded", false);
64403 _button.selectAll("svg.icon use").each(function() {
64404 var iconUse = select_default2(this);
64405 if (iconUse.attr("href") === "#iD-icon-info-filled") {
64406 iconUse.attr("href", "#iD-icon-info");
64410 tagReference.button = function(selection2, klass, iconName) {
64411 _button = selection2.selectAll(".tag-reference-button").data([0]);
64412 _button = _button.enter().append("button").attr("class", "tag-reference-button " + (klass || "")).attr("title", _t("icons.information")).call(svgIcon("#iD-icon-" + (iconName || "inspect"))).merge(_button);
64413 _button.on("click", function(d3_event) {
64414 d3_event.stopPropagation();
64415 d3_event.preventDefault();
64419 } else if (_loaded) {
64426 tagReference.body = function(selection2) {
64427 var itemID = what.qid || what.key + "-" + (what.value || "");
64428 _body = selection2.selectAll(".tag-reference-body").data([itemID], function(d2) {
64431 _body.exit().remove();
64432 _body = _body.enter().append("div").attr("class", "tag-reference-body").style("max-height", "0").style("opacity", "0").merge(_body);
64433 if (_showing === false) {
64437 tagReference.showing = function(val) {
64438 if (!arguments.length) return _showing;
64440 return tagReference;
64442 return tagReference;
64445 // modules/ui/sections/raw_tag_editor.js
64446 function uiSectionRawTagEditor(id2, context) {
64447 var section = uiSection(id2, context).classes("raw-tag-editor").label(function() {
64448 var count = Object.keys(_tags).filter(function(d2) {
64451 return _t.append("inspector.title_count", { title: _t("inspector.tags"), count });
64452 }).expandedByDefault(false).disclosureContent(renderDisclosureContent);
64453 var taginfo = services.taginfo;
64454 var dispatch14 = dispatch_default("change");
64455 var availableViews = [
64456 { id: "list", icon: "#fas-th-list" },
64457 { id: "text", icon: "#fas-i-cursor" }
64459 let _discardTags = {};
64460 _mainFileFetcher.get("discarded").then((d2) => {
64464 var _tagView = corePreferences("raw-tag-editor-view") || "list";
64465 var _readOnlyTags = [];
64466 var _orderedKeys = [];
64467 var _showBlank = false;
64468 var _pendingChange = null;
64473 var _didInteract = false;
64474 function interacted() {
64475 _didInteract = true;
64477 function renderDisclosureContent(wrap2) {
64478 _orderedKeys = _orderedKeys.filter(function(key) {
64479 return _tags[key] !== void 0;
64481 var all = Object.keys(_tags).sort();
64482 var missingKeys = utilArrayDifference(all, _orderedKeys);
64483 for (var i3 in missingKeys) {
64484 _orderedKeys.push(missingKeys[i3]);
64486 var rowData = _orderedKeys.map(function(key, i4) {
64487 return { index: i4, key, value: _tags[key] };
64489 if (!rowData.length || _showBlank) {
64490 _showBlank = false;
64491 rowData.push({ index: rowData.length, key: "", value: "" });
64493 var options2 = wrap2.selectAll(".raw-tag-options").data([0]);
64494 options2.exit().remove();
64495 var optionsEnter = options2.enter().insert("div", ":first-child").attr("class", "raw-tag-options").attr("role", "tablist");
64496 var optionEnter = optionsEnter.selectAll(".raw-tag-option").data(availableViews, function(d2) {
64499 optionEnter.append("button").attr("class", function(d2) {
64500 return "raw-tag-option raw-tag-option-" + d2.id + (_tagView === d2.id ? " selected" : "");
64501 }).attr("aria-selected", function(d2) {
64502 return _tagView === d2.id;
64503 }).attr("role", "tab").attr("title", function(d2) {
64504 return _t("icons." + d2.id);
64505 }).on("click", function(d3_event, d2) {
64507 corePreferences("raw-tag-editor-view", d2.id);
64508 wrap2.selectAll(".raw-tag-option").classed("selected", function(datum2) {
64509 return datum2 === d2;
64510 }).attr("aria-selected", function(datum2) {
64511 return datum2 === d2;
64513 wrap2.selectAll(".tag-text").classed("hide", d2.id !== "text").each(setTextareaHeight);
64514 wrap2.selectAll(".tag-list, .add-row").classed("hide", d2.id !== "list");
64515 }).each(function(d2) {
64516 select_default2(this).call(svgIcon(d2.icon));
64518 var textData = rowsToText(rowData);
64519 var textarea = wrap2.selectAll(".tag-text").data([0]);
64520 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);
64521 textarea.call(utilGetSetValue, textData).each(setTextareaHeight).on("input", setTextareaHeight).on("focus", interacted).on("blur", textChanged).on("change", textChanged);
64522 var list2 = wrap2.selectAll(".tag-list").data([0]);
64523 list2 = list2.enter().append("ul").attr("class", "tag-list" + (_tagView !== "list" ? " hide" : "")).merge(list2);
64524 var addRowEnter = wrap2.selectAll(".add-row").data([0]).enter().append("div").attr("class", "add-row" + (_tagView !== "list" ? " hide" : ""));
64525 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);
64526 addRowEnter.append("div").attr("class", "space-value");
64527 addRowEnter.append("div").attr("class", "space-buttons");
64528 var items = list2.selectAll(".tag-row").data(rowData, function(d2) {
64531 items.exit().each(unbind).remove();
64532 var itemsEnter = items.enter().append("li").attr("class", "tag-row").classed("readonly", isReadOnly);
64533 var innerWrap = itemsEnter.append("div").attr("class", "inner-wrap");
64534 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);
64535 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);
64536 innerWrap.append("button").attr("class", "form-field-button remove").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
64537 items = items.merge(itemsEnter).sort(function(a2, b2) {
64538 return a2.index - b2.index;
64540 items.each(function(d2) {
64541 var row = select_default2(this);
64542 var key = row.select("input.key");
64543 var value = row.select("input.value");
64544 if (_entityIDs && taginfo && _state !== "hover") {
64545 bindTypeahead(key, value);
64547 var referenceOptions = { key: d2.key };
64548 if (typeof d2.value === "string") {
64549 referenceOptions.value = d2.value;
64551 var reference = uiTagReference(referenceOptions, context);
64552 if (_state === "hover") {
64553 reference.showing(false);
64555 row.select(".inner-wrap").call(reference.button);
64556 row.call(reference.body);
64557 row.select("button.remove");
64559 items.selectAll("input.key").attr("title", function(d2) {
64561 }).call(utilGetSetValue, function(d2) {
64563 }).attr("readonly", function(d2) {
64564 return isReadOnly(d2) || null;
64566 items.selectAll("input.value").attr("title", function(d2) {
64567 return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : d2.value;
64568 }).classed("mixed", function(d2) {
64569 return Array.isArray(d2.value);
64570 }).attr("placeholder", function(d2) {
64571 return typeof d2.value === "string" ? null : _t("inspector.multiple_values");
64572 }).call(utilGetSetValue, function(d2) {
64573 return typeof d2.value === "string" ? d2.value : "";
64574 }).attr("readonly", function(d2) {
64575 return isReadOnly(d2) || null;
64577 items.selectAll("button.remove").on(
64578 ("PointerEvent" in window ? "pointer" : "mouse") + "down",
64579 // 'click' fires too late - #5878
64580 (d3_event, d2) => {
64581 if (d3_event.button !== 0) return;
64582 removeTag(d3_event, d2);
64586 function isReadOnly(d2) {
64587 for (var i3 = 0; i3 < _readOnlyTags.length; i3++) {
64588 if (d2.key.match(_readOnlyTags[i3]) !== null) {
64594 function setTextareaHeight() {
64595 if (_tagView !== "text") return;
64596 var selection2 = select_default2(this);
64597 var matches = selection2.node().value.match(/\n/g);
64598 var lineCount = 2 + Number(matches && matches.length);
64599 var lineHeight = 20;
64600 selection2.style("height", lineCount * lineHeight + "px");
64602 function stringify3(s2) {
64603 const stringified = JSON.stringify(s2).slice(1, -1);
64604 if (stringified !== s2) {
64605 return '"'.concat(stringified, '"');
64610 function unstringify(s2) {
64611 const isQuoted = s2.length > 1 && s2.charAt(0) === '"' && s2.charAt(s2.length - 1) === '"';
64614 return JSON.parse(s2);
64622 function rowsToText(rows) {
64623 var str = rows.filter(function(row) {
64624 return row.key && row.key.trim() !== "";
64625 }).map(function(row) {
64626 var rawVal = row.value;
64627 if (typeof rawVal !== "string") rawVal = "*";
64628 var val = rawVal ? stringify3(rawVal) : "";
64629 return stringify3(row.key) + "=" + val;
64631 if (_state !== "hover" && str.length) {
64636 function textChanged() {
64637 var newText = this.value.trim();
64639 newText.split("\n").forEach(function(row) {
64640 var m2 = row.match(/^\s*([^=]+)=(.*)$/);
64642 var k2 = context.cleanTagKey(unstringify(m2[1].trim()));
64643 var v2 = context.cleanTagValue(unstringify(m2[2].trim()));
64647 var tagDiff = utilTagDiff(_tags, newTags);
64648 if (!tagDiff.length) return;
64649 _pendingChange = _pendingChange || {};
64650 tagDiff.forEach(function(change) {
64651 if (isReadOnly({ key: change.key })) return;
64652 if (change.newVal === "*" && typeof change.oldVal !== "string") return;
64653 if (change.type === "-") {
64654 _pendingChange[change.key] = void 0;
64655 } else if (change.type === "+") {
64656 _pendingChange[change.key] = change.newVal || "";
64659 if (Object.keys(_pendingChange).length === 0) {
64660 _pendingChange = null;
64665 function pushMore(d3_event) {
64666 if (d3_event.keyCode === 9 && !d3_event.shiftKey && section.selection().selectAll(".tag-list li:last-child input.value").node() === this && utilGetSetValue(select_default2(this))) {
64670 function bindTypeahead(key, value) {
64671 if (isReadOnly(key.datum())) return;
64672 if (Array.isArray(value.datum().value)) {
64673 value.call(uiCombobox(context, "tag-value").minItems(1).fetcher(function(value2, callback) {
64674 var keyString = utilGetSetValue(key);
64675 if (!_tags[keyString]) return;
64676 var data = _tags[keyString].map(function(tagValue) {
64680 title: _t("inspector.empty"),
64681 display: (selection2) => selection2.text("").classed("virtual-option", true).call(_t.append("inspector.empty"))
64693 var geometry = context.graph().geometry(_entityIDs[0]);
64694 key.call(uiCombobox(context, "tag-key").fetcher(function(value2, callback) {
64699 }, function(err, data) {
64701 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()));
64702 callback(sort(value2, filtered));
64706 value.call(uiCombobox(context, "tag-value").fetcher(function(value2, callback) {
64709 key: utilGetSetValue(key),
64712 }, function(err, data) {
64714 const filtered = data.filter((d2) => d2.value.toLowerCase().includes(value2.toLowerCase()));
64715 callback(sort(value2, filtered));
64718 }).caseSensitive(allowUpperCaseTagValues.test(utilGetSetValue(key))));
64719 function sort(value2, data) {
64720 var sameletter = [];
64722 for (var i3 = 0; i3 < data.length; i3++) {
64723 if (data[i3].value.substring(0, value2.length) === value2) {
64724 sameletter.push(data[i3]);
64726 other.push(data[i3]);
64729 return sameletter.concat(other);
64732 function unbind() {
64733 var row = select_default2(this);
64734 row.selectAll("input.key").call(uiCombobox.off, context);
64735 row.selectAll("input.value").call(uiCombobox.off, context);
64737 function keyChange(d3_event, d2) {
64738 if (select_default2(this).attr("readonly")) return;
64740 if (_pendingChange && _pendingChange.hasOwnProperty(kOld) && _pendingChange[kOld] === void 0) return;
64741 var kNew = context.cleanTagKey(this.value.trim());
64742 if (isReadOnly({ key: kNew })) {
64746 if (kNew && kNew !== kOld && _tags[kNew] !== void 0) {
64748 section.selection().selectAll(".tag-list input.value").each(function(d4) {
64749 if (d4.key === kNew) {
64750 var input = select_default2(this).node();
64757 _pendingChange = _pendingChange || {};
64759 if (kOld === kNew) return;
64760 _pendingChange[kNew] = _pendingChange[kOld] || { oldKey: kOld };
64761 _pendingChange[kOld] = void 0;
64763 let row = this.parentNode.parentNode;
64764 let inputVal = select_default2(row).selectAll("input.value");
64765 let vNew = context.cleanTagValue(utilGetSetValue(inputVal));
64766 _pendingChange[kNew] = vNew;
64767 utilGetSetValue(inputVal, vNew);
64769 var existingKeyIndex = _orderedKeys.indexOf(kOld);
64770 if (existingKeyIndex !== -1) _orderedKeys[existingKeyIndex] = kNew;
64775 function valueChange(d3_event, d2) {
64776 if (isReadOnly(d2)) return;
64777 if (typeof d2.value !== "string" && !this.value) return;
64778 if (_pendingChange && _pendingChange.hasOwnProperty(d2.key) && _pendingChange[d2.key] === void 0) return;
64779 _pendingChange = _pendingChange || {};
64780 _pendingChange[d2.key] = context.cleanTagValue(this.value);
64783 function removeTag(d3_event, d2) {
64784 if (isReadOnly(d2)) return;
64785 if (d2.key === "") {
64786 _showBlank = false;
64787 section.reRender();
64789 _orderedKeys = _orderedKeys.filter(function(key) {
64790 return key !== d2.key;
64792 _pendingChange = _pendingChange || {};
64793 _pendingChange[d2.key] = void 0;
64797 function addTag() {
64798 window.setTimeout(function() {
64800 section.reRender();
64801 section.selection().selectAll(".tag-list li:last-child input.key").node().focus();
64804 function scheduleChange() {
64805 var entityIDs = _entityIDs;
64806 window.setTimeout(function() {
64807 if (!_pendingChange) return;
64808 dispatch14.call("change", this, entityIDs, _pendingChange);
64809 _pendingChange = null;
64812 section.state = function(val) {
64813 if (!arguments.length) return _state;
64814 if (_state !== val) {
64820 section.presets = function(val) {
64821 if (!arguments.length) return _presets;
64823 if (_presets && _presets.length && _presets[0].isFallback()) {
64824 section.disclosureExpanded(true);
64825 } else if (!_didInteract) {
64826 section.disclosureExpanded(null);
64830 section.tags = function(val) {
64831 if (!arguments.length) return _tags;
64835 section.entityIDs = function(val) {
64836 if (!arguments.length) return _entityIDs;
64837 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
64843 section.readOnlyTags = function(val) {
64844 if (!arguments.length) return _readOnlyTags;
64845 _readOnlyTags = val;
64848 return utilRebind(section, dispatch14, "on");
64851 // modules/ui/data_editor.js
64852 function uiDataEditor(context) {
64853 var dataHeader = uiDataHeader();
64854 var rawTagEditor = uiSectionRawTagEditor("custom-data-tag-editor", context).expandedByDefault(true).readOnlyTags([/./]);
64856 function dataEditor(selection2) {
64857 var header = selection2.selectAll(".header").data([0]);
64858 var headerEnter = header.enter().append("div").attr("class", "header fillL");
64859 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
64860 context.enter(modeBrowse(context));
64861 }).call(svgIcon("#iD-icon-close"));
64862 headerEnter.append("h2").call(_t.append("map_data.title"));
64863 var body = selection2.selectAll(".body").data([0]);
64864 body = body.enter().append("div").attr("class", "body").merge(body);
64865 var editor = body.selectAll(".data-editor").data([0]);
64866 editor.enter().append("div").attr("class", "modal-section data-editor").merge(editor).call(dataHeader.datum(_datum));
64867 var rte = body.selectAll(".raw-tag-editor").data([0]);
64868 rte.enter().append("div").attr("class", "raw-tag-editor data-editor").merge(rte).call(
64869 rawTagEditor.tags(_datum && _datum.properties || {}).state("hover").render
64870 ).selectAll("textarea.tag-text").attr("readonly", true).classed("readonly", true);
64872 dataEditor.datum = function(val) {
64873 if (!arguments.length) return _datum;
64880 // modules/ui/feature_list.js
64881 var sexagesimal = __toESM(require_sexagesimal());
64882 function uiFeatureList(context) {
64883 var _geocodeResults;
64884 function featureList(selection2) {
64885 var header = selection2.append("div").attr("class", "header fillL");
64886 header.append("h2").call(_t.append("inspector.feature_list"));
64887 var searchWrap = selection2.append("div").attr("class", "search-header");
64888 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
64889 var search = searchWrap.append("input").attr("placeholder", _t("inspector.search")).attr("type", "search").call(utilNoAuto).on("keypress", keypress).on("keydown", keydown).on("input", inputevent);
64890 var listWrap = selection2.append("div").attr("class", "inspector-body");
64891 var list2 = listWrap.append("div").attr("class", "feature-list");
64892 context.on("exit.feature-list", clearSearch);
64893 context.map().on("drawn.feature-list", mapDrawn);
64894 context.keybinding().on(uiCmd("\u2318F"), focusSearch);
64895 function focusSearch(d3_event) {
64896 var mode = context.mode() && context.mode().id;
64897 if (mode !== "browse") return;
64898 d3_event.preventDefault();
64899 search.node().focus();
64901 function keydown(d3_event) {
64902 if (d3_event.keyCode === 27) {
64903 search.node().blur();
64906 function keypress(d3_event) {
64907 var q2 = search.property("value"), items = list2.selectAll(".feature-list-item");
64908 if (d3_event.keyCode === 13 && // ↩ Return
64909 q2.length && items.size()) {
64910 click(d3_event, items.datum());
64913 function inputevent() {
64914 _geocodeResults = void 0;
64917 function clearSearch() {
64918 search.property("value", "");
64921 function mapDrawn(e3) {
64926 function features() {
64928 var graph = context.graph();
64929 var visibleCenter = context.map().extent().center();
64930 var q2 = search.property("value").toLowerCase();
64931 if (!q2) return result;
64932 var locationMatch = sexagesimal.pair(q2.toUpperCase()) || dmsMatcher(q2);
64933 if (locationMatch) {
64934 var loc = [Number(locationMatch[0]), Number(locationMatch[1])];
64938 type: _t("inspector.location"),
64939 name: dmsCoordinatePair([loc[1], loc[0]]),
64943 var idMatch = !locationMatch && q2.match(/(?:^|\W)(node|way|relation|note|[nwr])\W{0,2}0*([1-9]\d*)(?:\W|$)/i);
64945 var elemType = idMatch[1] === "note" ? idMatch[1] : idMatch[1].charAt(0);
64946 var elemId = idMatch[2];
64948 id: elemType + elemId,
64949 geometry: elemType === "n" ? "point" : elemType === "w" ? "line" : elemType === "note" ? "note" : "relation",
64950 type: elemType === "n" ? _t("inspector.node") : elemType === "w" ? _t("inspector.way") : elemType === "note" ? _t("note.note") : _t("inspector.relation"),
64954 var allEntities = graph.entities;
64955 var localResults = [];
64956 for (var id2 in allEntities) {
64957 var entity = allEntities[id2];
64958 if (!entity) continue;
64959 var name = utilDisplayName(entity) || "";
64960 if (name.toLowerCase().indexOf(q2) < 0) continue;
64961 var matched = _mainPresetIndex.match(entity, graph);
64962 var type2 = matched && matched.name() || utilDisplayType(entity.id);
64963 var extent = entity.extent(graph);
64964 var distance = extent ? geoSphericalDistance(visibleCenter, extent.center()) : 0;
64965 localResults.push({
64968 geometry: entity.geometry(graph),
64973 if (localResults.length > 100) break;
64975 localResults = localResults.sort(function byDistance(a2, b2) {
64976 return a2.distance - b2.distance;
64978 result = result.concat(localResults);
64979 (_geocodeResults || []).forEach(function(d2) {
64980 if (d2.osm_type && d2.osm_id) {
64981 var id3 = osmEntity.id.fromOSM(d2.osm_type, d2.osm_id);
64983 tags[d2.class] = d2.type;
64984 var attrs = { id: id3, type: d2.osm_type, tags };
64985 if (d2.osm_type === "way") {
64986 attrs.nodes = ["a", "a"];
64988 var tempEntity = osmEntity(attrs);
64989 var tempGraph = coreGraph([tempEntity]);
64990 var matched2 = _mainPresetIndex.match(tempEntity, tempGraph);
64991 var type3 = matched2 && matched2.name() || utilDisplayType(id3);
64994 geometry: tempEntity.geometry(tempGraph),
64996 name: d2.display_name,
64997 extent: new geoExtent(
64998 [Number(d2.boundingbox[3]), Number(d2.boundingbox[0])],
64999 [Number(d2.boundingbox[2]), Number(d2.boundingbox[1])]
65004 if (q2.match(/^[0-9]+$/)) {
65008 type: _t("inspector.node"),
65014 type: _t("inspector.way"),
65019 geometry: "relation",
65020 type: _t("inspector.relation"),
65026 type: _t("note.note"),
65032 function drawList() {
65033 var value = search.property("value");
65034 var results = features();
65035 list2.classed("filtered", value.length);
65036 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"));
65037 resultsIndicator.append("span").attr("class", "entity-name");
65038 list2.selectAll(".no-results-item .entity-name").html("").call(_t.append("geocoder.no_results_worldwide"));
65039 if (services.geocoder) {
65040 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"));
65042 list2.selectAll(".no-results-item").style("display", value.length && !results.length ? "block" : "none");
65043 list2.selectAll(".geocode-item").style("display", value && _geocodeResults === void 0 ? "block" : "none");
65044 list2.selectAll(".feature-list-item").data([-1]).remove();
65045 var items = list2.selectAll(".feature-list-item").data(results, function(d2) {
65048 var enter = items.enter().insert("button", ".geocode-item").attr("class", "feature-list-item").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
65049 var label = enter.append("div").attr("class", "label");
65050 label.each(function(d2) {
65051 select_default2(this).call(svgIcon("#iD-icon-" + d2.geometry, "pre-text"));
65053 label.append("span").attr("class", "entity-type").text(function(d2) {
65056 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) {
65059 enter.style("opacity", 0).transition().style("opacity", 1);
65061 items.exit().remove();
65063 function mouseover(d3_event, d2) {
65064 if (d2.id === -1) return;
65065 utilHighlightEntities([d2.id], true, context);
65067 function mouseout(d3_event, d2) {
65068 if (d2.id === -1) return;
65069 utilHighlightEntities([d2.id], false, context);
65071 function click(d3_event, d2) {
65072 d3_event.preventDefault();
65074 context.map().centerZoomEase([d2.location[1], d2.location[0]], 19);
65075 } else if (d2.entity) {
65076 utilHighlightEntities([d2.id], false, context);
65077 context.enter(modeSelect(context, [d2.entity.id]));
65078 context.map().zoomToEase(d2.entity);
65079 } else if (d2.geometry === "note") {
65080 const noteId = d2.id.replace(/\D/g, "");
65081 context.zoomToNote(noteId);
65083 context.zoomToEntity(d2.id);
65086 function geocoderSearch() {
65087 services.geocoder.search(search.property("value"), function(err, resp) {
65088 _geocodeResults = resp || [];
65093 return featureList;
65096 // modules/ui/entity_editor.js
65097 var import_fast_deep_equal9 = __toESM(require_fast_deep_equal());
65099 // modules/ui/sections/entity_issues.js
65100 function uiSectionEntityIssues(context) {
65101 var preference = corePreferences("entity-issues.reference.expanded");
65102 var _expanded = preference === null ? true : preference === "true";
65103 var _entityIDs = [];
65105 var _activeIssueID;
65106 var section = uiSection("entity-issues", context).shouldDisplay(function() {
65107 return _issues.length > 0;
65108 }).label(function() {
65109 return _t.append("inspector.title_count", { title: _t("issues.list_title"), count: _issues.length });
65110 }).disclosureContent(renderDisclosureContent);
65111 context.validator().on("validated.entity_issues", function() {
65113 section.reRender();
65114 }).on("focusedIssue.entity_issues", function(issue) {
65115 makeActiveIssue(issue.id);
65117 function reloadIssues() {
65118 _issues = context.validator().getSharedEntityIssues(_entityIDs, { includeDisabledRules: true });
65120 function makeActiveIssue(issueID) {
65121 _activeIssueID = issueID;
65122 section.selection().selectAll(".issue-container").classed("active", function(d2) {
65123 return d2.id === _activeIssueID;
65126 function renderDisclosureContent(selection2) {
65127 selection2.classed("grouped-items-area", true);
65128 _activeIssueID = _issues.length > 0 ? _issues[0].id : null;
65129 var containers = selection2.selectAll(".issue-container").data(_issues, function(d2) {
65132 containers.exit().remove();
65133 var containersEnter = containers.enter().append("div").attr("class", "issue-container");
65134 var itemsEnter = containersEnter.append("div").attr("class", function(d2) {
65135 return "issue severity-" + d2.severity;
65136 }).on("mouseover.highlight", function(d3_event, d2) {
65137 var ids = d2.entityIds.filter(function(e3) {
65138 return _entityIDs.indexOf(e3) === -1;
65140 utilHighlightEntities(ids, true, context);
65141 }).on("mouseout.highlight", function(d3_event, d2) {
65142 var ids = d2.entityIds.filter(function(e3) {
65143 return _entityIDs.indexOf(e3) === -1;
65145 utilHighlightEntities(ids, false, context);
65147 var labelsEnter = itemsEnter.append("div").attr("class", "issue-label");
65148 var textEnter = labelsEnter.append("button").attr("class", "issue-text").on("click", function(d3_event, d2) {
65149 makeActiveIssue(d2.id);
65150 var extent = d2.extent(context.graph());
65152 var setZoom = Math.max(context.map().zoom(), 19);
65153 context.map().unobscuredCenterZoomEase(extent.center(), setZoom);
65156 textEnter.each(function(d2) {
65157 var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
65158 select_default2(this).call(svgIcon(iconName, "issue-icon"));
65160 textEnter.append("span").attr("class", "issue-message");
65161 var infoButton = labelsEnter.append("button").attr("class", "issue-info-button").attr("title", _t("icons.information")).call(svgIcon("#iD-icon-inspect"));
65162 infoButton.on("click", function(d3_event) {
65163 d3_event.stopPropagation();
65164 d3_event.preventDefault();
65166 var container = select_default2(this.parentNode.parentNode.parentNode);
65167 var info = container.selectAll(".issue-info");
65168 var isExpanded = info.classed("expanded");
65169 _expanded = !isExpanded;
65170 corePreferences("entity-issues.reference.expanded", _expanded);
65172 info.transition().duration(200).style("max-height", "0px").style("opacity", "0").on("end", function() {
65173 info.classed("expanded", false);
65176 info.classed("expanded", true).transition().duration(200).style("max-height", "200px").style("opacity", "1").on("end", function() {
65177 info.style("max-height", null);
65181 itemsEnter.append("ul").attr("class", "issue-fix-list");
65182 containersEnter.append("div").attr("class", "issue-info" + (_expanded ? " expanded" : "")).style("max-height", _expanded ? null : "0").style("opacity", _expanded ? "1" : "0").each(function(d2) {
65183 if (typeof d2.reference === "function") {
65184 select_default2(this).call(d2.reference);
65186 select_default2(this).call(_t.append("inspector.no_documentation_key"));
65189 containers = containers.merge(containersEnter).classed("active", function(d2) {
65190 return d2.id === _activeIssueID;
65192 containers.selectAll(".issue-message").text("").each(function(d2) {
65193 return d2.message(context)(select_default2(this));
65195 var fixLists = containers.selectAll(".issue-fix-list");
65196 var fixes = fixLists.selectAll(".issue-fix-item").data(function(d2) {
65197 return d2.fixes ? d2.fixes(context) : [];
65201 fixes.exit().remove();
65202 var fixesEnter = fixes.enter().append("li").attr("class", "issue-fix-item");
65203 var buttons = fixesEnter.append("button").on("click", function(d3_event, d2) {
65204 if (select_default2(this).attr("disabled") || !d2.onClick) return;
65205 if (d2.issue.dateLastRanFix && /* @__PURE__ */ new Date() - d2.issue.dateLastRanFix < 1e3) return;
65206 d2.issue.dateLastRanFix = /* @__PURE__ */ new Date();
65207 utilHighlightEntities(d2.issue.entityIds.concat(d2.entityIds), false, context);
65208 new Promise(function(resolve, reject) {
65209 d2.onClick(context, resolve, reject);
65210 if (d2.onClick.length <= 1) {
65213 }).then(function() {
65214 context.validator().validate();
65216 }).on("mouseover.highlight", function(d3_event, d2) {
65217 utilHighlightEntities(d2.entityIds, true, context);
65218 }).on("mouseout.highlight", function(d3_event, d2) {
65219 utilHighlightEntities(d2.entityIds, false, context);
65221 buttons.each(function(d2) {
65222 var iconName = d2.icon || "iD-icon-wrench";
65223 if (iconName.startsWith("maki")) {
65226 select_default2(this).call(svgIcon("#" + iconName, "fix-icon"));
65228 buttons.append("span").attr("class", "fix-message").each(function(d2) {
65229 return d2.title(select_default2(this));
65231 fixesEnter.merge(fixes).selectAll("button").classed("actionable", function(d2) {
65233 }).attr("disabled", function(d2) {
65234 return d2.onClick ? null : "true";
65235 }).attr("title", function(d2) {
65236 if (d2.disabledReason) {
65237 return d2.disabledReason;
65242 section.entityIDs = function(val) {
65243 if (!arguments.length) return _entityIDs;
65244 if (!_entityIDs || !val || !utilArrayIdentical(_entityIDs, val)) {
65246 _activeIssueID = null;
65254 // modules/ui/preset_icon.js
65255 function uiPresetIcon() {
65258 function presetIcon(selection2) {
65259 selection2.each(render);
65261 function getIcon(p2, geom) {
65262 if (p2.isFallback && p2.isFallback()) return geom === "vertex" ? "" : "iD-icon-" + p2.id;
65263 if (p2.icon) return p2.icon;
65264 if (geom === "line") return "iD-other-line";
65265 if (geom === "vertex") return "temaki-vertex";
65266 return "maki-marker-stroked";
65268 function renderPointBorder(container, drawPoint) {
65269 let pointBorder = container.selectAll(".preset-icon-point-border").data(drawPoint ? [0] : []);
65270 pointBorder.exit().remove();
65271 let pointBorderEnter = pointBorder.enter();
65274 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");
65275 pointBorder = pointBorderEnter.merge(pointBorder);
65277 function renderCategoryBorder(container, category) {
65278 let categoryBorder = container.selectAll(".preset-icon-category-border").data(category ? [0] : []);
65279 categoryBorder.exit().remove();
65280 let categoryBorderEnter = categoryBorder.enter();
65282 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));
65283 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");
65284 categoryBorder = categoryBorderEnter.merge(categoryBorder);
65286 categoryBorder.selectAll("path").attr("class", "area ".concat(category.id));
65289 function renderCircleFill(container, drawVertex) {
65290 let vertexFill = container.selectAll(".preset-icon-fill-vertex").data(drawVertex ? [0] : []);
65291 vertexFill.exit().remove();
65292 let vertexFillEnter = vertexFill.enter();
65296 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);
65297 vertexFill = vertexFillEnter.merge(vertexFill);
65299 function renderSquareFill(container, drawArea, tagClasses) {
65300 let fill = container.selectAll(".preset-icon-fill-area").data(drawArea ? [0] : []);
65301 fill.exit().remove();
65302 let fillEnter = fill.enter();
65306 const l2 = d2 * 2 / 3;
65307 const c1 = (w2 - l2) / 2;
65308 const c2 = c1 + l2;
65309 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));
65310 ["fill", "stroke"].forEach((klass) => {
65311 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));
65313 const rVertex = 2.5;
65314 [[c1, c1], [c1, c2], [c2, c2], [c2, c1]].forEach((point) => {
65315 fillEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", rVertex);
65317 const rMidpoint = 1.25;
65318 [[c1, w2 / 2], [c2, w2 / 2], [h2 / 2, c1], [h2 / 2, c2]].forEach((point) => {
65319 fillEnter.append("circle").attr("class", "midpoint").attr("cx", point[0]).attr("cy", point[1]).attr("r", rMidpoint);
65321 fill = fillEnter.merge(fill);
65322 fill.selectAll("path.stroke").attr("class", "area stroke ".concat(tagClasses));
65323 fill.selectAll("path.fill").attr("class", "area fill ".concat(tagClasses));
65325 function renderLine(container, drawLine, tagClasses) {
65326 let line = container.selectAll(".preset-icon-line").data(drawLine ? [0] : []);
65327 line.exit().remove();
65328 let lineEnter = line.enter();
65332 const y2 = Math.round(d2 * 0.72);
65333 const l2 = Math.round(d2 * 0.6);
65335 const x12 = (w2 - l2) / 2;
65336 const x2 = x12 + l2;
65337 lineEnter = lineEnter.append("svg").attr("class", "preset-icon-line").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
65338 ["casing", "stroke"].forEach((klass) => {
65339 lineEnter.append("path").attr("d", "M".concat(x12, " ").concat(y2, " L").concat(x2, " ").concat(y2)).attr("class", "line ".concat(klass));
65341 [[x12 - 1, y2], [x2 + 1, y2]].forEach((point) => {
65342 lineEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
65344 line = lineEnter.merge(line);
65345 line.selectAll("path.stroke").attr("class", "line stroke ".concat(tagClasses));
65346 line.selectAll("path.casing").attr("class", "line casing ".concat(tagClasses));
65348 function renderRoute(container, drawRoute, p2) {
65349 let route = container.selectAll(".preset-icon-route").data(drawRoute ? [0] : []);
65350 route.exit().remove();
65351 let routeEnter = route.enter();
65355 const y12 = Math.round(d2 * 0.8);
65356 const y2 = Math.round(d2 * 0.68);
65357 const l2 = Math.round(d2 * 0.6);
65359 const x12 = (w2 - l2) / 2;
65360 const x2 = x12 + l2 / 3;
65361 const x3 = x2 + l2 / 3;
65362 const x4 = x3 + l2 / 3;
65363 routeEnter = routeEnter.append("svg").attr("class", "preset-icon-route").attr("width", w2).attr("height", h2).attr("viewBox", "0 0 ".concat(w2, " ").concat(h2));
65364 ["casing", "stroke"].forEach((klass) => {
65365 routeEnter.append("path").attr("d", "M".concat(x12, " ").concat(y12, " L").concat(x2, " ").concat(y2)).attr("class", "segment0 line ".concat(klass));
65366 routeEnter.append("path").attr("d", "M".concat(x2, " ").concat(y2, " L").concat(x3, " ").concat(y12)).attr("class", "segment1 line ".concat(klass));
65367 routeEnter.append("path").attr("d", "M".concat(x3, " ").concat(y12, " L").concat(x4, " ").concat(y2)).attr("class", "segment2 line ".concat(klass));
65369 [[x12, y12], [x2, y2], [x3, y12], [x4, y2]].forEach((point) => {
65370 routeEnter.append("circle").attr("class", "vertex").attr("cx", point[0]).attr("cy", point[1]).attr("r", r2);
65372 route = routeEnter.merge(route);
65374 let routeType = p2.tags.type === "waterway" ? "waterway" : p2.tags.route;
65375 const segmentPresetIDs = routeSegments[routeType];
65376 for (let i3 in segmentPresetIDs) {
65377 const segmentPreset = _mainPresetIndex.item(segmentPresetIDs[i3]);
65378 const segmentTagClasses = svgTagClasses().getClassesString(segmentPreset.tags, "");
65379 route.selectAll("path.stroke.segment".concat(i3)).attr("class", "segment".concat(i3, " line stroke ").concat(segmentTagClasses));
65380 route.selectAll("path.casing.segment".concat(i3)).attr("class", "segment".concat(i3, " line casing ").concat(segmentTagClasses));
65384 function renderSvgIcon(container, picon, geom, isFramed, category, tagClasses) {
65385 const isMaki = picon && /^maki-/.test(picon);
65386 const isTemaki = picon && /^temaki-/.test(picon);
65387 const isFa = picon && /^fa[srb]-/.test(picon);
65388 const isR\u00F6ntgen = picon && /^roentgen-/.test(picon);
65389 const isiDIcon = picon && !(isMaki || isTemaki || isFa || isR\u00F6ntgen);
65390 let icon2 = container.selectAll(".preset-icon").data(picon ? [0] : []);
65391 icon2.exit().remove();
65392 icon2 = icon2.enter().append("div").attr("class", "preset-icon").call(svgIcon("")).merge(icon2);
65393 icon2.attr("class", "preset-icon " + (geom ? geom + "-geom" : "")).classed("category", category).classed("framed", isFramed).classed("preset-icon-iD", isiDIcon);
65394 icon2.selectAll("svg").attr("class", "icon " + picon + " " + (!isiDIcon && geom !== "line" ? "" : tagClasses));
65395 icon2.selectAll("use").attr("href", "#" + picon);
65397 function renderImageIcon(container, imageURL) {
65398 let imageIcon = container.selectAll("img.image-icon").data(imageURL ? [0] : []);
65399 imageIcon.exit().remove();
65400 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);
65401 imageIcon.attr("src", imageURL);
65403 const routeSegments = {
65404 bicycle: ["highway/cycleway", "highway/cycleway", "highway/cycleway"],
65405 bus: ["highway/unclassified", "highway/secondary", "highway/primary"],
65406 trolleybus: ["highway/unclassified", "highway/secondary", "highway/primary"],
65407 detour: ["highway/tertiary", "highway/residential", "highway/unclassified"],
65408 ferry: ["route/ferry", "route/ferry", "route/ferry"],
65409 foot: ["highway/footway", "highway/footway", "highway/footway"],
65410 hiking: ["highway/path", "highway/path", "highway/path"],
65411 horse: ["highway/bridleway", "highway/bridleway", "highway/bridleway"],
65412 light_rail: ["railway/light_rail", "railway/light_rail", "railway/light_rail"],
65413 monorail: ["railway/monorail", "railway/monorail", "railway/monorail"],
65414 mtb: ["highway/path", "highway/track", "highway/bridleway"],
65415 pipeline: ["man_made/pipeline", "man_made/pipeline", "man_made/pipeline"],
65416 piste: ["piste/downhill", "piste/hike", "piste/nordic"],
65417 power: ["power/line", "power/line", "power/line"],
65418 road: ["highway/secondary", "highway/primary", "highway/trunk"],
65419 subway: ["railway/subway", "railway/subway", "railway/subway"],
65420 train: ["railway/rail", "railway/rail", "railway/rail"],
65421 tram: ["railway/tram", "railway/tram", "railway/tram"],
65422 railway: ["railway/rail", "railway/rail", "railway/rail"],
65423 waterway: ["waterway/stream", "waterway/stream", "waterway/stream"]
65425 function render() {
65426 let p2 = _preset.apply(this, arguments);
65427 let geom = _geometry ? _geometry.apply(this, arguments) : null;
65428 if (geom === "relation" && p2.tags && (p2.tags.type === "route" && p2.tags.route && routeSegments[p2.tags.route] || p2.tags.type === "waterway")) {
65431 const showThirdPartyIcons = corePreferences("preferences.privacy.thirdpartyicons") || "true";
65432 const isFallback = p2.isFallback && p2.isFallback();
65433 const imageURL = showThirdPartyIcons === "true" && p2.imageURL;
65434 const picon = getIcon(p2, geom);
65435 const isCategory = !p2.setTags;
65436 const drawPoint = false;
65437 const drawVertex = picon !== null && geom === "vertex";
65438 const drawLine = picon && geom === "line" && !isFallback && !isCategory;
65439 const drawArea = picon && geom === "area" && !isFallback && !isCategory;
65440 const drawRoute = picon && geom === "route";
65441 const isFramed = drawVertex || drawArea || drawLine || drawRoute || isCategory;
65442 let tags = !isCategory ? p2.setTags({}, geom) : {};
65443 for (let k2 in tags) {
65444 if (tags[k2] === "*") {
65448 let tagClasses = svgTagClasses().getClassesString(tags, "");
65449 let selection2 = select_default2(this);
65450 let container = selection2.selectAll(".preset-icon-container").data([0]);
65451 container = container.enter().append("div").attr("class", "preset-icon-container").merge(container);
65452 container.classed("showing-img", !!imageURL).classed("fallback", isFallback);
65453 renderCategoryBorder(container, isCategory && p2);
65454 renderPointBorder(container, drawPoint);
65455 renderCircleFill(container, drawVertex);
65456 renderSquareFill(container, drawArea, tagClasses);
65457 renderLine(container, drawLine, tagClasses);
65458 renderRoute(container, drawRoute, p2);
65459 renderSvgIcon(container, picon, geom, isFramed, isCategory, tagClasses);
65460 renderImageIcon(container, imageURL);
65462 presetIcon.preset = function(val) {
65463 if (!arguments.length) return _preset;
65464 _preset = utilFunctor(val);
65467 presetIcon.geometry = function(val) {
65468 if (!arguments.length) return _geometry;
65469 _geometry = utilFunctor(val);
65475 // modules/ui/sections/feature_type.js
65476 function uiSectionFeatureType(context) {
65477 var dispatch14 = dispatch_default("choose");
65478 var _entityIDs = [];
65481 var section = uiSection("feature-type", context).label(() => _t.append("inspector.feature_type")).disclosureContent(renderDisclosureContent);
65482 function renderDisclosureContent(selection2) {
65483 selection2.classed("preset-list-item", true);
65484 selection2.classed("mixed-types", _presets.length > 1);
65485 var presetButtonWrap = selection2.selectAll(".preset-list-button-wrap").data([0]).enter().append("div").attr("class", "preset-list-button-wrap");
65486 var presetButton = presetButtonWrap.append("button").attr("class", "preset-list-button preset-reset").call(
65487 uiTooltip().title(() => _t.append("inspector.back_tooltip")).placement("bottom")
65489 presetButton.append("div").attr("class", "preset-icon-container");
65490 presetButton.append("div").attr("class", "label").append("div").attr("class", "label-inner");
65491 presetButtonWrap.append("div").attr("class", "accessory-buttons");
65492 var tagReferenceBodyWrap = selection2.selectAll(".tag-reference-body-wrap").data([0]);
65493 tagReferenceBodyWrap = tagReferenceBodyWrap.enter().append("div").attr("class", "tag-reference-body-wrap").merge(tagReferenceBodyWrap);
65494 if (_tagReference) {
65495 selection2.selectAll(".preset-list-button-wrap .accessory-buttons").style("display", _presets.length === 1 ? null : "none").call(_tagReference.button);
65496 tagReferenceBodyWrap.style("display", _presets.length === 1 ? null : "none").call(_tagReference.body);
65498 selection2.selectAll(".preset-reset").on("click", function() {
65499 dispatch14.call("choose", this, _presets);
65500 }).on("pointerdown pointerup mousedown mouseup", function(d3_event) {
65501 d3_event.preventDefault();
65502 d3_event.stopPropagation();
65504 var geometries = entityGeometries();
65505 selection2.select(".preset-list-item button").call(
65506 uiPresetIcon().geometry(_presets.length === 1 ? geometries.length === 1 && geometries[0] : null).preset(_presets.length === 1 ? _presets[0] : _mainPresetIndex.item("point"))
65508 var names = _presets.length === 1 ? [
65509 _presets[0].nameLabel(),
65510 _presets[0].subtitleLabel()
65511 ].filter(Boolean) : [_t.append("inspector.multiple_types")];
65512 var label = selection2.select(".label-inner");
65513 var nameparts = label.selectAll(".namepart").data(names, (d2) => d2.stringId);
65514 nameparts.exit().remove();
65515 nameparts.enter().append("div").attr("class", "namepart").text("").each(function(d2) {
65516 d2(select_default2(this));
65519 section.entityIDs = function(val) {
65520 if (!arguments.length) return _entityIDs;
65524 section.presets = function(val) {
65525 if (!arguments.length) return _presets;
65526 if (!utilArrayIdentical(val, _presets)) {
65528 if (_presets.length === 1) {
65529 _tagReference = uiTagReference(_presets[0].reference(), context).showing(false);
65534 function entityGeometries() {
65536 for (var i3 in _entityIDs) {
65537 var geometry = context.graph().geometry(_entityIDs[i3]);
65538 if (!counts[geometry]) counts[geometry] = 0;
65539 counts[geometry] += 1;
65541 return Object.keys(counts).sort(function(geom1, geom2) {
65542 return counts[geom2] - counts[geom1];
65545 return utilRebind(section, dispatch14, "on");
65548 // modules/ui/form_fields.js
65549 function uiFormFields(context) {
65550 var moreCombo = uiCombobox(context, "more-fields").minItems(1);
65551 var _fieldsArr = [];
65552 var _lastPlaceholder = "";
65555 function formFields(selection2) {
65556 var allowedFields = _fieldsArr.filter(function(field) {
65557 return field.isAllowed();
65559 var shown = allowedFields.filter(function(field) {
65560 return field.isShown();
65562 var notShown = allowedFields.filter(function(field) {
65563 return !field.isShown();
65564 }).sort(function(a2, b2) {
65565 return a2.universal === b2.universal ? 0 : a2.universal ? 1 : -1;
65567 var container = selection2.selectAll(".form-fields-container").data([0]);
65568 container = container.enter().append("div").attr("class", "form-fields-container " + (_klass || "")).merge(container);
65569 var fields = container.selectAll(".wrap-form-field").data(shown, function(d2) {
65570 return d2.id + (d2.entityIDs ? d2.entityIDs.join() : "");
65572 fields.exit().remove();
65573 var enter = fields.enter().append("div").attr("class", function(d2) {
65574 return "wrap-form-field wrap-form-field-" + d2.safeid;
65576 fields = fields.merge(enter);
65577 fields.order().each(function(d2) {
65578 select_default2(this).call(d2.render);
65581 var moreFields = notShown.map(function(field) {
65582 var title = field.title();
65583 titles.push(title);
65584 var terms = field.terms();
65585 if (field.key) terms.push(field.key);
65586 if (field.keys) terms = terms.concat(field.keys);
65588 display: field.label(),
65595 var placeholder = titles.slice(0, 3).join(", ") + (titles.length > 3 ? "\u2026" : "");
65596 var more = selection2.selectAll(".more-fields").data(_state === "hover" || moreFields.length === 0 ? [] : [0]);
65597 more.exit().remove();
65598 var moreEnter = more.enter().append("div").attr("class", "more-fields").append("label");
65599 moreEnter.append("span").call(_t.append("inspector.add_fields"));
65600 more = moreEnter.merge(more);
65601 var input = more.selectAll(".value").data([0]);
65602 input.exit().remove();
65603 input = input.enter().append("input").attr("class", "value").attr("type", "text").attr("placeholder", placeholder).call(utilNoAuto).merge(input);
65604 input.call(utilGetSetValue, "").call(
65605 moreCombo.data(moreFields).on("accept", function(d2) {
65607 var field = d2.field;
65609 selection2.call(formFields);
65613 if (_lastPlaceholder !== placeholder) {
65614 input.attr("placeholder", placeholder);
65615 _lastPlaceholder = placeholder;
65618 formFields.fieldsArr = function(val) {
65619 if (!arguments.length) return _fieldsArr;
65620 _fieldsArr = val || [];
65623 formFields.state = function(val) {
65624 if (!arguments.length) return _state;
65628 formFields.klass = function(val) {
65629 if (!arguments.length) return _klass;
65636 // modules/ui/sections/preset_fields.js
65637 function uiSectionPresetFields(context) {
65638 var section = uiSection("preset-fields", context).label(() => _t.append("inspector.fields")).disclosureContent(renderDisclosureContent);
65639 var dispatch14 = dispatch_default("change", "revert");
65640 var formFields = uiFormFields(context);
65646 function renderDisclosureContent(selection2) {
65648 var graph = context.graph();
65649 var geometries = Object.keys(_entityIDs.reduce(function(geoms, entityID) {
65650 geoms[graph.entity(entityID).geometry(graph)] = true;
65653 const loc = _entityIDs.reduce(function(extent, entityID) {
65654 var entity = context.graph().entity(entityID);
65655 return extent.extend(entity.extent(context.graph()));
65656 }, geoExtent()).center();
65657 var presetsManager = _mainPresetIndex;
65658 var allFields = [];
65659 var allMoreFields = [];
65660 var sharedTotalFields;
65661 _presets.forEach(function(preset) {
65662 var fields = preset.fields(loc);
65663 var moreFields = preset.moreFields(loc);
65664 allFields = utilArrayUnion(allFields, fields);
65665 allMoreFields = utilArrayUnion(allMoreFields, moreFields);
65666 if (!sharedTotalFields) {
65667 sharedTotalFields = utilArrayUnion(fields, moreFields);
65669 sharedTotalFields = sharedTotalFields.filter(function(field) {
65670 return fields.indexOf(field) !== -1 || moreFields.indexOf(field) !== -1;
65674 var sharedFields = allFields.filter(function(field) {
65675 return sharedTotalFields.indexOf(field) !== -1;
65677 var sharedMoreFields = allMoreFields.filter(function(field) {
65678 return sharedTotalFields.indexOf(field) !== -1;
65681 sharedFields.forEach(function(field) {
65682 if (field.matchAllGeometry(geometries)) {
65684 uiField(context, field, _entityIDs)
65688 var singularEntity = _entityIDs.length === 1 && graph.hasEntity(_entityIDs[0]);
65689 if (singularEntity && singularEntity.isHighwayIntersection(graph) && presetsManager.field("restrictions")) {
65691 uiField(context, presetsManager.field("restrictions"), _entityIDs)
65694 var additionalFields = utilArrayUnion(sharedMoreFields, presetsManager.universal());
65695 additionalFields.sort(function(field1, field2) {
65696 return field1.title().localeCompare(field2.title(), _mainLocalizer.localeCode());
65698 additionalFields.forEach(function(field) {
65699 if (sharedFields.indexOf(field) === -1 && field.matchAllGeometry(geometries)) {
65701 uiField(context, field, _entityIDs, { show: false })
65705 _fieldsArr.forEach(function(field) {
65706 field.on("change", function(t2, onInput) {
65707 dispatch14.call("change", field, _entityIDs, t2, onInput);
65708 }).on("revert", function(keys2) {
65709 dispatch14.call("revert", field, keys2);
65713 _fieldsArr.forEach(function(field) {
65714 field.state(_state).tags(_tags);
65717 formFields.fieldsArr(_fieldsArr).state(_state).klass("grouped-items-area")
65720 section.presets = function(val) {
65721 if (!arguments.length) return _presets;
65722 if (!_presets || !val || !utilArrayIdentical(_presets, val)) {
65728 section.state = function(val) {
65729 if (!arguments.length) return _state;
65733 section.tags = function(val) {
65734 if (!arguments.length) return _tags;
65738 section.entityIDs = function(val) {
65739 if (!arguments.length) return _entityIDs;
65740 if (!val || !_entityIDs || !utilArrayIdentical(_entityIDs, val)) {
65746 return utilRebind(section, dispatch14, "on");
65749 // modules/ui/sections/raw_member_editor.js
65750 function uiSectionRawMemberEditor(context) {
65751 var section = uiSection("raw-member-editor", context).shouldDisplay(function() {
65752 if (!_entityIDs || _entityIDs.length !== 1) return false;
65753 var entity = context.hasEntity(_entityIDs[0]);
65754 return entity && entity.type === "relation";
65755 }).label(function() {
65756 var entity = context.hasEntity(_entityIDs[0]);
65757 if (!entity) return "";
65758 var gt2 = entity.members.length > _maxMembers ? ">" : "";
65759 var count = gt2 + entity.members.slice(0, _maxMembers).length;
65760 return _t.append("inspector.title_count", { title: _t("inspector.members"), count });
65761 }).disclosureContent(renderDisclosureContent);
65762 var taginfo = services.taginfo;
65764 var _maxMembers = 1e3;
65765 function downloadMember(d3_event, d2) {
65766 d3_event.preventDefault();
65767 select_default2(this).classed("loading", true);
65768 context.loadEntity(d2.id, function() {
65769 section.reRender();
65772 function zoomToMember(d3_event, d2) {
65773 d3_event.preventDefault();
65774 var entity = context.entity(d2.id);
65775 context.map().zoomToEase(entity);
65776 utilHighlightEntities([d2.id], true, context);
65778 function selectMember(d3_event, d2) {
65779 d3_event.preventDefault();
65780 utilHighlightEntities([d2.id], false, context);
65781 var entity = context.entity(d2.id);
65782 var mapExtent = context.map().extent();
65783 if (!entity.intersects(mapExtent, context.graph())) {
65784 context.map().zoomToEase(entity);
65786 context.enter(modeSelect(context, [d2.id]));
65788 function changeRole(d3_event, d2) {
65789 var oldRole = d2.role;
65790 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
65791 if (oldRole !== newRole) {
65792 var member = { id: d2.id, type: d2.type, role: newRole };
65794 actionChangeMember(d2.relation.id, member, d2.index),
65795 _t("operations.change_role.annotation", {
65799 context.validator().validate();
65802 function deleteMember(d3_event, d2) {
65803 utilHighlightEntities([d2.id], false, context);
65805 actionDeleteMember(d2.relation.id, d2.index),
65806 _t("operations.delete_member.annotation", {
65810 if (!context.hasEntity(d2.relation.id)) {
65811 context.enter(modeBrowse(context));
65813 context.validator().validate();
65816 function renderDisclosureContent(selection2) {
65817 var entityID = _entityIDs[0];
65818 var memberships = [];
65819 var entity = context.entity(entityID);
65820 entity.members.slice(0, _maxMembers).forEach(function(member, index) {
65827 member: context.hasEntity(member.id),
65828 domId: utilUniqueDomId(entityID + "-member-" + index)
65831 var list2 = selection2.selectAll(".member-list").data([0]);
65832 list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
65833 var items = list2.selectAll("li").data(memberships, function(d2) {
65834 return osmEntity.key(d2.relation) + "," + d2.index + "," + (d2.member ? osmEntity.key(d2.member) : "incomplete");
65836 items.exit().each(unbind).remove();
65837 var itemsEnter = items.enter().append("li").attr("class", "member-row form-field").classed("member-incomplete", function(d2) {
65840 itemsEnter.each(function(d2) {
65841 var item = select_default2(this);
65842 var label = item.append("label").attr("class", "field-label").attr("for", d2.domId);
65844 item.on("mouseover", function() {
65845 utilHighlightEntities([d2.id], true, context);
65846 }).on("mouseout", function() {
65847 utilHighlightEntities([d2.id], false, context);
65849 var labelLink = label.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectMember);
65850 labelLink.append("span").attr("class", "member-entity-type").text(function(d4) {
65851 var matched = _mainPresetIndex.match(d4.member, context.graph());
65852 return matched && matched.name() || utilDisplayType(d4.member.id);
65854 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) {
65855 return utilDisplayName(d4.member);
65857 label.append("button").attr("title", _t("icons.remove")).attr("class", "remove member-delete").call(svgIcon("#iD-operation-delete"));
65858 label.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToMember);
65860 var labelText = label.append("span").attr("class", "label-text");
65861 labelText.append("span").attr("class", "member-entity-type").call(_t.append("inspector." + d2.type, { id: d2.id }));
65862 labelText.append("span").attr("class", "member-entity-name").call(_t.append("inspector.incomplete", { id: d2.id }));
65863 label.append("button").attr("class", "member-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMember);
65866 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
65867 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
65869 }).property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
65871 wrapEnter.each(bindTypeahead);
65873 items = items.merge(itemsEnter).order();
65874 items.select("input.member-role").property("value", function(d2) {
65876 }).on("blur", changeRole).on("change", changeRole);
65877 items.select("button.member-delete").on("click", deleteMember);
65878 var dragOrigin, targetIndex;
65880 drag_default().on("start", function(d3_event) {
65885 targetIndex = null;
65886 }).on("drag", function(d3_event) {
65887 var x2 = d3_event.x - dragOrigin.x, y2 = d3_event.y - dragOrigin.y;
65888 if (!select_default2(this).classed("dragging") && // don't display drag until dragging beyond a distance threshold
65889 Math.sqrt(Math.pow(x2, 2) + Math.pow(y2, 2)) <= 5) return;
65890 var index = items.nodes().indexOf(this);
65891 select_default2(this).classed("dragging", true);
65892 targetIndex = null;
65893 selection2.selectAll("li.member-row").style("transform", function(d2, index2) {
65894 var node = select_default2(this).node();
65895 if (index === index2) {
65896 return "translate(" + x2 + "px, " + y2 + "px)";
65897 } else if (index2 > index && d3_event.y > node.offsetTop) {
65898 if (targetIndex === null || index2 > targetIndex) {
65899 targetIndex = index2;
65901 return "translateY(-100%)";
65902 } else if (index2 < index && d3_event.y < node.offsetTop + node.offsetHeight) {
65903 if (targetIndex === null || index2 < targetIndex) {
65904 targetIndex = index2;
65906 return "translateY(100%)";
65910 }).on("end", function(d3_event, d2) {
65911 if (!select_default2(this).classed("dragging")) return;
65912 var index = items.nodes().indexOf(this);
65913 select_default2(this).classed("dragging", false);
65914 selection2.selectAll("li.member-row").style("transform", null);
65915 if (targetIndex !== null) {
65917 actionMoveMember(d2.relation.id, index, targetIndex),
65918 _t("operations.reorder_members.annotation")
65920 context.validator().validate();
65924 function bindTypeahead(d2) {
65925 var row = select_default2(this);
65926 var role = row.selectAll("input.member-role");
65927 var origValue = role.property("value");
65928 function sort(value, data) {
65929 var sameletter = [];
65931 for (var i3 = 0; i3 < data.length; i3++) {
65932 if (data[i3].value.substring(0, value.length) === value) {
65933 sameletter.push(data[i3]);
65935 other.push(data[i3]);
65938 return sameletter.concat(other);
65941 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
65944 geometry = context.graph().geometry(d2.member.id);
65945 } else if (d2.type === "relation") {
65946 geometry = "relation";
65947 } else if (d2.type === "way") {
65950 geometry = "point";
65952 var rtype = entity.tags.type;
65955 rtype: rtype || "",
65958 }, function(err, data) {
65959 if (!err) callback(sort(role2, data));
65961 }).on("cancel", function() {
65962 role.property("value", origValue);
65966 function unbind() {
65967 var row = select_default2(this);
65968 row.selectAll("input.member-role").call(uiCombobox.off, context);
65971 section.entityIDs = function(val) {
65972 if (!arguments.length) return _entityIDs;
65979 // modules/actions/delete_members.js
65980 function actionDeleteMembers(relationId, memberIndexes) {
65981 return function(graph) {
65982 memberIndexes.sort((a2, b2) => b2 - a2);
65983 for (var i3 in memberIndexes) {
65984 graph = actionDeleteMember(relationId, memberIndexes[i3])(graph);
65990 // modules/ui/sections/raw_membership_editor.js
65991 function uiSectionRawMembershipEditor(context) {
65992 var section = uiSection("raw-membership-editor", context).shouldDisplay(function() {
65993 return _entityIDs && _entityIDs.length;
65994 }).label(function() {
65995 var parents = getSharedParentRelations();
65996 var gt2 = parents.length > _maxMemberships ? ">" : "";
65997 var count = gt2 + parents.slice(0, _maxMemberships).length;
65998 return _t.append("inspector.title_count", { title: _t("inspector.relations"), count });
65999 }).disclosureContent(renderDisclosureContent);
66000 var taginfo = services.taginfo;
66001 var nearbyCombo = uiCombobox(context, "parent-relation").minItems(1).fetcher(fetchNearbyRelations).itemsMouseEnter(function(d3_event, d2) {
66002 if (d2.relation) utilHighlightEntities([d2.relation.id], true, context);
66003 }).itemsMouseLeave(function(d3_event, d2) {
66004 if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
66006 var _inChange = false;
66007 var _entityIDs = [];
66009 var _maxMemberships = 1e3;
66010 function getSharedParentRelations() {
66012 for (var i3 = 0; i3 < _entityIDs.length; i3++) {
66013 var entity = context.graph().hasEntity(_entityIDs[i3]);
66014 if (!entity) continue;
66016 parents = context.graph().parentRelations(entity);
66018 parents = utilArrayIntersection(parents, context.graph().parentRelations(entity));
66020 if (!parents.length) break;
66024 function getMemberships() {
66025 var memberships = [];
66026 var relations = getSharedParentRelations().slice(0, _maxMemberships);
66027 var isMultiselect = _entityIDs.length > 1;
66028 var i3, relation, membership, index, member, indexedMember;
66029 for (i3 = 0; i3 < relations.length; i3++) {
66030 relation = relations[i3];
66034 hash: osmEntity.key(relation)
66036 for (index = 0; index < relation.members.length; index++) {
66037 member = relation.members[index];
66038 if (_entityIDs.indexOf(member.id) !== -1) {
66039 indexedMember = Object.assign({}, member, { index });
66040 membership.members.push(indexedMember);
66041 membership.hash += "," + index.toString();
66042 if (!isMultiselect) {
66043 memberships.push(membership);
66047 hash: osmEntity.key(relation)
66052 if (membership.members.length) memberships.push(membership);
66054 memberships.forEach(function(membership2) {
66055 membership2.domId = utilUniqueDomId("membership-" + membership2.relation.id);
66057 membership2.members.forEach(function(member2) {
66058 if (roles.indexOf(member2.role) === -1) roles.push(member2.role);
66060 membership2.role = roles.length === 1 ? roles[0] : roles;
66062 return memberships;
66064 function selectRelation(d3_event, d2) {
66065 d3_event.preventDefault();
66066 utilHighlightEntities([d2.relation.id], false, context);
66067 context.enter(modeSelect(context, [d2.relation.id]));
66069 function zoomToRelation(d3_event, d2) {
66070 d3_event.preventDefault();
66071 var entity = context.entity(d2.relation.id);
66072 context.map().zoomToEase(entity);
66073 utilHighlightEntities([d2.relation.id], true, context);
66075 function changeRole(d3_event, d2) {
66076 if (d2 === 0) return;
66077 if (_inChange) return;
66078 var newRole = context.cleanRelationRole(select_default2(this).property("value"));
66079 if (!newRole.trim() && typeof d2.role !== "string") return;
66080 var membersToUpdate = d2.members.filter(function(member) {
66081 return member.role !== newRole;
66083 if (membersToUpdate.length) {
66086 function actionChangeMemberRoles(graph) {
66087 membersToUpdate.forEach(function(member) {
66088 var newMember = Object.assign({}, member, { role: newRole });
66089 delete newMember.index;
66090 graph = actionChangeMember(d2.relation.id, newMember, member.index)(graph);
66094 _t("operations.change_role.annotation", {
66095 n: membersToUpdate.length
66098 context.validator().validate();
66102 function addMembership(d2, role) {
66104 _showBlank = false;
66105 function actionAddMembers(relationId, ids, role2) {
66106 return function(graph) {
66107 for (var i3 in ids) {
66108 var member = { id: ids[i3], type: graph.entity(ids[i3]).type, role: role2 };
66109 graph = actionAddMember(relationId, member)(graph);
66116 actionAddMembers(d2.relation.id, _entityIDs, role),
66117 _t("operations.add_member.annotation", {
66118 n: _entityIDs.length
66121 context.validator().validate();
66123 var relation = osmRelation();
66125 actionAddEntity(relation),
66126 actionAddMembers(relation.id, _entityIDs, role),
66127 _t("operations.add.annotation.relation")
66129 context.enter(modeSelect(context, [relation.id]).newFeature(true));
66132 function downloadMembers(d3_event, d2) {
66133 d3_event.preventDefault();
66134 const button = select_default2(this);
66135 button.classed("loading", true);
66136 context.loadEntity(d2.relation.id, function() {
66137 section.reRender();
66140 function deleteMembership(d3_event, d2) {
66142 if (d2 === 0) return;
66143 utilHighlightEntities([d2.relation.id], false, context);
66144 var indexes = d2.members.map(function(member) {
66145 return member.index;
66148 actionDeleteMembers(d2.relation.id, indexes),
66149 _t("operations.delete_member.annotation", {
66150 n: _entityIDs.length
66153 context.validator().validate();
66155 function fetchNearbyRelations(q2, callback) {
66156 var newRelation = {
66158 value: _t("inspector.new_relation"),
66159 display: _t.append("inspector.new_relation")
66161 var entityID = _entityIDs[0];
66163 var graph = context.graph();
66164 function baseDisplayValue(entity) {
66165 var matched = _mainPresetIndex.match(entity, graph);
66166 var presetName = matched && matched.name() || _t("inspector.relation");
66167 var entityName = utilDisplayName(entity) || "";
66168 return presetName + " " + entityName;
66170 function baseDisplayLabel(entity) {
66171 var matched = _mainPresetIndex.match(entity, graph);
66172 var presetName = matched && matched.name() || _t("inspector.relation");
66173 var entityName = utilDisplayName(entity) || "";
66174 return (selection2) => {
66175 selection2.append("b").text(presetName + " ");
66176 selection2.append("span").classed("has-colour", entity.tags.colour && isColourValid(entity.tags.colour)).style("border-color", entity.tags.colour).text(entityName);
66179 var explicitRelation = q2 && context.hasEntity(q2.toLowerCase());
66180 if (explicitRelation && explicitRelation.type === "relation" && explicitRelation.id !== entityID) {
66182 relation: explicitRelation,
66183 value: baseDisplayValue(explicitRelation) + " " + explicitRelation.id,
66184 display: baseDisplayLabel(explicitRelation)
66187 context.history().intersects(context.map().extent()).forEach(function(entity) {
66188 if (entity.type !== "relation" || entity.id === entityID) return;
66189 var value = baseDisplayValue(entity);
66190 if (q2 && (value + " " + entity.id).toLowerCase().indexOf(q2.toLowerCase()) === -1) return;
66194 display: baseDisplayLabel(entity)
66197 result.sort(function(a2, b2) {
66198 return osmRelation.creationOrder(a2.relation, b2.relation);
66200 var dupeGroups = Object.values(utilArrayGroupBy(result, "value")).filter(function(v2) {
66201 return v2.length > 1;
66203 dupeGroups.forEach(function(group) {
66204 group.forEach(function(obj) {
66205 obj.value += " " + obj.relation.id;
66209 result.forEach(function(obj) {
66210 obj.title = obj.value;
66212 result.unshift(newRelation);
66215 function renderDisclosureContent(selection2) {
66216 var memberships = getMemberships();
66217 var list2 = selection2.selectAll(".member-list").data([0]);
66218 list2 = list2.enter().append("ul").attr("class", "member-list").merge(list2);
66219 var items = list2.selectAll("li.member-row-normal").data(memberships, function(d2) {
66222 items.exit().each(unbind).remove();
66223 var itemsEnter = items.enter().append("li").attr("class", "member-row member-row-normal form-field");
66224 itemsEnter.on("mouseover", function(d3_event, d2) {
66225 utilHighlightEntities([d2.relation.id], true, context);
66226 }).on("mouseout", function(d3_event, d2) {
66227 utilHighlightEntities([d2.relation.id], false, context);
66229 var labelEnter = itemsEnter.append("label").attr("class", "field-label").attr("for", function(d2) {
66232 var labelLink = labelEnter.append("span").attr("class", "label-text").append("a").attr("href", "#").on("click", selectRelation);
66233 labelLink.append("span").attr("class", "member-entity-type").text(function(d2) {
66234 var matched = _mainPresetIndex.match(d2.relation, context.graph());
66235 return matched && matched.name() || _t.html("inspector.relation");
66237 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) {
66238 return utilDisplayName(d2.relation);
66240 labelEnter.append("button").attr("class", "members-download").attr("title", _t("icons.download")).call(svgIcon("#iD-icon-load")).on("click", downloadMembers);
66241 labelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", deleteMembership);
66242 labelEnter.append("button").attr("class", "member-zoom").attr("title", _t("icons.zoom_to")).call(svgIcon("#iD-icon-framed-dot", "monochrome")).on("click", zoomToRelation);
66243 items = items.merge(itemsEnter);
66244 items.selectAll("button.members-download").classed("hide", (d2) => {
66245 const graph = context.graph();
66246 return d2.relation.members.every((m2) => graph.hasEntity(m2.id));
66248 var wrapEnter = itemsEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
66249 wrapEnter.append("input").attr("class", "member-role").attr("id", function(d2) {
66251 }).property("type", "text").property("value", function(d2) {
66252 return typeof d2.role === "string" ? d2.role : "";
66253 }).attr("title", function(d2) {
66254 return Array.isArray(d2.role) ? d2.role.filter(Boolean).join("\n") : d2.role;
66255 }).attr("placeholder", function(d2) {
66256 return Array.isArray(d2.role) ? _t("inspector.multiple_roles") : _t("inspector.role");
66257 }).classed("mixed", function(d2) {
66258 return Array.isArray(d2.role);
66259 }).call(utilNoAuto).on("blur", changeRole).on("change", changeRole);
66261 wrapEnter.each(bindTypeahead);
66263 var newMembership = list2.selectAll(".member-row-new").data(_showBlank ? [0] : []);
66264 newMembership.exit().remove();
66265 var newMembershipEnter = newMembership.enter().append("li").attr("class", "member-row member-row-new form-field");
66266 var newLabelEnter = newMembershipEnter.append("label").attr("class", "field-label");
66267 newLabelEnter.append("input").attr("placeholder", _t("inspector.choose_relation")).attr("type", "text").attr("class", "member-entity-input").call(utilNoAuto);
66268 newLabelEnter.append("button").attr("class", "remove member-delete").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete")).on("click", function() {
66269 list2.selectAll(".member-row-new").remove();
66271 var newWrapEnter = newMembershipEnter.append("div").attr("class", "form-field-input-wrap form-field-input-member");
66272 newWrapEnter.append("input").attr("class", "member-role").property("type", "text").attr("placeholder", _t("inspector.role")).call(utilNoAuto);
66273 newMembership = newMembership.merge(newMembershipEnter);
66274 newMembership.selectAll(".member-entity-input").on("blur", cancelEntity).call(
66275 nearbyCombo.on("accept", acceptEntity).on("cancel", cancelEntity)
66277 var addRow = selection2.selectAll(".add-row").data([0]);
66278 var addRowEnter = addRow.enter().append("div").attr("class", "add-row");
66279 var addRelationButton = addRowEnter.append("button").attr("class", "add-relation").attr("aria-label", _t("inspector.add_to_relation"));
66280 addRelationButton.call(svgIcon("#iD-icon-plus", "light"));
66281 addRelationButton.call(uiTooltip().title(() => _t.append("inspector.add_to_relation")).placement(_mainLocalizer.textDirection() === "ltr" ? "right" : "left"));
66282 addRowEnter.append("div").attr("class", "space-value");
66283 addRowEnter.append("div").attr("class", "space-buttons");
66284 addRow = addRow.merge(addRowEnter);
66285 addRow.select(".add-relation").on("click", function() {
66287 section.reRender();
66288 list2.selectAll(".member-entity-input").node().focus();
66290 function acceptEntity(d2) {
66295 if (d2.relation) utilHighlightEntities([d2.relation.id], false, context);
66296 var role = context.cleanRelationRole(list2.selectAll(".member-row-new .member-role").property("value"));
66297 addMembership(d2, role);
66299 function cancelEntity() {
66300 var input = newMembership.selectAll(".member-entity-input");
66301 input.property("value", "");
66302 context.surface().selectAll(".highlighted").classed("highlighted", false);
66304 function bindTypeahead(d2) {
66305 var row = select_default2(this);
66306 var role = row.selectAll("input.member-role");
66307 var origValue = role.property("value");
66308 function sort(value, data) {
66309 var sameletter = [];
66311 for (var i3 = 0; i3 < data.length; i3++) {
66312 if (data[i3].value.substring(0, value.length) === value) {
66313 sameletter.push(data[i3]);
66315 other.push(data[i3]);
66318 return sameletter.concat(other);
66321 uiCombobox(context, "member-role").fetcher(function(role2, callback) {
66322 var rtype = d2.relation.tags.type;
66325 rtype: rtype || "",
66326 geometry: context.graph().geometry(_entityIDs[0]),
66328 }, function(err, data) {
66329 if (!err) callback(sort(role2, data));
66331 }).on("cancel", function() {
66332 role.property("value", origValue);
66336 function unbind() {
66337 var row = select_default2(this);
66338 row.selectAll("input.member-role").call(uiCombobox.off, context);
66341 section.entityIDs = function(val) {
66342 if (!arguments.length) return _entityIDs;
66344 _showBlank = false;
66350 // modules/ui/sections/selection_list.js
66351 function uiSectionSelectionList(context) {
66352 var _selectedIDs = [];
66353 var section = uiSection("selected-features", context).shouldDisplay(function() {
66354 return _selectedIDs.length > 1;
66355 }).label(function() {
66356 return _t.append("inspector.title_count", { title: _t("inspector.features"), count: _selectedIDs.length });
66357 }).disclosureContent(renderDisclosureContent);
66358 context.history().on("change.selectionList", function(difference2) {
66360 section.reRender();
66363 section.entityIDs = function(val) {
66364 if (!arguments.length) return _selectedIDs;
66365 _selectedIDs = val;
66368 function selectEntity(d3_event, entity) {
66369 context.enter(modeSelect(context, [entity.id]));
66371 function deselectEntity(d3_event, entity) {
66372 var selectedIDs = _selectedIDs.slice();
66373 var index = selectedIDs.indexOf(entity.id);
66375 selectedIDs.splice(index, 1);
66376 context.enter(modeSelect(context, selectedIDs));
66379 function renderDisclosureContent(selection2) {
66380 var list2 = selection2.selectAll(".feature-list").data([0]);
66381 list2 = list2.enter().append("ul").attr("class", "feature-list").merge(list2);
66382 var entities = _selectedIDs.map(function(id2) {
66383 return context.hasEntity(id2);
66384 }).filter(Boolean);
66385 var items = list2.selectAll(".feature-list-item").data(entities, osmEntity.key);
66386 items.exit().remove();
66387 var enter = items.enter().append("li").attr("class", "feature-list-item").each(function(d2) {
66388 select_default2(this).on("mouseover", function() {
66389 utilHighlightEntities([d2.id], true, context);
66390 }).on("mouseout", function() {
66391 utilHighlightEntities([d2.id], false, context);
66394 var label = enter.append("button").attr("class", "label").on("click", selectEntity);
66395 label.append("span").attr("class", "entity-geom-icon").call(svgIcon("", "pre-text"));
66396 label.append("span").attr("class", "entity-type");
66397 label.append("span").attr("class", "entity-name");
66398 enter.append("button").attr("class", "close").attr("title", _t("icons.deselect")).on("click", deselectEntity).call(svgIcon("#iD-icon-close"));
66399 items = items.merge(enter);
66400 items.selectAll(".entity-geom-icon use").attr("href", function() {
66401 var entity = this.parentNode.parentNode.__data__;
66402 return "#iD-icon-" + entity.geometry(context.graph());
66404 items.selectAll(".entity-type").text(function(entity) {
66405 return _mainPresetIndex.match(entity, context.graph()).name();
66407 items.selectAll(".entity-name").text(function(d2) {
66408 var entity = context.entity(d2.id);
66409 return utilDisplayName(entity);
66415 // modules/ui/entity_editor.js
66416 function uiEntityEditor(context) {
66417 var dispatch14 = dispatch_default("choose");
66418 var _state = "select";
66419 var _coalesceChanges = false;
66420 var _modified = false;
66423 var _activePresets = [];
66426 function entityEditor(selection2) {
66427 var combinedTags = utilCombinedTags(_entityIDs, context.graph());
66428 var header = selection2.selectAll(".header").data([0]);
66429 var headerEnter = header.enter().append("div").attr("class", "header fillL");
66430 var direction = _mainLocalizer.textDirection() === "rtl" ? "forward" : "backward";
66431 headerEnter.append("button").attr("class", "preset-reset preset-choose").attr("title", _t("inspector.back_tooltip")).call(svgIcon("#iD-icon-".concat(direction)));
66432 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
66433 context.enter(modeBrowse(context));
66434 }).call(svgIcon(_modified ? "#iD-icon-apply" : "#iD-icon-close"));
66435 headerEnter.append("h2");
66436 header = header.merge(headerEnter);
66437 header.selectAll("h2").text("").call(_entityIDs.length === 1 ? _t.append("inspector.edit") : _t.append("inspector.edit_features"));
66438 header.selectAll(".preset-reset").on("click", function() {
66439 dispatch14.call("choose", this, _activePresets);
66441 var body = selection2.selectAll(".inspector-body").data([0]);
66442 var bodyEnter = body.enter().append("div").attr("class", "entity-editor inspector-body sep-top");
66443 body = body.merge(bodyEnter);
66446 uiSectionSelectionList(context),
66447 uiSectionFeatureType(context).on("choose", function(presets) {
66448 dispatch14.call("choose", this, presets);
66450 uiSectionEntityIssues(context),
66451 uiSectionPresetFields(context).on("change", changeTags).on("revert", revertTags),
66452 uiSectionRawTagEditor("raw-tag-editor", context).on("change", changeTags),
66453 uiSectionRawMemberEditor(context),
66454 uiSectionRawMembershipEditor(context)
66457 _sections.forEach(function(section) {
66458 if (section.entityIDs) {
66459 section.entityIDs(_entityIDs);
66461 if (section.presets) {
66462 section.presets(_activePresets);
66464 if (section.tags) {
66465 section.tags(combinedTags);
66467 if (section.state) {
66468 section.state(_state);
66470 body.call(section.render);
66472 context.history().on("change.entity-editor", historyChanged);
66473 function historyChanged(difference2) {
66474 if (selection2.selectAll(".entity-editor").empty()) return;
66475 if (_state === "hide") return;
66476 var significant = !difference2 || difference2.didChange.properties || difference2.didChange.addition || difference2.didChange.deletion;
66477 if (!significant) return;
66478 _entityIDs = _entityIDs.filter(context.hasEntity);
66479 if (!_entityIDs.length) return;
66480 var priorActivePreset = _activePresets.length === 1 && _activePresets[0];
66481 loadActivePresets();
66482 var graph = context.graph();
66483 entityEditor.modified(_base !== graph);
66484 entityEditor(selection2);
66485 if (priorActivePreset && _activePresets.length === 1 && priorActivePreset !== _activePresets[0]) {
66486 context.container().selectAll(".entity-editor button.preset-reset .label").style("background-color", "#fff").transition().duration(750).style("background-color", null);
66490 function changeTags(entityIDs, changed, onInput) {
66492 for (var i3 in entityIDs) {
66493 var entityID = entityIDs[i3];
66494 var entity = context.entity(entityID);
66495 var tags = Object.assign({}, entity.tags);
66496 if (typeof changed === "function") {
66497 tags = changed(tags);
66499 for (var k2 in changed) {
66501 var v2 = changed[k2];
66502 if (typeof v2 === "object") {
66503 tags[k2] = tags[v2.oldKey];
66504 } else if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
66510 tags = utilCleanTags(tags);
66512 if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
66513 actions.push(actionChangeTags(entityID, tags));
66516 if (actions.length) {
66517 var combinedAction = function(graph) {
66518 actions.forEach(function(action) {
66519 graph = action(graph);
66523 var annotation = _t("operations.change_tags.annotation");
66524 if (_coalesceChanges) {
66525 context.overwrite(combinedAction, annotation);
66527 context.perform(combinedAction, annotation);
66528 _coalesceChanges = !!onInput;
66532 context.validator().validate();
66535 function revertTags(keys2) {
66537 for (var i3 in _entityIDs) {
66538 var entityID = _entityIDs[i3];
66539 var original = context.graph().base().entities[entityID];
66541 for (var j2 in keys2) {
66542 var key = keys2[j2];
66543 changed[key] = original ? original.tags[key] : void 0;
66545 var entity = context.entity(entityID);
66546 var tags = Object.assign({}, entity.tags);
66547 for (var k2 in changed) {
66549 var v2 = changed[k2];
66550 if (v2 !== void 0 || tags.hasOwnProperty(k2)) {
66554 tags = utilCleanTags(tags);
66555 if (!(0, import_fast_deep_equal9.default)(entity.tags, tags)) {
66556 actions.push(actionChangeTags(entityID, tags));
66559 if (actions.length) {
66560 var combinedAction = function(graph) {
66561 actions.forEach(function(action) {
66562 graph = action(graph);
66566 var annotation = _t("operations.change_tags.annotation");
66567 if (_coalesceChanges) {
66568 context.overwrite(combinedAction, annotation);
66570 context.perform(combinedAction, annotation);
66571 _coalesceChanges = false;
66574 context.validator().validate();
66576 entityEditor.modified = function(val) {
66577 if (!arguments.length) return _modified;
66579 return entityEditor;
66581 entityEditor.state = function(val) {
66582 if (!arguments.length) return _state;
66584 return entityEditor;
66586 entityEditor.entityIDs = function(val) {
66587 if (!arguments.length) return _entityIDs;
66588 _base = context.graph();
66589 _coalesceChanges = false;
66590 if (val && _entityIDs && utilArrayIdentical(_entityIDs, val)) return entityEditor;
66592 loadActivePresets(true);
66593 return entityEditor.modified(false);
66595 entityEditor.newFeature = function(val) {
66596 if (!arguments.length) return _newFeature;
66598 return entityEditor;
66600 function loadActivePresets(isForNewSelection) {
66601 var graph = context.graph();
66603 for (var i3 in _entityIDs) {
66604 var entity = graph.hasEntity(_entityIDs[i3]);
66605 if (!entity) return;
66606 var match = _mainPresetIndex.match(entity, graph);
66607 if (!counts[match.id]) counts[match.id] = 0;
66608 counts[match.id] += 1;
66610 var matches = Object.keys(counts).sort(function(p1, p2) {
66611 return counts[p2] - counts[p1];
66612 }).map(function(pID) {
66613 return _mainPresetIndex.item(pID);
66615 if (!isForNewSelection) {
66616 var weakPreset = _activePresets.length === 1 && !_activePresets[0].isFallback() && Object.keys(_activePresets[0].addTags || {}).length === 0;
66617 if (weakPreset && matches.length === 1 && matches[0].isFallback()) return;
66619 entityEditor.presets(matches);
66621 entityEditor.presets = function(val) {
66622 if (!arguments.length) return _activePresets;
66623 if (!utilArrayIdentical(val, _activePresets)) {
66624 _activePresets = val;
66626 return entityEditor;
66628 return utilRebind(entityEditor, dispatch14, "on");
66631 // modules/ui/preset_list.js
66632 function uiPresetList(context) {
66633 var dispatch14 = dispatch_default("cancel", "choose");
66636 var _currentPresets;
66637 var _autofocus = false;
66638 function presetList(selection2) {
66639 if (!_entityIDs) return;
66640 var presets = _mainPresetIndex.matchAllGeometry(entityGeometries());
66641 selection2.html("");
66642 var messagewrap = selection2.append("div").attr("class", "header fillL");
66643 var message = messagewrap.append("h2").call(_t.append("inspector.choose"));
66644 var direction = _mainLocalizer.textDirection() === "rtl" ? "backward" : "forward";
66645 messagewrap.append("button").attr("class", "preset-choose").attr("title", _entityIDs.length === 1 ? _t("inspector.edit") : _t("inspector.edit_features")).on("click", function() {
66646 dispatch14.call("cancel", this);
66647 }).call(svgIcon("#iD-icon-".concat(direction)));
66648 function initialKeydown(d3_event) {
66649 if (search.property("value").length === 0 && (d3_event.keyCode === utilKeybinding.keyCodes["\u232B"] || d3_event.keyCode === utilKeybinding.keyCodes["\u2326"])) {
66650 d3_event.preventDefault();
66651 d3_event.stopPropagation();
66652 operationDelete(context, _entityIDs)();
66653 } else if (search.property("value").length === 0 && (d3_event.ctrlKey || d3_event.metaKey) && d3_event.keyCode === utilKeybinding.keyCodes.z) {
66654 d3_event.preventDefault();
66655 d3_event.stopPropagation();
66657 } else if (!d3_event.ctrlKey && !d3_event.metaKey) {
66658 select_default2(this).on("keydown", keydown);
66659 keydown.call(this, d3_event);
66662 function keydown(d3_event) {
66663 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"] && // if insertion point is at the end of the string
66664 search.node().selectionStart === search.property("value").length) {
66665 d3_event.preventDefault();
66666 d3_event.stopPropagation();
66667 var buttons = list2.selectAll(".preset-list-button");
66668 if (!buttons.empty()) buttons.nodes()[0].focus();
66671 function keypress(d3_event) {
66672 var value = search.property("value");
66673 if (d3_event.keyCode === 13 && // ↩ Return
66675 list2.selectAll(".preset-list-item:first-child").each(function(d2) {
66676 d2.choose.call(this);
66680 function inputevent() {
66681 var value = search.property("value");
66682 list2.classed("filtered", value.length);
66683 var results, messageText;
66684 if (value.length) {
66685 results = presets.search(value, entityGeometries()[0], _currLoc);
66686 messageText = _t.html("inspector.results", {
66687 n: results.collection.length,
66691 var entityPresets2 = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66692 results = _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets2);
66693 messageText = _t.html("inspector.choose");
66695 list2.call(drawList, results);
66696 message.html(messageText);
66698 var searchWrap = selection2.append("div").attr("class", "search-header");
66699 searchWrap.call(svgIcon("#iD-icon-search", "pre-text"));
66700 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));
66702 search.node().focus();
66703 setTimeout(function() {
66704 search.node().focus();
66707 var listWrap = selection2.append("div").attr("class", "inspector-body");
66708 var entityPresets = _entityIDs.map((entityID) => _mainPresetIndex.match(context.graph().entity(entityID), context.graph()));
66709 var list2 = listWrap.append("div").attr("class", "preset-list").call(drawList, _mainPresetIndex.defaults(entityGeometries()[0], 36, !context.inIntro(), _currLoc, entityPresets));
66710 context.features().on("change.preset-list", updateForFeatureHiddenState);
66712 function drawList(list2, presets) {
66713 presets = presets.matchAllGeometry(entityGeometries());
66714 var collection = presets.collection.reduce(function(collection2, preset) {
66715 if (!preset) return collection2;
66716 if (preset.members) {
66717 if (preset.members.collection.filter(function(preset2) {
66718 return preset2.addable();
66720 collection2.push(CategoryItem(preset));
66722 } else if (preset.addable()) {
66723 collection2.push(PresetItem(preset));
66725 return collection2;
66727 var items = list2.selectAll(".preset-list-item").data(collection, function(d2) {
66728 return d2.preset.id;
66731 items.exit().remove();
66732 items.enter().append("div").attr("class", function(item) {
66733 return "preset-list-item preset-" + item.preset.id.replace("/", "-");
66734 }).classed("current", function(item) {
66735 return _currentPresets.indexOf(item.preset) !== -1;
66736 }).each(function(item) {
66737 select_default2(this).call(item);
66738 }).style("opacity", 0).transition().style("opacity", 1);
66739 updateForFeatureHiddenState();
66741 function itemKeydown(d3_event) {
66742 var item = select_default2(this.closest(".preset-list-item"));
66743 var parentItem = select_default2(item.node().parentNode.closest(".preset-list-item"));
66744 if (d3_event.keyCode === utilKeybinding.keyCodes["\u2193"]) {
66745 d3_event.preventDefault();
66746 d3_event.stopPropagation();
66747 var nextItem = select_default2(item.node().nextElementSibling);
66748 if (nextItem.empty()) {
66749 if (!parentItem.empty()) {
66750 nextItem = select_default2(parentItem.node().nextElementSibling);
66752 } else if (select_default2(this).classed("expanded")) {
66753 nextItem = item.select(".subgrid .preset-list-item:first-child");
66755 if (!nextItem.empty()) {
66756 nextItem.select(".preset-list-button").node().focus();
66758 } else if (d3_event.keyCode === utilKeybinding.keyCodes["\u2191"]) {
66759 d3_event.preventDefault();
66760 d3_event.stopPropagation();
66761 var previousItem = select_default2(item.node().previousElementSibling);
66762 if (previousItem.empty()) {
66763 if (!parentItem.empty()) {
66764 previousItem = parentItem;
66766 } else if (previousItem.select(".preset-list-button").classed("expanded")) {
66767 previousItem = previousItem.select(".subgrid .preset-list-item:last-child");
66769 if (!previousItem.empty()) {
66770 previousItem.select(".preset-list-button").node().focus();
66772 var search = select_default2(this.closest(".preset-list-pane")).select(".preset-search-input");
66773 search.node().focus();
66775 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66776 d3_event.preventDefault();
66777 d3_event.stopPropagation();
66778 if (!parentItem.empty()) {
66779 parentItem.select(".preset-list-button").node().focus();
66781 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66782 d3_event.preventDefault();
66783 d3_event.stopPropagation();
66784 item.datum().choose.call(select_default2(this).node());
66787 function CategoryItem(preset) {
66788 var box, sublist, shown = false;
66789 function item(selection2) {
66790 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap category");
66792 var isExpanded = select_default2(this).classed("expanded");
66793 var iconName = isExpanded ? _mainLocalizer.textDirection() === "rtl" ? "#iD-icon-backward" : "#iD-icon-forward" : "#iD-icon-down";
66794 select_default2(this).classed("expanded", !isExpanded).attr("title", !isExpanded ? _t("icons.collapse") : _t("icons.expand"));
66795 select_default2(this).selectAll("div.label-inner svg.icon use").attr("href", iconName);
66798 var geometries = entityGeometries();
66799 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) {
66800 if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2190" : "\u2192"]) {
66801 d3_event.preventDefault();
66802 d3_event.stopPropagation();
66803 if (!select_default2(this).classed("expanded")) {
66804 click.call(this, d3_event);
66806 } else if (d3_event.keyCode === utilKeybinding.keyCodes[_mainLocalizer.textDirection() === "rtl" ? "\u2192" : "\u2190"]) {
66807 d3_event.preventDefault();
66808 d3_event.stopPropagation();
66809 if (select_default2(this).classed("expanded")) {
66810 click.call(this, d3_event);
66813 itemKeydown.call(this, d3_event);
66816 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66817 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");
66818 box = selection2.append("div").attr("class", "subgrid").style("max-height", "0px").style("opacity", 0);
66819 box.append("div").attr("class", "arrow");
66820 sublist = box.append("div").attr("class", "preset-list fillL3");
66822 item.choose = function() {
66823 if (!box || !sublist) return;
66826 box.transition().duration(200).style("opacity", "0").style("max-height", "0px").style("padding-bottom", "0px");
66829 var members = preset.members.matchAllGeometry(entityGeometries());
66830 sublist.call(drawList, members);
66831 box.transition().duration(200).style("opacity", "1").style("max-height", 200 + members.collection.length * 190 + "px").style("padding-bottom", "10px");
66834 item.preset = preset;
66837 function PresetItem(preset) {
66838 function item(selection2) {
66839 var wrap2 = selection2.append("div").attr("class", "preset-list-button-wrap");
66840 var geometries = entityGeometries();
66841 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);
66842 var label = button.append("div").attr("class", "label").append("div").attr("class", "label-inner");
66844 preset.nameLabel(),
66845 preset.subtitleLabel()
66847 label.selectAll(".namepart").data(nameparts, (d2) => d2.stringId).enter().append("div").attr("class", "namepart").text("").each(function(d2) {
66848 d2(select_default2(this));
66850 wrap2.call(item.reference.button);
66851 selection2.call(item.reference.body);
66853 item.choose = function() {
66854 if (select_default2(this).classed("disabled")) return;
66855 if (!context.inIntro()) {
66856 _mainPresetIndex.setMostRecent(preset, entityGeometries()[0]);
66860 for (var i3 in _entityIDs) {
66861 var entityID = _entityIDs[i3];
66862 var oldPreset = _mainPresetIndex.match(graph.entity(entityID), graph);
66863 graph = actionChangePreset(entityID, oldPreset, preset)(graph);
66867 _t("operations.change_tags.annotation")
66869 context.validator().validate();
66870 dispatch14.call("choose", this, preset);
66872 item.help = function(d3_event) {
66873 d3_event.stopPropagation();
66874 item.reference.toggle();
66876 item.preset = preset;
66877 item.reference = uiTagReference(preset.reference(), context);
66880 function updateForFeatureHiddenState() {
66881 if (!_entityIDs.every(context.hasEntity)) return;
66882 var geometries = entityGeometries();
66883 var button = context.container().selectAll(".preset-list .preset-list-button");
66884 button.call(uiTooltip().destroyAny);
66885 button.each(function(item, index) {
66886 var hiddenPresetFeaturesId;
66887 for (var i3 in geometries) {
66888 hiddenPresetFeaturesId = context.features().isHiddenPreset(item.preset, geometries[i3]);
66889 if (hiddenPresetFeaturesId) break;
66891 var isHiddenPreset = !context.inIntro() && !!hiddenPresetFeaturesId && (_currentPresets.length !== 1 || item.preset !== _currentPresets[0]);
66892 select_default2(this).classed("disabled", isHiddenPreset);
66893 if (isHiddenPreset) {
66894 var isAutoHidden = context.features().autoHidden(hiddenPresetFeaturesId);
66895 select_default2(this).call(
66896 uiTooltip().title(() => _t.append("inspector.hidden_preset." + (isAutoHidden ? "zoom" : "manual"), {
66897 features: _t("feature." + hiddenPresetFeaturesId + ".description")
66898 })).placement(index < 2 ? "bottom" : "top")
66903 presetList.autofocus = function(val) {
66904 if (!arguments.length) return _autofocus;
66908 presetList.entityIDs = function(val) {
66909 if (!arguments.length) return _entityIDs;
66912 if (_entityIDs && _entityIDs.length) {
66913 const extent = _entityIDs.reduce(function(extent2, entityID) {
66914 var entity = context.graph().entity(entityID);
66915 return extent2.extend(entity.extent(context.graph()));
66917 _currLoc = extent.center();
66918 var presets = _entityIDs.map(function(entityID) {
66919 return _mainPresetIndex.match(context.entity(entityID), context.graph());
66921 presetList.presets(presets);
66925 presetList.presets = function(val) {
66926 if (!arguments.length) return _currentPresets;
66927 _currentPresets = val;
66930 function entityGeometries() {
66932 for (var i3 in _entityIDs) {
66933 var entityID = _entityIDs[i3];
66934 var entity = context.entity(entityID);
66935 var geometry = entity.geometry(context.graph());
66936 if (geometry === "vertex" && entity.isOnAddressLine(context.graph())) {
66937 geometry = "point";
66939 if (!counts[geometry]) counts[geometry] = 0;
66940 counts[geometry] += 1;
66942 return Object.keys(counts).sort(function(geom1, geom2) {
66943 return counts[geom2] - counts[geom1];
66946 return utilRebind(presetList, dispatch14, "on");
66949 // modules/ui/inspector.js
66950 function uiInspector(context) {
66951 var presetList = uiPresetList(context);
66952 var entityEditor = uiEntityEditor(context);
66953 var wrap2 = select_default2(null), presetPane = select_default2(null), editorPane = select_default2(null);
66954 var _state = "select";
66956 var _newFeature = false;
66957 function inspector(selection2) {
66958 presetList.entityIDs(_entityIDs).autofocus(_newFeature).on("choose", inspector.setPreset).on("cancel", function() {
66959 inspector.setPreset();
66961 entityEditor.state(_state).entityIDs(_entityIDs).on("choose", inspector.showList);
66962 wrap2 = selection2.selectAll(".panewrap").data([0]);
66963 var enter = wrap2.enter().append("div").attr("class", "panewrap");
66964 enter.append("div").attr("class", "preset-list-pane pane");
66965 enter.append("div").attr("class", "entity-editor-pane pane");
66966 wrap2 = wrap2.merge(enter);
66967 presetPane = wrap2.selectAll(".preset-list-pane");
66968 editorPane = wrap2.selectAll(".entity-editor-pane");
66969 function shouldDefaultToPresetList() {
66970 if (_state !== "select") return false;
66971 if (_entityIDs.length !== 1) return false;
66972 var entityID = _entityIDs[0];
66973 var entity = context.hasEntity(entityID);
66974 if (!entity) return false;
66975 if (entity.hasNonGeometryTags()) return false;
66976 if (_newFeature) return true;
66977 if (entity.geometry(context.graph()) !== "vertex") return false;
66978 if (context.graph().parentRelations(entity).length) return false;
66979 if (context.validator().getEntityIssues(entityID).length) return false;
66980 if (entity.isHighwayIntersection(context.graph())) return false;
66983 if (shouldDefaultToPresetList()) {
66984 wrap2.style("right", "-100%");
66985 editorPane.classed("hide", true);
66986 presetPane.classed("hide", false).call(presetList);
66988 wrap2.style("right", "0%");
66989 presetPane.classed("hide", true);
66990 editorPane.classed("hide", false).call(entityEditor);
66992 var footer = selection2.selectAll(".footer").data([0]);
66993 footer = footer.enter().append("div").attr("class", "footer").merge(footer);
66995 uiViewOnOSM(context).what(context.hasEntity(_entityIDs.length === 1 && _entityIDs[0]))
66998 inspector.showList = function(presets) {
66999 presetPane.classed("hide", false);
67000 wrap2.transition().styleTween("right", function() {
67001 return value_default("0%", "-100%");
67002 }).on("end", function() {
67003 editorPane.classed("hide", true);
67006 presetList.presets(presets);
67008 presetPane.call(presetList.autofocus(true));
67010 inspector.setPreset = function(preset) {
67011 if (preset && preset.id === "type/multipolygon") {
67012 presetPane.call(presetList.autofocus(true));
67014 editorPane.classed("hide", false);
67015 wrap2.transition().styleTween("right", function() {
67016 return value_default("-100%", "0%");
67017 }).on("end", function() {
67018 presetPane.classed("hide", true);
67021 entityEditor.presets([preset]);
67023 editorPane.call(entityEditor);
67026 inspector.state = function(val) {
67027 if (!arguments.length) return _state;
67029 entityEditor.state(_state);
67030 context.container().selectAll(".field-help-body").remove();
67033 inspector.entityIDs = function(val) {
67034 if (!arguments.length) return _entityIDs;
67038 inspector.newFeature = function(val) {
67039 if (!arguments.length) return _newFeature;
67046 // modules/ui/keepRight_details.js
67047 function uiKeepRightDetails(context) {
67049 function issueDetail(d2) {
67050 const { itemType, parentIssueType } = d2;
67051 const unknown = { html: _t.html("inspector.unknown") };
67052 let replacements = d2.replacements || {};
67053 replacements.default = unknown;
67054 if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
67055 return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".description"), replacements);
67057 return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".description"), replacements);
67060 function keepRightDetails(selection2) {
67061 const details = selection2.selectAll(".error-details").data(
67062 _qaItem ? [_qaItem] : [],
67063 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67065 details.exit().remove();
67066 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
67067 const descriptionEnter = detailsEnter.append("div").attr("class", "qa-details-subsection");
67068 descriptionEnter.append("h4").call(_t.append("QA.keepRight.detail_description"));
67069 descriptionEnter.append("div").attr("class", "qa-details-description-text").html(issueDetail);
67070 let relatedEntities = [];
67071 descriptionEnter.selectAll(".error_entity_link, .error_object_link").attr("href", "#").each(function() {
67072 const link3 = select_default2(this);
67073 const isObjectLink = link3.classed("error_object_link");
67074 const entityID = isObjectLink ? utilEntityRoot(_qaItem.objectType) + _qaItem.objectId : this.textContent;
67075 const entity = context.hasEntity(entityID);
67076 relatedEntities.push(entityID);
67077 link3.on("mouseenter", () => {
67078 utilHighlightEntities([entityID], true, context);
67079 }).on("mouseleave", () => {
67080 utilHighlightEntities([entityID], false, context);
67081 }).on("click", (d3_event) => {
67082 d3_event.preventDefault();
67083 utilHighlightEntities([entityID], false, context);
67084 const osmlayer = context.layers().layer("osm");
67085 if (!osmlayer.enabled()) {
67086 osmlayer.enabled(true);
67088 context.map().centerZoomEase(_qaItem.loc, 20);
67090 context.enter(modeSelect(context, [entityID]));
67092 context.loadEntity(entityID, (err, result) => {
67094 const entity2 = result.data.find((e3) => e3.id === entityID);
67095 if (entity2) context.enter(modeSelect(context, [entityID]));
67100 let name = utilDisplayName(entity);
67101 if (!name && !isObjectLink) {
67102 const preset = _mainPresetIndex.match(entity, context.graph());
67103 name = preset && !preset.isFallback() && preset.name();
67106 this.innerText = name;
67110 context.features().forceVisible(relatedEntities);
67111 context.map().pan([0, 0]);
67113 keepRightDetails.issue = function(val) {
67114 if (!arguments.length) return _qaItem;
67116 return keepRightDetails;
67118 return keepRightDetails;
67121 // modules/ui/keepRight_header.js
67122 function uiKeepRightHeader() {
67124 function issueTitle(d2) {
67125 const { itemType, parentIssueType } = d2;
67126 const unknown = _t.html("inspector.unknown");
67127 let replacements = d2.replacements || {};
67128 replacements.default = { html: unknown };
67129 if (_mainLocalizer.hasTextForStringId("QA.keepRight.errorTypes.".concat(itemType, ".title"))) {
67130 return _t.html("QA.keepRight.errorTypes.".concat(itemType, ".title"), replacements);
67132 return _t.html("QA.keepRight.errorTypes.".concat(parentIssueType, ".title"), replacements);
67135 function keepRightHeader(selection2) {
67136 const header = selection2.selectAll(".qa-header").data(
67137 _qaItem ? [_qaItem] : [],
67138 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67140 header.exit().remove();
67141 const headerEnter = header.enter().append("div").attr("class", "qa-header");
67142 const iconEnter = headerEnter.append("div").attr("class", "qa-header-icon").classed("new", (d2) => d2.id < 0);
67143 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"));
67144 headerEnter.append("div").attr("class", "qa-header-label").html(issueTitle);
67146 keepRightHeader.issue = function(val) {
67147 if (!arguments.length) return _qaItem;
67149 return keepRightHeader;
67151 return keepRightHeader;
67154 // modules/ui/view_on_keepRight.js
67155 function uiViewOnKeepRight() {
67157 function viewOnKeepRight(selection2) {
67159 if (services.keepRight && _qaItem instanceof QAItem) {
67160 url = services.keepRight.issueURL(_qaItem);
67162 const link3 = selection2.selectAll(".view-on-keepRight").data(url ? [url] : []);
67163 link3.exit().remove();
67164 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"));
67165 linkEnter.append("span").call(_t.append("inspector.view_on_keepRight"));
67167 viewOnKeepRight.what = function(val) {
67168 if (!arguments.length) return _qaItem;
67170 return viewOnKeepRight;
67172 return viewOnKeepRight;
67175 // modules/ui/keepRight_editor.js
67176 function uiKeepRightEditor(context) {
67177 const dispatch14 = dispatch_default("change");
67178 const qaDetails = uiKeepRightDetails(context);
67179 const qaHeader = uiKeepRightHeader(context);
67181 function keepRightEditor(selection2) {
67182 const headerEnter = selection2.selectAll(".header").data([0]).enter().append("div").attr("class", "header fillL");
67183 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
67184 headerEnter.append("h2").call(_t.append("QA.keepRight.title"));
67185 let body = selection2.selectAll(".body").data([0]);
67186 body = body.enter().append("div").attr("class", "body").merge(body);
67187 const editor = body.selectAll(".qa-editor").data([0]);
67188 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(keepRightSaveSection);
67189 const footer = selection2.selectAll(".footer").data([0]);
67190 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnKeepRight(context).what(_qaItem));
67192 function keepRightSaveSection(selection2) {
67193 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67194 const isShown = _qaItem && (isSelected || _qaItem.newComment || _qaItem.comment);
67195 let saveSection = selection2.selectAll(".qa-save").data(
67196 isShown ? [_qaItem] : [],
67197 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67199 saveSection.exit().remove();
67200 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
67201 saveSectionEnter.append("h4").attr("class", ".qa-save-header").call(_t.append("QA.keepRight.comment"));
67202 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);
67203 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
67204 function changeInput() {
67205 const input = select_default2(this);
67206 let val = input.property("value").trim();
67207 if (val === _qaItem.comment) {
67210 _qaItem = _qaItem.update({ newComment: val });
67211 const qaService = services.keepRight;
67213 qaService.replaceItem(_qaItem);
67215 saveSection.call(qaSaveButtons);
67218 function qaSaveButtons(selection2) {
67219 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67220 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
67221 buttonSection.exit().remove();
67222 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
67223 buttonEnter.append("button").attr("class", "button comment-button action").call(_t.append("QA.keepRight.save_comment"));
67224 buttonEnter.append("button").attr("class", "button close-button action");
67225 buttonEnter.append("button").attr("class", "button ignore-button action");
67226 buttonSection = buttonSection.merge(buttonEnter);
67227 buttonSection.select(".comment-button").attr("disabled", (d2) => d2.newComment ? null : true).on("click.comment", function(d3_event, d2) {
67229 const qaService = services.keepRight;
67231 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67234 buttonSection.select(".close-button").html((d2) => {
67235 const andComment = d2.newComment ? "_comment" : "";
67236 return _t.html("QA.keepRight.close".concat(andComment));
67237 }).on("click.close", function(d3_event, d2) {
67239 const qaService = services.keepRight;
67241 d2.newStatus = "ignore_t";
67242 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67245 buttonSection.select(".ignore-button").html((d2) => {
67246 const andComment = d2.newComment ? "_comment" : "";
67247 return _t.html("QA.keepRight.ignore".concat(andComment));
67248 }).on("click.ignore", function(d3_event, d2) {
67250 const qaService = services.keepRight;
67252 d2.newStatus = "ignore";
67253 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67257 keepRightEditor.error = function(val) {
67258 if (!arguments.length) return _qaItem;
67260 return keepRightEditor;
67262 return utilRebind(keepRightEditor, dispatch14, "on");
67265 // modules/ui/osmose_details.js
67266 function uiOsmoseDetails(context) {
67268 function issueString(d2, type2) {
67269 if (!d2) return "";
67270 const s2 = services.osmose.getStrings(d2.itemType);
67271 return type2 in s2 ? s2[type2] : "";
67273 function osmoseDetails(selection2) {
67274 const details = selection2.selectAll(".error-details").data(
67275 _qaItem ? [_qaItem] : [],
67276 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67278 details.exit().remove();
67279 const detailsEnter = details.enter().append("div").attr("class", "error-details qa-details-container");
67280 if (issueString(_qaItem, "detail")) {
67281 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67282 div.append("h4").call(_t.append("QA.keepRight.detail_description"));
67283 div.append("p").attr("class", "qa-details-description-text").html((d2) => issueString(d2, "detail")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67285 const detailsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
67286 const elemsDiv = detailsEnter.append("div").attr("class", "qa-details-subsection");
67287 if (issueString(_qaItem, "fix")) {
67288 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67289 div.append("h4").call(_t.append("QA.osmose.fix_title"));
67290 div.append("p").html((d2) => issueString(d2, "fix")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67292 if (issueString(_qaItem, "trap")) {
67293 const div = detailsEnter.append("div").attr("class", "qa-details-subsection");
67294 div.append("h4").call(_t.append("QA.osmose.trap_title"));
67295 div.append("p").html((d2) => issueString(d2, "trap")).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67297 const thisItem = _qaItem;
67298 services.osmose.loadIssueDetail(_qaItem).then((d2) => {
67299 if (!d2.elems || d2.elems.length === 0) return;
67300 if (context.selectedErrorID() !== thisItem.id && context.container().selectAll(".qaItem.osmose.hover.itemId-".concat(thisItem.id)).empty()) return;
67302 detailsDiv.append("h4").call(_t.append("QA.osmose.detail_title"));
67303 detailsDiv.append("p").html((d4) => d4.detail).selectAll("a").attr("rel", "noopener").attr("target", "_blank");
67305 elemsDiv.append("h4").call(_t.append("QA.osmose.elems_title"));
67306 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() {
67307 const link3 = select_default2(this);
67308 const entityID = this.textContent;
67309 const entity = context.hasEntity(entityID);
67310 link3.on("mouseenter", () => {
67311 utilHighlightEntities([entityID], true, context);
67312 }).on("mouseleave", () => {
67313 utilHighlightEntities([entityID], false, context);
67314 }).on("click", (d3_event) => {
67315 d3_event.preventDefault();
67316 utilHighlightEntities([entityID], false, context);
67317 const osmlayer = context.layers().layer("osm");
67318 if (!osmlayer.enabled()) {
67319 osmlayer.enabled(true);
67321 context.map().centerZoom(d2.loc, 20);
67323 context.enter(modeSelect(context, [entityID]));
67325 context.loadEntity(entityID, (err, result) => {
67327 const entity2 = result.data.find((e3) => e3.id === entityID);
67328 if (entity2) context.enter(modeSelect(context, [entityID]));
67333 let name = utilDisplayName(entity);
67335 const preset = _mainPresetIndex.match(entity, context.graph());
67336 name = preset && !preset.isFallback() && preset.name();
67339 this.innerText = name;
67343 context.features().forceVisible(d2.elems);
67344 context.map().pan([0, 0]);
67345 }).catch((err) => {
67349 osmoseDetails.issue = function(val) {
67350 if (!arguments.length) return _qaItem;
67352 return osmoseDetails;
67354 return osmoseDetails;
67357 // modules/ui/osmose_header.js
67358 function uiOsmoseHeader() {
67360 function issueTitle(d2) {
67361 const unknown = _t("inspector.unknown");
67362 if (!d2) return unknown;
67363 const s2 = services.osmose.getStrings(d2.itemType);
67364 return "title" in s2 ? s2.title : unknown;
67366 function osmoseHeader(selection2) {
67367 const header = selection2.selectAll(".qa-header").data(
67368 _qaItem ? [_qaItem] : [],
67369 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67371 header.exit().remove();
67372 const headerEnter = header.enter().append("div").attr("class", "qa-header");
67373 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));
67374 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");
67375 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 : "");
67376 headerEnter.append("div").attr("class", "qa-header-label").text(issueTitle);
67378 osmoseHeader.issue = function(val) {
67379 if (!arguments.length) return _qaItem;
67381 return osmoseHeader;
67383 return osmoseHeader;
67386 // modules/ui/view_on_osmose.js
67387 function uiViewOnOsmose() {
67389 function viewOnOsmose(selection2) {
67391 if (services.osmose && _qaItem instanceof QAItem) {
67392 url = services.osmose.itemURL(_qaItem);
67394 const link3 = selection2.selectAll(".view-on-osmose").data(url ? [url] : []);
67395 link3.exit().remove();
67396 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"));
67397 linkEnter.append("span").call(_t.append("inspector.view_on_osmose"));
67399 viewOnOsmose.what = function(val) {
67400 if (!arguments.length) return _qaItem;
67402 return viewOnOsmose;
67404 return viewOnOsmose;
67407 // modules/ui/osmose_editor.js
67408 function uiOsmoseEditor(context) {
67409 const dispatch14 = dispatch_default("change");
67410 const qaDetails = uiOsmoseDetails(context);
67411 const qaHeader = uiOsmoseHeader(context);
67413 function osmoseEditor(selection2) {
67414 const header = selection2.selectAll(".header").data([0]);
67415 const headerEnter = header.enter().append("div").attr("class", "header fillL");
67416 headerEnter.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => context.enter(modeBrowse(context))).call(svgIcon("#iD-icon-close"));
67417 headerEnter.append("h2").call(_t.append("QA.osmose.title"));
67418 let body = selection2.selectAll(".body").data([0]);
67419 body = body.enter().append("div").attr("class", "body").merge(body);
67420 let editor = body.selectAll(".qa-editor").data([0]);
67421 editor.enter().append("div").attr("class", "modal-section qa-editor").merge(editor).call(qaHeader.issue(_qaItem)).call(qaDetails.issue(_qaItem)).call(osmoseSaveSection);
67422 const footer = selection2.selectAll(".footer").data([0]);
67423 footer.enter().append("div").attr("class", "footer").merge(footer).call(uiViewOnOsmose(context).what(_qaItem));
67425 function osmoseSaveSection(selection2) {
67426 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67427 const isShown = _qaItem && isSelected;
67428 let saveSection = selection2.selectAll(".qa-save").data(
67429 isShown ? [_qaItem] : [],
67430 (d2) => "".concat(d2.id, "-").concat(d2.status || 0)
67432 saveSection.exit().remove();
67433 const saveSectionEnter = saveSection.enter().append("div").attr("class", "qa-save save-section cf");
67434 saveSection = saveSectionEnter.merge(saveSection).call(qaSaveButtons);
67436 function qaSaveButtons(selection2) {
67437 const isSelected = _qaItem && _qaItem.id === context.selectedErrorID();
67438 let buttonSection = selection2.selectAll(".buttons").data(isSelected ? [_qaItem] : [], (d2) => d2.status + d2.id);
67439 buttonSection.exit().remove();
67440 const buttonEnter = buttonSection.enter().append("div").attr("class", "buttons");
67441 buttonEnter.append("button").attr("class", "button close-button action");
67442 buttonEnter.append("button").attr("class", "button ignore-button action");
67443 buttonSection = buttonSection.merge(buttonEnter);
67444 buttonSection.select(".close-button").call(_t.append("QA.keepRight.close")).on("click.close", function(d3_event, d2) {
67446 const qaService = services.osmose;
67448 d2.newStatus = "done";
67449 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67452 buttonSection.select(".ignore-button").call(_t.append("QA.keepRight.ignore")).on("click.ignore", function(d3_event, d2) {
67454 const qaService = services.osmose;
67456 d2.newStatus = "false";
67457 qaService.postUpdate(d2, (err, item) => dispatch14.call("change", item));
67461 osmoseEditor.error = function(val) {
67462 if (!arguments.length) return _qaItem;
67464 return osmoseEditor;
67466 return utilRebind(osmoseEditor, dispatch14, "on");
67469 // modules/ui/sidebar.js
67470 function uiSidebar(context) {
67471 var inspector = uiInspector(context);
67472 var dataEditor = uiDataEditor(context);
67473 var noteEditor = uiNoteEditor(context);
67474 var keepRightEditor = uiKeepRightEditor(context);
67475 var osmoseEditor = uiOsmoseEditor(context);
67477 var _wasData = false;
67478 var _wasNote = false;
67479 var _wasQaItem = false;
67480 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
67481 function sidebar(selection2) {
67482 var container = context.container();
67483 var minWidth = 240;
67485 var containerWidth;
67487 selection2.style("min-width", minWidth + "px").style("max-width", "400px").style("width", "33.3333%");
67488 var resizer = selection2.append("div").attr("class", "sidebar-resizer").on(_pointerPrefix + "down.sidebar-resizer", pointerdown);
67489 var downPointerId, lastClientX, containerLocGetter;
67490 function pointerdown(d3_event) {
67491 if (downPointerId) return;
67492 if ("button" in d3_event && d3_event.button !== 0) return;
67493 downPointerId = d3_event.pointerId || "mouse";
67494 lastClientX = d3_event.clientX;
67495 containerLocGetter = utilFastMouse(container.node());
67496 dragOffset = utilFastMouse(resizer.node())(d3_event)[0] - 1;
67497 sidebarWidth = selection2.node().getBoundingClientRect().width;
67498 containerWidth = container.node().getBoundingClientRect().width;
67499 var widthPct = sidebarWidth / containerWidth * 100;
67500 selection2.style("width", widthPct + "%").style("max-width", "85%");
67501 resizer.classed("dragging", true);
67502 select_default2(window).on("touchmove.sidebar-resizer", function(d3_event2) {
67503 d3_event2.preventDefault();
67504 }, { passive: false }).on(_pointerPrefix + "move.sidebar-resizer", pointermove).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", pointerup);
67506 function pointermove(d3_event) {
67507 if (downPointerId !== (d3_event.pointerId || "mouse")) return;
67508 d3_event.preventDefault();
67509 var dx = d3_event.clientX - lastClientX;
67510 lastClientX = d3_event.clientX;
67511 var isRTL = _mainLocalizer.textDirection() === "rtl";
67512 var scaleX = isRTL ? 0 : 1;
67513 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
67514 var x2 = containerLocGetter(d3_event)[0] - dragOffset;
67515 sidebarWidth = isRTL ? containerWidth - x2 : x2;
67516 var isCollapsed = selection2.classed("collapsed");
67517 var shouldCollapse = sidebarWidth < minWidth;
67518 selection2.classed("collapsed", shouldCollapse);
67519 if (shouldCollapse) {
67520 if (!isCollapsed) {
67521 selection2.style(xMarginProperty, "-400px").style("width", "400px");
67522 context.ui().onResize([(sidebarWidth - dx) * scaleX, 0]);
67525 var widthPct = sidebarWidth / containerWidth * 100;
67526 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
67528 context.ui().onResize([-sidebarWidth * scaleX, 0]);
67530 context.ui().onResize([-dx * scaleX, 0]);
67534 function pointerup(d3_event) {
67535 if (downPointerId !== (d3_event.pointerId || "mouse")) return;
67536 downPointerId = null;
67537 resizer.classed("dragging", false);
67538 select_default2(window).on("touchmove.sidebar-resizer", null).on(_pointerPrefix + "move.sidebar-resizer", null).on(_pointerPrefix + "up.sidebar-resizer pointercancel.sidebar-resizer", null);
67540 var featureListWrap = selection2.append("div").attr("class", "feature-list-pane").call(uiFeatureList(context));
67541 var inspectorWrap = selection2.append("div").attr("class", "inspector-hidden inspector-wrap");
67542 var hoverModeSelect = function(targets) {
67543 context.container().selectAll(".feature-list-item button").classed("hover", false);
67544 if (context.selectedIDs().length > 1 && targets && targets.length) {
67545 var elements = context.container().selectAll(".feature-list-item button").filter(function(node) {
67546 return targets.indexOf(node) !== -1;
67548 if (!elements.empty()) {
67549 elements.classed("hover", true);
67553 sidebar.hoverModeSelect = throttle_default(hoverModeSelect, 200);
67554 function hover(targets) {
67555 var datum2 = targets && targets.length && targets[0];
67556 if (datum2 && datum2.__featurehash__) {
67558 sidebar.show(dataEditor.datum(datum2));
67559 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67560 } else if (datum2 instanceof osmNote) {
67561 if (context.mode().id === "drag-note") return;
67563 var osm = services.osm;
67565 datum2 = osm.getNote(datum2.id);
67567 sidebar.show(noteEditor.note(datum2));
67568 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67569 } else if (datum2 instanceof QAItem) {
67571 var errService = services[datum2.service];
67573 datum2 = errService.getError(datum2.id);
67576 if (datum2.service === "keepRight") {
67577 errEditor = keepRightEditor;
67579 errEditor = osmoseEditor;
67581 context.container().selectAll(".qaItem." + datum2.service).classed("hover", function(d2) {
67582 return d2.id === datum2.id;
67584 sidebar.show(errEditor.error(datum2));
67585 selection2.selectAll(".sidebar-component").classed("inspector-hover", true);
67586 } else if (!_current && datum2 instanceof osmEntity) {
67587 featureListWrap.classed("inspector-hidden", true);
67588 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", true);
67589 if (!inspector.entityIDs() || !utilArrayIdentical(inspector.entityIDs(), [datum2.id]) || inspector.state() !== "hover") {
67590 inspector.state("hover").entityIDs([datum2.id]).newFeature(false);
67591 inspectorWrap.call(inspector);
67593 } else if (!_current) {
67594 featureListWrap.classed("inspector-hidden", false);
67595 inspectorWrap.classed("inspector-hidden", true);
67596 inspector.state("hide");
67597 } else if (_wasData || _wasNote || _wasQaItem) {
67600 _wasQaItem = false;
67601 context.container().selectAll(".note").classed("hover", false);
67602 context.container().selectAll(".qaItem").classed("hover", false);
67606 sidebar.hover = throttle_default(hover, 200);
67607 sidebar.intersects = function(extent) {
67608 var rect = selection2.node().getBoundingClientRect();
67609 return extent.intersects([
67610 context.projection.invert([0, rect.height]),
67611 context.projection.invert([rect.width, 0])
67614 sidebar.select = function(ids, newFeature) {
67616 if (ids && ids.length) {
67617 var entity = ids.length === 1 && context.entity(ids[0]);
67618 if (entity && newFeature && selection2.classed("collapsed")) {
67619 var extent = entity.extent(context.graph());
67620 sidebar.expand(sidebar.intersects(extent));
67622 featureListWrap.classed("inspector-hidden", true);
67623 inspectorWrap.classed("inspector-hidden", false).classed("inspector-hover", false);
67624 inspector.state("select").entityIDs(ids).newFeature(newFeature);
67625 inspectorWrap.call(inspector);
67627 inspector.state("hide");
67630 sidebar.showPresetList = function() {
67631 inspector.showList();
67633 sidebar.show = function(component, element) {
67634 featureListWrap.classed("inspector-hidden", true);
67635 inspectorWrap.classed("inspector-hidden", true);
67636 if (_current) _current.remove();
67637 _current = selection2.append("div").attr("class", "sidebar-component").call(component, element);
67639 sidebar.hide = function() {
67640 featureListWrap.classed("inspector-hidden", false);
67641 inspectorWrap.classed("inspector-hidden", true);
67642 if (_current) _current.remove();
67645 sidebar.expand = function(moveMap) {
67646 if (selection2.classed("collapsed")) {
67647 sidebar.toggle(moveMap);
67650 sidebar.collapse = function(moveMap) {
67651 if (!selection2.classed("collapsed")) {
67652 sidebar.toggle(moveMap);
67655 sidebar.toggle = function(moveMap) {
67656 if (context.inIntro()) return;
67657 var isCollapsed = selection2.classed("collapsed");
67658 var isCollapsing = !isCollapsed;
67659 var isRTL = _mainLocalizer.textDirection() === "rtl";
67660 var scaleX = isRTL ? 0 : 1;
67661 var xMarginProperty = isRTL ? "margin-right" : "margin-left";
67662 sidebarWidth = selection2.node().getBoundingClientRect().width;
67663 selection2.style("width", sidebarWidth + "px");
67664 var startMargin, endMargin, lastMargin;
67665 if (isCollapsing) {
67666 startMargin = lastMargin = 0;
67667 endMargin = -sidebarWidth;
67669 startMargin = lastMargin = -sidebarWidth;
67672 if (!isCollapsing) {
67673 selection2.classed("collapsed", isCollapsing);
67675 selection2.transition().style(xMarginProperty, endMargin + "px").tween("panner", function() {
67676 var i3 = number_default(startMargin, endMargin);
67677 return function(t2) {
67678 var dx = lastMargin - Math.round(i3(t2));
67679 lastMargin = lastMargin - dx;
67680 context.ui().onResize(moveMap ? void 0 : [dx * scaleX, 0]);
67682 }).on("end", function() {
67683 if (isCollapsing) {
67684 selection2.classed("collapsed", isCollapsing);
67686 if (!isCollapsing) {
67687 var containerWidth2 = container.node().getBoundingClientRect().width;
67688 var widthPct = sidebarWidth / containerWidth2 * 100;
67689 selection2.style(xMarginProperty, null).style("width", widthPct + "%");
67693 resizer.on("dblclick", function(d3_event) {
67694 d3_event.preventDefault();
67695 if (d3_event.sourceEvent) {
67696 d3_event.sourceEvent.preventDefault();
67700 context.map().on("crossEditableZoom.sidebar", function(within) {
67701 if (!within && !selection2.select(".inspector-hover").empty()) {
67706 sidebar.showPresetList = function() {
67708 sidebar.hover = function() {
67710 sidebar.hover.cancel = function() {
67712 sidebar.intersects = function() {
67714 sidebar.select = function() {
67716 sidebar.show = function() {
67718 sidebar.hide = function() {
67720 sidebar.expand = function() {
67722 sidebar.collapse = function() {
67724 sidebar.toggle = function() {
67729 // modules/ui/source_switch.js
67730 function uiSourceSwitch(context) {
67732 function click(d3_event) {
67733 d3_event.preventDefault();
67734 var osm = context.connection();
67736 if (context.inIntro()) return;
67737 if (context.history().hasChanges() && !window.confirm(_t("source_switch.lose_changes"))) return;
67738 var isLive = select_default2(this).classed("live");
67740 context.enter(modeBrowse(context));
67741 context.history().clearSaved();
67743 select_default2(this).html(isLive ? _t.html("source_switch.live") : _t.html("source_switch.dev")).classed("live", isLive).classed("chip", isLive);
67744 osm.switch(isLive ? keys2[0] : keys2[1]);
67746 var sourceSwitch = function(selection2) {
67747 selection2.append("a").attr("href", "#").call(_t.append("source_switch.live")).attr("class", "live chip").on("click", click);
67749 sourceSwitch.keys = function(_2) {
67750 if (!arguments.length) return keys2;
67752 return sourceSwitch;
67754 return sourceSwitch;
67757 // modules/ui/spinner.js
67758 function uiSpinner(context) {
67759 var osm = context.connection();
67760 return function(selection2) {
67761 var img = selection2.append("img").attr("src", context.imagePath("loader-black.gif")).style("opacity", 0);
67763 osm.on("loading.spinner", function() {
67764 img.transition().style("opacity", 1);
67765 }).on("loaded.spinner", function() {
67766 img.transition().style("opacity", 0);
67772 // modules/ui/sections/privacy.js
67773 function uiSectionPrivacy(context) {
67774 let section = uiSection("preferences-third-party", context).label(() => _t.append("preferences.privacy.title")).disclosureContent(renderDisclosureContent);
67775 function renderDisclosureContent(selection2) {
67776 selection2.selectAll(".privacy-options-list").data([0]).enter().append("ul").attr("class", "layer-list privacy-options-list");
67777 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(
67778 uiTooltip().title(() => _t.append("preferences.privacy.third_party_icons.tooltip")).placement("bottom")
67780 thirdPartyIconsEnter.append("input").attr("type", "checkbox").on("change", (d3_event, d2) => {
67781 d3_event.preventDefault();
67782 corePreferences("preferences.privacy.thirdpartyicons", d2 === "true" ? "false" : "true");
67784 thirdPartyIconsEnter.append("span").call(_t.append("preferences.privacy.third_party_icons.description"));
67785 selection2.selectAll(".privacy-third-party-icons-item").classed("active", (d2) => d2 === "true").select("input").property("checked", (d2) => d2 === "true");
67786 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"));
67788 corePreferences.onChange("preferences.privacy.thirdpartyicons", section.reRender);
67792 // modules/ui/splash.js
67793 function uiSplash(context) {
67794 return (selection2) => {
67795 if (context.history().hasRestorableChanges()) return;
67796 let updateMessage = "";
67797 const sawPrivacyVersion = corePreferences("sawPrivacyVersion");
67798 let showSplash = !corePreferences("sawSplash");
67799 if (sawPrivacyVersion !== context.privacyVersion) {
67800 updateMessage = _t("splash.privacy_update");
67803 if (!showSplash) return;
67804 corePreferences("sawSplash", true);
67805 corePreferences("sawPrivacyVersion", context.privacyVersion);
67806 _mainFileFetcher.get("intro_graph");
67807 let modalSelection = uiModal(selection2);
67808 modalSelection.select(".modal").attr("class", "modal-splash modal");
67809 let introModal = modalSelection.select(".content").append("div").attr("class", "fillL");
67810 introModal.append("div").attr("class", "modal-section").append("h3").call(_t.append("splash.welcome"));
67811 let modalSection = introModal.append("div").attr("class", "modal-section");
67812 modalSection.append("p").html(_t.html("splash.text", {
67813 version: context.version,
67814 website: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/develop/CHANGELOG.md#whats-new">' + _t.html("splash.changelog") + "</a>" },
67815 github: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/issues">github.com</a>' }
67817 modalSection.append("p").html(_t.html("splash.privacy", {
67819 privacyLink: { html: '<a target="_blank" href="https://github.com/openstreetmap/iD/blob/release/PRIVACY.md">' + _t("splash.privacy_policy") + "</a>" }
67821 uiSectionPrivacy(context).label(() => _t.append("splash.privacy_settings")).render(modalSection);
67822 let buttonWrap = introModal.append("div").attr("class", "modal-actions");
67823 let walkthrough = buttonWrap.append("button").attr("class", "walkthrough").on("click", () => {
67824 context.container().call(uiIntro(context));
67825 modalSelection.close();
67827 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
67828 walkthrough.append("div").call(_t.append("splash.walkthrough"));
67829 let startEditing = buttonWrap.append("button").attr("class", "start-editing").on("click", modalSelection.close);
67830 startEditing.append("svg").attr("class", "logo logo-features").append("use").attr("xlink:href", "#iD-logo-features");
67831 startEditing.append("div").call(_t.append("splash.start"));
67832 modalSelection.select("button.close").attr("class", "hide");
67836 // modules/ui/status.js
67837 function uiStatus(context) {
67838 var osm = context.connection();
67839 return function(selection2) {
67841 function update(err, apiStatus) {
67842 selection2.html("");
67844 if (apiStatus === "connectionSwitched") {
67846 } else if (apiStatus === "rateLimited") {
67847 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) {
67848 d3_event.preventDefault();
67849 osm.authenticate();
67852 var throttledRetry = throttle_default(function() {
67853 context.loadTiles(context.projection);
67854 osm.reloadApiStatus();
67856 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) {
67857 d3_event.preventDefault();
67861 } else if (apiStatus === "readonly") {
67862 selection2.call(_t.append("osm_api_status.message.readonly"));
67863 } else if (apiStatus === "offline") {
67864 selection2.call(_t.append("osm_api_status.message.offline"));
67866 selection2.attr("class", "api-status " + (err ? "error" : apiStatus));
67868 osm.on("apiStatusChange.uiStatus", update);
67869 context.history().on("storage_error", () => {
67870 selection2.selectAll("span.local-storage-full").remove();
67871 selection2.append("span").attr("class", "local-storage-full").call(_t.append("osm_api_status.message.local_storage_full"));
67872 selection2.classed("error", true);
67874 window.setInterval(function() {
67875 osm.reloadApiStatus();
67877 osm.reloadApiStatus();
67881 // modules/ui/tools/modes.js
67882 function uiToolDrawModes(context) {
67885 label: _t.append("toolbar.add_feature")
67888 modeAddPoint(context, {
67889 title: _t.append("modes.add_point.title"),
67891 description: _t.append("modes.add_point.description"),
67892 preset: _mainPresetIndex.item("point"),
67895 modeAddLine(context, {
67896 title: _t.append("modes.add_line.title"),
67898 description: _t.append("modes.add_line.description"),
67899 preset: _mainPresetIndex.item("line"),
67902 modeAddArea(context, {
67903 title: _t.append("modes.add_area.title"),
67905 description: _t.append("modes.add_area.description"),
67906 preset: _mainPresetIndex.item("area"),
67910 function enabled(_mode) {
67911 return osmEditable();
67913 function osmEditable() {
67914 return context.editable();
67916 modes.forEach(function(mode) {
67917 context.keybinding().on(mode.key, function() {
67918 if (!enabled(mode)) return;
67919 if (mode.id === context.mode().id) {
67920 context.enter(modeBrowse(context));
67922 context.enter(mode);
67926 tool.render = function(selection2) {
67927 var wrap2 = selection2.append("div").attr("class", "joined").style("display", "flex");
67928 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
67929 context.map().on("move.modes", debouncedUpdate).on("drawn.modes", debouncedUpdate);
67930 context.on("enter.modes", update);
67932 function update() {
67933 var buttons = wrap2.selectAll("button.add-button").data(modes, function(d2) {
67936 buttons.exit().remove();
67937 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
67938 return d2.id + " add-button bar-button";
67939 }).on("click.mode-buttons", function(d3_event, d2) {
67940 if (!enabled(d2)) return;
67941 var currMode = context.mode().id;
67942 if (/^draw/.test(currMode)) return;
67943 if (d2.id === currMode) {
67944 context.enter(modeBrowse(context));
67949 uiTooltip().placement("bottom").title(function(d2) {
67950 return d2.description;
67951 }).keys(function(d2) {
67953 }).scrollContainer(context.container().select(".top-toolbar"))
67955 buttonsEnter.each(function(d2) {
67956 select_default2(this).call(svgIcon("#iD-icon-" + d2.button));
67958 buttonsEnter.append("span").attr("class", "label").text("").each(function(mode) {
67959 mode.title(select_default2(this));
67961 if (buttons.enter().size() || buttons.exit().size()) {
67962 context.ui().checkOverflow(".top-toolbar", true);
67964 buttons = buttons.merge(buttonsEnter).attr("aria-disabled", function(d2) {
67965 return !enabled(d2);
67966 }).classed("disabled", function(d2) {
67967 return !enabled(d2);
67968 }).attr("aria-pressed", function(d2) {
67969 return context.mode() && context.mode().button === d2.button;
67970 }).classed("active", function(d2) {
67971 return context.mode() && context.mode().button === d2.button;
67978 // modules/ui/tools/notes.js
67979 function uiToolNotes(context) {
67982 label: _t.append("modes.add_note.label")
67984 var mode = modeAddNote(context);
67985 function enabled() {
67986 return notesEnabled() && notesEditable();
67988 function notesEnabled() {
67989 var noteLayer = context.layers().layer("notes");
67990 return noteLayer && noteLayer.enabled();
67992 function notesEditable() {
67993 var mode2 = context.mode();
67994 return context.map().notesEditable() && mode2 && mode2.id !== "save";
67996 context.keybinding().on(mode.key, function() {
67997 if (!enabled()) return;
67998 if (mode.id === context.mode().id) {
67999 context.enter(modeBrowse(context));
68001 context.enter(mode);
68004 tool.render = function(selection2) {
68005 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68006 context.map().on("move.notes", debouncedUpdate).on("drawn.notes", debouncedUpdate);
68007 context.on("enter.notes", update);
68009 function update() {
68010 var showNotes = notesEnabled();
68011 var data = showNotes ? [mode] : [];
68012 var buttons = selection2.selectAll("button.add-button").data(data, function(d2) {
68015 buttons.exit().remove();
68016 var buttonsEnter = buttons.enter().append("button").attr("class", function(d2) {
68017 return d2.id + " add-button bar-button";
68018 }).on("click.notes", function(d3_event, d2) {
68019 if (!enabled()) return;
68020 var currMode = context.mode().id;
68021 if (/^draw/.test(currMode)) return;
68022 if (d2.id === currMode) {
68023 context.enter(modeBrowse(context));
68028 uiTooltip().placement("bottom").title(function(d2) {
68029 return d2.description;
68030 }).keys(function(d2) {
68032 }).scrollContainer(context.container().select(".top-toolbar"))
68034 buttonsEnter.each(function(d2) {
68035 select_default2(this).call(svgIcon(d2.icon || "#iD-icon-" + d2.button));
68037 if (buttons.enter().size() || buttons.exit().size()) {
68038 context.ui().checkOverflow(".top-toolbar", true);
68040 buttons = buttons.merge(buttonsEnter).classed("disabled", function() {
68042 }).attr("aria-disabled", function() {
68044 }).classed("active", function(d2) {
68045 return context.mode() && context.mode().button === d2.button;
68046 }).attr("aria-pressed", function(d2) {
68047 return context.mode() && context.mode().button === d2.button;
68051 tool.uninstall = function() {
68052 context.on("enter.editor.notes", null).on("exit.editor.notes", null).on("enter.notes", null);
68053 context.map().on("move.notes", null).on("drawn.notes", null);
68058 // modules/ui/tools/save.js
68059 function uiToolSave(context) {
68062 label: _t.append("save.title")
68065 var tooltipBehavior = null;
68066 var history = context.history();
68067 var key = uiCmd("\u2318S");
68068 var _numChanges = 0;
68069 function isSaving() {
68070 var mode = context.mode();
68071 return mode && mode.id === "save";
68073 function isDisabled() {
68074 return _numChanges === 0 || isSaving();
68076 function save(d3_event) {
68077 d3_event.preventDefault();
68078 if (!context.inIntro() && !isSaving() && history.hasChanges()) {
68079 context.enter(modeSave(context));
68082 function bgColor(numChanges) {
68084 if (numChanges === 0) {
68086 } else if (numChanges <= 50) {
68087 step = numChanges / 50;
68088 return rgb_default("#fff", "#ff8")(step);
68090 step = Math.min((numChanges - 50) / 50, 1);
68091 return rgb_default("#ff8", "#f88")(step);
68094 function updateCount() {
68095 var val = history.difference().summary().length;
68096 if (val === _numChanges) return;
68098 if (tooltipBehavior) {
68099 tooltipBehavior.title(() => _t.append(_numChanges > 0 ? "save.help" : "save.no_changes")).keys([key]);
68102 button.classed("disabled", isDisabled()).style("background", bgColor(_numChanges));
68103 button.select("span.count").text(_numChanges);
68106 tool.render = function(selection2) {
68107 tooltipBehavior = uiTooltip().placement("bottom").title(() => _t.append("save.no_changes")).keys([key]).scrollContainer(context.container().select(".top-toolbar"));
68108 var lastPointerUpType;
68109 button = selection2.append("button").attr("class", "save disabled bar-button").on("pointerup", function(d3_event) {
68110 lastPointerUpType = d3_event.pointerType;
68111 }).on("click", function(d3_event) {
68113 if (_numChanges === 0 && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
68114 context.ui().flash.duration(2e3).iconName("#iD-icon-save").iconClass("disabled").label(_t.append("save.no_changes"))();
68116 lastPointerUpType = null;
68117 }).call(tooltipBehavior);
68118 button.call(svgIcon("#iD-icon-save"));
68119 button.append("span").attr("class", "count").attr("aria-hidden", "true").text("0");
68121 context.keybinding().on(key, save, true);
68122 context.history().on("change.save", updateCount);
68123 context.on("enter.save", function() {
68125 button.classed("disabled", isDisabled());
68127 button.call(tooltipBehavior.hide);
68132 tool.uninstall = function() {
68133 context.keybinding().off(key, true);
68134 context.history().on("change.save", null);
68135 context.on("enter.save", null);
68137 tooltipBehavior = null;
68142 // modules/ui/tools/sidebar_toggle.js
68143 function uiToolSidebarToggle(context) {
68145 id: "sidebar_toggle",
68146 label: _t.append("toolbar.inspect")
68148 tool.render = function(selection2) {
68149 selection2.append("button").attr("class", "bar-button").attr("aria-label", _t("sidebar.tooltip")).on("click", function() {
68150 context.ui().sidebar.toggle();
68152 uiTooltip().placement("bottom").title(() => _t.append("sidebar.tooltip")).keys([_t("sidebar.key")]).scrollContainer(context.container().select(".top-toolbar"))
68153 ).call(svgIcon("#iD-icon-sidebar-" + (_mainLocalizer.textDirection() === "rtl" ? "right" : "left")));
68158 // modules/ui/tools/undo_redo.js
68159 function uiToolUndoRedo(context) {
68162 label: _t.append("toolbar.undo_redo")
68166 cmd: uiCmd("\u2318Z"),
68167 action: function() {
68170 annotation: function() {
68171 return context.history().undoAnnotation();
68173 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")
68176 cmd: uiCmd("\u2318\u21E7Z"),
68177 action: function() {
68180 annotation: function() {
68181 return context.history().redoAnnotation();
68183 icon: "iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "undo" : "redo")
68185 function editable() {
68186 return context.mode() && context.mode().id !== "save" && context.map().editableDataEnabled(
68188 /* ignore min zoom */
68191 tool.render = function(selection2) {
68192 var tooltipBehavior = uiTooltip().placement("bottom").title(function(d2) {
68193 return d2.annotation() ? _t.append(d2.id + ".tooltip", { action: d2.annotation() }) : _t.append(d2.id + ".nothing");
68194 }).keys(function(d2) {
68196 }).scrollContainer(context.container().select(".top-toolbar"));
68197 var lastPointerUpType;
68198 var buttons = selection2.selectAll("button").data(commands).enter().append("button").attr("class", function(d2) {
68199 return "disabled " + d2.id + "-button bar-button";
68200 }).on("pointerup", function(d3_event) {
68201 lastPointerUpType = d3_event.pointerType;
68202 }).on("click", function(d3_event, d2) {
68203 d3_event.preventDefault();
68204 var annotation = d2.annotation();
68205 if (editable() && annotation) {
68208 if (editable() && (lastPointerUpType === "touch" || lastPointerUpType === "pen")) {
68209 var label = annotation ? _t.append(d2.id + ".tooltip", { action: annotation }) : _t.append(d2.id + ".nothing");
68210 context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass(annotation ? "" : "disabled").label(label)();
68212 lastPointerUpType = null;
68213 }).call(tooltipBehavior);
68214 buttons.each(function(d2) {
68215 select_default2(this).call(svgIcon("#" + d2.icon));
68217 context.keybinding().on(commands[0].cmd, function(d3_event) {
68218 d3_event.preventDefault();
68219 if (editable()) commands[0].action();
68220 }).on(commands[1].cmd, function(d3_event) {
68221 d3_event.preventDefault();
68222 if (editable()) commands[1].action();
68224 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68225 context.map().on("move.undo_redo", debouncedUpdate).on("drawn.undo_redo", debouncedUpdate);
68226 context.history().on("change.undo_redo", function(difference2) {
68227 if (difference2) update();
68229 context.on("enter.undo_redo", update);
68230 function update() {
68231 buttons.classed("disabled", function(d2) {
68232 return !editable() || !d2.annotation();
68233 }).each(function() {
68234 var selection3 = select_default2(this);
68235 if (!selection3.select(".tooltip.in").empty()) {
68236 selection3.call(tooltipBehavior.updateContent);
68241 tool.uninstall = function() {
68242 context.keybinding().off(commands[0].cmd).off(commands[1].cmd);
68243 context.map().on("move.undo_redo", null).on("drawn.undo_redo", null);
68244 context.history().on("change.undo_redo", null);
68245 context.on("enter.undo_redo", null);
68250 // modules/ui/top_toolbar.js
68251 function uiTopToolbar(context) {
68252 var sidebarToggle = uiToolSidebarToggle(context), modes = uiToolDrawModes(context), notes = uiToolNotes(context), undoRedo = uiToolUndoRedo(context), save = uiToolSave(context);
68253 function notesEnabled() {
68254 var noteLayer = context.layers().layer("notes");
68255 return noteLayer && noteLayer.enabled();
68257 function topToolbar(bar) {
68258 bar.on("wheel.topToolbar", function(d3_event) {
68259 if (!d3_event.deltaX) {
68260 bar.node().scrollLeft += d3_event.deltaY;
68263 var debouncedUpdate = debounce_default(update, 500, { leading: true, trailing: true });
68264 context.layers().on("change.topToolbar", debouncedUpdate);
68266 function update() {
68272 tools.push("spacer");
68273 if (notesEnabled()) {
68274 tools = tools.concat([notes, "spacer"]);
68276 tools = tools.concat([undoRedo, save]);
68277 var toolbarItems = bar.selectAll(".toolbar-item").data(tools, function(d2) {
68278 return d2.id || d2;
68280 toolbarItems.exit().each(function(d2) {
68281 if (d2.uninstall) {
68285 var itemsEnter = toolbarItems.enter().append("div").attr("class", function(d2) {
68286 var classes = "toolbar-item " + (d2.id || d2).replace("_", "-");
68287 if (d2.klass) classes += " " + d2.klass;
68290 var actionableItems = itemsEnter.filter(function(d2) {
68291 return d2 !== "spacer";
68293 actionableItems.append("div").attr("class", "item-content").each(function(d2) {
68294 select_default2(this).call(d2.render, bar);
68296 actionableItems.append("div").attr("class", "item-label").each(function(d2) {
68297 d2.label(select_default2(this));
68304 // modules/ui/version.js
68305 var sawVersion = null;
68306 var isNewVersion = false;
68307 var isNewUser = false;
68308 function uiVersion(context) {
68309 var currVersion = context.version;
68310 var matchedVersion = currVersion.match(/\d+\.\d+\.\d+.*/);
68311 if (sawVersion === null && matchedVersion !== null) {
68312 if (corePreferences("sawVersion")) {
68314 isNewVersion = corePreferences("sawVersion") !== currVersion && currVersion.indexOf("-") === -1;
68317 isNewVersion = true;
68319 corePreferences("sawVersion", currVersion);
68320 sawVersion = currVersion;
68322 return function(selection2) {
68323 selection2.append("a").attr("target", "_blank").attr("href", "https://github.com/openstreetmap/iD").text(currVersion);
68324 if (isNewVersion && !isNewUser) {
68325 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(
68326 uiTooltip().title(() => _t.append("version.whats_new", { version: currVersion })).placement("top").scrollContainer(context.container().select(".main-footer-wrap"))
68332 // modules/ui/zoom.js
68333 function uiZoom(context) {
68336 icon: "iD-icon-plus",
68337 title: _t.append("zoom.in"),
68339 disabled: function() {
68340 return !context.map().canZoomIn();
68342 disabledTitle: _t.append("zoom.disabled.in"),
68346 icon: "iD-icon-minus",
68347 title: _t.append("zoom.out"),
68349 disabled: function() {
68350 return !context.map().canZoomOut();
68352 disabledTitle: _t.append("zoom.disabled.out"),
68355 function zoomIn(d3_event) {
68356 if (d3_event.shiftKey) return;
68357 d3_event.preventDefault();
68358 context.map().zoomIn();
68360 function zoomOut(d3_event) {
68361 if (d3_event.shiftKey) return;
68362 d3_event.preventDefault();
68363 context.map().zoomOut();
68365 function zoomInFurther(d3_event) {
68366 if (d3_event.shiftKey) return;
68367 d3_event.preventDefault();
68368 context.map().zoomInFurther();
68370 function zoomOutFurther(d3_event) {
68371 if (d3_event.shiftKey) return;
68372 d3_event.preventDefault();
68373 context.map().zoomOutFurther();
68375 return function(selection2) {
68376 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function(d2) {
68377 if (d2.disabled()) {
68378 return d2.disabledTitle;
68381 }).keys(function(d2) {
68384 var lastPointerUpType;
68385 var buttons = selection2.selectAll("button").data(zooms).enter().append("button").attr("class", function(d2) {
68387 }).on("pointerup.editor", function(d3_event) {
68388 lastPointerUpType = d3_event.pointerType;
68389 }).on("click.editor", function(d3_event, d2) {
68390 if (!d2.disabled()) {
68391 d2.action(d3_event);
68392 } else if (lastPointerUpType === "touch" || lastPointerUpType === "pen") {
68393 context.ui().flash.duration(2e3).iconName("#" + d2.icon).iconClass("disabled").label(d2.disabledTitle)();
68395 lastPointerUpType = null;
68396 }).call(tooltipBehavior);
68397 buttons.each(function(d2) {
68398 select_default2(this).call(svgIcon("#" + d2.icon, "light"));
68400 utilKeybinding.plusKeys.forEach(function(key) {
68401 context.keybinding().on([key], zoomIn);
68402 context.keybinding().on([uiCmd("\u2325" + key)], zoomInFurther);
68404 utilKeybinding.minusKeys.forEach(function(key) {
68405 context.keybinding().on([key], zoomOut);
68406 context.keybinding().on([uiCmd("\u2325" + key)], zoomOutFurther);
68408 function updateButtonStates() {
68409 buttons.classed("disabled", function(d2) {
68410 return d2.disabled();
68411 }).each(function() {
68412 var selection3 = select_default2(this);
68413 if (!selection3.select(".tooltip.in").empty()) {
68414 selection3.call(tooltipBehavior.updateContent);
68418 updateButtonStates();
68419 context.map().on("move.uiZoom", updateButtonStates);
68423 // modules/ui/zoom_to_selection.js
68424 function uiZoomToSelection(context) {
68425 function isDisabled() {
68426 var mode = context.mode();
68427 return !mode || !mode.zoomToSelected;
68429 var _lastPointerUpType;
68430 function pointerup(d3_event) {
68431 _lastPointerUpType = d3_event.pointerType;
68433 function click(d3_event) {
68434 d3_event.preventDefault();
68435 if (isDisabled()) {
68436 if (_lastPointerUpType === "touch" || _lastPointerUpType === "pen") {
68437 context.ui().flash.duration(2e3).iconName("#iD-icon-framed-dot").iconClass("disabled").label(_t.append("inspector.zoom_to.no_selection"))();
68440 var mode = context.mode();
68441 if (mode && mode.zoomToSelected) {
68442 mode.zoomToSelected();
68445 _lastPointerUpType = null;
68447 return function(selection2) {
68448 var tooltipBehavior = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(function() {
68449 if (isDisabled()) {
68450 return _t.append("inspector.zoom_to.no_selection");
68452 return _t.append("inspector.zoom_to.title");
68453 }).keys([_t("inspector.zoom_to.key")]);
68454 var button = selection2.append("button").on("pointerup", pointerup).on("click", click).call(svgIcon("#iD-icon-framed-dot", "light")).call(tooltipBehavior);
68455 function setEnabledState() {
68456 button.classed("disabled", isDisabled());
68457 if (!button.select(".tooltip.in").empty()) {
68458 button.call(tooltipBehavior.updateContent);
68461 context.on("enter.uiZoomToSelection", setEnabledState);
68466 // modules/ui/pane.js
68467 function uiPane(id2, context) {
68470 var _description = "";
68471 var _iconName = "";
68473 var _paneSelection = select_default2(null);
68478 pane.label = function(val) {
68479 if (!arguments.length) return _label;
68483 pane.key = function(val) {
68484 if (!arguments.length) return _key;
68488 pane.description = function(val) {
68489 if (!arguments.length) return _description;
68490 _description = val;
68493 pane.iconName = function(val) {
68494 if (!arguments.length) return _iconName;
68498 pane.sections = function(val) {
68499 if (!arguments.length) return _sections;
68503 pane.selection = function() {
68504 return _paneSelection;
68506 function hidePane() {
68507 context.ui().togglePanes();
68509 pane.togglePane = function(d3_event) {
68510 if (d3_event) d3_event.preventDefault();
68511 _paneTooltip.hide();
68512 context.ui().togglePanes(!_paneSelection.classed("shown") ? _paneSelection : void 0);
68514 pane.renderToggleButton = function(selection2) {
68515 if (!_paneTooltip) {
68516 _paneTooltip = uiTooltip().placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left").title(() => _description).keys([_key]);
68518 selection2.append("button").on("click", pane.togglePane).call(svgIcon("#" + _iconName, "light")).call(_paneTooltip);
68520 pane.renderContent = function(selection2) {
68522 _sections.forEach(function(section) {
68523 selection2.call(section.render);
68527 pane.renderPane = function(selection2) {
68528 _paneSelection = selection2.append("div").attr("class", "fillL map-pane hide " + id2 + "-pane").attr("pane", id2);
68529 var heading2 = _paneSelection.append("div").attr("class", "pane-heading");
68530 heading2.append("h2").text("").call(_label);
68531 heading2.append("button").attr("title", _t("icons.close")).on("click", hidePane).call(svgIcon("#iD-icon-close"));
68532 _paneSelection.append("div").attr("class", "pane-content").call(pane.renderContent);
68534 context.keybinding().on(_key, pane.togglePane);
68540 // modules/ui/sections/background_display_options.js
68541 function uiSectionBackgroundDisplayOptions(context) {
68542 var section = uiSection("background-display-options", context).label(() => _t.append("background.display_options")).disclosureContent(renderDisclosureContent);
68543 var _storedOpacity = corePreferences("background-opacity");
68546 var _sliders = ["brightness", "contrast", "saturation", "sharpness"];
68548 brightness: _storedOpacity !== null ? +_storedOpacity : 1,
68553 function clamp3(x2, min3, max3) {
68554 return Math.max(min3, Math.min(x2, max3));
68556 function updateValue(d2, val) {
68557 val = clamp3(val, _minVal, _maxVal);
68558 _options[d2] = val;
68559 context.background()[d2](val);
68560 if (d2 === "brightness") {
68561 corePreferences("background-opacity", val);
68563 section.reRender();
68565 function renderDisclosureContent(selection2) {
68566 var container = selection2.selectAll(".display-options-container").data([0]);
68567 var containerEnter = container.enter().append("div").attr("class", "display-options-container controls-list");
68568 var slidersEnter = containerEnter.selectAll(".display-control").data(_sliders).enter().append("label").attr("class", function(d2) {
68569 return "display-control display-control-" + d2;
68571 slidersEnter.html(function(d2) {
68572 return _t.html("background." + d2);
68573 }).append("span").attr("class", function(d2) {
68574 return "display-option-value display-option-value-" + d2;
68576 var sildersControlEnter = slidersEnter.append("div").attr("class", "control-wrap");
68577 sildersControlEnter.append("input").attr("class", function(d2) {
68578 return "display-option-input display-option-input-" + d2;
68579 }).attr("type", "range").attr("min", _minVal).attr("max", _maxVal).attr("step", "0.05").on("input", function(d3_event, d2) {
68580 var val = select_default2(this).property("value");
68581 if (!val && d3_event && d3_event.target) {
68582 val = d3_event.target.value;
68584 updateValue(d2, val);
68586 sildersControlEnter.append("button").attr("title", function(d2) {
68587 return "".concat(_t("background.reset"), " ").concat(_t("background." + d2));
68588 }).attr("class", function(d2) {
68589 return "display-option-reset display-option-reset-" + d2;
68590 }).on("click", function(d3_event, d2) {
68591 if (d3_event.button !== 0) return;
68592 updateValue(d2, 1);
68593 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
68594 containerEnter.append("a").attr("class", "display-option-resetlink").attr("role", "button").attr("href", "#").call(_t.append("background.reset_all")).on("click", function(d3_event) {
68595 d3_event.preventDefault();
68596 for (var i3 = 0; i3 < _sliders.length; i3++) {
68597 updateValue(_sliders[i3], 1);
68600 container = containerEnter.merge(container);
68601 container.selectAll(".display-option-input").property("value", function(d2) {
68602 return _options[d2];
68604 container.selectAll(".display-option-value").text(function(d2) {
68605 return Math.floor(_options[d2] * 100) + "%";
68607 container.selectAll(".display-option-reset").classed("disabled", function(d2) {
68608 return _options[d2] === 1;
68610 if (containerEnter.size() && _options.brightness !== 1) {
68611 context.background().brightness(_options.brightness);
68617 // modules/ui/settings/custom_background.js
68618 function uiSettingsCustomBackground() {
68619 var dispatch14 = dispatch_default("change");
68620 function render(selection2) {
68621 var _origSettings = {
68622 template: corePreferences("background-custom-template")
68624 var _currSettings = {
68625 template: corePreferences("background-custom-template")
68627 var example = "https://tile.openstreetmap.org/{zoom}/{x}/{y}.png";
68628 var modal = uiConfirm(selection2).okButton();
68629 modal.classed("settings-modal settings-custom-background", true);
68630 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_background.header"));
68631 var textSection = modal.select(".modal-section.message-text");
68632 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, "`");
68633 textSection.append("div").attr("class", "instructions-template").html(marked(instructions));
68634 textSection.append("textarea").attr("class", "field-template").attr("placeholder", _t("settings.custom_background.template.placeholder")).call(utilNoAuto).property("value", _currSettings.template);
68635 var buttonSection = modal.select(".modal-section.buttons");
68636 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
68637 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
68638 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
68639 function isSaveDisabled() {
68642 function clickCancel() {
68643 textSection.select(".field-template").property("value", _origSettings.template);
68644 corePreferences("background-custom-template", _origSettings.template);
68648 function clickSave() {
68649 _currSettings.template = textSection.select(".field-template").property("value");
68650 corePreferences("background-custom-template", _currSettings.template);
68653 dispatch14.call("change", this, _currSettings);
68656 return utilRebind(render, dispatch14, "on");
68659 // modules/ui/sections/background_list.js
68660 function uiSectionBackgroundList(context) {
68661 var _backgroundList = select_default2(null);
68662 var _customSource = context.background().findSource("custom");
68663 var _settingsCustomBackground = uiSettingsCustomBackground(context).on("change", customChanged);
68664 var section = uiSection("background-list", context).label(() => _t.append("background.backgrounds")).disclosureContent(renderDisclosureContent);
68665 function previousBackgroundID() {
68666 return corePreferences("background-last-used-toggle");
68668 function renderDisclosureContent(selection2) {
68669 var container = selection2.selectAll(".layer-background-list").data([0]);
68670 _backgroundList = container.enter().append("ul").attr("class", "layer-list layer-background-list").attr("dir", "auto").merge(container);
68671 var bgExtrasListEnter = selection2.selectAll(".bg-extras-list").data([0]).enter().append("ul").attr("class", "layer-list bg-extras-list");
68672 var minimapLabelEnter = bgExtrasListEnter.append("li").attr("class", "minimap-toggle-item").append("label").call(
68673 uiTooltip().title(() => _t.append("background.minimap.tooltip")).keys([_t("background.minimap.key")]).placement("top")
68675 minimapLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68676 d3_event.preventDefault();
68677 uiMapInMap.toggle();
68679 minimapLabelEnter.append("span").call(_t.append("background.minimap.description"));
68680 var panelLabelEnter = bgExtrasListEnter.append("li").attr("class", "background-panel-toggle-item").append("label").call(
68681 uiTooltip().title(() => _t.append("background.panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.background.key"))]).placement("top")
68683 panelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68684 d3_event.preventDefault();
68685 context.ui().info.toggle("background");
68687 panelLabelEnter.append("span").call(_t.append("background.panel.description"));
68688 var locPanelLabelEnter = bgExtrasListEnter.append("li").attr("class", "location-panel-toggle-item").append("label").call(
68689 uiTooltip().title(() => _t.append("background.location_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.location.key"))]).placement("top")
68691 locPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
68692 d3_event.preventDefault();
68693 context.ui().info.toggle("location");
68695 locPanelLabelEnter.append("span").call(_t.append("background.location_panel.description"));
68696 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"));
68697 _backgroundList.call(drawListItems, "radio", function(d3_event, d2) {
68698 chooseBackground(d2);
68700 return !d2.isHidden() && !d2.overlay;
68703 function setTooltips(selection2) {
68704 selection2.each(function(d2, i3, nodes) {
68705 var item = select_default2(this).select("label");
68706 var span = item.select("span");
68707 var placement = i3 < nodes.length / 2 ? "bottom" : "top";
68708 var hasDescription = d2.hasDescription();
68709 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68710 item.call(uiTooltip().destroyAny);
68711 if (d2.id === previousBackgroundID()) {
68713 uiTooltip().placement(placement).title(() => _t.append("background.switch")).keys([uiCmd("\u2318" + _t("background.key"))])
68715 } else if (hasDescription || isOverflowing) {
68717 uiTooltip().placement(placement).title(() => hasDescription ? d2.description() : d2.label())
68722 function drawListItems(layerList, type2, change, filter2) {
68723 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2).sort(function(a2, b2) {
68724 return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
68726 var layerLinks = layerList.selectAll("li").data(sources, function(d2, i3) {
68727 return d2.id + "---" + i3;
68729 layerLinks.exit().remove();
68730 var enter = layerLinks.enter().append("li").classed("layer-custom", function(d2) {
68731 return d2.id === "custom";
68732 }).classed("best", function(d2) {
68735 var label = enter.append("label");
68736 label.append("input").attr("type", type2).attr("name", "background-layer").attr("value", function(d2) {
68738 }).on("change", change);
68739 label.append("span").each(function(d2) {
68740 d2.label()(select_default2(this));
68742 enter.filter(function(d2) {
68743 return d2.id === "custom";
68744 }).append("button").attr("class", "layer-browse").call(
68745 uiTooltip().title(() => _t.append("settings.custom_background.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68746 ).on("click", function(d3_event) {
68747 d3_event.preventDefault();
68749 }).call(svgIcon("#iD-icon-more"));
68750 enter.filter(function(d2) {
68752 }).append("div").attr("class", "best").call(
68753 uiTooltip().title(() => _t.append("background.best_imagery")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
68754 ).append("span").text("\u2605");
68755 layerList.call(updateLayerSelections);
68757 function updateLayerSelections(selection2) {
68758 function active(d2) {
68759 return context.background().showsLayer(d2);
68761 selection2.selectAll("li").classed("active", active).classed("switch", function(d2) {
68762 return d2.id === previousBackgroundID();
68763 }).call(setTooltips).selectAll("input").property("checked", active);
68765 function chooseBackground(d2) {
68766 if (d2.id === "custom" && !d2.template()) {
68767 return editCustom();
68769 var previousBackground = context.background().baseLayerSource();
68770 corePreferences("background-last-used-toggle", previousBackground.id);
68771 corePreferences("background-last-used", d2.id);
68772 context.background().baseLayerSource(d2);
68774 function customChanged(d2) {
68775 if (d2 && d2.template) {
68776 _customSource.template(d2.template);
68777 chooseBackground(_customSource);
68779 _customSource.template("");
68780 chooseBackground(context.background().findSource("none"));
68783 function editCustom() {
68784 context.container().call(_settingsCustomBackground);
68786 context.background().on("change.background_list", function() {
68787 _backgroundList.call(updateLayerSelections);
68790 "move.background_list",
68791 debounce_default(function() {
68792 window.requestIdleCallback(section.reRender);
68798 // modules/ui/sections/background_offset.js
68799 function uiSectionBackgroundOffset(context) {
68800 var section = uiSection("background-offset", context).label(() => _t.append("background.fix_misalignment")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
68801 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
68802 var _directions = [
68803 ["top", [0, -0.5]],
68804 ["left", [-0.5, 0]],
68805 ["right", [0.5, 0]],
68806 ["bottom", [0, 0.5]]
68808 function updateValue() {
68809 var meters = geoOffsetToMeters(context.background().offset());
68810 var x2 = +meters[0].toFixed(2);
68811 var y2 = +meters[1].toFixed(2);
68812 context.container().selectAll(".nudge-inner-rect").select("input").classed("error", false).property("value", x2 + ", " + y2);
68813 context.container().selectAll(".nudge-reset").classed("disabled", function() {
68814 return x2 === 0 && y2 === 0;
68817 function resetOffset() {
68818 context.background().offset([0, 0]);
68821 function nudge(d2) {
68822 context.background().nudge(d2, context.map().zoom());
68825 function inputOffset() {
68826 var input = select_default2(this);
68827 var d2 = input.node().value;
68828 if (d2 === "") return resetOffset();
68829 d2 = d2.replace(/;/g, ",").split(",").map(function(n3) {
68830 return !isNaN(n3) && n3;
68832 if (d2.length !== 2 || !d2[0] || !d2[1]) {
68833 input.classed("error", true);
68836 context.background().offset(geoMetersToOffset(d2));
68839 function dragOffset(d3_event) {
68840 if (d3_event.button !== 0) return;
68841 var origin = [d3_event.clientX, d3_event.clientY];
68842 var pointerId = d3_event.pointerId || "mouse";
68843 context.container().append("div").attr("class", "nudge-surface");
68844 select_default2(window).on(_pointerPrefix + "move.drag-bg-offset", pointermove).on(_pointerPrefix + "up.drag-bg-offset", pointerup);
68845 if (_pointerPrefix === "pointer") {
68846 select_default2(window).on("pointercancel.drag-bg-offset", pointerup);
68848 function pointermove(d3_event2) {
68849 if (pointerId !== (d3_event2.pointerId || "mouse")) return;
68850 var latest = [d3_event2.clientX, d3_event2.clientY];
68852 -(origin[0] - latest[0]) / 4,
68853 -(origin[1] - latest[1]) / 4
68858 function pointerup(d3_event2) {
68859 if (pointerId !== (d3_event2.pointerId || "mouse")) return;
68860 if (d3_event2.button !== 0) return;
68861 context.container().selectAll(".nudge-surface").remove();
68862 select_default2(window).on(".drag-bg-offset", null);
68865 function renderDisclosureContent(selection2) {
68866 var container = selection2.selectAll(".nudge-container").data([0]);
68867 var containerEnter = container.enter().append("div").attr("class", "nudge-container");
68868 containerEnter.append("div").attr("class", "nudge-instructions").call(_t.append("background.offset"));
68869 var nudgeWrapEnter = containerEnter.append("div").attr("class", "nudge-controls-wrap");
68870 var nudgeEnter = nudgeWrapEnter.append("div").attr("class", "nudge-outer-rect").on(_pointerPrefix + "down", dragOffset);
68871 nudgeEnter.append("div").attr("class", "nudge-inner-rect").append("input").attr("type", "text").attr("aria-label", _t("background.offset_label")).on("change", inputOffset);
68872 nudgeWrapEnter.append("div").selectAll("button").data(_directions).enter().append("button").attr("title", function(d2) {
68873 return _t("background.nudge.".concat(d2[0]));
68874 }).attr("class", function(d2) {
68875 return d2[0] + " nudge";
68876 }).on("click", function(d3_event, d2) {
68879 nudgeWrapEnter.append("button").attr("title", _t("background.reset")).attr("class", "nudge-reset disabled").on("click", function(d3_event) {
68880 d3_event.preventDefault();
68882 }).call(svgIcon("#iD-icon-" + (_mainLocalizer.textDirection() === "rtl" ? "redo" : "undo")));
68885 context.background().on("change.backgroundOffset-update", updateValue);
68889 // modules/ui/sections/overlay_list.js
68890 function uiSectionOverlayList(context) {
68891 var section = uiSection("overlay-list", context).label(() => _t.append("background.overlays")).disclosureContent(renderDisclosureContent);
68892 var _overlayList = select_default2(null);
68893 function setTooltips(selection2) {
68894 selection2.each(function(d2, i3, nodes) {
68895 var item = select_default2(this).select("label");
68896 var span = item.select("span");
68897 var placement = i3 < nodes.length / 2 ? "bottom" : "top";
68898 var description = d2.description();
68899 var isOverflowing = span.property("clientWidth") !== span.property("scrollWidth");
68900 item.call(uiTooltip().destroyAny);
68901 if (description || isOverflowing) {
68903 uiTooltip().placement(placement).title(() => description || d2.name())
68908 function updateLayerSelections(selection2) {
68909 function active(d2) {
68910 return context.background().showsLayer(d2);
68912 selection2.selectAll("li").classed("active", active).call(setTooltips).selectAll("input").property("checked", active);
68914 function chooseOverlay(d3_event, d2) {
68915 d3_event.preventDefault();
68916 context.background().toggleOverlayLayer(d2);
68917 _overlayList.call(updateLayerSelections);
68918 document.activeElement.blur();
68920 function drawListItems(layerList, type2, change, filter2) {
68921 var sources = context.background().sources(context.map().extent(), context.map().zoom(), true).filter(filter2);
68922 var layerLinks = layerList.selectAll("li").data(sources, function(d2) {
68925 layerLinks.exit().remove();
68926 var enter = layerLinks.enter().append("li");
68927 var label = enter.append("label");
68928 label.append("input").attr("type", type2).attr("name", "layers").on("change", change);
68929 label.append("span").each(function(d2) {
68930 d2.label()(select_default2(this));
68932 layerList.selectAll("li").sort(sortSources);
68933 layerList.call(updateLayerSelections);
68934 function sortSources(a2, b2) {
68935 return a2.best() && !b2.best() ? -1 : b2.best() && !a2.best() ? 1 : descending(a2.area(), b2.area()) || ascending(a2.name(), b2.name()) || 0;
68938 function renderDisclosureContent(selection2) {
68939 var container = selection2.selectAll(".layer-overlay-list").data([0]);
68940 _overlayList = container.enter().append("ul").attr("class", "layer-list layer-overlay-list").attr("dir", "auto").merge(container);
68941 _overlayList.call(drawListItems, "checkbox", chooseOverlay, function(d2) {
68942 return !d2.isHidden() && d2.overlay;
68946 "move.overlay_list",
68947 debounce_default(function() {
68948 window.requestIdleCallback(section.reRender);
68954 // modules/ui/panes/background.js
68955 function uiPaneBackground(context) {
68956 var backgroundPane = uiPane("background", context).key(_t("background.key")).label(_t.append("background.title")).description(_t.append("background.description")).iconName("iD-icon-layers").sections([
68957 uiSectionBackgroundList(context),
68958 uiSectionOverlayList(context),
68959 uiSectionBackgroundDisplayOptions(context),
68960 uiSectionBackgroundOffset(context)
68962 return backgroundPane;
68965 // modules/ui/panes/help.js
68966 function uiPaneHelp(context) {
68976 "open_source_attribution",
68989 "select_left_click",
68990 "select_right_click",
68994 "multiselect_shift_click",
68995 "multiselect_lasso",
69008 ["feature_editor", [
69015 "fields_all_fields",
69017 "fields_add_field",
69026 "add_point_finish",
69031 "delete_point_command"
69038 "add_line_continue",
69041 "modify_line_dragnode",
69042 "modify_line_addnode",
69045 "connect_line_display",
69046 "connect_line_drag",
69047 "connect_line_tag",
69048 "disconnect_line_h",
69049 "disconnect_line_command",
69051 "move_line_command",
69052 "move_line_connected",
69055 "delete_line_command"
69062 "add_area_command",
69064 "add_area_continue",
69067 "square_area_command",
69069 "modify_area_dragnode",
69070 "modify_area_addnode",
69073 "delete_area_command"
69079 "edit_relation_add",
69080 "edit_relation_delete",
69081 "maintain_relation_h",
69082 "maintain_relation",
69083 "relation_types_h",
69086 "multipolygon_create",
69087 "multipolygon_merge",
69088 "turn_restriction_h",
69089 "turn_restriction",
69090 "turn_restriction_field",
69091 "turn_restriction_editing",
69162 "help.help.open_data_h": 3,
69163 "help.help.before_start_h": 3,
69164 "help.help.open_source_h": 3,
69165 "help.overview.navigation_h": 3,
69166 "help.overview.features_h": 3,
69167 "help.editing.select_h": 3,
69168 "help.editing.multiselect_h": 3,
69169 "help.editing.undo_redo_h": 3,
69170 "help.editing.save_h": 3,
69171 "help.editing.upload_h": 3,
69172 "help.editing.backups_h": 3,
69173 "help.editing.keyboard_h": 3,
69174 "help.feature_editor.type_h": 3,
69175 "help.feature_editor.fields_h": 3,
69176 "help.feature_editor.tags_h": 3,
69177 "help.points.add_point_h": 3,
69178 "help.points.move_point_h": 3,
69179 "help.points.delete_point_h": 3,
69180 "help.lines.add_line_h": 3,
69181 "help.lines.modify_line_h": 3,
69182 "help.lines.connect_line_h": 3,
69183 "help.lines.disconnect_line_h": 3,
69184 "help.lines.move_line_h": 3,
69185 "help.lines.delete_line_h": 3,
69186 "help.areas.point_or_area_h": 3,
69187 "help.areas.add_area_h": 3,
69188 "help.areas.square_area_h": 3,
69189 "help.areas.modify_area_h": 3,
69190 "help.areas.delete_area_h": 3,
69191 "help.relations.edit_relation_h": 3,
69192 "help.relations.maintain_relation_h": 3,
69193 "help.relations.relation_types_h": 2,
69194 "help.relations.multipolygon_h": 3,
69195 "help.relations.turn_restriction_h": 3,
69196 "help.relations.route_h": 3,
69197 "help.relations.boundary_h": 3,
69198 "help.notes.add_note_h": 3,
69199 "help.notes.update_note_h": 3,
69200 "help.notes.save_note_h": 3,
69201 "help.imagery.sources_h": 3,
69202 "help.imagery.offsets_h": 3,
69203 "help.streetlevel.using_h": 3,
69204 "help.gps.using_h": 3,
69205 "help.qa.tools_h": 3,
69206 "help.qa.issues_h": 3
69208 var docs = docKeys.map(function(key) {
69209 var helpkey = "help." + key[0];
69210 var helpPaneReplacements = { version: context.version };
69211 var text = key[1].reduce(function(all, part) {
69212 var subkey = helpkey + "." + part;
69213 var depth = headings[subkey];
69214 var hhh = depth ? Array(depth + 1).join("#") + " " : "";
69215 return all + hhh + helpHtml(subkey, helpPaneReplacements) + "\n\n";
69218 title: _t.html(helpkey + ".title"),
69219 content: marked(text.trim()).replace(/<code>/g, "<kbd>").replace(/<\/code>/g, "</kbd>")
69222 var helpPane = uiPane("help", context).key(_t("help.key")).label(_t.append("help.title")).description(_t.append("help.title")).iconName("iD-icon-help");
69223 helpPane.renderContent = function(content) {
69224 function clickHelp(d2, i3) {
69225 var rtl = _mainLocalizer.textDirection() === "rtl";
69226 content.property("scrollTop", 0);
69227 helpPane.selection().select(".pane-heading h2").html(d2.title);
69228 body.html(d2.content);
69229 body.selectAll("a").attr("target", "_blank");
69230 menuItems.classed("selected", function(m2) {
69231 return m2.title === d2.title;
69235 nav.call(drawNext).call(drawPrevious);
69237 nav.call(drawPrevious).call(drawNext);
69239 function drawNext(selection2) {
69240 if (i3 < docs.length - 1) {
69241 var nextLink = selection2.append("a").attr("href", "#").attr("class", "next").on("click", function(d3_event) {
69242 d3_event.preventDefault();
69243 clickHelp(docs[i3 + 1], i3 + 1);
69245 nextLink.append("span").html(docs[i3 + 1].title).call(svgIcon(rtl ? "#iD-icon-backward" : "#iD-icon-forward", "inline"));
69248 function drawPrevious(selection2) {
69250 var prevLink = selection2.append("a").attr("href", "#").attr("class", "previous").on("click", function(d3_event) {
69251 d3_event.preventDefault();
69252 clickHelp(docs[i3 - 1], i3 - 1);
69254 prevLink.call(svgIcon(rtl ? "#iD-icon-forward" : "#iD-icon-backward", "inline")).append("span").html(docs[i3 - 1].title);
69258 function clickWalkthrough(d3_event) {
69259 d3_event.preventDefault();
69260 if (context.inIntro()) return;
69261 context.container().call(uiIntro(context));
69262 context.ui().togglePanes();
69264 function clickShortcuts(d3_event) {
69265 d3_event.preventDefault();
69266 context.container().call(context.ui().shortcuts, true);
69268 var toc = content.append("ul").attr("class", "toc");
69269 var menuItems = toc.selectAll("li").data(docs).enter().append("li").append("a").attr("role", "button").attr("href", "#").html(function(d2) {
69271 }).on("click", function(d3_event, d2) {
69272 d3_event.preventDefault();
69273 clickHelp(d2, docs.indexOf(d2));
69275 var shortcuts = toc.append("li").attr("class", "shortcuts").call(
69276 uiTooltip().title(() => _t.append("shortcuts.tooltip")).keys(["?"]).placement("top")
69277 ).append("a").attr("href", "#").on("click", clickShortcuts);
69278 shortcuts.append("div").call(_t.append("shortcuts.title"));
69279 var walkthrough = toc.append("li").attr("class", "walkthrough").append("a").attr("href", "#").on("click", clickWalkthrough);
69280 walkthrough.append("svg").attr("class", "logo logo-walkthrough").append("use").attr("xlink:href", "#iD-logo-walkthrough");
69281 walkthrough.append("div").call(_t.append("splash.walkthrough"));
69282 var helpContent = content.append("div").attr("class", "left-content");
69283 var body = helpContent.append("div").attr("class", "body");
69284 var nav = helpContent.append("div").attr("class", "nav");
69285 clickHelp(docs[0], 0);
69290 // modules/ui/sections/validation_issues.js
69291 function uiSectionValidationIssues(id2, severity, context) {
69293 var section = uiSection(id2, context).label(function() {
69294 if (!_issues) return "";
69295 var issueCountText = _issues.length > 1e3 ? "1000+" : String(_issues.length);
69296 return _t.append("inspector.title_count", { title: _t("issues." + severity + "s.list_title"), count: issueCountText });
69297 }).disclosureContent(renderDisclosureContent).shouldDisplay(function() {
69298 return _issues && _issues.length;
69300 function getOptions() {
69302 what: corePreferences("validate-what") || "edited",
69303 where: corePreferences("validate-where") || "all"
69306 function reloadIssues() {
69307 _issues = context.validator().getIssuesBySeverity(getOptions())[severity];
69309 function renderDisclosureContent(selection2) {
69310 var center = context.map().center();
69311 var graph = context.graph();
69312 var issues = _issues.map(function withDistance(issue) {
69313 var extent = issue.extent(graph);
69314 var dist = extent ? geoSphericalDistance(center, extent.center()) : 0;
69315 return Object.assign(issue, { dist });
69316 }).sort(function byDistance(a2, b2) {
69317 return a2.dist - b2.dist;
69319 issues = issues.slice(0, 1e3);
69320 selection2.call(drawIssuesList, issues);
69322 function drawIssuesList(selection2, issues) {
69323 var list2 = selection2.selectAll(".issues-list").data([0]);
69324 list2 = list2.enter().append("ul").attr("class", "layer-list issues-list " + severity + "s-list").merge(list2);
69325 var items = list2.selectAll("li").data(issues, function(d2) {
69328 items.exit().remove();
69329 var itemsEnter = items.enter().append("li").attr("class", function(d2) {
69330 return "issue severity-" + d2.severity;
69332 var labelsEnter = itemsEnter.append("button").attr("class", "issue-label").on("click", function(d3_event, d2) {
69333 context.validator().focusIssue(d2);
69334 }).on("mouseover", function(d3_event, d2) {
69335 utilHighlightEntities(d2.entityIds, true, context);
69336 }).on("mouseout", function(d3_event, d2) {
69337 utilHighlightEntities(d2.entityIds, false, context);
69339 var textEnter = labelsEnter.append("span").attr("class", "issue-text");
69340 textEnter.append("span").attr("class", "issue-icon").each(function(d2) {
69341 var iconName = "#iD-icon-" + (d2.severity === "warning" ? "alert" : "error");
69342 select_default2(this).call(svgIcon(iconName));
69344 textEnter.append("span").attr("class", "issue-message");
69345 items = items.merge(itemsEnter).order();
69346 items.selectAll(".issue-message").text("").each(function(d2) {
69347 return d2.message(context)(select_default2(this));
69350 context.validator().on("validated.uiSectionValidationIssues" + id2, function() {
69351 window.requestIdleCallback(function() {
69353 section.reRender();
69357 "move.uiSectionValidationIssues" + id2,
69358 debounce_default(function() {
69359 window.requestIdleCallback(function() {
69360 if (getOptions().where === "visible") {
69363 section.reRender();
69370 // modules/ui/sections/validation_options.js
69371 function uiSectionValidationOptions(context) {
69372 var section = uiSection("issues-options", context).content(renderContent);
69373 function renderContent(selection2) {
69374 var container = selection2.selectAll(".issues-options-container").data([0]);
69375 container = container.enter().append("div").attr("class", "issues-options-container").merge(container);
69377 { key: "what", values: ["edited", "all"] },
69378 { key: "where", values: ["visible", "all"] }
69380 var options2 = container.selectAll(".issues-option").data(data, function(d2) {
69383 var optionsEnter = options2.enter().append("div").attr("class", function(d2) {
69384 return "issues-option issues-option-" + d2.key;
69386 optionsEnter.append("div").attr("class", "issues-option-title").html(function(d2) {
69387 return _t.html("issues.options." + d2.key + ".title");
69389 var valuesEnter = optionsEnter.selectAll("label").data(function(d2) {
69390 return d2.values.map(function(val) {
69391 return { value: val, key: d2.key };
69393 }).enter().append("label");
69394 valuesEnter.append("input").attr("type", "radio").attr("name", function(d2) {
69395 return "issues-option-" + d2.key;
69396 }).attr("value", function(d2) {
69398 }).property("checked", function(d2) {
69399 return getOptions()[d2.key] === d2.value;
69400 }).on("change", function(d3_event, d2) {
69401 updateOptionValue(d3_event, d2.key, d2.value);
69403 valuesEnter.append("span").html(function(d2) {
69404 return _t.html("issues.options." + d2.key + "." + d2.value);
69407 function getOptions() {
69409 what: corePreferences("validate-what") || "edited",
69411 where: corePreferences("validate-where") || "all"
69412 // 'all', 'visible'
69415 function updateOptionValue(d3_event, d2, val) {
69416 if (!val && d3_event && d3_event.target) {
69417 val = d3_event.target.value;
69419 corePreferences("validate-" + d2, val);
69420 context.validator().validate();
69425 // modules/ui/sections/validation_rules.js
69426 function uiSectionValidationRules(context) {
69428 var MAXSQUARE = 20;
69429 var DEFAULTSQUARE = 5;
69430 var section = uiSection("issues-rules", context).disclosureContent(renderDisclosureContent).label(() => _t.append("issues.rules.title"));
69431 var _ruleKeys = context.validator().getRuleKeys().filter(function(key) {
69432 return key !== "maprules";
69433 }).sort(function(key1, key2) {
69434 return _t("issues." + key1 + ".title") < _t("issues." + key2 + ".title") ? -1 : 1;
69436 function renderDisclosureContent(selection2) {
69437 var container = selection2.selectAll(".issues-rulelist-container").data([0]);
69438 var containerEnter = container.enter().append("div").attr("class", "issues-rulelist-container");
69439 containerEnter.append("ul").attr("class", "layer-list issue-rules-list");
69440 var ruleLinks = containerEnter.append("div").attr("class", "issue-rules-links section-footer");
69441 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
69442 d3_event.preventDefault();
69443 context.validator().disableRules(_ruleKeys);
69445 ruleLinks.append("a").attr("class", "issue-rules-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
69446 d3_event.preventDefault();
69447 context.validator().disableRules([]);
69449 container = container.merge(containerEnter);
69450 container.selectAll(".issue-rules-list").call(drawListItems, _ruleKeys, "checkbox", "rule", toggleRule, isRuleEnabled);
69452 function drawListItems(selection2, data, type2, name, change, active) {
69453 var items = selection2.selectAll("li").data(data);
69454 items.exit().remove();
69455 var enter = items.enter().append("li");
69456 if (name === "rule") {
69458 uiTooltip().title(function(d2) {
69459 return _t.append("issues." + d2 + ".tip");
69460 }).placement("top")
69463 var label = enter.append("label");
69464 label.append("input").attr("type", type2).attr("name", name).on("change", change);
69465 label.append("span").html(function(d2) {
69467 if (d2 === "unsquare_way") {
69468 params.val = { html: '<span class="square-degrees"></span>' };
69470 return _t.html("issues." + d2 + ".title", params);
69472 items = items.merge(enter);
69473 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
69474 var degStr = corePreferences("validate-square-degrees");
69475 if (degStr === null) {
69476 degStr = DEFAULTSQUARE.toString();
69478 var span = items.selectAll(".square-degrees");
69479 var input = span.selectAll(".square-degrees-input").data([0]);
69480 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) {
69481 d3_event.preventDefault();
69482 d3_event.stopPropagation();
69484 }).on("keyup", function(d3_event) {
69485 if (d3_event.keyCode === 13) {
69489 }).on("blur", changeSquare).merge(input).property("value", degStr);
69491 function changeSquare() {
69492 var input = select_default2(this);
69493 var degStr = utilGetSetValue(input).trim();
69494 var degNum = Number(degStr);
69495 if (!isFinite(degNum)) {
69496 degNum = DEFAULTSQUARE;
69497 } else if (degNum > MAXSQUARE) {
69498 degNum = MAXSQUARE;
69499 } else if (degNum < MINSQUARE) {
69500 degNum = MINSQUARE;
69502 degNum = Math.round(degNum * 10) / 10;
69503 degStr = degNum.toString();
69504 input.property("value", degStr);
69505 corePreferences("validate-square-degrees", degStr);
69506 context.validator().revalidateUnsquare();
69508 function isRuleEnabled(d2) {
69509 return context.validator().isRuleEnabled(d2);
69511 function toggleRule(d3_event, d2) {
69512 context.validator().toggleRule(d2);
69514 context.validator().on("validated.uiSectionValidationRules", function() {
69515 window.requestIdleCallback(section.reRender);
69520 // modules/ui/sections/validation_status.js
69521 function uiSectionValidationStatus(context) {
69522 var section = uiSection("issues-status", context).content(renderContent).shouldDisplay(function() {
69523 var issues = context.validator().getIssues(getOptions());
69524 return issues.length === 0;
69526 function getOptions() {
69528 what: corePreferences("validate-what") || "edited",
69529 where: corePreferences("validate-where") || "all"
69532 function renderContent(selection2) {
69533 var box = selection2.selectAll(".box").data([0]);
69534 var boxEnter = box.enter().append("div").attr("class", "box");
69535 boxEnter.append("div").call(svgIcon("#iD-icon-apply", "pre-text"));
69536 var noIssuesMessage = boxEnter.append("span");
69537 noIssuesMessage.append("strong").attr("class", "message");
69538 noIssuesMessage.append("br");
69539 noIssuesMessage.append("span").attr("class", "details");
69540 renderIgnoredIssuesReset(selection2);
69541 setNoIssuesText(selection2);
69543 function renderIgnoredIssuesReset(selection2) {
69544 var ignoredIssues = context.validator().getIssues({ what: "all", where: "all", includeDisabledRules: true, includeIgnored: "only" });
69545 var resetIgnored = selection2.selectAll(".reset-ignored").data(ignoredIssues.length ? [0] : []);
69546 resetIgnored.exit().remove();
69547 var resetIgnoredEnter = resetIgnored.enter().append("div").attr("class", "reset-ignored section-footer");
69548 resetIgnoredEnter.append("a").attr("href", "#");
69549 resetIgnored = resetIgnored.merge(resetIgnoredEnter);
69550 resetIgnored.select("a").html(_t.html("inspector.title_count", { title: { html: _t.html("issues.reset_ignored") }, count: ignoredIssues.length }));
69551 resetIgnored.on("click", function(d3_event) {
69552 d3_event.preventDefault();
69553 context.validator().resetIgnoredIssues();
69556 function setNoIssuesText(selection2) {
69557 var opts = getOptions();
69558 function checkForHiddenIssues(cases) {
69559 for (var type2 in cases) {
69560 var hiddenOpts = cases[type2];
69561 var hiddenIssues = context.validator().getIssues(hiddenOpts);
69562 if (hiddenIssues.length) {
69563 selection2.select(".box .details").html("").call(_t.append(
69564 "issues.no_issues.hidden_issues." + type2,
69565 { count: hiddenIssues.length.toString() }
69570 selection2.select(".box .details").html("").call(_t.append("issues.no_issues.hidden_issues.none"));
69573 if (opts.what === "edited" && opts.where === "visible") {
69574 messageType = "edits_in_view";
69575 checkForHiddenIssues({
69576 elsewhere: { what: "edited", where: "all" },
69577 everything_else: { what: "all", where: "visible" },
69578 disabled_rules: { what: "edited", where: "visible", includeDisabledRules: "only" },
69579 everything_else_elsewhere: { what: "all", where: "all" },
69580 disabled_rules_elsewhere: { what: "edited", where: "all", includeDisabledRules: "only" },
69581 ignored_issues: { what: "edited", where: "visible", includeIgnored: "only" },
69582 ignored_issues_elsewhere: { what: "edited", where: "all", includeIgnored: "only" }
69584 } else if (opts.what === "edited" && opts.where === "all") {
69585 messageType = "edits";
69586 checkForHiddenIssues({
69587 everything_else: { what: "all", where: "all" },
69588 disabled_rules: { what: "edited", where: "all", includeDisabledRules: "only" },
69589 ignored_issues: { what: "edited", where: "all", includeIgnored: "only" }
69591 } else if (opts.what === "all" && opts.where === "visible") {
69592 messageType = "everything_in_view";
69593 checkForHiddenIssues({
69594 elsewhere: { what: "all", where: "all" },
69595 disabled_rules: { what: "all", where: "visible", includeDisabledRules: "only" },
69596 disabled_rules_elsewhere: { what: "all", where: "all", includeDisabledRules: "only" },
69597 ignored_issues: { what: "all", where: "visible", includeIgnored: "only" },
69598 ignored_issues_elsewhere: { what: "all", where: "all", includeIgnored: "only" }
69600 } else if (opts.what === "all" && opts.where === "all") {
69601 messageType = "everything";
69602 checkForHiddenIssues({
69603 disabled_rules: { what: "all", where: "all", includeDisabledRules: "only" },
69604 ignored_issues: { what: "all", where: "all", includeIgnored: "only" }
69607 if (opts.what === "edited" && context.history().difference().summary().length === 0) {
69608 messageType = "no_edits";
69610 selection2.select(".box .message").html("").call(_t.append("issues.no_issues.message." + messageType));
69612 context.validator().on("validated.uiSectionValidationStatus", function() {
69613 window.requestIdleCallback(section.reRender);
69616 "move.uiSectionValidationStatus",
69617 debounce_default(function() {
69618 window.requestIdleCallback(section.reRender);
69624 // modules/ui/panes/issues.js
69625 function uiPaneIssues(context) {
69626 var issuesPane = uiPane("issues", context).key(_t("issues.key")).label(_t.append("issues.title")).description(_t.append("issues.title")).iconName("iD-icon-alert").sections([
69627 uiSectionValidationOptions(context),
69628 uiSectionValidationStatus(context),
69629 uiSectionValidationIssues("issues-errors", "error", context),
69630 uiSectionValidationIssues("issues-warnings", "warning", context),
69631 uiSectionValidationRules(context)
69636 // modules/ui/settings/custom_data.js
69637 function uiSettingsCustomData(context) {
69638 var dispatch14 = dispatch_default("change");
69639 function render(selection2) {
69640 var dataLayer = context.layers().layer("data");
69641 var _origSettings = {
69642 fileList: dataLayer && dataLayer.fileList() || null,
69643 url: corePreferences("settings-custom-data-url")
69645 var _currSettings = {
69646 fileList: dataLayer && dataLayer.fileList() || null
69647 // url: prefs('settings-custom-data-url')
69649 var modal = uiConfirm(selection2).okButton();
69650 modal.classed("settings-modal settings-custom-data", true);
69651 modal.select(".modal-section.header").append("h3").call(_t.append("settings.custom_data.header"));
69652 var textSection = modal.select(".modal-section.message-text");
69653 textSection.append("pre").attr("class", "instructions-file").call(_t.append("settings.custom_data.file.instructions"));
69654 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) {
69655 var files = d3_event.target.files;
69656 if (files && files.length) {
69657 _currSettings.url = "";
69658 textSection.select(".field-url").property("value", "");
69659 _currSettings.fileList = files;
69661 _currSettings.fileList = null;
69664 textSection.append("h4").call(_t.append("settings.custom_data.or"));
69665 textSection.append("pre").attr("class", "instructions-url").call(_t.append("settings.custom_data.url.instructions"));
69666 textSection.append("textarea").attr("class", "field-url").attr("placeholder", _t("settings.custom_data.url.placeholder")).call(utilNoAuto).property("value", _currSettings.url);
69667 var buttonSection = modal.select(".modal-section.buttons");
69668 buttonSection.insert("button", ".ok-button").attr("class", "button cancel-button secondary-action").call(_t.append("confirm.cancel"));
69669 buttonSection.select(".cancel-button").on("click.cancel", clickCancel);
69670 buttonSection.select(".ok-button").attr("disabled", isSaveDisabled).on("click.save", clickSave);
69671 function isSaveDisabled() {
69674 function clickCancel() {
69675 textSection.select(".field-url").property("value", _origSettings.url);
69676 corePreferences("settings-custom-data-url", _origSettings.url);
69680 function clickSave() {
69681 _currSettings.url = textSection.select(".field-url").property("value").trim();
69682 if (_currSettings.url) {
69683 _currSettings.fileList = null;
69685 if (_currSettings.fileList) {
69686 _currSettings.url = "";
69688 corePreferences("settings-custom-data-url", _currSettings.url);
69691 dispatch14.call("change", this, _currSettings);
69694 return utilRebind(render, dispatch14, "on");
69697 // modules/ui/sections/data_layers.js
69698 function uiSectionDataLayers(context) {
69699 var settingsCustomData = uiSettingsCustomData(context).on("change", customChanged);
69700 var layers = context.layers();
69701 var section = uiSection("data-layers", context).label(() => _t.append("map_data.data_layers")).disclosureContent(renderDisclosureContent);
69702 function renderDisclosureContent(selection2) {
69703 var container = selection2.selectAll(".data-layer-container").data([0]);
69704 container.enter().append("div").attr("class", "data-layer-container").merge(container).call(drawOsmItems).call(drawQAItems).call(drawCustomDataItems).call(drawVectorItems).call(drawPanelItems);
69706 function showsLayer(which) {
69707 var layer = layers.layer(which);
69709 return layer.enabled();
69713 function setLayer(which, enabled) {
69714 var mode = context.mode();
69715 if (mode && /^draw/.test(mode.id)) return;
69716 var layer = layers.layer(which);
69718 layer.enabled(enabled);
69719 if (!enabled && (which === "osm" || which === "notes")) {
69720 context.enter(modeBrowse(context));
69724 function toggleLayer(which) {
69725 setLayer(which, !showsLayer(which));
69727 function drawOsmItems(selection2) {
69728 var osmKeys = ["osm", "notes"];
69729 var osmLayers = layers.all().filter(function(obj) {
69730 return osmKeys.indexOf(obj.id) !== -1;
69732 var ul = selection2.selectAll(".layer-list-osm").data([0]);
69733 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-osm").merge(ul);
69734 var li = ul.selectAll(".list-item").data(osmLayers);
69735 li.exit().remove();
69736 var liEnter = li.enter().append("li").attr("class", function(d2) {
69737 return "list-item list-item-" + d2.id;
69739 var labelEnter = liEnter.append("label").each(function(d2) {
69740 if (d2.id === "osm") {
69741 select_default2(this).call(
69742 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).keys([uiCmd("\u2325" + _t("area_fill.wireframe.key"))]).placement("bottom")
69745 select_default2(this).call(
69746 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
69750 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
69751 toggleLayer(d2.id);
69753 labelEnter.append("span").html(function(d2) {
69754 return _t.html("map_data.layers." + d2.id + ".title");
69756 li.merge(liEnter).classed("active", function(d2) {
69757 return d2.layer.enabled();
69758 }).selectAll("input").property("checked", function(d2) {
69759 return d2.layer.enabled();
69762 function drawQAItems(selection2) {
69763 var qaKeys = ["keepRight", "osmose"];
69764 var qaLayers = layers.all().filter(function(obj) {
69765 return qaKeys.indexOf(obj.id) !== -1;
69767 var ul = selection2.selectAll(".layer-list-qa").data([0]);
69768 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-qa").merge(ul);
69769 var li = ul.selectAll(".list-item").data(qaLayers);
69770 li.exit().remove();
69771 var liEnter = li.enter().append("li").attr("class", function(d2) {
69772 return "list-item list-item-" + d2.id;
69774 var labelEnter = liEnter.append("label").each(function(d2) {
69775 select_default2(this).call(
69776 uiTooltip().title(() => _t.append("map_data.layers." + d2.id + ".tooltip")).placement("bottom")
69779 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
69780 toggleLayer(d2.id);
69782 labelEnter.append("span").each(function(d2) {
69783 _t.append("map_data.layers." + d2.id + ".title")(select_default2(this));
69785 li.merge(liEnter).classed("active", function(d2) {
69786 return d2.layer.enabled();
69787 }).selectAll("input").property("checked", function(d2) {
69788 return d2.layer.enabled();
69791 function drawVectorItems(selection2) {
69792 var dataLayer = layers.layer("data");
69795 name: "Detroit Neighborhoods/Parks",
69796 src: "neighborhoods-parks",
69797 tooltip: "Neighborhood boundaries and parks as compiled by City of Detroit in concert with community groups.",
69798 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"
69801 name: "Detroit Composite POIs",
69802 src: "composite-poi",
69803 tooltip: "Fire Inspections, Business Licenses, and other public location data collated from the City of Detroit.",
69804 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"
69807 name: "Detroit All-The-Places POIs",
69808 src: "alltheplaces-poi",
69809 tooltip: "Public domain business location data created by web scrapers.",
69810 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"
69813 var detroit = geoExtent([-83.5, 42.1], [-82.8, 42.5]);
69814 var showVectorItems = context.map().zoom() > 9 && detroit.contains(context.map().center());
69815 var container = selection2.selectAll(".vectortile-container").data(showVectorItems ? [0] : []);
69816 container.exit().remove();
69817 var containerEnter = container.enter().append("div").attr("class", "vectortile-container");
69818 containerEnter.append("h4").attr("class", "vectortile-header").text("Detroit Vector Tiles (Beta)");
69819 containerEnter.append("ul").attr("class", "layer-list layer-list-vectortile");
69820 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");
69821 container = container.merge(containerEnter);
69822 var ul = container.selectAll(".layer-list-vectortile");
69823 var li = ul.selectAll(".list-item").data(vtData);
69824 li.exit().remove();
69825 var liEnter = li.enter().append("li").attr("class", function(d2) {
69826 return "list-item list-item-" + d2.src;
69828 var labelEnter = liEnter.append("label").each(function(d2) {
69829 select_default2(this).call(
69830 uiTooltip().title(d2.tooltip).placement("top")
69833 labelEnter.append("input").attr("type", "radio").attr("name", "vectortile").on("change", selectVTLayer);
69834 labelEnter.append("span").text(function(d2) {
69837 li.merge(liEnter).classed("active", isVTLayerSelected).selectAll("input").property("checked", isVTLayerSelected);
69838 function isVTLayerSelected(d2) {
69839 return dataLayer && dataLayer.template() === d2.template;
69841 function selectVTLayer(d3_event, d2) {
69842 corePreferences("settings-custom-data-url", d2.template);
69844 dataLayer.template(d2.template, d2.src);
69845 dataLayer.enabled(true);
69849 function drawCustomDataItems(selection2) {
69850 var dataLayer = layers.layer("data");
69851 var hasData = dataLayer && dataLayer.hasData();
69852 var showsData = hasData && dataLayer.enabled();
69853 var ul = selection2.selectAll(".layer-list-data").data(dataLayer ? [0] : []);
69854 ul.exit().remove();
69855 var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-data");
69856 var liEnter = ulEnter.append("li").attr("class", "list-item-data");
69857 var labelEnter = liEnter.append("label").call(
69858 uiTooltip().title(() => _t.append("map_data.layers.custom.tooltip")).placement("top")
69860 labelEnter.append("input").attr("type", "checkbox").on("change", function() {
69861 toggleLayer("data");
69863 labelEnter.append("span").call(_t.append("map_data.layers.custom.title"));
69864 liEnter.append("button").attr("class", "open-data-options").call(
69865 uiTooltip().title(() => _t.append("settings.custom_data.tooltip")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69866 ).on("click", function(d3_event) {
69867 d3_event.preventDefault();
69869 }).call(svgIcon("#iD-icon-more"));
69870 liEnter.append("button").attr("class", "zoom-to-data").call(
69871 uiTooltip().title(() => _t.append("map_data.layers.custom.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
69872 ).on("click", function(d3_event) {
69873 if (select_default2(this).classed("disabled")) return;
69874 d3_event.preventDefault();
69875 d3_event.stopPropagation();
69876 dataLayer.fitZoom();
69877 }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
69878 ul = ul.merge(ulEnter);
69879 ul.selectAll(".list-item-data").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
69880 ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
69882 function editCustom() {
69883 context.container().call(settingsCustomData);
69885 function customChanged(d2) {
69886 var dataLayer = layers.layer("data");
69887 if (d2 && d2.url) {
69888 dataLayer.url(d2.url);
69889 } else if (d2 && d2.fileList) {
69890 dataLayer.fileList(d2.fileList);
69893 function drawPanelItems(selection2) {
69894 var panelsListEnter = selection2.selectAll(".md-extras-list").data([0]).enter().append("ul").attr("class", "layer-list md-extras-list");
69895 var historyPanelLabelEnter = panelsListEnter.append("li").attr("class", "history-panel-toggle-item").append("label").call(
69896 uiTooltip().title(() => _t.append("map_data.history_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.history.key"))]).placement("top")
69898 historyPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69899 d3_event.preventDefault();
69900 context.ui().info.toggle("history");
69902 historyPanelLabelEnter.append("span").call(_t.append("map_data.history_panel.title"));
69903 var measurementPanelLabelEnter = panelsListEnter.append("li").attr("class", "measurement-panel-toggle-item").append("label").call(
69904 uiTooltip().title(() => _t.append("map_data.measurement_panel.tooltip")).keys([uiCmd("\u2318\u21E7" + _t("info_panels.measurement.key"))]).placement("top")
69906 measurementPanelLabelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event) {
69907 d3_event.preventDefault();
69908 context.ui().info.toggle("measurement");
69910 measurementPanelLabelEnter.append("span").call(_t.append("map_data.measurement_panel.title"));
69912 context.layers().on("change.uiSectionDataLayers", section.reRender);
69914 "move.uiSectionDataLayers",
69915 debounce_default(function() {
69916 window.requestIdleCallback(section.reRender);
69922 // modules/ui/sections/map_features.js
69923 function uiSectionMapFeatures(context) {
69924 var _features = context.features().keys();
69925 var section = uiSection("map-features", context).label(() => _t.append("map_data.map_features")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69926 function renderDisclosureContent(selection2) {
69927 var container = selection2.selectAll(".layer-feature-list-container").data([0]);
69928 var containerEnter = container.enter().append("div").attr("class", "layer-feature-list-container");
69929 containerEnter.append("ul").attr("class", "layer-list layer-feature-list");
69930 var footer = containerEnter.append("div").attr("class", "feature-list-links section-footer");
69931 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.disable_all")).on("click", function(d3_event) {
69932 d3_event.preventDefault();
69933 context.features().disableAll();
69935 footer.append("a").attr("class", "feature-list-link").attr("role", "button").attr("href", "#").call(_t.append("issues.enable_all")).on("click", function(d3_event) {
69936 d3_event.preventDefault();
69937 context.features().enableAll();
69939 container = container.merge(containerEnter);
69940 container.selectAll(".layer-feature-list").call(drawListItems, _features, "checkbox", "feature", clickFeature, showsFeature);
69942 function drawListItems(selection2, data, type2, name, change, active) {
69943 var items = selection2.selectAll("li").data(data);
69944 items.exit().remove();
69945 var enter = items.enter().append("li").call(
69946 uiTooltip().title(function(d2) {
69947 var tip = _t.append(name + "." + d2 + ".tooltip");
69948 if (autoHiddenFeature(d2)) {
69949 var msg = showsLayer("osm") ? _t.append("map_data.autohidden") : _t.append("map_data.osmhidden");
69950 return (selection3) => {
69951 selection3.call(tip);
69952 selection3.append("div").call(msg);
69956 }).placement("top")
69958 var label = enter.append("label");
69959 label.append("input").attr("type", type2).attr("name", name).on("change", change);
69960 label.append("span").html(function(d2) {
69961 return _t.html(name + "." + d2 + ".description");
69963 items = items.merge(enter);
69964 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", autoHiddenFeature);
69966 function autoHiddenFeature(d2) {
69967 return context.features().autoHidden(d2);
69969 function showsFeature(d2) {
69970 return context.features().enabled(d2);
69972 function clickFeature(d3_event, d2) {
69973 context.features().toggle(d2);
69975 function showsLayer(id2) {
69976 var layer = context.layers().layer(id2);
69977 return layer && layer.enabled();
69979 context.features().on("change.map_features", section.reRender);
69983 // modules/ui/sections/map_style_options.js
69984 function uiSectionMapStyleOptions(context) {
69985 var section = uiSection("fill-area", context).label(() => _t.append("map_data.style_options")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
69986 function renderDisclosureContent(selection2) {
69987 var container = selection2.selectAll(".layer-fill-list").data([0]);
69988 container.enter().append("ul").attr("class", "layer-list layer-fill-list").merge(container).call(drawListItems, context.map().areaFillOptions, "radio", "area_fill", setFill, isActiveFill);
69989 var container2 = selection2.selectAll(".layer-visual-diff-list").data([0]);
69990 container2.enter().append("ul").attr("class", "layer-list layer-visual-diff-list").merge(container2).call(drawListItems, ["highlight_edits"], "checkbox", "visual_diff", toggleHighlightEdited, function() {
69991 return context.surface().classed("highlight-edited");
69994 function drawListItems(selection2, data, type2, name, change, active) {
69995 var items = selection2.selectAll("li").data(data);
69996 items.exit().remove();
69997 var enter = items.enter().append("li").call(
69998 uiTooltip().title(function(d2) {
69999 return _t.append(name + "." + d2 + ".tooltip");
70000 }).keys(function(d2) {
70001 var key = d2 === "wireframe" ? _t("area_fill.wireframe.key") : null;
70002 if (d2 === "highlight_edits") key = _t("map_data.highlight_edits.key");
70003 return key ? [key] : null;
70004 }).placement("top")
70006 var label = enter.append("label");
70007 label.append("input").attr("type", type2).attr("name", name).on("change", change);
70008 label.append("span").html(function(d2) {
70009 return _t.html(name + "." + d2 + ".description");
70011 items = items.merge(enter);
70012 items.classed("active", active).selectAll("input").property("checked", active).property("indeterminate", false);
70014 function isActiveFill(d2) {
70015 return context.map().activeAreaFill() === d2;
70017 function toggleHighlightEdited(d3_event) {
70018 d3_event.preventDefault();
70019 context.map().toggleHighlightEdited();
70021 function setFill(d3_event, d2) {
70022 context.map().activeAreaFill(d2);
70024 context.map().on("changeHighlighting.ui_style, changeAreaFill.ui_style", section.reRender);
70028 // modules/ui/settings/local_photos.js
70029 function uiSettingsLocalPhotos(context) {
70030 var dispatch14 = dispatch_default("change");
70031 var photoLayer = context.layers().layer("local-photos");
70033 function render(selection2) {
70034 modal = uiConfirm(selection2).okButton();
70035 modal.classed("settings-modal settings-local-photos", true);
70036 modal.select(".modal-section.header").append("h3").call(_t.append("local_photos.header"));
70037 modal.select(".modal-section.message-text").append("div").classed("local-photos", true);
70038 var instructionsSection = modal.select(".modal-section.message-text .local-photos").append("div").classed("instructions", true);
70039 instructionsSection.append("p").classed("instructions-local-photos", true).call(_t.append("local_photos.file.instructions"));
70040 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) {
70041 var files = d3_event.target.files;
70042 if (files && files.length) {
70043 photoList.select("ul").append("li").classed("placeholder", true).append("div");
70044 dispatch14.call("change", this, files);
70046 d3_event.target.value = null;
70048 instructionsSection.append("label").attr("for", "local-photo-files").classed("button", true).call(_t.append("local_photos.file.label"));
70049 const photoList = modal.select(".modal-section.message-text .local-photos").append("div").append("div").classed("list-local-photos", true);
70050 photoList.append("ul");
70051 updatePhotoList(photoList.select("ul"));
70052 context.layers().on("change", () => updatePhotoList(photoList.select("ul")));
70054 function updatePhotoList(container) {
70056 function locationUnavailable(d2) {
70057 return !(isArray_default(d2.loc) && isNumber_default(d2.loc[0]) && isNumber_default(d2.loc[1]));
70059 container.selectAll("li.placeholder").remove();
70060 let selection2 = container.selectAll("li").data((_a3 = photoLayer.getPhotos()) != null ? _a3 : [], (d2) => d2.id);
70061 selection2.exit().remove();
70062 const selectionEnter = selection2.enter().append("li");
70063 selectionEnter.append("span").classed("filename", true);
70064 selectionEnter.append("button").classed("form-field-button zoom-to-data", true).attr("title", _t("local_photos.zoom_single")).call(svgIcon("#iD-icon-framed-dot"));
70065 selectionEnter.append("button").classed("form-field-button no-geolocation", true).call(svgIcon("#iD-icon-alert")).call(
70066 uiTooltip().title(() => _t.append("local_photos.no_geolocation.tooltip")).placement("left")
70068 selectionEnter.append("button").classed("form-field-button remove", true).attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
70069 selection2 = selection2.merge(selectionEnter);
70070 selection2.classed("invalid", locationUnavailable);
70071 selection2.select("span.filename").text((d2) => d2.name).attr("title", (d2) => d2.name);
70072 selection2.select("span.filename").on("click", (d3_event, d2) => {
70073 photoLayer.openPhoto(d3_event, d2, false);
70075 selection2.select("button.zoom-to-data").on("click", (d3_event, d2) => {
70076 photoLayer.openPhoto(d3_event, d2, true);
70078 selection2.select("button.remove").on("click", (d3_event, d2) => {
70079 photoLayer.removePhoto(d2.id);
70080 updatePhotoList(container);
70083 return utilRebind(render, dispatch14, "on");
70086 // modules/ui/sections/photo_overlays.js
70087 function uiSectionPhotoOverlays(context) {
70088 var settingsLocalPhotos = uiSettingsLocalPhotos(context).on("change", localPhotosChanged);
70089 var layers = context.layers();
70090 var section = uiSection("photo-overlays", context).label(() => _t.append("photo_overlays.title")).disclosureContent(renderDisclosureContent).expandedByDefault(false);
70091 function renderDisclosureContent(selection2) {
70092 var container = selection2.selectAll(".photo-overlay-container").data([0]);
70093 container.enter().append("div").attr("class", "photo-overlay-container").merge(container).call(drawPhotoItems).call(drawPhotoTypeItems).call(drawDateFilter).call(drawUsernameFilter).call(drawLocalPhotos);
70095 function drawPhotoItems(selection2) {
70096 var photoKeys = context.photos().overlayLayerIDs();
70097 var photoLayers = layers.all().filter(function(obj) {
70098 return photoKeys.indexOf(obj.id) !== -1;
70100 var data = photoLayers.filter(function(obj) {
70101 if (!obj.layer.supported()) return false;
70102 if (layerEnabled(obj)) return true;
70103 if (typeof obj.layer.validHere === "function") {
70104 return obj.layer.validHere(context.map().extent(), context.map().zoom());
70108 function layerSupported(d2) {
70109 return d2.layer && d2.layer.supported();
70111 function layerEnabled(d2) {
70112 return layerSupported(d2) && d2.layer.enabled();
70114 function layerRendered(d2) {
70116 return (_c = (_b3 = (_a3 = d2.layer).rendered) == null ? void 0 : _b3.call(_a3, context.map().zoom())) != null ? _c : true;
70118 var ul = selection2.selectAll(".layer-list-photos").data([0]);
70119 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photos").merge(ul);
70120 var li = ul.selectAll(".list-item-photos").data(data, (d2) => d2.id);
70121 li.exit().remove();
70122 var liEnter = li.enter().append("li").attr("class", function(d2) {
70123 var classes = "list-item-photos list-item-" + d2.id;
70124 if (d2.id === "mapillary-signs" || d2.id === "mapillary-map-features") {
70125 classes += " indented";
70129 var labelEnter = liEnter.append("label").each(function(d2) {
70131 if (d2.id === "mapillary-signs") titleID = "mapillary.signs.tooltip";
70132 else if (d2.id === "mapillary") titleID = "mapillary_images.tooltip";
70133 else if (d2.id === "kartaview") titleID = "kartaview_images.tooltip";
70134 else titleID = d2.id.replace(/-/g, "_") + ".tooltip";
70135 select_default2(this).call(
70136 uiTooltip().title(() => {
70137 if (!layerRendered(d2)) {
70138 return _t.append("street_side.minzoom_tooltip");
70140 return _t.append(titleID);
70142 }).placement("top")
70145 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
70146 toggleLayer(d2.id);
70148 labelEnter.append("span").html(function(d2) {
70150 if (id2 === "mapillary-signs") id2 = "photo_overlays.traffic_signs";
70151 return _t.html(id2.replace(/-/g, "_") + ".title");
70153 li.merge(liEnter).classed("active", layerEnabled).selectAll("input").property("disabled", (d2) => !layerRendered(d2)).property("checked", layerEnabled);
70155 function drawPhotoTypeItems(selection2) {
70156 var data = context.photos().allPhotoTypes();
70157 function typeEnabled(d2) {
70158 return context.photos().showsPhotoType(d2);
70160 var ul = selection2.selectAll(".layer-list-photo-types").data([0]);
70161 ul.exit().remove();
70162 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-photo-types").merge(ul);
70163 var li = ul.selectAll(".list-item-photo-types").data(context.photos().shouldFilterByPhotoType() ? data : []);
70164 li.exit().remove();
70165 var liEnter = li.enter().append("li").attr("class", function(d2) {
70166 return "list-item-photo-types list-item-" + d2;
70168 var labelEnter = liEnter.append("label").each(function(d2) {
70169 select_default2(this).call(
70170 uiTooltip().title(() => _t.append("photo_overlays.photo_type." + d2 + ".tooltip")).placement("top")
70173 labelEnter.append("input").attr("type", "checkbox").on("change", function(d3_event, d2) {
70174 context.photos().togglePhotoType(d2);
70176 labelEnter.append("span").html(function(d2) {
70177 return _t.html("photo_overlays.photo_type." + d2 + ".title");
70179 li.merge(liEnter).classed("active", typeEnabled).selectAll("input").property("checked", typeEnabled);
70181 function drawDateFilter(selection2) {
70182 var data = context.photos().dateFilters();
70183 function filterEnabled(d2) {
70184 return context.photos().dateFilterValue(d2);
70186 var ul = selection2.selectAll(".layer-list-date-filter").data([0]);
70187 ul.exit().remove();
70188 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-date-filter").merge(ul);
70189 var li = ul.selectAll(".list-item-date-filter").data(context.photos().shouldFilterByDate() ? data : []);
70190 li.exit().remove();
70191 var liEnter = li.enter().append("li").attr("class", "list-item-date-filter");
70192 var labelEnter = liEnter.append("label").each(function(d2) {
70193 select_default2(this).call(
70194 uiTooltip().title(() => _t.append("photo_overlays.date_filter." + d2 + ".tooltip")).placement("top")
70197 labelEnter.append("span").each(function(d2) {
70198 _t.append("photo_overlays.date_filter." + d2 + ".title")(select_default2(this));
70200 labelEnter.append("input").attr("type", "date").attr("class", "list-item-input").attr("placeholder", _t("units.year_month_day")).call(utilNoAuto).each(function(d2) {
70201 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d2) || "");
70202 }).on("change", function(d3_event, d2) {
70203 var value = utilGetSetValue(select_default2(this)).trim();
70204 context.photos().setDateFilter(d2, value, true);
70205 li.selectAll("input").each(function(d4) {
70206 utilGetSetValue(select_default2(this), context.photos().dateFilterValue(d4) || "");
70209 li = li.merge(liEnter).classed("active", filterEnabled);
70211 function drawUsernameFilter(selection2) {
70212 function filterEnabled() {
70213 return context.photos().usernames();
70215 var ul = selection2.selectAll(".layer-list-username-filter").data([0]);
70216 ul.exit().remove();
70217 ul = ul.enter().append("ul").attr("class", "layer-list layer-list-username-filter").merge(ul);
70218 var li = ul.selectAll(".list-item-username-filter").data(context.photos().shouldFilterByUsername() ? ["username-filter"] : []);
70219 li.exit().remove();
70220 var liEnter = li.enter().append("li").attr("class", "list-item-username-filter");
70221 var labelEnter = liEnter.append("label").each(function() {
70222 select_default2(this).call(
70223 uiTooltip().title(() => _t.append("photo_overlays.username_filter.tooltip")).placement("top")
70226 labelEnter.append("span").call(_t.append("photo_overlays.username_filter.title"));
70227 labelEnter.append("input").attr("type", "text").attr("class", "list-item-input").call(utilNoAuto).property("value", usernameValue).on("change", function() {
70228 var value = select_default2(this).property("value");
70229 context.photos().setUsernameFilter(value, true);
70230 select_default2(this).property("value", usernameValue);
70232 li.merge(liEnter).classed("active", filterEnabled);
70233 function usernameValue() {
70234 var usernames = context.photos().usernames();
70235 if (usernames) return usernames.join("; ");
70239 function toggleLayer(which) {
70240 setLayer(which, !showsLayer(which));
70242 function showsLayer(which) {
70243 var layer = layers.layer(which);
70245 return layer.enabled();
70249 function setLayer(which, enabled) {
70250 var layer = layers.layer(which);
70252 layer.enabled(enabled);
70255 function drawLocalPhotos(selection2) {
70256 var photoLayer = layers.layer("local-photos");
70257 var hasData = photoLayer && photoLayer.hasData();
70258 var showsData = hasData && photoLayer.enabled();
70259 var ul = selection2.selectAll(".layer-list-local-photos").data(photoLayer ? [0] : []);
70260 ul.exit().remove();
70261 var ulEnter = ul.enter().append("ul").attr("class", "layer-list layer-list-local-photos");
70262 var localPhotosEnter = ulEnter.append("li").attr("class", "list-item-local-photos");
70263 var localPhotosLabelEnter = localPhotosEnter.append("label").call(uiTooltip().title(() => _t.append("local_photos.tooltip")));
70264 localPhotosLabelEnter.append("input").attr("type", "checkbox").on("change", function() {
70265 toggleLayer("local-photos");
70267 localPhotosLabelEnter.call(_t.append("local_photos.header"));
70268 localPhotosEnter.append("button").attr("class", "open-data-options").call(
70269 uiTooltip().title(() => _t.append("local_photos.tooltip_edit")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70270 ).on("click", function(d3_event) {
70271 d3_event.preventDefault();
70273 }).call(svgIcon("#iD-icon-more"));
70274 localPhotosEnter.append("button").attr("class", "zoom-to-data").call(
70275 uiTooltip().title(() => _t.append("local_photos.zoom")).placement(_mainLocalizer.textDirection() === "rtl" ? "right" : "left")
70276 ).on("click", function(d3_event) {
70277 if (select_default2(this).classed("disabled")) return;
70278 d3_event.preventDefault();
70279 d3_event.stopPropagation();
70280 photoLayer.fitZoom();
70281 }).call(svgIcon("#iD-icon-framed-dot", "monochrome"));
70282 ul = ul.merge(ulEnter);
70283 ul.selectAll(".list-item-local-photos").classed("active", showsData).selectAll("label").classed("deemphasize", !hasData).selectAll("input").property("disabled", !hasData).property("checked", showsData);
70284 ul.selectAll("button.zoom-to-data").classed("disabled", !hasData);
70286 function editLocalPhotos() {
70287 context.container().call(settingsLocalPhotos);
70289 function localPhotosChanged(d2) {
70290 var localPhotosLayer = layers.layer("local-photos");
70291 localPhotosLayer.fileList(d2);
70293 context.layers().on("change.uiSectionPhotoOverlays", section.reRender);
70294 context.photos().on("change.uiSectionPhotoOverlays", section.reRender);
70296 "move.photo_overlays",
70297 debounce_default(function() {
70298 window.requestIdleCallback(section.reRender);
70304 // modules/ui/panes/map_data.js
70305 function uiPaneMapData(context) {
70306 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([
70307 uiSectionDataLayers(context),
70308 uiSectionPhotoOverlays(context),
70309 uiSectionMapStyleOptions(context),
70310 uiSectionMapFeatures(context)
70312 return mapDataPane;
70315 // modules/ui/panes/preferences.js
70316 function uiPanePreferences(context) {
70317 let preferencesPane = uiPane("preferences", context).key(_t("preferences.key")).label(_t.append("preferences.title")).description(_t.append("preferences.description")).iconName("fas-user-cog").sections([
70318 uiSectionPrivacy(context)
70320 return preferencesPane;
70323 // modules/ui/init.js
70324 function uiInit(context) {
70325 var _initCounter = 0;
70326 var _needWidth = {};
70327 var _lastPointerType;
70328 function render(container) {
70329 container.on("click.ui", function(d3_event) {
70330 if (d3_event.button !== 0) return;
70331 if (!d3_event.composedPath) return;
70332 var isOkayTarget = d3_event.composedPath().some(function(node) {
70333 return node.nodeType === 1 && // clicking <input> focuses it and/or changes a value
70334 (node.nodeName === "INPUT" || // clicking <label> affects its <input> by default
70335 node.nodeName === "LABEL" || // clicking <a> opens a hyperlink by default
70336 node.nodeName === "A");
70338 if (isOkayTarget) return;
70339 d3_event.preventDefault();
70341 var detected = utilDetect();
70342 if ("GestureEvent" in window && // Listening for gesture events on iOS 13.4+ breaks double-tapping,
70343 // but we only need to do this on desktop Safari anyway. – #7694
70344 !detected.isMobileWebKit) {
70345 container.on("gesturestart.ui gesturechange.ui gestureend.ui", function(d3_event) {
70346 d3_event.preventDefault();
70349 if ("PointerEvent" in window) {
70350 select_default2(window).on("pointerdown.ui pointerup.ui", function(d3_event) {
70351 var pointerType = d3_event.pointerType || "mouse";
70352 if (_lastPointerType !== pointerType) {
70353 _lastPointerType = pointerType;
70354 container.attr("pointer", pointerType);
70358 _lastPointerType = "mouse";
70359 container.attr("pointer", "mouse");
70361 container.attr("lang", _mainLocalizer.localeCode()).attr("dir", _mainLocalizer.textDirection());
70362 container.call(uiFullScreen(context));
70363 var map2 = context.map();
70364 map2.redrawEnable(false);
70365 map2.on("hitMinZoom.ui", function() {
70366 ui.flash.iconName("#iD-icon-no").label(_t.append("cannot_zoom"))();
70368 container.append("svg").attr("id", "ideditor-defs").call(ui.svgDefs);
70369 container.append("div").attr("class", "sidebar").call(ui.sidebar);
70370 var content = container.append("div").attr("class", "main-content active");
70371 content.append("div").attr("class", "top-toolbar-wrap").append("div").attr("class", "top-toolbar fillD").call(uiTopToolbar(context));
70372 content.append("div").attr("class", "main-map").attr("dir", "ltr").call(map2);
70373 var overMap = content.append("div").attr("class", "over-map");
70374 overMap.append("div").attr("class", "select-trap").text("t");
70375 overMap.call(uiMapInMap(context)).call(uiNotice(context));
70376 overMap.append("div").attr("class", "spinner").call(uiSpinner(context));
70377 var controlsWrap = overMap.append("div").attr("class", "map-controls-wrap");
70378 var controls = controlsWrap.append("div").attr("class", "map-controls");
70379 controls.append("div").attr("class", "map-control zoombuttons").call(uiZoom(context));
70380 controls.append("div").attr("class", "map-control zoom-to-selection-control").call(uiZoomToSelection(context));
70381 controls.append("div").attr("class", "map-control geolocate-control").call(uiGeolocate(context));
70382 controlsWrap.on("wheel.mapControls", function(d3_event) {
70383 if (!d3_event.deltaX) {
70384 controlsWrap.node().scrollTop += d3_event.deltaY;
70387 var panes = overMap.append("div").attr("class", "map-panes");
70389 uiPaneBackground(context),
70390 uiPaneMapData(context),
70391 uiPaneIssues(context),
70392 uiPanePreferences(context),
70393 uiPaneHelp(context)
70395 uiPanes.forEach(function(pane) {
70396 controls.append("div").attr("class", "map-control map-pane-control " + pane.id + "-control").call(pane.renderToggleButton);
70397 panes.call(pane.renderPane);
70399 ui.info = uiInfo(context);
70400 overMap.call(ui.info);
70401 overMap.append("div").attr("class", "photoviewer").classed("al", true).classed("hide", true).call(ui.photoviewer);
70402 overMap.append("div").attr("class", "attribution-wrap").attr("dir", "ltr").call(uiAttribution(context));
70403 var about = content.append("div").attr("class", "map-footer");
70404 about.append("div").attr("class", "api-status").call(uiStatus(context));
70405 var footer = about.append("div").attr("class", "map-footer-bar fillD");
70406 footer.append("div").attr("class", "flash-wrap footer-hide");
70407 var footerWrap = footer.append("div").attr("class", "main-footer-wrap footer-show");
70408 footerWrap.append("div").attr("class", "scale-block").call(uiScale(context));
70409 var aboutList = footerWrap.append("div").attr("class", "info-block").append("ul").attr("class", "map-footer-list");
70410 aboutList.append("li").attr("class", "user-list").call(uiContributors(context));
70411 var apiConnections = context.connection().apiConnections();
70412 if (apiConnections && apiConnections.length > 1) {
70413 aboutList.append("li").attr("class", "source-switch").call(
70414 uiSourceSwitch(context).keys(apiConnections)
70417 aboutList.append("li").attr("class", "issues-info").call(uiIssuesInfo(context));
70418 aboutList.append("li").attr("class", "feature-warning").call(uiFeatureInfo(context));
70419 var issueLinks = aboutList.append("li");
70420 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"));
70421 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"));
70422 aboutList.append("li").attr("class", "version").call(uiVersion(context));
70423 if (!context.embed()) {
70424 aboutList.call(uiAccount(context));
70427 map2.redrawEnable(true);
70428 ui.hash = behaviorHash(context);
70430 if (!ui.hash.hadLocation) {
70431 map2.centerZoom([0, 0], 2);
70433 window.onbeforeunload = function() {
70434 return context.save();
70436 window.onunload = function() {
70437 context.history().unlock();
70439 select_default2(window).on("resize.editor", function() {
70442 var panPixels = 80;
70443 context.keybinding().on("\u232B", function(d3_event) {
70444 d3_event.preventDefault();
70445 }).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) {
70447 d3_event.stopImmediatePropagation();
70448 d3_event.preventDefault();
70450 var previousBackground = context.background().findSource(corePreferences("background-last-used-toggle"));
70451 if (previousBackground) {
70452 var currentBackground = context.background().baseLayerSource();
70453 corePreferences("background-last-used-toggle", currentBackground.id);
70454 corePreferences("background-last-used", previousBackground.id);
70455 context.background().baseLayerSource(previousBackground);
70457 }).on(_t("area_fill.wireframe.key"), function toggleWireframe(d3_event) {
70458 d3_event.preventDefault();
70459 d3_event.stopPropagation();
70460 context.map().toggleWireframe();
70461 }).on(uiCmd("\u2325" + _t("area_fill.wireframe.key")), function toggleOsmData(d3_event) {
70462 d3_event.preventDefault();
70463 d3_event.stopPropagation();
70464 var mode = context.mode();
70465 if (mode && /^draw/.test(mode.id)) return;
70466 var layer = context.layers().layer("osm");
70468 layer.enabled(!layer.enabled());
70469 if (!layer.enabled()) {
70470 context.enter(modeBrowse(context));
70473 }).on(_t("map_data.highlight_edits.key"), function toggleHighlightEdited(d3_event) {
70474 d3_event.preventDefault();
70475 context.map().toggleHighlightEdited();
70477 context.on("enter.editor", function(entered) {
70478 container.classed("mode-" + entered.id, true);
70479 }).on("exit.editor", function(exited) {
70480 container.classed("mode-" + exited.id, false);
70482 context.enter(modeBrowse(context));
70483 if (!_initCounter++) {
70484 if (!ui.hash.startWalkthrough) {
70485 context.container().call(uiSplash(context)).call(uiRestore(context));
70487 context.container().call(ui.shortcuts);
70489 var osm = context.connection();
70490 var auth = uiLoading(context).message(_t.html("loading_auth")).blocking(true);
70492 osm.on("authLoading.ui", function() {
70493 context.container().call(auth);
70494 }).on("authDone.ui", function() {
70499 if (ui.hash.startWalkthrough) {
70500 ui.hash.startWalkthrough = false;
70501 context.container().call(uiIntro(context));
70504 return function(d3_event) {
70505 if (d3_event.shiftKey) return;
70506 if (context.container().select(".combobox").size()) return;
70507 d3_event.preventDefault();
70508 context.map().pan(d2, 100);
70514 ui.ensureLoaded = () => {
70515 if (_loadPromise) return _loadPromise;
70516 return _loadPromise = Promise.all([
70517 // must have strings and presets before loading the UI
70518 _mainLocalizer.ensureLoaded(),
70519 _mainPresetIndex.ensureLoaded()
70521 if (!context.container().empty()) render(context.container());
70522 }).catch((err) => console.error(err));
70524 ui.restart = function() {
70525 context.keybinding().clear();
70526 _loadPromise = null;
70527 context.container().selectAll("*").remove();
70530 ui.lastPointerType = function() {
70531 return _lastPointerType;
70533 ui.svgDefs = svgDefs(context);
70534 ui.flash = uiFlash(context);
70535 ui.sidebar = uiSidebar(context);
70536 ui.photoviewer = uiPhotoviewer(context);
70537 ui.shortcuts = uiShortcuts(context);
70538 ui.onResize = function(withPan) {
70539 var map2 = context.map();
70540 var mapDimensions = utilGetDimensions(context.container().select(".main-content"), true);
70541 utilGetDimensions(context.container().select(".sidebar"), true);
70542 if (withPan !== void 0) {
70543 map2.redrawEnable(false);
70545 map2.redrawEnable(true);
70547 map2.dimensions(mapDimensions);
70548 ui.photoviewer.onMapResize();
70549 ui.checkOverflow(".top-toolbar");
70550 ui.checkOverflow(".map-footer-bar");
70551 var resizeWindowEvent = document.createEvent("Event");
70552 resizeWindowEvent.initEvent("resizeWindow", true, true);
70553 document.dispatchEvent(resizeWindowEvent);
70555 ui.checkOverflow = function(selector, reset) {
70557 delete _needWidth[selector];
70559 var selection2 = context.container().select(selector);
70560 if (selection2.empty()) return;
70561 var scrollWidth = selection2.property("scrollWidth");
70562 var clientWidth = selection2.property("clientWidth");
70563 var needed = _needWidth[selector] || scrollWidth;
70564 if (scrollWidth > clientWidth) {
70565 selection2.classed("narrow", true);
70566 if (!_needWidth[selector]) {
70567 _needWidth[selector] = scrollWidth;
70569 } else if (scrollWidth >= needed) {
70570 selection2.classed("narrow", false);
70573 ui.togglePanes = function(showPane) {
70574 var hidePanes = context.container().selectAll(".map-pane.shown");
70575 var side = _mainLocalizer.textDirection() === "ltr" ? "right" : "left";
70576 hidePanes.classed("shown", false).classed("hide", true);
70577 context.container().selectAll(".map-pane-control button").classed("active", false);
70579 hidePanes.classed("shown", false).classed("hide", true).style(side, "-500px");
70580 context.container().selectAll("." + showPane.attr("pane") + "-control button").classed("active", true);
70581 showPane.classed("shown", true).classed("hide", false);
70582 if (hidePanes.empty()) {
70583 showPane.style(side, "-500px").transition().duration(200).style(side, "0px");
70585 showPane.style(side, "0px");
70588 hidePanes.classed("shown", true).classed("hide", false).style(side, "0px").transition().duration(200).style(side, "-500px").on("end", function() {
70589 select_default2(this).classed("shown", false).classed("hide", true);
70593 var _editMenu = uiEditMenu(context);
70594 ui.editMenu = function() {
70597 ui.showEditMenu = function(anchorPoint, triggerType, operations) {
70598 ui.closeEditMenu();
70599 if (!operations && context.mode().operations) operations = context.mode().operations();
70600 if (!operations || !operations.length) return;
70601 if (!context.map().editableDataEnabled()) return;
70602 var surfaceNode = context.surface().node();
70603 if (surfaceNode.focus) {
70604 surfaceNode.focus();
70606 operations.forEach(function(operation2) {
70607 if (operation2.point) operation2.point(anchorPoint);
70609 _editMenu.anchorLoc(anchorPoint).triggerType(triggerType).operations(operations);
70610 context.map().supersurface.call(_editMenu);
70612 ui.closeEditMenu = function() {
70613 context.map().supersurface.select(".edit-menu").remove();
70615 var _saveLoading = select_default2(null);
70616 context.uploader().on("saveStarted.ui", function() {
70617 _saveLoading = uiLoading(context).message(_t.html("save.uploading")).blocking(true);
70618 context.container().call(_saveLoading);
70619 }).on("saveEnded.ui", function() {
70620 _saveLoading.close();
70621 _saveLoading = select_default2(null);
70630 // modules/ui/commit_warnings.js
70631 function uiCommitWarnings(context) {
70632 function commitWarnings(selection2) {
70633 var issuesBySeverity = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeDisabledRules: true });
70634 for (var severity in issuesBySeverity) {
70635 var issues = issuesBySeverity[severity];
70636 if (severity !== "error") {
70637 issues = issues.filter(function(issue) {
70638 return issue.type !== "help_request";
70641 var section = severity + "-section";
70642 var issueItem = severity + "-item";
70643 var container = selection2.selectAll("." + section).data(issues.length ? [0] : []);
70644 container.exit().remove();
70645 var containerEnter = container.enter().append("div").attr("class", "modal-section " + section + " fillL2");
70646 containerEnter.append("h3").call(severity === "warning" ? _t.append("commit.warnings") : _t.append("commit.errors"));
70647 containerEnter.append("ul").attr("class", "changeset-list");
70648 container = containerEnter.merge(container);
70649 var items = container.select("ul").selectAll("li").data(issues, function(d2) {
70652 items.exit().remove();
70653 var itemsEnter = items.enter().append("li").attr("class", issueItem);
70654 var buttons = itemsEnter.append("button").on("mouseover", function(d3_event, d2) {
70655 if (d2.entityIds) {
70656 context.surface().selectAll(
70657 utilEntityOrMemberSelector(
70661 ).classed("hover", true);
70663 }).on("mouseout", function() {
70664 context.surface().selectAll(".hover").classed("hover", false);
70665 }).on("click", function(d3_event, d2) {
70666 context.validator().focusIssue(d2);
70668 buttons.call(svgIcon("#iD-icon-alert", "pre-text"));
70669 buttons.append("strong").attr("class", "issue-message");
70670 buttons.filter(function(d2) {
70673 uiTooltip().title(function(d2) {
70675 }).placement("top")
70677 items = itemsEnter.merge(items);
70678 items.selectAll(".issue-message").text("").each(function(d2) {
70679 return d2.message(context)(select_default2(this));
70683 return commitWarnings;
70686 // modules/ui/lasso.js
70687 function uiLasso(context) {
70688 var group, polygon2;
70689 lasso.coordinates = [];
70690 function lasso(selection2) {
70691 context.container().classed("lasso", true);
70692 group = selection2.append("g").attr("class", "lasso hide");
70693 polygon2 = group.append("path").attr("class", "lasso-path");
70694 group.call(uiToggle(true));
70698 polygon2.data([lasso.coordinates]).attr("d", function(d2) {
70699 return "M" + d2.join(" L") + " Z";
70703 lasso.extent = function() {
70704 return lasso.coordinates.reduce(function(extent, point) {
70705 return extent.extend(geoExtent(point));
70708 lasso.p = function(_2) {
70709 if (!arguments.length) return lasso;
70710 lasso.coordinates.push(_2);
70714 lasso.close = function() {
70716 group.call(uiToggle(false, function() {
70717 select_default2(this).remove();
70720 context.container().classed("lasso", false);
70725 // node_modules/osm-community-index/lib/simplify.js
70726 var import_diacritics2 = __toESM(require_diacritics(), 1);
70727 function simplify(str) {
70728 if (typeof str !== "string") return "";
70729 return import_diacritics2.default.remove(
70730 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()
70734 // node_modules/osm-community-index/lib/resolve_strings.js
70735 function resolveStrings(item, defaults, localizerFn) {
70736 let itemStrings = Object.assign({}, item.strings);
70737 let defaultStrings = Object.assign({}, defaults[item.type]);
70738 const anyToken = new RegExp(/(\{\w+\})/, "gi");
70740 if (itemStrings.community) {
70741 const communityID = simplify(itemStrings.community);
70742 itemStrings.community = localizerFn("_communities.".concat(communityID));
70744 ["name", "description", "extendedDescription"].forEach((prop) => {
70745 if (defaultStrings[prop]) defaultStrings[prop] = localizerFn("_defaults.".concat(item.type, ".").concat(prop));
70746 if (itemStrings[prop]) itemStrings[prop] = localizerFn("".concat(item.id, ".").concat(prop));
70749 let replacements = {
70750 account: item.account,
70751 community: itemStrings.community,
70752 signupUrl: itemStrings.signupUrl,
70753 url: itemStrings.url
70755 if (!replacements.signupUrl) {
70756 replacements.signupUrl = resolve(itemStrings.signupUrl || defaultStrings.signupUrl);
70758 if (!replacements.url) {
70759 replacements.url = resolve(itemStrings.url || defaultStrings.url);
70762 name: resolve(itemStrings.name || defaultStrings.name),
70763 url: resolve(itemStrings.url || defaultStrings.url),
70764 signupUrl: resolve(itemStrings.signupUrl || defaultStrings.signupUrl),
70765 description: resolve(itemStrings.description || defaultStrings.description),
70766 extendedDescription: resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription)
70768 resolved.nameHTML = linkify(resolved.url, resolved.name);
70769 resolved.urlHTML = linkify(resolved.url);
70770 resolved.signupUrlHTML = linkify(resolved.signupUrl);
70771 resolved.descriptionHTML = resolve(itemStrings.description || defaultStrings.description, true);
70772 resolved.extendedDescriptionHTML = resolve(itemStrings.extendedDescription || defaultStrings.extendedDescription, true);
70774 function resolve(s2, addLinks) {
70775 if (!s2) return void 0;
70777 for (let key in replacements) {
70778 const token = "{".concat(key, "}");
70779 const regex = new RegExp(token, "g");
70780 if (regex.test(result)) {
70781 let replacement = replacements[key];
70782 if (!replacement) {
70783 throw new Error("Cannot resolve token: ".concat(token));
70785 if (addLinks && (key === "signupUrl" || key === "url")) {
70786 replacement = linkify(replacement);
70788 result = result.replace(regex, replacement);
70792 const leftovers = result.match(anyToken);
70794 throw new Error("Cannot resolve tokens: ".concat(leftovers));
70796 if (addLinks && item.type === "reddit") {
70797 result = result.replace(/(\/r\/\w+\/*)/i, (match) => linkify(resolved.url, match));
70801 function linkify(url, text) {
70802 if (!url) return void 0;
70803 text = text || url;
70804 return '<a target="_blank" href="'.concat(url, '">').concat(text, "</a>");
70808 // modules/ui/success.js
70810 function uiSuccess(context) {
70811 const MAXEVENTS = 2;
70812 const dispatch14 = dispatch_default("cancel");
70815 ensureOSMCommunityIndex();
70816 function ensureOSMCommunityIndex() {
70817 const data = _mainFileFetcher;
70818 return Promise.all([
70819 data.get("oci_features"),
70820 data.get("oci_resources"),
70821 data.get("oci_defaults")
70822 ]).then((vals) => {
70823 if (_oci) return _oci;
70824 if (vals[0] && Array.isArray(vals[0].features)) {
70825 _sharedLocationManager.mergeCustomGeoJSON(vals[0]);
70827 let ociResources = Object.values(vals[1].resources);
70828 if (ociResources.length) {
70829 return _sharedLocationManager.mergeLocationSets(ociResources).then(() => {
70831 resources: ociResources,
70832 defaults: vals[2].defaults
70840 defaults: vals[2].defaults
70846 function parseEventDate(when) {
70848 let raw = when.trim();
70850 if (!/Z$/.test(raw)) {
70853 const parsed = new Date(raw);
70854 return new Date(parsed.toUTCString().slice(0, 25));
70856 function success(selection2) {
70857 let header = selection2.append("div").attr("class", "header fillL");
70858 header.append("h2").call(_t.append("success.just_edited"));
70859 header.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", () => dispatch14.call("cancel")).call(svgIcon("#iD-icon-close"));
70860 let body = selection2.append("div").attr("class", "body save-success fillL");
70861 let summary = body.append("div").attr("class", "save-summary");
70862 summary.append("h3").call(_t.append("success.thank_you" + (_location ? "_location" : ""), { where: _location }));
70863 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"));
70864 let osm = context.connection();
70866 let changesetURL = osm.changesetURL(_changeset2.id);
70867 let table = summary.append("table").attr("class", "summary-table");
70868 let row = table.append("tr").attr("class", "summary-row");
70869 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");
70870 let summaryDetail = row.append("td").attr("class", "cell-detail summary-detail");
70871 summaryDetail.append("a").attr("class", "cell-detail summary-view-on-osm").attr("target", "_blank").attr("href", changesetURL).call(_t.append("success.view_on_osm"));
70872 summaryDetail.append("div").html(_t.html("success.changeset_id", {
70873 changeset_id: { html: '<a href="'.concat(changesetURL, '" target="_blank">').concat(_changeset2.id, "</a>") }
70875 if (showDonationMessage !== false) {
70876 const donationUrl = "https://supporting.openstreetmap.org/";
70877 let supporting = body.append("div").attr("class", "save-supporting");
70878 supporting.append("h3").call(_t.append("success.supporting.title"));
70879 supporting.append("p").call(_t.append("success.supporting.details"));
70880 table = supporting.append("table").attr("class", "supporting-table");
70881 row = table.append("tr").attr("class", "supporting-row");
70882 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");
70883 let supportingDetail = row.append("td").attr("class", "cell-detail supporting-detail");
70884 supportingDetail.append("a").attr("class", "cell-detail support-the-map").attr("target", "_blank").attr("href", donationUrl).call(_t.append("success.supporting.donation.title"));
70885 supportingDetail.append("div").call(_t.append("success.supporting.donation.details"));
70887 ensureOSMCommunityIndex().then((oci) => {
70888 const loc = context.map().center();
70889 const validHere = _sharedLocationManager.locationSetsAt(loc);
70890 let communities = [];
70891 oci.resources.forEach((resource) => {
70892 let area = validHere[resource.locationSetID];
70894 const localizer = (stringID) => _t.html("community.".concat(stringID));
70895 resource.resolved = resolveStrings(resource, oci.defaults, localizer);
70898 order: resource.order || 0,
70902 communities.sort((a2, b2) => a2.area - b2.area || b2.order - a2.order);
70903 body.call(showCommunityLinks, communities.map((c2) => c2.resource));
70906 function showCommunityLinks(selection2, resources) {
70907 let communityLinks = selection2.append("div").attr("class", "save-communityLinks");
70908 communityLinks.append("h3").call(_t.append("success.like_osm"));
70909 let table = communityLinks.append("table").attr("class", "community-table");
70910 let row = table.selectAll(".community-row").data(resources);
70911 let rowEnter = row.enter().append("tr").attr("class", "community-row");
70912 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));
70913 let communityDetail = rowEnter.append("td").attr("class", "cell-detail community-detail");
70914 communityDetail.each(showCommunityDetails);
70915 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"));
70917 function showCommunityDetails(d2) {
70918 let selection2 = select_default2(this);
70919 let communityID = d2.id;
70920 selection2.append("div").attr("class", "community-name").html(d2.resolved.nameHTML);
70921 selection2.append("div").attr("class", "community-description").html(d2.resolved.descriptionHTML);
70922 if (d2.resolved.extendedDescriptionHTML || d2.languageCodes && d2.languageCodes.length) {
70923 selection2.append("div").call(
70924 uiDisclosure(context, "community-more-".concat(d2.id), false).expanded(false).updatePreference(false).label(() => _t.append("success.more")).content(showMore)
70927 let nextEvents = (d2.events || []).map((event) => {
70928 event.date = parseEventDate(event.when);
70930 }).filter((event) => {
70931 const t2 = event.date.getTime();
70932 const now3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
70933 return !isNaN(t2) && t2 >= now3;
70934 }).sort((a2, b2) => {
70935 return a2.date < b2.date ? -1 : a2.date > b2.date ? 1 : 0;
70936 }).slice(0, MAXEVENTS);
70937 if (nextEvents.length) {
70938 selection2.append("div").call(
70939 uiDisclosure(context, "community-events-".concat(d2.id), false).expanded(false).updatePreference(false).label(_t.html("success.events")).content(showNextEvents)
70940 ).select(".hide-toggle").append("span").attr("class", "badge-text").text(nextEvents.length);
70942 function showMore(selection3) {
70943 let more = selection3.selectAll(".community-more").data([0]);
70944 let moreEnter = more.enter().append("div").attr("class", "community-more");
70945 if (d2.resolved.extendedDescriptionHTML) {
70946 moreEnter.append("div").attr("class", "community-extended-description").html(d2.resolved.extendedDescriptionHTML);
70948 if (d2.languageCodes && d2.languageCodes.length) {
70949 const languageList = d2.languageCodes.map((code) => _mainLocalizer.languageName(code)).join(", ");
70950 moreEnter.append("div").attr("class", "community-languages").call(_t.append("success.languages", { languages: languageList }));
70953 function showNextEvents(selection3) {
70954 let events = selection3.append("div").attr("class", "community-events");
70955 let item = events.selectAll(".community-event").data(nextEvents);
70956 let itemEnter = item.enter().append("div").attr("class", "community-event");
70957 itemEnter.append("div").attr("class", "community-event-name").append("a").attr("target", "_blank").attr("href", (d4) => d4.url).text((d4) => {
70958 let name = d4.name;
70959 if (d4.i18n && d4.id) {
70960 name = _t("community.".concat(communityID, ".events.").concat(d4.id, ".name"), { default: name });
70964 itemEnter.append("div").attr("class", "community-event-when").text((d4) => {
70965 let options2 = { weekday: "short", day: "numeric", month: "short", year: "numeric" };
70966 if (d4.date.getHours() || d4.date.getMinutes()) {
70967 options2.hour = "numeric";
70968 options2.minute = "numeric";
70970 return d4.date.toLocaleString(_mainLocalizer.localeCode(), options2);
70972 itemEnter.append("div").attr("class", "community-event-where").text((d4) => {
70973 let where = d4.where;
70974 if (d4.i18n && d4.id) {
70975 where = _t("community.".concat(communityID, ".events.").concat(d4.id, ".where"), { default: where });
70979 itemEnter.append("div").attr("class", "community-event-description").text((d4) => {
70980 let description = d4.description;
70981 if (d4.i18n && d4.id) {
70982 description = _t("community.".concat(communityID, ".events.").concat(d4.id, ".description"), { default: description });
70984 return description;
70988 success.changeset = function(val) {
70989 if (!arguments.length) return _changeset2;
70993 success.location = function(val) {
70994 if (!arguments.length) return _location;
70998 return utilRebind(success, dispatch14, "on");
71001 // modules/ui/fields/input.js
71002 var likelyRawNumberFormat = /^-?(0\.\d*|\d*\.\d{0,2}(\d{4,})?|\d{4,}\.\d{3})$/;
71003 function uiFieldText(field, context) {
71004 var dispatch14 = dispatch_default("change");
71005 var input = select_default2(null);
71006 var outlinkButton = select_default2(null);
71007 var wrap2 = select_default2(null);
71008 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
71009 var _entityIDs = [];
71011 var _phoneFormats = {};
71012 const isDirectionField = field.key.split(":").some((keyPart) => keyPart === "direction");
71013 const formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
71014 const parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
71015 const countDecimalPlaces = _mainLocalizer.decimalPlaceCounter(_mainLocalizer.languageCode());
71016 if (field.type === "tel") {
71017 _mainFileFetcher.get("phone_formats").then(function(d2) {
71018 _phoneFormats = d2;
71019 updatePhonePlaceholder();
71020 }).catch(function() {
71023 function calcLocked() {
71024 var isLocked = (field.id === "brand" || field.id === "network" || field.id === "operator" || field.id === "flag") && _entityIDs.length && _entityIDs.some(function(entityID) {
71025 var entity = context.graph().hasEntity(entityID);
71026 if (!entity) return false;
71027 if (entity.tags.wikidata) return true;
71028 var preset = _mainPresetIndex.match(entity, context.graph());
71029 var isSuggestion = preset && preset.suggestion;
71030 var which = field.id;
71031 return isSuggestion && !!entity.tags[which] && !!entity.tags[which + ":wikidata"];
71033 field.locked(isLocked);
71035 function i3(selection2) {
71037 var isLocked = field.locked();
71038 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71039 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71040 input = wrap2.selectAll("input").data([0]);
71041 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);
71042 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
71043 wrap2.call(_lengthIndicator);
71044 if (field.type === "tel") {
71045 updatePhonePlaceholder();
71046 } else if (field.type === "number") {
71047 var rtl = _mainLocalizer.textDirection() === "rtl";
71048 input.attr("type", "text");
71049 var inc = field.increment;
71050 var buttons = wrap2.selectAll(".increment, .decrement").data(rtl ? [inc, -inc] : [-inc, inc]);
71051 buttons.enter().append("button").attr("class", function(d2) {
71052 var which = d2 > 0 ? "increment" : "decrement";
71053 return "form-field-button " + which;
71054 }).attr("title", function(d2) {
71055 var which = d2 > 0 ? "increment" : "decrement";
71056 return _t("inspector.".concat(which));
71057 }).merge(buttons).on("click", function(d3_event, d2) {
71058 d3_event.preventDefault();
71059 var isMixed = Array.isArray(_tags[field.key]);
71060 if (isMixed) return;
71061 var raw_vals = input.node().value || "0";
71062 var vals = raw_vals.split(";");
71063 vals = vals.map(function(v2) {
71065 const isRawNumber = likelyRawNumberFormat.test(v2);
71066 var num = isRawNumber ? parseFloat(v2) : parseLocaleFloat(v2);
71067 if (isDirectionField) {
71068 const compassDir = cardinal[v2.toLowerCase()];
71069 if (compassDir !== void 0) {
71073 if (!isFinite(num)) return v2;
71074 num = parseFloat(num);
71075 if (!isFinite(num)) return v2;
71077 if (isDirectionField) {
71078 num = (num % 360 + 360) % 360;
71080 return formatFloat(clamped(num), isRawNumber ? v2.includes(".") ? v2.split(".")[1].length : 0 : countDecimalPlaces(v2));
71082 input.node().value = vals.join(";");
71085 } else if (field.type === "identifier" && field.urlFormat && field.pattern) {
71086 input.attr("type", "text");
71087 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
71088 outlinkButton = outlinkButton.enter().append("button").call(svgIcon("#iD-icon-out-link")).attr("class", "form-field-button foreign-id-permalink").attr("title", function() {
71089 var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
71090 if (domainResults.length >= 2 && domainResults[1]) {
71091 var domain = domainResults[1];
71092 return _t("icons.view_on", { domain });
71095 }).merge(outlinkButton);
71096 outlinkButton.on("click", function(d3_event) {
71097 d3_event.preventDefault();
71098 var value = validIdentifierValueForLink();
71100 var url = field.urlFormat.replace(/{value}/, encodeURIComponent(value));
71101 window.open(url, "_blank");
71103 }).classed("disabled", () => !validIdentifierValueForLink()).merge(outlinkButton);
71104 } else if (field.type === "url") {
71105 input.attr("type", "text");
71106 outlinkButton = wrap2.selectAll(".foreign-id-permalink").data([0]);
71107 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) {
71108 d3_event.preventDefault();
71109 const value = validIdentifierValueForLink();
71110 if (value) window.open(value, "_blank");
71111 }).merge(outlinkButton);
71112 } else if (field.type === "colour") {
71113 input.attr("type", "text");
71114 updateColourPreview();
71115 } else if (field.type === "date") {
71116 input.attr("type", "text");
71120 function updateColourPreview() {
71121 wrap2.selectAll(".colour-preview").remove();
71122 const colour = utilGetSetValue(input);
71123 if (!isColourValid(colour) && colour !== "") {
71124 wrap2.selectAll("input.colour-selector").remove();
71125 wrap2.selectAll(".form-field-button").remove();
71128 var colourSelector = wrap2.selectAll(".colour-selector").data([0]);
71129 colourSelector.enter().append("input").attr("type", "color").attr("class", "colour-selector").on("input", debounce_default(function(d3_event) {
71130 d3_event.preventDefault();
71131 var colour2 = this.value;
71132 if (!isColourValid(colour2)) return;
71133 utilGetSetValue(input, this.value);
71135 updateColourPreview();
71137 wrap2.selectAll("input.colour-selector").attr("value", colour);
71138 var chooserButton = wrap2.selectAll(".colour-preview").data([colour]);
71139 chooserButton = chooserButton.enter().append("div").attr("class", "form-field-button colour-preview").append("div").style("background-color", (d2) => d2).attr("class", "colour-box");
71140 if (colour === "") {
71141 chooserButton = chooserButton.call(svgIcon("#iD-icon-edit"));
71143 chooserButton.on("click", () => wrap2.select(".colour-selector").node().showPicker());
71145 function updateDateField() {
71146 function isDateValid(date2) {
71147 return date2.match(/^[0-9]{4}(-[0-9]{2}(-[0-9]{2})?)?$/);
71149 const date = utilGetSetValue(input);
71150 const now3 = /* @__PURE__ */ new Date();
71151 const today = new Date(now3.getTime() - now3.getTimezoneOffset() * 6e4).toISOString().split("T")[0];
71152 if ((field.key === "check_date" || field.key === "survey:date") && date !== today) {
71153 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", () => {
71154 utilGetSetValue(input, today);
71159 wrap2.selectAll(".date-set-today").remove();
71161 if (!isDateValid(date) && date !== "") {
71162 wrap2.selectAll("input.date-selector").remove();
71163 wrap2.selectAll(".date-calendar").remove();
71166 if (utilDetect().browser !== "Safari") {
71167 var dateSelector = wrap2.selectAll(".date-selector").data([0]);
71168 dateSelector.enter().append("input").attr("type", "date").attr("class", "date-selector").on("input", debounce_default(function(d3_event) {
71169 d3_event.preventDefault();
71170 var date2 = this.value;
71171 if (!isDateValid(date2)) return;
71172 utilGetSetValue(input, this.value);
71176 wrap2.selectAll("input.date-selector").attr("value", date);
71177 var calendarButton = wrap2.selectAll(".date-calendar").data([date]);
71178 calendarButton = calendarButton.enter().append("button").attr("class", "form-field-button date-calendar").call(svgIcon("#fas-calendar-days"));
71179 calendarButton.on("click", () => wrap2.select(".date-selector").node().showPicker());
71182 function updatePhonePlaceholder() {
71183 if (input.empty() || !Object.keys(_phoneFormats).length) return;
71184 var extent = combinedEntityExtent();
71185 var countryCode = extent && iso1A2Code(extent.center());
71186 var format2 = countryCode && _phoneFormats[countryCode.toLowerCase()];
71187 if (format2) input.attr("placeholder", format2);
71189 function validIdentifierValueForLink() {
71191 const value = utilGetSetValue(input).trim();
71192 if (field.type === "url" && value) {
71194 return new URL(value).href;
71199 if (field.type === "identifier" && field.pattern) {
71200 return value && ((_a3 = value.match(new RegExp(field.pattern))) == null ? void 0 : _a3[0]);
71204 function clamped(num) {
71205 if (field.minValue !== void 0) {
71206 num = Math.max(num, field.minValue);
71208 if (field.maxValue !== void 0) {
71209 num = Math.min(num, field.maxValue);
71213 function getVals(tags) {
71215 const multiSelection = context.selectedIDs();
71216 tags = multiSelection.length > 1 ? context.selectedIDs().map((id2) => context.graph().entity(id2)).map((entity) => entity.tags) : [tags];
71217 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]));
71219 return new Set([].concat(tags[field.key]));
71222 function change(onInput) {
71223 return function() {
71225 var val = utilGetSetValue(input);
71226 if (!onInput) val = context.cleanTagValue(val);
71227 if (!val && getVals(_tags).size > 1) return;
71228 var displayVal = val;
71229 if (field.type === "number" && val) {
71230 var numbers2 = val.split(";");
71231 numbers2 = numbers2.map(function(v2) {
71232 if (likelyRawNumberFormat.test(v2)) {
71235 var num = parseLocaleFloat(v2);
71236 const fractionDigits = countDecimalPlaces(v2);
71237 return isFinite(num) ? clamped(num).toFixed(fractionDigits) : v2;
71239 val = numbers2.join(";");
71241 if (!onInput) utilGetSetValue(input, displayVal);
71242 t2[field.key] = val || void 0;
71244 dispatch14.call("change", this, (tags) => {
71245 if (field.keys.some((key) => tags[key])) {
71246 field.keys.filter((key) => tags[key]).forEach((key) => {
71247 tags[key] = val || void 0;
71250 tags[field.key] = val || void 0;
71255 dispatch14.call("change", this, t2, onInput);
71259 i3.entityIDs = function(val) {
71260 if (!arguments.length) return _entityIDs;
71264 i3.tags = function(tags) {
71267 const vals = getVals(tags);
71268 const isMixed = vals.size > 1;
71269 var val = vals.size === 1 ? (_a3 = [...vals][0]) != null ? _a3 : "" : "";
71271 if (field.type === "number" && val) {
71272 var numbers2 = val.split(";");
71273 var oriNumbers = utilGetSetValue(input).split(";");
71274 if (numbers2.length !== oriNumbers.length) shouldUpdate = true;
71275 numbers2 = numbers2.map(function(v2) {
71277 var num = Number(v2);
71278 if (!isFinite(num) || v2 === "") return v2;
71279 const fractionDigits = v2.includes(".") ? v2.split(".")[1].length : 0;
71280 return formatFloat(num, fractionDigits);
71282 val = numbers2.join(";");
71283 shouldUpdate = (inputValue, setValue) => {
71284 const inputNums = inputValue.split(";").map(
71285 (setVal) => likelyRawNumberFormat.test(setVal) ? parseFloat(setVal) : parseLocaleFloat(setVal)
71287 const setNums = setValue.split(";").map(parseLocaleFloat);
71288 return !isEqual_default(inputNums, setNums);
71291 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);
71292 if (field.type === "number") {
71293 const buttons = wrap2.selectAll(".increment, .decrement");
71295 buttons.attr("disabled", "disabled").classed("disabled", true);
71297 var raw_vals = tags[field.key] || "0";
71298 const canIncDec = raw_vals.split(";").some((val2) => isFinite(Number(val2)) || isDirectionField && cardinal[val2.trim().toLowerCase()]);
71299 buttons.attr("disabled", canIncDec ? null : "disabled").classed("disabled", !canIncDec);
71302 if (field.type === "tel") updatePhonePlaceholder();
71303 if (field.type === "colour") updateColourPreview();
71304 if (field.type === "date") updateDateField();
71305 if (outlinkButton && !outlinkButton.empty()) {
71306 var disabled = !validIdentifierValueForLink();
71307 outlinkButton.classed("disabled", disabled);
71310 _lengthIndicator.update(tags[field.key]);
71313 i3.focus = function() {
71314 var node = input.node();
71315 if (node) node.focus();
71317 function combinedEntityExtent() {
71318 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
71320 return utilRebind(i3, dispatch14, "on");
71323 // modules/ui/fields/access.js
71324 function uiFieldAccess(field, context) {
71325 var dispatch14 = dispatch_default("change");
71326 var items = select_default2(null);
71328 function access(selection2) {
71329 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71330 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71331 var list2 = wrap2.selectAll("ul").data([0]);
71332 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
71333 items = list2.selectAll("li").data(field.keys);
71334 var enter = items.enter().append("li").attr("class", function(d2) {
71335 return "labeled-input preset-access-" + d2;
71337 enter.append("div").attr("class", "label preset-label-access").attr("for", function(d2) {
71338 return "preset-input-access-" + d2;
71339 }).html(function(d2) {
71340 return field.t.html("types." + d2);
71342 enter.append("div").attr("class", "preset-input-access-wrap").append("input").attr("type", "text").attr("class", function(d2) {
71343 return "preset-input-access preset-input-access-" + d2;
71344 }).call(utilNoAuto).each(function(d2) {
71345 select_default2(this).call(
71346 uiCombobox(context, "access-" + d2).data(access.options(d2))
71349 items = items.merge(enter);
71350 wrap2.selectAll(".preset-input-access").on("change", change).on("blur", change);
71352 function change(d3_event, d2) {
71354 var value = context.cleanTagValue(utilGetSetValue(select_default2(this)));
71355 if (!value && typeof _tags[d2] !== "string") return;
71356 tag2[d2] = value || void 0;
71357 dispatch14.call("change", this, tag2);
71359 access.options = function(type2) {
71371 if (type2 === "access") {
71372 options2 = options2.filter((v2) => v2 !== "yes" && v2 !== "designated");
71374 if (type2 === "bicycle") {
71375 options2.splice(options2.length - 4, 0, "dismount");
71377 var stringsField = field.resolveReference("stringsCrossReference");
71378 return options2.map(function(option) {
71380 title: stringsField.t("options." + option + ".description"),
71385 const placeholdersByTag = {
71388 foot: "designated",
71389 motor_vehicle: "no"
71393 motor_vehicle: "no",
71399 motor_vehicle: "no",
71405 motor_vehicle: "no"
71408 motor_vehicle: "no",
71409 bicycle: "designated"
71412 motor_vehicle: "no",
71413 horse: "designated"
71417 motor_vehicle: "no",
71423 motor_vehicle: "yes",
71428 motor_vehicle: "yes"
71432 motor_vehicle: "yes",
71438 motor_vehicle: "yes",
71444 motor_vehicle: "yes",
71450 motor_vehicle: "yes",
71456 motor_vehicle: "yes",
71462 motor_vehicle: "yes",
71468 motor_vehicle: "yes",
71473 motor_vehicle: "yes"
71477 motor_vehicle: "yes",
71483 motor_vehicle: "yes",
71489 motor_vehicle: "yes",
71509 motor_vehicle: "no",
71521 motor_vehicle: "no"
71538 motorcycle_barrier: {
71539 motor_vehicle: "no"
71546 access.tags = function(tags) {
71548 utilGetSetValue(items.selectAll(".preset-input-access"), function(d2) {
71549 return typeof tags[d2] === "string" ? tags[d2] : "";
71550 }).classed("mixed", function(d2) {
71551 return tags[d2] && Array.isArray(tags[d2]);
71552 }).attr("title", function(d2) {
71553 return tags[d2] && Array.isArray(tags[d2]) && tags[d2].filter(Boolean).join("\n");
71554 }).attr("placeholder", function(d2) {
71555 if (tags[d2] && Array.isArray(tags[d2])) {
71556 return _t("inspector.multiple_values");
71558 if (d2 === "bicycle" || d2 === "motor_vehicle") {
71559 if (tags.vehicle && typeof tags.vehicle === "string") {
71560 return tags.vehicle;
71563 if (tags.access && typeof tags.access === "string") {
71564 return tags.access;
71566 function getPlaceholdersByTag(key, placeholdersByKey) {
71567 if (typeof tags[key] === "string") {
71568 if (placeholdersByKey[tags[key]] && placeholdersByKey[tags[key]][d2]) {
71569 return placeholdersByKey[tags[key]][d2];
71572 var impliedAccesses = tags[key].filter(Boolean).map(function(val) {
71573 return placeholdersByKey[val] && placeholdersByKey[val][d2];
71574 }).filter(Boolean);
71575 if (impliedAccesses.length === tags[key].length && new Set(impliedAccesses).size === 1) {
71576 return impliedAccesses[0];
71580 for (const key in placeholdersByTag) {
71582 const impliedAccess = getPlaceholdersByTag(key, placeholdersByTag[key]);
71583 if (impliedAccess) {
71584 return impliedAccess;
71588 if (d2 === "access" && !tags.barrier) {
71591 return field.placeholder();
71594 access.focus = function() {
71595 items.selectAll(".preset-input-access").node().focus();
71597 return utilRebind(access, dispatch14, "on");
71600 // modules/ui/fields/address.js
71601 function uiFieldAddress(field, context) {
71602 var dispatch14 = dispatch_default("change");
71603 var _selection = select_default2(null);
71604 var _wrap = select_default2(null);
71605 var addrField = _mainPresetIndex.field("address");
71606 var _entityIDs = [];
71609 var _addressFormats = [{
71611 ["housenumber", "street"],
71612 ["city", "postcode"]
71615 _mainFileFetcher.get("address_formats").then(function(d2) {
71616 _addressFormats = d2;
71617 if (!_selection.empty()) {
71618 _selection.call(address);
71620 }).catch(function() {
71622 function getNear(isAddressable, type2, searchRadius, resultProp) {
71623 var extent = combinedEntityExtent();
71624 var l2 = extent.center();
71625 var box = geoExtent(l2).padByMeters(searchRadius);
71626 var features = context.history().intersects(box).filter(isAddressable).map((d2) => {
71627 let dist = geoSphericalDistance(d2.extent(context.graph()).center(), l2);
71628 if (d2.geometry(context.graph()) === "line") {
71629 var loc = context.projection([
71630 (extent[0][0] + extent[1][0]) / 2,
71631 (extent[0][1] + extent[1][1]) / 2
71633 var choice = geoChooseEdge(context.graph().childNodes(d2), loc, context.projection);
71634 dist = geoSphericalDistance(choice.loc, l2);
71636 const value = resultProp && d2.tags[resultProp] ? d2.tags[resultProp] : d2.tags.name;
71638 if (type2 === "street") {
71639 title = "".concat(addrField.t("placeholders.street"), ": ").concat(title);
71640 } else if (type2 === "place") {
71641 title = "".concat(addrField.t("placeholders.place"), ": ").concat(title);
71648 klass: "address-".concat(type2)
71650 }).sort(function(a2, b2) {
71651 return a2.dist - b2.dist;
71653 return utilArrayUniqBy(features, "value");
71655 function getNearStreets() {
71656 function isAddressable(d2) {
71657 return d2.tags.highway && d2.tags.name && d2.type === "way";
71659 return getNear(isAddressable, "street", 200);
71661 function getNearPlaces() {
71662 function isAddressable(d2) {
71663 if (d2.tags.name) {
71664 if (d2.tags.place) return true;
71665 if (d2.tags.boundary === "administrative" && d2.tags.admin_level > 8) return true;
71669 return getNear(isAddressable, "place", 200);
71671 function getNearCities() {
71672 function isAddressable(d2) {
71673 if (d2.tags.name) {
71674 if (d2.tags.boundary === "administrative" && d2.tags.admin_level === "8") return true;
71675 if (d2.tags.border_type === "city") return true;
71676 if (d2.tags.place === "city" || d2.tags.place === "town" || d2.tags.place === "village") return true;
71678 if (d2.tags["".concat(field.key, ":city")]) return true;
71681 return getNear(isAddressable, "city", 200, "".concat(field.key, ":city"));
71683 function getNearPostcodes() {
71684 return [...new Set([].concat(getNearValues("postcode")).concat(getNear((d2) => d2.tags.postal_code, "postcode", 200, "postal_code")))];
71686 function getNearValues(key) {
71687 const tagKey = "".concat(field.key, ":").concat(key);
71688 function hasTag(d2) {
71689 return _entityIDs.indexOf(d2.id) === -1 && d2.tags[tagKey];
71691 return getNear(hasTag, key, 200, tagKey);
71693 function updateForCountryCode() {
71694 if (!_countryCode) return;
71696 for (var i3 = 0; i3 < _addressFormats.length; i3++) {
71697 var format2 = _addressFormats[i3];
71698 if (!format2.countryCodes) {
71699 addressFormat = format2;
71700 } else if (format2.countryCodes.indexOf(_countryCode) !== -1) {
71701 addressFormat = format2;
71705 var dropdowns = addressFormat.dropdowns || [
71722 var widths = addressFormat.widths || {
71723 housenumber: 1 / 5,
71732 var total = r2.reduce(function(sum, key) {
71733 return sum + (widths[key] || 0.5);
71735 return r2.map(function(key) {
71738 width: (widths[key] || 0.5) / total
71742 var rows = _wrap.selectAll(".addr-row").data(addressFormat.format, function(d2) {
71743 return d2.toString();
71745 rows.exit().remove();
71746 rows.enter().append("div").attr("class", "addr-row").selectAll("input").data(row).enter().append("input").property("type", "text").call(updatePlaceholder).attr("class", function(d2) {
71747 return "addr-" + d2.id;
71748 }).call(utilNoAuto).each(addDropdown).style("width", function(d2) {
71749 return d2.width * 100 + "%";
71751 function addDropdown(d2) {
71752 if (dropdowns.indexOf(d2.id) === -1) return;
71756 nearValues = getNearStreets;
71759 nearValues = getNearPlaces;
71761 case "street+place":
71762 nearValues = () => [].concat(getNearStreets()).concat(getNearPlaces());
71763 d2.isAutoStreetPlace = true;
71764 d2.id = _tags["".concat(field.key, ":place")] ? "place" : "street";
71767 nearValues = getNearCities;
71770 nearValues = getNearPostcodes;
71773 nearValues = getNearValues;
71775 select_default2(this).call(
71776 uiCombobox(context, "address-".concat(d2.isAutoStreetPlace ? "street-place" : d2.id)).minItems(1).caseSensitive(true).fetcher(function(typedValue, callback) {
71777 typedValue = typedValue.toLowerCase();
71778 callback(nearValues(d2.id).filter((v2) => v2.value.toLowerCase().indexOf(typedValue) !== -1));
71779 }).on("accept", function(selected) {
71780 if (d2.isAutoStreetPlace) {
71781 d2.id = selected ? selected.type : "street";
71782 utilTriggerEvent(select_default2(this), "change");
71787 _wrap.selectAll("input").on("blur", change()).on("change", change());
71788 _wrap.selectAll("input:not(.combobox-input)").on("input", change(true));
71789 if (_tags) updateTags(_tags);
71791 function address(selection2) {
71792 _selection = selection2;
71793 _wrap = selection2.selectAll(".form-field-input-wrap").data([0]);
71794 _wrap = _wrap.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(_wrap);
71795 var extent = combinedEntityExtent();
71798 if (context.inIntro()) {
71799 countryCode = _t("intro.graph.countrycode");
71801 var center = extent.center();
71802 countryCode = iso1A2Code(center);
71805 _countryCode = countryCode.toLowerCase();
71806 updateForCountryCode();
71810 function change(onInput) {
71811 return function() {
71813 _wrap.selectAll("input").each(function(subfield) {
71814 var key = field.key + ":" + subfield.id;
71815 var value = this.value;
71816 if (!onInput) value = context.cleanTagValue(value);
71817 if (Array.isArray(_tags[key]) && !value) return;
71818 if (subfield.isAutoStreetPlace) {
71819 if (subfield.id === "street") {
71820 tags["".concat(field.key, ":place")] = void 0;
71821 } else if (subfield.id === "place") {
71822 tags["".concat(field.key, ":street")] = void 0;
71825 tags[key] = value || void 0;
71827 Object.keys(tags).filter((k2) => tags[k2]).forEach((k2) => _tags[k2] = tags[k2]);
71828 dispatch14.call("change", this, tags, onInput);
71831 function updatePlaceholder(inputSelection) {
71832 return inputSelection.attr("placeholder", function(subfield) {
71833 if (_tags && Array.isArray(_tags[field.key + ":" + subfield.id])) {
71834 return _t("inspector.multiple_values");
71836 if (subfield.isAutoStreetPlace) {
71837 return "".concat(getLocalPlaceholder("street"), " / ").concat(getLocalPlaceholder("place"));
71839 return getLocalPlaceholder(subfield.id);
71842 function getLocalPlaceholder(key) {
71843 if (_countryCode) {
71844 var localkey = key + "!" + _countryCode;
71845 var tkey = addrField.hasTextForStringId("placeholders." + localkey) ? localkey : key;
71846 return addrField.t("placeholders." + tkey);
71849 function updateTags(tags) {
71850 utilGetSetValue(_wrap.selectAll("input"), (subfield) => {
71852 if (subfield.isAutoStreetPlace) {
71853 const streetKey = "".concat(field.key, ":street");
71854 const placeKey = "".concat(field.key, ":place");
71855 if (tags[streetKey] !== void 0 || tags[placeKey] === void 0) {
71856 val = tags[streetKey];
71857 subfield.id = "street";
71859 val = tags[placeKey];
71860 subfield.id = "place";
71863 val = tags["".concat(field.key, ":").concat(subfield.id)];
71865 return typeof val === "string" ? val : "";
71866 }).attr("title", function(subfield) {
71867 var val = tags[field.key + ":" + subfield.id];
71868 return val && Array.isArray(val) ? val.filter(Boolean).join("\n") : void 0;
71869 }).classed("mixed", function(subfield) {
71870 return Array.isArray(tags[field.key + ":" + subfield.id]);
71871 }).call(updatePlaceholder);
71873 function combinedEntityExtent() {
71874 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
71876 address.entityIDs = function(val) {
71877 if (!arguments.length) return _entityIDs;
71881 address.tags = function(tags) {
71885 address.focus = function() {
71886 var node = _wrap.selectAll("input").node();
71887 if (node) node.focus();
71889 return utilRebind(address, dispatch14, "on");
71892 // modules/ui/fields/directional_combo.js
71893 function uiFieldDirectionalCombo(field, context) {
71894 var dispatch14 = dispatch_default("change");
71895 var items = select_default2(null);
71896 var wrap2 = select_default2(null);
71899 if (field.type === "cycleway") {
71902 key: field.keys[0],
71903 keys: field.keys.slice(1)
71906 function directionalCombo(selection2) {
71907 function stripcolon(s2) {
71908 return s2.replace(":", "");
71910 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71911 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71912 var div = wrap2.selectAll("ul").data([0]);
71913 div = div.enter().append("ul").attr("class", "rows rows-table").merge(div);
71914 items = div.selectAll("li").data(field.keys);
71915 var enter = items.enter().append("li").attr("class", function(d2) {
71916 return "labeled-input preset-directionalcombo-" + stripcolon(d2);
71918 enter.append("div").attr("class", "label preset-label-directionalcombo").attr("for", function(d2) {
71919 return "preset-input-directionalcombo-" + stripcolon(d2);
71920 }).html(function(d2) {
71921 return field.t.html("types." + d2);
71923 enter.append("div").attr("class", "preset-input-directionalcombo-wrap form-field-input-wrap").each(function(key) {
71929 const combo = uiFieldCombo(subField, context);
71930 combo.on("change", (t2) => change(key, t2[key]));
71931 _combos[key] = combo;
71932 select_default2(this).call(combo);
71934 items = items.merge(enter);
71935 wrap2.selectAll(".preset-input-directionalcombo").on("change", change).on("blur", change);
71937 function change(key, newValue) {
71938 const commonKey = field.key;
71939 const otherKey = key === field.keys[0] ? field.keys[1] : field.keys[0];
71940 dispatch14.call("change", this, (tags) => {
71941 const otherValue = tags[otherKey] || tags[commonKey];
71942 if (newValue === otherValue) {
71943 tags[commonKey] = newValue;
71945 delete tags[otherKey];
71947 tags[key] = newValue;
71948 delete tags[commonKey];
71949 tags[otherKey] = otherValue;
71954 directionalCombo.tags = function(tags) {
71956 const commonKey = field.key;
71957 for (let key in _combos) {
71958 const uniqueValues = [...new Set([].concat(_tags[commonKey]).concat(_tags[key]).filter(Boolean))];
71959 _combos[key].tags({ [key]: uniqueValues.length > 1 ? uniqueValues : uniqueValues[0] });
71962 directionalCombo.focus = function() {
71963 var node = wrap2.selectAll("input").node();
71964 if (node) node.focus();
71966 return utilRebind(directionalCombo, dispatch14, "on");
71969 // modules/ui/fields/lanes.js
71970 function uiFieldLanes(field, context) {
71971 var dispatch14 = dispatch_default("change");
71972 var LANE_WIDTH = 40;
71973 var LANE_HEIGHT = 200;
71974 var _entityIDs = [];
71975 function lanes(selection2) {
71976 var lanesData = context.entity(_entityIDs[0]).lanes();
71977 if (!context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode) {
71978 selection2.call(lanes.off);
71981 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
71982 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
71983 var surface = wrap2.selectAll(".surface").data([0]);
71984 var d2 = utilGetDimensions(wrap2);
71985 var freeSpace = d2[0] - lanesData.lanes.length * LANE_WIDTH * 1.5 + LANE_WIDTH * 0.5;
71986 surface = surface.enter().append("svg").attr("width", d2[0]).attr("height", 300).attr("class", "surface").merge(surface);
71987 var lanesSelection = surface.selectAll(".lanes").data([0]);
71988 lanesSelection = lanesSelection.enter().append("g").attr("class", "lanes").merge(lanesSelection);
71989 lanesSelection.attr("transform", function() {
71990 return "translate(" + freeSpace / 2 + ", 0)";
71992 var lane = lanesSelection.selectAll(".lane").data(lanesData.lanes);
71993 lane.exit().remove();
71994 var enter = lane.enter().append("g").attr("class", "lane");
71995 enter.append("g").append("rect").attr("y", 50).attr("width", LANE_WIDTH).attr("height", LANE_HEIGHT);
71996 enter.append("g").attr("class", "forward").append("text").attr("y", 40).attr("x", 14).text("\u25B2");
71997 enter.append("g").attr("class", "bothways").append("text").attr("y", 40).attr("x", 14).text("\u25B2\u25BC");
71998 enter.append("g").attr("class", "backward").append("text").attr("y", 40).attr("x", 14).text("\u25BC");
71999 lane = lane.merge(enter);
72000 lane.attr("transform", function(d4) {
72001 return "translate(" + LANE_WIDTH * d4.index * 1.5 + ", 0)";
72003 lane.select(".forward").style("visibility", function(d4) {
72004 return d4.direction === "forward" ? "visible" : "hidden";
72006 lane.select(".bothways").style("visibility", function(d4) {
72007 return d4.direction === "bothways" ? "visible" : "hidden";
72009 lane.select(".backward").style("visibility", function(d4) {
72010 return d4.direction === "backward" ? "visible" : "hidden";
72013 lanes.entityIDs = function(val) {
72016 lanes.tags = function() {
72018 lanes.focus = function() {
72020 lanes.off = function() {
72022 return utilRebind(lanes, dispatch14, "on");
72024 uiFieldLanes.supportsMultiselection = false;
72026 // modules/ui/fields/localized.js
72027 var _languagesArray = [];
72028 var LANGUAGE_SUFFIX_REGEX = /^(.*):([a-z]{2,3}(?:-[A-Z][a-z]{3})?(?:-[A-Z]{2})?)$/;
72029 function uiFieldLocalized(field, context) {
72030 var dispatch14 = dispatch_default("change", "input");
72031 var wikipedia = services.wikipedia;
72032 var input = select_default2(null);
72033 var localizedInputs = select_default2(null);
72034 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue());
72037 _mainFileFetcher.get("languages").then(loadLanguagesArray).catch(function() {
72039 var _territoryLanguages = {};
72040 _mainFileFetcher.get("territory_languages").then(function(d2) {
72041 _territoryLanguages = d2;
72042 }).catch(function() {
72044 var langCombo = uiCombobox(context, "localized-lang").fetcher(fetchLanguages).minItems(0);
72045 var _selection = select_default2(null);
72046 var _multilingual = [];
72047 var _buttonTip = uiTooltip().title(() => _t.append("translate.translate")).placement("left");
72049 var _entityIDs = [];
72050 function loadLanguagesArray(dataLanguages) {
72051 if (_languagesArray.length !== 0) return;
72052 var replacements = {
72054 // in OSM, `sr` implies Cyrillic
72056 // `sr-Cyrl` isn't used in OSM
72058 for (var code in dataLanguages) {
72059 if (replacements[code] === false) continue;
72060 var metaCode = code;
72061 if (replacements[code]) metaCode = replacements[code];
72062 _languagesArray.push({
72063 localName: _mainLocalizer.languageName(metaCode, { localOnly: true }),
72064 nativeName: dataLanguages[metaCode].nativeName,
72066 label: _mainLocalizer.languageName(metaCode)
72070 function calcLocked() {
72071 var isLocked = field.id === "name" && _entityIDs.length && _entityIDs.some(function(entityID) {
72072 var entity = context.graph().hasEntity(entityID);
72073 if (!entity) return false;
72074 if (entity.tags.wikidata) return true;
72075 if (entity.tags["name:etymology:wikidata"]) return true;
72076 var preset = _mainPresetIndex.match(entity, context.graph());
72078 var isSuggestion = preset.suggestion;
72079 var fields = preset.fields(entity.extent(context.graph()).center());
72080 var showsBrandField = fields.some(function(d2) {
72081 return d2.id === "brand";
72083 var showsOperatorField = fields.some(function(d2) {
72084 return d2.id === "operator";
72086 var setsName = preset.addTags.name;
72087 var setsBrandWikidata = preset.addTags["brand:wikidata"];
72088 var setsOperatorWikidata = preset.addTags["operator:wikidata"];
72089 return isSuggestion && setsName && (setsBrandWikidata && !showsBrandField || setsOperatorWikidata && !showsOperatorField);
72093 field.locked(isLocked);
72095 function calcMultilingual(tags) {
72096 var existingLangsOrdered = _multilingual.map(function(item2) {
72099 var existingLangs = new Set(existingLangsOrdered.filter(Boolean));
72100 for (var k2 in tags) {
72101 var m2 = k2.match(LANGUAGE_SUFFIX_REGEX);
72102 if (m2 && m2[1] === field.key && m2[2]) {
72103 var item = { lang: m2[2], value: tags[k2] };
72104 if (existingLangs.has(item.lang)) {
72105 _multilingual[existingLangsOrdered.indexOf(item.lang)].value = item.value;
72106 existingLangs.delete(item.lang);
72108 _multilingual.push(item);
72112 _multilingual.forEach(function(item2) {
72113 if (item2.lang && existingLangs.has(item2.lang)) {
72118 function localized(selection2) {
72119 _selection = selection2;
72121 var isLocked = field.locked();
72122 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72123 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72124 input = wrap2.selectAll(".localized-main").data([0]);
72125 input = input.enter().append("input").attr("type", "text").attr("id", field.domId).attr("class", "localized-main").call(utilNoAuto).merge(input);
72126 input.classed("disabled", !!isLocked).attr("readonly", isLocked || null).on("input", change(true)).on("blur", change()).on("change", change());
72127 wrap2.call(_lengthIndicator);
72128 var translateButton = wrap2.selectAll(".localized-add").data([0]);
72129 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);
72130 translateButton.classed("disabled", !!isLocked).call(isLocked ? _buttonTip.destroy : _buttonTip).on("click", addNew);
72131 if (_tags && !_multilingual.length) {
72132 calcMultilingual(_tags);
72134 localizedInputs = selection2.selectAll(".localized-multilingual").data([0]);
72135 localizedInputs = localizedInputs.enter().append("div").attr("class", "localized-multilingual").merge(localizedInputs);
72136 localizedInputs.call(renderMultilingual);
72137 localizedInputs.selectAll("button, input").classed("disabled", !!isLocked).attr("readonly", isLocked || null);
72138 selection2.selectAll(".combobox-caret").classed("nope", true);
72139 function addNew(d3_event) {
72140 d3_event.preventDefault();
72141 if (field.locked()) return;
72142 var defaultLang = _mainLocalizer.languageCode().toLowerCase();
72143 var langExists = _multilingual.find(function(datum2) {
72144 return datum2.lang === defaultLang;
72146 var isLangEn = defaultLang.indexOf("en") > -1;
72147 if (isLangEn || langExists) {
72149 langExists = _multilingual.find(function(datum2) {
72150 return datum2.lang === defaultLang;
72154 _multilingual.unshift({ lang: defaultLang, value: "" });
72155 localizedInputs.call(renderMultilingual);
72158 function change(onInput) {
72159 return function(d3_event) {
72160 if (field.locked()) {
72161 d3_event.preventDefault();
72164 var val = utilGetSetValue(select_default2(this));
72165 if (!onInput) val = context.cleanTagValue(val);
72166 if (!val && Array.isArray(_tags[field.key])) return;
72168 t2[field.key] = val || void 0;
72169 dispatch14.call("change", this, t2, onInput);
72173 function key(lang) {
72174 return field.key + ":" + lang;
72176 function changeLang(d3_event, d2) {
72178 var lang = utilGetSetValue(select_default2(this)).toLowerCase();
72179 var language = _languagesArray.find(function(d4) {
72180 return d4.label.toLowerCase() === lang || d4.localName && d4.localName.toLowerCase() === lang || d4.nativeName && d4.nativeName.toLowerCase() === lang;
72182 if (language) lang = language.code;
72183 if (d2.lang && d2.lang !== lang) {
72184 tags[key(d2.lang)] = void 0;
72186 var newKey = lang && context.cleanTagKey(key(lang));
72187 var value = utilGetSetValue(select_default2(this.parentNode).selectAll(".localized-value"));
72188 if (newKey && value) {
72189 tags[newKey] = value;
72190 } else if (newKey && _wikiTitles && _wikiTitles[d2.lang]) {
72191 tags[newKey] = _wikiTitles[d2.lang];
72194 dispatch14.call("change", this, tags);
72196 function changeValue(d3_event, d2) {
72197 if (!d2.lang) return;
72198 var value = context.cleanTagValue(utilGetSetValue(select_default2(this))) || void 0;
72199 if (!value && Array.isArray(d2.value)) return;
72201 t2[key(d2.lang)] = value;
72203 dispatch14.call("change", this, t2);
72205 function fetchLanguages(value, cb) {
72206 var v2 = value.toLowerCase();
72207 var langCodes = [_mainLocalizer.localeCode(), _mainLocalizer.languageCode()];
72208 if (_countryCode && _territoryLanguages[_countryCode]) {
72209 langCodes = langCodes.concat(_territoryLanguages[_countryCode]);
72211 var langItems = [];
72212 langCodes.forEach(function(code) {
72213 var langItem = _languagesArray.find(function(item) {
72214 return item.code === code;
72216 if (langItem) langItems.push(langItem);
72218 langItems = utilArrayUniq(langItems.concat(_languagesArray));
72219 cb(langItems.filter(function(d2) {
72220 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;
72221 }).map(function(d2) {
72222 return { value: d2.label };
72225 function renderMultilingual(selection2) {
72226 var entries = selection2.selectAll("div.entry").data(_multilingual, function(d2) {
72229 entries.exit().style("top", "0").style("max-height", "240px").transition().duration(200).style("opacity", "0").style("max-height", "0px").remove();
72230 var entriesEnter = entries.enter().append("div").attr("class", "entry").each(function(_2, index) {
72231 var wrap2 = select_default2(this);
72232 var domId = utilUniqueDomId(index);
72233 var label = wrap2.append("label").attr("class", "field-label").attr("for", domId);
72234 var text = label.append("span").attr("class", "label-text");
72235 text.append("span").attr("class", "label-textvalue").call(_t.append("translate.localized_translation_label"));
72236 text.append("span").attr("class", "label-textannotation");
72237 label.append("button").attr("class", "remove-icon-multilingual").attr("title", _t("icons.remove")).on("click", function(d3_event, d2) {
72238 if (field.locked()) return;
72239 d3_event.preventDefault();
72240 _multilingual.splice(_multilingual.indexOf(d2), 1);
72241 var langKey = d2.lang && key(d2.lang);
72242 if (langKey && langKey in _tags) {
72243 delete _tags[langKey];
72245 t2[langKey] = void 0;
72246 dispatch14.call("change", this, t2);
72249 renderMultilingual(selection2);
72250 }).call(svgIcon("#iD-operation-delete"));
72251 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);
72252 wrap2.append("input").attr("type", "text").attr("class", "localized-value").on("blur", changeValue).on("change", changeValue);
72254 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() {
72255 select_default2(this).style("max-height", "").style("overflow", "visible");
72257 entries = entries.merge(entriesEnter);
72259 entries.classed("present", true);
72260 utilGetSetValue(entries.select(".localized-lang"), function(d2) {
72261 var langItem = _languagesArray.find(function(item) {
72262 return item.code === d2.lang;
72264 if (langItem) return langItem.label;
72267 utilGetSetValue(entries.select(".localized-value"), function(d2) {
72268 return typeof d2.value === "string" ? d2.value : "";
72269 }).attr("title", function(d2) {
72270 return Array.isArray(d2.value) ? d2.value.filter(Boolean).join("\n") : null;
72271 }).attr("placeholder", function(d2) {
72272 return Array.isArray(d2.value) ? _t("inspector.multiple_values") : _t("translate.localized_translation_name");
72273 }).classed("mixed", function(d2) {
72274 return Array.isArray(d2.value);
72277 localized.tags = function(tags) {
72279 if (typeof tags.wikipedia === "string" && !_wikiTitles) {
72281 var wm = tags.wikipedia.match(/([^:]+):(.+)/);
72282 if (wm && wm[0] && wm[1]) {
72283 wikipedia.translations(wm[1], wm[2], function(err, d2) {
72284 if (err || !d2) return;
72289 var isMixed = Array.isArray(tags[field.key]);
72290 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);
72291 calcMultilingual(tags);
72292 _selection.call(localized);
72294 _lengthIndicator.update(tags[field.key]);
72297 localized.focus = function() {
72298 input.node().focus();
72300 localized.entityIDs = function(val) {
72301 if (!arguments.length) return _entityIDs;
72303 _multilingual = [];
72307 function loadCountryCode() {
72308 var extent = combinedEntityExtent();
72309 var countryCode = extent && iso1A2Code(extent.center());
72310 _countryCode = countryCode && countryCode.toLowerCase();
72312 function combinedEntityExtent() {
72313 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72315 return utilRebind(localized, dispatch14, "on");
72318 // modules/ui/fields/roadheight.js
72319 function uiFieldRoadheight(field, context) {
72320 var dispatch14 = dispatch_default("change");
72321 var primaryUnitInput = select_default2(null);
72322 var primaryInput = select_default2(null);
72323 var secondaryInput = select_default2(null);
72324 var secondaryUnitInput = select_default2(null);
72325 var _entityIDs = [];
72328 var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
72329 var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
72330 var primaryUnits = [
72333 title: _t("inspector.roadheight.meter")
72337 title: _t("inspector.roadheight.foot")
72340 var unitCombo = uiCombobox(context, "roadheight-unit").data(primaryUnits);
72341 function roadheight(selection2) {
72342 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72343 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72344 primaryInput = wrap2.selectAll("input.roadheight-number").data([0]);
72345 primaryInput = primaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-number").attr("id", field.domId).call(utilNoAuto).merge(primaryInput);
72346 primaryInput.on("change", change).on("blur", change);
72347 var loc = combinedEntityExtent().center();
72348 _isImperial = roadHeightUnit(loc) === "ft";
72349 primaryUnitInput = wrap2.selectAll("input.roadheight-unit").data([0]);
72350 primaryUnitInput = primaryUnitInput.enter().append("input").attr("type", "text").attr("class", "roadheight-unit").call(unitCombo).merge(primaryUnitInput);
72351 primaryUnitInput.on("blur", changeUnits).on("change", changeUnits);
72352 secondaryInput = wrap2.selectAll("input.roadheight-secondary-number").data([0]);
72353 secondaryInput = secondaryInput.enter().append("input").attr("type", "text").attr("class", "roadheight-secondary-number").call(utilNoAuto).merge(secondaryInput);
72354 secondaryInput.on("change", change).on("blur", change);
72355 secondaryUnitInput = wrap2.selectAll("input.roadheight-secondary-unit").data([0]);
72356 secondaryUnitInput = secondaryUnitInput.enter().append("input").attr("type", "text").call(utilNoAuto).classed("disabled", true).classed("roadheight-secondary-unit", true).attr("readonly", "readonly").merge(secondaryUnitInput);
72357 function changeUnits() {
72358 var primaryUnit = utilGetSetValue(primaryUnitInput);
72359 if (primaryUnit === "m") {
72360 _isImperial = false;
72361 } else if (primaryUnit === "ft") {
72362 _isImperial = true;
72364 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
72365 setUnitSuggestions();
72369 function setUnitSuggestions() {
72370 utilGetSetValue(primaryUnitInput, _isImperial ? "ft" : "m");
72372 function change() {
72374 var primaryValue = utilGetSetValue(primaryInput).trim();
72375 var secondaryValue = utilGetSetValue(secondaryInput).trim();
72376 if (!primaryValue && !secondaryValue && Array.isArray(_tags[field.key])) return;
72377 if (!primaryValue && !secondaryValue) {
72378 tag2[field.key] = void 0;
72380 var rawPrimaryValue = likelyRawNumberFormat.test(primaryValue) ? parseFloat(primaryValue) : parseLocaleFloat(primaryValue);
72381 if (isNaN(rawPrimaryValue)) rawPrimaryValue = primaryValue;
72382 var rawSecondaryValue = likelyRawNumberFormat.test(secondaryValue) ? parseFloat(secondaryValue) : parseLocaleFloat(secondaryValue);
72383 if (isNaN(rawSecondaryValue)) rawSecondaryValue = secondaryValue;
72384 if (isNaN(rawPrimaryValue) || isNaN(rawSecondaryValue) || !_isImperial) {
72385 tag2[field.key] = context.cleanTagValue(rawPrimaryValue);
72387 if (rawPrimaryValue !== "") {
72388 rawPrimaryValue = rawPrimaryValue + "'";
72390 if (rawSecondaryValue !== "") {
72391 rawSecondaryValue = rawSecondaryValue + '"';
72393 tag2[field.key] = context.cleanTagValue(rawPrimaryValue + rawSecondaryValue);
72396 dispatch14.call("change", this, tag2);
72398 roadheight.tags = function(tags) {
72400 var primaryValue = tags[field.key];
72401 var secondaryValue;
72402 var isMixed = Array.isArray(primaryValue);
72404 if (primaryValue && (primaryValue.indexOf("'") >= 0 || primaryValue.indexOf('"') >= 0)) {
72405 secondaryValue = primaryValue.match(/(-?[\d.]+)"/);
72406 if (secondaryValue !== null) {
72407 secondaryValue = formatFloat(parseFloat(secondaryValue[1]));
72409 primaryValue = primaryValue.match(/(-?[\d.]+)'/);
72410 if (primaryValue !== null) {
72411 primaryValue = formatFloat(parseFloat(primaryValue[1]));
72413 _isImperial = true;
72414 } else if (primaryValue) {
72415 var rawValue = primaryValue;
72416 primaryValue = parseFloat(rawValue);
72417 if (isNaN(primaryValue)) {
72418 primaryValue = rawValue;
72420 primaryValue = formatFloat(primaryValue);
72422 _isImperial = false;
72425 setUnitSuggestions();
72426 var inchesPlaceholder = formatFloat(0);
72427 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);
72428 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");
72429 secondaryUnitInput.attr("value", _isImperial ? _t("inspector.roadheight.inch") : null);
72431 roadheight.focus = function() {
72432 primaryInput.node().focus();
72434 roadheight.entityIDs = function(val) {
72437 function combinedEntityExtent() {
72438 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72440 return utilRebind(roadheight, dispatch14, "on");
72443 // modules/ui/fields/roadspeed.js
72444 function uiFieldRoadspeed(field, context) {
72445 var dispatch14 = dispatch_default("change");
72446 var unitInput = select_default2(null);
72447 var input = select_default2(null);
72448 var _entityIDs = [];
72451 var formatFloat = _mainLocalizer.floatFormatter(_mainLocalizer.languageCode());
72452 var parseLocaleFloat = _mainLocalizer.floatParser(_mainLocalizer.languageCode());
72453 var speedCombo = uiCombobox(context, "roadspeed");
72454 var unitCombo = uiCombobox(context, "roadspeed-unit").data(["km/h", "mph"].map(comboValues));
72455 var metricValues = [20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120];
72456 var imperialValues = [5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80];
72457 function roadspeed(selection2) {
72458 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72459 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72460 input = wrap2.selectAll("input.roadspeed-number").data([0]);
72461 input = input.enter().append("input").attr("type", "text").attr("class", "roadspeed-number").attr("id", field.domId).call(utilNoAuto).call(speedCombo).merge(input);
72462 input.on("change", change).on("blur", change);
72463 var loc = combinedEntityExtent().center();
72464 _isImperial = roadSpeedUnit(loc) === "mph";
72465 unitInput = wrap2.selectAll("input.roadspeed-unit").data([0]);
72466 unitInput = unitInput.enter().append("input").attr("type", "text").attr("class", "roadspeed-unit").attr("aria-label", _t("inspector.speed_unit")).call(unitCombo).merge(unitInput);
72467 unitInput.on("blur", changeUnits).on("change", changeUnits);
72468 function changeUnits() {
72469 var unit2 = utilGetSetValue(unitInput);
72470 if (unit2 === "km/h") {
72471 _isImperial = false;
72472 } else if (unit2 === "mph") {
72473 _isImperial = true;
72475 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
72476 setUnitSuggestions();
72480 function setUnitSuggestions() {
72481 speedCombo.data((_isImperial ? imperialValues : metricValues).map(comboValues));
72482 utilGetSetValue(unitInput, _isImperial ? "mph" : "km/h");
72484 function comboValues(d2) {
72486 value: formatFloat(d2),
72487 title: formatFloat(d2)
72490 function change() {
72492 var value = utilGetSetValue(input).trim();
72493 if (!value && Array.isArray(_tags[field.key])) return;
72495 tag2[field.key] = void 0;
72497 var rawValue = likelyRawNumberFormat.test(value) ? parseFloat(value) : parseLocaleFloat(value);
72498 if (isNaN(rawValue)) rawValue = value;
72499 if (isNaN(rawValue) || !_isImperial) {
72500 tag2[field.key] = context.cleanTagValue(rawValue);
72502 tag2[field.key] = context.cleanTagValue(rawValue + " mph");
72505 dispatch14.call("change", this, tag2);
72507 roadspeed.tags = function(tags) {
72509 var rawValue = tags[field.key];
72510 var value = rawValue;
72511 var isMixed = Array.isArray(value);
72513 if (rawValue && rawValue.indexOf("mph") >= 0) {
72514 _isImperial = true;
72515 } else if (rawValue) {
72516 _isImperial = false;
72518 value = parseInt(value, 10);
72519 if (isNaN(value)) {
72522 value = formatFloat(value);
72525 setUnitSuggestions();
72526 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);
72528 roadspeed.focus = function() {
72529 input.node().focus();
72531 roadspeed.entityIDs = function(val) {
72534 function combinedEntityExtent() {
72535 return _entityIDs && _entityIDs.length && utilTotalExtent(_entityIDs, context.graph());
72537 return utilRebind(roadspeed, dispatch14, "on");
72540 // modules/ui/fields/radio.js
72541 function uiFieldRadio(field, context) {
72542 var dispatch14 = dispatch_default("change");
72543 var placeholder = select_default2(null);
72544 var wrap2 = select_default2(null);
72545 var labels = select_default2(null);
72546 var radios = select_default2(null);
72547 var radioData = (field.options || field.keys).slice();
72551 var _entityIDs = [];
72552 function selectedKey() {
72553 var node = wrap2.selectAll(".form-field-input-radio label.active input");
72554 return !node.empty() && node.datum();
72556 function radio(selection2) {
72557 selection2.classed("preset-radio", true);
72558 wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72559 var enter = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-radio");
72560 enter.append("span").attr("class", "placeholder");
72561 wrap2 = wrap2.merge(enter);
72562 placeholder = wrap2.selectAll(".placeholder");
72563 labels = wrap2.selectAll("label").data(radioData);
72564 enter = labels.enter().append("label");
72565 var stringsField = field.resolveReference("stringsCrossReference");
72566 enter.append("input").attr("type", "radio").attr("name", field.id).attr("value", function(d2) {
72567 return stringsField.t("options." + d2, { "default": d2 });
72568 }).attr("checked", false);
72569 enter.append("span").each(function(d2) {
72570 stringsField.t.append("options." + d2, { "default": d2 })(select_default2(this));
72572 labels = labels.merge(enter);
72573 radios = labels.selectAll("input").on("change", changeRadio);
72575 function structureExtras(selection2, tags) {
72576 var selected = selectedKey() || tags.layer !== void 0;
72577 var type2 = _mainPresetIndex.field(selected);
72578 var layer = _mainPresetIndex.field("layer");
72579 var showLayer = selected === "bridge" || selected === "tunnel" || tags.layer !== void 0;
72580 var extrasWrap = selection2.selectAll(".structure-extras-wrap").data(selected ? [0] : []);
72581 extrasWrap.exit().remove();
72582 extrasWrap = extrasWrap.enter().append("div").attr("class", "structure-extras-wrap").merge(extrasWrap);
72583 var list2 = extrasWrap.selectAll("ul").data([0]);
72584 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
72586 if (!typeField || typeField.id !== selected) {
72587 typeField = uiField(context, type2, _entityIDs, { wrap: false }).on("change", changeType);
72589 typeField.tags(tags);
72593 var typeItem = list2.selectAll(".structure-type-item").data(typeField ? [typeField] : [], function(d2) {
72596 typeItem.exit().remove();
72597 var typeEnter = typeItem.enter().insert("li", ":first-child").attr("class", "labeled-input structure-type-item");
72598 typeEnter.append("div").attr("class", "label structure-label-type").attr("for", "preset-input-" + selected).call(_t.append("inspector.radio.structure.type"));
72599 typeEnter.append("div").attr("class", "structure-input-type-wrap");
72600 typeItem = typeItem.merge(typeEnter);
72602 typeItem.selectAll(".structure-input-type-wrap").call(typeField.render);
72604 if (layer && showLayer) {
72606 layerField = uiField(context, layer, _entityIDs, { wrap: false }).on("change", changeLayer);
72608 layerField.tags(tags);
72609 field.keys = utilArrayUnion(field.keys, ["layer"]);
72612 field.keys = field.keys.filter(function(k2) {
72613 return k2 !== "layer";
72616 var layerItem = list2.selectAll(".structure-layer-item").data(layerField ? [layerField] : []);
72617 layerItem.exit().remove();
72618 var layerEnter = layerItem.enter().append("li").attr("class", "labeled-input structure-layer-item");
72619 layerEnter.append("div").attr("class", "label structure-label-layer").attr("for", "preset-input-layer").call(_t.append("inspector.radio.structure.layer"));
72620 layerEnter.append("div").attr("class", "structure-input-layer-wrap");
72621 layerItem = layerItem.merge(layerEnter);
72623 layerItem.selectAll(".structure-input-layer-wrap").call(layerField.render);
72626 function changeType(t2, onInput) {
72627 var key = selectedKey();
72630 if (val !== "no") {
72631 _oldType[key] = val;
72633 if (field.type === "structureRadio") {
72634 if (val === "no" || key !== "bridge" && key !== "tunnel" || key === "tunnel" && val === "building_passage") {
72637 if (t2.layer === void 0) {
72638 if (key === "bridge" && val !== "no") {
72641 if (key === "tunnel" && val !== "no" && val !== "building_passage") {
72646 dispatch14.call("change", this, t2, onInput);
72648 function changeLayer(t2, onInput) {
72649 if (t2.layer === "0") {
72652 dispatch14.call("change", this, t2, onInput);
72654 function changeRadio() {
72658 t2[field.key] = void 0;
72660 radios.each(function(d2) {
72661 var active = select_default2(this).property("checked");
72662 if (active) activeKey = d2;
72664 if (active) t2[field.key] = d2;
72666 var val = _oldType[activeKey] || "yes";
72667 t2[d2] = active ? val : void 0;
72670 if (field.type === "structureRadio") {
72671 if (activeKey === "bridge") {
72673 } else if (activeKey === "tunnel" && t2.tunnel !== "building_passage") {
72679 dispatch14.call("change", this, t2);
72681 radio.tags = function(tags) {
72682 function isOptionChecked(d2) {
72684 return tags[field.key] === d2;
72686 return !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
72688 function isMixed(d2) {
72690 return Array.isArray(tags[field.key]) && tags[field.key].includes(d2);
72692 return Array.isArray(tags[d2]);
72694 radios.property("checked", function(d2) {
72695 return isOptionChecked(d2) && (field.key || field.options.filter(isOptionChecked).length === 1);
72697 labels.classed("active", function(d2) {
72699 return Array.isArray(tags[field.key]) && tags[field.key].includes(d2) || tags[field.key] === d2;
72701 return Array.isArray(tags[d2]) && tags[d2].some((v2) => typeof v2 === "string" && v2.toLowerCase() !== "no") || !!(typeof tags[d2] === "string" && tags[d2].toLowerCase() !== "no");
72702 }).classed("mixed", isMixed).attr("title", function(d2) {
72703 return isMixed(d2) ? _t("inspector.unshared_value_tooltip") : null;
72705 var selection2 = radios.filter(function() {
72706 return this.checked;
72708 if (selection2.empty()) {
72709 placeholder.text("");
72710 placeholder.call(_t.append("inspector.none"));
72712 placeholder.text(selection2.attr("value"));
72713 _oldType[selection2.datum()] = tags[selection2.datum()];
72715 if (field.type === "structureRadio") {
72716 if (!!tags.waterway && !_oldType.tunnel) {
72717 _oldType.tunnel = "culvert";
72719 wrap2.call(structureExtras, tags);
72722 radio.focus = function() {
72723 radios.node().focus();
72725 radio.entityIDs = function(val) {
72726 if (!arguments.length) return _entityIDs;
72731 radio.isAllowed = function() {
72732 return _entityIDs.length === 1;
72734 return utilRebind(radio, dispatch14, "on");
72737 // modules/ui/fields/restrictions.js
72738 function uiFieldRestrictions(field, context) {
72739 var dispatch14 = dispatch_default("change");
72740 var breathe = behaviorBreathe(context);
72741 corePreferences("turn-restriction-via-way", null);
72742 var storedViaWay = corePreferences("turn-restriction-via-way0");
72743 var storedDistance = corePreferences("turn-restriction-distance");
72744 var _maxViaWay = storedViaWay !== null ? +storedViaWay : 0;
72745 var _maxDistance = storedDistance ? +storedDistance : 30;
72746 var _initialized3 = false;
72747 var _parent = select_default2(null);
72748 var _container = select_default2(null);
72755 function restrictions(selection2) {
72756 _parent = selection2;
72757 if (_vertexID && (context.graph() !== _graph || !_intersection)) {
72758 _graph = context.graph();
72759 _intersection = osmIntersection(_graph, _vertexID, _maxDistance);
72761 var isOK = _intersection && _intersection.vertices.length && // has vertices
72762 _intersection.vertices.filter(function(vertex) {
72763 return vertex.id === _vertexID;
72764 }).length && _intersection.ways.length > 2;
72765 select_default2(selection2.node().parentNode).classed("hide", !isOK);
72766 if (!isOK || !context.container().select(".inspector-wrap.inspector-hidden").empty() || !selection2.node().parentNode || !selection2.node().parentNode.parentNode) {
72767 selection2.call(restrictions.off);
72770 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
72771 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
72772 var container = wrap2.selectAll(".restriction-container").data([0]);
72773 var containerEnter = container.enter().append("div").attr("class", "restriction-container");
72774 containerEnter.append("div").attr("class", "restriction-help");
72775 _container = containerEnter.merge(container).call(renderViewer);
72776 var controls = wrap2.selectAll(".restriction-controls").data([0]);
72777 controls.enter().append("div").attr("class", "restriction-controls-container").append("div").attr("class", "restriction-controls").merge(controls).call(renderControls);
72779 function renderControls(selection2) {
72780 var distControl = selection2.selectAll(".restriction-distance").data([0]);
72781 distControl.exit().remove();
72782 var distControlEnter = distControl.enter().append("div").attr("class", "restriction-control restriction-distance");
72783 distControlEnter.append("span").attr("class", "restriction-control-label restriction-distance-label").call(_t.append("restriction.controls.distance", { suffix: ":" }));
72784 distControlEnter.append("input").attr("class", "restriction-distance-input").attr("type", "range").attr("min", "20").attr("max", "50").attr("step", "5");
72785 distControlEnter.append("span").attr("class", "restriction-distance-text");
72786 selection2.selectAll(".restriction-distance-input").property("value", _maxDistance).on("input", function() {
72787 var val = select_default2(this).property("value");
72788 _maxDistance = +val;
72789 _intersection = null;
72790 _container.selectAll(".layer-osm .layer-turns *").remove();
72791 corePreferences("turn-restriction-distance", _maxDistance);
72792 _parent.call(restrictions);
72794 selection2.selectAll(".restriction-distance-text").call(displayMaxDistance(_maxDistance));
72795 var viaControl = selection2.selectAll(".restriction-via-way").data([0]);
72796 viaControl.exit().remove();
72797 var viaControlEnter = viaControl.enter().append("div").attr("class", "restriction-control restriction-via-way");
72798 viaControlEnter.append("span").attr("class", "restriction-control-label restriction-via-way-label").call(_t.append("restriction.controls.via", { suffix: ":" }));
72799 viaControlEnter.append("input").attr("class", "restriction-via-way-input").attr("type", "range").attr("min", "0").attr("max", "2").attr("step", "1");
72800 viaControlEnter.append("span").attr("class", "restriction-via-way-text");
72801 selection2.selectAll(".restriction-via-way-input").property("value", _maxViaWay).on("input", function() {
72802 var val = select_default2(this).property("value");
72804 _container.selectAll(".layer-osm .layer-turns *").remove();
72805 corePreferences("turn-restriction-via-way0", _maxViaWay);
72806 _parent.call(restrictions);
72808 selection2.selectAll(".restriction-via-way-text").call(displayMaxVia(_maxViaWay));
72810 function renderViewer(selection2) {
72811 if (!_intersection) return;
72812 var vgraph = _intersection.graph;
72813 var filter2 = utilFunctor(true);
72814 var projection2 = geoRawMercator();
72815 var sdims = utilGetDimensions(context.container().select(".sidebar"));
72816 var d2 = [sdims[0] - 50, 370];
72817 var c2 = geoVecScale(d2, 0.5);
72819 projection2.scale(geoZoomToScale(z2));
72820 var extent = geoExtent();
72821 for (var i3 = 0; i3 < _intersection.vertices.length; i3++) {
72822 extent._extend(_intersection.vertices[i3].extent());
72825 if (_intersection.vertices.length > 1) {
72826 var hPadding = Math.min(160, Math.max(110, d2[0] * 0.4));
72827 var vPadding = 160;
72828 var tl = projection2([extent[0][0], extent[1][1]]);
72829 var br2 = projection2([extent[1][0], extent[0][1]]);
72830 var hFactor = (br2[0] - tl[0]) / (d2[0] - hPadding);
72831 var vFactor = (br2[1] - tl[1]) / (d2[1] - vPadding - padTop);
72832 var hZoomDiff = Math.log(Math.abs(hFactor)) / Math.LN2;
72833 var vZoomDiff = Math.log(Math.abs(vFactor)) / Math.LN2;
72834 z2 = z2 - Math.max(hZoomDiff, vZoomDiff);
72835 projection2.scale(geoZoomToScale(z2));
72837 var extentCenter = projection2(extent.center());
72838 extentCenter[1] = extentCenter[1] - padTop / 2;
72839 projection2.translate(geoVecSubtract(c2, extentCenter)).clipExtent([[0, 0], d2]);
72840 var drawLayers = svgLayers(projection2, context).only(["osm", "touch"]).dimensions(d2);
72841 var drawVertices = svgVertices(projection2, context);
72842 var drawLines = svgLines(projection2, context);
72843 var drawTurns = svgTurns(projection2, context);
72844 var firstTime = selection2.selectAll(".surface").empty();
72845 selection2.call(drawLayers);
72846 var surface = selection2.selectAll(".surface").classed("tr", true);
72848 _initialized3 = true;
72849 surface.call(breathe);
72851 if (_fromWayID && !vgraph.hasEntity(_fromWayID)) {
72855 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));
72856 surface.on("click.restrictions", click).on("mouseover.restrictions", mouseover);
72857 surface.selectAll(".selected").classed("selected", false);
72858 surface.selectAll(".related").classed("related", false);
72861 way = vgraph.entity(_fromWayID);
72862 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
72864 document.addEventListener("resizeWindow", function() {
72865 utilSetDimensions(_container, null);
72869 function click(d3_event) {
72870 surface.call(breathe.off).call(breathe);
72871 var datum2 = d3_event.target.__data__;
72872 var entity = datum2 && datum2.properties && datum2.properties.entity;
72876 if (datum2 instanceof osmWay && (datum2.__from || datum2.__via)) {
72877 _fromWayID = datum2.id;
72880 } else if (datum2 instanceof osmTurn) {
72881 var actions, extraActions, turns, i4;
72882 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
72883 if (datum2.restrictionID && !datum2.direct) {
72885 } else if (datum2.restrictionID && !datum2.only) {
72887 var datumOnly = JSON.parse(JSON.stringify(datum2));
72888 datumOnly.only = true;
72889 restrictionType = restrictionType.replace(/^no/, "only");
72890 turns = _intersection.turns(_fromWayID, 2);
72893 for (i4 = 0; i4 < turns.length; i4++) {
72894 var turn = turns[i4];
72895 if (seen[turn.restrictionID]) continue;
72896 if (turn.direct && turn.path[1] === datum2.path[1]) {
72897 seen[turns[i4].restrictionID] = true;
72898 turn.restrictionType = osmInferRestriction(vgraph, turn, projection2);
72899 _oldTurns.push(turn);
72900 extraActions.push(actionUnrestrictTurn(turn));
72903 actions = _intersection.actions.concat(extraActions, [
72904 actionRestrictTurn(datumOnly, restrictionType),
72905 _t("operations.restriction.annotation.create")
72907 } else if (datum2.restrictionID) {
72908 turns = _oldTurns || [];
72910 for (i4 = 0; i4 < turns.length; i4++) {
72911 if (turns[i4].key !== datum2.key) {
72912 extraActions.push(actionRestrictTurn(turns[i4], turns[i4].restrictionType));
72916 actions = _intersection.actions.concat(extraActions, [
72917 actionUnrestrictTurn(datum2),
72918 _t("operations.restriction.annotation.delete")
72921 actions = _intersection.actions.concat([
72922 actionRestrictTurn(datum2, restrictionType),
72923 _t("operations.restriction.annotation.create")
72926 context.perform.apply(context, actions);
72927 var s2 = surface.selectAll("." + datum2.key);
72928 datum2 = s2.empty() ? null : s2.datum();
72929 updateHints(datum2);
72936 function mouseover(d3_event) {
72937 var datum2 = d3_event.target.__data__;
72938 updateHints(datum2);
72940 _lastXPos = _lastXPos || sdims[0];
72941 function redraw(minChange) {
72944 xPos = utilGetDimensions(context.container().select(".sidebar"))[0];
72946 if (!minChange || minChange && Math.abs(xPos - _lastXPos) >= minChange) {
72947 if (context.hasEntity(_vertexID)) {
72949 _container.call(renderViewer);
72953 function highlightPathsFrom(wayID) {
72954 surface.selectAll(".related").classed("related", false).classed("allow", false).classed("restrict", false).classed("only", false);
72955 surface.selectAll("." + wayID).classed("related", true);
72957 var turns = _intersection.turns(wayID, _maxViaWay);
72958 for (var i4 = 0; i4 < turns.length; i4++) {
72959 var turn = turns[i4];
72960 var ids = [turn.to.way];
72961 var klass = turn.no ? "restrict" : turn.only ? "only" : "allow";
72962 if (turn.only || turns.length === 1) {
72963 if (turn.via.ways) {
72964 ids = ids.concat(turn.via.ways);
72966 } else if (turn.to.way === wayID) {
72969 surface.selectAll(utilEntitySelector(ids)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
72973 function updateHints(datum2) {
72974 var help = _container.selectAll(".restriction-help").html("");
72975 var placeholders = {};
72976 ["from", "via", "to"].forEach(function(k2) {
72977 placeholders[k2] = { html: '<span class="qualifier">' + _t("restriction.help." + k2) + "</span>" };
72979 var entity = datum2 && datum2.properties && datum2.properties.entity;
72984 way = vgraph.entity(_fromWayID);
72985 surface.selectAll("." + _fromWayID).classed("selected", true).classed("related", true);
72987 if (datum2 instanceof osmWay && datum2.__from) {
72989 highlightPathsFrom(_fromWayID ? null : way.id);
72990 surface.selectAll("." + way.id).classed("related", true);
72991 var clickSelect = !_fromWayID || _fromWayID !== way.id;
72992 help.append("div").html(_t.html("restriction.help." + (clickSelect ? "select_from_name" : "from_name"), {
72993 from: placeholders.from,
72994 fromName: displayName(way.id, vgraph)
72996 } else if (datum2 instanceof osmTurn) {
72997 var restrictionType = osmInferRestriction(vgraph, datum2, projection2);
72998 var turnType = restrictionType.replace(/^(only|no)\_/, "");
72999 var indirect = datum2.direct === false ? _t.html("restriction.help.indirect") : "";
73000 var klass, turnText, nextText;
73002 klass = "restrict";
73003 turnText = _t.html("restriction.help.turn.no_" + turnType, { indirect: { html: indirect } });
73004 nextText = _t.html("restriction.help.turn.only_" + turnType, { indirect: "" });
73005 } else if (datum2.only) {
73007 turnText = _t.html("restriction.help.turn.only_" + turnType, { indirect: { html: indirect } });
73008 nextText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: "" });
73011 turnText = _t.html("restriction.help.turn.allowed_" + turnType, { indirect: { html: indirect } });
73012 nextText = _t.html("restriction.help.turn.no_" + turnType, { indirect: "" });
73014 help.append("div").attr("class", "qualifier " + klass).html(turnText);
73015 help.append("div").html(_t.html("restriction.help.from_name_to_name", {
73016 from: placeholders.from,
73017 fromName: displayName(datum2.from.way, vgraph),
73018 to: placeholders.to,
73019 toName: displayName(datum2.to.way, vgraph)
73021 if (datum2.via.ways && datum2.via.ways.length) {
73023 for (var i4 = 0; i4 < datum2.via.ways.length; i4++) {
73024 var prev = names[names.length - 1];
73025 var curr = displayName(datum2.via.ways[i4], vgraph);
73026 if (!prev || curr !== prev) {
73030 help.append("div").html(_t.html("restriction.help.via_names", {
73031 via: placeholders.via,
73032 viaNames: names.join(", ")
73036 help.append("div").html(_t.html("restriction.help.toggle", { turn: { html: nextText.trim() } }));
73038 highlightPathsFrom(null);
73039 var alongIDs = datum2.path.slice();
73040 surface.selectAll(utilEntitySelector(alongIDs)).classed("related", true).classed("allow", klass === "allow").classed("restrict", klass === "restrict").classed("only", klass === "only");
73042 highlightPathsFrom(null);
73044 help.append("div").html(_t.html("restriction.help.from_name", {
73045 from: placeholders.from,
73046 fromName: displayName(_fromWayID, vgraph)
73049 help.append("div").html(_t.html("restriction.help.select_from", {
73050 from: placeholders.from
73056 function displayMaxDistance(maxDist) {
73057 return (selection2) => {
73058 var isImperial = !_mainLocalizer.usesMetric();
73062 // imprecise conversion for prettier display
73071 opts = { distance: _t("units.feet", { quantity: distToFeet }) };
73073 opts = { distance: _t("units.meters", { quantity: maxDist }) };
73075 return selection2.html("").call(_t.append("restriction.controls.distance_up_to", opts));
73078 function displayMaxVia(maxVia) {
73079 return (selection2) => {
73080 selection2 = selection2.html("");
73081 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"));
73084 function displayName(entityID, graph) {
73085 var entity = graph.entity(entityID);
73086 var name = utilDisplayName(entity) || "";
73087 var matched = _mainPresetIndex.match(entity, graph);
73088 var type2 = matched && matched.name() || utilDisplayType(entity.id);
73089 return name || type2;
73091 restrictions.entityIDs = function(val) {
73092 _intersection = null;
73095 _vertexID = val[0];
73097 restrictions.tags = function() {
73099 restrictions.focus = function() {
73101 restrictions.off = function(selection2) {
73102 if (!_initialized3) return;
73103 selection2.selectAll(".surface").call(breathe.off).on("click.restrictions", null).on("mouseover.restrictions", null);
73104 select_default2(window).on("resize.restrictions", null);
73106 return utilRebind(restrictions, dispatch14, "on");
73108 uiFieldRestrictions.supportsMultiselection = false;
73110 // modules/ui/fields/textarea.js
73111 function uiFieldTextarea(field, context) {
73112 var dispatch14 = dispatch_default("change");
73113 var input = select_default2(null);
73114 var _lengthIndicator = uiLengthIndicator(context.maxCharsForTagValue()).silent(field.usage === "changeset" && field.key === "comment");
73116 function textarea(selection2) {
73117 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73118 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).style("position", "relative").merge(wrap2);
73119 input = wrap2.selectAll("textarea").data([0]);
73120 input = input.enter().append("textarea").attr("id", field.domId).call(utilNoAuto).on("input", change(true)).on("blur", change()).on("change", change()).merge(input);
73121 wrap2.call(_lengthIndicator);
73122 function change(onInput) {
73123 return function() {
73124 var val = utilGetSetValue(input);
73125 if (!onInput) val = context.cleanTagValue(val);
73126 if (!val && Array.isArray(_tags[field.key])) return;
73128 t2[field.key] = val || void 0;
73129 dispatch14.call("change", this, t2, onInput);
73133 textarea.tags = function(tags) {
73135 var isMixed = Array.isArray(tags[field.key]);
73136 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);
73138 _lengthIndicator.update(tags[field.key]);
73141 textarea.focus = function() {
73142 input.node().focus();
73144 return utilRebind(textarea, dispatch14, "on");
73147 // modules/ui/fields/wikidata.js
73148 function uiFieldWikidata(field, context) {
73149 var wikidata = services.wikidata;
73150 var dispatch14 = dispatch_default("change");
73151 var _selection = select_default2(null);
73152 var _searchInput = select_default2(null);
73154 var _wikidataEntity = null;
73156 var _entityIDs = [];
73157 var _wikipediaKey = field.keys && field.keys.find(function(key) {
73158 return key.includes("wikipedia");
73160 var _hintKey = field.key === "wikidata" ? "name" : field.key.split(":")[0];
73161 var combobox = uiCombobox(context, "combo-" + field.safeid).caseSensitive(true).minItems(1);
73162 function wiki(selection2) {
73163 _selection = selection2;
73164 var wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73165 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-" + field.type).merge(wrap2);
73166 var list2 = wrap2.selectAll("ul").data([0]);
73167 list2 = list2.enter().append("ul").attr("class", "rows").merge(list2);
73168 var searchRow = list2.selectAll("li.wikidata-search").data([0]);
73169 var searchRowEnter = searchRow.enter().append("li").attr("class", "wikidata-search");
73170 searchRowEnter.append("input").attr("type", "text").attr("id", field.domId).style("flex", "1").call(utilNoAuto).on("focus", function() {
73171 var node = select_default2(this).node();
73172 node.setSelectionRange(0, node.value.length);
73173 }).on("blur", function() {
73174 setLabelForEntity();
73175 }).call(combobox.fetcher(fetchWikidataItems));
73176 combobox.on("accept", function(d2) {
73181 }).on("cancel", function() {
73182 setLabelForEntity();
73184 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) {
73185 d3_event.preventDefault();
73186 if (_wikiURL) window.open(_wikiURL, "_blank");
73188 searchRow = searchRow.merge(searchRowEnter);
73189 _searchInput = searchRow.select("input");
73190 var wikidataProperties = ["description", "identifier"];
73191 var items = list2.selectAll("li.labeled-input").data(wikidataProperties);
73192 var enter = items.enter().append("li").attr("class", function(d2) {
73193 return "labeled-input preset-wikidata-" + d2;
73195 enter.append("div").attr("class", "label").html(function(d2) {
73196 return _t.html("wikidata." + d2);
73198 enter.append("input").attr("type", "text").call(utilNoAuto).classed("disabled", "true").attr("readonly", "true");
73199 enter.append("button").attr("class", "form-field-button").attr("title", _t("icons.copy")).call(svgIcon("#iD-operation-copy")).on("click", function(d3_event) {
73200 d3_event.preventDefault();
73201 select_default2(this.parentNode).select("input").node().select();
73202 document.execCommand("copy");
73205 function fetchWikidataItems(q2, callback) {
73206 if (!q2 && _hintKey) {
73207 for (var i3 in _entityIDs) {
73208 var entity = context.hasEntity(_entityIDs[i3]);
73209 if (entity.tags[_hintKey]) {
73210 q2 = entity.tags[_hintKey];
73215 wikidata.itemsForSearchQuery(q2, function(err, data) {
73217 if (err !== "No query") console.error(err);
73220 var result = data.map(function(item) {
73223 value: item.display.label.value + " (" + item.id + ")",
73224 display: (selection2) => selection2.append("span").attr("class", "localized-text").attr("lang", item.display.label.language).text(item.display.label.value),
73225 title: item.display.description && item.display.description.value,
73226 terms: item.aliases
73229 if (callback) callback(result);
73232 function change() {
73234 syncTags[field.key] = _qid;
73235 dispatch14.call("change", this, syncTags);
73236 var initGraph = context.graph();
73237 var initEntityIDs = _entityIDs;
73238 wikidata.entityByQID(_qid, function(err, entity) {
73240 if (context.graph() !== initGraph) return;
73241 if (!entity.sitelinks) return;
73242 var langs = wikidata.languagesToQuery();
73243 ["labels", "descriptions"].forEach(function(key) {
73244 if (!entity[key]) return;
73245 var valueLangs = Object.keys(entity[key]);
73246 if (valueLangs.length === 0) return;
73247 var valueLang = valueLangs[0];
73248 if (langs.indexOf(valueLang) === -1) {
73249 langs.push(valueLang);
73252 var newWikipediaValue;
73253 if (_wikipediaKey) {
73254 var foundPreferred;
73255 for (var i3 in langs) {
73256 var lang = langs[i3];
73257 var siteID = lang.replace("-", "_") + "wiki";
73258 if (entity.sitelinks[siteID]) {
73259 foundPreferred = true;
73260 newWikipediaValue = lang + ":" + entity.sitelinks[siteID].title;
73264 if (!foundPreferred) {
73265 var wikiSiteKeys = Object.keys(entity.sitelinks).filter(function(site) {
73266 return site.endsWith("wiki");
73268 if (wikiSiteKeys.length === 0) {
73269 newWikipediaValue = null;
73271 var wikiLang = wikiSiteKeys[0].slice(0, -4).replace("_", "-");
73272 var wikiTitle = entity.sitelinks[wikiSiteKeys[0]].title;
73273 newWikipediaValue = wikiLang + ":" + wikiTitle;
73277 if (newWikipediaValue) {
73278 newWikipediaValue = context.cleanTagValue(newWikipediaValue);
73280 if (typeof newWikipediaValue === "undefined") return;
73281 var actions = initEntityIDs.map(function(entityID) {
73282 var entity2 = context.hasEntity(entityID);
73283 if (!entity2) return null;
73284 var currTags = Object.assign({}, entity2.tags);
73285 if (newWikipediaValue === null) {
73286 if (!currTags[_wikipediaKey]) return null;
73287 delete currTags[_wikipediaKey];
73289 currTags[_wikipediaKey] = newWikipediaValue;
73291 return actionChangeTags(entityID, currTags);
73292 }).filter(Boolean);
73293 if (!actions.length) return;
73295 function actionUpdateWikipediaTags(graph) {
73296 actions.forEach(function(action) {
73297 graph = action(graph);
73301 context.history().undoAnnotation()
73305 function setLabelForEntity() {
73307 if (_wikidataEntity) {
73308 label = entityPropertyForDisplay(_wikidataEntity, "labels");
73309 if (label.length === 0) {
73310 label = _wikidataEntity.id.toString();
73313 utilGetSetValue(_searchInput, label);
73315 wiki.tags = function(tags) {
73316 var isMixed = Array.isArray(tags[field.key]);
73317 _searchInput.attr("title", isMixed ? tags[field.key].filter(Boolean).join("\n") : null).attr("placeholder", isMixed ? _t("inspector.multiple_values") : "").classed("mixed", isMixed);
73318 _qid = typeof tags[field.key] === "string" && tags[field.key] || "";
73319 if (!/^Q[0-9]*$/.test(_qid)) {
73323 _wikiURL = "https://wikidata.org/wiki/" + _qid;
73324 wikidata.entityByQID(_qid, function(err, entity) {
73329 _wikidataEntity = entity;
73330 setLabelForEntity();
73331 var description = entityPropertyForDisplay(entity, "descriptions");
73332 _selection.select("button.wiki-link").classed("disabled", false);
73333 _selection.select(".preset-wikidata-description").style("display", function() {
73334 return description.length > 0 ? "flex" : "none";
73335 }).select("input").attr("value", description);
73336 _selection.select(".preset-wikidata-identifier").style("display", function() {
73337 return entity.id ? "flex" : "none";
73338 }).select("input").attr("value", entity.id);
73340 function unrecognized() {
73341 _wikidataEntity = null;
73342 setLabelForEntity();
73343 _selection.select(".preset-wikidata-description").style("display", "none");
73344 _selection.select(".preset-wikidata-identifier").style("display", "none");
73345 _selection.select("button.wiki-link").classed("disabled", true);
73346 if (_qid && _qid !== "") {
73347 _wikiURL = "https://wikidata.org/wiki/Special:Search?search=" + _qid;
73353 function entityPropertyForDisplay(wikidataEntity, propKey) {
73354 if (!wikidataEntity[propKey]) return "";
73355 var propObj = wikidataEntity[propKey];
73356 var langKeys = Object.keys(propObj);
73357 if (langKeys.length === 0) return "";
73358 var langs = wikidata.languagesToQuery();
73359 for (var i3 in langs) {
73360 var lang = langs[i3];
73361 var valueObj = propObj[lang];
73362 if (valueObj && valueObj.value && valueObj.value.length > 0) return valueObj.value;
73364 return propObj[langKeys[0]].value;
73366 wiki.entityIDs = function(val) {
73367 if (!arguments.length) return _entityIDs;
73371 wiki.focus = function() {
73372 _searchInput.node().focus();
73374 return utilRebind(wiki, dispatch14, "on");
73377 // modules/ui/fields/wikipedia.js
73378 function uiFieldWikipedia(field, context) {
73379 const scheme = "https://";
73380 const domain = "wikipedia.org";
73381 const dispatch14 = dispatch_default("change");
73382 const wikipedia = services.wikipedia;
73383 const wikidata = services.wikidata;
73384 let _langInput = select_default2(null);
73385 let _titleInput = select_default2(null);
73389 let _dataWikipedia = [];
73390 _mainFileFetcher.get("wmf_sitematrix").then((d2) => {
73391 _dataWikipedia = d2;
73392 if (_tags) updateForTags(_tags);
73395 const langCombo = uiCombobox(context, "wikipedia-lang").fetcher((value, callback) => {
73396 const v2 = value.toLowerCase();
73398 _dataWikipedia.filter((d2) => {
73399 return d2[0].toLowerCase().indexOf(v2) >= 0 || d2[1].toLowerCase().indexOf(v2) >= 0 || d2[2].toLowerCase().indexOf(v2) >= 0;
73400 }).map((d2) => ({ value: d2[1] }))
73403 const titleCombo = uiCombobox(context, "wikipedia-title").fetcher((value, callback) => {
73406 for (let i3 in _entityIDs) {
73407 let entity = context.hasEntity(_entityIDs[i3]);
73408 if (entity.tags.name) {
73409 value = entity.tags.name;
73414 const searchfn = value.length > 7 ? wikipedia.search : wikipedia.suggestions;
73415 searchfn(language()[2], value, (query, data) => {
73416 callback(data.map((d2) => ({ value: d2 })));
73419 function wiki(selection2) {
73420 let wrap2 = selection2.selectAll(".form-field-input-wrap").data([0]);
73421 wrap2 = wrap2.enter().append("div").attr("class", "form-field-input-wrap form-field-input-".concat(field.type)).merge(wrap2);
73422 let langContainer = wrap2.selectAll(".wiki-lang-container").data([0]);
73423 langContainer = langContainer.enter().append("div").attr("class", "wiki-lang-container").merge(langContainer);
73424 _langInput = langContainer.selectAll("input.wiki-lang").data([0]);
73425 _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);
73426 _langInput.on("blur", changeLang).on("change", changeLang);
73427 let titleContainer = wrap2.selectAll(".wiki-title-container").data([0]);
73428 titleContainer = titleContainer.enter().append("div").attr("class", "wiki-title-container").merge(titleContainer);
73429 _titleInput = titleContainer.selectAll("input.wiki-title").data([0]);
73430 _titleInput = _titleInput.enter().append("input").attr("type", "text").attr("class", "wiki-title").attr("id", field.domId).call(utilNoAuto).call(titleCombo).merge(_titleInput);
73431 _titleInput.on("blur", function() {
73433 }).on("change", function() {
73436 let link3 = titleContainer.selectAll(".wiki-link").data([0]);
73437 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);
73438 link3.on("click", (d3_event) => {
73439 d3_event.preventDefault();
73440 if (_wikiURL) window.open(_wikiURL, "_blank");
73443 function defaultLanguageInfo(skipEnglishFallback) {
73444 const langCode = _mainLocalizer.languageCode().toLowerCase();
73445 for (let i3 in _dataWikipedia) {
73446 let d2 = _dataWikipedia[i3];
73447 if (d2[2] === langCode) return d2;
73449 return skipEnglishFallback ? ["", "", ""] : ["English", "English", "en"];
73451 function language(skipEnglishFallback) {
73452 const value = utilGetSetValue(_langInput).toLowerCase();
73453 for (let i3 in _dataWikipedia) {
73454 let d2 = _dataWikipedia[i3];
73455 if (d2[0].toLowerCase() === value || d2[1].toLowerCase() === value || d2[2] === value) return d2;
73457 return defaultLanguageInfo(skipEnglishFallback);
73459 function changeLang() {
73460 utilGetSetValue(_langInput, language()[1]);
73463 function change(skipWikidata) {
73464 let value = utilGetSetValue(_titleInput);
73465 const m2 = value.match(/https?:\/\/([-a-z]+)\.wikipedia\.org\/(?:wiki|\1-[-a-z]+)\/([^#]+)(?:#(.+))?/);
73466 const langInfo = m2 && _dataWikipedia.find((d2) => m2[1] === d2[2]);
73469 const nativeLangName = langInfo[1];
73470 value = decodeURIComponent(m2[2]).replace(/_/g, " ");
73473 anchor = decodeURIComponent(m2[3]);
73474 value += "#" + anchor.replace(/_/g, " ");
73476 value = value.slice(0, 1).toUpperCase() + value.slice(1);
73477 utilGetSetValue(_langInput, nativeLangName);
73478 utilGetSetValue(_titleInput, value);
73481 syncTags.wikipedia = context.cleanTagValue(language()[2] + ":" + value);
73483 syncTags.wikipedia = void 0;
73485 dispatch14.call("change", this, syncTags);
73486 if (skipWikidata || !value || !language()[2]) return;
73487 const initGraph = context.graph();
73488 const initEntityIDs = _entityIDs;
73489 wikidata.itemsByTitle(language()[2], value, (err, data) => {
73490 if (err || !data || !Object.keys(data).length) return;
73491 if (context.graph() !== initGraph) return;
73492 const qids = Object.keys(data);
73493 const value2 = qids && qids.find((id2) => id2.match(/^Q\d+$/));
73494 let actions = initEntityIDs.map((entityID) => {
73495 let entity = context.entity(entityID).tags;
73496 let currTags = Object.assign({}, entity);
73497 if (currTags.wikidata !== value2) {
73498 currTags.wikidata = value2;
73499 return actionChangeTags(entityID, currTags);
73502 }).filter(Boolean);
73503 if (!actions.length) return;
73505 function actionUpdateWikidataTags(graph) {
73506 actions.forEach(function(action) {
73507 graph = action(graph);
73511 context.history().undoAnnotation()
73515 wiki.tags = (tags) => {
73517 updateForTags(tags);
73519 function updateForTags(tags) {
73520 const value = typeof tags[field.key] === "string" ? tags[field.key] : "";
73521 const m2 = value.match(/([^:]+):([^#]+)(?:#(.+))?/);
73522 const tagLang = m2 && m2[1];
73523 const tagArticleTitle = m2 && m2[2];
73524 let anchor = m2 && m2[3];
73525 const tagLangInfo = tagLang && _dataWikipedia.find((d2) => tagLang === d2[2]);
73527 const nativeLangName = tagLangInfo[1];
73528 utilGetSetValue(_langInput, nativeLangName);
73529 utilGetSetValue(_titleInput, tagArticleTitle + (anchor ? "#" + anchor : ""));
73530 _wikiURL = "".concat(scheme).concat(tagLang, ".").concat(domain, "/wiki/").concat(wiki.encodePath(tagArticleTitle, anchor));
73532 utilGetSetValue(_titleInput, value);
73533 if (value && value !== "") {
73534 utilGetSetValue(_langInput, "");
73535 const defaultLangInfo = defaultLanguageInfo();
73536 _wikiURL = "".concat(scheme).concat(defaultLangInfo[2], ".").concat(domain, "/w/index.php?fulltext=1&search=").concat(value);
73538 const shownOrDefaultLangInfo = language(
73540 /* skipEnglishFallback */
73542 utilGetSetValue(_langInput, shownOrDefaultLangInfo[1]);
73547 wiki.encodePath = (tagArticleTitle, anchor) => {
73548 const underscoredTitle = tagArticleTitle.replace(/ /g, "_");
73549 const uriEncodedUnderscoredTitle = encodeURIComponent(underscoredTitle);
73550 const uriEncodedAnchorFragment = wiki.encodeURIAnchorFragment(anchor);
73551 return "".concat(uriEncodedUnderscoredTitle).concat(uriEncodedAnchorFragment);
73553 wiki.encodeURIAnchorFragment = (anchor) => {
73554 if (!anchor) return "";
73555 const underscoredAnchor = anchor.replace(/ /g, "_");
73556 return "#" + encodeURIComponent(underscoredAnchor);
73558 wiki.entityIDs = (val) => {
73559 if (!arguments.length) return _entityIDs;
73563 wiki.focus = () => {
73564 _titleInput.node().focus();
73566 return utilRebind(wiki, dispatch14, "on");
73568 uiFieldWikipedia.supportsMultiselection = false;
73570 // modules/ui/fields/index.js
73572 access: uiFieldAccess,
73573 address: uiFieldAddress,
73574 check: uiFieldCheck,
73575 colour: uiFieldText,
73576 combo: uiFieldCombo,
73577 cycleway: uiFieldDirectionalCombo,
73579 defaultCheck: uiFieldCheck,
73580 directionalCombo: uiFieldDirectionalCombo,
73581 email: uiFieldText,
73582 identifier: uiFieldText,
73583 lanes: uiFieldLanes,
73584 localized: uiFieldLocalized,
73585 roadheight: uiFieldRoadheight,
73586 roadspeed: uiFieldRoadspeed,
73587 manyCombo: uiFieldCombo,
73588 multiCombo: uiFieldCombo,
73589 networkCombo: uiFieldCombo,
73590 number: uiFieldText,
73591 onewayCheck: uiFieldCheck,
73592 radio: uiFieldRadio,
73593 restrictions: uiFieldRestrictions,
73594 semiCombo: uiFieldCombo,
73595 structureRadio: uiFieldRadio,
73598 textarea: uiFieldTextarea,
73599 typeCombo: uiFieldCombo,
73601 wikidata: uiFieldWikidata,
73602 wikipedia: uiFieldWikipedia
73605 // modules/ui/field.js
73606 function uiField(context, presetField2, entityIDs, options2) {
73607 options2 = Object.assign({
73614 var dispatch14 = dispatch_default("change", "revert");
73615 var field = Object.assign({}, presetField2);
73616 field.domId = utilUniqueDomId("form-field-" + field.safeid);
73617 var _show = options2.show;
73621 if (entityIDs && entityIDs.length) {
73622 _entityExtent = entityIDs.reduce(function(extent, entityID) {
73623 var entity = context.graph().entity(entityID);
73624 return extent.extend(entity.extent(context.graph()));
73627 var _locked = false;
73628 var _lockedTip = uiTooltip().title(() => _t.append("inspector.lock.suggestion", { label: field.title })).placement("bottom");
73629 if (_show && !field.impl) {
73632 function createField() {
73633 field.impl = uiFields[field.type](field, context).on("change", function(t2, onInput) {
73634 dispatch14.call("change", field, t2, onInput);
73637 field.entityIDs = entityIDs;
73638 if (field.impl.entityIDs) {
73639 field.impl.entityIDs(entityIDs);
73643 function allKeys() {
73644 let keys2 = field.keys || [field.key];
73645 if (field.type === "directionalCombo" && field.key) {
73646 keys2 = keys2.concat(field.key);
73650 function isModified() {
73651 if (!entityIDs || !entityIDs.length) return false;
73652 return entityIDs.some(function(entityID) {
73653 var original = context.graph().base().entities[entityID];
73654 var latest = context.graph().entity(entityID);
73655 return allKeys().some(function(key) {
73656 return original ? latest.tags[key] !== original.tags[key] : latest.tags[key];
73660 function tagsContainFieldKey() {
73661 return allKeys().some(function(key) {
73662 if (field.type === "multiCombo") {
73663 for (var tagKey in _tags) {
73664 if (tagKey.indexOf(key) === 0) {
73670 if (field.type === "localized") {
73671 for (let tagKey2 in _tags) {
73672 let match = tagKey2.match(LANGUAGE_SUFFIX_REGEX);
73673 if (match && match[1] === field.key && match[2]) {
73678 return _tags[key] !== void 0;
73681 function revert(d3_event, d2) {
73682 d3_event.stopPropagation();
73683 d3_event.preventDefault();
73684 if (!entityIDs || _locked) return;
73685 dispatch14.call("revert", d2, allKeys());
73687 function remove2(d3_event, d2) {
73688 d3_event.stopPropagation();
73689 d3_event.preventDefault();
73690 if (_locked) return;
73692 allKeys().forEach(function(key) {
73695 dispatch14.call("change", d2, t2);
73697 field.render = function(selection2) {
73698 var container = selection2.selectAll(".form-field").data([field]);
73699 var enter = container.enter().append("div").attr("class", function(d2) {
73700 return "form-field form-field-" + d2.safeid;
73701 }).classed("nowrap", !options2.wrap);
73702 if (options2.wrap) {
73703 var labelEnter = enter.append("label").attr("class", "field-label").attr("for", function(d2) {
73706 var textEnter = labelEnter.append("span").attr("class", "label-text");
73707 textEnter.append("span").attr("class", "label-textvalue").each(function(d2) {
73708 d2.label()(select_default2(this));
73710 textEnter.append("span").attr("class", "label-textannotation");
73711 if (options2.remove) {
73712 labelEnter.append("button").attr("class", "remove-icon").attr("title", _t("icons.remove")).call(svgIcon("#iD-operation-delete"));
73714 if (options2.revert) {
73715 labelEnter.append("button").attr("class", "modified-icon").attr("title", _t("icons.undo")).call(svgIcon(_mainLocalizer.textDirection() === "rtl" ? "#iD-icon-redo" : "#iD-icon-undo"));
73718 container = container.merge(enter);
73719 container.select(".field-label > .remove-icon").on("click", remove2);
73720 container.select(".field-label > .modified-icon").on("click", revert);
73721 container.each(function(d2) {
73722 var selection3 = select_default2(this);
73726 var reference, help;
73727 if (options2.wrap && field.type === "restrictions") {
73728 help = uiFieldHelp(context, "restrictions");
73730 if (options2.wrap && options2.info) {
73731 var referenceKey = d2.key || "";
73732 if (d2.type === "multiCombo") {
73733 referenceKey = referenceKey.replace(/:$/, "");
73735 var referenceOptions = d2.reference || {
73737 value: _tags[referenceKey]
73739 reference = uiTagReference(referenceOptions, context);
73740 if (_state === "hover") {
73741 reference.showing(false);
73744 selection3.call(d2.impl);
73746 selection3.call(help.body).select(".field-label").call(help.button);
73749 selection3.call(reference.body).select(".field-label").call(reference.button);
73751 d2.impl.tags(_tags);
73753 container.classed("locked", _locked).classed("modified", isModified()).classed("present", tagsContainFieldKey());
73754 var annotation = container.selectAll(".field-label .label-textannotation");
73755 var icon2 = annotation.selectAll(".icon").data(_locked ? [0] : []);
73756 icon2.exit().remove();
73757 icon2.enter().append("svg").attr("class", "icon").append("use").attr("xlink:href", "#fas-lock");
73758 container.call(_locked ? _lockedTip : _lockedTip.destroy);
73760 field.state = function(val) {
73761 if (!arguments.length) return _state;
73765 field.tags = function(val) {
73766 if (!arguments.length) return _tags;
73768 if (tagsContainFieldKey() && !_show) {
73776 field.locked = function(val) {
73777 if (!arguments.length) return _locked;
73781 field.show = function() {
73786 if (field.default && field.key && _tags[field.key] !== field.default) {
73788 t2[field.key] = field.default;
73789 dispatch14.call("change", this, t2);
73792 field.isShown = function() {
73795 field.isAllowed = function() {
73796 if (entityIDs && entityIDs.length > 1 && uiFields[field.type].supportsMultiselection === false) return false;
73797 if (field.geometry && !entityIDs.every(function(entityID) {
73798 return field.matchGeometry(context.graph().geometry(entityID));
73800 if (entityIDs && _entityExtent && field.locationSetID) {
73801 var validHere = _sharedLocationManager.locationSetsAt(_entityExtent.center());
73802 if (!validHere[field.locationSetID]) return false;
73804 var prerequisiteTag = field.prerequisiteTag;
73805 if (entityIDs && !tagsContainFieldKey() && // ignore tagging prerequisites if a value is already present
73807 if (!entityIDs.every(function(entityID) {
73808 var entity = context.graph().entity(entityID);
73809 if (prerequisiteTag.key) {
73810 var value = entity.tags[prerequisiteTag.key];
73811 if (!value) return false;
73812 if (prerequisiteTag.valueNot) {
73813 return prerequisiteTag.valueNot !== value;
73815 if (prerequisiteTag.value) {
73816 return prerequisiteTag.value === value;
73818 } else if (prerequisiteTag.keyNot) {
73819 if (entity.tags[prerequisiteTag.keyNot]) return false;
73826 field.focus = function() {
73828 field.impl.focus();
73831 return utilRebind(field, dispatch14, "on");
73834 // modules/ui/changeset_editor.js
73835 function uiChangesetEditor(context) {
73836 var dispatch14 = dispatch_default("change");
73837 var formFields = uiFormFields(context);
73838 var commentCombo = uiCombobox(context, "comment").caseSensitive(true);
73842 function changesetEditor(selection2) {
73843 render(selection2);
73845 function render(selection2) {
73846 var initial = false;
73849 var presets = _mainPresetIndex;
73851 uiField(context, presets.field("comment"), null, { show: true, revert: false }),
73852 uiField(context, presets.field("source"), null, { show: true, revert: false }),
73853 uiField(context, presets.field("hashtags"), null, { show: false, revert: false })
73855 _fieldsArr.forEach(function(field) {
73856 field.on("change", function(t2, onInput) {
73857 dispatch14.call("change", field, void 0, t2, onInput);
73861 _fieldsArr.forEach(function(field) {
73864 selection2.call(formFields.fieldsArr(_fieldsArr));
73866 var commentField = selection2.select(".form-field-comment textarea");
73867 var commentNode = commentField.node();
73869 commentNode.focus();
73870 commentNode.select();
73872 utilTriggerEvent(commentField, "blur");
73873 var osm = context.connection();
73875 osm.userChangesets(function(err, changesets) {
73877 var comments = changesets.map(function(changeset) {
73878 var comment = changeset.tags.comment;
73879 return comment ? { title: comment, value: comment } : null;
73880 }).filter(Boolean);
73882 commentCombo.data(utilArrayUniqBy(comments, "title"))
73887 const warnings = [];
73888 if (_tags.comment.match(/google/i)) {
73890 id: 'contains "google"',
73891 msg: _t.append("commit.google_warning"),
73892 link: _t("commit.google_warning_link")
73895 const maxChars = context.maxCharsForTagValue();
73896 const strLen = utilUnicodeCharsCount(utilCleanOsmString(_tags.comment, Number.POSITIVE_INFINITY));
73897 if (strLen > maxChars || false) {
73899 id: "message too long",
73900 msg: _t.append("commit.changeset_comment_length_warning", { maxChars })
73903 var commentWarning = selection2.select(".form-field-comment").selectAll(".comment-warning").data(warnings, (d2) => d2.id);
73904 commentWarning.exit().transition().duration(200).style("opacity", 0).remove();
73905 var commentEnter = commentWarning.enter().insert("div", ".comment-warning").attr("class", "comment-warning field-warning").style("opacity", 0);
73906 commentEnter.call(svgIcon("#iD-icon-alert", "inline")).append("span");
73907 commentEnter.transition().duration(200).style("opacity", 1);
73908 commentWarning.merge(commentEnter).selectAll("div > span").text("").each(function(d2) {
73909 let selection3 = select_default2(this);
73911 selection3 = selection3.append("a").attr("target", "_blank").attr("href", d2.link);
73913 selection3.call(d2.msg);
73916 changesetEditor.tags = function(_2) {
73917 if (!arguments.length) return _tags;
73919 return changesetEditor;
73921 changesetEditor.changesetID = function(_2) {
73922 if (!arguments.length) return _changesetID;
73923 if (_changesetID === _2) return changesetEditor;
73926 return changesetEditor;
73928 return utilRebind(changesetEditor, dispatch14, "on");
73931 // modules/ui/sections/changes.js
73932 function uiSectionChanges(context) {
73933 var _discardTags = {};
73934 _mainFileFetcher.get("discarded").then(function(d2) {
73936 }).catch(function() {
73938 var section = uiSection("changes-list", context).label(function() {
73939 var history = context.history();
73940 var summary = history.difference().summary();
73941 return _t.append("inspector.title_count", { title: _t("commit.changes"), count: summary.length });
73942 }).disclosureContent(renderDisclosureContent);
73943 function renderDisclosureContent(selection2) {
73944 var history = context.history();
73945 var summary = history.difference().summary();
73946 var container = selection2.selectAll(".commit-section").data([0]);
73947 var containerEnter = container.enter().append("div").attr("class", "commit-section");
73948 containerEnter.append("ul").attr("class", "changeset-list");
73949 container = containerEnter.merge(container);
73950 var items = container.select("ul").selectAll("li").data(summary);
73951 var itemsEnter = items.enter().append("li").attr("class", "change-item");
73952 var buttons = itemsEnter.append("button").on("mouseover", mouseover).on("mouseout", mouseout).on("click", click);
73953 buttons.each(function(d2) {
73954 select_default2(this).call(svgIcon("#iD-icon-" + d2.entity.geometry(d2.graph), "pre-text " + d2.changeType));
73956 buttons.append("span").attr("class", "change-type").html(function(d2) {
73957 return _t.html("commit." + d2.changeType) + " ";
73959 buttons.append("strong").attr("class", "entity-type").text(function(d2) {
73960 var matched = _mainPresetIndex.match(d2.entity, d2.graph);
73961 return matched && matched.name() || utilDisplayType(d2.entity.id);
73963 buttons.append("span").attr("class", "entity-name").text(function(d2) {
73964 var name = utilDisplayName(d2.entity) || "", string = "";
73968 return string += " " + name;
73970 items = itemsEnter.merge(items);
73971 var changeset = new osmChangeset().update({ id: void 0 });
73972 var changes = history.changes(actionDiscardTags(history.difference(), _discardTags));
73973 delete changeset.id;
73974 var data = JXON.stringify(changeset.osmChangeJXON(changes));
73975 var blob = new Blob([data], { type: "text/xml;charset=utf-8;" });
73976 var fileName = "changes.osc";
73977 var linkEnter = container.selectAll(".download-changes").data([0]).enter().append("a").attr("class", "download-changes");
73978 linkEnter.attr("href", window.URL.createObjectURL(blob)).attr("download", fileName);
73979 linkEnter.call(svgIcon("#iD-icon-load", "inline")).append("span").call(_t.append("commit.download_changes"));
73980 function mouseover(d2) {
73982 context.surface().selectAll(
73983 utilEntityOrMemberSelector([d2.entity.id], context.graph())
73984 ).classed("hover", true);
73987 function mouseout() {
73988 context.surface().selectAll(".hover").classed("hover", false);
73990 function click(d3_event, change) {
73991 if (change.changeType !== "deleted") {
73992 var entity = change.entity;
73993 context.map().zoomToEase(entity);
73994 context.surface().selectAll(utilEntityOrMemberSelector([entity.id], context.graph())).classed("hover", true);
74001 // modules/ui/commit.js
74002 var readOnlyTags = [
74003 /^changesets_count$/,
74012 /^closed:keepright$/,
74015 var hashtagRegex = /(#[^\u2000-\u206F\u2E00-\u2E7F\s\\'!"#$%()*,.\/:;<=>?@\[\]^`{|}~]+)/g;
74016 function uiCommit(context) {
74017 var dispatch14 = dispatch_default("cancel");
74020 var changesetEditor = uiChangesetEditor(context).on("change", changeTags);
74021 var rawTagEditor = uiSectionRawTagEditor("changeset-tag-editor", context).on("change", changeTags).readOnlyTags(readOnlyTags);
74022 var commitChanges = uiSectionChanges(context);
74023 var commitWarnings = uiCommitWarnings(context);
74024 function commit(selection2) {
74025 _selection = selection2;
74026 if (!context.changeset) initChangeset();
74027 loadDerivedChangesetTags();
74028 selection2.call(render);
74030 function initChangeset() {
74031 var commentDate = +corePreferences("commentDate") || 0;
74032 var currDate = Date.now();
74033 var cutoff = 2 * 86400 * 1e3;
74034 if (commentDate > currDate || currDate - commentDate > cutoff) {
74035 corePreferences("comment", null);
74036 corePreferences("hashtags", null);
74037 corePreferences("source", null);
74039 if (context.defaultChangesetComment()) {
74040 corePreferences("comment", context.defaultChangesetComment());
74041 corePreferences("commentDate", Date.now());
74043 if (context.defaultChangesetSource()) {
74044 corePreferences("source", context.defaultChangesetSource());
74045 corePreferences("commentDate", Date.now());
74047 if (context.defaultChangesetHashtags()) {
74048 corePreferences("hashtags", context.defaultChangesetHashtags());
74049 corePreferences("commentDate", Date.now());
74051 var detected = utilDetect();
74053 comment: corePreferences("comment") || "",
74054 created_by: context.cleanTagValue("iD " + context.version),
74055 host: context.cleanTagValue(detected.host),
74056 locale: context.cleanTagValue(_mainLocalizer.localeCode())
74058 findHashtags(tags, true);
74059 var hashtags = corePreferences("hashtags");
74061 tags.hashtags = hashtags;
74063 var source = corePreferences("source");
74065 tags.source = source;
74067 var photoOverlaysUsed = context.history().photoOverlaysUsed();
74068 if (photoOverlaysUsed.length) {
74069 var sources = (tags.source || "").split(";");
74070 if (sources.indexOf("streetlevel imagery") === -1) {
74071 sources.push("streetlevel imagery");
74073 photoOverlaysUsed.forEach(function(photoOverlay) {
74074 if (sources.indexOf(photoOverlay) === -1) {
74075 sources.push(photoOverlay);
74078 tags.source = context.cleanTagValue(sources.join(";"));
74080 context.changeset = new osmChangeset({ tags });
74082 function loadDerivedChangesetTags() {
74083 var osm = context.connection();
74085 var tags = Object.assign({}, context.changeset.tags);
74086 var imageryUsed = context.cleanTagValue(context.history().imageryUsed().join(";"));
74087 tags.imagery_used = imageryUsed || "None";
74088 var osmClosed = osm.getClosedIDs();
74090 if (osmClosed.length) {
74091 tags["closed:note"] = context.cleanTagValue(osmClosed.join(";"));
74093 if (services.keepRight) {
74094 var krClosed = services.keepRight.getClosedIDs();
74095 if (krClosed.length) {
74096 tags["closed:keepright"] = context.cleanTagValue(krClosed.join(";"));
74099 if (services.osmose) {
74100 var osmoseClosed = services.osmose.getClosedCounts();
74101 for (itemType in osmoseClosed) {
74102 tags["closed:osmose:" + itemType] = context.cleanTagValue(osmoseClosed[itemType].toString());
74105 for (var key in tags) {
74106 if (key.match(/(^warnings:)|(^resolved:)/)) {
74110 function addIssueCounts(issues, prefix) {
74111 var issuesByType = utilArrayGroupBy(issues, "type");
74112 for (var issueType in issuesByType) {
74113 var issuesOfType = issuesByType[issueType];
74114 if (issuesOfType[0].subtype) {
74115 var issuesBySubtype = utilArrayGroupBy(issuesOfType, "subtype");
74116 for (var issueSubtype in issuesBySubtype) {
74117 var issuesOfSubtype = issuesBySubtype[issueSubtype];
74118 tags[prefix + ":" + issueType + ":" + issueSubtype] = context.cleanTagValue(issuesOfSubtype.length.toString());
74121 tags[prefix + ":" + issueType] = context.cleanTagValue(issuesOfType.length.toString());
74125 var warnings = context.validator().getIssuesBySeverity({ what: "edited", where: "all", includeIgnored: true, includeDisabledRules: true }).warning.filter(function(issue) {
74126 return issue.type !== "help_request";
74128 addIssueCounts(warnings, "warnings");
74129 var resolvedIssues = context.validator().getResolvedIssues();
74130 addIssueCounts(resolvedIssues, "resolved");
74131 context.changeset = context.changeset.update({ tags });
74133 function render(selection2) {
74134 var osm = context.connection();
74136 var header = selection2.selectAll(".header").data([0]);
74137 var headerTitle = header.enter().append("div").attr("class", "header fillL");
74138 headerTitle.append("div").append("h2").call(_t.append("commit.title"));
74139 headerTitle.append("button").attr("class", "close").attr("title", _t("icons.close")).on("click", function() {
74140 dispatch14.call("cancel", this);
74141 }).call(svgIcon("#iD-icon-close"));
74142 var body = selection2.selectAll(".body").data([0]);
74143 body = body.enter().append("div").attr("class", "body").merge(body);
74144 var changesetSection = body.selectAll(".changeset-editor").data([0]);
74145 changesetSection = changesetSection.enter().append("div").attr("class", "modal-section changeset-editor").merge(changesetSection);
74146 changesetSection.call(
74147 changesetEditor.changesetID(context.changeset.id).tags(context.changeset.tags)
74149 body.call(commitWarnings);
74150 var saveSection = body.selectAll(".save-section").data([0]);
74151 saveSection = saveSection.enter().append("div").attr("class", "modal-section save-section fillL").merge(saveSection);
74152 var prose = saveSection.selectAll(".commit-info").data([0]);
74153 if (prose.enter().size()) {
74154 _userDetails2 = null;
74156 prose = prose.enter().append("p").attr("class", "commit-info").call(_t.append("commit.upload_explanation")).merge(prose);
74157 osm.userDetails(function(err, user) {
74159 if (_userDetails2 === user) return;
74160 _userDetails2 = user;
74161 var userLink = select_default2(document.createElement("div"));
74162 if (user.image_url) {
74163 userLink.append("img").attr("src", user.image_url).attr("class", "icon pre-text user-icon");
74165 userLink.append("a").attr("class", "user-info").text(user.display_name).attr("href", osm.userURL(user.display_name)).attr("target", "_blank");
74166 prose.html(_t.html("commit.upload_explanation_with_user", { user: { html: userLink.html() } }));
74168 var requestReview = saveSection.selectAll(".request-review").data([0]);
74169 var requestReviewEnter = requestReview.enter().append("div").attr("class", "request-review");
74170 var requestReviewDomId = utilUniqueDomId("commit-input-request-review");
74171 var labelEnter = requestReviewEnter.append("label").attr("for", requestReviewDomId);
74172 if (!labelEnter.empty()) {
74173 labelEnter.call(uiTooltip().title(() => _t.append("commit.request_review_info")).placement("top"));
74175 labelEnter.append("input").attr("type", "checkbox").attr("id", requestReviewDomId);
74176 labelEnter.append("span").call(_t.append("commit.request_review"));
74177 requestReview = requestReview.merge(requestReviewEnter);
74178 var requestReviewInput = requestReview.selectAll("input").property("checked", isReviewRequested(context.changeset.tags)).on("change", toggleRequestReview);
74179 var buttonSection = saveSection.selectAll(".buttons").data([0]);
74180 var buttonEnter = buttonSection.enter().append("div").attr("class", "buttons fillL");
74181 buttonEnter.append("button").attr("class", "secondary-action button cancel-button").append("span").attr("class", "label").call(_t.append("commit.cancel"));
74182 var uploadButton = buttonEnter.append("button").attr("class", "action button save-button");
74183 uploadButton.append("span").attr("class", "label").call(_t.append("commit.save"));
74184 var uploadBlockerTooltipText = getUploadBlockerMessage();
74185 buttonSection = buttonSection.merge(buttonEnter);
74186 buttonSection.selectAll(".cancel-button").on("click.cancel", function() {
74187 dispatch14.call("cancel", this);
74189 buttonSection.selectAll(".save-button").classed("disabled", uploadBlockerTooltipText !== null).on("click.save", function() {
74190 if (!select_default2(this).classed("disabled")) {
74192 for (var key in context.changeset.tags) {
74193 if (!key) delete context.changeset.tags[key];
74195 context.uploader().save(context.changeset);
74198 uiTooltip().destroyAny(buttonSection.selectAll(".save-button"));
74199 if (uploadBlockerTooltipText) {
74200 buttonSection.selectAll(".save-button").call(uiTooltip().title(() => uploadBlockerTooltipText).placement("top"));
74202 var tagSection = body.selectAll(".tag-section.raw-tag-editor").data([0]);
74203 tagSection = tagSection.enter().append("div").attr("class", "modal-section tag-section raw-tag-editor").merge(tagSection);
74205 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
74207 var changesSection = body.selectAll(".commit-changes-section").data([0]);
74208 changesSection = changesSection.enter().append("div").attr("class", "modal-section commit-changes-section").merge(changesSection);
74209 changesSection.call(commitChanges.render);
74210 function toggleRequestReview() {
74211 var rr = requestReviewInput.property("checked");
74212 updateChangeset({ review_requested: rr ? "yes" : void 0 });
74214 rawTagEditor.tags(Object.assign({}, context.changeset.tags)).render
74218 function getUploadBlockerMessage() {
74219 var errors = context.validator().getIssuesBySeverity({ what: "edited", where: "all" }).error;
74220 if (errors.length) {
74221 return _t.append("commit.outstanding_errors_message", { count: errors.length });
74223 var hasChangesetComment = context.changeset && context.changeset.tags.comment && context.changeset.tags.comment.trim().length;
74224 if (!hasChangesetComment) {
74225 return _t.append("commit.comment_needed_message");
74230 function changeTags(_2, changed, onInput) {
74231 if (changed.hasOwnProperty("comment")) {
74232 if (changed.comment === void 0) {
74233 changed.comment = "";
74236 corePreferences("comment", changed.comment);
74237 corePreferences("commentDate", Date.now());
74240 if (changed.hasOwnProperty("source")) {
74241 if (changed.source === void 0) {
74242 corePreferences("source", null);
74243 } else if (!onInput) {
74244 corePreferences("source", changed.source);
74245 corePreferences("commentDate", Date.now());
74248 updateChangeset(changed, onInput);
74250 _selection.call(render);
74253 function findHashtags(tags, commentOnly) {
74254 var detectedHashtags = commentHashtags();
74255 if (detectedHashtags.length) {
74256 corePreferences("hashtags", null);
74258 if (!detectedHashtags.length || !commentOnly) {
74259 detectedHashtags = detectedHashtags.concat(hashtagHashtags());
74261 var allLowerCase = /* @__PURE__ */ new Set();
74262 return detectedHashtags.filter(function(hashtag) {
74263 var lowerCase = hashtag.toLowerCase();
74264 if (!allLowerCase.has(lowerCase)) {
74265 allLowerCase.add(lowerCase);
74270 function commentHashtags() {
74271 var matches = (tags.comment || "").replace(/http\S*/g, "").match(hashtagRegex);
74272 return matches || [];
74274 function hashtagHashtags() {
74275 var matches = (tags.hashtags || "").split(/[,;\s]+/).map(function(s2) {
74276 if (s2[0] !== "#") {
74279 var matched = s2.match(hashtagRegex);
74280 return matched && matched[0];
74281 }).filter(Boolean);
74282 return matches || [];
74285 function isReviewRequested(tags) {
74286 var rr = tags.review_requested;
74287 if (rr === void 0) return false;
74288 rr = rr.trim().toLowerCase();
74289 return !(rr === "" || rr === "no");
74291 function updateChangeset(changed, onInput) {
74292 var tags = Object.assign({}, context.changeset.tags);
74293 Object.keys(changed).forEach(function(k2) {
74294 var v2 = changed[k2];
74295 k2 = context.cleanTagKey(k2);
74296 if (readOnlyTags.indexOf(k2) !== -1) return;
74297 if (v2 === void 0) {
74299 } else if (onInput) {
74302 tags[k2] = context.cleanTagValue(v2);
74306 var commentOnly = changed.hasOwnProperty("comment") && changed.comment !== "";
74307 var arr = findHashtags(tags, commentOnly);
74309 tags.hashtags = context.cleanTagValue(arr.join(";"));
74310 corePreferences("hashtags", tags.hashtags);
74312 delete tags.hashtags;
74313 corePreferences("hashtags", null);
74316 if (_userDetails2 && _userDetails2.changesets_count !== void 0) {
74317 var changesetsCount = parseInt(_userDetails2.changesets_count, 10) + 1;
74318 tags.changesets_count = String(changesetsCount);
74319 if (changesetsCount <= 100) {
74321 s2 = corePreferences("walkthrough_completed");
74323 tags["ideditor:walkthrough_completed"] = s2;
74325 s2 = corePreferences("walkthrough_progress");
74327 tags["ideditor:walkthrough_progress"] = s2;
74329 s2 = corePreferences("walkthrough_started");
74331 tags["ideditor:walkthrough_started"] = s2;
74335 delete tags.changesets_count;
74337 if (!(0, import_fast_deep_equal10.default)(context.changeset.tags, tags)) {
74338 context.changeset = context.changeset.update({ tags });
74341 commit.reset = function() {
74342 context.changeset = null;
74344 return utilRebind(commit, dispatch14, "on");
74347 // modules/modes/save.js
74348 function modeSave(context) {
74349 var mode = { id: "save" };
74350 var keybinding = utilKeybinding("modeSave");
74351 var commit = uiCommit(context).on("cancel", cancel);
74355 var uploader = context.uploader().on("saveStarted.modeSave", function() {
74357 }).on("willAttemptUpload.modeSave", prepareForSuccess).on("progressChanged.modeSave", showProgress).on("resultNoChanges.modeSave", function() {
74359 }).on("resultErrors.modeSave", showErrors).on("resultConflicts.modeSave", showConflicts).on("resultSuccess.modeSave", showSuccess);
74360 function cancel() {
74361 context.enter(modeBrowse(context));
74363 function showProgress(num, total) {
74364 var modal = context.container().select(".loading-modal .modal-section");
74365 var progress = modal.selectAll(".progress").data([0]);
74366 progress.enter().append("div").attr("class", "progress").merge(progress).text(_t("save.conflict_progress", { num, total }));
74368 function showConflicts(changeset, conflicts, origChanges) {
74369 var selection2 = context.container().select(".sidebar").append("div").attr("class", "sidebar-component");
74370 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
74371 _conflictsUi = uiConflicts(context).conflictList(conflicts).origChanges(origChanges).on("cancel", function() {
74372 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74373 selection2.remove();
74375 uploader.cancelConflictResolution();
74376 }).on("save", function() {
74377 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74378 selection2.remove();
74379 uploader.processResolvedConflicts(changeset);
74381 selection2.call(_conflictsUi);
74383 function showErrors(errors) {
74385 var selection2 = uiConfirm(context.container());
74386 selection2.select(".modal-section.header").append("h3").text(_t("save.error"));
74387 addErrors(selection2, errors);
74388 selection2.okButton();
74390 function addErrors(selection2, data) {
74391 var message = selection2.select(".modal-section.message-text");
74392 var items = message.selectAll(".error-container").data(data);
74393 var enter = items.enter().append("div").attr("class", "error-container");
74394 enter.append("a").attr("class", "error-description").attr("href", "#").classed("hide-toggle", true).text(function(d2) {
74395 return d2.msg || _t("save.unknown_error_details");
74396 }).on("click", function(d3_event) {
74397 d3_event.preventDefault();
74398 var error = select_default2(this);
74399 var detail = select_default2(this.nextElementSibling);
74400 var exp2 = error.classed("expanded");
74401 detail.style("display", exp2 ? "none" : "block");
74402 error.classed("expanded", !exp2);
74404 var details = enter.append("div").attr("class", "error-detail-container").style("display", "none");
74405 details.append("ul").attr("class", "error-detail-list").selectAll("li").data(function(d2) {
74406 return d2.details || [];
74407 }).enter().append("li").attr("class", "error-detail-item").text(function(d2) {
74410 items.exit().remove();
74412 function showSuccess(changeset) {
74414 var ui = _success.changeset(changeset).location(_location).on("cancel", function() {
74415 context.ui().sidebar.hide();
74417 context.enter(modeBrowse(context).sidebar(ui));
74419 function keybindingOn() {
74420 select_default2(document).call(keybinding.on("\u238B", cancel, true));
74422 function keybindingOff() {
74423 select_default2(document).call(keybinding.unbind);
74425 function prepareForSuccess() {
74426 _success = uiSuccess(context);
74428 if (!services.geocoder) return;
74429 services.geocoder.reverse(context.map().center(), function(err, result) {
74430 if (err || !result || !result.address) return;
74431 var addr = result.address;
74432 var place = addr && (addr.town || addr.city || addr.county) || "";
74433 var region = addr && (addr.state || addr.country) || "";
74434 var separator = place && region ? _t("success.thank_you_where.separator") : "";
74436 "success.thank_you_where.format",
74437 { place, separator, region }
74441 mode.selectedIDs = function() {
74442 return _conflictsUi ? _conflictsUi.shownEntityIds() : [];
74444 mode.enter = function() {
74445 context.ui().sidebar.expand();
74447 context.ui().sidebar.show(commit);
74450 context.container().selectAll(".main-content").classed("active", false).classed("inactive", true);
74451 var osm = context.connection();
74456 if (osm.authenticated()) {
74459 osm.authenticate(function(err) {
74468 mode.exit = function() {
74470 context.container().selectAll(".main-content").classed("active", true).classed("inactive", false);
74471 context.ui().sidebar.hide();
74476 // modules/modes/select_error.js
74477 function modeSelectError(context, selectedErrorID, selectedErrorService) {
74479 id: "select-error",
74482 var keybinding = utilKeybinding("select-error");
74483 var errorService = services[selectedErrorService];
74485 switch (selectedErrorService) {
74487 errorEditor = uiKeepRightEditor(context).on("change", function() {
74488 context.map().pan([0, 0]);
74489 var error = checkSelectedID();
74490 if (!error) return;
74491 context.ui().sidebar.show(errorEditor.error(error));
74495 errorEditor = uiOsmoseEditor(context).on("change", function() {
74496 context.map().pan([0, 0]);
74497 var error = checkSelectedID();
74498 if (!error) return;
74499 context.ui().sidebar.show(errorEditor.error(error));
74504 behaviorBreathe(context),
74505 behaviorHover(context),
74506 behaviorSelect(context),
74507 behaviorLasso(context),
74508 modeDragNode(context).behavior,
74509 modeDragNote(context).behavior
74511 function checkSelectedID() {
74512 if (!errorService) return;
74513 var error = errorService.getError(selectedErrorID);
74515 context.enter(modeBrowse(context));
74519 mode.zoomToSelected = function() {
74520 if (!errorService) return;
74521 var error = errorService.getError(selectedErrorID);
74523 context.map().centerZoomEase(error.loc, 20);
74526 mode.enter = function() {
74527 var error = checkSelectedID();
74528 if (!error) return;
74529 behaviors.forEach(context.install);
74530 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
74531 select_default2(document).call(keybinding);
74533 var sidebar = context.ui().sidebar;
74534 sidebar.show(errorEditor.error(error));
74535 context.map().on("drawn.select-error", selectError);
74536 function selectError(d3_event, drawn) {
74537 if (!checkSelectedID()) return;
74538 var selection2 = context.surface().selectAll(".itemId-" + selectedErrorID + "." + selectedErrorService);
74539 if (selection2.empty()) {
74540 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
74541 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
74542 context.enter(modeBrowse(context));
74545 selection2.classed("selected", true);
74546 context.selectedErrorID(selectedErrorID);
74550 if (context.container().select(".combobox").size()) return;
74551 context.enter(modeBrowse(context));
74554 mode.exit = function() {
74555 behaviors.forEach(context.uninstall);
74556 select_default2(document).call(keybinding.unbind);
74557 context.surface().selectAll(".qaItem.selected").classed("selected hover", false);
74558 context.map().on("drawn.select-error", null);
74559 context.ui().sidebar.hide();
74560 context.selectedErrorID(null);
74561 context.features().forceVisible([]);
74566 // modules/core/context.js
74567 function coreContext() {
74568 const dispatch14 = dispatch_default("enter", "exit", "change");
74569 let context = utilRebind({}, dispatch14, "on");
74570 let _deferred2 = /* @__PURE__ */ new Set();
74571 context.version = package_default.version;
74572 context.privacyVersion = "20201202";
74573 context.initialHashParams = window.location.hash ? utilStringQs(window.location.hash) : {};
74574 context.changeset = null;
74575 let _defaultChangesetComment = context.initialHashParams.comment;
74576 let _defaultChangesetSource = context.initialHashParams.source;
74577 let _defaultChangesetHashtags = context.initialHashParams.hashtags;
74578 context.defaultChangesetComment = function(val) {
74579 if (!arguments.length) return _defaultChangesetComment;
74580 _defaultChangesetComment = val;
74583 context.defaultChangesetSource = function(val) {
74584 if (!arguments.length) return _defaultChangesetSource;
74585 _defaultChangesetSource = val;
74588 context.defaultChangesetHashtags = function(val) {
74589 if (!arguments.length) return _defaultChangesetHashtags;
74590 _defaultChangesetHashtags = val;
74593 let _setsDocumentTitle = true;
74594 context.setsDocumentTitle = function(val) {
74595 if (!arguments.length) return _setsDocumentTitle;
74596 _setsDocumentTitle = val;
74599 let _documentTitleBase = document.title;
74600 context.documentTitleBase = function(val) {
74601 if (!arguments.length) return _documentTitleBase;
74602 _documentTitleBase = val;
74606 context.ui = () => _ui;
74607 context.lastPointerType = () => _ui.lastPointerType();
74608 let _keybinding = utilKeybinding("context");
74609 context.keybinding = () => _keybinding;
74610 select_default2(document).call(_keybinding);
74611 let _connection = services.osm;
74615 context.connection = () => _connection;
74616 context.history = () => _history;
74617 context.validator = () => _validator;
74618 context.uploader = () => _uploader;
74619 context.preauth = (options2) => {
74621 _connection.switch(options2);
74625 context.locale = function(locale2) {
74626 if (!arguments.length) return _mainLocalizer.localeCode();
74627 _mainLocalizer.preferredLocaleCodes(locale2);
74630 function afterLoad(cid, callback) {
74631 return (err, result) => {
74633 if (err.status === 400 || err.status === 401 || err.status === 403) {
74635 _connection.logout();
74638 if (typeof callback === "function") {
74642 } else if (_connection && _connection.getConnectionId() !== cid) {
74643 if (typeof callback === "function") {
74644 callback({ message: "Connection Switched", status: -1 });
74648 _history.merge(result.data, result.extent);
74649 if (typeof callback === "function") {
74650 callback(err, result);
74656 context.loadTiles = (projection2, callback) => {
74657 const handle = window.requestIdleCallback(() => {
74658 _deferred2.delete(handle);
74659 if (_connection && context.editableDataEnabled()) {
74660 const cid = _connection.getConnectionId();
74661 _connection.loadTiles(projection2, afterLoad(cid, callback));
74664 _deferred2.add(handle);
74666 context.loadTileAtLoc = (loc, callback) => {
74667 const handle = window.requestIdleCallback(() => {
74668 _deferred2.delete(handle);
74669 if (_connection && context.editableDataEnabled()) {
74670 const cid = _connection.getConnectionId();
74671 _connection.loadTileAtLoc(loc, afterLoad(cid, callback));
74674 _deferred2.add(handle);
74676 context.loadEntity = (entityID, callback) => {
74678 const cid = _connection.getConnectionId();
74679 _connection.loadEntity(entityID, afterLoad(cid, callback));
74680 _connection.loadEntityRelations(entityID, afterLoad(cid, callback));
74683 context.loadNote = (entityID, callback) => {
74685 const cid = _connection.getConnectionId();
74686 _connection.loadEntityNote(entityID, afterLoad(cid, callback));
74689 context.zoomToEntity = (entityID, zoomTo) => {
74690 context.zoomToEntities([entityID], zoomTo);
74692 context.zoomToEntities = (entityIDs, zoomTo) => {
74693 let loadedEntities = [];
74694 const throttledZoomTo = throttle_default(() => _map.zoomTo(loadedEntities), 500);
74695 entityIDs.forEach((entityID) => context.loadEntity(entityID, (err, result) => {
74697 const entity = result.data.find((e3) => e3.id === entityID);
74698 if (!entity) return;
74699 loadedEntities.push(entity);
74700 if (zoomTo !== false) {
74704 _map.on("drawn.zoomToEntity", () => {
74705 if (!entityIDs.every((entityID) => context.hasEntity(entityID))) return;
74706 _map.on("drawn.zoomToEntity", null);
74707 context.on("enter.zoomToEntity", null);
74708 context.enter(modeSelect(context, entityIDs));
74710 context.on("enter.zoomToEntity", () => {
74711 if (_mode.id !== "browse") {
74712 _map.on("drawn.zoomToEntity", null);
74713 context.on("enter.zoomToEntity", null);
74717 context.zoomToNote = (noteId, zoomTo) => {
74718 context.loadNote(noteId, (err, result) => {
74720 const entity = result.data.find((e3) => e3.id === noteId);
74722 const note = services.osm.getNote(noteId);
74723 if (zoomTo !== false) {
74724 context.map().centerZoom(note.loc, 15);
74726 const noteLayer = context.layers().layer("notes");
74727 noteLayer.enabled(true);
74728 context.enter(modeSelectNote(context, noteId));
74732 let _minEditableZoom = 16;
74733 context.minEditableZoom = function(val) {
74734 if (!arguments.length) return _minEditableZoom;
74735 _minEditableZoom = val;
74737 _connection.tileZoom(val);
74741 context.maxCharsForTagKey = () => 255;
74742 context.maxCharsForTagValue = () => 255;
74743 context.maxCharsForRelationRole = () => 255;
74744 context.cleanTagKey = (val) => utilCleanOsmString(val, context.maxCharsForTagKey());
74745 context.cleanTagValue = (val) => utilCleanOsmString(val, context.maxCharsForTagValue());
74746 context.cleanRelationRole = (val) => utilCleanOsmString(val, context.maxCharsForRelationRole());
74747 let _inIntro = false;
74748 context.inIntro = function(val) {
74749 if (!arguments.length) return _inIntro;
74753 context.save = () => {
74754 if (_inIntro || context.container().select(".modal").size()) return;
74756 if (_mode && _mode.id === "save") {
74758 if (services.osm && services.osm.isChangesetInflight()) {
74759 _history.clearSaved();
74763 canSave = context.selectedIDs().every((id2) => {
74764 const entity = context.hasEntity(id2);
74765 return entity && !entity.isDegenerate();
74771 if (_history.hasChanges()) {
74772 return _t("save.unsaved_changes");
74775 context.debouncedSave = debounce_default(context.save, 350);
74776 function withDebouncedSave(fn) {
74777 return function() {
74778 const result = fn.apply(_history, arguments);
74779 context.debouncedSave();
74783 context.hasEntity = (id2) => _history.graph().hasEntity(id2);
74784 context.entity = (id2) => _history.graph().entity(id2);
74786 context.mode = () => _mode;
74787 context.enter = (newMode) => {
74790 dispatch14.call("exit", this, _mode);
74794 dispatch14.call("enter", this, _mode);
74796 context.selectedIDs = () => _mode && _mode.selectedIDs && _mode.selectedIDs() || [];
74797 context.activeID = () => _mode && _mode.activeID && _mode.activeID();
74798 let _selectedNoteID;
74799 context.selectedNoteID = function(noteID) {
74800 if (!arguments.length) return _selectedNoteID;
74801 _selectedNoteID = noteID;
74804 let _selectedErrorID;
74805 context.selectedErrorID = function(errorID) {
74806 if (!arguments.length) return _selectedErrorID;
74807 _selectedErrorID = errorID;
74810 context.install = (behavior) => context.surface().call(behavior);
74811 context.uninstall = (behavior) => context.surface().call(behavior.off);
74813 context.copyGraph = () => _copyGraph;
74815 context.copyIDs = function(val) {
74816 if (!arguments.length) return _copyIDs;
74818 _copyGraph = _history.graph();
74822 context.copyLonLat = function(val) {
74823 if (!arguments.length) return _copyLonLat;
74828 context.background = () => _background;
74830 context.features = () => _features;
74831 context.hasHiddenConnections = (id2) => {
74832 const graph = _history.graph();
74833 const entity = graph.entity(id2);
74834 return _features.hasHiddenConnections(entity, graph);
74837 context.photos = () => _photos;
74839 context.map = () => _map;
74840 context.layers = () => _map.layers();
74841 context.surface = () => _map.surface;
74842 context.editableDataEnabled = () => _map.editableDataEnabled();
74843 context.surfaceRect = () => _map.surface.node().getBoundingClientRect();
74844 context.editable = () => {
74845 const mode = context.mode();
74846 if (!mode || mode.id === "save") return false;
74847 return _map.editableDataEnabled();
74849 let _debugFlags = {
74853 // label collision bounding boxes
74855 // imagery bounding polygons
74859 // downloaded data from osm
74861 context.debugFlags = () => _debugFlags;
74862 context.getDebug = (flag) => flag && _debugFlags[flag];
74863 context.setDebug = function(flag, val) {
74864 if (arguments.length === 1) val = true;
74865 _debugFlags[flag] = val;
74866 dispatch14.call("change");
74869 let _container = select_default2(null);
74870 context.container = function(val) {
74871 if (!arguments.length) return _container;
74873 _container.classed("ideditor", true);
74876 context.containerNode = function(val) {
74877 if (!arguments.length) return context.container().node();
74878 context.container(select_default2(val));
74882 context.embed = function(val) {
74883 if (!arguments.length) return _embed;
74887 let _assetPath = "";
74888 context.assetPath = function(val) {
74889 if (!arguments.length) return _assetPath;
74891 _mainFileFetcher.assetPath(val);
74894 let _assetMap = {};
74895 context.assetMap = function(val) {
74896 if (!arguments.length) return _assetMap;
74898 _mainFileFetcher.assetMap(val);
74901 context.asset = (val) => {
74902 if (/^http(s)?:\/\//i.test(val)) return val;
74903 const filename = _assetPath + val;
74904 return _assetMap[filename] || filename;
74906 context.imagePath = (val) => context.asset("img/".concat(val));
74907 context.reset = context.flush = () => {
74908 context.debouncedSave.cancel();
74909 Array.from(_deferred2).forEach((handle) => {
74910 window.cancelIdleCallback(handle);
74911 _deferred2.delete(handle);
74913 Object.values(services).forEach((service) => {
74914 if (service && typeof service.reset === "function") {
74915 service.reset(context);
74918 context.changeset = null;
74919 _validator.reset();
74923 context.container().select(".inspector-wrap *").remove();
74926 context.projection = geoRawMercator();
74927 context.curtainProjection = geoRawMercator();
74928 context.init = () => {
74929 instantiateInternal();
74930 initializeDependents();
74932 function instantiateInternal() {
74933 _history = coreHistory(context);
74934 context.graph = _history.graph;
74935 context.pauseChangeDispatch = _history.pauseChangeDispatch;
74936 context.resumeChangeDispatch = _history.resumeChangeDispatch;
74937 context.perform = withDebouncedSave(_history.perform);
74938 context.replace = withDebouncedSave(_history.replace);
74939 context.pop = withDebouncedSave(_history.pop);
74940 context.overwrite = withDebouncedSave(_history.overwrite);
74941 context.undo = withDebouncedSave(_history.undo);
74942 context.redo = withDebouncedSave(_history.redo);
74943 _validator = coreValidator(context);
74944 _uploader = coreUploader(context);
74945 _background = rendererBackground(context);
74946 _features = rendererFeatures(context);
74947 _map = rendererMap(context);
74948 _photos = rendererPhotos(context);
74949 _ui = uiInit(context);
74951 function initializeDependents() {
74952 if (context.initialHashParams.presets) {
74953 _mainPresetIndex.addablePresetIDs(new Set(context.initialHashParams.presets.split(",")));
74955 if (context.initialHashParams.locale) {
74956 _mainLocalizer.preferredLocaleCodes(context.initialHashParams.locale);
74958 _mainLocalizer.ensureLoaded();
74959 _mainPresetIndex.ensureLoaded();
74960 _background.ensureLoaded();
74961 Object.values(services).forEach((service) => {
74962 if (service && typeof service.init === "function") {
74969 if (services.maprules && context.initialHashParams.maprules) {
74970 json_default(context.initialHashParams.maprules).then((mapcss) => {
74971 services.maprules.init();
74972 mapcss.forEach((mapcssSelector) => services.maprules.addRule(mapcssSelector));
74976 if (!context.container().empty()) {
74977 _ui.ensureLoaded().then(() => {
74978 _background.init();
74987 // modules/services/nominatim.js
74988 var apibase = nominatimApiUrl;
74989 var _inflight = {};
74990 var _nominatimCache;
74991 var nominatim_default = {
74994 _nominatimCache = new RBush();
74996 reset: function() {
74997 Object.values(_inflight).forEach(function(controller) {
74998 controller.abort();
75001 _nominatimCache = new RBush();
75003 countryCode: function(location, callback) {
75004 this.reverse(location, function(err, result) {
75006 return callback(err);
75007 } else if (result.address) {
75008 return callback(null, result.address.country_code);
75010 return callback("Unable to geocode", null);
75014 reverse: function(loc, callback) {
75015 var cached = _nominatimCache.search(
75016 { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] }
75018 if (cached.length > 0) {
75019 if (callback) callback(null, cached[0].data);
75022 var params = { zoom: 13, format: "json", addressdetails: 1, lat: loc[1], lon: loc[0] };
75023 var url = apibase + "reverse?" + utilQsString(params);
75024 if (_inflight[url]) return;
75025 var controller = new AbortController();
75026 _inflight[url] = controller;
75027 json_default(url, {
75028 signal: controller.signal,
75030 "Accept-Language": _mainLocalizer.localeCodes().join(",")
75032 }).then(function(result) {
75033 delete _inflight[url];
75034 if (result && result.error) {
75035 throw new Error(result.error);
75037 var extent = geoExtent(loc).padByMeters(200);
75038 _nominatimCache.insert(Object.assign(extent.bbox(), { data: result }));
75039 if (callback) callback(null, result);
75040 }).catch(function(err) {
75041 delete _inflight[url];
75042 if (err.name === "AbortError") return;
75043 if (callback) callback(err.message);
75046 search: function(val, callback) {
75052 var url = apibase + "search?" + utilQsString(params);
75053 if (_inflight[url]) return;
75054 var controller = new AbortController();
75055 _inflight[url] = controller;
75056 json_default(url, {
75057 signal: controller.signal,
75059 "Accept-Language": _mainLocalizer.localeCodes().join(",")
75061 }).then(function(result) {
75062 delete _inflight[url];
75063 if (result && result.error) {
75064 throw new Error(result.error);
75066 if (callback) callback(null, result);
75067 }).catch(function(err) {
75068 delete _inflight[url];
75069 if (err.name === "AbortError") return;
75070 if (callback) callback(err.message);
75075 // node_modules/name-suggestion-index/lib/matcher.js
75076 var import_which_polygon4 = __toESM(require_which_polygon(), 1);
75078 // node_modules/name-suggestion-index/lib/simplify.js
75079 var import_diacritics3 = __toESM(require_diacritics(), 1);
75080 function simplify2(str) {
75081 if (typeof str !== "string") return "";
75082 return import_diacritics3.default.remove(
75083 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()
75087 // node_modules/name-suggestion-index/config/matchGroups.json
75088 var matchGroups_default = {
75090 adult_gaming_centre: [
75092 "amenity/gambling",
75093 "leisure/adult_gaming_centre"
75097 "shop/hairdresser_supply"
75111 "tourism/camp_site",
75112 "tourism/caravan_site"
75123 "healthcare/clinic",
75124 "healthcare/laboratory",
75125 "healthcare/physiotherapist",
75126 "healthcare/sample_collection",
75127 "healthcare/dialysis"
75132 "shop/convenience",
75140 "amenity/coworking_space",
75141 "office/coworking",
75142 "office/coworking_space"
75147 "healthcare/dentist"
75150 "office/telecommunication",
75152 "shop/electronics",
75156 "shop/mobile_phone",
75157 "shop/telecommunication"
75161 "shop/haberdashery",
75165 "shop/accessories",
75169 "shop/department_store",
75171 "shop/fashion_accessories",
75177 "office/accountant",
75178 "office/financial",
75179 "office/financial_advisor",
75180 "office/tax_advisor",
75184 "leisure/fitness_centre",
75185 "leisure/fitness_center",
75186 "leisure/sports_centre",
75187 "leisure/sports_center"
75192 "amenity/fast_food",
75193 "amenity/ice_cream",
75195 "amenity/restaurant",
75200 "shop/confectionary",
75201 "shop/confectionery",
75211 "shop/convenience;gas",
75212 "shop/gas;convenience"
75222 "shop/bathroom_furnishing",
75225 "shop/doityourself",
75230 "shop/hardware_store",
75231 "shop/power_tools",
75238 "shop/health_food",
75240 "shop/nutrition_supplements"
75243 "shop/electronics",
75250 "shop/video_games",
75255 "amenity/hospital",
75256 "healthcare/hospital"
75260 "shop/interior_decoration"
75262 lifeboat_station: [
75263 "amenity/lifeboat_station",
75264 "emergency/lifeboat_station",
75265 "emergency/marine_rescue"
75272 "amenity/money_transfer",
75273 "shop/money_transfer"
75276 "shop/office_supplies",
75286 "amenity/parcel_locker",
75287 "amenity/vending_machine"
75291 "amenity/pharmacy",
75292 "healthcare/pharmacy"
75295 "amenity/theme_park",
75296 "leisure/amusement_arcade",
75297 "leisure/playground"
75300 "amenity/bicycle_rental",
75301 "amenity/boat_rental",
75302 "amenity/car_rental",
75303 "amenity/truck_rental",
75304 "amenity/vehicle_rental",
75309 "amenity/childcare",
75311 "amenity/kindergarten",
75312 "amenity/language_school",
75313 "amenity/prep_school",
75315 "amenity/university"
75318 "shop/storage_units",
75319 "shop/storage_rental"
75323 "power/substation",
75324 "power/sub_station"
75328 "shop/frozen_food",
75329 "shop/greengrocer",
75331 "shop/supermarket",
75335 "shop/variety_store",
75340 "amenity/vending_machine",
75342 "shop/vending_machine"
75347 "amenity/weight_clinic",
75348 "healthcare/counselling",
75349 "leisure/fitness_centre",
75350 "office/therapist",
75354 "shop/health_food",
75357 "shop/nutrition_supplements",
75362 "shop/supermarket",
75363 "shop/department_store"
75368 // node_modules/name-suggestion-index/config/genericWords.json
75369 var genericWords_default = {
75371 "^(barn|bazaa?r|bench|bou?tique|building|casa|church)$",
75372 "^(baseball|basketball|football|soccer|softball|tennis(halle)?)\\s?(field|court)?$",
75373 "^(club|green|out|ware)\\s?house$",
75374 "^(driveway|el \xE1rbol|fountain|generic|golf|government|graveyard)$",
75375 "^(fixme|n\\s?\\/?\\s?a|name|no\\s?name|none|null|temporary|test|unknown)$",
75376 "^(hofladen|librairie|magazine?|maison)$",
75377 "^(mobile home|skate)?\\s?park$",
75378 "^(obuwie|pond|pool|sale|shops?|sklep|stores?)$",
75381 "^tattoo( studio)?$",
75383 "^\u0446\u0435\u0440\u043A\u043E\u0432\u043D\u0430\u044F( \u043B\u0430\u0432\u043A\u0430)?$"
75387 // node_modules/name-suggestion-index/config/trees.json
75388 var trees_default = {
75391 emoji: "\u{1F354}",
75392 mainTag: "brand:wikidata",
75393 sourceTags: ["brand", "name"],
75395 primary: "^(name|name:\\w+)$",
75396 alternate: "^(brand|brand:\\w+|operator|operator:\\w+|\\w+_name|\\w+_name:\\w+)$"
75400 emoji: "\u{1F6A9}",
75401 mainTag: "flag:wikidata",
75403 primary: "^(flag:name|flag:name:\\w+)$",
75404 alternate: "^(country|country:\\w+|flag|flag:\\w+|subject|subject:\\w+)$"
75408 emoji: "\u{1F4BC}",
75409 mainTag: "operator:wikidata",
75410 sourceTags: ["operator"],
75412 primary: "^(name|name:\\w+|operator|operator:\\w+)$",
75413 alternate: "^(brand|brand:\\w+|\\w+_name|\\w+_name:\\w+)$"
75417 emoji: "\u{1F687}",
75418 mainTag: "network:wikidata",
75419 sourceTags: ["network"],
75421 primary: "^network$",
75422 alternate: "^(operator|operator:\\w+|network:\\w+|\\w+_name|\\w+_name:\\w+)$"
75428 // node_modules/name-suggestion-index/lib/matcher.js
75429 var matchGroups = matchGroups_default.matchGroups;
75430 var trees = trees_default.trees;
75431 var Matcher = class {
75434 // initialize the genericWords regexes
75436 this.matchIndex = void 0;
75437 this.genericWords = /* @__PURE__ */ new Map();
75438 (genericWords_default.genericWords || []).forEach((s2) => this.genericWords.set(s2, new RegExp(s2, "i")));
75439 this.itemLocation = void 0;
75440 this.locationSets = void 0;
75441 this.locationIndex = void 0;
75442 this.warnings = [];
75445 // `buildMatchIndex()`
75446 // Call this to prepare the matcher for use
75448 // `data` needs to be an Object indexed on a 'tree/key/value' path.
75449 // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75451 // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75452 // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] },
75456 buildMatchIndex(data) {
75458 if (that.matchIndex) return;
75459 that.matchIndex = /* @__PURE__ */ new Map();
75460 const seenTree = /* @__PURE__ */ new Map();
75461 Object.keys(data).forEach((tkv) => {
75462 const category = data[tkv];
75463 const parts = tkv.split("/", 3);
75464 const t2 = parts[0];
75465 const k2 = parts[1];
75466 const v2 = parts[2];
75467 const thiskv = "".concat(k2, "/").concat(v2);
75468 const tree = trees[t2];
75469 let branch = that.matchIndex.get(thiskv);
75472 primary: /* @__PURE__ */ new Map(),
75473 alternate: /* @__PURE__ */ new Map(),
75474 excludeGeneric: /* @__PURE__ */ new Map(),
75475 excludeNamed: /* @__PURE__ */ new Map()
75477 that.matchIndex.set(thiskv, branch);
75479 const properties = category.properties || {};
75480 const exclude = properties.exclude || {};
75481 (exclude.generic || []).forEach((s2) => branch.excludeGeneric.set(s2, new RegExp(s2, "i")));
75482 (exclude.named || []).forEach((s2) => branch.excludeNamed.set(s2, new RegExp(s2, "i")));
75483 const excludeRegexes = [...branch.excludeGeneric.values(), ...branch.excludeNamed.values()];
75484 let items = category.items;
75485 if (!Array.isArray(items) || !items.length) return;
75486 const primaryName = new RegExp(tree.nameTags.primary, "i");
75487 const alternateName = new RegExp(tree.nameTags.alternate, "i");
75488 const notName = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75489 const skipGenericKV = skipGenericKVMatches(t2, k2, v2);
75490 const genericKV = /* @__PURE__ */ new Set(["".concat(k2, "/yes"), "building/yes"]);
75491 const matchGroupKV = /* @__PURE__ */ new Set();
75492 Object.values(matchGroups).forEach((matchGroup) => {
75493 const inGroup = matchGroup.some((otherkv) => otherkv === thiskv);
75494 if (!inGroup) return;
75495 matchGroup.forEach((otherkv) => {
75496 if (otherkv === thiskv) return;
75497 matchGroupKV.add(otherkv);
75498 const otherk = otherkv.split("/", 2)[0];
75499 genericKV.add("".concat(otherk, "/yes"));
75502 items.forEach((item) => {
75503 if (!item.id) return;
75504 if (Array.isArray(item.matchTags) && item.matchTags.length) {
75505 item.matchTags = item.matchTags.filter((matchTag) => !matchGroupKV.has(matchTag) && !genericKV.has(matchTag));
75506 if (!item.matchTags.length) delete item.matchTags;
75508 let kvTags = ["".concat(thiskv)].concat(item.matchTags || []);
75509 if (!skipGenericKV) {
75510 kvTags = kvTags.concat(Array.from(genericKV));
75512 Object.keys(item.tags).forEach((osmkey) => {
75513 if (notName.test(osmkey)) return;
75514 const osmvalue = item.tags[osmkey];
75515 if (!osmvalue || excludeRegexes.some((regex) => regex.test(osmvalue))) return;
75516 if (primaryName.test(osmkey)) {
75517 kvTags.forEach((kv) => insertName("primary", t2, kv, simplify2(osmvalue), item.id));
75518 } else if (alternateName.test(osmkey)) {
75519 kvTags.forEach((kv) => insertName("alternate", t2, kv, simplify2(osmvalue), item.id));
75522 let keepMatchNames = /* @__PURE__ */ new Set();
75523 (item.matchNames || []).forEach((matchName) => {
75524 const nsimple = simplify2(matchName);
75525 kvTags.forEach((kv) => {
75526 const branch2 = that.matchIndex.get(kv);
75527 const primaryLeaf = branch2 && branch2.primary.get(nsimple);
75528 const alternateLeaf = branch2 && branch2.alternate.get(nsimple);
75529 const inPrimary = primaryLeaf && primaryLeaf.has(item.id);
75530 const inAlternate = alternateLeaf && alternateLeaf.has(item.id);
75531 if (!inPrimary && !inAlternate) {
75532 insertName("alternate", t2, kv, nsimple, item.id);
75533 keepMatchNames.add(matchName);
75537 if (keepMatchNames.size) {
75538 item.matchNames = Array.from(keepMatchNames);
75540 delete item.matchNames;
75544 function insertName(which, t2, kv, nsimple, itemID) {
75546 that.warnings.push("Warning: skipping empty ".concat(which, " name for item ").concat(t2, "/").concat(kv, ": ").concat(itemID));
75549 let branch = that.matchIndex.get(kv);
75552 primary: /* @__PURE__ */ new Map(),
75553 alternate: /* @__PURE__ */ new Map(),
75554 excludeGeneric: /* @__PURE__ */ new Map(),
75555 excludeNamed: /* @__PURE__ */ new Map()
75557 that.matchIndex.set(kv, branch);
75559 let leaf = branch[which].get(nsimple);
75561 leaf = /* @__PURE__ */ new Set();
75562 branch[which].set(nsimple, leaf);
75565 if (!/yes$/.test(kv)) {
75566 const kvnsimple = "".concat(kv, "/").concat(nsimple);
75567 const existing = seenTree.get(kvnsimple);
75568 if (existing && existing !== t2) {
75569 const items = Array.from(leaf);
75570 that.warnings.push('Duplicate cache key "'.concat(kvnsimple, '" in trees "').concat(t2, '" and "').concat(existing, '", check items: ').concat(items));
75573 seenTree.set(kvnsimple, t2);
75576 function skipGenericKVMatches(t2, k2, v2) {
75577 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";
75581 // `buildLocationIndex()`
75582 // Call this to prepare a which-polygon location index.
75583 // This *resolves* all the locationSets into GeoJSON, which takes some time.
75584 // You can skip this step if you don't care about matching within a location.
75586 // `data` needs to be an Object indexed on a 'tree/key/value' path.
75587 // (e.g. cache filled by `fileTree.read` or data found in `dist/nsi.json`)
75589 // 'brands/amenity/bank': { properties: {}, items: [ {}, {}, … ] },
75590 // 'brands/amenity/bar': { properties: {}, items: [ {}, {}, … ] },
75594 buildLocationIndex(data, loco) {
75596 if (that.locationIndex) return;
75597 that.itemLocation = /* @__PURE__ */ new Map();
75598 that.locationSets = /* @__PURE__ */ new Map();
75599 Object.keys(data).forEach((tkv) => {
75600 const items = data[tkv].items;
75601 if (!Array.isArray(items) || !items.length) return;
75602 items.forEach((item) => {
75603 if (that.itemLocation.has(item.id)) return;
75606 resolved = loco.resolveLocationSet(item.locationSet);
75608 console.warn("buildLocationIndex: ".concat(err.message));
75610 if (!resolved || !resolved.id) return;
75611 that.itemLocation.set(item.id, resolved.id);
75612 if (that.locationSets.has(resolved.id)) return;
75613 let feature3 = _cloneDeep2(resolved.feature);
75614 feature3.id = resolved.id;
75615 feature3.properties.id = resolved.id;
75616 if (!feature3.geometry.coordinates.length || !feature3.properties.area) {
75617 console.warn("buildLocationIndex: locationSet ".concat(resolved.id, " for ").concat(item.id, " resolves to an empty feature:"));
75618 console.warn(JSON.stringify(feature3));
75621 that.locationSets.set(resolved.id, feature3);
75624 that.locationIndex = (0, import_which_polygon4.default)({ type: "FeatureCollection", features: [...that.locationSets.values()] });
75625 function _cloneDeep2(obj) {
75626 return JSON.parse(JSON.stringify(obj));
75631 // Pass parts and return an Array of matches.
75635 // `loc` - optional - [lon,lat] location to search
75637 // 1. If the [k,v,n] tuple matches a canonical item…
75638 // Return an Array of match results.
75639 // Each result will include the area in km² that the item is valid.
75641 // Order of results:
75642 // Primary ordering will be on the "match" column:
75643 // "primary" - where the query matches the `name` tag, followed by
75644 // "alternate" - where the query matches an alternate name tag (e.g. short_name, brand, operator, etc)
75645 // Secondary ordering will be on the "area" column:
75646 // "area descending" if no location was provided, (worldwide before local)
75647 // "area ascending" if location was provided (local before worldwide)
75650 // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String },
75651 // { match: 'primary', itemID: String, area: Number, kv: String, nsimple: String },
75652 // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String },
75653 // { match: 'alternate', itemID: String, area: Number, kv: String, nsimple: String },
75659 // 2. If the [k,v,n] tuple matches an exclude pattern…
75660 // Return an Array with a single exclude result, either
75662 // [ { match: 'excludeGeneric', pattern: String, kv: String } ] // "generic" e.g. "Food Court"
75664 // [ { match: 'excludeNamed', pattern: String, kv: String } ] // "named", e.g. "Kebabai"
75667 // "generic" - a generic word that is probably not really a name.
75668 // For these, iD should warn the user "Hey don't put 'food court' in the name tag".
75669 // "named" - a real name like "Kebabai" that is just common, but not a brand.
75670 // 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.
75674 // 3. If the [k,v,n] tuple matches nothing of any kind, return `null`
75677 match(k2, v2, n3, loc) {
75679 if (!that.matchIndex) {
75680 throw new Error("match: matchIndex not built.");
75682 let matchLocations;
75683 if (Array.isArray(loc) && that.locationIndex) {
75684 matchLocations = that.locationIndex([loc[0], loc[1], loc[0], loc[1]], true);
75686 const nsimple = simplify2(n3);
75687 let seen = /* @__PURE__ */ new Set();
75689 gatherResults("primary");
75690 gatherResults("alternate");
75691 if (results.length) return results;
75692 gatherResults("exclude");
75693 return results.length ? results : null;
75694 function gatherResults(which) {
75695 const kv = "".concat(k2, "/").concat(v2);
75696 let didMatch = tryMatch(which, kv);
75697 if (didMatch) return;
75698 for (let mg in matchGroups) {
75699 const matchGroup = matchGroups[mg];
75700 const inGroup = matchGroup.some((otherkv) => otherkv === kv);
75701 if (!inGroup) continue;
75702 for (let i3 = 0; i3 < matchGroup.length; i3++) {
75703 const otherkv = matchGroup[i3];
75704 if (otherkv === kv) continue;
75705 didMatch = tryMatch(which, otherkv);
75706 if (didMatch) return;
75709 if (which === "exclude") {
75710 const regex = [...that.genericWords.values()].find((regex2) => regex2.test(n3));
75712 results.push({ match: "excludeGeneric", pattern: String(regex) });
75717 function tryMatch(which, kv) {
75718 const branch = that.matchIndex.get(kv);
75719 if (!branch) return;
75720 if (which === "exclude") {
75721 let regex = [...branch.excludeNamed.values()].find((regex2) => regex2.test(n3));
75723 results.push({ match: "excludeNamed", pattern: String(regex), kv });
75726 regex = [...branch.excludeGeneric.values()].find((regex2) => regex2.test(n3));
75728 results.push({ match: "excludeGeneric", pattern: String(regex), kv });
75733 const leaf = branch[which].get(nsimple);
75734 if (!leaf || !leaf.size) return;
75735 let hits = Array.from(leaf).map((itemID) => {
75736 let area = Infinity;
75737 if (that.itemLocation && that.locationSets) {
75738 const location = that.locationSets.get(that.itemLocation.get(itemID));
75739 area = location && location.properties.area || Infinity;
75741 return { match: which, itemID, area, kv, nsimple };
75743 let sortFn = byAreaDescending;
75744 if (matchLocations) {
75745 hits = hits.filter(isValidLocation);
75746 sortFn = byAreaAscending;
75748 if (!hits.length) return;
75749 hits.sort(sortFn).forEach((hit) => {
75750 if (seen.has(hit.itemID)) return;
75751 seen.add(hit.itemID);
75755 function isValidLocation(hit) {
75756 if (!that.itemLocation) return true;
75757 return matchLocations.find((props) => props.id === that.itemLocation.get(hit.itemID));
75759 function byAreaAscending(hitA, hitB) {
75760 return hitA.area - hitB.area;
75762 function byAreaDescending(hitA, hitB) {
75763 return hitB.area - hitA.area;
75769 // Return any warnings discovered when buiding the index.
75770 // (currently this does nothing)
75773 return this.warnings;
75777 // modules/services/nsi.js
75778 var import_vparse2 = __toESM(require_vparse());
75779 var _nsiStatus = "loading";
75781 var buildingPreset = {
75782 "building/commercial": true,
75783 "building/government": true,
75784 "building/hotel": true,
75785 "building/retail": true,
75786 "building/office": true,
75787 "building/supermarket": true,
75788 "building/yes": true
75790 var notNames = /:(colou?r|type|forward|backward|left|right|etymology|pronunciation|wikipedia)$/i;
75791 var notBranches = /(coop|express|wireless|factory|outlet)/i;
75792 function setNsiSources() {
75793 const nsiVersion = package_default.dependencies["name-suggestion-index"] || package_default.devDependencies["name-suggestion-index"];
75794 const v2 = (0, import_vparse2.default)(nsiVersion);
75795 const vMinor = "".concat(v2.major, ".").concat(v2.minor);
75796 const cdn = nsiCdnUrl.replace("{version}", vMinor);
75798 "nsi_data": cdn + "dist/nsi.min.json",
75799 "nsi_dissolved": cdn + "dist/dissolved.min.json",
75800 "nsi_features": cdn + "dist/featureCollection.min.json",
75801 "nsi_generics": cdn + "dist/genericWords.min.json",
75802 "nsi_presets": cdn + "dist/presets/nsi-id-presets.min.json",
75803 "nsi_replacements": cdn + "dist/replacements.min.json",
75804 "nsi_trees": cdn + "dist/trees.min.json"
75806 let fileMap = _mainFileFetcher.fileMap();
75807 for (const k2 in sources) {
75808 if (!fileMap[k2]) fileMap[k2] = sources[k2];
75811 function loadNsiPresets() {
75812 return Promise.all([
75813 _mainFileFetcher.get("nsi_presets"),
75814 _mainFileFetcher.get("nsi_features")
75815 ]).then((vals) => {
75816 Object.values(vals[0].presets).forEach((preset) => preset.suggestion = true);
75817 Object.values(vals[0].presets).forEach((preset) => {
75818 if (preset.tags["brand:wikidata"]) {
75819 preset.removeTags = { "brand:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75821 if (preset.tags["operator:wikidata"]) {
75822 preset.removeTags = { "operator:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75824 if (preset.tags["network:wikidata"]) {
75825 preset.removeTags = { "network:wikipedia": "*", ...preset.removeTags || preset.addTags || preset.tags };
75828 _mainPresetIndex.merge({
75829 presets: vals[0].presets,
75830 featureCollection: vals[1]
75834 function loadNsiData() {
75835 return Promise.all([
75836 _mainFileFetcher.get("nsi_data"),
75837 _mainFileFetcher.get("nsi_dissolved"),
75838 _mainFileFetcher.get("nsi_replacements"),
75839 _mainFileFetcher.get("nsi_trees")
75840 ]).then((vals) => {
75843 // the raw name-suggestion-index data
75844 dissolved: vals[1].dissolved,
75845 // list of dissolved items
75846 replacements: vals[2].replacements,
75847 // trivial old->new qid replacements
75848 trees: vals[3].trees,
75849 // metadata about trees, main tags
75850 kvt: /* @__PURE__ */ new Map(),
75851 // Map (k -> Map (v -> t) )
75852 qids: /* @__PURE__ */ new Map(),
75853 // Map (wd/wp tag values -> qids)
75854 ids: /* @__PURE__ */ new Map()
75855 // Map (id -> NSI item)
75857 const matcher = _nsi.matcher = new Matcher();
75858 matcher.buildMatchIndex(_nsi.data);
75859 matcher.itemLocation = /* @__PURE__ */ new Map();
75860 matcher.locationSets = /* @__PURE__ */ new Map();
75861 Object.keys(_nsi.data).forEach((tkv) => {
75862 const items = _nsi.data[tkv].items;
75863 if (!Array.isArray(items) || !items.length) return;
75864 items.forEach((item) => {
75865 if (matcher.itemLocation.has(item.id)) return;
75866 const locationSetID = _sharedLocationManager.locationSetID(item.locationSet);
75867 matcher.itemLocation.set(item.id, locationSetID);
75868 if (matcher.locationSets.has(locationSetID)) return;
75869 const fakeFeature = { id: locationSetID, properties: { id: locationSetID, area: 1 } };
75870 matcher.locationSets.set(locationSetID, fakeFeature);
75873 matcher.locationIndex = (bbox2) => {
75874 const validHere = _sharedLocationManager.locationSetsAt([bbox2[0], bbox2[1]]);
75875 const results = [];
75876 for (const [locationSetID, area] of Object.entries(validHere)) {
75877 const fakeFeature = matcher.locationSets.get(locationSetID);
75879 fakeFeature.properties.area = area;
75880 results.push(fakeFeature);
75885 Object.keys(_nsi.data).forEach((tkv) => {
75886 const category = _nsi.data[tkv];
75887 const parts = tkv.split("/", 3);
75888 const t2 = parts[0];
75889 const k2 = parts[1];
75890 const v2 = parts[2];
75891 let vmap = _nsi.kvt.get(k2);
75893 vmap = /* @__PURE__ */ new Map();
75894 _nsi.kvt.set(k2, vmap);
75897 const tree = _nsi.trees[t2];
75898 const mainTag = tree.mainTag;
75899 const items = category.items || [];
75900 items.forEach((item) => {
75902 item.mainTag = mainTag;
75903 _nsi.ids.set(item.id, item);
75904 const wd = item.tags[mainTag];
75905 const wp = item.tags[mainTag.replace("wikidata", "wikipedia")];
75906 if (wd) _nsi.qids.set(wd, wd);
75907 if (wp && wd) _nsi.qids.set(wp, wd);
75912 function gatherKVs(tags) {
75913 let primary = /* @__PURE__ */ new Set();
75914 let alternate = /* @__PURE__ */ new Set();
75915 Object.keys(tags).forEach((osmkey) => {
75916 const osmvalue = tags[osmkey];
75917 if (!osmvalue) return;
75918 if (osmkey === "route_master") osmkey = "route";
75919 const vmap = _nsi.kvt.get(osmkey);
75921 if (vmap.get(osmvalue)) {
75922 primary.add("".concat(osmkey, "/").concat(osmvalue));
75923 } else if (osmvalue === "yes") {
75924 alternate.add("".concat(osmkey, "/").concat(osmvalue));
75927 const preset = _mainPresetIndex.matchTags(tags, "area");
75928 if (buildingPreset[preset.id]) {
75929 alternate.add("building/yes");
75931 return { primary, alternate };
75933 function identifyTree(tags) {
75936 Object.keys(tags).forEach((osmkey) => {
75938 const osmvalue = tags[osmkey];
75939 if (!osmvalue) return;
75940 if (osmkey === "route_master") osmkey = "route";
75941 const vmap = _nsi.kvt.get(osmkey);
75943 if (osmvalue === "yes") {
75944 unknown = "unknown";
75946 t2 = vmap.get(osmvalue);
75949 return t2 || unknown || null;
75951 function gatherNames(tags) {
75952 const empty2 = { primary: /* @__PURE__ */ new Set(), alternate: /* @__PURE__ */ new Set() };
75953 let primary = /* @__PURE__ */ new Set();
75954 let alternate = /* @__PURE__ */ new Set();
75955 let foundSemi = false;
75956 let testNameFragments = false;
75958 let t2 = identifyTree(tags);
75959 if (!t2) return empty2;
75960 if (t2 === "transit") {
75962 primary: /^network$/i,
75963 alternate: /^(operator|operator:\w+|network:\w+|\w+_name|\w+_name:\w+)$/i
75965 } else if (t2 === "flags") {
75967 primary: /^(flag:name|flag:name:\w+)$/i,
75968 alternate: /^(flag|flag:\w+|subject|subject:\w+)$/i
75969 // note: no `country`, we special-case it below
75971 } else if (t2 === "brands") {
75972 testNameFragments = true;
75974 primary: /^(name|name:\w+)$/i,
75975 alternate: /^(brand|brand:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75977 } else if (t2 === "operators") {
75978 testNameFragments = true;
75980 primary: /^(name|name:\w+|operator|operator:\w+)$/i,
75981 alternate: /^(brand|brand:\w+|\w+_name|\w+_name:\w+)/i
75984 testNameFragments = true;
75986 primary: /^(name|name:\w+)$/i,
75987 alternate: /^(brand|brand:\w+|network|network:\w+|operator|operator:\w+|\w+_name|\w+_name:\w+)/i
75990 if (tags.name && testNameFragments) {
75991 const nameParts = tags.name.split(/[\s\-\/,.]/);
75992 for (let split = nameParts.length; split > 0; split--) {
75993 const name = nameParts.slice(0, split).join(" ");
75997 Object.keys(tags).forEach((osmkey) => {
75998 const osmvalue = tags[osmkey];
75999 if (!osmvalue) return;
76000 if (isNamelike(osmkey, "primary")) {
76001 if (/;/.test(osmvalue)) {
76004 primary.add(osmvalue);
76005 alternate.delete(osmvalue);
76007 } else if (!primary.has(osmvalue) && isNamelike(osmkey, "alternate")) {
76008 if (/;/.test(osmvalue)) {
76011 alternate.add(osmvalue);
76015 if (tags.man_made === "flagpole" && !primary.size && !alternate.size && !!tags.country) {
76016 const osmvalue = tags.country;
76017 if (/;/.test(osmvalue)) {
76020 alternate.add(osmvalue);
76026 return { primary, alternate };
76028 function isNamelike(osmkey, which) {
76029 if (osmkey === "old_name") return false;
76030 return patterns2[which].test(osmkey) && !notNames.test(osmkey);
76033 function gatherTuples(tryKVs, tryNames) {
76035 ["primary", "alternate"].forEach((whichName) => {
76036 const arr = Array.from(tryNames[whichName]).sort((a2, b2) => b2.length - a2.length);
76037 arr.forEach((n3) => {
76038 ["primary", "alternate"].forEach((whichKV) => {
76039 tryKVs[whichKV].forEach((kv) => {
76040 const parts = kv.split("/", 2);
76041 const k2 = parts[0];
76042 const v2 = parts[1];
76043 tuples.push({ k: k2, v: v2, n: n3 });
76050 function _upgradeTags(tags, loc) {
76051 let newTags = Object.assign({}, tags);
76052 let changed = false;
76053 Object.keys(newTags).forEach((osmkey) => {
76054 const matchTag = osmkey.match(/^(\w+:)?wikidata$/);
76056 const prefix = matchTag[1] || "";
76057 const wd = newTags[osmkey];
76058 const replace = _nsi.replacements[wd];
76059 if (replace && replace.wikidata !== void 0) {
76061 if (replace.wikidata) {
76062 newTags[osmkey] = replace.wikidata;
76064 delete newTags[osmkey];
76067 if (replace && replace.wikipedia !== void 0) {
76069 const wpkey = "".concat(prefix, "wikipedia");
76070 if (replace.wikipedia) {
76071 newTags[wpkey] = replace.wikipedia;
76073 delete newTags[wpkey];
76078 const isRouteMaster = tags.type === "route_master";
76079 const tryKVs = gatherKVs(tags);
76080 if (!tryKVs.primary.size && !tryKVs.alternate.size) {
76081 return changed ? { newTags, matched: null } : null;
76083 const tryNames = gatherNames(tags);
76084 const foundQID = _nsi.qids.get(tags.wikidata) || _nsi.qids.get(tags.wikipedia);
76085 if (foundQID) tryNames.primary.add(foundQID);
76086 if (!tryNames.primary.size && !tryNames.alternate.size) {
76087 return changed ? { newTags, matched: null } : null;
76089 const tuples = gatherTuples(tryKVs, tryNames);
76090 for (let i3 = 0; i3 < tuples.length; i3++) {
76091 const tuple = tuples[i3];
76092 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n, loc);
76093 if (!hits || !hits.length) continue;
76094 if (hits[0].match !== "primary" && hits[0].match !== "alternate") break;
76096 for (let j2 = 0; j2 < hits.length; j2++) {
76097 const hit = hits[j2];
76098 itemID = hit.itemID;
76099 if (_nsi.dissolved[itemID]) continue;
76100 item = _nsi.ids.get(itemID);
76101 if (!item) continue;
76102 const mainTag = item.mainTag;
76103 const itemQID = item.tags[mainTag];
76104 const notQID = newTags["not:".concat(mainTag)];
76106 // Exceptions, skip this hit
76107 !itemQID || itemQID === notQID || // No `*:wikidata` or matched a `not:*:wikidata`
76108 newTags.office && !item.tags.office
76116 if (!item) continue;
76117 item = JSON.parse(JSON.stringify(item));
76118 const tkv = item.tkv;
76119 const parts = tkv.split("/", 3);
76120 const k2 = parts[1];
76121 const v2 = parts[2];
76122 const category = _nsi.data[tkv];
76123 const properties = category.properties || {};
76124 let preserveTags = item.preserveTags || properties.preserveTags || [];
76125 ["building", "emergency", "internet_access", "takeaway"].forEach((osmkey) => {
76126 if (k2 !== osmkey) preserveTags.push("^".concat(osmkey, "$"));
76128 const regexes = preserveTags.map((s2) => new RegExp(s2, "i"));
76130 Object.keys(newTags).forEach((osmkey) => {
76131 if (regexes.some((regex) => regex.test(osmkey))) {
76132 keepTags[osmkey] = newTags[osmkey];
76135 _nsi.kvt.forEach((vmap, k3) => {
76136 if (newTags[k3] === "yes") delete newTags[k3];
76139 delete newTags.wikipedia;
76140 delete newTags.wikidata;
76142 Object.assign(newTags, item.tags, keepTags);
76143 if (isRouteMaster) {
76144 newTags.route_master = newTags.route;
76145 delete newTags.route;
76147 const origName = tags.name;
76148 const newName = newTags.name;
76149 if (newName && origName && newName !== origName && !newTags.branch) {
76150 const newNames = gatherNames(newTags);
76151 const newSet = /* @__PURE__ */ new Set([...newNames.primary, ...newNames.alternate]);
76152 const isMoved = newSet.has(origName);
76154 const nameParts = origName.split(/[\s\-\/,.]/);
76155 for (let split = nameParts.length; split > 0; split--) {
76156 const name = nameParts.slice(0, split).join(" ");
76157 const branch = nameParts.slice(split).join(" ");
76158 const nameHits = _nsi.matcher.match(k2, v2, name, loc);
76159 if (!nameHits || !nameHits.length) continue;
76160 if (nameHits.some((hit) => hit.itemID === itemID)) {
76162 if (notBranches.test(branch)) {
76163 newTags.name = origName;
76165 const branchHits = _nsi.matcher.match(k2, v2, branch, loc);
76166 if (branchHits && branchHits.length) {
76167 if (branchHits[0].match === "primary" || branchHits[0].match === "alternate") {
76171 newTags.branch = branch;
76180 return { newTags, matched: item };
76182 return changed ? { newTags, matched: null } : null;
76184 function _isGenericName(tags) {
76185 const n3 = tags.name;
76186 if (!n3) return false;
76187 const tryNames = { primary: /* @__PURE__ */ new Set([n3]), alternate: /* @__PURE__ */ new Set() };
76188 const tryKVs = gatherKVs(tags);
76189 if (!tryKVs.primary.size && !tryKVs.alternate.size) return false;
76190 const tuples = gatherTuples(tryKVs, tryNames);
76191 for (let i3 = 0; i3 < tuples.length; i3++) {
76192 const tuple = tuples[i3];
76193 const hits = _nsi.matcher.match(tuple.k, tuple.v, tuple.n);
76194 if (hits && hits.length && hits[0].match === "excludeGeneric") return true;
76198 var nsi_default = {
76200 // On init, start preparing the name-suggestion-index
76204 _mainPresetIndex.ensureLoaded().then(() => loadNsiPresets()).then(() => loadNsiData()).then(() => _nsiStatus = "ok").catch(() => _nsiStatus = "failed");
76207 // Reset is called when user saves data to OSM (does nothing here)
76212 // To let other code know how it's going...
76215 // `String`: 'loading', 'ok', 'failed'
76217 status: () => _nsiStatus,
76218 // `isGenericName()`
76219 // Is the `name` tag generic?
76222 // `tags`: `Object` containing the feature's OSM tags
76224 // `true` if it is generic, `false` if not
76226 isGenericName: (tags) => _isGenericName(tags),
76228 // Suggest tag upgrades.
76229 // This function will not modify the input tags, it makes a copy.
76232 // `tags`: `Object` containing the feature's OSM tags
76233 // `loc`: Location where this feature exists, as a [lon, lat]
76235 // `Object` containing the result, or `null` if no changes needed:
76237 // 'newTags': `Object` - The tags the the feature should have
76238 // 'matched': `Object` - The matched item
76241 upgradeTags: (tags, loc) => _upgradeTags(tags, loc),
76243 // Direct access to the NSI cache, useful for testing or breaking things
76246 // `Object`: the internal NSI cache
76251 // modules/services/kartaview.js
76252 var apibase2 = "https://kartaview.org";
76253 var maxResults = 1e3;
76255 var tiler3 = utilTiler().zoomExtent([tileZoom, tileZoom]).skipNullIsland(true);
76256 var dispatch6 = dispatch_default("loadedImages");
76257 var imgZoom2 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
76259 var _oscSelectedImage;
76260 var _loadViewerPromise2;
76261 function abortRequest3(controller) {
76262 controller.abort();
76264 function maxPageAtZoom(z2) {
76265 if (z2 < 15) return 2;
76266 if (z2 === 15) return 5;
76267 if (z2 === 16) return 10;
76268 if (z2 === 17) return 20;
76269 if (z2 === 18) return 40;
76270 if (z2 > 18) return 80;
76272 function loadTiles2(which, url, projection2) {
76273 var currZoom = Math.floor(geoScaleToZoom(projection2.scale()));
76274 var tiles = tiler3.getTiles(projection2);
76275 var cache = _oscCache[which];
76276 Object.keys(cache.inflight).forEach(function(k2) {
76277 var wanted = tiles.find(function(tile) {
76278 return k2.indexOf(tile.id + ",") === 0;
76281 abortRequest3(cache.inflight[k2]);
76282 delete cache.inflight[k2];
76285 tiles.forEach(function(tile) {
76286 loadNextTilePage(which, currZoom, url, tile);
76289 function loadNextTilePage(which, currZoom, url, tile) {
76290 var cache = _oscCache[which];
76291 var bbox2 = tile.extent.bbox();
76292 var maxPages = maxPageAtZoom(currZoom);
76293 var nextPage = cache.nextPage[tile.id] || 1;
76294 var params = utilQsString({
76297 // client_id: clientId,
76298 bbTopLeft: [bbox2.maxY, bbox2.minX].join(","),
76299 bbBottomRight: [bbox2.minY, bbox2.maxX].join(",")
76301 if (nextPage > maxPages) return;
76302 var id2 = tile.id + "," + String(nextPage);
76303 if (cache.loaded[id2] || cache.inflight[id2]) return;
76304 var controller = new AbortController();
76305 cache.inflight[id2] = controller;
76308 signal: controller.signal,
76310 headers: { "Content-Type": "application/x-www-form-urlencoded" }
76312 json_default(url, options2).then(function(data) {
76313 cache.loaded[id2] = true;
76314 delete cache.inflight[id2];
76315 if (!data || !data.currentPageItems || !data.currentPageItems.length) {
76316 throw new Error("No Data");
76318 var features = data.currentPageItems.map(function(item) {
76319 var loc = [+item.lng, +item.lat];
76321 if (which === "images") {
76326 captured_at: item.shot_date || item.date_added,
76327 captured_by: item.username,
76328 imagePath: item.lth_name,
76329 sequence_id: item.sequence_id,
76330 sequence_index: +item.sequence_index
76332 var seq = _oscCache.sequences[d2.sequence_id];
76334 seq = { rotation: 0, images: [] };
76335 _oscCache.sequences[d2.sequence_id] = seq;
76337 seq.images[d2.sequence_index] = d2;
76338 _oscCache.images.forImageKey[d2.key] = d2;
76348 cache.rtree.load(features);
76349 if (data.currentPageItems.length === maxResults) {
76350 cache.nextPage[tile.id] = nextPage + 1;
76351 loadNextTilePage(which, currZoom, url, tile);
76353 cache.nextPage[tile.id] = Infinity;
76355 if (which === "images") {
76356 dispatch6.call("loadedImages");
76358 }).catch(function() {
76359 cache.loaded[id2] = true;
76360 delete cache.inflight[id2];
76363 function partitionViewport2(projection2) {
76364 var z2 = geoScaleToZoom(projection2.scale());
76365 var z22 = Math.ceil(z2 * 2) / 2 + 2.5;
76366 var tiler8 = utilTiler().zoomExtent([z22, z22]);
76367 return tiler8.getTiles(projection2).map(function(tile) {
76368 return tile.extent;
76371 function searchLimited2(limit, projection2, rtree) {
76372 limit = limit || 5;
76373 return partitionViewport2(projection2).reduce(function(result, extent) {
76374 var found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
76377 return found.length ? result.concat(found) : result;
76380 var kartaview_default = {
76385 this.event = utilRebind(this, dispatch6, "on");
76387 reset: function() {
76389 Object.values(_oscCache.images.inflight).forEach(abortRequest3);
76392 images: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), forImageKey: {} },
76395 _oscSelectedImage = null;
76397 images: function(projection2) {
76399 return searchLimited2(limit, projection2, _oscCache.images.rtree);
76401 sequences: function(projection2) {
76402 var viewport = projection2.clipExtent();
76403 var min3 = [viewport[0][0], viewport[1][1]];
76404 var max3 = [viewport[1][0], viewport[0][1]];
76405 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
76406 var sequenceKeys = {};
76407 _oscCache.images.rtree.search(bbox2).forEach(function(d2) {
76408 sequenceKeys[d2.data.sequence_id] = true;
76410 var lineStrings = [];
76411 Object.keys(sequenceKeys).forEach(function(sequenceKey) {
76412 var seq = _oscCache.sequences[sequenceKey];
76413 var images = seq && seq.images;
76416 type: "LineString",
76417 coordinates: images.map(function(d2) {
76419 }).filter(Boolean),
76421 captured_at: images[0] ? images[0].captured_at : null,
76422 captured_by: images[0] ? images[0].captured_by : null,
76428 return lineStrings;
76430 cachedImage: function(imageKey) {
76431 return _oscCache.images.forImageKey[imageKey];
76433 loadImages: function(projection2) {
76434 var url = apibase2 + "/1.0/list/nearby-photos/";
76435 loadTiles2("images", url, projection2);
76437 ensureViewerLoaded: function(context) {
76438 if (_loadViewerPromise2) return _loadViewerPromise2;
76439 var wrap2 = context.container().select(".photoviewer").selectAll(".kartaview-wrapper").data([0]);
76441 var wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper kartaview-wrapper").classed("hide", true).call(imgZoom2.on("zoom", zoomPan2)).on("dblclick.zoom", null);
76442 wrapEnter.append("div").attr("class", "photo-attribution fillD");
76443 var controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
76444 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
76445 controlsEnter.append("button").on("click.rotate-ccw", rotate(-90)).text("\u293F");
76446 controlsEnter.append("button").on("click.rotate-cw", rotate(90)).text("\u293E");
76447 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
76448 wrapEnter.append("div").attr("class", "kartaview-image-wrap");
76449 context.ui().photoviewer.on("resize.kartaview", function(dimensions) {
76450 imgZoom2.extent([[0, 0], dimensions]).translateExtent([[0, 0], dimensions]);
76452 function zoomPan2(d3_event) {
76453 var t2 = d3_event.transform;
76454 context.container().select(".photoviewer .kartaview-image-wrap").call(utilSetTransform, t2.x, t2.y, t2.k);
76456 function rotate(deg) {
76457 return function() {
76458 if (!_oscSelectedImage) return;
76459 var sequenceKey = _oscSelectedImage.sequence_id;
76460 var sequence = _oscCache.sequences[sequenceKey];
76461 if (!sequence) return;
76462 var r2 = sequence.rotation || 0;
76464 if (r2 > 180) r2 -= 360;
76465 if (r2 < -180) r2 += 360;
76466 sequence.rotation = r2;
76467 var wrap3 = context.container().select(".photoviewer .kartaview-wrapper");
76468 wrap3.transition().duration(100).call(imgZoom2.transform, identity2);
76469 wrap3.selectAll(".kartaview-image").transition().duration(100).style("transform", "rotate(" + r2 + "deg)");
76472 function step(stepBy) {
76473 return function() {
76474 if (!_oscSelectedImage) return;
76475 var sequenceKey = _oscSelectedImage.sequence_id;
76476 var sequence = _oscCache.sequences[sequenceKey];
76477 if (!sequence) return;
76478 var nextIndex = _oscSelectedImage.sequence_index + stepBy;
76479 var nextImage = sequence.images[nextIndex];
76480 if (!nextImage) return;
76481 context.map().centerEase(nextImage.loc);
76482 that.selectImage(context, nextImage.key);
76485 _loadViewerPromise2 = Promise.resolve();
76486 return _loadViewerPromise2;
76488 showViewer: function(context) {
76489 var viewer = context.container().select(".photoviewer").classed("hide", false);
76490 var isHidden = viewer.selectAll(".photo-wrapper.kartaview-wrapper.hide").size();
76492 viewer.selectAll(".photo-wrapper:not(.kartaview-wrapper)").classed("hide", true);
76493 viewer.selectAll(".photo-wrapper.kartaview-wrapper").classed("hide", false);
76497 hideViewer: function(context) {
76498 _oscSelectedImage = null;
76499 this.updateUrlImage(null);
76500 var viewer = context.container().select(".photoviewer");
76501 if (!viewer.empty()) viewer.datum(null);
76502 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
76503 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
76504 return this.setStyles(context, null, true);
76506 selectImage: function(context, imageKey) {
76507 var d2 = this.cachedImage(imageKey);
76508 _oscSelectedImage = d2;
76509 this.updateUrlImage(imageKey);
76510 var viewer = context.container().select(".photoviewer");
76511 if (!viewer.empty()) viewer.datum(d2);
76512 this.setStyles(context, null, true);
76513 context.container().selectAll(".icon-sign").classed("currentView", false);
76514 if (!d2) return this;
76515 var wrap2 = context.container().select(".photoviewer .kartaview-wrapper");
76516 var imageWrap = wrap2.selectAll(".kartaview-image-wrap");
76517 var attribution = wrap2.selectAll(".photo-attribution").text("");
76518 wrap2.transition().duration(100).call(imgZoom2.transform, identity2);
76519 imageWrap.selectAll(".kartaview-image").remove();
76521 var sequence = _oscCache.sequences[d2.sequence_id];
76522 var r2 = sequence && sequence.rotation || 0;
76523 imageWrap.append("img").attr("class", "kartaview-image").attr("src", apibase2 + "/" + d2.imagePath).style("transform", "rotate(" + r2 + "deg)");
76524 if (d2.captured_by) {
76525 attribution.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://kartaview.org/user/" + encodeURIComponent(d2.captured_by)).text("@" + d2.captured_by);
76526 attribution.append("span").text("|");
76528 if (d2.captured_at) {
76529 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.captured_at));
76530 attribution.append("span").text("|");
76532 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");
76535 function localeDateString2(s2) {
76536 if (!s2) return null;
76537 var options2 = { day: "numeric", month: "short", year: "numeric" };
76538 var d4 = new Date(s2);
76539 if (isNaN(d4.getTime())) return null;
76540 return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
76543 getSelectedImage: function() {
76544 return _oscSelectedImage;
76546 getSequenceKeyForImage: function(d2) {
76547 return d2 && d2.sequence_id;
76549 // Updates the currently highlighted sequence and selected bubble.
76550 // Reset is only necessary when interacting with the viewport because
76551 // this implicitly changes the currently selected bubble/sequence
76552 setStyles: function(context, hovered, reset) {
76554 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
76555 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
76557 var hoveredImageKey = hovered && hovered.key;
76558 var hoveredSequenceKey = this.getSequenceKeyForImage(hovered);
76559 var hoveredSequence = hoveredSequenceKey && _oscCache.sequences[hoveredSequenceKey];
76560 var hoveredImageKeys = hoveredSequence && hoveredSequence.images.map(function(d2) {
76563 var viewer = context.container().select(".photoviewer");
76564 var selected = viewer.empty() ? void 0 : viewer.datum();
76565 var selectedImageKey = selected && selected.key;
76566 var selectedSequenceKey = this.getSequenceKeyForImage(selected);
76567 var selectedSequence = selectedSequenceKey && _oscCache.sequences[selectedSequenceKey];
76568 var selectedImageKeys = selectedSequence && selectedSequence.images.map(function(d2) {
76571 var highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
76572 context.container().selectAll(".layer-kartaview .viewfield-group").classed("highlighted", function(d2) {
76573 return highlightedImageKeys.indexOf(d2.key) !== -1;
76574 }).classed("hovered", function(d2) {
76575 return d2.key === hoveredImageKey;
76576 }).classed("currentView", function(d2) {
76577 return d2.key === selectedImageKey;
76579 context.container().selectAll(".layer-kartaview .sequence").classed("highlighted", function(d2) {
76580 return d2.properties.key === hoveredSequenceKey;
76581 }).classed("currentView", function(d2) {
76582 return d2.properties.key === selectedSequenceKey;
76584 context.container().selectAll(".layer-kartaview .viewfield-group .viewfield").attr("d", viewfieldPath);
76585 function viewfieldPath() {
76586 var d2 = this.parentNode.__data__;
76587 if (d2.pano && d2.key !== selectedImageKey) {
76588 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
76590 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
76595 updateUrlImage: function(imageKey) {
76596 if (!window.mocha) {
76597 var hash = utilStringQs(window.location.hash);
76599 hash.photo = "kartaview/" + imageKey;
76603 window.location.replace("#" + utilQsString(hash, true));
76606 cache: function() {
76611 // modules/services/pannellum_photo.js
76612 var pannellumViewerCSS = "pannellum/pannellum.css";
76613 var pannellumViewerJS = "pannellum/pannellum.js";
76614 var dispatch7 = dispatch_default("viewerChanged");
76615 var _currScenes = [];
76616 var _pannellumViewer;
76617 var pannellum_photo_default = {
76618 init: async function(context, selection2) {
76619 selection2.append("div").attr("class", "photo-frame pannellum-frame").attr("id", "ideditor-pannellum-viewer").classed("hide", true).on("keydown", function(e3) {
76620 e3.stopPropagation();
76622 if (!window.pannellum) {
76623 await this.loadPannellum(context);
76626 "default": { firstScene: "" },
76630 _pannellumViewer = window.pannellum.viewer("ideditor-pannellum-viewer", options2);
76631 _pannellumViewer.on("mousedown", () => {
76632 select_default2(window).on("pointermove.pannellum mousemove.pannellum", () => {
76633 dispatch7.call("viewerChanged");
76635 }).on("mouseup", () => {
76636 select_default2(window).on("pointermove.pannellum mousemove.pannellum", null);
76637 }).on("animatefinished", () => {
76638 dispatch7.call("viewerChanged");
76640 context.ui().photoviewer.on("resize.pannellum", () => {
76641 _pannellumViewer.resize();
76643 this.event = utilRebind(this, dispatch7, "on");
76646 loadPannellum: function(context) {
76647 const head = select_default2("head");
76648 return Promise.all([
76649 new Promise((resolve, reject) => {
76650 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);
76652 new Promise((resolve, reject) => {
76653 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);
76657 showPhotoFrame: function(context) {
76658 const isHidden = context.selectAll(".photo-frame.pannellum-frame.hide").size();
76660 context.selectAll(".photo-frame:not(.pannellum-frame)").classed("hide", true);
76661 context.selectAll(".photo-frame.pannellum-frame").classed("hide", false);
76665 hidePhotoFrame: function(viewerContext) {
76666 viewerContext.select("photo-frame.pannellum-frame").classed("hide", false);
76669 selectPhoto: function(data, keepOrientation) {
76670 const { key } = data;
76671 if (!(key in _currScenes)) {
76672 let newSceneOptions = {
76673 showFullscreenCtrl: false,
76677 type: "equirectangular",
76678 preview: data.preview_path,
76679 panorama: data.image_path,
76680 northOffset: data.ca
76682 _currScenes.push(key);
76683 _pannellumViewer.addScene(key, newSceneOptions);
76687 if (keepOrientation) {
76688 yaw = this.getYaw();
76689 pitch = _pannellumViewer.getPitch();
76691 _pannellumViewer.loadScene(key, pitch, yaw);
76692 dispatch7.call("viewerChanged");
76693 if (_currScenes.length > 3) {
76694 const old_key = _currScenes.shift();
76695 _pannellumViewer.removeScene(old_key);
76697 _pannellumViewer.resize();
76700 getYaw: function() {
76701 return _pannellumViewer.getYaw();
76705 // modules/services/vegbilder.js
76706 var owsEndpoint = "https://www.vegvesen.no/kart/ogc/vegbilder_1_0/ows?";
76707 var tileZoom2 = 14;
76708 var tiler4 = utilTiler().zoomExtent([tileZoom2, tileZoom2]).skipNullIsland(true);
76709 var dispatch8 = dispatch_default("loadedImages", "viewerChanged");
76710 var directionEnum = Object.freeze({
76711 forward: Symbol(0),
76712 backward: Symbol(1)
76715 var _pannellumFrame;
76717 var _loadViewerPromise3;
76718 var _vegbilderCache;
76719 async function fetchAvailableLayers() {
76723 request: "GetCapabilities",
76726 const urlForRequest = owsEndpoint + utilQsString(params);
76727 const response = await xml_default(urlForRequest);
76728 const xPathSelector = "/wfs:WFS_Capabilities/wfs:FeatureTypeList/wfs:FeatureType/wfs:Name";
76729 const regexMatcher = /^vegbilder_1_0:Vegbilder(?<image_type>_360)?_(?<year>\d{4})$/;
76730 const NSResolver = response.createNSResolver(response);
76731 const l2 = response.evaluate(
76735 XPathResult.ANY_TYPE
76738 const availableLayers = [];
76739 while ((node = l2.iterateNext()) !== null) {
76740 const match = (_a3 = node.textContent) == null ? void 0 : _a3.match(regexMatcher);
76742 availableLayers.push({
76744 is_sphere: !!((_b3 = match.groups) == null ? void 0 : _b3.image_type),
76745 year: parseInt((_c = match.groups) == null ? void 0 : _c.year, 10)
76749 return availableLayers;
76751 function filterAvailableLayers(photoContex) {
76752 const fromDateString = photoContex.fromDate();
76753 const toDateString = photoContex.toDate();
76754 const fromYear = fromDateString ? new Date(fromDateString).getFullYear() : 2016;
76755 const toYear = toDateString ? new Date(toDateString).getFullYear() : null;
76756 const showsFlat = photoContex.showsFlat();
76757 const showsPano = photoContex.showsPanoramic();
76758 return Array.from(_vegbilderCache.wfslayers.values()).filter(({ layerInfo }) => layerInfo.year >= fromYear && (!toYear || layerInfo.year <= toYear) && (!layerInfo.is_sphere && showsFlat || layerInfo.is_sphere && showsPano));
76760 function loadWFSLayers(projection2, margin, wfslayers) {
76761 const tiles = tiler4.margin(margin).getTiles(projection2);
76762 for (const cache of wfslayers) {
76763 loadWFSLayer(projection2, cache, tiles);
76766 function loadWFSLayer(projection2, cache, tiles) {
76767 for (const [key, controller] of cache.inflight.entries()) {
76768 const wanted = tiles.some((tile) => key === tile.id);
76770 controller.abort();
76771 cache.inflight.delete(key);
76774 Promise.all(tiles.map(
76775 (tile) => loadTile2(cache, cache.layerInfo.name, tile)
76776 )).then(() => orderSequences(projection2, cache));
76778 async function loadTile2(cache, typename, tile) {
76779 const bbox2 = tile.extent.bbox();
76780 const tileid = tile.id;
76781 if (cache.loaded.get(tileid) === true || cache.inflight.has(tileid)) return;
76784 request: "GetFeature",
76786 typenames: typename,
76787 bbox: [bbox2.minY, bbox2.minX, bbox2.maxY, bbox2.maxX].join(","),
76788 outputFormat: "json"
76790 const controller = new AbortController();
76791 cache.inflight.set(tileid, controller);
76794 signal: controller.signal
76796 const urlForRequest = owsEndpoint + utilQsString(params);
76797 let featureCollection;
76799 featureCollection = await json_default(urlForRequest, options2);
76801 cache.loaded.set(tileid, false);
76804 cache.inflight.delete(tileid);
76806 cache.loaded.set(tileid, true);
76807 if (featureCollection.features.length === 0) {
76810 const features = featureCollection.features.map((feature3) => {
76811 const loc = feature3.geometry.coordinates;
76812 const key = feature3.id;
76813 const properties = feature3.properties;
76816 TIDSPUNKT: captured_at,
76818 URLPREVIEW: preview_path,
76819 BILDETYPE: image_type,
76821 FELTKODE: lane_code
76823 const lane_number = parseInt(lane_code.match(/^[0-9]+/)[0], 10);
76824 const direction = lane_number % 2 === 0 ? directionEnum.backward : directionEnum.forward;
76831 road_reference: roadReference(properties),
76835 captured_at: new Date(captured_at),
76836 is_sphere: image_type === "360"
76838 cache.points.set(key, data);
76847 _vegbilderCache.rtree.load(features);
76848 dispatch8.call("loadedImages");
76850 function orderSequences(projection2, cache) {
76851 const { points } = cache;
76852 const grouped = Array.from(points.values()).reduce((grouped2, image) => {
76853 const key = image.road_reference;
76854 if (grouped2.has(key)) {
76855 grouped2.get(key).push(image);
76857 grouped2.set(key, [image]);
76860 }, /* @__PURE__ */ new Map());
76861 const imageSequences = Array.from(grouped.values()).reduce((imageSequences2, imageGroup) => {
76862 imageGroup.sort((a2, b2) => {
76863 if (a2.captured_at.valueOf() > b2.captured_at.valueOf()) {
76865 } else if (a2.captured_at.valueOf() < b2.captured_at.valueOf()) {
76868 const { direction } = a2;
76869 if (direction === directionEnum.forward) {
76870 return a2.metering - b2.metering;
76872 return b2.metering - a2.metering;
76876 let imageSequence = [imageGroup[0]];
76878 for (const [lastImage, image] of pairs(imageGroup)) {
76879 if (lastImage.ca === null) {
76880 const b2 = projection2(lastImage.loc);
76881 const a2 = projection2(image.loc);
76882 if (!geoVecEqual(a2, b2)) {
76883 angle2 = geoVecAngle(a2, b2);
76884 angle2 *= 180 / Math.PI;
76886 angle2 = angle2 >= 0 ? angle2 : angle2 + 360;
76888 lastImage.ca = angle2;
76890 if (image.direction === lastImage.direction && image.captured_at.valueOf() - lastImage.captured_at.valueOf() <= 2e4) {
76891 imageSequence.push(image);
76893 imageSequences2.push(imageSequence);
76894 imageSequence = [image];
76897 imageSequences2.push(imageSequence);
76898 return imageSequences2;
76900 cache.sequences = imageSequences.map((images) => {
76903 key: images[0].key,
76905 type: "LineString",
76906 coordinates: images.map((image) => image.loc)
76909 for (const image of images) {
76910 _vegbilderCache.image2sequence_map.set(image.key, sequence);
76915 function roadReference(properties) {
76917 FYLKENUMMER: county_number,
76918 VEGKATEGORI: road_class,
76919 VEGSTATUS: road_status,
76920 VEGNUMMER: road_number,
76921 STREKNING: section,
76922 DELSTREKNING: subsection,
76924 KRYSSDEL: junction_part,
76925 SIDEANLEGGSDEL: services_part,
76926 ANKERPUNKT: anker_point,
76930 if (year >= 2020) {
76931 reference = "".concat(road_class).concat(road_status).concat(road_number, " S").concat(section, "D").concat(subsection);
76932 if (junction_part) {
76933 reference = "".concat(reference, " M").concat(anker_point, " KD").concat(junction_part);
76934 } else if (services_part) {
76935 reference = "".concat(reference, " M").concat(anker_point, " SD").concat(services_part);
76938 reference = "".concat(county_number).concat(road_class).concat(road_status).concat(road_number, " HP").concat(parcel);
76942 function localeTimestamp(date) {
76951 return date.toLocaleString(_mainLocalizer.localeCode(), options2);
76953 function partitionViewport3(projection2) {
76954 const zoom = geoScaleToZoom(projection2.scale());
76955 const roundZoom = Math.ceil(zoom * 2) / 2 + 2.5;
76956 const tiler8 = utilTiler().zoomExtent([roundZoom, roundZoom]);
76957 return tiler8.getTiles(projection2).map((tile) => tile.extent);
76959 function searchLimited3(limit, projection2, rtree) {
76960 limit != null ? limit : limit = 5;
76961 return partitionViewport3(projection2).reduce((result, extent) => {
76962 const found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
76963 return result.concat(found);
76966 var vegbilder_default = {
76968 this.event = utilRebind(this, dispatch8, "on");
76970 reset: async function() {
76971 if (_vegbilderCache) {
76972 for (const layer of _vegbilderCache.wfslayers.values()) {
76973 for (const controller of layer.inflight.values()) {
76974 controller.abort();
76978 _vegbilderCache = {
76979 wfslayers: /* @__PURE__ */ new Map(),
76980 rtree: new RBush(),
76981 image2sequence_map: /* @__PURE__ */ new Map()
76983 const availableLayers = await fetchAvailableLayers();
76984 const { wfslayers } = _vegbilderCache;
76985 for (const layerInfo of availableLayers) {
76988 loaded: /* @__PURE__ */ new Map(),
76989 inflight: /* @__PURE__ */ new Map(),
76990 points: /* @__PURE__ */ new Map(),
76993 wfslayers.set(layerInfo.name, cache);
76996 images: function(projection2) {
76998 return searchLimited3(limit, projection2, _vegbilderCache.rtree);
77000 sequences: function(projection2) {
77001 const viewport = projection2.clipExtent();
77002 const min3 = [viewport[0][0], viewport[1][1]];
77003 const max3 = [viewport[1][0], viewport[0][1]];
77004 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
77005 const seen = /* @__PURE__ */ new Set();
77006 const line_strings = [];
77007 for (const { data } of _vegbilderCache.rtree.search(bbox2)) {
77008 const sequence = _vegbilderCache.image2sequence_map.get(data.key);
77009 if (!sequence) continue;
77010 const { key, geometry, images } = sequence;
77011 if (seen.has(key)) continue;
77014 type: "LineString",
77015 coordinates: geometry.coordinates,
77019 line_strings.push(line);
77021 return line_strings;
77023 cachedImage: function(key) {
77024 for (const { points } of _vegbilderCache.wfslayers.values()) {
77025 if (points.has(key)) return points.get(key);
77028 getSequenceForImage: function(image) {
77029 return _vegbilderCache == null ? void 0 : _vegbilderCache.image2sequence_map.get(image == null ? void 0 : image.key);
77031 loadImages: async function(context, margin) {
77032 if (!_vegbilderCache) {
77033 await this.reset();
77035 margin != null ? margin : margin = 1;
77036 const wfslayers = filterAvailableLayers(context.photos());
77037 loadWFSLayers(context.projection, margin, wfslayers);
77039 photoFrame: function() {
77040 return _currentFrame;
77042 ensureViewerLoaded: function(context) {
77043 if (_loadViewerPromise3) return _loadViewerPromise3;
77044 const step = (stepBy) => () => {
77045 const viewer = context.container().select(".photoviewer");
77046 const selected = viewer.empty() ? void 0 : viewer.datum();
77047 if (!selected) return;
77048 const sequence = this.getSequenceForImage(selected);
77049 const nextIndex = sequence.images.indexOf(selected) + stepBy;
77050 const nextImage = sequence.images[nextIndex];
77051 if (!nextImage) return;
77052 context.map().centerEase(nextImage.loc);
77053 this.selectImage(context, nextImage.key, true);
77055 const wrap2 = context.container().select(".photoviewer").selectAll(".vegbilder-wrapper").data([0]);
77056 const wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper vegbilder-wrapper").classed("hide", true);
77057 wrapEnter.append("div").attr("class", "photo-attribution fillD");
77058 const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
77059 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
77060 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
77061 _loadViewerPromise3 = Promise.all([
77062 pannellum_photo_default.init(context, wrapEnter),
77063 plane_photo_default.init(context, wrapEnter)
77064 ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
77065 _pannellumFrame = pannellumPhotoFrame;
77066 _pannellumFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
77067 _planeFrame = planePhotoFrame;
77068 _planeFrame.event.on("viewerChanged", () => dispatch8.call("viewerChanged"));
77070 return _loadViewerPromise3;
77072 selectImage: function(context, key, keepOrientation) {
77073 const d2 = this.cachedImage(key);
77074 this.updateUrlImage(key);
77075 const viewer = context.container().select(".photoviewer");
77076 if (!viewer.empty()) {
77079 this.setStyles(context, null, true);
77080 if (!d2) return this;
77081 const wrap2 = context.container().select(".photoviewer .vegbilder-wrapper");
77082 const attribution = wrap2.selectAll(".photo-attribution").text("");
77083 if (d2.captured_at) {
77084 attribution.append("span").attr("class", "captured_at").text(localeTimestamp(d2.captured_at));
77086 attribution.append("a").attr("target", "_blank").attr("href", "https://vegvesen.no").call(_t.append("vegbilder.publisher"));
77087 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"));
77088 _currentFrame = d2.is_sphere ? _pannellumFrame : _planeFrame;
77089 _currentFrame.selectPhoto(d2, keepOrientation).showPhotoFrame(wrap2);
77092 showViewer: function(context) {
77093 const viewer = context.container().select(".photoviewer").classed("hide", false);
77094 const isHidden = viewer.selectAll(".photo-wrapper.vegbilder-wrapper.hide").size();
77096 viewer.selectAll(".photo-wrapper:not(.vegbilder-wrapper)").classed("hide", true);
77097 viewer.selectAll(".photo-wrapper.vegbilder-wrapper").classed("hide", false);
77101 hideViewer: function(context) {
77102 this.updateUrlImage(null);
77103 const viewer = context.container().select(".photoviewer");
77104 if (!viewer.empty()) viewer.datum(null);
77105 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
77106 context.container().selectAll(".viewfield-group, .sequence").classed("currentView", false);
77107 return this.setStyles(context, null, true);
77109 // Updates the currently highlighted sequence and selected bubble.
77110 // Reset is only necessary when interacting with the viewport because
77111 // this implicitly changes the currently selected bubble/sequence
77112 setStyles: function(context, hovered, reset) {
77115 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
77116 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
77118 const hoveredImageKey = hovered == null ? void 0 : hovered.key;
77119 const hoveredSequence = this.getSequenceForImage(hovered);
77120 const hoveredSequenceKey = hoveredSequence == null ? void 0 : hoveredSequence.key;
77121 const hoveredImageKeys = (_a3 = hoveredSequence == null ? void 0 : hoveredSequence.images.map((d2) => d2.key)) != null ? _a3 : [];
77122 const viewer = context.container().select(".photoviewer");
77123 const selected = viewer.empty() ? void 0 : viewer.datum();
77124 const selectedImageKey = selected == null ? void 0 : selected.key;
77125 const selectedSequence = this.getSequenceForImage(selected);
77126 const selectedSequenceKey = selectedSequence == null ? void 0 : selectedSequence.key;
77127 const selectedImageKeys = (_b3 = selectedSequence == null ? void 0 : selectedSequence.images.map((d2) => d2.key)) != null ? _b3 : [];
77128 const highlightedImageKeys = utilArrayUnion(hoveredImageKeys, selectedImageKeys);
77129 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);
77130 context.container().selectAll(".layer-vegbilder .sequence").classed("highlighted", (d2) => d2.key === hoveredSequenceKey).classed("currentView", (d2) => d2.key === selectedSequenceKey);
77131 context.container().selectAll(".layer-vegbilder .viewfield-group .viewfield").attr("d", viewfieldPath);
77132 function viewfieldPath() {
77133 const d2 = this.parentNode.__data__;
77134 if (d2.is_sphere && d2.key !== selectedImageKey) {
77135 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
77137 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
77142 updateUrlImage: function(key) {
77143 if (!window.mocha) {
77144 const hash = utilStringQs(window.location.hash);
77146 hash.photo = "vegbilder/" + key;
77150 window.location.replace("#" + utilQsString(hash, true));
77153 validHere: function(extent) {
77154 const bbox2 = Object.values(extent.bbox());
77155 return iso1A2Codes(bbox2).includes("NO");
77157 cache: function() {
77158 return _vegbilderCache;
77162 // node_modules/osm-auth/src/osm-auth.mjs
77163 function osmAuth(o2) {
77167 _store = window.localStorage;
77169 var _mock = /* @__PURE__ */ new Map();
77172 hasItem: (k2) => _mock.has(k2),
77173 getItem: (k2) => _mock.get(k2),
77174 setItem: (k2, v2) => _mock.set(k2, v2),
77175 removeItem: (k2) => _mock.delete(k2),
77176 clear: () => _mock.clear()
77179 function token(k2, v2) {
77180 var key = o2.url + k2;
77181 if (arguments.length === 1) {
77182 var val = _store.getItem(key) || "";
77183 return val.replace(/"/g, "");
77184 } else if (arguments.length === 2) {
77186 return _store.setItem(key, v2);
77188 return _store.removeItem(key);
77192 oauth2.authenticated = function() {
77193 return !!token("oauth2_access_token");
77195 oauth2.logout = function() {
77196 token("oauth2_access_token", "");
77197 token("oauth_token", "");
77198 token("oauth_token_secret", "");
77199 token("oauth_request_token_secret", "");
77202 oauth2.authenticate = function(callback) {
77203 if (oauth2.authenticated()) {
77204 callback(null, oauth2);
77208 _preopenPopup(function(error, popup) {
77212 _generatePkceChallenge(function(pkce) {
77213 _authenticate(pkce, popup, callback);
77218 oauth2.authenticateAsync = function() {
77219 if (oauth2.authenticated()) {
77220 return Promise.resolve(oauth2);
77223 return new Promise((resolve, reject) => {
77224 var errback = (err, result) => {
77231 _preopenPopup((error, popup) => {
77235 _generatePkceChallenge((pkce) => _authenticate(pkce, popup, errback));
77240 function _preopenPopup(callback) {
77241 if (o2.singlepage) {
77242 callback(null, void 0);
77250 ["left", window.screen.width / 2 - w2 / 2],
77251 ["top", window.screen.height / 2 - h2 / 2]
77252 ].map(function(x2) {
77253 return x2.join("=");
77255 var popup = window.open("about:blank", "oauth_window", settings);
77257 callback(null, popup);
77259 var error = new Error("Popup was blocked");
77260 error.status = "popup-blocked";
77264 function _authenticate(pkce, popup, callback) {
77265 var state = generateState();
77266 var url = o2.url + "/oauth2/authorize?" + utilQsString2({
77267 client_id: o2.client_id,
77268 redirect_uri: o2.redirect_uri,
77269 response_type: "code",
77272 code_challenge: pkce.code_challenge,
77273 code_challenge_method: pkce.code_challenge_method,
77274 locale: o2.locale || ""
77276 if (o2.singlepage) {
77277 if (_store.isMocked) {
77278 var error = new Error("localStorage unavailable, but required in singlepage mode");
77279 error.status = "pkce-localstorage-unavailable";
77283 var params = utilStringQs2(window.location.search.slice(1));
77285 oauth2.bootstrapToken(params.code, callback);
77287 token("oauth2_state", state);
77288 token("oauth2_pkce_code_verifier", pkce.code_verifier);
77289 window.location = url;
77292 oauth2.popupWindow = popup;
77293 popup.location = url;
77295 window.authComplete = function(url2) {
77296 var params2 = utilStringQs2(url2.split("?")[1]);
77297 if (params2.state !== state) {
77298 var error2 = new Error("Invalid state");
77299 error2.status = "invalid-state";
77303 _getAccessToken(params2.code, pkce.code_verifier, accessTokenDone);
77304 delete window.authComplete;
77306 function accessTokenDone(err, xhr) {
77312 var access_token = JSON.parse(xhr.response);
77313 token("oauth2_access_token", access_token.access_token);
77314 callback(null, oauth2);
77317 function _getAccessToken(auth_code, code_verifier, accessTokenDone) {
77318 var url = o2.url + "/oauth2/token?" + utilQsString2({
77319 client_id: o2.client_id,
77320 redirect_uri: o2.redirect_uri,
77321 grant_type: "authorization_code",
77325 oauth2.rawxhr("POST", url, null, null, null, accessTokenDone);
77328 oauth2.bringPopupWindowToFront = function() {
77329 var broughtPopupToFront = false;
77331 if (oauth2.popupWindow && !oauth2.popupWindow.closed) {
77332 oauth2.popupWindow.focus();
77333 broughtPopupToFront = true;
77337 return broughtPopupToFront;
77339 oauth2.bootstrapToken = function(auth_code, callback) {
77340 var state = token("oauth2_state");
77341 token("oauth2_state", "");
77342 var params = utilStringQs2(window.location.search.slice(1));
77343 if (params.state !== state) {
77344 var error = new Error("Invalid state");
77345 error.status = "invalid-state";
77349 var code_verifier = token("oauth2_pkce_code_verifier");
77350 token("oauth2_pkce_code_verifier", "");
77351 _getAccessToken(auth_code, code_verifier, accessTokenDone);
77352 function accessTokenDone(err, xhr) {
77358 var access_token = JSON.parse(xhr.response);
77359 token("oauth2_access_token", access_token.access_token);
77360 callback(null, oauth2);
77363 oauth2.fetch = function(resource, options2) {
77364 if (oauth2.authenticated()) {
77368 return oauth2.authenticateAsync().then(_doFetch);
77370 return Promise.reject(new Error("not authenticated"));
77373 function _doFetch() {
77374 options2 = options2 || {};
77375 if (!options2.headers) {
77376 options2.headers = { "Content-Type": "application/x-www-form-urlencoded" };
77378 options2.headers.Authorization = "Bearer " + token("oauth2_access_token");
77379 return fetch(resource, options2);
77382 oauth2.xhr = function(options2, callback) {
77383 if (oauth2.authenticated()) {
77387 oauth2.authenticate(_doXHR);
77390 callback("not authenticated", null);
77394 function _doXHR() {
77395 var url = options2.prefix !== false ? o2.apiUrl + options2.path : options2.path;
77396 return oauth2.rawxhr(
77399 token("oauth2_access_token"),
77405 function done(err, xhr) {
77408 } else if (xhr.responseXML) {
77409 callback(err, xhr.responseXML);
77411 callback(err, xhr.response);
77415 oauth2.rawxhr = function(method, url, access_token, data, headers, callback) {
77416 headers = headers || { "Content-Type": "application/x-www-form-urlencoded" };
77417 if (access_token) {
77418 headers.Authorization = "Bearer " + access_token;
77420 var xhr = new XMLHttpRequest();
77421 xhr.onreadystatechange = function() {
77422 if (4 === xhr.readyState && 0 !== xhr.status) {
77423 if (/^20\d$/.test(xhr.status)) {
77424 callback(null, xhr);
77426 callback(xhr, null);
77430 xhr.onerror = function(e3) {
77431 callback(e3, null);
77433 xhr.open(method, url, true);
77434 for (var h2 in headers) xhr.setRequestHeader(h2, headers[h2]);
77438 oauth2.preauth = function(val) {
77439 if (val && val.access_token) {
77440 token("oauth2_access_token", val.access_token);
77444 oauth2.options = function(val) {
77445 if (!arguments.length) return o2;
77447 o2.apiUrl = o2.apiUrl || "https://api.openstreetmap.org";
77448 o2.url = o2.url || "https://www.openstreetmap.org";
77449 o2.auto = o2.auto || false;
77450 o2.singlepage = o2.singlepage || false;
77451 o2.loading = o2.loading || function() {
77453 o2.done = o2.done || function() {
77455 return oauth2.preauth(o2);
77457 oauth2.options(o2);
77460 function utilQsString2(obj) {
77461 return Object.keys(obj).filter(function(key) {
77462 return obj[key] !== void 0;
77463 }).sort().map(function(key) {
77464 return encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
77467 function utilStringQs2(str) {
77469 while (i3 < str.length && (str[i3] === "?" || str[i3] === "#")) i3++;
77470 str = str.slice(i3);
77471 return str.split("&").reduce(function(obj, pair3) {
77472 var parts = pair3.split("=");
77473 if (parts.length === 2) {
77474 obj[parts[0]] = decodeURIComponent(parts[1]);
77479 function supportsWebCryptoAPI() {
77480 return window && window.crypto && window.crypto.getRandomValues && window.crypto.subtle && window.crypto.subtle.digest;
77482 function _generatePkceChallenge(callback) {
77484 if (supportsWebCryptoAPI()) {
77485 var random = window.crypto.getRandomValues(new Uint8Array(32));
77486 code_verifier = base64(random.buffer);
77487 var verifier = Uint8Array.from(Array.from(code_verifier).map(function(char) {
77488 return char.charCodeAt(0);
77490 window.crypto.subtle.digest("SHA-256", verifier).then(function(hash) {
77491 var code_challenge = base64(hash);
77495 code_challenge_method: "S256"
77499 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77500 code_verifier = "";
77501 for (var i3 = 0; i3 < 64; i3++) {
77502 code_verifier += chars[Math.floor(Math.random() * chars.length)];
77506 code_challenge: code_verifier,
77507 code_challenge_method: "plain"
77511 function generateState() {
77513 if (supportsWebCryptoAPI()) {
77514 var random = window.crypto.getRandomValues(new Uint8Array(32));
77515 state = base64(random.buffer);
77517 var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
77519 for (var i3 = 0; i3 < 64; i3++) {
77520 state += chars[Math.floor(Math.random() * chars.length)];
77525 function base64(buffer) {
77526 return btoa(String.fromCharCode.apply(null, new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/[=]/g, "");
77529 // modules/services/osm.js
77530 var tiler5 = utilTiler();
77531 var dispatch9 = dispatch_default("apiStatusChange", "authLoading", "authDone", "change", "loading", "loaded", "loadedNotes");
77532 var urlroot = osmApiConnections[0].url;
77533 var apiUrlroot = osmApiConnections[0].apiUrl || urlroot;
77534 var redirectPath = window.location.origin + window.location.pathname;
77535 var oauth = osmAuth({
77537 apiUrl: apiUrlroot,
77538 client_id: osmApiConnections[0].client_id,
77539 scope: "read_prefs write_prefs write_api read_gpx write_notes",
77540 redirect_uri: redirectPath + "land.html",
77541 loading: authLoading,
77544 var _apiConnections = osmApiConnections;
77545 var _imageryBlocklists = [/.*\.google(apis)?\..*\/(vt|kh)[\?\/].*([xyz]=.*){3}.*/];
77546 var _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
77547 var _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
77548 var _userCache = { toLoad: {}, user: {} };
77549 var _cachedApiStatus;
77550 var _changeset = {};
77551 var _deferred = /* @__PURE__ */ new Set();
77552 var _connectionID = 1;
77553 var _tileZoom3 = 16;
77554 var _noteZoom = 12;
77555 var _rateLimitError;
77556 var _userChangesets;
77559 var _maxWayNodes = 2e3;
77560 function authLoading() {
77561 dispatch9.call("authLoading");
77563 function authDone() {
77564 dispatch9.call("authDone");
77566 function abortRequest4(controllerOrXHR) {
77567 if (controllerOrXHR) {
77568 controllerOrXHR.abort();
77571 function hasInflightRequests(cache) {
77572 return Object.keys(cache.inflight).length;
77574 function abortUnwantedRequests3(cache, visibleTiles) {
77575 Object.keys(cache.inflight).forEach(function(k2) {
77576 if (cache.toLoad[k2]) return;
77577 if (visibleTiles.find(function(tile) {
77578 return k2 === tile.id;
77580 abortRequest4(cache.inflight[k2]);
77581 delete cache.inflight[k2];
77584 function getLoc(attrs) {
77585 var lon = attrs.lon && attrs.lon.value;
77586 var lat = attrs.lat && attrs.lat.value;
77587 return [Number(lon), Number(lat)];
77589 function getNodes(obj) {
77590 var elems = obj.getElementsByTagName("nd");
77591 var nodes = new Array(elems.length);
77592 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77593 nodes[i3] = "n" + elems[i3].attributes.ref.value;
77597 function getNodesJSON(obj) {
77598 var elems = obj.nodes;
77599 var nodes = new Array(elems.length);
77600 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77601 nodes[i3] = "n" + elems[i3];
77605 function getTags(obj) {
77606 var elems = obj.getElementsByTagName("tag");
77608 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77609 var attrs = elems[i3].attributes;
77610 tags[attrs.k.value] = attrs.v.value;
77614 function getMembers(obj) {
77615 var elems = obj.getElementsByTagName("member");
77616 var members = new Array(elems.length);
77617 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77618 var attrs = elems[i3].attributes;
77620 id: attrs.type.value[0] + attrs.ref.value,
77621 type: attrs.type.value,
77622 role: attrs.role.value
77627 function getMembersJSON(obj) {
77628 var elems = obj.members;
77629 var members = new Array(elems.length);
77630 for (var i3 = 0, l2 = elems.length; i3 < l2; i3++) {
77631 var attrs = elems[i3];
77633 id: attrs.type[0] + attrs.ref,
77640 function getVisible(attrs) {
77641 return !attrs.visible || attrs.visible.value !== "false";
77643 function parseComments(comments) {
77644 var parsedComments = [];
77645 for (var i3 = 0; i3 < comments.length; i3++) {
77646 var comment = comments[i3];
77647 if (comment.nodeName === "comment") {
77648 var childNodes = comment.childNodes;
77649 var parsedComment = {};
77650 for (var j2 = 0; j2 < childNodes.length; j2++) {
77651 var node = childNodes[j2];
77652 var nodeName = node.nodeName;
77653 if (nodeName === "#text") continue;
77654 parsedComment[nodeName] = node.textContent;
77655 if (nodeName === "uid") {
77656 var uid = node.textContent;
77657 if (uid && !_userCache.user[uid]) {
77658 _userCache.toLoad[uid] = true;
77662 if (parsedComment) {
77663 parsedComments.push(parsedComment);
77667 return parsedComments;
77669 function encodeNoteRtree(note) {
77678 var jsonparsers = {
77679 node: function nodeData(obj, uid) {
77680 return new osmNode({
77682 visible: typeof obj.visible === "boolean" ? obj.visible : true,
77683 version: obj.version && obj.version.toString(),
77684 changeset: obj.changeset && obj.changeset.toString(),
77685 timestamp: obj.timestamp,
77687 uid: obj.uid && obj.uid.toString(),
77688 loc: [Number(obj.lon), Number(obj.lat)],
77692 way: function wayData(obj, uid) {
77693 return new osmWay({
77695 visible: typeof obj.visible === "boolean" ? obj.visible : true,
77696 version: obj.version && obj.version.toString(),
77697 changeset: obj.changeset && obj.changeset.toString(),
77698 timestamp: obj.timestamp,
77700 uid: obj.uid && obj.uid.toString(),
77702 nodes: getNodesJSON(obj)
77705 relation: function relationData(obj, uid) {
77706 return new osmRelation({
77708 visible: typeof obj.visible === "boolean" ? obj.visible : true,
77709 version: obj.version && obj.version.toString(),
77710 changeset: obj.changeset && obj.changeset.toString(),
77711 timestamp: obj.timestamp,
77713 uid: obj.uid && obj.uid.toString(),
77715 members: getMembersJSON(obj)
77718 user: function parseUser(obj, uid) {
77721 display_name: obj.display_name,
77722 account_created: obj.account_created,
77723 image_url: obj.img && obj.img.href,
77724 changesets_count: obj.changesets && obj.changesets.count && obj.changesets.count.toString() || "0",
77725 active_blocks: obj.blocks && obj.blocks.received && obj.blocks.received.active && obj.blocks.received.active.toString() || "0"
77729 function parseJSON(payload, callback, options2) {
77730 options2 = Object.assign({ skipSeen: true }, options2);
77732 return callback({ message: "No JSON", status: -1 });
77734 var json = payload;
77735 if (typeof json !== "object") json = JSON.parse(payload);
77736 if (!json.elements) return callback({ message: "No JSON", status: -1 });
77737 var children2 = json.elements;
77738 var handle = window.requestIdleCallback(function() {
77739 _deferred.delete(handle);
77742 for (var i3 = 0; i3 < children2.length; i3++) {
77743 result = parseChild(children2[i3]);
77744 if (result) results.push(result);
77746 callback(null, results);
77748 _deferred.add(handle);
77749 function parseChild(child) {
77750 var parser3 = jsonparsers[child.type];
77751 if (!parser3) return null;
77753 uid = osmEntity.id.fromOSM(child.type, child.id);
77754 if (options2.skipSeen) {
77755 if (_tileCache.seen[uid]) return null;
77756 _tileCache.seen[uid] = true;
77758 return parser3(child, uid);
77761 function parseUserJSON(payload, callback, options2) {
77762 options2 = Object.assign({ skipSeen: true }, options2);
77764 return callback({ message: "No JSON", status: -1 });
77766 var json = payload;
77767 if (typeof json !== "object") json = JSON.parse(payload);
77768 if (!json.users && !json.user) return callback({ message: "No JSON", status: -1 });
77769 var objs = json.users || [json];
77770 var handle = window.requestIdleCallback(function() {
77771 _deferred.delete(handle);
77774 for (var i3 = 0; i3 < objs.length; i3++) {
77775 result = parseObj(objs[i3]);
77776 if (result) results.push(result);
77778 callback(null, results);
77780 _deferred.add(handle);
77781 function parseObj(obj) {
77782 var uid = obj.user.id && obj.user.id.toString();
77783 if (options2.skipSeen && _userCache.user[uid]) {
77784 delete _userCache.toLoad[uid];
77787 var user = jsonparsers.user(obj.user, uid);
77788 _userCache.user[uid] = user;
77789 delete _userCache.toLoad[uid];
77794 node: function nodeData2(obj, uid) {
77795 var attrs = obj.attributes;
77796 return new osmNode({
77798 visible: getVisible(attrs),
77799 version: attrs.version.value,
77800 changeset: attrs.changeset && attrs.changeset.value,
77801 timestamp: attrs.timestamp && attrs.timestamp.value,
77802 user: attrs.user && attrs.user.value,
77803 uid: attrs.uid && attrs.uid.value,
77804 loc: getLoc(attrs),
77808 way: function wayData2(obj, uid) {
77809 var attrs = obj.attributes;
77810 return new osmWay({
77812 visible: getVisible(attrs),
77813 version: attrs.version.value,
77814 changeset: attrs.changeset && attrs.changeset.value,
77815 timestamp: attrs.timestamp && attrs.timestamp.value,
77816 user: attrs.user && attrs.user.value,
77817 uid: attrs.uid && attrs.uid.value,
77818 tags: getTags(obj),
77819 nodes: getNodes(obj)
77822 relation: function relationData2(obj, uid) {
77823 var attrs = obj.attributes;
77824 return new osmRelation({
77826 visible: getVisible(attrs),
77827 version: attrs.version.value,
77828 changeset: attrs.changeset && attrs.changeset.value,
77829 timestamp: attrs.timestamp && attrs.timestamp.value,
77830 user: attrs.user && attrs.user.value,
77831 uid: attrs.uid && attrs.uid.value,
77832 tags: getTags(obj),
77833 members: getMembers(obj)
77836 note: function parseNote(obj, uid) {
77837 var attrs = obj.attributes;
77838 var childNodes = obj.childNodes;
77841 props.loc = getLoc(attrs);
77842 if (!_noteCache.note[uid]) {
77843 let coincident = false;
77844 const epsilon3 = 1e-5;
77847 props.loc = geoVecAdd(props.loc, [epsilon3, epsilon3]);
77849 const bbox2 = geoExtent(props.loc).bbox();
77850 coincident = _noteCache.rtree.search(bbox2).length;
77851 } while (coincident);
77853 props.loc = _noteCache.note[uid].loc;
77855 for (var i3 = 0; i3 < childNodes.length; i3++) {
77856 var node = childNodes[i3];
77857 var nodeName = node.nodeName;
77858 if (nodeName === "#text") continue;
77859 if (nodeName === "comments") {
77860 props[nodeName] = parseComments(node.childNodes);
77862 props[nodeName] = node.textContent;
77865 var note = new osmNote(props);
77866 var item = encodeNoteRtree(note);
77867 _noteCache.note[note.id] = note;
77868 updateRtree3(item, true);
77871 user: function parseUser2(obj, uid) {
77872 var attrs = obj.attributes;
77875 display_name: attrs.display_name && attrs.display_name.value,
77876 account_created: attrs.account_created && attrs.account_created.value,
77877 changesets_count: "0",
77880 var img = obj.getElementsByTagName("img");
77881 if (img && img[0] && img[0].getAttribute("href")) {
77882 user.image_url = img[0].getAttribute("href");
77884 var changesets = obj.getElementsByTagName("changesets");
77885 if (changesets && changesets[0] && changesets[0].getAttribute("count")) {
77886 user.changesets_count = changesets[0].getAttribute("count");
77888 var blocks = obj.getElementsByTagName("blocks");
77889 if (blocks && blocks[0]) {
77890 var received = blocks[0].getElementsByTagName("received");
77891 if (received && received[0] && received[0].getAttribute("active")) {
77892 user.active_blocks = received[0].getAttribute("active");
77895 _userCache.user[uid] = user;
77896 delete _userCache.toLoad[uid];
77900 function parseXML(xml, callback, options2) {
77901 options2 = Object.assign({ skipSeen: true }, options2);
77902 if (!xml || !xml.childNodes) {
77903 return callback({ message: "No XML", status: -1 });
77905 var root3 = xml.childNodes[0];
77906 var children2 = root3.childNodes;
77907 var handle = window.requestIdleCallback(function() {
77908 _deferred.delete(handle);
77911 for (var i3 = 0; i3 < children2.length; i3++) {
77912 result = parseChild(children2[i3]);
77913 if (result) results.push(result);
77915 callback(null, results);
77917 _deferred.add(handle);
77918 function parseChild(child) {
77919 var parser3 = parsers[child.nodeName];
77920 if (!parser3) return null;
77922 if (child.nodeName === "user") {
77923 uid = child.attributes.id.value;
77924 if (options2.skipSeen && _userCache.user[uid]) {
77925 delete _userCache.toLoad[uid];
77928 } else if (child.nodeName === "note") {
77929 uid = child.getElementsByTagName("id")[0].textContent;
77931 uid = osmEntity.id.fromOSM(child.nodeName, child.attributes.id.value);
77932 if (options2.skipSeen) {
77933 if (_tileCache.seen[uid]) return null;
77934 _tileCache.seen[uid] = true;
77937 return parser3(child, uid);
77940 function updateRtree3(item, replace) {
77941 _noteCache.rtree.remove(item, function isEql(a2, b2) {
77942 return a2.data.id === b2.data.id;
77945 _noteCache.rtree.insert(item);
77948 function wrapcb(thisArg, callback, cid) {
77949 return function(err, result) {
77951 if (err.status === 400 || err.status === 401 || err.status === 403) {
77954 return callback.call(thisArg, err);
77955 } else if (thisArg.getConnectionId() !== cid) {
77956 return callback.call(thisArg, { message: "Connection Switched", status: -1 });
77958 return callback.call(thisArg, err, result);
77962 var osm_default = {
77964 utilRebind(this, dispatch9, "on");
77966 reset: function() {
77967 Array.from(_deferred).forEach(function(handle) {
77968 window.cancelIdleCallback(handle);
77969 _deferred.delete(handle);
77972 _userChangesets = void 0;
77973 _userDetails = void 0;
77974 _rateLimitError = void 0;
77975 Object.values(_tileCache.inflight).forEach(abortRequest4);
77976 Object.values(_noteCache.inflight).forEach(abortRequest4);
77977 Object.values(_noteCache.inflightPost).forEach(abortRequest4);
77978 if (_changeset.inflight) abortRequest4(_changeset.inflight);
77979 _tileCache = { toLoad: {}, loaded: {}, inflight: {}, seen: {}, rtree: new RBush() };
77980 _noteCache = { toLoad: {}, loaded: {}, inflight: {}, inflightPost: {}, note: {}, closed: {}, rtree: new RBush() };
77981 _userCache = { toLoad: {}, user: {} };
77982 _cachedApiStatus = void 0;
77986 getConnectionId: function() {
77987 return _connectionID;
77989 getUrlRoot: function() {
77992 getApiUrlRoot: function() {
77995 changesetURL: function(changesetID) {
77996 return urlroot + "/changeset/" + changesetID;
77998 changesetsURL: function(center, zoom) {
77999 var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
78000 return urlroot + "/history#map=" + Math.floor(zoom) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
78002 entityURL: function(entity) {
78003 return urlroot + "/" + entity.type + "/" + entity.osmId();
78005 historyURL: function(entity) {
78006 return urlroot + "/" + entity.type + "/" + entity.osmId() + "/history";
78008 userURL: function(username) {
78009 return urlroot + "/user/" + encodeURIComponent(username);
78011 noteURL: function(note) {
78012 return urlroot + "/note/" + note.id;
78014 noteReportURL: function(note) {
78015 return urlroot + "/reports/new?reportable_type=Note&reportable_id=" + note.id;
78017 // Generic method to load data from the OSM API
78018 // Can handle either auth or unauth calls.
78019 loadFromAPI: function(path, callback, options2) {
78020 options2 = Object.assign({ skipSeen: true }, options2);
78022 var cid = _connectionID;
78023 function done(err, payload) {
78024 if (that.getConnectionId() !== cid) {
78025 if (callback) callback({ message: "Connection Switched", status: -1 });
78028 var isAuthenticated = that.authenticated();
78029 if (isAuthenticated && err && err.status && (err.status === 400 || err.status === 401 || err.status === 403)) {
78031 that.loadFromAPI(path, callback, options2);
78033 if (!isAuthenticated && !_rateLimitError && err && err.status && (err.status === 509 || err.status === 429)) {
78034 _rateLimitError = err;
78035 dispatch9.call("change");
78036 that.reloadApiStatus();
78037 } else if (err && _cachedApiStatus === "online" || !err && _cachedApiStatus !== "online") {
78038 that.reloadApiStatus();
78042 return callback(err);
78044 if (path.indexOf(".json") !== -1) {
78045 return parseJSON(payload, callback, options2);
78047 return parseXML(payload, callback, options2);
78053 if (this.authenticated()) {
78059 var url = apiUrlroot + path;
78060 var controller = new AbortController();
78062 if (path.indexOf(".json") !== -1) {
78067 fn(url, { signal: controller.signal }).then(function(data) {
78069 }).catch(function(err) {
78070 if (err.name === "AbortError") return;
78071 var match = err.message.match(/^\d{3}/);
78073 done({ status: +match[0], statusText: err.message });
78081 // Load a single entity by id (ways and relations use the `/full` call to include
78082 // nodes and members). Parent relations are not included, see `loadEntityRelations`.
78083 // GET /api/0.6/node/#id
78084 // GET /api/0.6/[way|relation]/#id/full
78085 loadEntity: function(id2, callback) {
78086 var type2 = osmEntity.id.type(id2);
78087 var osmID = osmEntity.id.toOSM(id2);
78088 var options2 = { skipSeen: false };
78090 "/api/0.6/" + type2 + "/" + osmID + (type2 !== "node" ? "/full" : "") + ".json",
78091 function(err, entities) {
78092 if (callback) callback(err, { data: entities });
78097 // Load a single note by id , XML format
78098 // GET /api/0.6/notes/#id
78099 loadEntityNote: function(id2, callback) {
78100 var options2 = { skipSeen: false };
78102 "/api/0.6/notes/" + id2,
78103 function(err, entities) {
78104 if (callback) callback(err, { data: entities });
78109 // Load a single entity with a specific version
78110 // GET /api/0.6/[node|way|relation]/#id/#version
78111 loadEntityVersion: function(id2, version, callback) {
78112 var type2 = osmEntity.id.type(id2);
78113 var osmID = osmEntity.id.toOSM(id2);
78114 var options2 = { skipSeen: false };
78116 "/api/0.6/" + type2 + "/" + osmID + "/" + version + ".json",
78117 function(err, entities) {
78118 if (callback) callback(err, { data: entities });
78123 // Load the relations of a single entity with the given.
78124 // GET /api/0.6/[node|way|relation]/#id/relations
78125 loadEntityRelations: function(id2, callback) {
78126 var type2 = osmEntity.id.type(id2);
78127 var osmID = osmEntity.id.toOSM(id2);
78128 var options2 = { skipSeen: false };
78130 "/api/0.6/" + type2 + "/" + osmID + "/relations.json",
78131 function(err, entities) {
78132 if (callback) callback(err, { data: entities });
78137 // Load multiple entities in chunks
78138 // (note: callback may be called multiple times)
78139 // Unlike `loadEntity`, child nodes and members are not fetched
78140 // GET /api/0.6/[nodes|ways|relations]?#parameters
78141 loadMultiple: function(ids, callback) {
78143 var groups = utilArrayGroupBy(utilArrayUniq(ids), osmEntity.id.type);
78144 Object.keys(groups).forEach(function(k2) {
78145 var type2 = k2 + "s";
78146 var osmIDs = groups[k2].map(function(id2) {
78147 return osmEntity.id.toOSM(id2);
78149 var options2 = { skipSeen: false };
78150 utilArrayChunk(osmIDs, 150).forEach(function(arr) {
78152 "/api/0.6/" + type2 + ".json?" + type2 + "=" + arr.join(),
78153 function(err, entities) {
78154 if (callback) callback(err, { data: entities });
78161 // Create, upload, and close a changeset
78162 // PUT /api/0.6/changeset/create
78163 // POST /api/0.6/changeset/#id/upload
78164 // PUT /api/0.6/changeset/#id/close
78165 putChangeset: function(changeset, changes, callback) {
78166 var cid = _connectionID;
78167 if (_changeset.inflight) {
78168 return callback({ message: "Changeset already inflight", status: -2 }, changeset);
78169 } else if (_changeset.open) {
78170 return createdChangeset.call(this, null, _changeset.open);
78174 path: "/api/0.6/changeset/create",
78175 headers: { "Content-Type": "text/xml" },
78176 content: JXON.stringify(changeset.asJXON())
78178 _changeset.inflight = oauth.xhr(
78180 wrapcb(this, createdChangeset, cid)
78183 function createdChangeset(err, changesetID) {
78184 _changeset.inflight = null;
78186 return callback(err, changeset);
78188 _changeset.open = changesetID;
78189 changeset = changeset.update({ id: changesetID });
78192 path: "/api/0.6/changeset/" + changesetID + "/upload",
78193 headers: { "Content-Type": "text/xml" },
78194 content: JXON.stringify(changeset.osmChangeJXON(changes))
78196 _changeset.inflight = oauth.xhr(
78198 wrapcb(this, uploadedChangeset, cid)
78201 function uploadedChangeset(err) {
78202 _changeset.inflight = null;
78203 if (err) return callback(err, changeset);
78204 window.setTimeout(function() {
78205 callback(null, changeset);
78207 _changeset.open = null;
78208 if (this.getConnectionId() === cid) {
78211 path: "/api/0.6/changeset/" + changeset.id + "/close",
78212 headers: { "Content-Type": "text/xml" }
78219 // Load multiple users in chunks
78220 // (note: callback may be called multiple times)
78221 // GET /api/0.6/users?users=#id1,#id2,...,#idn
78222 loadUsers: function(uids, callback) {
78225 utilArrayUniq(uids).forEach(function(uid) {
78226 if (_userCache.user[uid]) {
78227 delete _userCache.toLoad[uid];
78228 cached.push(_userCache.user[uid]);
78233 if (cached.length || !this.authenticated()) {
78234 callback(void 0, cached);
78235 if (!this.authenticated()) return;
78237 utilArrayChunk(toLoad, 150).forEach((function(arr) {
78240 path: "/api/0.6/users.json?users=" + arr.join()
78241 }, wrapcb(this, done, _connectionID));
78243 function done(err, payload) {
78244 if (err) return callback(err);
78245 var options2 = { skipSeen: true };
78246 return parseUserJSON(payload, function(err2, results) {
78247 if (err2) return callback(err2);
78248 return callback(void 0, results);
78252 // Load a given user by id
78253 // GET /api/0.6/user/#id
78254 loadUser: function(uid, callback) {
78255 if (_userCache.user[uid] || !this.authenticated()) {
78256 delete _userCache.toLoad[uid];
78257 return callback(void 0, _userCache.user[uid]);
78261 path: "/api/0.6/user/" + uid + ".json"
78262 }, wrapcb(this, done, _connectionID));
78263 function done(err, payload) {
78264 if (err) return callback(err);
78265 var options2 = { skipSeen: true };
78266 return parseUserJSON(payload, function(err2, results) {
78267 if (err2) return callback(err2);
78268 return callback(void 0, results[0]);
78272 // Load the details of the logged-in user
78273 // GET /api/0.6/user/details
78274 userDetails: function(callback) {
78275 if (_userDetails) {
78276 return callback(void 0, _userDetails);
78280 path: "/api/0.6/user/details.json"
78281 }, wrapcb(this, done, _connectionID));
78282 function done(err, payload) {
78283 if (err) return callback(err);
78284 var options2 = { skipSeen: false };
78285 return parseUserJSON(payload, function(err2, results) {
78286 if (err2) return callback(err2);
78287 _userDetails = results[0];
78288 return callback(void 0, _userDetails);
78292 // Load previous changesets for the logged in user
78293 // GET /api/0.6/changesets?user=#id
78294 userChangesets: function(callback) {
78295 if (_userChangesets) {
78296 return callback(void 0, _userChangesets);
78299 wrapcb(this, gotDetails, _connectionID)
78301 function gotDetails(err, user) {
78303 return callback(err);
78307 path: "/api/0.6/changesets?user=" + user.id
78308 }, wrapcb(this, done, _connectionID));
78310 function done(err, xml) {
78312 return callback(err);
78314 _userChangesets = Array.prototype.map.call(
78315 xml.getElementsByTagName("changeset"),
78316 function(changeset) {
78317 return { tags: getTags(changeset) };
78319 ).filter(function(changeset) {
78320 var comment = changeset.tags.comment;
78321 return comment && comment !== "";
78323 return callback(void 0, _userChangesets);
78326 // Fetch the status of the OSM API
78327 // GET /api/capabilities
78328 status: function(callback) {
78329 var url = apiUrlroot + "/api/capabilities";
78330 var errback = wrapcb(this, done, _connectionID);
78331 xml_default(url).then(function(data) {
78332 errback(null, data);
78333 }).catch(function(err) {
78334 errback(err.message);
78336 function done(err, xml) {
78338 return callback(err, null);
78340 var elements = xml.getElementsByTagName("blacklist");
78342 for (var i3 = 0; i3 < elements.length; i3++) {
78343 var regexString = elements[i3].getAttribute("regex");
78346 var regex = new RegExp(regexString);
78347 regexes.push(regex);
78352 if (regexes.length) {
78353 _imageryBlocklists = regexes;
78355 if (_rateLimitError) {
78356 return callback(_rateLimitError, "rateLimited");
78358 var waynodes = xml.getElementsByTagName("waynodes");
78359 var maxWayNodes = waynodes.length && parseInt(waynodes[0].getAttribute("maximum"), 10);
78360 if (maxWayNodes && isFinite(maxWayNodes)) _maxWayNodes = maxWayNodes;
78361 var apiStatus = xml.getElementsByTagName("status");
78362 var val = apiStatus[0].getAttribute("api");
78363 return callback(void 0, val);
78367 // Calls `status` and dispatches an `apiStatusChange` event if the returned
78368 // status differs from the cached status.
78369 reloadApiStatus: function() {
78370 if (!this.throttledReloadApiStatus) {
78372 this.throttledReloadApiStatus = throttle_default(function() {
78373 that.status(function(err, status) {
78374 if (status !== _cachedApiStatus) {
78375 _cachedApiStatus = status;
78376 dispatch9.call("apiStatusChange", that, err, status);
78381 this.throttledReloadApiStatus();
78383 // Returns the maximum number of nodes a single way can have
78384 maxWayNodes: function() {
78385 return _maxWayNodes;
78387 // Load data (entities) from the API in tiles
78388 // GET /api/0.6/map?bbox=
78389 loadTiles: function(projection2, callback) {
78391 var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
78392 var hadRequests = hasInflightRequests(_tileCache);
78393 abortUnwantedRequests3(_tileCache, tiles);
78394 if (hadRequests && !hasInflightRequests(_tileCache)) {
78395 dispatch9.call("loaded");
78397 tiles.forEach(function(tile) {
78398 this.loadTile(tile, callback);
78401 // Load a single data tile
78402 // GET /api/0.6/map?bbox=
78403 loadTile: function(tile, callback) {
78405 if (_tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
78406 if (!hasInflightRequests(_tileCache)) {
78407 dispatch9.call("loading");
78409 var path = "/api/0.6/map.json?bbox=";
78410 var options2 = { skipSeen: true };
78411 _tileCache.inflight[tile.id] = this.loadFromAPI(
78412 path + tile.extent.toParam(),
78416 function tileCallback(err, parsed) {
78417 delete _tileCache.inflight[tile.id];
78419 delete _tileCache.toLoad[tile.id];
78420 _tileCache.loaded[tile.id] = true;
78421 var bbox2 = tile.extent.bbox();
78422 bbox2.id = tile.id;
78423 _tileCache.rtree.insert(bbox2);
78426 callback(err, Object.assign({ data: parsed }, tile));
78428 if (!hasInflightRequests(_tileCache)) {
78429 dispatch9.call("loaded");
78433 isDataLoaded: function(loc) {
78434 var bbox2 = { minX: loc[0], minY: loc[1], maxX: loc[0], maxY: loc[1] };
78435 return _tileCache.rtree.collides(bbox2);
78437 // load the tile that covers the given `loc`
78438 loadTileAtLoc: function(loc, callback) {
78439 if (Object.keys(_tileCache.toLoad).length > 50) return;
78440 var k2 = geoZoomToScale(_tileZoom3 + 1);
78441 var offset = geoRawMercator().scale(k2)(loc);
78442 var projection2 = geoRawMercator().transform({ k: k2, x: -offset[0], y: -offset[1] });
78443 var tiles = tiler5.zoomExtent([_tileZoom3, _tileZoom3]).getTiles(projection2);
78444 tiles.forEach(function(tile) {
78445 if (_tileCache.toLoad[tile.id] || _tileCache.loaded[tile.id] || _tileCache.inflight[tile.id]) return;
78446 _tileCache.toLoad[tile.id] = true;
78447 this.loadTile(tile, callback);
78450 // Load notes from the API in tiles
78451 // GET /api/0.6/notes?bbox=
78452 loadNotes: function(projection2, noteOptions) {
78453 noteOptions = Object.assign({ limit: 1e4, closed: 7 }, noteOptions);
78456 var path = "/api/0.6/notes?limit=" + noteOptions.limit + "&closed=" + noteOptions.closed + "&bbox=";
78457 var throttleLoadUsers = throttle_default(function() {
78458 var uids = Object.keys(_userCache.toLoad);
78459 if (!uids.length) return;
78460 that.loadUsers(uids, function() {
78463 var tiles = tiler5.zoomExtent([_noteZoom, _noteZoom]).getTiles(projection2);
78464 abortUnwantedRequests3(_noteCache, tiles);
78465 tiles.forEach(function(tile) {
78466 if (_noteCache.loaded[tile.id] || _noteCache.inflight[tile.id]) return;
78467 var options2 = { skipSeen: false };
78468 _noteCache.inflight[tile.id] = that.loadFromAPI(
78469 path + tile.extent.toParam(),
78471 delete _noteCache.inflight[tile.id];
78473 _noteCache.loaded[tile.id] = true;
78475 throttleLoadUsers();
78476 dispatch9.call("loadedNotes");
78483 // POST /api/0.6/notes?params
78484 postNoteCreate: function(note, callback) {
78485 if (!this.authenticated()) {
78486 return callback({ message: "Not Authenticated", status: -3 }, note);
78488 if (_noteCache.inflightPost[note.id]) {
78489 return callback({ message: "Note update already inflight", status: -2 }, note);
78491 if (!note.loc[0] || !note.loc[1] || !note.newComment) return;
78492 var comment = note.newComment;
78493 if (note.newCategory && note.newCategory !== "None") {
78494 comment += " #" + note.newCategory;
78496 var path = "/api/0.6/notes?" + utilQsString({ lon: note.loc[0], lat: note.loc[1], text: comment });
78497 _noteCache.inflightPost[note.id] = oauth.xhr({
78500 }, wrapcb(this, done, _connectionID));
78501 function done(err, xml) {
78502 delete _noteCache.inflightPost[note.id];
78504 return callback(err);
78506 this.removeNote(note);
78507 var options2 = { skipSeen: false };
78508 return parseXML(xml, function(err2, results) {
78510 return callback(err2);
78512 return callback(void 0, results[0]);
78518 // POST /api/0.6/notes/#id/comment?text=comment
78519 // POST /api/0.6/notes/#id/close?text=comment
78520 // POST /api/0.6/notes/#id/reopen?text=comment
78521 postNoteUpdate: function(note, newStatus, callback) {
78522 if (!this.authenticated()) {
78523 return callback({ message: "Not Authenticated", status: -3 }, note);
78525 if (_noteCache.inflightPost[note.id]) {
78526 return callback({ message: "Note update already inflight", status: -2 }, note);
78529 if (note.status !== "closed" && newStatus === "closed") {
78531 } else if (note.status !== "open" && newStatus === "open") {
78534 action = "comment";
78535 if (!note.newComment) return;
78537 var path = "/api/0.6/notes/" + note.id + "/" + action;
78538 if (note.newComment) {
78539 path += "?" + utilQsString({ text: note.newComment });
78541 _noteCache.inflightPost[note.id] = oauth.xhr({
78544 }, wrapcb(this, done, _connectionID));
78545 function done(err, xml) {
78546 delete _noteCache.inflightPost[note.id];
78548 return callback(err);
78550 this.removeNote(note);
78551 if (action === "close") {
78552 _noteCache.closed[note.id] = true;
78553 } else if (action === "reopen") {
78554 delete _noteCache.closed[note.id];
78556 var options2 = { skipSeen: false };
78557 return parseXML(xml, function(err2, results) {
78559 return callback(err2);
78561 return callback(void 0, results[0]);
78566 /* connection options for source switcher (optional) */
78567 apiConnections: function(val) {
78568 if (!arguments.length) return _apiConnections;
78569 _apiConnections = val;
78572 switch: function(newOptions) {
78573 urlroot = newOptions.url;
78574 apiUrlroot = newOptions.apiUrl || urlroot;
78575 if (newOptions.url && !newOptions.apiUrl) {
78578 apiUrl: newOptions.url
78581 const oldOptions = utilObjectOmit(oauth.options(), "access_token");
78582 oauth.options({ ...oldOptions, ...newOptions });
78584 this.userChangesets(function() {
78586 dispatch9.call("change");
78589 toggle: function(val) {
78593 isChangesetInflight: function() {
78594 return !!_changeset.inflight;
78596 // get/set cached data
78597 // This is used to save/restore the state when entering/exiting the walkthrough
78598 // Also used for testing purposes.
78599 caches: function(obj) {
78600 function cloneCache(source) {
78602 Object.keys(source).forEach(function(k2) {
78603 if (k2 === "rtree") {
78604 target.rtree = new RBush().fromJSON(source.rtree.toJSON());
78605 } else if (k2 === "note") {
78607 Object.keys(source.note).forEach(function(id2) {
78608 target.note[id2] = osmNote(source.note[id2]);
78611 target[k2] = JSON.parse(JSON.stringify(source[k2]));
78616 if (!arguments.length) {
78618 tile: cloneCache(_tileCache),
78619 note: cloneCache(_noteCache),
78620 user: cloneCache(_userCache)
78623 if (obj === "get") {
78631 _tileCache = obj.tile;
78632 _tileCache.inflight = {};
78635 _noteCache = obj.note;
78636 _noteCache.inflight = {};
78637 _noteCache.inflightPost = {};
78640 _userCache = obj.user;
78644 logout: function() {
78645 _userChangesets = void 0;
78646 _userDetails = void 0;
78648 dispatch9.call("change");
78651 authenticated: function() {
78652 return oauth.authenticated();
78654 authenticate: function(callback) {
78656 var cid = _connectionID;
78657 _userChangesets = void 0;
78658 _userDetails = void 0;
78659 function done(err, res) {
78661 if (callback) callback(err);
78664 if (that.getConnectionId() !== cid) {
78665 if (callback) callback({ message: "Connection Switched", status: -1 });
78668 _rateLimitError = void 0;
78669 dispatch9.call("change");
78670 if (callback) callback(err, res);
78671 that.userChangesets(function() {
78675 ...oauth.options(),
78676 locale: _mainLocalizer.localeCode()
78678 oauth.authenticate(done);
78680 imageryBlocklists: function() {
78681 return _imageryBlocklists;
78683 tileZoom: function(val) {
78684 if (!arguments.length) return _tileZoom3;
78688 // get all cached notes covering the viewport
78689 notes: function(projection2) {
78690 var viewport = projection2.clipExtent();
78691 var min3 = [viewport[0][0], viewport[1][1]];
78692 var max3 = [viewport[1][0], viewport[0][1]];
78693 var bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
78694 return _noteCache.rtree.search(bbox2).map(function(d2) {
78698 // get a single note from the cache
78699 getNote: function(id2) {
78700 return _noteCache.note[id2];
78702 // remove a single note from the cache
78703 removeNote: function(note) {
78704 if (!(note instanceof osmNote) || !note.id) return;
78705 delete _noteCache.note[note.id];
78706 updateRtree3(encodeNoteRtree(note), false);
78708 // replace a single note in the cache
78709 replaceNote: function(note) {
78710 if (!(note instanceof osmNote) || !note.id) return;
78711 _noteCache.note[note.id] = note;
78712 updateRtree3(encodeNoteRtree(note), true);
78715 // Get an array of note IDs closed during this session.
78716 // Used to populate `closed:note` changeset tag
78717 getClosedIDs: function() {
78718 return Object.keys(_noteCache.closed).sort();
78722 // modules/services/osm_wikibase.js
78723 var apibase3 = "https://wiki.openstreetmap.org/w/api.php";
78724 var _inflight2 = {};
78725 var _wikibaseCache = {};
78726 var _localeIDs = { en: false };
78727 var debouncedRequest = debounce_default(request, 500, { leading: false });
78728 function request(url, callback) {
78729 if (_inflight2[url]) return;
78730 var controller = new AbortController();
78731 _inflight2[url] = controller;
78732 json_default(url, { signal: controller.signal }).then(function(result) {
78733 delete _inflight2[url];
78734 if (callback) callback(null, result);
78735 }).catch(function(err) {
78736 delete _inflight2[url];
78737 if (err.name === "AbortError") return;
78738 if (callback) callback(err.message);
78741 var osm_wikibase_default = {
78744 _wikibaseCache = {};
78747 reset: function() {
78748 Object.values(_inflight2).forEach(function(controller) {
78749 controller.abort();
78754 * Get the best value for the property, or undefined if not found
78755 * @param entity object from wikibase
78756 * @param property string e.g. 'P4' for image
78757 * @param langCode string e.g. 'fr' for French
78759 claimToValue: function(entity, property, langCode) {
78760 if (!entity.claims[property]) return void 0;
78761 var locale2 = _localeIDs[langCode];
78762 var preferredPick, localePick;
78763 entity.claims[property].forEach(function(stmt) {
78764 if (!preferredPick && stmt.rank === "preferred") {
78765 preferredPick = stmt;
78767 if (locale2 && stmt.qualifiers && stmt.qualifiers.P26 && stmt.qualifiers.P26[0].datavalue.value.id === locale2) {
78771 var result = localePick || preferredPick;
78773 var datavalue = result.mainsnak.datavalue;
78774 return datavalue.type === "wikibase-entityid" ? datavalue.value.id : datavalue.value;
78780 * Convert monolingual property into a key-value object (language -> value)
78781 * @param entity object from wikibase
78782 * @param property string e.g. 'P31' for monolingual wiki page title
78784 monolingualClaimToValueObj: function(entity, property) {
78785 if (!entity || !entity.claims[property]) return void 0;
78786 return entity.claims[property].reduce(function(acc, obj) {
78787 var value = obj.mainsnak.datavalue.value;
78788 acc[value.language] = value.text;
78792 toSitelink: function(key, value) {
78793 var result = value ? "Tag:" + key + "=" + value : "Key:" + key;
78794 return result.replace(/_/g, " ").trim();
78797 // Pass params object of the form:
78800 // value: 'string',
78801 // langCode: 'string'
78804 getEntity: function(params, callback) {
78805 var doRequest = params.debounce ? debouncedRequest : request;
78809 var rtypeSitelink = params.key === "type" && params.value ? ("Relation:" + params.value).replace(/_/g, " ").trim() : false;
78810 var keySitelink = params.key ? this.toSitelink(params.key) : false;
78811 var tagSitelink = params.key && params.value ? this.toSitelink(params.key, params.value) : false;
78812 var localeSitelink;
78813 if (params.langCodes) {
78814 params.langCodes.forEach(function(langCode) {
78815 if (_localeIDs[langCode] === void 0) {
78816 localeSitelink = ("Locale:" + langCode).replace(/_/g, " ").trim();
78817 titles.push(localeSitelink);
78821 if (rtypeSitelink) {
78822 if (_wikibaseCache[rtypeSitelink]) {
78823 result.rtype = _wikibaseCache[rtypeSitelink];
78825 titles.push(rtypeSitelink);
78829 if (_wikibaseCache[keySitelink]) {
78830 result.key = _wikibaseCache[keySitelink];
78832 titles.push(keySitelink);
78836 if (_wikibaseCache[tagSitelink]) {
78837 result.tag = _wikibaseCache[tagSitelink];
78839 titles.push(tagSitelink);
78842 if (!titles.length) {
78843 return callback(null, result);
78846 action: "wbgetentities",
78848 titles: titles.join("|"),
78849 languages: params.langCodes.join("|"),
78850 languagefallback: 1,
78853 // There is an MW Wikibase API bug https://phabricator.wikimedia.org/T212069
78854 // We shouldn't use v1 until it gets fixed, but should switch to it afterwards
78855 // formatversion: 2,
78857 var url = apibase3 + "?" + utilQsString(obj);
78858 doRequest(url, function(err, d2) {
78861 } else if (!d2.success || d2.error) {
78862 callback(d2.error.messages.map(function(v2) {
78863 return v2.html["*"];
78866 var localeID = false;
78867 Object.values(d2.entities).forEach(function(res) {
78868 if (res.missing !== "") {
78869 var title = res.sitelinks.wiki.title;
78870 if (title === rtypeSitelink) {
78871 _wikibaseCache[rtypeSitelink] = res;
78872 result.rtype = res;
78873 } else if (title === keySitelink) {
78874 _wikibaseCache[keySitelink] = res;
78876 } else if (title === tagSitelink) {
78877 _wikibaseCache[tagSitelink] = res;
78879 } else if (title === localeSitelink) {
78882 console.log("Unexpected title " + title);
78886 if (localeSitelink) {
78887 that.addLocale(params.langCodes[0], localeID);
78889 callback(null, result);
78894 // Pass params object of the form:
78896 // key: 'string', // required
78897 // value: 'string' // optional
78900 // Get an result object used to display tag documentation
78902 // title: 'string',
78903 // description: 'string',
78904 // editURL: 'string',
78905 // imageURL: 'string',
78906 // wiki: { title: 'string', text: 'string', url: 'string' }
78909 getDocs: function(params, callback) {
78911 var langCodes = _mainLocalizer.localeCodes().map(function(code) {
78912 return code.toLowerCase();
78914 params.langCodes = langCodes;
78915 this.getEntity(params, function(err, data) {
78920 var entity = data.rtype || data.tag || data.key;
78922 callback("No entity");
78927 for (i3 in langCodes) {
78928 let code2 = langCodes[i3];
78929 if (entity.descriptions[code2] && entity.descriptions[code2].language === code2) {
78930 description = entity.descriptions[code2];
78934 if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
78936 title: entity.title,
78937 description: description ? description.value : "",
78938 descriptionLocaleCode: description ? description.language : "",
78939 editURL: "https://wiki.openstreetmap.org/wiki/" + entity.title
78941 if (entity.claims) {
78943 var image = that.claimToValue(entity, "P4", langCodes[0]);
78945 imageroot = "https://commons.wikimedia.org/w/index.php";
78947 image = that.claimToValue(entity, "P28", langCodes[0]);
78949 imageroot = "https://wiki.openstreetmap.org/w/index.php";
78952 if (imageroot && image) {
78953 result.imageURL = imageroot + "?" + utilQsString({
78954 title: "Special:Redirect/file/" + image,
78959 var rtypeWiki = that.monolingualClaimToValueObj(data.rtype, "P31");
78960 var tagWiki = that.monolingualClaimToValueObj(data.tag, "P31");
78961 var keyWiki = that.monolingualClaimToValueObj(data.key, "P31");
78962 var wikis = [rtypeWiki, tagWiki, keyWiki];
78963 for (i3 in wikis) {
78964 var wiki = wikis[i3];
78965 for (var j2 in langCodes) {
78966 var code = langCodes[j2];
78967 var referenceId = langCodes[0].split("-")[0] !== "en" && code.split("-")[0] === "en" ? "inspector.wiki_en_reference" : "inspector.wiki_reference";
78968 var info = getWikiInfo(wiki, code, referenceId);
78970 result.wiki = info;
78974 if (result.wiki) break;
78976 callback(null, result);
78977 function getWikiInfo(wiki2, langCode, tKey) {
78978 if (wiki2 && wiki2[langCode]) {
78980 title: wiki2[langCode],
78982 url: "https://wiki.openstreetmap.org/wiki/" + wiki2[langCode]
78988 addLocale: function(langCode, qid) {
78989 _localeIDs[langCode] = qid;
78991 apibase: function(val) {
78992 if (!arguments.length) return apibase3;
78998 // modules/services/streetside.js
78999 var streetsideApi = "https://dev.virtualearth.net/REST/v1/Imagery/MetaData/Streetside?mapArea={bbox}&key={key}&count={count}";
79000 var maxResults2 = 500;
79001 var bubbleAppKey = utilAesDecrypt("5c875730b09c6b422433e807e1ff060b6536c791dbfffcffc4c6b18a1bdba1f14593d151adb50e19e1be1ab19aef813bf135d0f103475e5c724dec94389e45d0");
79002 var pannellumViewerCSS2 = "pannellum/pannellum.css";
79003 var pannellumViewerJS2 = "pannellum/pannellum.js";
79004 var tileZoom3 = 16.5;
79005 var tiler6 = utilTiler().zoomExtent([tileZoom3, tileZoom3]).skipNullIsland(true);
79006 var dispatch10 = dispatch_default("loadedImages", "viewerChanged");
79009 var defaultHfov = 45;
79010 var _hires = false;
79011 var _resolution = 512;
79012 var _currScene = 0;
79014 var _pannellumViewer2;
79015 var _sceneOptions = {
79016 showFullscreenCtrl: false,
79026 var _loadViewerPromise4;
79027 function abortRequest5(i3) {
79030 function localeTimestamp2(s2) {
79031 if (!s2) return null;
79032 const options2 = { day: "numeric", month: "short", year: "numeric" };
79033 const d2 = new Date(s2);
79034 if (isNaN(d2.getTime())) return null;
79035 return d2.toLocaleString(_mainLocalizer.localeCode(), options2);
79037 function loadTiles3(which, url, projection2, margin) {
79038 const tiles = tiler6.margin(margin).getTiles(projection2);
79039 const cache = _ssCache[which];
79040 Object.keys(cache.inflight).forEach((k2) => {
79041 const wanted = tiles.find((tile) => k2.indexOf(tile.id + ",") === 0);
79043 abortRequest5(cache.inflight[k2]);
79044 delete cache.inflight[k2];
79047 tiles.forEach((tile) => loadNextTilePage2(which, url, tile));
79049 function loadNextTilePage2(which, url, tile) {
79050 const cache = _ssCache[which];
79051 const nextPage = cache.nextPage[tile.id] || 0;
79052 const id2 = tile.id + "," + String(nextPage);
79053 if (cache.loaded[id2] || cache.inflight[id2]) return;
79054 cache.inflight[id2] = getBubbles(url, tile, (response) => {
79055 cache.loaded[id2] = true;
79056 delete cache.inflight[id2];
79057 if (!response) return;
79058 if (response.resourceSets[0].resources.length === maxResults2) {
79059 const split = tile.extent.split();
79060 loadNextTilePage2(which, url, { id: tile.id + ",a", extent: split[0] });
79061 loadNextTilePage2(which, url, { id: tile.id + ",b", extent: split[1] });
79062 loadNextTilePage2(which, url, { id: tile.id + ",c", extent: split[2] });
79063 loadNextTilePage2(which, url, { id: tile.id + ",d", extent: split[3] });
79065 const features = response.resourceSets[0].resources.map((bubble) => {
79066 const bubbleId = bubble.imageUrl;
79067 if (cache.points[bubbleId]) return null;
79069 bubble.lon || bubble.longitude,
79070 bubble.lat || bubble.latitude
79075 imageUrl: bubble.imageUrl.replace(
79077 bubble.imageUrlSubdomains[0]
79079 ca: bubble.he || bubble.heading,
79080 captured_at: bubble.vintageEnd,
79081 captured_by: "microsoft",
79085 cache.points[bubbleId] = d2;
79093 }).filter(Boolean);
79094 cache.rtree.load(features);
79095 if (which === "bubbles") {
79096 dispatch10.call("loadedImages");
79100 function getBubbles(url, tile, callback) {
79101 let rect = tile.extent.rectangle();
79102 let urlForRequest = url.replace("{key}", bubbleAppKey).replace("{bbox}", [rect[1], rect[0], rect[3], rect[2]].join(",")).replace("{count}", maxResults2);
79103 const controller = new AbortController();
79104 fetch(urlForRequest, { signal: controller.signal }).then(function(response) {
79105 if (!response.ok) {
79106 throw new Error(response.status + " " + response.statusText);
79108 return response.json();
79109 }).then(function(result) {
79113 return callback(result || []);
79114 }).catch(function(err) {
79115 if (err.name === "AbortError") {
79117 throw new Error(err);
79122 function partitionViewport4(projection2) {
79123 let z2 = geoScaleToZoom(projection2.scale());
79124 let z22 = Math.ceil(z2 * 2) / 2 + 2.5;
79125 let tiler8 = utilTiler().zoomExtent([z22, z22]);
79126 return tiler8.getTiles(projection2).map((tile) => tile.extent);
79128 function searchLimited4(limit, projection2, rtree) {
79129 limit = limit || 5;
79130 return partitionViewport4(projection2).reduce((result, extent) => {
79131 let found = rtree.search(extent.bbox()).slice(0, limit).map((d2) => d2.data);
79132 return found.length ? result.concat(found) : result;
79135 function loadImage2(imgInfo) {
79136 return new Promise((resolve) => {
79137 let img = new Image();
79138 img.onload = () => {
79139 let canvas = document.getElementById("ideditor-canvas" + imgInfo.face);
79140 let ctx = canvas.getContext("2d");
79141 ctx.drawImage(img, imgInfo.x, imgInfo.y);
79142 resolve({ imgInfo, status: "ok" });
79144 img.onerror = () => {
79145 resolve({ data: imgInfo, status: "error" });
79147 img.setAttribute("crossorigin", "");
79148 img.src = imgInfo.url;
79151 function loadCanvas(imageGroup) {
79152 return Promise.all(imageGroup.map(loadImage2)).then((data) => {
79153 let canvas = document.getElementById("ideditor-canvas" + data[0].imgInfo.face);
79154 const which = { "01": 0, "02": 1, "03": 2, "10": 3, "11": 4, "12": 5 };
79155 let face = data[0].imgInfo.face;
79156 _sceneOptions.cubeMap[which[face]] = canvas.toDataURL("image/jpeg", 1);
79157 return { status: "loadCanvas for face " + data[0].imgInfo.face + "ok" };
79160 function loadFaces(faceGroup) {
79161 return Promise.all(faceGroup.map(loadCanvas)).then(() => {
79162 return { status: "loadFaces done" };
79165 function setupCanvas(selection2, reset) {
79167 selection2.selectAll("#ideditor-stitcher-canvases").remove();
79169 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);
79171 function qkToXY(qk) {
79175 for (let i3 = qk.length; i3 > 0; i3--) {
79176 const key = qk[i3 - 1];
79177 x2 += +(key === "1" || key === "3") * scale;
79178 y2 += +(key === "2" || key === "3") * scale;
79183 function getQuadKeys() {
79184 let dim = _resolution / 256;
79445 } else if (dim === 8) {
79512 } else if (dim === 4) {
79541 var streetside_default = {
79543 * init() initialize streetside.
79549 this.event = utilRebind(this, dispatch10, "on");
79552 * reset() reset the cache.
79554 reset: function() {
79556 Object.values(_ssCache.bubbles.inflight).forEach(abortRequest5);
79559 bubbles: { inflight: {}, loaded: {}, nextPage: {}, rtree: new RBush(), points: {} },
79566 bubbles: function(projection2) {
79568 return searchLimited4(limit, projection2, _ssCache.bubbles.rtree);
79570 cachedImage: function(imageKey) {
79571 return _ssCache.bubbles.points[imageKey];
79573 sequences: function(projection2) {
79574 const viewport = projection2.clipExtent();
79575 const min3 = [viewport[0][0], viewport[1][1]];
79576 const max3 = [viewport[1][0], viewport[0][1]];
79577 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
79580 _ssCache.bubbles.rtree.search(bbox2).forEach((d2) => {
79581 const key = d2.data.sequenceKey;
79582 if (key && !seen[key]) {
79584 results.push(_ssCache.sequences[key].geojson);
79592 loadBubbles: function(projection2, margin) {
79593 if (margin === void 0) margin = 2;
79594 loadTiles3("bubbles", streetsideApi, projection2, margin);
79596 viewer: function() {
79597 return _pannellumViewer2;
79599 initViewer: function() {
79600 if (!window.pannellum) return;
79601 if (_pannellumViewer2) return;
79603 const sceneID = _currScene.toString();
79605 "default": { firstScene: sceneID },
79608 options2.scenes[sceneID] = _sceneOptions;
79609 _pannellumViewer2 = window.pannellum.viewer("ideditor-viewer-streetside", options2);
79611 ensureViewerLoaded: function(context) {
79612 if (_loadViewerPromise4) return _loadViewerPromise4;
79613 let wrap2 = context.container().select(".photoviewer").selectAll(".ms-wrapper").data([0]);
79614 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper ms-wrapper").classed("hide", true);
79616 let pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
79617 wrapEnter.append("div").attr("id", "ideditor-viewer-streetside").on(pointerPrefix + "down.streetside", () => {
79618 select_default2(window).on(pointerPrefix + "move.streetside", () => {
79619 dispatch10.call("viewerChanged");
79621 }).on(pointerPrefix + "up.streetside pointercancel.streetside", () => {
79622 select_default2(window).on(pointerPrefix + "move.streetside", null);
79623 let t2 = timer((elapsed) => {
79624 dispatch10.call("viewerChanged");
79625 if (elapsed > 2e3) {
79629 }).append("div").attr("class", "photo-attribution fillD");
79630 let controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls");
79631 controlsEnter.append("button").on("click.back", step(-1)).text("\u25C4");
79632 controlsEnter.append("button").on("click.forward", step(1)).text("\u25BA");
79633 wrap2 = wrap2.merge(wrapEnter).call(setupCanvas, true);
79634 context.ui().photoviewer.on("resize.streetside", () => {
79635 if (_pannellumViewer2) {
79636 _pannellumViewer2.resize();
79639 _loadViewerPromise4 = new Promise((resolve, reject) => {
79640 let loadedCount = 0;
79641 function loaded() {
79643 if (loadedCount === 2) resolve();
79645 const head = select_default2("head");
79646 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() {
79649 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() {
79652 }).catch(function() {
79653 _loadViewerPromise4 = null;
79655 return _loadViewerPromise4;
79656 function step(stepBy) {
79658 let viewer = context.container().select(".photoviewer");
79659 let selected = viewer.empty() ? void 0 : viewer.datum();
79660 if (!selected) return;
79661 let nextID = stepBy === 1 ? selected.ne : selected.pr;
79662 let yaw = _pannellumViewer2.getYaw();
79663 let ca = selected.ca + yaw;
79664 let origin = selected.loc;
79667 origin[0] + geoMetersToLon(meters / 5, origin[1]),
79671 origin[0] + geoMetersToLon(meters / 2, origin[1]),
79672 origin[1] + geoMetersToLat(meters)
79675 origin[0] - geoMetersToLon(meters / 2, origin[1]),
79676 origin[1] + geoMetersToLat(meters)
79679 origin[0] - geoMetersToLon(meters / 5, origin[1]),
79682 let poly = [p1, p2, p3, p4, p1];
79683 let angle2 = (stepBy === 1 ? ca : ca + 180) * (Math.PI / 180);
79684 poly = geoRotate(poly, -angle2, origin);
79685 let extent = poly.reduce((extent2, point) => {
79686 return extent2.extend(geoExtent(point));
79688 let minDist = Infinity;
79689 _ssCache.bubbles.rtree.search(extent.bbox()).forEach((d2) => {
79690 if (d2.data.key === selected.key) return;
79691 if (!geoPointInPolygon(d2.data.loc, poly)) return;
79692 let dist = geoVecLength(d2.data.loc, selected.loc);
79693 let theta = selected.ca - d2.data.ca;
79694 let minTheta = Math.min(Math.abs(theta), 360 - Math.abs(theta));
79695 if (minTheta > 20) {
79698 if (dist < minDist) {
79699 nextID = d2.data.key;
79703 let nextBubble = nextID && that.cachedImage(nextID);
79704 if (!nextBubble) return;
79705 context.map().centerEase(nextBubble.loc);
79706 that.selectImage(context, nextBubble.key).yaw(yaw).showViewer(context);
79710 yaw: function(yaw) {
79711 if (typeof yaw !== "number") return yaw;
79712 _sceneOptions.yaw = yaw;
79718 showViewer: function(context) {
79719 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
79720 let isHidden = wrap2.selectAll(".photo-wrapper.ms-wrapper.hide").size();
79722 wrap2.selectAll(".photo-wrapper:not(.ms-wrapper)").classed("hide", true);
79723 wrap2.selectAll(".photo-wrapper.ms-wrapper").classed("hide", false);
79730 hideViewer: function(context) {
79731 let viewer = context.container().select(".photoviewer");
79732 if (!viewer.empty()) viewer.datum(null);
79733 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
79734 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
79735 this.updateUrlImage(null);
79736 return this.setStyles(context, null, true);
79741 selectImage: function(context, key) {
79743 let d2 = this.cachedImage(key);
79744 let viewer = context.container().select(".photoviewer");
79745 if (!viewer.empty()) viewer.datum(d2);
79746 this.setStyles(context, null, true);
79747 let wrap2 = context.container().select(".photoviewer .ms-wrapper");
79748 let attribution = wrap2.selectAll(".photo-attribution").html("");
79749 wrap2.selectAll(".pnlm-load-box").style("display", "block");
79750 if (!d2) return this;
79751 this.updateUrlImage(key);
79752 _sceneOptions.northOffset = d2.ca;
79753 let line1 = attribution.append("div").attr("class", "attribution-row");
79754 const hiresDomId = utilUniqueDomId("streetside-hires");
79755 let label = line1.append("label").attr("for", hiresDomId).attr("class", "streetside-hires");
79756 label.append("input").attr("type", "checkbox").attr("id", hiresDomId).property("checked", _hires).on("click", (d3_event) => {
79757 d3_event.stopPropagation();
79759 _resolution = _hires ? 1024 : 512;
79760 wrap2.call(setupCanvas, true);
79762 yaw: _pannellumViewer2.getYaw(),
79763 pitch: _pannellumViewer2.getPitch(),
79764 hfov: _pannellumViewer2.getHfov()
79766 _sceneOptions = Object.assign(_sceneOptions, viewstate);
79767 that.selectImage(context, d2.key).showViewer(context);
79769 label.append("span").call(_t.append("streetside.hires"));
79770 let captureInfo = line1.append("div").attr("class", "attribution-capture-info");
79771 if (d2.captured_by) {
79772 const yyyy = (/* @__PURE__ */ new Date()).getFullYear();
79773 captureInfo.append("a").attr("class", "captured_by").attr("target", "_blank").attr("href", "https://www.microsoft.com/en-us/maps/streetside").text("\xA9" + yyyy + " Microsoft");
79774 captureInfo.append("span").text("|");
79776 if (d2.captured_at) {
79777 captureInfo.append("span").attr("class", "captured_at").text(localeTimestamp2(d2.captured_at));
79779 let line2 = attribution.append("div").attr("class", "attribution-row");
79780 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"));
79781 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"));
79782 const faceKeys = ["01", "02", "03", "10", "11", "12"];
79783 let quadKeys = getQuadKeys();
79784 let faces = faceKeys.map((faceKey) => {
79785 return quadKeys.map((quadKey) => {
79786 const xy = qkToXY(quadKey);
79789 url: d2.imageUrl.replace("{faceId}", faceKey).replace("{tileId}", quadKey),
79795 loadFaces(faces).then(function() {
79796 if (!_pannellumViewer2) {
79800 let sceneID = _currScene.toString();
79801 _pannellumViewer2.addScene(sceneID, _sceneOptions).loadScene(sceneID);
79802 if (_currScene > 2) {
79803 sceneID = (_currScene - 1).toString();
79804 _pannellumViewer2.removeScene(sceneID);
79810 getSequenceKeyForBubble: function(d2) {
79811 return d2 && d2.sequenceKey;
79813 // Updates the currently highlighted sequence and selected bubble.
79814 // Reset is only necessary when interacting with the viewport because
79815 // this implicitly changes the currently selected bubble/sequence
79816 setStyles: function(context, hovered, reset) {
79818 context.container().selectAll(".viewfield-group").classed("highlighted", false).classed("hovered", false).classed("currentView", false);
79819 context.container().selectAll(".sequence").classed("highlighted", false).classed("currentView", false);
79821 let hoveredBubbleKey = hovered && hovered.key;
79822 let hoveredSequenceKey = this.getSequenceKeyForBubble(hovered);
79823 let hoveredSequence = hoveredSequenceKey && _ssCache.sequences[hoveredSequenceKey];
79824 let hoveredBubbleKeys = hoveredSequence && hoveredSequence.bubbles.map((d2) => d2.key) || [];
79825 let viewer = context.container().select(".photoviewer");
79826 let selected = viewer.empty() ? void 0 : viewer.datum();
79827 let selectedBubbleKey = selected && selected.key;
79828 let selectedSequenceKey = this.getSequenceKeyForBubble(selected);
79829 let selectedSequence = selectedSequenceKey && _ssCache.sequences[selectedSequenceKey];
79830 let selectedBubbleKeys = selectedSequence && selectedSequence.bubbles.map((d2) => d2.key) || [];
79831 let highlightedBubbleKeys = utilArrayUnion(hoveredBubbleKeys, selectedBubbleKeys);
79832 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);
79833 context.container().selectAll(".layer-streetside-images .sequence").classed("highlighted", (d2) => d2.properties.key === hoveredSequenceKey).classed("currentView", (d2) => d2.properties.key === selectedSequenceKey);
79834 context.container().selectAll(".layer-streetside-images .viewfield-group .viewfield").attr("d", viewfieldPath);
79835 function viewfieldPath() {
79836 let d2 = this.parentNode.__data__;
79837 if (d2.pano && d2.key !== selectedBubbleKey) {
79838 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
79840 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
79845 updateUrlImage: function(imageKey) {
79846 if (!window.mocha) {
79847 var hash = utilStringQs(window.location.hash);
79849 hash.photo = "streetside/" + imageKey;
79853 window.location.replace("#" + utilQsString(hash, true));
79859 cache: function() {
79864 // modules/services/taginfo.js
79865 var apibase4 = taginfoApiUrl;
79866 var _inflight3 = {};
79867 var _popularKeys = {};
79868 var _taginfoCache = {};
79870 point: "count_nodes",
79871 vertex: "count_nodes",
79872 area: "count_ways",
79875 var tag_sort_members = {
79876 point: "count_node_members",
79877 vertex: "count_node_members",
79878 area: "count_way_members",
79879 line: "count_way_members",
79880 relation: "count_relation_members"
79882 var tag_filters = {
79888 var tag_members_fractions = {
79889 point: "count_node_members_fraction",
79890 vertex: "count_node_members_fraction",
79891 area: "count_way_members_fraction",
79892 line: "count_way_members_fraction",
79893 relation: "count_relation_members_fraction"
79895 function sets(params, n3, o2) {
79896 if (params.geometry && o2[params.geometry]) {
79897 params[n3] = o2[params.geometry];
79901 function setFilter(params) {
79902 return sets(params, "filter", tag_filters);
79904 function setSort(params) {
79905 return sets(params, "sortname", tag_sorts);
79907 function setSortMembers(params) {
79908 return sets(params, "sortname", tag_sort_members);
79910 function clean(params) {
79911 return utilObjectOmit(params, ["geometry", "debounce"]);
79913 function filterKeys(type2) {
79914 var count_type = type2 ? "count_" + type2 : "count_all";
79915 return function(d2) {
79916 return Number(d2[count_type]) > 2500 || d2.in_wiki;
79919 function filterMultikeys(prefix) {
79920 return function(d2) {
79921 var re3 = new RegExp("^" + prefix + "(.*)$", "i");
79922 var matches = d2.key.match(re3) || [];
79923 return matches.length === 2 && matches[1].indexOf(":") === -1;
79926 function filterValues(allowUpperCase) {
79927 return function(d2) {
79928 if (d2.value.match(/[;,]/) !== null) return false;
79929 if (!allowUpperCase && d2.value.match(/[A-Z*]/) !== null) return false;
79930 return d2.count > 100 || d2.in_wiki;
79933 function filterRoles(geometry) {
79934 return function(d2) {
79935 if (d2.role === "") return false;
79936 if (d2.role.match(/[A-Z*;,]/) !== null) return false;
79937 return Number(d2[tag_members_fractions[geometry]]) > 0;
79940 function valKey(d2) {
79946 function valKeyDescription(d2) {
79949 title: d2.description || d2.value
79953 function roleKey(d2) {
79959 function sortKeys(a2, b2) {
79960 return a2.key.indexOf(":") === -1 && b2.key.indexOf(":") !== -1 ? -1 : a2.key.indexOf(":") !== -1 && b2.key.indexOf(":") === -1 ? 1 : 0;
79962 var debouncedRequest2 = debounce_default(request2, 300, { leading: false });
79963 function request2(url, params, exactMatch, callback, loaded) {
79964 if (_inflight3[url]) return;
79965 if (checkCache(url, params, exactMatch, callback)) return;
79966 var controller = new AbortController();
79967 _inflight3[url] = controller;
79968 json_default(url, { signal: controller.signal }).then(function(result) {
79969 delete _inflight3[url];
79970 if (loaded) loaded(null, result);
79971 }).catch(function(err) {
79972 delete _inflight3[url];
79973 if (err.name === "AbortError") return;
79974 if (loaded) loaded(err.message);
79977 function checkCache(url, params, exactMatch, callback) {
79978 var rp = params.rp || 25;
79979 var testQuery = params.query || "";
79982 var hit = _taginfoCache[testUrl];
79983 if (hit && (url === testUrl || hit.length < rp)) {
79984 callback(null, hit);
79987 if (exactMatch || !testQuery.length) return false;
79988 testQuery = testQuery.slice(0, -1);
79989 testUrl = url.replace(/&query=(.*?)&/, "&query=" + testQuery + "&");
79990 } while (testQuery.length >= 0);
79993 var taginfo_default = {
79996 _taginfoCache = {};
79998 // manually exclude some keys – #5377, #7485
80004 sorting_name: true,
80009 "bridge:name": true
80013 sortname: "values_all",
80017 lang: _mainLocalizer.languageCode()
80019 this.keys(params, function(err, data) {
80021 data.forEach(function(d2) {
80022 if (d2.value === "opening_hours") return;
80023 _popularKeys[d2.value] = true;
80027 reset: function() {
80028 Object.values(_inflight3).forEach(function(controller) {
80029 controller.abort();
80033 keys: function(params, callback) {
80034 var doRequest = params.debounce ? debouncedRequest2 : request2;
80035 params = clean(setSort(params));
80036 params = Object.assign({
80038 sortname: "count_all",
80041 lang: _mainLocalizer.languageCode()
80043 var url = apibase4 + "keys/all?" + utilQsString(params);
80044 doRequest(url, params, false, callback, function(err, d2) {
80048 var f2 = filterKeys(params.filter);
80049 var result = d2.data.filter(f2).sort(sortKeys).map(valKey);
80050 _taginfoCache[url] = result;
80051 callback(null, result);
80055 multikeys: function(params, callback) {
80056 var doRequest = params.debounce ? debouncedRequest2 : request2;
80057 params = clean(setSort(params));
80058 params = Object.assign({
80060 sortname: "count_all",
80063 lang: _mainLocalizer.languageCode()
80065 var prefix = params.query;
80066 var url = apibase4 + "keys/all?" + utilQsString(params);
80067 doRequest(url, params, true, callback, function(err, d2) {
80071 var f2 = filterMultikeys(prefix);
80072 var result = d2.data.filter(f2).map(valKey);
80073 _taginfoCache[url] = result;
80074 callback(null, result);
80078 values: function(params, callback) {
80079 var key = params.key;
80080 if (key && _popularKeys[key]) {
80081 callback(null, []);
80084 var doRequest = params.debounce ? debouncedRequest2 : request2;
80085 params = clean(setSort(setFilter(params)));
80086 params = Object.assign({
80088 sortname: "count_all",
80091 lang: _mainLocalizer.languageCode()
80093 var url = apibase4 + "key/values?" + utilQsString(params);
80094 doRequest(url, params, false, callback, function(err, d2) {
80098 var allowUpperCase = allowUpperCaseTagValues.test(params.key);
80099 var f2 = filterValues(allowUpperCase);
80100 var result = d2.data.filter(f2).map(valKeyDescription);
80101 _taginfoCache[url] = result;
80102 callback(null, result);
80106 roles: function(params, callback) {
80107 var doRequest = params.debounce ? debouncedRequest2 : request2;
80108 var geometry = params.geometry;
80109 params = clean(setSortMembers(params));
80110 params = Object.assign({
80112 sortname: "count_all_members",
80115 lang: _mainLocalizer.languageCode()
80117 var url = apibase4 + "relation/roles?" + utilQsString(params);
80118 doRequest(url, params, true, callback, function(err, d2) {
80122 var f2 = filterRoles(geometry);
80123 var result = d2.data.filter(f2).map(roleKey);
80124 _taginfoCache[url] = result;
80125 callback(null, result);
80129 docs: function(params, callback) {
80130 var doRequest = params.debounce ? debouncedRequest2 : request2;
80131 params = clean(setSort(params));
80132 var path = "key/wiki_pages?";
80133 if (params.value) {
80134 path = "tag/wiki_pages?";
80135 } else if (params.rtype) {
80136 path = "relation/wiki_pages?";
80138 var url = apibase4 + path + utilQsString(params);
80139 doRequest(url, params, true, callback, function(err, d2) {
80143 _taginfoCache[url] = d2.data;
80144 callback(null, d2.data);
80148 apibase: function(_2) {
80149 if (!arguments.length) return apibase4;
80155 // modules/services/vector_tile.js
80156 var import_fast_deep_equal11 = __toESM(require_fast_deep_equal());
80157 var import_fast_json_stable_stringify2 = __toESM(require_fast_json_stable_stringify());
80158 var import_polygon_clipping = __toESM(require_polygon_clipping_umd());
80159 var tiler7 = utilTiler().tileSize(512).margin(1);
80160 var dispatch11 = dispatch_default("loadedData");
80162 function abortRequest6(controller) {
80163 controller.abort();
80165 function vtToGeoJSON(data, tile, mergeCache) {
80166 var vectorTile = new VectorTile(new Pbf(data));
80167 var layers = Object.keys(vectorTile.layers);
80168 if (!Array.isArray(layers)) {
80172 layers.forEach(function(layerID) {
80173 var layer = vectorTile.layers[layerID];
80175 for (var i3 = 0; i3 < layer.length; i3++) {
80176 var feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80177 var geometry = feature3.geometry;
80178 if (geometry.type === "Polygon") {
80179 geometry.type = "MultiPolygon";
80180 geometry.coordinates = [geometry.coordinates];
80182 var isClipped = false;
80183 if (geometry.type === "MultiPolygon") {
80184 var featureClip = turf_bbox_clip_default(feature3, tile.extent.rectangle());
80185 if (!(0, import_fast_deep_equal11.default)(feature3.geometry, featureClip.geometry)) {
80188 if (!feature3.geometry.coordinates.length) continue;
80189 if (!feature3.geometry.coordinates[0].length) continue;
80191 var featurehash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3));
80192 var propertyhash = utilHashcode((0, import_fast_json_stable_stringify2.default)(feature3.properties || {}));
80193 feature3.__layerID__ = layerID.replace(/[^_a-zA-Z0-9\-]/g, "_");
80194 feature3.__featurehash__ = featurehash;
80195 feature3.__propertyhash__ = propertyhash;
80196 features.push(feature3);
80197 if (isClipped && geometry.type === "MultiPolygon") {
80198 var merged = mergeCache[propertyhash];
80199 if (merged && merged.length) {
80200 var other = merged[0];
80201 var coords = import_polygon_clipping.default.union(
80202 feature3.geometry.coordinates,
80203 other.geometry.coordinates
80205 if (!coords || !coords.length) {
80208 merged.push(feature3);
80209 for (var j2 = 0; j2 < merged.length; j2++) {
80210 merged[j2].geometry.coordinates = coords;
80211 merged[j2].__featurehash__ = featurehash;
80214 mergeCache[propertyhash] = [feature3];
80222 function loadTile3(source, tile) {
80223 if (source.loaded[tile.id] || source.inflight[tile.id]) return;
80224 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) {
80225 var subdomains = r2.split(",");
80226 return subdomains[(tile.xyz[0] + tile.xyz[1]) % subdomains.length];
80228 var controller = new AbortController();
80229 source.inflight[tile.id] = controller;
80230 fetch(url, { signal: controller.signal }).then(function(response) {
80231 if (!response.ok) {
80232 throw new Error(response.status + " " + response.statusText);
80234 source.loaded[tile.id] = [];
80235 delete source.inflight[tile.id];
80236 return response.arrayBuffer();
80237 }).then(function(data) {
80239 throw new Error("No Data");
80241 var z2 = tile.xyz[2];
80242 if (!source.canMerge[z2]) {
80243 source.canMerge[z2] = {};
80245 source.loaded[tile.id] = vtToGeoJSON(data, tile, source.canMerge[z2]);
80246 dispatch11.call("loadedData");
80247 }).catch(function() {
80248 source.loaded[tile.id] = [];
80249 delete source.inflight[tile.id];
80252 var vector_tile_default = {
80257 this.event = utilRebind(this, dispatch11, "on");
80259 reset: function() {
80260 for (var sourceID in _vtCache) {
80261 var source = _vtCache[sourceID];
80262 if (source && source.inflight) {
80263 Object.values(source.inflight).forEach(abortRequest6);
80268 addSource: function(sourceID, template) {
80269 _vtCache[sourceID] = { template, inflight: {}, loaded: {}, canMerge: {} };
80270 return _vtCache[sourceID];
80272 data: function(sourceID, projection2) {
80273 var source = _vtCache[sourceID];
80274 if (!source) return [];
80275 var tiles = tiler7.getTiles(projection2);
80278 for (var i3 = 0; i3 < tiles.length; i3++) {
80279 var features = source.loaded[tiles[i3].id];
80280 if (!features || !features.length) continue;
80281 for (var j2 = 0; j2 < features.length; j2++) {
80282 var feature3 = features[j2];
80283 var hash = feature3.__featurehash__;
80284 if (seen[hash]) continue;
80286 results.push(Object.assign({}, feature3));
80291 loadTiles: function(sourceID, template, projection2) {
80292 var source = _vtCache[sourceID];
80294 source = this.addSource(sourceID, template);
80296 var tiles = tiler7.getTiles(projection2);
80297 Object.keys(source.inflight).forEach(function(k2) {
80298 var wanted = tiles.find(function(tile) {
80299 return k2 === tile.id;
80302 abortRequest6(source.inflight[k2]);
80303 delete source.inflight[k2];
80306 tiles.forEach(function(tile) {
80307 loadTile3(source, tile);
80310 cache: function() {
80315 // modules/services/wikidata.js
80316 var apibase5 = "https://www.wikidata.org/w/api.php?";
80317 var _wikidataCache = {};
80318 var wikidata_default = {
80321 reset: function() {
80322 _wikidataCache = {};
80324 // Search for Wikidata items matching the query
80325 itemsForSearchQuery: function(query, callback, language) {
80327 if (callback) callback("No query", {});
80330 var lang = this.languagesToQuery()[0];
80331 var url = apibase5 + utilQsString({
80332 action: "wbsearchentities",
80337 // the language to search
80338 language: language || lang,
80339 // the language for the label and description in the result
80344 json_default(url).then((result) => {
80345 if (result && result.error) {
80346 if (result.error.code === "badvalue" && result.error.info.includes(lang) && !language && lang.includes("-")) {
80347 this.itemsForSearchQuery(query, callback, lang.split("-")[0]);
80350 throw new Error(result.error);
80353 if (callback) callback(null, result.search || {});
80354 }).catch(function(err) {
80355 if (callback) callback(err.message, {});
80358 // Given a Wikipedia language and article title,
80359 // return an array of corresponding Wikidata entities.
80360 itemsByTitle: function(lang, title, callback) {
80362 if (callback) callback("No title", {});
80365 lang = lang || "en";
80366 var url = apibase5 + utilQsString({
80367 action: "wbgetentities",
80370 sites: lang.replace(/-/g, "_") + "wiki",
80373 // shrink response by filtering to one language
80376 json_default(url).then(function(result) {
80377 if (result && result.error) {
80378 throw new Error(result.error);
80380 if (callback) callback(null, result.entities || {});
80381 }).catch(function(err) {
80382 if (callback) callback(err.message, {});
80385 languagesToQuery: function() {
80386 return _mainLocalizer.localeCodes().map(function(code) {
80387 return code.toLowerCase();
80388 }).filter(function(code) {
80389 return code !== "en-us";
80392 entityByQID: function(qid, callback) {
80394 callback("No qid", {});
80397 if (_wikidataCache[qid]) {
80398 if (callback) callback(null, _wikidataCache[qid]);
80401 var langs = this.languagesToQuery();
80402 var url = apibase5 + utilQsString({
80403 action: "wbgetentities",
80407 props: "labels|descriptions|claims|sitelinks",
80408 sitefilter: langs.map(function(d2) {
80409 return d2 + "wiki";
80411 languages: langs.join("|"),
80412 languagefallback: 1,
80415 json_default(url).then(function(result) {
80416 if (result && result.error) {
80417 throw new Error(result.error);
80419 if (callback) callback(null, result.entities[qid] || {});
80420 }).catch(function(err) {
80421 if (callback) callback(err.message, {});
80424 // Pass `params` object of the form:
80426 // qid: 'string' // brand wikidata (e.g. 'Q37158')
80429 // Get an result object used to display tag documentation
80431 // title: 'string',
80432 // description: 'string',
80433 // editURL: 'string',
80434 // imageURL: 'string',
80435 // wiki: { title: 'string', text: 'string', url: 'string' }
80438 getDocs: function(params, callback) {
80439 var langs = this.languagesToQuery();
80440 this.entityByQID(params.qid, function(err, entity) {
80441 if (err || !entity) {
80442 callback(err || "No entity");
80447 for (i3 in langs) {
80448 let code = langs[i3];
80449 if (entity.descriptions[code] && entity.descriptions[code].language === code) {
80450 description = entity.descriptions[code];
80454 if (!description && Object.values(entity.descriptions).length) description = Object.values(entity.descriptions)[0];
80457 description: description ? description.value : "",
80458 descriptionLocaleCode: description ? description.language : "",
80459 editURL: "https://www.wikidata.org/wiki/" + entity.id
80461 if (entity.claims) {
80462 var imageroot = "https://commons.wikimedia.org/w/index.php";
80463 var props = ["P154", "P18"];
80465 for (i3 = 0; i3 < props.length; i3++) {
80466 prop = entity.claims[props[i3]];
80467 if (prop && Object.keys(prop).length > 0) {
80468 image = prop[Object.keys(prop)[0]].mainsnak.datavalue.value;
80470 result.imageURL = imageroot + "?" + utilQsString({
80471 title: "Special:Redirect/file/" + image,
80479 if (entity.sitelinks) {
80480 var englishLocale = _mainLocalizer.languageCode().toLowerCase() === "en";
80481 for (i3 = 0; i3 < langs.length; i3++) {
80482 var w2 = langs[i3] + "wiki";
80483 if (entity.sitelinks[w2]) {
80484 var title = entity.sitelinks[w2].title;
80485 var tKey = "inspector.wiki_reference";
80486 if (!englishLocale && langs[i3] === "en") {
80487 tKey = "inspector.wiki_en_reference";
80492 url: "https://" + langs[i3] + ".wikipedia.org/wiki/" + title.replace(/ /g, "_")
80498 callback(null, result);
80503 // modules/services/wikipedia.js
80504 var endpoint = "https://en.wikipedia.org/w/api.php?";
80505 var wikipedia_default = {
80508 reset: function() {
80510 search: function(lang, query, callback) {
80512 if (callback) callback("No Query", []);
80515 lang = lang || "en";
80516 var url = endpoint.replace("en", lang) + utilQsString({
80520 srinfo: "suggestion",
80525 json_default(url).then(function(result) {
80526 if (result && result.error) {
80527 throw new Error(result.error);
80528 } else if (!result || !result.query || !result.query.search) {
80529 throw new Error("No Results");
80532 var titles = result.query.search.map(function(d2) {
80535 callback(null, titles);
80537 }).catch(function(err) {
80538 if (callback) callback(err, []);
80541 suggestions: function(lang, query, callback) {
80543 if (callback) callback("", []);
80546 lang = lang || "en";
80547 var url = endpoint.replace("en", lang) + utilQsString({
80548 action: "opensearch",
80555 json_default(url).then(function(result) {
80556 if (result && result.error) {
80557 throw new Error(result.error);
80558 } else if (!result || result.length < 2) {
80559 throw new Error("No Results");
80561 if (callback) callback(null, result[1] || []);
80562 }).catch(function(err) {
80563 if (callback) callback(err.message, []);
80566 translations: function(lang, title, callback) {
80568 if (callback) callback("No Title");
80571 var url = endpoint.replace("en", lang) + utilQsString({
80579 json_default(url).then(function(result) {
80580 if (result && result.error) {
80581 throw new Error(result.error);
80582 } else if (!result || !result.query || !result.query.pages) {
80583 throw new Error("No Results");
80586 var list2 = result.query.pages[Object.keys(result.query.pages)[0]];
80587 var translations = {};
80588 if (list2 && list2.langlinks) {
80589 list2.langlinks.forEach(function(d2) {
80590 translations[d2.lang] = d2["*"];
80593 callback(null, translations);
80595 }).catch(function(err) {
80596 if (callback) callback(err.message);
80601 // modules/services/mapilio.js
80602 var apiUrl2 = "https://end.mapilio.com";
80603 var imageBaseUrl = "https://cdn.mapilio.com/im";
80604 var baseTileUrl2 = "https://geo.mapilio.com/geoserver/gwc/service/wmts?REQUEST=GetTile&SERVICE=WMTS&VERSION=1.0.0&LAYER=mapilio:";
80605 var pointLayer = "map_points";
80606 var lineLayer = "map_roads_line";
80607 var tileStyle = "&STYLE=&TILEMATRIX=EPSG:900913:{z}&TILEMATRIXSET=EPSG:900913&FORMAT=application/vnd.mapbox-vector-tile&TILECOL={x}&TILEROW={y}";
80609 var dispatch12 = dispatch_default("loadedImages", "loadedLines");
80610 var imgZoom3 = zoom_default2().extent([[0, 0], [320, 240]]).translateExtent([[0, 0], [320, 240]]).scaleExtent([1, 15]);
80611 var pannellumViewerCSS3 = "pannellum/pannellum.css";
80612 var pannellumViewerJS3 = "pannellum/pannellum.js";
80613 var resolution = 1080;
80616 var _loadViewerPromise5;
80617 var _pannellumViewer3;
80618 var _sceneOptions2 = {
80619 showFullscreenCtrl: false,
80626 var _currScene2 = 0;
80627 function partitionViewport5(projection2) {
80628 const z2 = geoScaleToZoom(projection2.scale());
80629 const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
80630 const tiler8 = utilTiler().zoomExtent([z22, z22]);
80631 return tiler8.getTiles(projection2).map(function(tile) {
80632 return tile.extent;
80635 function searchLimited5(limit, projection2, rtree) {
80636 limit = limit || 5;
80637 return partitionViewport5(projection2).reduce(function(result, extent) {
80638 const found = rtree.search(extent.bbox()).slice(0, limit).map(function(d2) {
80641 return found.length ? result.concat(found) : result;
80644 function loadTiles4(which, url, maxZoom2, projection2) {
80645 const tiler8 = utilTiler().zoomExtent([minZoom3, maxZoom2]).skipNullIsland(true);
80646 const tiles = tiler8.getTiles(projection2);
80647 tiles.forEach(function(tile) {
80648 loadTile4(which, url, tile);
80651 function loadTile4(which, url, tile) {
80652 const cache = _cache3.requests;
80653 const tileId = "".concat(tile.id, "-").concat(which);
80654 if (cache.loaded[tileId] || cache.inflight[tileId]) return;
80655 const controller = new AbortController();
80656 cache.inflight[tileId] = controller;
80657 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
80658 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
80659 if (!response.ok) {
80660 throw new Error(response.status + " " + response.statusText);
80662 cache.loaded[tileId] = true;
80663 delete cache.inflight[tileId];
80664 return response.arrayBuffer();
80665 }).then(function(data) {
80666 if (data.byteLength === 0) {
80667 throw new Error("No Data");
80669 loadTileDataToCache2(data, tile, which);
80670 if (which === "images") {
80671 dispatch12.call("loadedImages");
80673 dispatch12.call("loadedLines");
80675 }).catch(function(e3) {
80676 if (e3.message === "No Data") {
80677 cache.loaded[tileId] = true;
80683 function loadTileDataToCache2(data, tile) {
80684 const vectorTile = new VectorTile(new Pbf(data));
80685 let features, cache, layer, i3, feature3, loc, d2;
80686 if (vectorTile.layers.hasOwnProperty(pointLayer)) {
80688 cache = _cache3.images;
80689 layer = vectorTile.layers[pointLayer];
80690 for (i3 = 0; i3 < layer.length; i3++) {
80691 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80692 loc = feature3.geometry.coordinates;
80693 let resolutionArr = feature3.properties.resolution.split("x");
80694 let sourceWidth = Math.max(resolutionArr[0], resolutionArr[1]);
80695 let sourceHeight = Math.min(resolutionArr[0], resolutionArr[1]);
80696 let isPano = sourceWidth % sourceHeight === 0;
80699 capture_time: feature3.properties.capture_time,
80700 id: feature3.properties.id,
80701 sequence_id: feature3.properties.sequence_uuid,
80702 heading: feature3.properties.heading,
80703 resolution: feature3.properties.resolution,
80706 cache.forImageId[d2.id] = d2;
80716 cache.rtree.load(features);
80719 if (vectorTile.layers.hasOwnProperty(lineLayer)) {
80720 cache = _cache3.sequences;
80721 layer = vectorTile.layers[lineLayer];
80722 for (i3 = 0; i3 < layer.length; i3++) {
80723 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
80724 if (cache.lineString[feature3.properties.sequence_uuid]) {
80725 cache.lineString[feature3.properties.sequence_uuid].push(feature3);
80727 cache.lineString[feature3.properties.sequence_uuid] = [feature3];
80732 function getImageData(imageId, sequenceId) {
80733 return fetch(apiUrl2 + "/api/sequence-detail?sequence_uuid=".concat(sequenceId), { method: "GET" }).then(function(response) {
80734 if (!response.ok) {
80735 throw new Error(response.status + " " + response.statusText);
80737 return response.json();
80738 }).then(function(data) {
80739 let index = data.data.findIndex((feature3) => feature3.id === imageId);
80740 const { filename, uploaded_hash } = data.data[index];
80741 _sceneOptions2.panorama = imageBaseUrl + "/" + uploaded_hash + "/" + filename + "/" + resolution;
80744 var mapilio_default = {
80745 // Initialize Mapilio
80750 this.event = utilRebind(this, dispatch12, "on");
80752 // Reset cache and state
80753 reset: function() {
80755 Object.values(_cache3.requests.inflight).forEach(function(request3) {
80760 images: { rtree: new RBush(), forImageId: {} },
80761 sequences: { rtree: new RBush(), lineString: {} },
80762 requests: { loaded: {}, inflight: {} }
80764 _activeImage = null;
80766 // Get visible images
80767 images: function(projection2) {
80769 return searchLimited5(limit, projection2, _cache3.images.rtree);
80771 cachedImage: function(imageKey) {
80772 return _cache3.images.forImageId[imageKey];
80774 // Load images in the visible area
80775 loadImages: function(projection2) {
80776 let url = baseTileUrl2 + pointLayer + tileStyle;
80777 loadTiles4("images", url, 14, projection2);
80779 // Load line in the visible area
80780 loadLines: function(projection2) {
80781 let url = baseTileUrl2 + lineLayer + tileStyle;
80782 loadTiles4("line", url, 14, projection2);
80784 // Get visible sequences
80785 sequences: function(projection2) {
80786 const viewport = projection2.clipExtent();
80787 const min3 = [viewport[0][0], viewport[1][1]];
80788 const max3 = [viewport[1][0], viewport[0][1]];
80789 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
80790 const sequenceIds = {};
80791 let lineStrings = [];
80792 _cache3.images.rtree.search(bbox2).forEach(function(d2) {
80793 if (d2.data.sequence_id) {
80794 sequenceIds[d2.data.sequence_id] = true;
80797 Object.keys(sequenceIds).forEach(function(sequenceId) {
80798 if (_cache3.sequences.lineString[sequenceId]) {
80799 lineStrings = lineStrings.concat(_cache3.sequences.lineString[sequenceId]);
80802 return lineStrings;
80804 // Set the currently visible image
80805 setActiveImage: function(image) {
80809 sequence_id: image.sequence_id
80812 _activeImage = null;
80815 // Update the currently highlighted sequence and selected bubble.
80816 setStyles: function(context, hovered) {
80817 const hoveredImageId = hovered && hovered.id;
80818 const hoveredSequenceId = hovered && hovered.sequence_id;
80819 const selectedSequenceId = _activeImage && _activeImage.sequence_id;
80820 const selectedImageId = _activeImage && _activeImage.id;
80821 const markers = context.container().selectAll(".layer-mapilio .viewfield-group");
80822 const sequences = context.container().selectAll(".layer-mapilio .sequence");
80823 markers.classed("highlighted", function(d2) {
80824 return d2.id === hoveredImageId;
80825 }).classed("hovered", function(d2) {
80826 return d2.id === hoveredImageId;
80827 }).classed("currentView", function(d2) {
80828 return d2.id === selectedImageId;
80830 sequences.classed("highlighted", function(d2) {
80831 return d2.properties.sequence_uuid === hoveredSequenceId;
80832 }).classed("currentView", function(d2) {
80833 return d2.properties.sequence_uuid === selectedSequenceId;
80837 updateUrlImage: function(imageKey) {
80838 if (!window.mocha) {
80839 var hash = utilStringQs(window.location.hash);
80841 hash.photo = "mapilio/" + imageKey;
80845 window.location.replace("#" + utilQsString(hash, true));
80848 initViewer: function() {
80849 if (!window.pannellum) return;
80850 if (_pannellumViewer3) return;
80852 const sceneID = _currScene2.toString();
80854 "default": { firstScene: sceneID },
80857 options2.scenes[sceneID] = _sceneOptions2;
80858 _pannellumViewer3 = window.pannellum.viewer("ideditor-viewer-mapilio-pnlm", options2);
80860 selectImage: function(context, id2) {
80862 let d2 = this.cachedImage(id2);
80863 this.setActiveImage(d2);
80864 this.updateUrlImage(d2.id);
80865 let viewer = context.container().select(".photoviewer");
80866 if (!viewer.empty()) viewer.datum(d2);
80867 this.setStyles(context, null);
80868 if (!d2) return this;
80869 let wrap2 = context.container().select(".photoviewer .mapilio-wrapper");
80870 let attribution = wrap2.selectAll(".photo-attribution").text("");
80871 if (d2.capture_time) {
80872 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
80873 attribution.append("span").text("|");
80875 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");
80876 wrap2.transition().duration(100).call(imgZoom3.transform, identity2);
80877 wrap2.selectAll("img").remove();
80878 wrap2.selectAll("button.back").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 - 1));
80879 wrap2.selectAll("button.forward").classed("hide", !_cache3.images.forImageId.hasOwnProperty(+id2 + 1));
80880 getImageData(d2.id, d2.sequence_id).then(function() {
80882 if (!_pannellumViewer3) {
80886 let sceneID = _currScene2.toString();
80887 _pannellumViewer3.addScene(sceneID, _sceneOptions2).loadScene(sceneID);
80888 if (_currScene2 > 2) {
80889 sceneID = (_currScene2 - 1).toString();
80890 _pannellumViewer3.removeScene(sceneID);
80894 that.initOnlyPhoto(context);
80897 function localeDateString2(s2) {
80898 if (!s2) return null;
80899 var options2 = { day: "numeric", month: "short", year: "numeric" };
80900 var d4 = new Date(s2);
80901 if (isNaN(d4.getTime())) return null;
80902 return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
80906 initOnlyPhoto: function(context) {
80907 if (_pannellumViewer3) {
80908 _pannellumViewer3.destroy();
80909 _pannellumViewer3 = null;
80911 let wrap2 = context.container().select("#ideditor-viewer-mapilio-simple");
80912 let imgWrap = wrap2.select("img");
80913 if (!imgWrap.empty()) {
80914 imgWrap.attr("src", _sceneOptions2.panorama);
80916 wrap2.append("img").attr("src", _sceneOptions2.panorama);
80919 ensureViewerLoaded: function(context) {
80921 let imgWrap = context.container().select("#ideditor-viewer-mapilio-simple > img");
80922 if (!imgWrap.empty()) {
80925 if (_loadViewerPromise5) return _loadViewerPromise5;
80926 let wrap2 = context.container().select(".photoviewer").selectAll(".mapilio-wrapper").data([0]);
80927 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper mapilio-wrapper").classed("hide", true).on("dblclick.zoom", null);
80928 wrapEnter.append("div").attr("class", "photo-attribution fillD");
80929 const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-mapilio");
80930 controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
80931 controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
80932 wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-pnlm");
80933 wrapEnter.append("div").attr("id", "ideditor-viewer-mapilio-simple-wrap").call(imgZoom3.on("zoom", zoomPan2)).append("div").attr("id", "ideditor-viewer-mapilio-simple");
80934 context.ui().photoviewer.on("resize.mapilio", () => {
80935 if (_pannellumViewer3) {
80936 _pannellumViewer3.resize();
80939 _loadViewerPromise5 = new Promise((resolve, reject) => {
80940 let loadedCount = 0;
80941 function loaded() {
80943 if (loadedCount === 2) resolve();
80945 const head = select_default2("head");
80946 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() {
80949 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() {
80952 }).catch(function() {
80953 _loadViewerPromise5 = null;
80955 function step(stepBy) {
80956 return function() {
80957 if (!_activeImage) return;
80958 const imageId = _activeImage.id;
80959 const nextIndex = imageId + stepBy;
80960 if (!nextIndex) return;
80961 const nextImage = _cache3.images.forImageId[nextIndex];
80962 context.map().centerEase(nextImage.loc);
80963 that.selectImage(context, nextImage.id);
80966 function zoomPan2(d3_event) {
80967 var t2 = d3_event.transform;
80968 context.container().select(".photoviewer #ideditor-viewer-mapilio-simple").call(utilSetTransform, t2.x, t2.y, t2.k);
80970 return _loadViewerPromise5;
80972 showViewer: function(context) {
80973 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
80974 let isHidden = wrap2.selectAll(".photo-wrapper.mapilio-wrapper.hide").size();
80976 wrap2.selectAll(".photo-wrapper:not(.mapilio-wrapper)").classed("hide", true);
80977 wrap2.selectAll(".photo-wrapper.mapilio-wrapper").classed("hide", false);
80984 hideViewer: function(context) {
80985 let viewer = context.container().select(".photoviewer");
80986 if (!viewer.empty()) viewer.datum(null);
80987 this.updateUrlImage(null);
80988 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
80989 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
80990 this.setActiveImage();
80991 return this.setStyles(context, null);
80993 // Return the current cache
80994 cache: function() {
80999 // modules/services/panoramax.js
81000 var apiUrl3 = "https://api.panoramax.xyz/";
81001 var tileUrl2 = apiUrl3 + "api/map/{z}/{x}/{y}.mvt";
81002 var imageDataUrl = apiUrl3 + "api/collections/{collectionId}/items/{itemId}";
81003 var userIdUrl = apiUrl3 + "api/users/search?q={username}";
81004 var usernameURL = apiUrl3 + "api/users/{userId}";
81005 var viewerUrl = apiUrl3;
81006 var highDefinition = "hd";
81007 var standardDefinition = "sd";
81008 var pictureLayer = "pictures";
81009 var sequenceLayer = "sequences";
81011 var imageMinZoom = 15;
81012 var lineMinZoom = 10;
81013 var dispatch13 = dispatch_default("loadedImages", "loadedLines", "viewerChanged");
81015 var _loadViewerPromise6;
81016 var _definition = standardDefinition;
81019 var _pannellumFrame2;
81020 var _currentFrame2;
81022 var _currentScene = {
81023 currentImage: null,
81028 function partitionViewport6(projection2) {
81029 const z2 = geoScaleToZoom(projection2.scale());
81030 const z22 = Math.ceil(z2 * 2) / 2 + 2.5;
81031 const tiler8 = utilTiler().zoomExtent([z22, z22]);
81032 return tiler8.getTiles(projection2).map(function(tile) {
81033 return tile.extent;
81036 function searchLimited6(limit, projection2, rtree) {
81037 limit = limit || 5;
81038 return partitionViewport6(projection2).reduce(function(result, extent) {
81039 let found = rtree.search(extent.bbox());
81040 const spacing = Math.max(1, Math.floor(found.length / limit));
81041 found = found.filter((d2, idx) => idx % spacing === 0 || d2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)).sort((a2, b2) => {
81042 if (a2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return -1;
81043 if (b2.data.id === (_activeImage2 == null ? void 0 : _activeImage2.id)) return 1;
81045 }).slice(0, limit).map((d2) => d2.data);
81046 return found.length ? result.concat(found) : result;
81049 function loadTiles5(which, url, maxZoom2, projection2, zoom) {
81050 const tiler8 = utilTiler().zoomExtent([minZoom4, maxZoom2]).skipNullIsland(true);
81051 const tiles = tiler8.getTiles(projection2);
81052 tiles.forEach(function(tile) {
81053 loadTile5(which, url, tile, zoom);
81056 function loadTile5(which, url, tile, zoom) {
81057 const cache = _cache4.requests;
81058 const tileId = "".concat(tile.id, "-").concat(which);
81059 if (cache.loaded[tileId] || cache.inflight[tileId]) return;
81060 const controller = new AbortController();
81061 cache.inflight[tileId] = controller;
81062 const requestUrl = url.replace("{x}", tile.xyz[0]).replace("{y}", tile.xyz[1]).replace("{z}", tile.xyz[2]);
81063 fetch(requestUrl, { signal: controller.signal }).then(function(response) {
81064 if (!response.ok) {
81065 throw new Error(response.status + " " + response.statusText);
81067 cache.loaded[tileId] = true;
81068 delete cache.inflight[tileId];
81069 return response.arrayBuffer();
81070 }).then(function(data) {
81071 if (data.byteLength === 0) {
81072 throw new Error("No Data");
81074 loadTileDataToCache3(data, tile, zoom);
81075 if (which === "images") {
81076 dispatch13.call("loadedImages");
81078 dispatch13.call("loadedLines");
81080 }).catch(function(e3) {
81081 if (e3.message === "No Data") {
81082 cache.loaded[tileId] = true;
81088 function loadTileDataToCache3(data, tile, zoom) {
81089 const vectorTile = new VectorTile(new Pbf(data));
81090 let features, cache, layer, i3, feature3, loc, d2;
81091 if (vectorTile.layers.hasOwnProperty(pictureLayer)) {
81093 cache = _cache4.images;
81094 layer = vectorTile.layers[pictureLayer];
81095 for (i3 = 0; i3 < layer.length; i3++) {
81096 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
81097 loc = feature3.geometry.coordinates;
81100 capture_time: feature3.properties.ts,
81101 capture_time_parsed: new Date(feature3.properties.ts),
81102 id: feature3.properties.id,
81103 account_id: feature3.properties.account_id,
81104 sequence_id: feature3.properties.sequences.split('"')[1],
81105 heading: parseInt(feature3.properties.heading, 10),
81107 resolution: feature3.properties.resolution,
81108 isPano: feature3.properties.type === "equirectangular",
81109 model: feature3.properties.model
81111 cache.forImageId[d2.id] = d2;
81120 if (d2.capture_time < _oldestDate) {
81121 _oldestDate = d2.capture_time;
81124 _oldestDate = d2.capture_time;
81128 cache.rtree.load(features);
81131 if (vectorTile.layers.hasOwnProperty(sequenceLayer)) {
81132 cache = _cache4.sequences;
81133 if (zoom >= lineMinZoom && zoom < imageMinZoom) cache = _cache4.mockSequences;
81134 layer = vectorTile.layers[sequenceLayer];
81135 for (i3 = 0; i3 < layer.length; i3++) {
81136 feature3 = layer.feature(i3).toGeoJSON(tile.xyz[0], tile.xyz[1], tile.xyz[2]);
81137 if (cache.lineString[feature3.properties.id]) {
81138 cache.lineString[feature3.properties.id].push(feature3);
81140 cache.lineString[feature3.properties.id] = [feature3];
81143 if (feature3.properties.date < _oldestDate) {
81144 _oldestDate = feature3.properties.date;
81147 _oldestDate = feature3.properties.date;
81152 async function getImageData2(collection_id, image_id) {
81153 const requestUrl = imageDataUrl.replace("{collectionId}", collection_id).replace("{itemId}", image_id);
81154 const response = await fetch(requestUrl, { method: "GET" });
81155 if (!response.ok) {
81156 throw new Error(response.status + " " + response.statusText);
81158 const data = await response.json();
81161 async function getUsername(user_id) {
81162 const requestUrl = usernameURL.replace("{userId}", user_id);
81163 const response = await fetch(requestUrl, { method: "GET" });
81164 if (!response.ok) {
81165 throw new Error(response.status + " " + response.statusText);
81167 const data = await response.json();
81170 var panoramax_default = {
81175 this.event = utilRebind(this, dispatch13, "on");
81177 reset: function() {
81179 Object.values(_cache4.requests.inflight).forEach(function(request3) {
81184 images: { rtree: new RBush(), forImageId: {} },
81185 sequences: { rtree: new RBush(), lineString: {} },
81186 mockSequences: { rtree: new RBush(), lineString: {} },
81187 requests: { loaded: {}, inflight: {} }
81189 _currentScene.currentImage = null;
81190 _activeImage2 = null;
81192 // Get visible images
81193 images: function(projection2) {
81195 return searchLimited6(limit, projection2, _cache4.images.rtree);
81197 cachedImage: function(imageKey) {
81198 return _cache4.images.forImageId[imageKey];
81200 // Load images in the visible area
81201 loadImages: function(projection2) {
81202 loadTiles5("images", tileUrl2, imageMinZoom, projection2);
81204 // Load line in the visible area
81205 loadLines: function(projection2, zoom) {
81206 loadTiles5("line", tileUrl2, lineMinZoom, projection2, zoom);
81208 getUserIds: async function(usernames) {
81209 const requestUrls = usernames.map((username) => userIdUrl.replace("{username}", username));
81210 const responses = await Promise.all(requestUrls.map((requestUrl) => fetch(requestUrl, { method: "GET" })));
81211 if (responses.some((response) => !response.ok)) {
81212 const response = responses.find((response2) => !response2.ok);
81213 throw new Error(response.status + " " + response.statusText);
81215 const data = await Promise.all(responses.map((response) => response.json()));
81216 return data.flatMap((d2, i3) => d2.features.filter((f2) => f2.name === usernames[i3]).map((f2) => f2.id));
81218 getOldestDate: function() {
81219 return _oldestDate;
81221 // Get visible sequences
81222 sequences: function(projection2, zoom) {
81223 const viewport = projection2.clipExtent();
81224 const min3 = [viewport[0][0], viewport[1][1]];
81225 const max3 = [viewport[1][0], viewport[0][1]];
81226 const bbox2 = geoExtent(projection2.invert(min3), projection2.invert(max3)).bbox();
81227 const sequenceIds = {};
81228 let lineStrings = [];
81229 if (zoom >= imageMinZoom) {
81230 _cache4.images.rtree.search(bbox2).forEach(function(d2) {
81231 if (d2.data.sequence_id) {
81232 sequenceIds[d2.data.sequence_id] = true;
81235 Object.keys(sequenceIds).forEach(function(sequenceId) {
81236 if (_cache4.sequences.lineString[sequenceId]) {
81237 lineStrings = lineStrings.concat(_cache4.sequences.lineString[sequenceId]);
81240 return lineStrings;
81242 if (zoom >= lineMinZoom) {
81243 Object.keys(_cache4.mockSequences.lineString).forEach(function(sequenceId) {
81244 lineStrings = lineStrings.concat(_cache4.mockSequences.lineString[sequenceId]);
81247 return lineStrings;
81249 // Set the currently visible image
81250 setActiveImage: function(image) {
81254 sequence_id: image.sequence_id
81257 _activeImage2 = null;
81260 getActiveImage: function() {
81261 return _activeImage2;
81263 // Update the currently highlighted sequence and selected bubble.
81264 setStyles: function(context, hovered) {
81265 const hoveredImageId = hovered && hovered.id;
81266 const hoveredSequenceId = hovered && hovered.sequence_id;
81267 const selectedSequenceId = _activeImage2 && _activeImage2.sequence_id;
81268 const selectedImageId = _activeImage2 && _activeImage2.id;
81269 const markers = context.container().selectAll(".layer-panoramax .viewfield-group");
81270 const sequences = context.container().selectAll(".layer-panoramax .sequence");
81271 markers.classed("highlighted", function(d2) {
81272 return d2.sequence_id === selectedSequenceId || d2.id === hoveredImageId;
81273 }).classed("hovered", function(d2) {
81274 return d2.id === hoveredImageId;
81275 }).classed("currentView", function(d2) {
81276 return d2.id === selectedImageId;
81278 sequences.classed("highlighted", function(d2) {
81279 return d2.properties.id === hoveredSequenceId;
81280 }).classed("currentView", function(d2) {
81281 return d2.properties.id === selectedSequenceId;
81283 context.container().selectAll(".layer-panoramax .viewfield-group .viewfield").attr("d", viewfieldPath);
81284 function viewfieldPath() {
81285 let d2 = this.parentNode.__data__;
81286 if (d2.isPano && d2.id !== selectedImageId) {
81287 return "M 8,13 m -10,0 a 10,10 0 1,0 20,0 a 10,10 0 1,0 -20,0";
81289 return "M 6,9 C 8,8.4 8,8.4 10,9 L 16,-2 C 12,-5 4,-5 0,-2 z";
81294 updateUrlImage: function(imageKey) {
81295 if (!window.mocha) {
81296 var hash = utilStringQs(window.location.hash);
81298 hash.photo = "panoramax/" + imageKey;
81302 window.location.replace("#" + utilQsString(hash, true));
81305 selectImage: function(context, id2) {
81307 let d2 = that.cachedImage(id2);
81308 that.setActiveImage(d2);
81309 that.updateUrlImage(d2.id);
81310 const viewerLink = "".concat(viewerUrl, "#pic=").concat(d2.id, "&focus=pic");
81311 let viewer = context.container().select(".photoviewer");
81312 if (!viewer.empty()) viewer.datum(d2);
81313 this.setStyles(context, null);
81314 if (!d2) return this;
81315 let wrap2 = context.container().select(".photoviewer .panoramax-wrapper");
81316 let attribution = wrap2.selectAll(".photo-attribution").text("");
81317 let line1 = attribution.append("div").attr("class", "attribution-row");
81318 const hdDomId = utilUniqueDomId("panoramax-hd");
81319 let label = line1.append("label").attr("for", hdDomId).attr("class", "panoramax-hd");
81320 label.append("input").attr("type", "checkbox").attr("id", hdDomId).property("checked", _isHD).on("click", (d3_event) => {
81321 d3_event.stopPropagation();
81323 _definition = _isHD ? highDefinition : standardDefinition;
81324 that.selectImage(context, d2.id).showViewer(context);
81326 label.append("span").call(_t.append("panoramax.hd"));
81327 if (d2.capture_time) {
81328 attribution.append("span").attr("class", "captured_at").text(localeDateString2(d2.capture_time));
81329 attribution.append("span").text("|");
81331 attribution.append("a").attr("class", "report-photo").attr("href", "mailto:signalement.ign@panoramax.fr").call(_t.append("panoramax.report"));
81332 attribution.append("span").text("|");
81333 attribution.append("a").attr("class", "image-link").attr("target", "_blank").attr("href", viewerLink).text("panoramax.xyz");
81334 getImageData2(d2.sequence_id, d2.id).then(function(data) {
81336 currentImage: null,
81340 _currentScene.currentImage = data.assets[_definition];
81341 const nextIndex = data.links.findIndex((x2) => x2.rel === "next");
81342 const prevIndex = data.links.findIndex((x2) => x2.rel === "prev");
81343 if (nextIndex !== -1) {
81344 _currentScene.nextImage = data.links[nextIndex];
81346 if (prevIndex !== -1) {
81347 _currentScene.prevImage = data.links[prevIndex];
81349 d2.image_path = _currentScene.currentImage.href;
81350 wrap2.selectAll("button.back").classed("hide", _currentScene.prevImage === null);
81351 wrap2.selectAll("button.forward").classed("hide", _currentScene.nextImage === null);
81352 _currentFrame2 = d2.isPano ? _pannellumFrame2 : _planeFrame2;
81353 _currentFrame2.showPhotoFrame(wrap2).selectPhoto(d2, true);
81355 function localeDateString2(s2) {
81356 if (!s2) return null;
81357 var options2 = { day: "numeric", month: "short", year: "numeric" };
81358 var d4 = new Date(s2);
81359 if (isNaN(d4.getTime())) return null;
81360 return d4.toLocaleDateString(_mainLocalizer.localeCode(), options2);
81362 if (d2.account_id) {
81363 attribution.append("span").text("|");
81364 let line2 = attribution.append("span").attr("class", "attribution-row");
81365 getUsername(d2.account_id).then(function(username) {
81366 line2.append("span").attr("class", "captured_by").text(_t("panoramax.captured_by", { username }));
81371 photoFrame: function() {
81372 return _currentFrame2;
81374 ensureViewerLoaded: function(context) {
81376 let imgWrap = context.container().select("#ideditor-viewer-panoramax-simple > img");
81377 if (!imgWrap.empty()) {
81380 if (_loadViewerPromise6) return _loadViewerPromise6;
81381 let wrap2 = context.container().select(".photoviewer").selectAll(".panoramax-wrapper").data([0]);
81382 let wrapEnter = wrap2.enter().append("div").attr("class", "photo-wrapper panoramax-wrapper").classed("hide", true).on("dblclick.zoom", null);
81383 wrapEnter.append("div").attr("class", "photo-attribution fillD");
81384 const controlsEnter = wrapEnter.append("div").attr("class", "photo-controls-wrap").append("div").attr("class", "photo-controls-panoramax");
81385 controlsEnter.append("button").classed("back", true).on("click.back", step(-1)).text("\u25C4");
81386 controlsEnter.append("button").classed("forward", true).on("click.forward", step(1)).text("\u25BA");
81387 _loadViewerPromise6 = Promise.all([
81388 pannellum_photo_default.init(context, wrapEnter),
81389 plane_photo_default.init(context, wrapEnter)
81390 ]).then(([pannellumPhotoFrame, planePhotoFrame]) => {
81391 _pannellumFrame2 = pannellumPhotoFrame;
81392 _pannellumFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
81393 _planeFrame2 = planePhotoFrame;
81394 _planeFrame2.event.on("viewerChanged", () => dispatch13.call("viewerChanged"));
81396 function step(stepBy) {
81397 return function() {
81398 if (!_currentScene.currentImage) return;
81400 if (stepBy === 1) nextId = _currentScene.nextImage.id;
81401 else nextId = _currentScene.prevImage.id;
81402 if (!nextId) return;
81403 const nextImage = _cache4.images.forImageId[nextId];
81405 context.map().centerEase(nextImage.loc);
81406 that.selectImage(context, nextImage.id);
81410 return _loadViewerPromise6;
81412 showViewer: function(context) {
81413 let wrap2 = context.container().select(".photoviewer").classed("hide", false);
81414 let isHidden = wrap2.selectAll(".photo-wrapper.panoramax-wrapper.hide").size();
81416 wrap2.selectAll(".photo-wrapper:not(.panoramax-wrapper)").classed("hide", true);
81417 wrap2.selectAll(".photo-wrapper.panoramax-wrapper").classed("hide", false);
81421 hideViewer: function(context) {
81422 let viewer = context.container().select(".photoviewer");
81423 if (!viewer.empty()) viewer.datum(null);
81424 this.updateUrlImage(null);
81425 viewer.classed("hide", true).selectAll(".photo-wrapper").classed("hide", true);
81426 context.container().selectAll(".viewfield-group, .sequence, .icon-sign").classed("currentView", false);
81427 this.setActiveImage();
81428 return this.setStyles(context, null);
81430 cache: function() {
81435 // modules/services/index.js
81437 geocoder: nominatim_default,
81438 keepRight: keepRight_default,
81439 osmose: osmose_default,
81440 mapillary: mapillary_default,
81442 kartaview: kartaview_default,
81443 vegbilder: vegbilder_default,
81445 osmWikibase: osm_wikibase_default,
81446 maprules: maprules_default,
81447 streetside: streetside_default,
81448 taginfo: taginfo_default,
81449 vectorTile: vector_tile_default,
81450 wikidata: wikidata_default,
81451 wikipedia: wikipedia_default,
81452 mapilio: mapilio_default,
81453 panoramax: panoramax_default
81456 // modules/modes/drag_note.js
81457 function modeDragNote(context) {
81462 var edit2 = behaviorEdit(context);
81463 var _nudgeInterval;
81466 function startNudge(d3_event, nudge) {
81467 if (_nudgeInterval) window.clearInterval(_nudgeInterval);
81468 _nudgeInterval = window.setInterval(function() {
81469 context.map().pan(nudge);
81470 doMove(d3_event, nudge);
81473 function stopNudge() {
81474 if (_nudgeInterval) {
81475 window.clearInterval(_nudgeInterval);
81476 _nudgeInterval = null;
81479 function origin(note) {
81480 return context.projection(note.loc);
81482 function start2(d3_event, note) {
81484 var osm = services.osm;
81486 _note = osm.getNote(_note.id);
81488 context.surface().selectAll(".note-" + _note.id).classed("active", true);
81489 context.perform(actionNoop());
81490 context.enter(mode);
81491 context.selectedNoteID(_note.id);
81493 function move(d3_event, entity, point) {
81494 d3_event.stopPropagation();
81495 _lastLoc = context.projection.invert(point);
81497 var nudge = geoViewportEdge(point, context.map().dimensions());
81499 startNudge(d3_event, nudge);
81504 function doMove(d3_event, nudge) {
81505 nudge = nudge || [0, 0];
81506 var currPoint = d3_event && d3_event.point || context.projection(_lastLoc);
81507 var currMouse = geoVecSubtract(currPoint, nudge);
81508 var loc = context.projection.invert(currMouse);
81509 _note = _note.move(loc);
81510 var osm = services.osm;
81512 osm.replaceNote(_note);
81514 context.replace(actionNoop());
81517 context.replace(actionNoop());
81518 context.selectedNoteID(_note.id).enter(modeSelectNote(context, _note.id));
81520 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);
81521 mode.enter = function() {
81522 context.install(edit2);
81524 mode.exit = function() {
81525 context.ui().sidebar.hover.cancel();
81526 context.uninstall(edit2);
81527 context.surface().selectAll(".active").classed("active", false);
81530 mode.behavior = drag;
81534 // modules/modes/select_data.js
81535 function modeSelectData(context, selectedDatum) {
81540 var keybinding = utilKeybinding("select-data");
81541 var dataEditor = uiDataEditor(context);
81543 behaviorBreathe(context),
81544 behaviorHover(context),
81545 behaviorSelect(context),
81546 behaviorLasso(context),
81547 modeDragNode(context).behavior,
81548 modeDragNote(context).behavior
81550 function selectData(d3_event, drawn) {
81551 var selection2 = context.surface().selectAll(".layer-mapdata .data" + selectedDatum.__featurehash__);
81552 if (selection2.empty()) {
81553 var source = d3_event && d3_event.type === "zoom" && d3_event.sourceEvent;
81554 if (drawn && source && (source.type === "pointermove" || source.type === "mousemove" || source.type === "touchmove")) {
81555 context.enter(modeBrowse(context));
81558 selection2.classed("selected", true);
81562 if (context.container().select(".combobox").size()) return;
81563 context.enter(modeBrowse(context));
81565 mode.zoomToSelected = function() {
81566 var extent = geoExtent(bounds_default(selectedDatum));
81567 context.map().centerZoomEase(extent.center(), context.map().trimmedExtentZoom(extent));
81569 mode.enter = function() {
81570 behaviors.forEach(context.install);
81571 keybinding.on(_t("inspector.zoom_to.key"), mode.zoomToSelected).on("\u238B", esc, true);
81572 select_default2(document).call(keybinding);
81574 var sidebar = context.ui().sidebar;
81575 sidebar.show(dataEditor.datum(selectedDatum));
81576 var extent = geoExtent(bounds_default(selectedDatum));
81577 sidebar.expand(sidebar.intersects(extent));
81578 context.map().on("drawn.select-data", selectData);
81580 mode.exit = function() {
81581 behaviors.forEach(context.uninstall);
81582 select_default2(document).call(keybinding.unbind);
81583 context.surface().selectAll(".layer-mapdata .selected").classed("selected hover", false);
81584 context.map().on("drawn.select-data", null);
81585 context.ui().sidebar.hide();
81590 // modules/behavior/select.js
81591 function behaviorSelect(context) {
81592 var _tolerancePx = 4;
81593 var _lastMouseEvent = null;
81594 var _showMenu = false;
81595 var _downPointers = {};
81596 var _longPressTimeout = null;
81597 var _lastInteractionType = null;
81598 var _multiselectionPointerId = null;
81599 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
81600 function keydown(d3_event) {
81601 if (d3_event.keyCode === 32) {
81602 var activeNode = document.activeElement;
81603 if (activeNode && (/* @__PURE__ */ new Set(["INPUT", "TEXTAREA"])).has(activeNode.nodeName)) return;
81605 if (d3_event.keyCode === 93 || // context menu key
81606 d3_event.keyCode === 32) {
81607 d3_event.preventDefault();
81609 if (d3_event.repeat) return;
81611 if (d3_event.shiftKey) {
81612 context.surface().classed("behavior-multiselect", true);
81614 if (d3_event.keyCode === 32) {
81615 if (!_downPointers.spacebar && _lastMouseEvent) {
81617 _longPressTimeout = window.setTimeout(didLongPress, 500, "spacebar", "spacebar");
81618 _downPointers.spacebar = {
81619 firstEvent: _lastMouseEvent,
81620 lastEvent: _lastMouseEvent
81625 function keyup(d3_event) {
81627 if (!d3_event.shiftKey) {
81628 context.surface().classed("behavior-multiselect", false);
81630 if (d3_event.keyCode === 93) {
81631 d3_event.preventDefault();
81632 _lastInteractionType = "menukey";
81633 contextmenu(d3_event);
81634 } else if (d3_event.keyCode === 32) {
81635 var pointer = _downPointers.spacebar;
81637 delete _downPointers.spacebar;
81638 if (pointer.done) return;
81639 d3_event.preventDefault();
81640 _lastInteractionType = "spacebar";
81641 click(pointer.firstEvent, pointer.lastEvent, "spacebar");
81645 function pointerdown(d3_event) {
81646 var id2 = (d3_event.pointerId || "mouse").toString();
81648 if (d3_event.buttons && d3_event.buttons !== 1) return;
81649 context.ui().closeEditMenu();
81650 if (d3_event.pointerType !== "mouse") {
81651 _longPressTimeout = window.setTimeout(didLongPress, 500, id2, "longdown-" + (d3_event.pointerType || "mouse"));
81653 _downPointers[id2] = {
81654 firstEvent: d3_event,
81655 lastEvent: d3_event
81658 function didLongPress(id2, interactionType) {
81659 var pointer = _downPointers[id2];
81660 if (!pointer) return;
81661 for (var i3 in _downPointers) {
81662 _downPointers[i3].done = true;
81664 _longPressTimeout = null;
81665 _lastInteractionType = interactionType;
81667 click(pointer.firstEvent, pointer.lastEvent, id2);
81669 function pointermove(d3_event) {
81670 var id2 = (d3_event.pointerId || "mouse").toString();
81671 if (_downPointers[id2]) {
81672 _downPointers[id2].lastEvent = d3_event;
81674 if (!d3_event.pointerType || d3_event.pointerType === "mouse") {
81675 _lastMouseEvent = d3_event;
81676 if (_downPointers.spacebar) {
81677 _downPointers.spacebar.lastEvent = d3_event;
81681 function pointerup(d3_event) {
81682 var id2 = (d3_event.pointerId || "mouse").toString();
81683 var pointer = _downPointers[id2];
81684 if (!pointer) return;
81685 delete _downPointers[id2];
81686 if (_multiselectionPointerId === id2) {
81687 _multiselectionPointerId = null;
81689 if (pointer.done) return;
81690 click(pointer.firstEvent, d3_event, id2);
81692 function pointercancel(d3_event) {
81693 var id2 = (d3_event.pointerId || "mouse").toString();
81694 if (!_downPointers[id2]) return;
81695 delete _downPointers[id2];
81696 if (_multiselectionPointerId === id2) {
81697 _multiselectionPointerId = null;
81700 function contextmenu(d3_event) {
81701 d3_event.preventDefault();
81702 if (!+d3_event.clientX && !+d3_event.clientY) {
81703 if (_lastMouseEvent) {
81704 d3_event = _lastMouseEvent;
81709 _lastMouseEvent = d3_event;
81710 if (d3_event.pointerType === "touch" || d3_event.pointerType === "pen" || d3_event.mozInputSource && // firefox doesn't give a pointerType on contextmenu events
81711 (d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_TOUCH || d3_event.mozInputSource === MouseEvent.MOZ_SOURCE_PEN)) {
81712 _lastInteractionType = "touch";
81714 _lastInteractionType = "rightclick";
81718 click(d3_event, d3_event);
81720 function click(firstEvent, lastEvent, pointerId) {
81722 var mapNode = context.container().select(".main-map").node();
81723 var pointGetter = utilFastMouse(mapNode);
81724 var p1 = pointGetter(firstEvent);
81725 var p2 = pointGetter(lastEvent);
81726 var dist = geoVecLength(p1, p2);
81727 if (dist > _tolerancePx || !mapContains(lastEvent)) {
81731 var targetDatum = lastEvent.target.__data__;
81732 var multiselectEntityId;
81733 if (!_multiselectionPointerId) {
81734 var selectPointerInfo = pointerDownOnSelection(pointerId);
81735 if (selectPointerInfo) {
81736 _multiselectionPointerId = selectPointerInfo.pointerId;
81737 multiselectEntityId = !selectPointerInfo.selected && selectPointerInfo.entityId;
81738 _downPointers[selectPointerInfo.pointerId].done = true;
81741 var isMultiselect = context.mode().id === "select" && // and shift key is down
81742 (lastEvent && lastEvent.shiftKey || // or we're lasso-selecting
81743 context.surface().select(".lasso").node() || // or a pointer is down over a selected feature
81744 _multiselectionPointerId && !multiselectEntityId);
81745 processClick(targetDatum, isMultiselect, p2, multiselectEntityId);
81746 function mapContains(event) {
81747 var rect = mapNode.getBoundingClientRect();
81748 return event.clientX >= rect.left && event.clientX <= rect.right && event.clientY >= rect.top && event.clientY <= rect.bottom;
81750 function pointerDownOnSelection(skipPointerId) {
81751 var mode = context.mode();
81752 var selectedIDs = mode.id === "select" ? mode.selectedIDs() : [];
81753 for (var pointerId2 in _downPointers) {
81754 if (pointerId2 === "spacebar" || pointerId2 === skipPointerId) continue;
81755 var pointerInfo = _downPointers[pointerId2];
81756 var p12 = pointGetter(pointerInfo.firstEvent);
81757 var p22 = pointGetter(pointerInfo.lastEvent);
81758 if (geoVecLength(p12, p22) > _tolerancePx) continue;
81759 var datum2 = pointerInfo.firstEvent.target.__data__;
81760 var entity = datum2 && datum2.properties && datum2.properties.entity || datum2;
81761 if (context.graph().hasEntity(entity.id)) {
81763 pointerId: pointerId2,
81764 entityId: entity.id,
81765 selected: selectedIDs.indexOf(entity.id) !== -1
81772 function processClick(datum2, isMultiselect, point, alsoSelectId) {
81773 var mode = context.mode();
81774 var showMenu = _showMenu;
81775 var interactionType = _lastInteractionType;
81776 var entity = datum2 && datum2.properties && datum2.properties.entity;
81777 if (entity) datum2 = entity;
81778 if (datum2 && datum2.type === "midpoint") {
81779 datum2 = datum2.parents[0];
81782 if (datum2 instanceof osmEntity) {
81783 var selectedIDs = context.selectedIDs();
81784 context.selectedNoteID(null);
81785 context.selectedErrorID(null);
81786 if (!isMultiselect) {
81787 if (!showMenu || selectedIDs.length <= 1 || selectedIDs.indexOf(datum2.id) === -1) {
81788 if (alsoSelectId === datum2.id) alsoSelectId = null;
81789 selectedIDs = (alsoSelectId ? [alsoSelectId] : []).concat([datum2.id]);
81790 newMode = mode.id === "select" ? mode.selectedIDs(selectedIDs) : modeSelect(context, selectedIDs).selectBehavior(behavior);
81791 context.enter(newMode);
81794 if (selectedIDs.indexOf(datum2.id) !== -1) {
81796 selectedIDs = selectedIDs.filter(function(id2) {
81797 return id2 !== datum2.id;
81799 newMode = selectedIDs.length ? mode.selectedIDs(selectedIDs) : modeBrowse(context).selectBehavior(behavior);
81800 context.enter(newMode);
81803 selectedIDs = selectedIDs.concat([datum2.id]);
81804 newMode = mode.selectedIDs(selectedIDs);
81805 context.enter(newMode);
81808 } else if (datum2 && datum2.__featurehash__ && !isMultiselect) {
81809 context.selectedNoteID(null).enter(modeSelectData(context, datum2));
81810 } else if (datum2 instanceof osmNote && !isMultiselect) {
81811 context.selectedNoteID(datum2.id).enter(modeSelectNote(context, datum2.id));
81812 } else if (datum2 instanceof QAItem && !isMultiselect) {
81813 context.selectedErrorID(datum2.id).enter(modeSelectError(context, datum2.id, datum2.service));
81815 context.selectedNoteID(null);
81816 context.selectedErrorID(null);
81817 if (!isMultiselect && mode.id !== "browse") {
81818 context.enter(modeBrowse(context));
81821 context.ui().closeEditMenu();
81822 if (showMenu) context.ui().showEditMenu(point, interactionType);
81825 function cancelLongPress() {
81826 if (_longPressTimeout) window.clearTimeout(_longPressTimeout);
81827 _longPressTimeout = null;
81829 function resetProperties() {
81832 _lastInteractionType = null;
81834 function behavior(selection2) {
81836 _lastMouseEvent = context.map().lastPointerEvent();
81837 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) {
81839 if (+e3.clientX === 0 && +e3.clientY === 0) {
81840 d3_event.preventDefault();
81843 selection2.on(_pointerPrefix + "down.select", pointerdown).on("contextmenu.select", contextmenu);
81845 behavior.off = function(selection2) {
81847 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);
81848 selection2.on(_pointerPrefix + "down.select", null).on("contextmenu.select", null);
81849 context.surface().classed("behavior-multiselect", false);
81854 // modules/operations/index.js
81855 var operations_exports = {};
81856 __export(operations_exports, {
81857 operationCircularize: () => operationCircularize,
81858 operationContinue: () => operationContinue,
81859 operationCopy: () => operationCopy,
81860 operationDelete: () => operationDelete,
81861 operationDisconnect: () => operationDisconnect,
81862 operationDowngrade: () => operationDowngrade,
81863 operationExtract: () => operationExtract,
81864 operationMerge: () => operationMerge,
81865 operationMove: () => operationMove,
81866 operationOrthogonalize: () => operationOrthogonalize,
81867 operationPaste: () => operationPaste,
81868 operationReflectLong: () => operationReflectLong,
81869 operationReflectShort: () => operationReflectShort,
81870 operationReverse: () => operationReverse,
81871 operationRotate: () => operationRotate,
81872 operationSplit: () => operationSplit,
81873 operationStraighten: () => operationStraighten
81876 // modules/operations/continue.js
81877 function operationContinue(context, selectedIDs) {
81878 var _entities = selectedIDs.map(function(id2) {
81879 return context.graph().entity(id2);
81881 var _geometries = Object.assign(
81882 { line: [], vertex: [] },
81883 utilArrayGroupBy(_entities, function(entity) {
81884 return entity.geometry(context.graph());
81887 var _vertex = _geometries.vertex.length && _geometries.vertex[0];
81888 function candidateWays() {
81889 return _vertex ? context.graph().parentWays(_vertex).filter(function(parent) {
81890 return parent.geometry(context.graph()) === "line" && !parent.isClosed() && parent.affix(_vertex.id) && (_geometries.line.length === 0 || _geometries.line[0] === parent);
81893 var _candidates = candidateWays();
81894 var operation2 = function() {
81895 var candidate = _candidates[0];
81897 modeDrawLine(context, candidate.id, context.graph(), "line", candidate.affix(_vertex.id), true)
81900 operation2.relatedEntityIds = function() {
81901 return _candidates.length ? [_candidates[0].id] : [];
81903 operation2.available = function() {
81904 return _geometries.vertex.length === 1 && _geometries.line.length <= 1 && !context.features().hasHiddenConnections(_vertex, context.graph());
81906 operation2.disabled = function() {
81907 if (_candidates.length === 0) {
81908 return "not_eligible";
81909 } else if (_candidates.length > 1) {
81914 operation2.tooltip = function() {
81915 var disable = operation2.disabled();
81916 return disable ? _t.append("operations.continue." + disable) : _t.append("operations.continue.description");
81918 operation2.annotation = function() {
81919 return _t("operations.continue.annotation.line");
81921 operation2.id = "continue";
81922 operation2.keys = [_t("operations.continue.key")];
81923 operation2.title = _t.append("operations.continue.title");
81924 operation2.behavior = behaviorOperation(context).which(operation2);
81928 // modules/operations/copy.js
81929 function operationCopy(context, selectedIDs) {
81930 function getFilteredIdsToCopy() {
81931 return selectedIDs.filter(function(selectedID) {
81932 var entity = context.graph().hasEntity(selectedID);
81933 return entity.hasInterestingTags() || entity.geometry(context.graph()) !== "vertex";
81936 var operation2 = function() {
81937 var graph = context.graph();
81938 var selected = groupEntities(getFilteredIdsToCopy(), graph);
81943 for (i3 = 0; i3 < selected.relation.length; i3++) {
81944 entity = selected.relation[i3];
81945 if (!skip[entity.id] && entity.isComplete(graph)) {
81946 canCopy.push(entity.id);
81947 skip = getDescendants(entity.id, graph, skip);
81950 for (i3 = 0; i3 < selected.way.length; i3++) {
81951 entity = selected.way[i3];
81952 if (!skip[entity.id]) {
81953 canCopy.push(entity.id);
81954 skip = getDescendants(entity.id, graph, skip);
81957 for (i3 = 0; i3 < selected.node.length; i3++) {
81958 entity = selected.node[i3];
81959 if (!skip[entity.id]) {
81960 canCopy.push(entity.id);
81963 context.copyIDs(canCopy);
81964 if (_point && (canCopy.length !== 1 || graph.entity(canCopy[0]).type !== "node")) {
81965 context.copyLonLat(context.projection.invert(_point));
81967 context.copyLonLat(null);
81970 function groupEntities(ids, graph) {
81971 var entities = ids.map(function(id2) {
81972 return graph.entity(id2);
81974 return Object.assign(
81975 { relation: [], way: [], node: [] },
81976 utilArrayGroupBy(entities, "type")
81979 function getDescendants(id2, graph, descendants) {
81980 var entity = graph.entity(id2);
81982 descendants = descendants || {};
81983 if (entity.type === "relation") {
81984 children2 = entity.members.map(function(m2) {
81987 } else if (entity.type === "way") {
81988 children2 = entity.nodes;
81992 for (var i3 = 0; i3 < children2.length; i3++) {
81993 if (!descendants[children2[i3]]) {
81994 descendants[children2[i3]] = true;
81995 descendants = getDescendants(children2[i3], graph, descendants);
81998 return descendants;
82000 operation2.available = function() {
82001 return getFilteredIdsToCopy().length > 0;
82003 operation2.disabled = function() {
82004 var extent = utilTotalExtent(getFilteredIdsToCopy(), context.graph());
82005 if (extent.percentContainedIn(context.map().extent()) < 0.8) {
82006 return "too_large";
82010 operation2.availableForKeypress = function() {
82011 var selection2 = window.getSelection && window.getSelection();
82012 return !selection2 || !selection2.toString();
82014 operation2.tooltip = function() {
82015 var disable = operation2.disabled();
82016 return disable ? _t.append("operations.copy." + disable, { n: selectedIDs.length }) : _t.append("operations.copy.description", { n: selectedIDs.length });
82018 operation2.annotation = function() {
82019 return _t("operations.copy.annotation", { n: selectedIDs.length });
82022 operation2.point = function(val) {
82026 operation2.id = "copy";
82027 operation2.keys = [uiCmd("\u2318C")];
82028 operation2.title = _t.append("operations.copy.title");
82029 operation2.behavior = behaviorOperation(context).which(operation2);
82033 // modules/operations/disconnect.js
82034 function operationDisconnect(context, selectedIDs) {
82035 var _vertexIDs = [];
82037 var _otherIDs = [];
82039 selectedIDs.forEach(function(id2) {
82040 var entity = context.entity(id2);
82041 if (entity.type === "way") {
82043 } else if (entity.geometry(context.graph()) === "vertex") {
82044 _vertexIDs.push(id2);
82046 _otherIDs.push(id2);
82049 var _coords, _descriptionID = "", _annotationID = "features";
82050 var _disconnectingVertexIds = [];
82051 var _disconnectingWayIds = [];
82052 if (_vertexIDs.length > 0) {
82053 _disconnectingVertexIds = _vertexIDs;
82054 _vertexIDs.forEach(function(vertexID) {
82055 var action = actionDisconnect(vertexID);
82056 if (_wayIDs.length > 0) {
82057 var waysIDsForVertex = _wayIDs.filter(function(wayID) {
82058 var way = context.entity(wayID);
82059 return way.nodes.indexOf(vertexID) !== -1;
82061 action.limitWays(waysIDsForVertex);
82063 _actions.push(action);
82064 _disconnectingWayIds = _disconnectingWayIds.concat(context.graph().parentWays(context.graph().entity(vertexID)).map((d2) => d2.id));
82066 _disconnectingWayIds = utilArrayUniq(_disconnectingWayIds).filter(function(id2) {
82067 return _wayIDs.indexOf(id2) === -1;
82069 _descriptionID += _actions.length === 1 ? "single_point." : "multiple_points.";
82070 if (_wayIDs.length === 1) {
82071 _descriptionID += "single_way." + context.graph().geometry(_wayIDs[0]);
82073 _descriptionID += _wayIDs.length === 0 ? "no_ways" : "multiple_ways";
82075 } else if (_wayIDs.length > 0) {
82076 var ways = _wayIDs.map(function(id2) {
82077 return context.entity(id2);
82079 var nodes = utilGetAllNodes(_wayIDs, context.graph());
82080 _coords = nodes.map(function(n3) {
82083 var sharedActions = [];
82084 var sharedNodes = [];
82085 var unsharedActions = [];
82086 var unsharedNodes = [];
82087 nodes.forEach(function(node) {
82088 var action = actionDisconnect(node.id).limitWays(_wayIDs);
82089 if (action.disabled(context.graph()) !== "not_connected") {
82091 for (var i3 in ways) {
82092 var way = ways[i3];
82093 if (way.nodes.indexOf(node.id) !== -1) {
82096 if (count > 1) break;
82099 sharedActions.push(action);
82100 sharedNodes.push(node);
82102 unsharedActions.push(action);
82103 unsharedNodes.push(node);
82107 _descriptionID += "no_points.";
82108 _descriptionID += _wayIDs.length === 1 ? "single_way." : "multiple_ways.";
82109 if (sharedActions.length) {
82110 _actions = sharedActions;
82111 _disconnectingVertexIds = sharedNodes.map((node) => node.id);
82112 _descriptionID += "conjoined";
82113 _annotationID = "from_each_other";
82115 _actions = unsharedActions;
82116 _disconnectingVertexIds = unsharedNodes.map((node) => node.id);
82117 if (_wayIDs.length === 1) {
82118 _descriptionID += context.graph().geometry(_wayIDs[0]);
82120 _descriptionID += "separate";
82124 var _extent = utilTotalExtent(_disconnectingVertexIds, context.graph());
82125 var operation2 = function() {
82126 context.perform(function(graph) {
82127 return _actions.reduce(function(graph2, action) {
82128 return action(graph2);
82130 }, operation2.annotation());
82131 context.validator().validate();
82133 operation2.relatedEntityIds = function() {
82134 if (_vertexIDs.length) {
82135 return _disconnectingWayIds;
82137 return _disconnectingVertexIds;
82139 operation2.available = function() {
82140 if (_actions.length === 0) return false;
82141 if (_otherIDs.length !== 0) return false;
82142 if (_vertexIDs.length !== 0 && _wayIDs.length !== 0 && !_wayIDs.every(function(wayID) {
82143 return _vertexIDs.some(function(vertexID) {
82144 var way = context.entity(wayID);
82145 return way.nodes.indexOf(vertexID) !== -1;
82150 operation2.disabled = function() {
82152 for (var actionIndex in _actions) {
82153 reason = _actions[actionIndex].disabled(context.graph());
82154 if (reason) return reason;
82156 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82157 return "too_large." + ((_vertexIDs.length ? _vertexIDs : _wayIDs).length === 1 ? "single" : "multiple");
82158 } else if (_coords && someMissing()) {
82159 return "not_downloaded";
82160 } else if (selectedIDs.some(context.hasHiddenConnections)) {
82161 return "connected_to_hidden";
82164 function someMissing() {
82165 if (context.inIntro()) return false;
82166 var osm = context.connection();
82168 var missing = _coords.filter(function(loc) {
82169 return !osm.isDataLoaded(loc);
82171 if (missing.length) {
82172 missing.forEach(function(loc) {
82173 context.loadTileAtLoc(loc);
82181 operation2.tooltip = function() {
82182 var disable = operation2.disabled();
82183 return disable ? _t.append("operations.disconnect." + disable) : _t.append("operations.disconnect.description." + _descriptionID);
82185 operation2.annotation = function() {
82186 return _t("operations.disconnect.annotation." + _annotationID);
82188 operation2.id = "disconnect";
82189 operation2.keys = [_t("operations.disconnect.key")];
82190 operation2.title = _t.append("operations.disconnect.title");
82191 operation2.behavior = behaviorOperation(context).which(operation2);
82195 // modules/operations/downgrade.js
82196 function operationDowngrade(context, selectedIDs) {
82197 var _affectedFeatureCount = 0;
82198 var _downgradeType = downgradeTypeForEntityIDs(selectedIDs);
82199 var _multi = _affectedFeatureCount === 1 ? "single" : "multiple";
82200 function downgradeTypeForEntityIDs(entityIds) {
82202 _affectedFeatureCount = 0;
82203 for (var i3 in entityIds) {
82204 var entityID = entityIds[i3];
82205 var type2 = downgradeTypeForEntityID(entityID);
82207 _affectedFeatureCount += 1;
82208 if (downgradeType && type2 !== downgradeType) {
82209 if (downgradeType !== "generic" && type2 !== "generic") {
82210 downgradeType = "building_address";
82212 downgradeType = "generic";
82215 downgradeType = type2;
82219 return downgradeType;
82221 function downgradeTypeForEntityID(entityID) {
82222 var graph = context.graph();
82223 var entity = graph.entity(entityID);
82224 var preset = _mainPresetIndex.match(entity, graph);
82225 if (!preset || preset.isFallback()) return null;
82226 if (entity.type === "node" && preset.id !== "address" && Object.keys(entity.tags).some(function(key) {
82227 return key.match(/^addr:.{1,}/);
82231 var geometry = entity.geometry(graph);
82232 if (geometry === "area" && entity.tags.building && !preset.tags.building) {
82235 if (geometry === "vertex" && Object.keys(entity.tags).length) {
82240 var buildingKeysToKeep = ["architect", "building", "height", "layer", "nycdoitt:bin", "source", "type", "wheelchair"];
82241 var addressKeysToKeep = ["source"];
82242 var operation2 = function() {
82243 context.perform(function(graph) {
82244 for (var i3 in selectedIDs) {
82245 var entityID = selectedIDs[i3];
82246 var type2 = downgradeTypeForEntityID(entityID);
82247 if (!type2) continue;
82248 var tags = Object.assign({}, graph.entity(entityID).tags);
82249 for (var key in tags) {
82250 if (type2 === "address" && addressKeysToKeep.indexOf(key) !== -1) continue;
82251 if (type2 === "building") {
82252 if (buildingKeysToKeep.indexOf(key) !== -1 || key.match(/^building:.{1,}/) || key.match(/^roof:.{1,}/)) continue;
82254 if (type2 !== "generic") {
82255 if (key.match(/^addr:.{1,}/) || key.match(/^source:.{1,}/)) continue;
82259 graph = actionChangeTags(entityID, tags)(graph);
82262 }, operation2.annotation());
82263 context.validator().validate();
82264 context.enter(modeSelect(context, selectedIDs));
82266 operation2.available = function() {
82267 return _downgradeType;
82269 operation2.disabled = function() {
82270 if (selectedIDs.some(hasWikidataTag)) {
82271 return "has_wikidata_tag";
82274 function hasWikidataTag(id2) {
82275 var entity = context.entity(id2);
82276 return entity.tags.wikidata && entity.tags.wikidata.trim().length > 0;
82279 operation2.tooltip = function() {
82280 var disable = operation2.disabled();
82281 return disable ? _t.append("operations.downgrade." + disable + "." + _multi) : _t.append("operations.downgrade.description." + _downgradeType);
82283 operation2.annotation = function() {
82285 if (_downgradeType === "building_address") {
82286 suffix = "generic";
82288 suffix = _downgradeType;
82290 return _t("operations.downgrade.annotation." + suffix, { n: _affectedFeatureCount });
82292 operation2.id = "downgrade";
82293 operation2.keys = [uiCmd("\u232B")];
82294 operation2.title = _t.append("operations.downgrade.title");
82295 operation2.behavior = behaviorOperation(context).which(operation2);
82299 // modules/operations/extract.js
82300 function operationExtract(context, selectedIDs) {
82301 var _amount = selectedIDs.length === 1 ? "single" : "multiple";
82302 var _geometries = utilArrayUniq(selectedIDs.map(function(entityID) {
82303 return context.graph().hasEntity(entityID) && context.graph().geometry(entityID);
82304 }).filter(Boolean));
82305 var _geometryID = _geometries.length === 1 ? _geometries[0] : "feature";
82307 var _actions = selectedIDs.map(function(entityID) {
82308 var graph = context.graph();
82309 var entity = graph.hasEntity(entityID);
82310 if (!entity || !entity.hasInterestingTags()) return null;
82311 if (entity.type === "node" && graph.parentWays(entity).length === 0) return null;
82312 if (entity.type !== "node") {
82313 var preset = _mainPresetIndex.match(entity, graph);
82314 if (preset.geometry.indexOf("point") === -1) return null;
82316 _extent = _extent ? _extent.extend(entity.extent(graph)) : entity.extent(graph);
82317 return actionExtract(entityID, context.projection);
82318 }).filter(Boolean);
82319 var operation2 = function() {
82320 var combinedAction = function(graph) {
82321 _actions.forEach(function(action) {
82322 graph = action(graph);
82326 context.perform(combinedAction, operation2.annotation());
82327 var extractedNodeIDs = _actions.map(function(action) {
82328 return action.getExtractedNodeID();
82330 context.enter(modeSelect(context, extractedNodeIDs));
82332 operation2.available = function() {
82333 return _actions.length && selectedIDs.length === _actions.length;
82335 operation2.disabled = function() {
82336 if (_extent && _extent.percentContainedIn(context.map().extent()) < 0.8) {
82337 return "too_large";
82338 } else if (selectedIDs.some(function(entityID) {
82339 return context.graph().geometry(entityID) === "vertex" && context.hasHiddenConnections(entityID);
82341 return "connected_to_hidden";
82345 operation2.tooltip = function() {
82346 var disableReason = operation2.disabled();
82347 if (disableReason) {
82348 return _t.append("operations.extract." + disableReason + "." + _amount);
82350 return _t.append("operations.extract.description." + _geometryID + "." + _amount);
82353 operation2.annotation = function() {
82354 return _t("operations.extract.annotation", { n: selectedIDs.length });
82356 operation2.id = "extract";
82357 operation2.keys = [_t("operations.extract.key")];
82358 operation2.title = _t.append("operations.extract.title");
82359 operation2.behavior = behaviorOperation(context).which(operation2);
82363 // modules/operations/merge.js
82364 function operationMerge(context, selectedIDs) {
82365 var _action = getAction();
82366 function getAction() {
82367 var join = actionJoin(selectedIDs);
82368 if (!join.disabled(context.graph())) return join;
82369 var merge2 = actionMerge(selectedIDs);
82370 if (!merge2.disabled(context.graph())) return merge2;
82371 var mergePolygon = actionMergePolygon(selectedIDs);
82372 if (!mergePolygon.disabled(context.graph())) return mergePolygon;
82373 var mergeNodes = actionMergeNodes(selectedIDs);
82374 if (!mergeNodes.disabled(context.graph())) return mergeNodes;
82375 if (join.disabled(context.graph()) !== "not_eligible") return join;
82376 if (merge2.disabled(context.graph()) !== "not_eligible") return merge2;
82377 if (mergePolygon.disabled(context.graph()) !== "not_eligible") return mergePolygon;
82380 var operation2 = function() {
82381 if (operation2.disabled()) return;
82382 context.perform(_action, operation2.annotation());
82383 context.validator().validate();
82384 var resultIDs = selectedIDs.filter(context.hasEntity);
82385 if (resultIDs.length > 1) {
82386 var interestingIDs = resultIDs.filter(function(id2) {
82387 return context.entity(id2).hasInterestingTags();
82389 if (interestingIDs.length) resultIDs = interestingIDs;
82391 context.enter(modeSelect(context, resultIDs));
82393 operation2.available = function() {
82394 return selectedIDs.length >= 2;
82396 operation2.disabled = function() {
82397 var actionDisabled = _action.disabled(context.graph());
82398 if (actionDisabled) return actionDisabled;
82399 var osm = context.connection();
82400 if (osm && _action.resultingWayNodesLength && _action.resultingWayNodesLength(context.graph()) > osm.maxWayNodes()) {
82401 return "too_many_vertices";
82405 operation2.tooltip = function() {
82406 var disabled = operation2.disabled();
82408 if (disabled === "conflicting_relations") {
82409 return _t.append("operations.merge.conflicting_relations");
82411 if (disabled === "restriction" || disabled === "connectivity") {
82413 "operations.merge.damage_relation",
82414 { relation: _mainPresetIndex.item("type/" + disabled).name() }
82417 return _t.append("operations.merge." + disabled);
82419 return _t.append("operations.merge.description");
82421 operation2.annotation = function() {
82422 return _t("operations.merge.annotation", { n: selectedIDs.length });
82424 operation2.id = "merge";
82425 operation2.keys = [_t("operations.merge.key")];
82426 operation2.title = _t.append("operations.merge.title");
82427 operation2.behavior = behaviorOperation(context).which(operation2);
82431 // modules/operations/paste.js
82432 function operationPaste(context) {
82434 var operation2 = function() {
82435 if (!_pastePoint) return;
82436 var oldIDs = context.copyIDs();
82437 if (!oldIDs.length) return;
82438 var projection2 = context.projection;
82439 var extent = geoExtent();
82440 var oldGraph = context.copyGraph();
82442 var action = actionCopyEntities(oldIDs, oldGraph);
82443 context.perform(action);
82444 var copies = action.copies();
82445 var originals = /* @__PURE__ */ new Set();
82446 Object.values(copies).forEach(function(entity) {
82447 originals.add(entity.id);
82449 for (var id2 in copies) {
82450 var oldEntity = oldGraph.entity(id2);
82451 var newEntity = copies[id2];
82452 extent._extend(oldEntity.extent(oldGraph));
82453 var parents = context.graph().parentWays(newEntity);
82454 var parentCopied = parents.some(function(parent) {
82455 return originals.has(parent.id);
82457 if (!parentCopied) {
82458 newIDs.push(newEntity.id);
82461 var copyPoint = context.copyLonLat() && projection2(context.copyLonLat()) || projection2(extent.center());
82462 var delta = geoVecSubtract(_pastePoint, copyPoint);
82463 context.replace(actionMove(newIDs, delta, projection2), operation2.annotation());
82464 context.enter(modeSelect(context, newIDs));
82466 operation2.point = function(val) {
82470 operation2.available = function() {
82471 return context.mode().id === "browse";
82473 operation2.disabled = function() {
82474 return !context.copyIDs().length;
82476 operation2.tooltip = function() {
82477 var oldGraph = context.copyGraph();
82478 var ids = context.copyIDs();
82480 return _t.append("operations.paste.nothing_copied");
82482 return _t.append("operations.paste.description", { feature: utilDisplayLabel(oldGraph.entity(ids[0]), oldGraph), n: ids.length });
82484 operation2.annotation = function() {
82485 var ids = context.copyIDs();
82486 return _t("operations.paste.annotation", { n: ids.length });
82488 operation2.id = "paste";
82489 operation2.keys = [uiCmd("\u2318V")];
82490 operation2.title = _t.append("operations.paste.title");
82494 // modules/operations/reverse.js
82495 function operationReverse(context, selectedIDs) {
82496 var operation2 = function() {
82497 context.perform(function combinedReverseAction(graph) {
82498 actions().forEach(function(action) {
82499 graph = action(graph);
82502 }, operation2.annotation());
82503 context.validator().validate();
82505 function actions(situation) {
82506 return selectedIDs.map(function(entityID) {
82507 var entity = context.hasEntity(entityID);
82508 if (!entity) return null;
82509 if (situation === "toolbar") {
82510 if (entity.type === "way" && (!entity.isOneWay() && !entity.isSided())) return null;
82512 var geometry = entity.geometry(context.graph());
82513 if (entity.type !== "node" && geometry !== "line") return null;
82514 var action = actionReverse(entityID);
82515 if (action.disabled(context.graph())) return null;
82517 }).filter(Boolean);
82519 function reverseTypeID() {
82520 var acts = actions();
82521 var nodeActionCount = acts.filter(function(act) {
82522 var entity = context.hasEntity(act.entityID());
82523 return entity && entity.type === "node";
82525 if (nodeActionCount === 0) return "line";
82526 if (nodeActionCount === acts.length) return "point";
82529 operation2.available = function(situation) {
82530 return actions(situation).length > 0;
82532 operation2.disabled = function() {
82535 operation2.tooltip = function() {
82536 return _t.append("operations.reverse.description." + reverseTypeID());
82538 operation2.annotation = function() {
82539 var acts = actions();
82540 return _t("operations.reverse.annotation." + reverseTypeID(), { n: acts.length });
82542 operation2.id = "reverse";
82543 operation2.keys = [_t("operations.reverse.key")];
82544 operation2.title = _t.append("operations.reverse.title");
82545 operation2.behavior = behaviorOperation(context).which(operation2);
82549 // modules/operations/split.js
82550 function operationSplit(context, selectedIDs) {
82551 var _vertexIds = selectedIDs.filter(function(id2) {
82552 return context.graph().geometry(id2) === "vertex";
82554 var _selectedWayIds = selectedIDs.filter(function(id2) {
82555 var entity = context.graph().hasEntity(id2);
82556 return entity && entity.type === "way";
82558 var _isAvailable = _vertexIds.length > 0 && _vertexIds.length + _selectedWayIds.length === selectedIDs.length;
82559 var _action = actionSplit(_vertexIds);
82561 var _geometry = "feature";
82562 var _waysAmount = "single";
82563 var _nodesAmount = _vertexIds.length === 1 ? "single" : "multiple";
82564 if (_isAvailable) {
82565 if (_selectedWayIds.length) _action.limitWays(_selectedWayIds);
82566 _ways = _action.ways(context.graph());
82567 var geometries = {};
82568 _ways.forEach(function(way) {
82569 geometries[way.geometry(context.graph())] = true;
82571 if (Object.keys(geometries).length === 1) {
82572 _geometry = Object.keys(geometries)[0];
82574 _waysAmount = _ways.length === 1 ? "single" : "multiple";
82576 var operation2 = function() {
82577 var difference2 = context.perform(_action, operation2.annotation());
82578 var idsToSelect = _vertexIds.concat(difference2.extantIDs().filter(function(id2) {
82579 return context.entity(id2).type === "way";
82581 context.enter(modeSelect(context, idsToSelect));
82583 operation2.relatedEntityIds = function() {
82584 return _selectedWayIds.length ? [] : _ways.map((way) => way.id);
82586 operation2.available = function() {
82587 return _isAvailable;
82589 operation2.disabled = function() {
82590 var reason = _action.disabled(context.graph());
82593 } else if (selectedIDs.some(context.hasHiddenConnections)) {
82594 return "connected_to_hidden";
82598 operation2.tooltip = function() {
82599 var disable = operation2.disabled();
82600 return disable ? _t.append("operations.split." + disable) : _t.append("operations.split.description." + _geometry + "." + _waysAmount + "." + _nodesAmount + "_node");
82602 operation2.annotation = function() {
82603 return _t("operations.split.annotation." + _geometry, { n: _ways.length });
82605 operation2.icon = function() {
82606 if (_waysAmount === "multiple") {
82607 return "#iD-operation-split-multiple";
82609 return "#iD-operation-split";
82612 operation2.id = "split";
82613 operation2.keys = [_t("operations.split.key")];
82614 operation2.title = _t.append("operations.split.title");
82615 operation2.behavior = behaviorOperation(context).which(operation2);
82619 // modules/operations/straighten.js
82620 function operationStraighten(context, selectedIDs) {
82621 var _wayIDs = selectedIDs.filter(function(id2) {
82622 return id2.charAt(0) === "w";
82624 var _nodeIDs = selectedIDs.filter(function(id2) {
82625 return id2.charAt(0) === "n";
82627 var _amount = (_wayIDs.length ? _wayIDs : _nodeIDs).length === 1 ? "single" : "multiple";
82628 var _nodes = utilGetAllNodes(selectedIDs, context.graph());
82629 var _coords = _nodes.map(function(n3) {
82632 var _extent = utilTotalExtent(selectedIDs, context.graph());
82633 var _action = chooseAction();
82635 function chooseAction() {
82636 if (_wayIDs.length === 0 && _nodeIDs.length > 2) {
82637 _geometry = "point";
82638 return actionStraightenNodes(_nodeIDs, context.projection);
82639 } else if (_wayIDs.length > 0 && (_nodeIDs.length === 0 || _nodeIDs.length === 2)) {
82640 var startNodeIDs = [];
82641 var endNodeIDs = [];
82642 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82643 var entity = context.entity(selectedIDs[i3]);
82644 if (entity.type === "node") {
82646 } else if (entity.type !== "way" || entity.isClosed()) {
82649 startNodeIDs.push(entity.first());
82650 endNodeIDs.push(entity.last());
82652 startNodeIDs = startNodeIDs.filter(function(n3) {
82653 return startNodeIDs.indexOf(n3) === startNodeIDs.lastIndexOf(n3);
82655 endNodeIDs = endNodeIDs.filter(function(n3) {
82656 return endNodeIDs.indexOf(n3) === endNodeIDs.lastIndexOf(n3);
82658 if (utilArrayDifference(startNodeIDs, endNodeIDs).length + utilArrayDifference(endNodeIDs, startNodeIDs).length !== 2) return null;
82659 var wayNodeIDs = utilGetAllNodes(_wayIDs, context.graph()).map(function(node) {
82662 if (wayNodeIDs.length <= 2) return null;
82663 if (_nodeIDs.length === 2 && (wayNodeIDs.indexOf(_nodeIDs[0]) === -1 || wayNodeIDs.indexOf(_nodeIDs[1]) === -1)) return null;
82664 if (_nodeIDs.length) {
82665 _extent = utilTotalExtent(_nodeIDs, context.graph());
82667 _geometry = "line";
82668 return actionStraightenWay(selectedIDs, context.projection);
82672 function operation2() {
82673 if (!_action) return;
82674 context.perform(_action, operation2.annotation());
82675 window.setTimeout(function() {
82676 context.validator().validate();
82679 operation2.available = function() {
82680 return Boolean(_action);
82682 operation2.disabled = function() {
82683 var reason = _action.disabled(context.graph());
82686 } else if (_extent.percentContainedIn(context.map().extent()) < 0.8) {
82687 return "too_large";
82688 } else if (someMissing()) {
82689 return "not_downloaded";
82690 } else if (selectedIDs.some(context.hasHiddenConnections)) {
82691 return "connected_to_hidden";
82694 function someMissing() {
82695 if (context.inIntro()) return false;
82696 var osm = context.connection();
82698 var missing = _coords.filter(function(loc) {
82699 return !osm.isDataLoaded(loc);
82701 if (missing.length) {
82702 missing.forEach(function(loc) {
82703 context.loadTileAtLoc(loc);
82711 operation2.tooltip = function() {
82712 var disable = operation2.disabled();
82713 return disable ? _t.append("operations.straighten." + disable + "." + _amount) : _t.append("operations.straighten.description." + _geometry + (_wayIDs.length === 1 ? "" : "s"));
82715 operation2.annotation = function() {
82716 return _t("operations.straighten.annotation." + _geometry, { n: _wayIDs.length ? _wayIDs.length : _nodeIDs.length });
82718 operation2.id = "straighten";
82719 operation2.keys = [_t("operations.straighten.key")];
82720 operation2.title = _t.append("operations.straighten.title");
82721 operation2.behavior = behaviorOperation(context).which(operation2);
82725 // modules/modes/select.js
82726 function modeSelect(context, selectedIDs) {
82731 var keybinding = utilKeybinding("select");
82732 var _breatheBehavior = behaviorBreathe(context);
82733 var _modeDragNode = modeDragNode(context);
82734 var _selectBehavior;
82735 var _behaviors = [];
82736 var _operations = [];
82737 var _newFeature = false;
82738 var _follow = false;
82739 var _focusedParentWayId;
82740 var _focusedVertexIds;
82741 function singular() {
82742 if (selectedIDs && selectedIDs.length === 1) {
82743 return context.hasEntity(selectedIDs[0]);
82746 function selectedEntities() {
82747 return selectedIDs.map(function(id2) {
82748 return context.hasEntity(id2);
82749 }).filter(Boolean);
82751 function checkSelectedIDs() {
82753 if (Array.isArray(selectedIDs)) {
82754 ids = selectedIDs.filter(function(id2) {
82755 return context.hasEntity(id2);
82759 context.enter(modeBrowse(context));
82761 } else if (selectedIDs.length > 1 && ids.length === 1 || selectedIDs.length === 1 && ids.length > 1) {
82762 context.enter(modeSelect(context, ids));
82768 function parentWaysIdsOfSelection(onlyCommonParents) {
82769 var graph = context.graph();
82771 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82772 var entity = context.hasEntity(selectedIDs[i3]);
82773 if (!entity || entity.geometry(graph) !== "vertex") {
82776 var currParents = graph.parentWays(entity).map(function(w2) {
82779 if (!parents.length) {
82780 parents = currParents;
82783 parents = (onlyCommonParents ? utilArrayIntersection : utilArrayUnion)(parents, currParents);
82784 if (!parents.length) {
82790 function childNodeIdsOfSelection(onlyCommon) {
82791 var graph = context.graph();
82793 for (var i3 = 0; i3 < selectedIDs.length; i3++) {
82794 var entity = context.hasEntity(selectedIDs[i3]);
82795 if (!entity || !["area", "line"].includes(entity.geometry(graph))) {
82798 var currChilds = graph.childNodes(entity).map(function(node) {
82801 if (!childs.length) {
82802 childs = currChilds;
82805 childs = (onlyCommon ? utilArrayIntersection : utilArrayUnion)(childs, currChilds);
82806 if (!childs.length) {
82812 function checkFocusedParent() {
82813 if (_focusedParentWayId) {
82814 var parents = parentWaysIdsOfSelection(true);
82815 if (parents.indexOf(_focusedParentWayId) === -1) _focusedParentWayId = null;
82818 function parentWayIdForVertexNavigation() {
82819 var parentIds = parentWaysIdsOfSelection(true);
82820 if (_focusedParentWayId && parentIds.indexOf(_focusedParentWayId) !== -1) {
82821 return _focusedParentWayId;
82823 return parentIds.length ? parentIds[0] : null;
82825 mode.selectedIDs = function(val) {
82826 if (!arguments.length) return selectedIDs;
82830 mode.zoomToSelected = function() {
82831 context.map().zoomToEase(selectedEntities());
82833 mode.newFeature = function(val) {
82834 if (!arguments.length) return _newFeature;
82838 mode.selectBehavior = function(val) {
82839 if (!arguments.length) return _selectBehavior;
82840 _selectBehavior = val;
82843 mode.follow = function(val) {
82844 if (!arguments.length) return _follow;
82848 function loadOperations() {
82849 _operations.forEach(function(operation2) {
82850 if (operation2.behavior) {
82851 context.uninstall(operation2.behavior);
82854 _operations = Object.values(operations_exports).map(function(o2) {
82855 return o2(context, selectedIDs);
82856 }).filter(function(o2) {
82857 return o2.id !== "delete" && o2.id !== "downgrade" && o2.id !== "copy";
82859 // group copy/downgrade/delete operation together at the end of the list
82860 operationCopy(context, selectedIDs),
82861 operationDowngrade(context, selectedIDs),
82862 operationDelete(context, selectedIDs)
82863 ]).filter(function(operation2) {
82864 return operation2.available();
82866 _operations.forEach(function(operation2) {
82867 if (operation2.behavior) {
82868 context.install(operation2.behavior);
82871 context.ui().closeEditMenu();
82873 mode.operations = function() {
82874 return _operations;
82876 mode.enter = function() {
82877 if (!checkSelectedIDs()) return;
82878 context.features().forceVisible(selectedIDs);
82879 _modeDragNode.restoreSelectedIDs(selectedIDs);
82881 if (!_behaviors.length) {
82882 if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
82884 behaviorPaste(context),
82886 behaviorHover(context).on("hover", context.ui().sidebar.hoverModeSelect),
82888 behaviorLasso(context),
82889 _modeDragNode.behavior,
82890 modeDragNote(context).behavior
82893 _behaviors.forEach(context.install);
82894 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);
82895 select_default2(document).call(keybinding);
82896 context.ui().sidebar.select(selectedIDs, _newFeature);
82897 context.history().on("change.select", function() {
82900 }).on("undone.select", checkSelectedIDs).on("redone.select", checkSelectedIDs);
82901 context.map().on("drawn.select", selectElements).on("crossEditableZoom.select", function() {
82903 _breatheBehavior.restartIfNeeded(context.surface());
82905 context.map().doubleUpHandler().on("doubleUp.modeSelect", didDoubleUp);
82908 var extent = geoExtent();
82909 var graph = context.graph();
82910 selectedIDs.forEach(function(id2) {
82911 var entity = context.entity(id2);
82912 extent._extend(entity.extent(graph));
82914 var loc = extent.center();
82915 context.map().centerEase(loc);
82918 function nudgeSelection(delta) {
82919 return function() {
82920 if (!context.map().withinEditableZoom()) return;
82921 var moveOp = operationMove(context, selectedIDs);
82922 if (moveOp.disabled()) {
82923 context.ui().flash.duration(4e3).iconName("#iD-operation-" + moveOp.id).iconClass("operation disabled").label(moveOp.tooltip())();
82925 context.perform(actionMove(selectedIDs, delta, context.projection), moveOp.annotation());
82926 context.validator().validate();
82930 function scaleSelection(factor) {
82931 return function() {
82932 if (!context.map().withinEditableZoom()) return;
82933 let nodes = utilGetAllNodes(selectedIDs, context.graph());
82934 let isUp = factor > 1;
82935 if (nodes.length <= 1) return;
82936 let extent2 = utilTotalExtent(selectedIDs, context.graph());
82937 function scalingDisabled() {
82939 return "too_small";
82940 } else if (extent2.percentContainedIn(context.map().extent()) < 0.8) {
82941 return "too_large";
82942 } else if (someMissing() || selectedIDs.some(incompleteRelation)) {
82943 return "not_downloaded";
82944 } else if (selectedIDs.some(context.hasHiddenConnections)) {
82945 return "connected_to_hidden";
82948 function tooSmall() {
82949 if (isUp) return false;
82950 let dLon = Math.abs(extent2[1][0] - extent2[0][0]);
82951 let dLat = Math.abs(extent2[1][1] - extent2[0][1]);
82952 return dLon < geoMetersToLon(1, extent2[1][1]) && dLat < geoMetersToLat(1);
82954 function someMissing() {
82955 if (context.inIntro()) return false;
82956 let osm = context.connection();
82958 let missing = nodes.filter(function(n3) {
82959 return !osm.isDataLoaded(n3.loc);
82961 if (missing.length) {
82962 missing.forEach(function(loc2) {
82963 context.loadTileAtLoc(loc2);
82970 function incompleteRelation(id2) {
82971 let entity = context.entity(id2);
82972 return entity.type === "relation" && !entity.isComplete(context.graph());
82975 const disabled = scalingDisabled();
82977 let multi = selectedIDs.length === 1 ? "single" : "multiple";
82978 context.ui().flash.duration(4e3).iconName("#iD-icon-no").iconClass("operation disabled").label(_t.append("operations.scale." + disabled + "." + multi))();
82980 const pivot = context.projection(extent2.center());
82981 const annotation = _t("operations.scale.annotation." + (isUp ? "up" : "down") + ".feature", { n: selectedIDs.length });
82982 context.perform(actionScale(selectedIDs, pivot, factor, context.projection), annotation);
82983 context.validator().validate();
82987 function didDoubleUp(d3_event, loc2) {
82988 if (!context.map().withinEditableZoom()) return;
82989 var target = select_default2(d3_event.target);
82990 var datum2 = target.datum();
82991 var entity = datum2 && datum2.properties && datum2.properties.entity;
82992 if (!entity) return;
82993 if (entity instanceof osmWay && target.classed("target")) {
82994 var choice = geoChooseEdge(context.graph().childNodes(entity), loc2, context.projection);
82995 var prev = entity.nodes[choice.index - 1];
82996 var next = entity.nodes[choice.index];
82998 actionAddMidpoint({ loc: choice.loc, edge: [prev, next] }, osmNode()),
82999 _t("operations.add.annotation.vertex")
83001 context.validator().validate();
83002 } else if (entity.type === "midpoint") {
83004 actionAddMidpoint({ loc: entity.loc, edge: entity.edge }, osmNode()),
83005 _t("operations.add.annotation.vertex")
83007 context.validator().validate();
83010 function selectElements() {
83011 if (!checkSelectedIDs()) return;
83012 var surface = context.surface();
83013 surface.selectAll(".selected-member").classed("selected-member", false);
83014 surface.selectAll(".selected").classed("selected", false);
83015 surface.selectAll(".related").classed("related", false);
83016 checkFocusedParent();
83017 if (_focusedParentWayId) {
83018 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
83020 if (context.map().withinEditableZoom()) {
83021 surface.selectAll(utilDeepMemberSelector(
83025 /* skipMultipolgonMembers */
83026 )).classed("selected-member", true);
83027 surface.selectAll(utilEntityOrDeepMemberSelector(selectedIDs, context.graph())).classed("selected", true);
83031 if (context.container().select(".combobox").size()) return;
83032 context.enter(modeBrowse(context));
83034 function firstVertex(d3_event) {
83035 d3_event.preventDefault();
83036 var entity = singular();
83037 var parentId = parentWayIdForVertexNavigation();
83039 if (entity && entity.type === "way") {
83041 } else if (parentId) {
83042 way = context.entity(parentId);
83044 _focusedParentWayId = way && way.id;
83047 mode.selectedIDs([way.first()]).follow(true)
83051 function lastVertex(d3_event) {
83052 d3_event.preventDefault();
83053 var entity = singular();
83054 var parentId = parentWayIdForVertexNavigation();
83056 if (entity && entity.type === "way") {
83058 } else if (parentId) {
83059 way = context.entity(parentId);
83061 _focusedParentWayId = way && way.id;
83064 mode.selectedIDs([way.last()]).follow(true)
83068 function previousVertex(d3_event) {
83069 d3_event.preventDefault();
83070 var parentId = parentWayIdForVertexNavigation();
83071 _focusedParentWayId = parentId;
83072 if (!parentId) return;
83073 var way = context.entity(parentId);
83074 var length2 = way.nodes.length;
83075 var curr = way.nodes.indexOf(selectedIDs[0]);
83079 } else if (way.isClosed()) {
83080 index = length2 - 2;
83082 if (index !== -1) {
83084 mode.selectedIDs([way.nodes[index]]).follow(true)
83088 function nextVertex(d3_event) {
83089 d3_event.preventDefault();
83090 var parentId = parentWayIdForVertexNavigation();
83091 _focusedParentWayId = parentId;
83092 if (!parentId) return;
83093 var way = context.entity(parentId);
83094 var length2 = way.nodes.length;
83095 var curr = way.nodes.indexOf(selectedIDs[0]);
83097 if (curr < length2 - 1) {
83099 } else if (way.isClosed()) {
83102 if (index !== -1) {
83104 mode.selectedIDs([way.nodes[index]]).follow(true)
83108 function focusNextParent(d3_event) {
83109 d3_event.preventDefault();
83110 var parents = parentWaysIdsOfSelection(true);
83111 if (!parents || parents.length < 2) return;
83112 var index = parents.indexOf(_focusedParentWayId);
83113 if (index < 0 || index > parents.length - 2) {
83114 _focusedParentWayId = parents[0];
83116 _focusedParentWayId = parents[index + 1];
83118 var surface = context.surface();
83119 surface.selectAll(".related").classed("related", false);
83120 if (_focusedParentWayId) {
83121 surface.selectAll(utilEntitySelector([_focusedParentWayId])).classed("related", true);
83124 function selectParent(d3_event) {
83125 d3_event.preventDefault();
83126 var currentSelectedIds = mode.selectedIDs();
83127 var parentIds = _focusedParentWayId ? [_focusedParentWayId] : parentWaysIdsOfSelection(false);
83128 if (!parentIds.length) return;
83130 mode.selectedIDs(parentIds)
83132 _focusedVertexIds = currentSelectedIds;
83134 function selectChild(d3_event) {
83135 d3_event.preventDefault();
83136 var currentSelectedIds = mode.selectedIDs();
83137 var childIds = _focusedVertexIds ? _focusedVertexIds.filter((id2) => context.hasEntity(id2)) : childNodeIdsOfSelection(true);
83138 if (!childIds || !childIds.length) return;
83139 if (currentSelectedIds.length === 1) _focusedParentWayId = currentSelectedIds[0];
83141 mode.selectedIDs(childIds)
83145 mode.exit = function() {
83146 _newFeature = false;
83147 _focusedVertexIds = null;
83148 _operations.forEach(function(operation2) {
83149 if (operation2.behavior) {
83150 context.uninstall(operation2.behavior);
83154 _behaviors.forEach(context.uninstall);
83155 select_default2(document).call(keybinding.unbind);
83156 context.ui().closeEditMenu();
83157 context.history().on("change.select", null).on("undone.select", null).on("redone.select", null);
83158 var surface = context.surface();
83159 surface.selectAll(".selected-member").classed("selected-member", false);
83160 surface.selectAll(".selected").classed("selected", false);
83161 surface.selectAll(".highlighted").classed("highlighted", false);
83162 surface.selectAll(".related").classed("related", false);
83163 context.map().on("drawn.select", null);
83164 context.ui().sidebar.hide();
83165 context.features().forceVisible([]);
83166 var entity = singular();
83167 if (_newFeature && entity && entity.type === "relation" && // no tags
83168 Object.keys(entity.tags).length === 0 && // no parent relations
83169 context.graph().parentRelations(entity).length === 0 && // no members or one member with no role
83170 (entity.members.length === 0 || entity.members.length === 1 && !entity.members[0].role)) {
83171 var deleteAction = actionDeleteRelation(
83174 /* don't delete untagged members */
83176 context.perform(deleteAction, _t("operations.delete.annotation.relation"));
83177 context.validator().validate();
83183 // modules/behavior/lasso.js
83184 function behaviorLasso(context) {
83185 var _pointerPrefix = "PointerEvent" in window ? "pointer" : "mouse";
83186 var behavior = function(selection2) {
83188 function pointerdown(d3_event) {
83190 if (d3_event.button === button && d3_event.shiftKey === true) {
83192 select_default2(window).on(_pointerPrefix + "move.lasso", pointermove).on(_pointerPrefix + "up.lasso", pointerup);
83193 d3_event.stopPropagation();
83196 function pointermove() {
83198 lasso = uiLasso(context);
83199 context.surface().call(lasso);
83201 lasso.p(context.map().mouse());
83203 function normalize2(a2, b2) {
83205 [Math.min(a2[0], b2[0]), Math.min(a2[1], b2[1])],
83206 [Math.max(a2[0], b2[0]), Math.max(a2[1], b2[1])]
83209 function lassoed() {
83210 if (!lasso) return [];
83211 var graph = context.graph();
83213 if (context.map().editableDataEnabled(
83215 /* skipZoomCheck */
83216 ) && context.map().isInWideSelection()) {
83217 limitToNodes = new Set(utilGetAllNodes(context.selectedIDs(), graph));
83218 } else if (!context.map().editableDataEnabled()) {
83221 var bounds = lasso.extent().map(context.projection.invert);
83222 var extent = geoExtent(normalize2(bounds[0], bounds[1]));
83223 var intersects2 = context.history().intersects(extent).filter(function(entity) {
83224 return entity.type === "node" && (!limitToNodes || limitToNodes.has(entity)) && geoPointInPolygon(context.projection(entity.loc), lasso.coordinates) && !context.features().isHidden(entity, graph, entity.geometry(graph));
83226 intersects2.sort(function(node1, node2) {
83227 var parents1 = graph.parentWays(node1);
83228 var parents2 = graph.parentWays(node2);
83229 if (parents1.length && parents2.length) {
83230 var sharedParents = utilArrayIntersection(parents1, parents2);
83231 if (sharedParents.length) {
83232 var sharedParentNodes = sharedParents[0].nodes;
83233 return sharedParentNodes.indexOf(node1.id) - sharedParentNodes.indexOf(node2.id);
83235 return Number(parents1[0].id.slice(1)) - Number(parents2[0].id.slice(1));
83237 } else if (parents1.length || parents2.length) {
83238 return parents1.length - parents2.length;
83240 return node1.loc[0] - node2.loc[0];
83242 return intersects2.map(function(entity) {
83246 function pointerup() {
83247 select_default2(window).on(_pointerPrefix + "move.lasso", null).on(_pointerPrefix + "up.lasso", null);
83248 if (!lasso) return;
83249 var ids = lassoed();
83252 context.enter(modeSelect(context, ids));
83255 selection2.on(_pointerPrefix + "down.lasso", pointerdown);
83257 behavior.off = function(selection2) {
83258 selection2.on(_pointerPrefix + "down.lasso", null);
83263 // modules/modes/browse.js
83264 function modeBrowse(context) {
83268 title: _t.append("modes.browse.title"),
83269 description: _t.append("modes.browse.description")
83272 var _selectBehavior;
83273 var _behaviors = [];
83274 mode.selectBehavior = function(val) {
83275 if (!arguments.length) return _selectBehavior;
83276 _selectBehavior = val;
83279 mode.enter = function() {
83280 if (!_behaviors.length) {
83281 if (!_selectBehavior) _selectBehavior = behaviorSelect(context);
83283 behaviorPaste(context),
83284 behaviorHover(context).on("hover", context.ui().sidebar.hover),
83286 behaviorLasso(context),
83287 modeDragNode(context).behavior,
83288 modeDragNote(context).behavior
83291 _behaviors.forEach(context.install);
83292 if (document.activeElement && document.activeElement.blur) {
83293 document.activeElement.blur();
83296 context.ui().sidebar.show(sidebar);
83298 context.ui().sidebar.select(null);
83301 mode.exit = function() {
83302 context.ui().sidebar.hover.cancel();
83303 _behaviors.forEach(context.uninstall);
83305 context.ui().sidebar.hide();
83308 mode.sidebar = function(_2) {
83309 if (!arguments.length) return sidebar;
83313 mode.operations = function() {
83314 return [operationPaste(context)];
83319 // modules/behavior/add_way.js
83320 function behaviorAddWay(context) {
83321 var dispatch14 = dispatch_default("start", "startFromWay", "startFromNode");
83322 var draw = behaviorDraw(context);
83323 function behavior(surface) {
83324 draw.on("click", function() {
83325 dispatch14.apply("start", this, arguments);
83326 }).on("clickWay", function() {
83327 dispatch14.apply("startFromWay", this, arguments);
83328 }).on("clickNode", function() {
83329 dispatch14.apply("startFromNode", this, arguments);
83330 }).on("cancel", behavior.cancel).on("finish", behavior.cancel);
83331 context.map().dblclickZoomEnable(false);
83332 surface.call(draw);
83334 behavior.off = function(surface) {
83335 surface.call(draw.off);
83337 behavior.cancel = function() {
83338 window.setTimeout(function() {
83339 context.map().dblclickZoomEnable(true);
83341 context.enter(modeBrowse(context));
83343 return utilRebind(behavior, dispatch14, "on");
83346 // modules/behavior/hash.js
83347 function behaviorHash(context) {
83348 var _cachedHash = null;
83349 var _latitudeLimit = 90 - 1e-8;
83350 function computedHashParameters() {
83351 var map2 = context.map();
83352 var center = map2.center();
83353 var zoom = map2.zoom();
83354 var precision3 = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
83355 var oldParams = utilObjectOmit(
83356 utilStringQs(window.location.hash),
83357 ["comment", "source", "hashtags", "walkthrough"]
83359 var newParams = {};
83360 delete oldParams.id;
83361 var selected = context.selectedIDs().filter(function(id2) {
83362 return context.hasEntity(id2);
83364 if (selected.length) {
83365 newParams.id = selected.join(",");
83366 } else if (context.selectedNoteID()) {
83367 newParams.id = "note/".concat(context.selectedNoteID());
83369 newParams.map = zoom.toFixed(2) + "/" + center[1].toFixed(precision3) + "/" + center[0].toFixed(precision3);
83370 return Object.assign(oldParams, newParams);
83372 function computedHash() {
83373 return "#" + utilQsString(computedHashParameters(), true);
83375 function computedTitle(includeChangeCount) {
83376 var baseTitle = context.documentTitleBase() || "iD";
83380 var selected = context.selectedIDs().filter(function(id2) {
83381 return context.hasEntity(id2);
83383 if (selected.length) {
83384 var firstLabel = utilDisplayLabel(context.entity(selected[0]), context.graph());
83385 if (selected.length > 1) {
83386 contextual = _t("title.labeled_and_more", {
83387 labeled: firstLabel,
83388 count: selected.length - 1
83391 contextual = firstLabel;
83393 titleID = "context";
83395 if (includeChangeCount) {
83396 changeCount = context.history().difference().summary().length;
83397 if (changeCount > 0) {
83398 titleID = contextual ? "changes_context" : "changes";
83402 return _t("title.format." + titleID, {
83403 changes: changeCount,
83405 context: contextual
83410 function updateTitle(includeChangeCount) {
83411 if (!context.setsDocumentTitle()) return;
83412 var newTitle = computedTitle(includeChangeCount);
83413 if (document.title !== newTitle) {
83414 document.title = newTitle;
83417 function updateHashIfNeeded() {
83418 if (context.inIntro()) return;
83419 var latestHash = computedHash();
83420 if (_cachedHash !== latestHash) {
83421 _cachedHash = latestHash;
83422 window.history.replaceState(null, computedTitle(
83424 /* includeChangeCount */
83428 /* includeChangeCount */
83430 const q2 = utilStringQs(latestHash);
83432 corePreferences("map-location", q2.map);
83436 var _throttledUpdate = throttle_default(updateHashIfNeeded, 500);
83437 var _throttledUpdateTitle = throttle_default(function() {
83440 /* includeChangeCount */
83443 function hashchange() {
83444 if (window.location.hash === _cachedHash) return;
83445 _cachedHash = window.location.hash;
83446 var q2 = utilStringQs(_cachedHash);
83447 var mapArgs = (q2.map || "").split("/").map(Number);
83448 if (mapArgs.length < 3 || mapArgs.some(isNaN)) {
83449 updateHashIfNeeded();
83451 if (_cachedHash === computedHash()) return;
83452 var mode = context.mode();
83453 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83454 if (q2.id && mode) {
83455 var ids = q2.id.split(",").filter(function(id2) {
83456 return context.hasEntity(id2) || id2.startsWith("note/");
83458 if (ids.length && ["browse", "select-note", "select"].includes(mode.id)) {
83459 if (ids.length === 1 && ids[0].startsWith("note/")) {
83460 context.enter(modeSelectNote(context, ids[0]));
83461 } else if (!utilArrayIdentical(mode.selectedIDs(), ids)) {
83462 context.enter(modeSelect(context, ids));
83467 var center = context.map().center();
83468 var dist = geoSphericalDistance(center, [mapArgs[2], mapArgs[1]]);
83470 if (mode && mode.id.match(/^draw/) !== null && dist > maxdist) {
83471 context.enter(modeBrowse(context));
83476 function behavior() {
83477 context.map().on("move.behaviorHash", _throttledUpdate);
83478 context.history().on("change.behaviorHash", _throttledUpdateTitle);
83479 context.on("enter.behaviorHash", _throttledUpdate);
83480 select_default2(window).on("hashchange.behaviorHash", hashchange);
83481 var q2 = utilStringQs(window.location.hash);
83483 const selectIds = q2.id.split(",");
83484 if (selectIds.length === 1 && selectIds[0].startsWith("note/")) {
83485 const noteId = selectIds[0].split("/")[1];
83486 context.zoomToNote(noteId, !q2.map);
83488 context.zoomToEntities(
83489 // convert ids to short form id: node/123 -> n123
83490 selectIds.map((id2) => id2.replace(/([nwr])[^/]*\//, "$1")),
83495 if (q2.walkthrough === "true") {
83496 behavior.startWalkthrough = true;
83499 behavior.hadLocation = true;
83500 } else if (!q2.id && corePreferences("map-location")) {
83501 const mapArgs = corePreferences("map-location").split("/").map(Number);
83502 context.map().centerZoom([mapArgs[2], Math.min(_latitudeLimit, Math.max(-_latitudeLimit, mapArgs[1]))], mapArgs[0]);
83503 updateHashIfNeeded();
83504 behavior.hadLocation = true;
83507 updateTitle(false);
83509 behavior.off = function() {
83510 _throttledUpdate.cancel();
83511 _throttledUpdateTitle.cancel();
83512 context.map().on("move.behaviorHash", null);
83513 context.on("enter.behaviorHash", null);
83514 select_default2(window).on("hashchange.behaviorHash", null);
83515 window.location.hash = "";
83520 // node_modules/d3-brush/src/brush.js
83521 var { abs: abs2, max: max2, min: min2 } = Math;
83522 function number1(e3) {
83523 return [+e3[0], +e3[1]];
83525 function number22(e3) {
83526 return [number1(e3[0]), number1(e3[1])];
83530 handles: ["w", "e"].map(type),
83531 input: function(x2, e3) {
83532 return x2 == null ? null : [[+x2[0], e3[0][1]], [+x2[1], e3[1][1]]];
83534 output: function(xy) {
83535 return xy && [xy[0][0], xy[1][0]];
83540 handles: ["n", "s"].map(type),
83541 input: function(y2, e3) {
83542 return y2 == null ? null : [[e3[0][0], +y2[0]], [e3[1][0], +y2[1]]];
83544 output: function(xy) {
83545 return xy && [xy[0][1], xy[1][1]];
83550 handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type),
83551 input: function(xy) {
83552 return xy == null ? null : number22(xy);
83554 output: function(xy) {
83558 function type(t2) {
83559 return { type: t2 };
83562 // modules/index.js
83565 dispatch: dispatch_default,
83566 geoMercator: mercator_default,
83567 geoProjection: projection,
83568 polygonArea: area_default3,
83569 polygonCentroid: centroid_default2,
83570 select: select_default2,
83571 selectAll: selectAll_default2,
83576 window.requestIdleCallback = window.requestIdleCallback || function(cb) {
83577 var start2 = Date.now();
83578 return window.requestAnimationFrame(function() {
83581 timeRemaining: function() {
83582 return Math.max(0, 50 - (Date.now() - start2));
83587 window.cancelIdleCallback = window.cancelIdleCallback || function(id2) {
83588 window.cancelAnimationFrame(id2);
83590 window.iD = modules_exports;
83592 //# sourceMappingURL=iD.js.map